Compiere 3.1

org.compiere.acct
Class Fact

java.lang.Object
  extended by 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 $
Author:
Jorg Janke

Nested Class Summary
 class Fact.Balance
          Fact Balance Utility
 
Field Summary
static String POST_Actual
          Actual Balance Type
static String POST_Budget
          Budget Balance Type
static String POST_Commitment
          Encumbrance Posting
static String POST_Reservation
          Encumbrance Posting
 
Constructor Summary
Fact(Doc document, MAcctSchema acctSchema, String defaultPostingType)
          Constructor
 
Method Summary
 FactLine balanceAccounting()
          Balance Accounting Currency.
 void balanceSegments()
          Balance all segments
 FactLine balanceSource()
          Create Source Line for Suspense Balancing.
 boolean checkAccounts()
          Check Accounts of Fact Lines
 FactLine createLine(DocLine docLine, MAccount account, int C_Currency_ID, BigDecimal Amt)
          Create and convert Fact Line.
 FactLine createLine(DocLine docLine, MAccount account, int C_Currency_ID, BigDecimal debitAmt, BigDecimal creditAmt)
          Create and convert Fact Line.
 FactLine createLine(DocLine docLine, MAccount account, int C_Currency_ID, BigDecimal debitAmt, BigDecimal creditAmt, boolean createZero)
          Create and convert Fact Line.
 FactLine createLine(DocLine docLine, MAccount accountDr, MAccount accountCr, int C_Currency_ID, BigDecimal Amt)
          Create and convert Fact Line.
 void dispose()
          Dispose
 boolean distribute()
          GL Distribution of Fact Lines
 String get_TrxName()
          Get Transaction
protected  BigDecimal getAcctBalance()
          Return Accounting Balance
 MAcctSchema getAcctSchema()
          Get AcctSchema
 FactLine[] getLines()
          Get Lines
protected  BigDecimal getSourceBalance()
          Return Source Balance
 boolean isAcctBalanced()
          Are the lines Accounting Balanced
 boolean isConverted()
          Is converted
 boolean isPostingType(String PostingType)
          Is Posting Type
 boolean isSegmentBalanced()
          Are all segments balanced
 boolean isSegmentBalanced(String segmentType)
          Is Source Segment balanced.
 boolean isSourceBalanced()
          Are the lines Source Balanced
 boolean save(String trxName)
          Save Fact
 String toString()
          String representation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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 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,
                           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 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,
                           MAccount account,
                           int C_Currency_ID,
                           BigDecimal debitAmt,
                           BigDecimal creditAmt,
                           boolean createZero)
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
createZero - boolean - if true, allow creation of zero line when no suspense balancing
Returns:
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 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,
                           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 null
account - Account to be used
C_Currency_ID - Currency
Amt - 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

Overrides:
toString in class Object
Returns:
String

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

Compiere 3.1

Compiere® is a registered trademark of ComPiere, Inc. ©2004-2008 HumanFlash.com All rights reserved.