Class Fact


  • public class Fact
    extends Object
    • Constructor Detail

      • Fact

        public Fact​(AcctServer document,
                    AcctSchema acctSchema,
                    String defaultPostingType)
        Constructor
        Parameters:
        document - pointer to document
        acctSchema - Account Schema to create accounts
        defaultPostingType - the default Posting type (actual,..) for this posting
    • Method Detail

      • dispose

        public void dispose()
        Dispose
      • createLine

        public FactLine createLine​(DocLine docLine,
                                   Account account,
                                   String C_Currency_ID,
                                   String debitAmt,
                                   String creditAmt,
                                   String Fact_Acct_Group_ID,
                                   String SeqNo,
                                   String DocBaseType,
                                   ConnectionProvider conn)
        Create and convert Fact Line. Used to create a DR and/or CR entry
        Parameters:
        docLine - the document line or null
        account - if null, line is not created
        C_Currency_ID - the currency
        debitAmt - debit amount, can be null
        creditAmt - credit amount, can be null
        Returns:
        Fact Line
      • createLine

        public FactLine createLine​(DocLine docLine,
                                   Account account,
                                   String C_Currency_ID,
                                   String debitAmt,
                                   String creditAmt,
                                   String Fact_Acct_Group_ID,
                                   String SeqNo,
                                   String DocBaseType,
                                   String conversionDate,
                                   ConnectionProvider conn)
        Create and convert Fact Line using a specified conversion date. Used to create a DR and/or CR entry
        Parameters:
        docLine - the document line or null
        account - if null, line is not created
        C_Currency_ID - the currency
        debitAmt - debit amount, can be null
        creditAmt - credit amount, can be null
        Fact_Acct_Group_ID -
        SeqNo -
        DocBaseType -
        conversionDate - Date to convert currencies if required
        Returns:
        Fact Line
      • createLine

        public FactLine createLine​(DocLine docLine,
                                   Account account,
                                   String C_Currency_ID,
                                   String debitAmt,
                                   String creditAmt,
                                   String Fact_Acct_Group_ID,
                                   String SeqNo,
                                   String DocBaseType,
                                   String conversionDate,
                                   BigDecimal conversionRate,
                                   ConnectionProvider conn)
        Create and convert Fact Line using a specified conversion date. Used to create a DR and/or CR entry
        Parameters:
        docLine - the document line or null
        account - if null, line is not created
        C_Currency_ID - the currency
        debitAmt - debit amount, can be null
        creditAmt - credit amount, can be null
        conversionDate - Date to convert currencies if required
        conversionRate - The rate to use to convert from source amount to account amount. May be null
        Returns:
        Fact Line
      • createLine

        public FactLine createLine​(DocLine docLine,
                                   Account accountDr,
                                   Account accountCr,
                                   String C_Currency_ID,
                                   String Amt,
                                   String Fact_Acct_Group_ID,
                                   String SeqNo,
                                   String DocBaseType,
                                   ConnectionProvider conn)
        Create and convert Fact Line. Used to create either a DR or CR entry
        Parameters:
        docLine - Document Line or null
        accountDr - Account to be used if Amt is DR balance
        accountCr - Account to be used if Amt is CR balance
        C_Currency_ID - Currency
        Amt - if negative Cr else Dr
        Returns:
        FactLine
      • createLine

        public FactLine createLine​(DocLine docLine,
                                   Account account,
                                   String C_Currency_ID,
                                   String Amt,
                                   String Fact_Acct_Group_ID,
                                   String SeqNo,
                                   String DocBaseType,
                                   ConnectionProvider conn)
        Create and convert Fact Line. Used to create either a DR or CR entry
        Parameters:
        docLine - Document line or null
        account - Account to be used
        C_Currency_ID - Currency
        Amt - if negative Cr else Dr
        Returns:
        FactLine
      • isSourceBalanced

        public boolean isSourceBalanced()
        Are the lines Source Balanced
        Returns:
        true if source lines balanced
      • getSourceBalance

        protected BigDecimal getSourceBalance()
        Return Source Balance
        Returns:
        source balance
      • balanceSource

        public FactLine balanceSource​(ConnectionProvider conn)
        Create Source Line for Suspense Balancing. Only if Suspense Balancing is enabled and not a multi-currency document (double check as otherwise the rule should not have fired) If not balanced create balancing entry in currency of the document
        Returns:
        FactLine
      • getLines

        public FactLine[] getLines()
        Get Lines
        Returns:
        FactLine Array
      • save

        public boolean save​(Connection con,
                            ConnectionProvider conn,
                            VariablesSecureApp vars)
                     throws javax.servlet.ServletException
        Save Fact
        Parameters:
        con - connection
        Returns:
        true if all lines were saved
        Throws:
        javax.servlet.ServletException
      • isSegmentBalanced

        public boolean isSegmentBalanced​(ConnectionProvider conn)
        Are all segments balanced
        Returns:
        true if segments are balanced
      • isSegmentBalanced

        public boolean isSegmentBalanced​(String segmentType,
                                         ConnectionProvider conn)
        Is Source Segment balanced.
        Parameters:
        segmentType - - see AcctSchemaElement.SEGMENT_* Implemented only for Org Other sensible candidates are Project, User1/2
        Returns:
        true if segments are balanced
      • balanceSegments

        public void balanceSegments​(ConnectionProvider conn)
        Balance all segments. - For all balancing segments - For all segment values - If balance <> 0 create dueTo/dueFrom line overwriting the segment value
      • isAcctBalanced

        public boolean isAcctBalanced()
        Are the lines Accounting Balanced
        Returns:
        true if accounting lines are balanced
      • getAcctBalance

        protected BigDecimal getAcctBalance()
        Return Accounting Balance
        Returns:
        true if accounting lines are balanced
      • balanceAccounting

        public FactLine balanceAccounting​(ConnectionProvider conn)
        Balance Accounting Currency. If the accounting currency is not balanced, if Currency balancing is enabled create a new line using the currency balancing account with zero source balance or adjust the line with the largest balance sheet account or if no balance sheet account exist, the line with the largest amount
        Returns:
        FactLine
      • getM_acctSchema

        public AcctSchema getM_acctSchema()
      • setM_acctSchema

        public void setM_acctSchema​(AcctSchema schema)