Package org.compiere.acct
Class FactLine
- java.lang.Object
-
- org.compiere.model.PO
-
- org.compiere.model.X_Fact_Acct
-
- org.compiere.acct.FactLine
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparator<Object>
,I_Fact_Acct
,I_Persistent
,Evaluatee
public final class FactLine extends X_Fact_Acct
Accounting Fact Entry.- Version:
- $Id: FactLine.java,v 1.3 2006/07/30 00:53:33 jjanke Exp $
Contributor(s):
Chris Farley: Fix Bug [ 1657372 ] M_MatchInv records can not be balanced
https://sourceforge.net/forum/message.php?msg_id=4151117
Carlos Ruiz - globalqss: Add setAmtAcct method rounded by Currency
Armen Rizal, Goodwill Consulting
- BF [ 1745154 ] Cost in Reversing Material Related Docs Bayu Sistematika -
- BF [ 2213252 ] Matching Inv-Receipt generated unproperly value for src amt Teo Sarca
- FR [ 2819081 ] FactLine.getDocLine should be public https://sourceforge.net/p/adempiere/feature-requests/764/
- Author:
- Jorg Janke
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.compiere.model.X_Fact_Acct
POSTINGTYPE_Actual, POSTINGTYPE_AD_Reference_ID, POSTINGTYPE_Budget, POSTINGTYPE_Commitment, POSTINGTYPE_Reservation, POSTINGTYPE_Statistical
-
Fields inherited from class org.compiere.model.PO
ACCESSLEVEL_ALL, ACCESSLEVEL_CLIENT, ACCESSLEVEL_CLIENTORG, ACCESSLEVEL_ORG, ACCESSLEVEL_SYSTEM, ACCESSLEVEL_SYSTEMCLIENT, ENTITYTYPE_Dictionary, ENTITYTYPE_UserMaintained, I_ZERO, LOCAL_TRX_PREFIX, log, p_ctx, p_info, XML_ATTRIBUTE_AD_Table_ID, XML_ATTRIBUTE_Record_ID
-
Fields inherited from interface org.compiere.model.I_Fact_Acct
accessLevel, COLUMNNAME_A_Asset_ID, COLUMNNAME_Account_ID, COLUMNNAME_AD_Client_ID, COLUMNNAME_AD_Org_ID, COLUMNNAME_AD_OrgTrx_ID, COLUMNNAME_AD_Table_ID, COLUMNNAME_AmtAcctCr, COLUMNNAME_AmtAcctDr, COLUMNNAME_AmtSourceCr, COLUMNNAME_AmtSourceDr, COLUMNNAME_C_AcctSchema_ID, COLUMNNAME_C_Activity_ID, COLUMNNAME_C_BPartner_ID, COLUMNNAME_C_Campaign_ID, COLUMNNAME_C_Currency_ID, COLUMNNAME_C_LocFrom_ID, COLUMNNAME_C_LocTo_ID, COLUMNNAME_C_Period_ID, COLUMNNAME_C_Project_ID, COLUMNNAME_C_ProjectPhase_ID, COLUMNNAME_C_ProjectTask_ID, COLUMNNAME_C_SalesRegion_ID, COLUMNNAME_C_SubAcct_ID, COLUMNNAME_C_Tax_ID, COLUMNNAME_C_UOM_ID, COLUMNNAME_Created, COLUMNNAME_CreatedBy, COLUMNNAME_DateAcct, COLUMNNAME_DateTrx, COLUMNNAME_Description, COLUMNNAME_Fact_Acct_ID, COLUMNNAME_Fact_Acct_UU, COLUMNNAME_GL_Budget_ID, COLUMNNAME_GL_Category_ID, COLUMNNAME_IsActive, COLUMNNAME_Line_ID, COLUMNNAME_M_Locator_ID, COLUMNNAME_M_Product_ID, COLUMNNAME_PostingType, COLUMNNAME_Qty, COLUMNNAME_Record_ID, COLUMNNAME_Updated, COLUMNNAME_UpdatedBy, COLUMNNAME_User1_ID, COLUMNNAME_User2_ID, COLUMNNAME_UserElement1_ID, COLUMNNAME_UserElement2_ID, Model, Table_ID, Table_Name
-
-
Constructor Summary
Constructors Constructor Description FactLine(Properties ctx, int AD_Table_ID, int Record_ID, int Line_ID, String trxName)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FactLine
accrue(String description)
Create Accrual (flip CR/DR) of the linevoid
addDescription(String description)
Set Descriptionprotected boolean
beforeSave(boolean newRecord)
Before Saveboolean
convert()
Convert to Accounted Currencyvoid
currencyCorrect(BigDecimal deltaAmount)
Currect Accounting Amount.MAccount
getAccount()
Get AccountBigDecimal
getAcctBalance()
Get Accounted Balanceint
getAD_Org_ID()
Get AD_Org_ID (balancing segment).int
getC_SalesRegion_ID()
Get/derive Sales RegionDocLine
getDocLine()
Get Document LineBigDecimal
getSourceBalance()
Returns Source Balance of lineboolean
isBalanceSheet()
Is Account on Balance Sheetboolean
isDrSourceBalance()
Is Debit Source BalanceFactLine
reverse(String description)
Create Reversal (negate DR/CR) of the linevoid
setAccount(MAcctSchema acctSchema, MAccount acct)
Set Account Infovoid
setAmtAcct(int C_Currency_ID, BigDecimal AmtAcctDr, BigDecimal AmtAcctCr)
Set Accounted Amounts rounded by currencyvoid
setAmtAcct(BigDecimal AmtAcctDr, BigDecimal AmtAcctCr)
Set Accounted Amounts (alternative: call convert)boolean
setAmtSource(int C_Currency_ID, BigDecimal AmtSourceDr, BigDecimal AmtSourceCr)
Set Source Amountsvoid
setDocumentInfo(Doc doc, DocLine docLine)
Set Document Infovoid
setLocation(int C_Location_ID, boolean isFrom)
Set Locationvoid
setLocationFromBPartner(int C_BPartner_Location_ID, boolean isFrom)
Set Location from Busoness Partner Locationvoid
setLocationFromLocator(int M_Locator_ID, boolean isFrom)
Set Location from Locatorvoid
setLocationFromOrg(int AD_Org_ID, boolean isFrom)
Set Location from Organizationvoid
setM_Locator_ID(int M_Locator_ID)
Set Warehouse LocatorString
toString()
To Stringboolean
updateReverseLine(int AD_Table_ID, int Record_ID, int Line_ID, BigDecimal multiplier)
Update Line with reversed Original Amount in Accounting Currency.-
Methods inherited from class org.compiere.model.X_Fact_Acct
get_AccessLevel, getA_Asset_ID, getAccount_ID, getAD_OrgTrx_ID, getAD_Table, getAD_Table_ID, getAmtAcctCr, getAmtAcctDr, getAmtSourceCr, getAmtSourceDr, getC_AcctSchema, getC_AcctSchema_ID, getC_Activity, getC_Activity_ID, getC_BPartner, getC_BPartner_ID, getC_Campaign, getC_Campaign_ID, getC_Currency, getC_Currency_ID, getC_LocFrom, getC_LocFrom_ID, getC_LocTo, getC_LocTo_ID, getC_Period, getC_Period_ID, getC_Project, getC_Project_ID, getC_ProjectPhase, getC_ProjectPhase_ID, getC_ProjectTask, getC_ProjectTask_ID, getC_SalesRegion, getC_SubAcct, getC_SubAcct_ID, getC_Tax, getC_Tax_ID, getC_UOM, getC_UOM_ID, getDateAcct, getDateTrx, getDescription, getFact_Acct_ID, getFact_Acct_UU, getGL_Budget, getGL_Budget_ID, getGL_Category, getGL_Category_ID, getKeyNamePair, getLine_ID, getM_Locator, getM_Locator_ID, getM_Product, getM_Product_ID, getPostingType, getQty, getRecord_ID, getUser1, getUser1_ID, getUser2, getUser2_ID, getUserElement1_ID, getUserElement2_ID, initPO, setA_Asset_ID, setAccount_ID, setAD_OrgTrx_ID, setAD_Table_ID, setAmtAcctCr, setAmtAcctDr, setAmtSourceCr, setAmtSourceDr, setC_AcctSchema_ID, setC_Activity_ID, setC_BPartner_ID, setC_Campaign_ID, setC_Currency_ID, setC_LocFrom_ID, setC_LocTo_ID, setC_Period_ID, setC_Project_ID, setC_ProjectPhase_ID, setC_ProjectTask_ID, setC_SalesRegion_ID, setC_SubAcct_ID, setC_Tax_ID, setC_UOM_ID, setDateAcct, setDateTrx, setDescription, setFact_Acct_ID, setFact_Acct_UU, setGL_Budget_ID, setGL_Category_ID, setLine_ID, setM_Product_ID, setPostingType, setQty, setRecord_ID, setUser1_ID, setUser2_ID, setUserElement1_ID, setUserElement2_ID
-
Methods inherited from class org.compiere.model.PO
afterDelete, afterSave, beforeDelete, checkImmutable, clearCrossTenantSafe, clone, columnExists, columnExists, compare, copyPO, copyValues, copyValues, createAttachment, delete, delete, delete_Accounting, delete_Tree, deleteEx, deleteEx, dump, dump, equals, get_Attribute, get_Attributes, get_ColumnCount, get_ColumnDescription, get_ColumnDisplayType, get_ColumnIndex, get_ColumnLabel, get_ColumnLookup, get_ColumnName, get_DisplayValue, get_HashMap, get_ID, get_IDOld, get_KeyColumns, get_Logger, get_OptimisticLockingColumns, get_Table_ID, get_TableName, get_Translation, get_Translation, get_Translation, get_Translation, get_Translation, get_TrxName, get_Value, get_Value, get_ValueAsBoolean, get_ValueAsInt, get_ValueAsInt, get_ValueAsString, get_ValueDifference, get_ValueDifference, get_ValueE, get_ValueOfColumn, get_ValueOld, get_ValueOld, get_ValueOldAsInt, get_WhereClause, get_WhereClause, get_xmlDocument, get_xmlString, getAD_Client_ID, getAllIDs, getAttachment, getAttachment, getAttachmentData, getCreated, getCreatedBy, getCtx, getDoc, getFindParameter, getPdfAttachment, getUpdated, getUpdatedBy, getUUIDColumnName, getUUIDColumnName, hashCode, insert_Accounting, insert_Tree, insert_Tree, is_Changed, is_Immutable, is_new, is_UseOptimisticLocking, is_ValueChanged, is_ValueChanged, isActive, isAttachment, isColumnMandatory, isColumnUpdateable, isMandatoryOK, isPdfAttachment, isReplication, load, load, load, load, load, loadByUU, loadComplete, loadDefaults, loadSpecial, lock, makeImmutable, postDelete, retrieveIdOfParentValue, retrieveIdOfParentValue, save, save, saveEx, saveEx, saveNew_afterSetID, saveNew_getID, saveNewSpecial, saveReplica, saveUpdate, set_Attribute, set_ColumnUpdateable, set_CustomColumn, set_CustomColumnReturningBoolean, set_OptimisticLockingColumns, set_TrxName, set_TrxName, set_UseOptimisticLocking, set_Value, set_Value, set_Value, set_Value, set_ValueE, set_ValueNoCheck, set_ValueNoCheckE, set_ValueOfColumn, set_ValueOfColumn, set_ValueOfColumnReturningBoolean, set_ValueOfColumnReturningBoolean, setAD_Client_ID, setAD_Org_ID, setClientOrg, setClientOrg, setCrossTenantSafe, setDoc, setDocWorkflowMgr, setIsActive, setProcessedOn, setReplication, setStandardDefaults, setUpdateable, setUpdatedBy, unlock, update_Tree, validForeignKeys
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Methods inherited from interface org.compiere.model.I_Fact_Acct
getAD_Client_ID, getCreated, getCreatedBy, getUpdated, getUpdatedBy, isActive, setAD_Org_ID, setIsActive
-
Methods inherited from interface org.compiere.model.I_Persistent
save
-
-
-
-
Constructor Detail
-
FactLine
public FactLine(Properties ctx, int AD_Table_ID, int Record_ID, int Line_ID, String trxName)
Constructor- Parameters:
ctx
- contextAD_Table_ID
- - Table of Document SourceRecord_ID
- - Record of documentLine_ID
- - Optional line idtrxName
- transaction
-
-
Method Detail
-
reverse
public FactLine reverse(String description)
Create Reversal (negate DR/CR) of the line- Parameters:
description
- new description- Returns:
- reversal line
-
accrue
public FactLine accrue(String description)
Create Accrual (flip CR/DR) of the line- Parameters:
description
- new description- Returns:
- accrual line
-
setAccount
public void setAccount(MAcctSchema acctSchema, MAccount acct)
Set Account Info- Parameters:
acctSchema
- account schemaacct
- account
-
setAmtSource
public boolean setAmtSource(int C_Currency_ID, BigDecimal AmtSourceDr, BigDecimal AmtSourceCr)
Set Source Amounts- Parameters:
C_Currency_ID
- currencyAmtSourceDr
- source amount drAmtSourceCr
- source amount cr- Returns:
- true, if any if the amount is not zero
-
setAmtAcct
public void setAmtAcct(BigDecimal AmtAcctDr, BigDecimal AmtAcctCr)
Set Accounted Amounts (alternative: call convert)- Parameters:
AmtAcctDr
- acct amount drAmtAcctCr
- acct amount cr
-
setAmtAcct
public void setAmtAcct(int C_Currency_ID, BigDecimal AmtAcctDr, BigDecimal AmtAcctCr)
Set Accounted Amounts rounded by currency- Parameters:
C_Currency_ID
- currencyAmtAcctDr
- acct amount drAmtAcctCr
- acct amount cr
-
setDocumentInfo
public void setDocumentInfo(Doc doc, DocLine docLine)
Set Document Info- Parameters:
doc
- documentdocLine
- doc line
-
getDocLine
public DocLine getDocLine()
Get Document Line- Returns:
- doc line
-
addDescription
public void addDescription(String description)
Set Description- Parameters:
description
- description
-
setM_Locator_ID
public void setM_Locator_ID(int M_Locator_ID)
Set Warehouse Locator. - will overwrite Organization -- Specified by:
setM_Locator_ID
in interfaceI_Fact_Acct
- Overrides:
setM_Locator_ID
in classX_Fact_Acct
- Parameters:
M_Locator_ID
- locator
-
setLocation
public void setLocation(int C_Location_ID, boolean isFrom)
Set Location- Parameters:
C_Location_ID
- locationisFrom
- from
-
setLocationFromLocator
public void setLocationFromLocator(int M_Locator_ID, boolean isFrom)
Set Location from Locator- Parameters:
M_Locator_ID
- locatorisFrom
- from
-
setLocationFromBPartner
public void setLocationFromBPartner(int C_BPartner_Location_ID, boolean isFrom)
Set Location from Busoness Partner Location- Parameters:
C_BPartner_Location_ID
- bp locationisFrom
- from
-
setLocationFromOrg
public void setLocationFromOrg(int AD_Org_ID, boolean isFrom)
Set Location from Organization- Parameters:
AD_Org_ID
- orgisFrom
- from
-
getSourceBalance
public BigDecimal getSourceBalance()
Returns Source Balance of line- Returns:
- source balance
-
isDrSourceBalance
public boolean isDrSourceBalance()
Is Debit Source Balance- Returns:
- true if DR source balance
-
getAcctBalance
public BigDecimal getAcctBalance()
Get Accounted Balance- Returns:
- accounting balance
-
isBalanceSheet
public boolean isBalanceSheet()
Is Account on Balance Sheet- Returns:
- true if account is a balance sheet account
-
currencyCorrect
public void currencyCorrect(BigDecimal deltaAmount)
Currect Accounting Amount.Example: 1 -1 1 -1 Old 100/0 100/0 0/100 0/100 New 99/0 101/0 0/99 0/101
- Parameters:
deltaAmount
- delta amount
-
convert
public boolean convert()
Convert to Accounted Currency- Returns:
- true if converted
-
getAccount
public MAccount getAccount()
Get Account- Returns:
- account
-
toString
public String toString()
To String- Overrides:
toString
in classX_Fact_Acct
- Returns:
- String
-
getAD_Org_ID
public int getAD_Org_ID()
Get AD_Org_ID (balancing segment). (if not set directly - from document line, document, account, locator)Note that Locator needs to be set before - otherwise segment balancing might produce the wrong results
- Specified by:
getAD_Org_ID
in interfaceI_Fact_Acct
- Overrides:
getAD_Org_ID
in classPO
- Returns:
- AD_Org_ID
-
getC_SalesRegion_ID
public int getC_SalesRegion_ID()
Get/derive Sales Region- Specified by:
getC_SalesRegion_ID
in interfaceI_Fact_Acct
- Overrides:
getC_SalesRegion_ID
in classX_Fact_Acct
- Returns:
- Sales Region
-
beforeSave
protected boolean beforeSave(boolean newRecord)
Before Save- Overrides:
beforeSave
in classPO
- Parameters:
newRecord
- new- Returns:
- true
-
updateReverseLine
public boolean updateReverseLine(int AD_Table_ID, int Record_ID, int Line_ID, BigDecimal multiplier)
Update Line with reversed Original Amount in Accounting Currency. Also copies original dimensions like Project, etc. Called from Doc_MatchInv- Parameters:
AD_Table_ID
- tableRecord_ID
- recordLine_ID
- linemultiplier
- targetQty/documentQty- Returns:
- true if success
-
-