Package org.openbravo.erpCommon.ad_forms
Class Fact
- java.lang.Object
-
- org.openbravo.erpCommon.ad_forms.Fact
-
public class Fact extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
EXCHANGE_DOCTYPE_Invoice
Deprecated.static String
EXCHANGE_DOCTYPE_Payment
Deprecated.static String
EXCHANGE_DOCTYPE_Transaction
Deprecated.static String
POST_Actual
Actual Balance Typestatic String
POST_Budget
Budget Balance Typestatic String
POST_Commitment
Encumbrance PostingBigDecimal
ZERO
-
Constructor Summary
Constructors Constructor Description Fact(AcctServer document, AcctSchema acctSchema, String defaultPostingType)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FactLine
balanceAccounting(ConnectionProvider conn)
Balance Accounting Currency.void
balanceSegments(ConnectionProvider conn)
Balance all segments.FactLine
balanceSource(ConnectionProvider conn)
Create Source Line for Suspense Balancing.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.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.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.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.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.void
dispose()
Disposeprotected BigDecimal
getAcctBalance()
Return Accounting BalanceFactLine[]
getLines()
Get LinesAcctSchema
getM_acctSchema()
AcctServer
getM_doc()
protected BigDecimal
getSourceBalance()
Return Source Balanceboolean
isAcctBalanced()
Are the lines Accounting Balancedboolean
isSegmentBalanced(String segmentType, ConnectionProvider conn)
Is Source Segment balanced.boolean
isSegmentBalanced(ConnectionProvider conn)
Are all segments balancedboolean
isSourceBalanced()
Are the lines Source Balancedboolean
save(Connection con, ConnectionProvider conn, VariablesSecureApp vars)
Save Factvoid
setM_acctSchema(AcctSchema schema)
List<Set<String>>
splitRecordID2Set(Set<String> recordID2Set, int maxSize)
-
-
-
Field Detail
-
ZERO
public final BigDecimal ZERO
-
POST_Actual
public static final String POST_Actual
Actual Balance Type- See Also:
- Constant Field Values
-
POST_Budget
public static final String POST_Budget
Budget Balance Type- See Also:
- Constant Field Values
-
POST_Commitment
public static final String POST_Commitment
Encumbrance Posting- See Also:
- Constant Field Values
-
EXCHANGE_DOCTYPE_Invoice
@Deprecated public static final String EXCHANGE_DOCTYPE_Invoice
Deprecated.- See Also:
- Constant Field Values
-
EXCHANGE_DOCTYPE_Payment
@Deprecated public static final String EXCHANGE_DOCTYPE_Payment
Deprecated.- See Also:
- Constant Field Values
-
EXCHANGE_DOCTYPE_Transaction
@Deprecated public static final String EXCHANGE_DOCTYPE_Transaction
Deprecated.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Fact
public Fact(AcctServer document, AcctSchema acctSchema, String defaultPostingType)
Constructor- Parameters:
document
- pointer to documentacctSchema
- Account Schema to create accountsdefaultPostingType
- the default Posting type (actual,..) for this posting
-
-
Method Detail
-
getM_doc
public AcctServer getM_doc()
-
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 nullaccount
- if null, line is not createdC_Currency_ID
- the currencydebitAmt
- debit amount, can be nullcreditAmt
- 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 nullaccount
- if null, line is not createdC_Currency_ID
- the currencydebitAmt
- debit amount, can be nullcreditAmt
- credit amount, can be nullFact_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 nullaccount
- if null, line is not createdC_Currency_ID
- the currencydebitAmt
- debit amount, can be nullcreditAmt
- credit amount, can be nullconversionDate
- Date to convert currencies if requiredconversionRate
- 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 nullaccountDr
- Account to be used if Amt is DR balanceaccountCr
- Account to be used if Amt is CR balanceC_Currency_ID
- CurrencyAmt
- 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 nullaccount
- Account to be usedC_Currency_ID
- CurrencyAmt
- 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
-
splitRecordID2Set
public List<Set<String>> splitRecordID2Set(Set<String> recordID2Set, int maxSize)
-
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)
-
-