Package org.compiere.acct
Class Fact
- java.lang.Object
-
- org.compiere.acct.Fact
-
public final class Fact extends Object
Accounting Fact- Version:
- $Id: Fact.java,v 1.2 2006/07/30 00:53:33 jjanke Exp $ BF [ 2789949 ] Multicurrency in matching posting
- Author:
- Jorg Janke
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFact.BalanceFact Balance Utility
-
Field Summary
Fields Modifier and Type Field Description static StringPOST_ActualActual Balance Typestatic StringPOST_BudgetBudget Balance Typestatic StringPOST_CommitmentEncumbrance Postingstatic StringPOST_ReservationEncumbrance Posting
-
Constructor Summary
Constructors Constructor Description Fact(Doc document, MAcctSchema acctSchema, String defaultPostingType)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(FactLine line)Add Fact LineFactLinebalanceAccounting()Balance Accounting Currency.voidbalanceSegments()Balance all segmentsFactLinebalanceSource()Create Source Line for Suspense Balancing.booleancheckAccounts()Check Accounts of Fact LinesFactLinecreateLine(DocLine docLine, MAccount account, int C_Currency_ID, BigDecimal Amt)Create and convert Fact Line.FactLinecreateLine(DocLine docLine, MAccount account, int C_Currency_ID, BigDecimal debitAmt, BigDecimal creditAmt)Create and convert Fact Line.FactLinecreateLine(DocLine docLine, MAccount accountDr, MAccount accountCr, int C_Currency_ID, BigDecimal Amt)Create and convert Fact Line.voiddispose()Disposebooleandistribute()GL Distribution of Fact LinesStringget_TrxName()Get Transactionprotected BigDecimalgetAcctBalance()Return Accounting BalanceMAcctSchemagetAcctSchema()Get AcctSchemaFactLine[]getLines()Get Linesprotected BigDecimalgetSourceBalance()Return Source BalancebooleanisAcctBalanced()Are the lines Accounting BalancedbooleanisConverted()Is convertedbooleanisPostingType(String PostingType)Is Posting TypebooleanisSegmentBalanced()Are all segments balancedbooleanisSegmentBalanced(String segmentType)Is Source Segment balanced.booleanisSourceBalanced()Are the lines Source Balancedvoidremove(FactLine line)Remove Fact Linebooleansave(String trxName)Save FactStringtoString()String representation
-
-
-
Field Detail
-
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
-
POST_Reservation
public static final String POST_Reservation
Encumbrance Posting- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Fact
public Fact(Doc document, MAcctSchema acctSchema, String defaultPostingType)
Constructor- Parameters:
document- pointer to documentacctSchema- Account Schema to create accountsdefaultPostingType- the default Posting type (actual,..) for this posting
-
-
Method Detail
-
dispose
public void dispose()
Dispose
-
createLine
public FactLine createLine(DocLine docLine, MAccount account, int C_Currency_ID, BigDecimal debitAmt, BigDecimal creditAmt)
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
-
add
public void add(FactLine line)
Add Fact Line- Parameters:
line- fact line
-
remove
public void remove(FactLine line)
Remove Fact Line- Parameters:
line- fact line
-
createLine
public FactLine createLine(DocLine docLine, MAccount accountDr, MAccount accountCr, int C_Currency_ID, BigDecimal Amt)
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, MAccount account, int C_Currency_ID, BigDecimal Amt)
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
-
isPostingType
public boolean isPostingType(String PostingType)
Is Posting Type- Parameters:
PostingType- - see POST_*- Returns:
- true if document is posting type
-
isConverted
public boolean isConverted()
Is converted- Returns:
- true if converted
-
getAcctSchema
public MAcctSchema getAcctSchema()
Get AcctSchema- Returns:
- AcctSchema
-
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()
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
-
isSegmentBalanced
public boolean isSegmentBalanced()
Are all segments balanced- Returns:
- true if segments are balanced
-
isSegmentBalanced
public boolean isSegmentBalanced(String segmentType)
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()
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()
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
-
checkAccounts
public boolean checkAccounts()
Check Accounts of Fact Lines- Returns:
- true if success
-
distribute
public boolean distribute()
GL Distribution of Fact Lines- Returns:
- true if success
-
toString
public String toString()
String representation
-
getLines
public FactLine[] getLines()
Get Lines- Returns:
- FactLine Array
-
save
public boolean save(String trxName)
Save Fact- Parameters:
trxName- transaction- Returns:
- true if all lines were saved
-
get_TrxName
public String get_TrxName()
Get Transaction- Returns:
- trx
-
-