Class AcctServer

    • Constructor Detail

      • AcctServer

        public AcctServer​(String m_AD_Client_ID,
                          String m_AD_Org_ID,
                          ConnectionProvider connectionProvider)
        Constructor
        Parameters:
        m_AD_Client_ID - Client ID of these Documents
        connectionProvider - Provider for db connections.
      • AcctServer

        public AcctServer()
    • Method Detail

      • setBatchSize

        public void setBatchSize​(String newbatchSize)
      • isBackground

        public boolean isBackground()
        Returns:
        the isBackground
      • setBackground

        public void setBackground​(boolean isBackground)
        Parameters:
        isBackground - the isBackground to set
      • get

        public static AcctServer get​(String AD_Table_ID,
                                     String AD_Client_ID,
                                     String AD_Org_ID,
                                     ConnectionProvider connectionProvider)
                              throws javax.servlet.ServletException
        Factory - Create Posting document
        Parameters:
        AD_Table_ID - Table ID of Documents
        AD_Client_ID - Client ID of Documents
        connectionProvider - Database connection provider
        Returns:
        Document
        Throws:
        javax.servlet.ServletException
      • reloadAcctSchemaArray

        public void reloadAcctSchemaArray()
                                   throws javax.servlet.ServletException
        Throws:
        javax.servlet.ServletException
      • post

        public boolean post​(String strClave,
                            boolean force,
                            VariablesSecureApp vars,
                            ConnectionProvider conn,
                            Connection con)
                     throws javax.servlet.ServletException
        This method handles the accounting of the record identified by strClave. Due to the possibility of developing processes that may run after the standard accounting the commit of the transactions made in this method cannot be done here. The commit must be handled in the caller of this method appropriately. Realize that you must handle the commit of the transactions made through a normal or a DAL connection.
        Throws:
        javax.servlet.ServletException
      • loadDocumentType

        public void loadDocumentType()
      • loadDocumentType

        public void loadDocumentType​(boolean supressWarnings)
      • isBalanced

        public boolean isBalanced()
        Is the Source Document Balanced
        Returns:
        true if (source) balanced
      • isConvertible

        public boolean isConvertible​(AcctSchema acctSchema,
                                     ConnectionProvider conn)
                              throws javax.servlet.ServletException
        Is Document convertible to currency and Conversion Type
        Parameters:
        acctSchema - accounting schema
        Returns:
        true, if convertible to accounting currency
        Throws:
        javax.servlet.ServletException
      • getAmount

        public String getAmount​(int AmtType)
        Get the Amount (loaded in loadDocumentDetails)
        Parameters:
        AmtType - see AMTTYPE_*
        Returns:
        Amount
      • getAmount

        public String getAmount()
        Get Amount with index 0
        Returns:
        Amount (primary document amount)
      • getConversionDate

        protected String getConversionDate()
        Get the Convertion Date
        Returns:
        DateAcct
      • getConvertedAmt

        public static String getConvertedAmt​(String Amt,
                                             String CurFrom_ID,
                                             String CurTo_ID,
                                             String ConvDate,
                                             String RateType,
                                             ConnectionProvider conn)
        Convert an amount
        Parameters:
        CurFrom_ID - The C_Currency_ID FROM
        CurTo_ID - The C_Currency_ID TO
        ConvDate - The Conversion date - if null - use current date
        RateType - The Conversion rate type - if null/empty - use Spot
        Amt - The amount to be converted
        Returns:
        converted amount
      • isPeriodOpen

        public boolean isPeriodOpen()
        Is Period Open
        Returns:
        true if period is open
      • setC_Period_ID

        public void setC_Period_ID()
        Calculate Period ID. Set to -1 if no period open, 0 if no period control
      • match

        public int match​(VariablesSecureApp vars,
                         ConnectionProvider conn,
                         Connection con)
        Matching
          Derive Invoice-Receipt Match from PO-Invoice and PO-Receipt
          Purchase Order (20)
          - Invoice1 (10)
          - Invoice2 (10)
          - Receipt1 (5)
          - Receipt2 (15)
          (a) Creates Directs
              - Invoice1 - Receipt1 (5)
              - Invoice2 - Receipt2 (10)
          (b) Creates Indirects
              - Invoice1 - Receipt2 (5)
          (Not imlemented)
         
         
         
        Returns:
        number of records created
      • getAccount

        public final Account getAccount​(String AcctType,
                                        AcctSchema as,
                                        ConnectionProvider conn)
        Get the account for Accounting Schema
        Parameters:
        AcctType - see ACCTTYPE_*
        as - accounting schema
        Returns:
        Account
      • getAccountBPartner

        public final Account getAccountBPartner​(String cBPartnerId,
                                                AcctSchema as,
                                                boolean isReceipt,
                                                boolean isPrepayment,
                                                ConnectionProvider conn)
                                         throws javax.servlet.ServletException
        Get the account for Accounting Schema
        Parameters:
        cBPartnerId - business partner id
        as - accounting schema
        Returns:
        Account
        Throws:
        javax.servlet.ServletException
      • getAccountBPartner

        public final Account getAccountBPartner​(String cBPartnerId,
                                                AcctSchema as,
                                                boolean isReceipt,
                                                boolean isPrepayment,
                                                boolean isDoubtfuldebt,
                                                ConnectionProvider conn)
                                         throws javax.servlet.ServletException
        Get the account for Accounting Schema
        Parameters:
        cBPartnerId - business partner id
        as - accounting schema
        Returns:
        Account
        Throws:
        javax.servlet.ServletException
      • getAccountBPartnerBadDebt

        public final Account getAccountBPartnerBadDebt​(String BPartnerId,
                                                       boolean isExpense,
                                                       AcctSchema as,
                                                       ConnectionProvider conn)
                                                throws javax.servlet.ServletException
        It gets Account to be used to provision for the selected Business Partner
        Parameters:
        BPartnerId - : ID of the Business Partner
        isExpense - : Provision Expense Account. If not it applies to Provision Applied account
        as - : Accounting Schema
        conn - : Connection Provider
        Returns:
        Account
        Throws:
        javax.servlet.ServletException
      • getAccountBPartnerAllowanceForDoubtfulDebt

        public final Account getAccountBPartnerAllowanceForDoubtfulDebt​(String BPartnerId,
                                                                        AcctSchema as,
                                                                        ConnectionProvider conn)
                                                                 throws javax.servlet.ServletException
        It gets Account to be used to provision for the selected Business Partner
        Parameters:
        BPartnerId - : ID of the Business Partner
        as - : Accounting Schema
        conn - : Connection Provider
        Returns:
        Account
        Throws:
        javax.servlet.ServletException
      • getAccountGLItem

        public Account getAccountGLItem​(GLItem glItem,
                                        AcctSchema as,
                                        boolean bIsReceipt,
                                        ConnectionProvider conn)
                                 throws javax.servlet.ServletException
        Get the account for GL Item
        Throws:
        javax.servlet.ServletException
      • getAccount

        public Account getAccount​(ConnectionProvider conn,
                                  String use,
                                  FIN_FinancialAccountAccounting financialAccountAccounting,
                                  boolean bIsReceipt)
                           throws javax.servlet.ServletException
        Get the account for Financial Account (Uses: INT - In Transit DEP - Deposit CLE - Clearing WIT - Withdraw)
        Throws:
        javax.servlet.ServletException
      • getObjectFieldProvider

        public FieldProvider[] getObjectFieldProvider()
      • setObjectFieldProvider

        public void setObjectFieldProvider​(FieldProvider[] fieldProvider)
      • loadObjectFieldProvider

        public abstract void loadObjectFieldProvider​(ConnectionProvider conn,
                                                     String aD_Client_ID,
                                                     String Id)
                                              throws javax.servlet.ServletException
        Throws:
        javax.servlet.ServletException
      • getBalance

        public abstract BigDecimal getBalance()
        Get Source Currency Balance - subtracts line (and tax) amounts from total - no rounding
        Returns:
        positive amount, if total header is bigger than lines
      • getDocumentConfirmation

        public abstract boolean getDocumentConfirmation​(ConnectionProvider conn,
                                                        String strRecordId)
      • getInfo

        public String getInfo​(String language)
        Parameters:
        language -
        Returns:
        a String representing the result of created
      • checkDocuments

        public boolean checkDocuments()
                               throws javax.servlet.ServletException
        Throws:
        javax.servlet.ServletException
      • checkDocuments

        public boolean checkDocuments​(String dateFrom,
                                      String dateTo)
                               throws javax.servlet.ServletException
        Throws:
        javax.servlet.ServletException
      • filterDatesCheckDocuments

        @Deprecated
        public boolean filterDatesCheckDocuments​(String dateFrom,
                                                 String dateTo)
                                          throws javax.servlet.ServletException
        Deprecated.
        Throws:
        javax.servlet.ServletException
      • setMessageResult

        public void setMessageResult​(OBError error)
      • getMessageResult

        public OBError getMessageResult()
      • getServletInfo

        public String getServletInfo()
      • getStatus

        public String getStatus()
      • setStatus

        public void setStatus​(String strStatus)
      • getConversionRatePrecision

        public static int getConversionRatePrecision​(VariablesSecureApp vars)
      • getPaymentDetailAmount

        @Deprecated
        public BigDecimal getPaymentDetailAmount​(List<FIN_PaymentDetail> paymentDetails,
                                                 FIN_PaymentSchedule ps,
                                                 FIN_PaymentSchedule psi,
                                                 FIN_PaymentSchedule pso,
                                                 int currentPaymentDetailIndex)
        Deprecated.
        Returns the amount of a Payment Detail. In case the related Payment Schedule Detail was generated for compensate the difference between an Order and a related Invoice, it merges it's amount with the next Payment Schedule Detail. Issue 19567: https://issues.openbravo.com/view.php?id=19567
        Parameters:
        paymentDetails - List of payment Details
        ps - Previous Payment Schedule
        psi - Invoice Payment Schedule of actual Payment Detail
        pso - Order Payment Schedule of actual Payment Detail
        currentPaymentDetailIndex - Index
      • getPaymentDetailIdWriteOffAndAmount

        public HashMap<String,​BigDecimal> getPaymentDetailIdWriteOffAndAmount​(List<String> paymentDetailsIds,
                                                                                    FIN_PaymentSchedule ps,
                                                                                    FIN_PaymentSchedule psi,
                                                                                    FIN_PaymentSchedule pso,
                                                                                    int currentPaymentDetailIndex)
        Returns the writeoff and the amount of a Payment Detail. In case the related Payment Schedule Detail was generated for compensate the difference between an Order and a related Invoice, it merges it's amount with the next Payment Schedule Detail. Issue 19567: https://issues.openbravo.com/view.php?id=19567
        Parameters:
        paymentDetailsIds - List of payment Details Ids
        ps - Previous Payment Schedule
        psi - Invoice Payment Schedule of actual Payment Detail
        pso - Order Payment Schedule of actual Payment Detail
        currentPaymentDetailIndex - Index
      • getPaymentDetailWriteOffAndAmount

        public HashMap<String,​BigDecimal> getPaymentDetailWriteOffAndAmount​(List<FIN_PaymentDetail> paymentDetails,
                                                                                  FIN_PaymentSchedule ps,
                                                                                  FIN_PaymentSchedule psi,
                                                                                  FIN_PaymentSchedule pso,
                                                                                  int currentPaymentDetailIndex,
                                                                                  FieldProvider fieldProvider)
        Returns the writeoff and the amount of a Payment Detail. In case the related Payment Schedule Detail was generated for compensate the difference between an Order and a related Invoice, it merges it's amount with the next Payment Schedule Detail. Issue 19567: https://issues.openbravo.com/view.php?id=19567
        It does exactly the same as the getPaymentDetailWriteOffAndAmount(List, FIN_PaymentSchedule, FIN_PaymentSchedule, FIN_PaymentSchedule, int) method, but it also stores a new field "MergedPaymentDetailId" inside the fieldProvider with the merged payment detail id (if any).
        Parameters:
        paymentDetails - List of payment Details
        ps - Previous Payment Schedule
        psi - Invoice Payment Schedule of actual Payment Detail
        pso - Order Payment Schedule of actual Payment Detail
        currentPaymentDetailIndex - Index
        fieldProvider - contains the FieldProvider with the Payment Detail currently being processed. Used to store the "MergedPaymentDetailId" (if any) as a new field of the fieldProvider
      • getPaymentDetailWriteOffAndAmount

        public HashMap<String,​BigDecimal> getPaymentDetailWriteOffAndAmount​(FIN_PaymentDetail paymentDetail,
                                                                                  String paymentDetailNextId,
                                                                                  String paymentDetailPreviousId,
                                                                                  FIN_PaymentSchedule ps,
                                                                                  FIN_PaymentSchedule psi,
                                                                                  FIN_PaymentSchedule pso,
                                                                                  FieldProvider fieldProvider)
        Returns the writeoff and the amount of a Payment Detail. In case the related Payment Schedule Detail was generated for compensate the difference between an Order and a related Invoice, it merges it's amount with the next Payment Schedule Detail. Issue 19567: https://issues.openbravo.com/view.php?id=19567
        It does exactly the same as the getPaymentDetailWriteOffAndAmount(List, FIN_PaymentSchedule, FIN_PaymentSchedule, FIN_PaymentSchedule, int) method, but it also stores a new field "MergedPaymentDetailId" inside the fieldProvider with the merged payment detail id (if any).
        Parameters:
        paymentDetail - Payment Detail
        paymentDetailNextId - Next Payment Detail id
        paymentDetailPreviousId - Previous Payment Detail id
        ps - Previous Payment Schedule
        psi - Invoice Payment Schedule of actual Payment Detail
        pso - Order Payment Schedule of actual Payment Detail
        fieldProvider - contains the FieldProvider with the Payment Detail currently being processed. Used to store the "MergedPaymentDetailId" (if any) as a new field of the fieldProvider