Sunday, February 3, 2019

Main CO Java

 /*===========================================================================+
  |   Copyright (c) 2001, 2005 Oracle Corporation, Redwood Shores, CA, USA    |
  |                         All rights reserved.                              |
  +===========================================================================+
  |  HISTORY                                                                  |
  +===========================================================================*/
 package xxfin.oracle.apps.pos.deptreqsumm.webui;
 import oracle.apps.fnd.common.VersionInfo;
 import oracle.apps.fnd.framework.OAApplicationModule;
 import oracle.apps.fnd.framework.OAViewObject;
 import oracle.apps.fnd.framework.webui.OAControllerImpl;
 import oracle.apps.fnd.framework.webui.OAPageContext;
 import oracle.apps.fnd.framework.webui.beans.OAWebBean;
 import java.io.PrintStream;
 import java.io.Serializable;
 import java.sql.CallableStatement;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import oracle.jbo.Row;
 import oracle.apps.fnd.framework.OAException;
 import oracle.apps.fnd.framework.webui.beans.OAStyledTextBean;
import oracle.apps.fnd.framework.webui.beans.layout.OAQueryBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageStyledTextBean;
import oracle.apps.fnd.framework.webui.beans.table.OAAdvancedTableBean;
import oracle.apps.fnd.framework.webui.beans.table.OAColumnBean;
 import xxfin.oracle.apps.pos.deptreqsumm.server.xxdeptreqsummAMImpl;
 /**
  * Controller for ...
  */
 public class xxdeptreqsummCO extends OAControllerImpl
 {
   public static final String RCS_ID="$Header$";
   public static final boolean RCS_ID_RECORDED =
         VersionInfo.recordClassVersion(RCS_ID, "%packagename%");
   /**
    * Layout and page setup logic for a region.
    * @param pageContext the current OA page context
    * @param webBean the web bean corresponding to the region
    */
   public void processRequest(OAPageContext pageContext, OAWebBean webBean)
   {
     super.processRequest(pageContext, webBean);
    
     OAApplicationModule am=(OAApplicationModule)pageContext.getApplicationModule(webBean);
     OAViewObject ssumAmtVO=(OAViewObject)am.findViewObject("xxsuppsummVO");
     OAViewObject payAmtVO = (OAViewObject)am.findViewObject("xxsupppaymentsVO");
     OAViewObject invAmtVO = (OAViewObject)am.findViewObject("xxsupplierinvoicesVO");
     OAViewObject invpoAmtVO = (OAViewObject)am.findViewObject("xxsuppinvposVO");
     
      // TotalPayments Conversion
      OAWebBean TotalPaymentsAmt = webBean.findChildRecursive("TotalPayments");
      if (TotalPaymentsAmt!=null)
        {
         TotalPaymentsAmt.setAttributeValue(CURRENCY_CODE,"AED");
        }
     
      // PaymentAmount Conversion
      OAWebBean PaymentAmountAmt = webBean.findChildRecursive("PaymentAmount");
      if (PaymentAmountAmt!=null)
      {
        PaymentAmountAmt.setAttributeValue(CURRENCY_CODE,"AED");
      }
     
      //  InvoiceAmount Conversion
       OAWebBean InvoiceAmountAmt = webBean.findChildRecursive("InvoiceAmount");
       if (InvoiceAmountAmt!=null)
       {
         InvoiceAmountAmt.setAttributeValue(CURRENCY_CODE,"AED");
       }
      // TaxAmount Conversion
       OAWebBean TaxAmountAmt = webBean.findChildRecursive("TaxAmount");
       if (TaxAmountAmt!=null)
       {
         TaxAmountAmt.setAttributeValue(CURRENCY_CODE,"AED");
       }
      // TotalInvoiceAmount Conversion
       OAWebBean TotalInvoiceAmountAmt = webBean.findChildRecursive("TotalInvoiceAmount");
       if (TotalInvoiceAmountAmt!=null)
       {
         TotalInvoiceAmountAmt.setAttributeValue(CURRENCY_CODE,"AED");
       }
      
       // PoTotal Conversion
        OAWebBean PoTotalAmt = webBean.findChildRecursive("PoTotal");
        if (PoTotalAmt!=null)
        {
          PoTotalAmt.setAttributeValue(CURRENCY_CODE,"AED");
        }
       // Price Conversion
        OAWebBean PriceAmt = webBean.findChildRecursive("Price");
        if (PriceAmt!=null)
        {
          PriceAmt.setAttributeValue(CURRENCY_CODE,"AED");
        }
       // Line Amoount Conversion
        OAWebBean LineAmoountAmt = webBean.findChildRecursive("LineAmoount");
        if (LineAmoountAmt!=null)
        {
          LineAmoountAmt.setAttributeValue(CURRENCY_CODE,"AED");
        }
   }
   /**
    * Procedure to handle form submissions for form elements in
    * a region.
    * @param pageContext the current OA page context
    * @param webBean the web bean corresponding to the region
    */
   public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
   {
     super.processFormRequest(pageContext, webBean);
         
       String lv_suppId = "0";
       String lv_PayId  = "0";
       String lv_InvId  = "0";
       String lv_poid   = "0";
       OAApplicationModule am=(OAApplicationModule)pageContext.getApplicationModule(webBean);
       OAApplicationModule rootAM = pageContext.getRootApplicationModule();
       Connection conn = am.getOADBTransaction().getJdbcConnection();
       String PlsqlTraceProcQuery = "begin XXCUST_OAF_TRACE_PRO(:1,:2,:3); end;";
       try
       {
         CallableStatement PlsqlTrace = conn.prepareCall(PlsqlTraceProcQuery);
         PlsqlTrace.setString(1, "1");
         PlsqlTrace.setString(2, "xxdeptreqsummCO");
         PlsqlTrace.setString(3, "processFormRequestStarted");
         PlsqlTrace.execute();
         PlsqlTrace.close();
       } catch (Exception e) {
         throw new OAException("Error when executing PLSQL Trace Procedure. Please contact system administrator. Error :" + e);
       }
      
     OAViewObject suppsummvo=(OAViewObject)am.findViewObject("xxsuppsummVO");
     OAViewObject supppaymentsvo=(OAViewObject)am.findViewObject("xxsupppaymentsVO");
     OAViewObject suppinvvo=(OAViewObject)am.findViewObject("xxsupplierinvoicesVO");
     OAViewObject suppinvposvo=(OAViewObject)am.findViewObject("xxsuppinvposVO");
     //OAViewObject suppinvpoprsvo=(OAViewObject)am.findViewObject("xxsuppinvpoprsVO");
     OAViewObject suppinvpoprsvo=(OAViewObject)am.findViewObject("xxsuppinvpoprVO");
   
       String event = pageContext.getParameter("event");
       String paybatchname=(String)pageContext.getParameter("PaymentBatchParam");
      
       if ("supplierSelect".equals(event))
       {
          
           OAViewObject lv_xxsuppsummVO = (OAViewObject)am.findViewObject("xxsuppsummVO");
          
           Row masterRow = lv_xxsuppsummVO.getFirstFilteredRow ("SuppSelectFlag", "Y");
          
           if (lv_xxsuppsummVO != null) {
               if (masterRow != null)
               {
                 lv_xxsuppsummVO.setCurrentRow(masterRow);
                   try
                   {
                     lv_suppId = lv_xxsuppsummVO.getCurrentRow().getAttribute("SupplierId").toString();
                   }
                   catch (Exception e)
                   {
                     lv_suppId = null;
                   }
               } 
            
           }             
       }
     else if("paymentSelect".equals(event))
       {
          System.out.println("Inside paymentSelect Event");
      
          
           OAViewObject lv_xxsupppaymentsVO = (OAViewObject)am.findViewObject("xxsupppaymentsVO");
           if (lv_xxsupppaymentsVO != null) {
          
           System.out.println("Row Count: "+lv_xxsupppaymentsVO.getRowCount());
           }
          
           Row masterRow = lv_xxsupppaymentsVO.getFirstFilteredRow ("PaySelectFlag", "Y");
          
           System.out.println("Master Row Check ID : "+ masterRow.getAttribute("CheckId").toString());
          
           if (lv_xxsupppaymentsVO!=null)
           {
             if (masterRow!=null)
             {
               lv_xxsupppaymentsVO.setCurrentRow(masterRow);
               try
               {
                 lv_PayId = lv_xxsupppaymentsVO.getCurrentRow().getAttribute("CheckId").toString();
               }
               catch (Exception e)
               {
                 lv_PayId = null;
               }
              
             }
           }
           System.out.println("Current Row Check ID : "+ lv_xxsupppaymentsVO.getCurrentRow().getAttribute("CheckId").toString());
          
      
       }
       else if("invoiceSelect".equals(event))
         {
             OAViewObject lv_xxsupplierinvoicesVO = (OAViewObject)am.findViewObject("xxsupplierinvoicesVO");
                         
             Row masterRow = lv_xxsupplierinvoicesVO.getFirstFilteredRow ("InvSelectFlag", "Y");
             if (lv_xxsupplierinvoicesVO!=null)
             {
               if (masterRow!=null)
               {
                 lv_xxsupplierinvoicesVO.setCurrentRow(masterRow);
                 try
                 {
                   lv_InvId = lv_xxsupplierinvoicesVO.getCurrentRow().getAttribute("InvoiceId").toString();
                 }
                 catch (Exception e)
                 {
                   lv_InvId = null;
                 }
               }
             }
        
         }
       else if("poSelect".equals(event))
         {
             OAViewObject lv_xxsuppinvposVO = (OAViewObject)am.findViewObject("xxsuppinvposVO");
            
             Row masterRow = lv_xxsuppinvposVO.getFirstFilteredRow ("PoSelectFlag", "Y");
            
             if(lv_xxsuppinvposVO !=null)
            
             {
               if(masterRow!=null)
               {
                 lv_xxsuppinvposVO.setCurrentRow((masterRow));
                 try
                 {
                   lv_poid = lv_xxsuppinvposVO.getCurrentRow().getAttribute("PoHeaderId").toString();
                 }
                 catch (Exception e)
                 {
                   lv_poid = null;
                 }
               }
             }
        
         }
     else if(pageContext.getParameter("SearchButton")!=null)
     {
     
      if(pageContext.getParameter("PaymentBatchParam")!=null)
      {
        
        Serializable[] parameters = {paybatchname};
        Class[] parmType = {String.class };
       
        am.invokeMethod("xxsuppsummmtd",parameters, parmType);
               
        am.invokeMethod("xxsupppaymtd",parameters, parmType);
       
        am.invokeMethod("xxsupinvmtd",parameters, parmType);
       // Number lcinvid;
       /* Row invidrow = suppinvvo.getCurrentRow();
        suppinvvo.setCurrentRow(invidrow);
        Number lcinvid = (Number)invidrow.getAttribute("INVOICE_ID");
        //lcinvid = suppinvvo.getCurrentRow().getAttributeValues("INVOICE_ID");
        Serializable[] parameterspo = {paybatchname,lcinvid};
        Class[] parmTypepo = {String.class, Number.class };
        */
        am.invokeMethod("xxsupinpomtd",parameters, parmType);
       
        am.invokeMethod("xxsuppoprmtd",parameters, parmType);
        Row supsel = suppsummvo.first();
        suppsummvo.setCurrentRow(supsel);
        suppsummvo.getCurrentRow().setAttribute("SuppSelectFlag","Y");
       
        Row spaysel = supppaymentsvo.first();
        supppaymentsvo.setCurrentRow(spaysel);
        supppaymentsvo.getCurrentRow().setAttribute("PaySelectFlag","Y");
       
        Row sinvsel = suppinvvo.first();
        suppinvvo.setCurrentRow(sinvsel);
        suppinvvo.getCurrentRow().setAttribute("InvSelectFlag","Y");
       
        Row posel = suppinvposvo.first();
        suppinvposvo.setCurrentRow(posel);
        suppinvposvo.getCurrentRow().setAttribute("PoSelectFlag","Y");
      }
      else if("PaymentBatchParam".equals(null))
      {
         String msg = " Please provide the value for Input Parameter: 'Payment Batch' ";
         throw new OAException(msg,OAException.INFORMATION);
      }
     }    
   }
 }

No comments:

Post a Comment

SQL Query to find Customer, Customer Account and Customer Sites Information

/****************************************************************************** *PURPOSE: Query to Customer, Customer Account and Customer...