Package org.compiere.model
Class MCostDetail
java.lang.Object
org.compiere.model.PO
org.compiere.model.X_M_CostDetail
org.compiere.model.MCostDetail
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparator<Object>
,I_M_CostDetail
,I_Persistent
,Evaluatee
Cost Detail Model
- Version:
- $Id: MCostDetail.java,v 1.3 2006/07/30 00:51:05 jjanke Exp $
- Author:
- Jorg Janke, Armen Rizal, Goodwill Consulting
- BF: 2431123 Return Trx changes weighted average cost
- BF: 1568752 Average invoice costing: landed costs incorrectly applied, Armen Rizal and Bayu Cahya
- BF [ 2129781 ] Cost Detail not created properly for multi acc schema, Teo Sarca
- BF [ 2847648 ] Manufacture and shipment cost errors https://sourceforge.net/p/adempiere/libero/237/, red1 FR: [ 2214883 ] Remove SQL code and Replace for Query
- See Also:
-
Field Summary
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, UUID_NEW_RECORD, XML_ATTRIBUTE_AD_Table_ID, XML_ATTRIBUTE_Record_ID
Fields inherited from interface org.compiere.model.I_M_CostDetail
accessLevel, COLUMNNAME_AD_Client_ID, COLUMNNAME_AD_Org_ID, COLUMNNAME_Amt, COLUMNNAME_C_AcctSchema_ID, COLUMNNAME_C_InvoiceLine_ID, COLUMNNAME_C_OrderLine_ID, COLUMNNAME_C_ProjectIssue_ID, COLUMNNAME_Created, COLUMNNAME_CreatedBy, COLUMNNAME_CumulatedAmt, COLUMNNAME_CumulatedQty, COLUMNNAME_CurrentCostPrice, COLUMNNAME_CurrentQty, COLUMNNAME_DeltaAmt, COLUMNNAME_DeltaQty, COLUMNNAME_Description, COLUMNNAME_IsActive, COLUMNNAME_IsSOTrx, COLUMNNAME_M_AttributeSetInstance_ID, COLUMNNAME_M_CostDetail_ID, COLUMNNAME_M_CostDetail_UU, COLUMNNAME_M_CostElement_ID, COLUMNNAME_M_InOutLine_ID, COLUMNNAME_M_InventoryLine_ID, COLUMNNAME_M_MatchInv_ID, COLUMNNAME_M_MovementLine_ID, COLUMNNAME_M_Product_ID, COLUMNNAME_M_ProductionLine_ID, COLUMNNAME_PP_Cost_Collector_ID, COLUMNNAME_Price, COLUMNNAME_Processed, COLUMNNAME_Qty, COLUMNNAME_Updated, COLUMNNAME_UpdatedBy, Model, Table_ID, Table_Name
-
Constructor Summary
ConstructorDescriptionMCostDetail
(Properties ctx, int M_CostDetail_ID, String trxName) Standard ConstructorMCostDetail
(Properties ctx, String M_CostDetail_UU, String trxName) UUID based ConstructorMCostDetail
(Properties ctx, ResultSet rs, String trxName) Load ConstructorMCostDetail
(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_CostElement_ID, BigDecimal amt, BigDecimal qty, String description, String trxName) New Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Before Deletestatic boolean
createInventory
(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_InventoryLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, String Description, String trxName) Create New Cost Detail record for Physical Inventory.static boolean
createInvoice
(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int C_InvoiceLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, String Description, String trxName) Create New Cost Detail record for AP Invoices.static boolean
createMatchInvoice
(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_MatchInv_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, String Description, String trxName) Create cost detail record for Match Invoice (M_MatchInv).static boolean
createMovement
(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_MovementLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, boolean from, String Description, String trxName) Create New Cost Detail record for Inventory Movements.static boolean
createOrder
(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int C_OrderLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, String Description, String trxName) Create New Cost Detail record for Purchase Orders.static boolean
createProduction
(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_ProductionLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, String Description, String trxName) Create New Cost Detail record for Production.static boolean
createProjectIssue
(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int C_ProjectIssue_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, String Description, String trxName) Create Cost Detail for Project Issue (C_ProjectIssue).static boolean
createShipment
(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_InOutLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, String Description, boolean IsSOTrx, String trxName) Create New Cost Detail record for SO Shipments.static MCostDetail
get
(Properties ctx, String whereClause, int ID, int M_AttributeSetInstance_ID, int C_AcctSchema_ID, String trxName) Get Cost Detailstatic MCostDetail
get
(Properties ctx, String whereClause, int ID, int M_AttributeSetInstance_ID, String trxName) Deprecated.boolean
isDelta()
Is this a Delta Record (previously processed)?boolean
Is Invoiceboolean
isOrder()
Is Orderboolean
Is Shipmentboolean
static List<MCostDetail>
list
(Properties ctx, String whereClause, int ID, int M_AttributeSetInstance_ID, int C_AcctSchema_ID, String trxName) Get Cost Detail Recordsboolean
process()
Process Cost Detail Record.protected boolean
process
(MAcctSchema as, MProduct product, MCostElement ce, int Org_ID, int M_ASI_ID) Process cost detail recordstatic boolean
processProduct
(MProduct product, String trxName) Process Cost Details for productvoid
setAmt
(BigDecimal Amt) Set Amtvoid
setQty
(BigDecimal Qty) Set QtytoString()
String RepresentationMethods inherited from class org.compiere.model.X_M_CostDetail
get_AccessLevel, getAmt, getC_AcctSchema, getC_AcctSchema_ID, getC_InvoiceLine, getC_InvoiceLine_ID, getC_OrderLine, getC_OrderLine_ID, getC_ProjectIssue, getC_ProjectIssue_ID, getCumulatedAmt, getCumulatedQty, getCurrentCostPrice, getCurrentQty, getDeltaAmt, getDeltaQty, getDescription, getM_AttributeSetInstance, getM_AttributeSetInstance_ID, getM_CostDetail_ID, getM_CostDetail_UU, getM_CostElement, getM_CostElement_ID, getM_InOutLine, getM_InOutLine_ID, getM_InventoryLine, getM_InventoryLine_ID, getM_MatchInv, getM_MatchInv_ID, getM_MovementLine, getM_MovementLine_ID, getM_Product, getM_Product_ID, getM_ProductionLine, getM_ProductionLine_ID, getPP_Cost_Collector, getPP_Cost_Collector_ID, getPrice, getQty, initPO, isProcessed, isSOTrx, setC_AcctSchema_ID, setC_InvoiceLine_ID, setC_OrderLine_ID, setC_ProjectIssue_ID, setCumulatedAmt, setCumulatedQty, setCurrentCostPrice, setCurrentQty, setDeltaAmt, setDeltaQty, setDescription, setIsSOTrx, setM_AttributeSetInstance_ID, setM_CostDetail_ID, setM_CostDetail_UU, setM_CostElement_ID, setM_InOutLine_ID, setM_InventoryLine_ID, setM_MatchInv_ID, setM_MovementLine_ID, setM_Product_ID, setM_ProductionLine_ID, setPP_Cost_Collector_ID, setPrice, setProcessed
Methods inherited from class org.compiere.model.PO
afterDelete, afterSave, beforeSave, buildInsertSQL, 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_UUID, get_Value, get_Value, get_ValueAsBoolean, get_ValueAsInt, get_ValueAsInt, get_ValueAsString, 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, getAD_Org_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, loadByUU, loadComplete, loadDefaults, loadPO, loadSpecial, lock, makeImmutable, postDelete, retrieveIdOfParentValue, retrieveIdOfParentValue, save, save, saveCrossTenantSafe, saveCrossTenantSafeEx, saveCrossTenantSafeEx, 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, toInsertSQL, 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_M_CostDetail
getAD_Client_ID, getAD_Org_ID, getCreated, getCreatedBy, getUpdated, getUpdatedBy, isActive, setAD_Org_ID, setIsActive
Methods inherited from interface org.compiere.model.I_Persistent
save
-
Field Details
-
INOUTLINE_DOCBASETYPE_SQL
- See Also:
-
-
Constructor Details
-
MCostDetail
UUID based Constructor- Parameters:
ctx
- ContextM_CostDetail_UU
- UUID keytrxName
- Transaction
-
MCostDetail
Standard Constructor- Parameters:
ctx
- contextM_CostDetail_ID
- idtrxName
- trx
-
MCostDetail
Load Constructor- Parameters:
ctx
- contextrs
- result settrxName
- trx
-
MCostDetail
public MCostDetail(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_CostElement_ID, BigDecimal amt, BigDecimal qty, String description, String trxName) New Constructor- Parameters:
as
- accounting schemaAD_Org_ID
- orgM_Product_ID
- productM_AttributeSetInstance_ID
- asiM_CostElement_ID
- optional cost element for Freightamt
- Amountqty
- Quantitydescription
- optional descriptiontrxName
- transaction
-
-
Method Details
-
createOrder
public static boolean createOrder(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int C_OrderLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, String Description, String trxName) Create New Cost Detail record for Purchase Orders. Called from Doc_MatchPO.- Parameters:
as
- accounting schemaAD_Org_ID
- orgM_Product_ID
- productM_AttributeSetInstance_ID
- asiC_OrderLine_ID
- orderM_CostElement_ID
- optional cost element for FreightAmt
- amt total amountQty
- qtyDescription
- optional descriptiontrxName
- transaction- Returns:
- true if created
-
createInvoice
public static boolean createInvoice(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int C_InvoiceLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, String Description, String trxName) Create New Cost Detail record for AP Invoices. Called from Doc_Invoice - for Invoice Adjustments.- Parameters:
as
- accounting schemaAD_Org_ID
- orgM_Product_ID
- productM_AttributeSetInstance_ID
- asiC_InvoiceLine_ID
- invoiceM_CostElement_ID
- optional cost element for FreightAmt
- amtQty
- qtyDescription
- optional descriptiontrxName
- transaction- Returns:
- true if created
-
createShipment
public static boolean createShipment(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_InOutLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, String Description, boolean IsSOTrx, String trxName) Create New Cost Detail record for SO Shipments. Called from Doc_MInOut - for SO Shipments.- Parameters:
as
- accounting schemaAD_Org_ID
- orgM_Product_ID
- productM_AttributeSetInstance_ID
- asiM_InOutLine_ID
- shipmentM_CostElement_ID
- optional cost element for FreightAmt
- amtQty
- qtyDescription
- optional descriptionIsSOTrx
- sales ordertrxName
- transaction- Returns:
- true if no error
-
createInventory
public static boolean createInventory(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_InventoryLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, String Description, String trxName) Create New Cost Detail record for Physical Inventory. Called from Doc_Inventory.- Parameters:
as
- accounting schemaAD_Org_ID
- orgM_Product_ID
- productM_AttributeSetInstance_ID
- asiM_InventoryLine_ID
- orderM_CostElement_ID
- optional cost elementAmt
- amt total amountQty
- qtyDescription
- optional descriptiontrxName
- transaction- Returns:
- true if no error
-
createMovement
public static boolean createMovement(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_MovementLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, boolean from, String Description, String trxName) Create New Cost Detail record for Inventory Movements. Called from Doc_Movement.- Parameters:
as
- accounting schemaAD_Org_ID
- orgM_Product_ID
- productM_AttributeSetInstance_ID
- asiM_MovementLine_ID
- movementM_CostElement_ID
- optional cost element for FreightAmt
- amt total amountQty
- qtyfrom
- if true the from (reduction)Description
- optional descriptiontrxName
- transaction- Returns:
- true if no error
-
createProduction
public static boolean createProduction(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_ProductionLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, String Description, String trxName) Create New Cost Detail record for Production. Called from Doc_Production.- Parameters:
as
- accounting schemaAD_Org_ID
- orgM_Product_ID
- productM_AttributeSetInstance_ID
- asiM_ProductionLine_ID
- production lineM_CostElement_ID
- optional cost elementAmt
- amt total amountQty
- qtyDescription
- optional descriptiontrxName
- transaction- Returns:
- true if no error
-
createMatchInvoice
public static boolean createMatchInvoice(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_MatchInv_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, String Description, String trxName) Create cost detail record for Match Invoice (M_MatchInv).- Parameters:
as
-AD_Org_ID
-M_Product_ID
-M_AttributeSetInstance_ID
-M_MatchInv_ID
-M_CostElement_ID
-Amt
-Qty
-Description
-trxName
-- Returns:
- true if no error
-
createProjectIssue
public static boolean createProjectIssue(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int C_ProjectIssue_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, String Description, String trxName) Create Cost Detail for Project Issue (C_ProjectIssue). Called from Doc_ProjectIssue- Parameters:
as
- accounting schemaAD_Org_ID
- orgM_Product_ID
- productM_AttributeSetInstance_ID
- asiC_ProjectIssue_ID
- project issue lineM_CostElement_ID
- optional cost elementAmt
- amt total amountQty
- qtyDescription
- optional descriptiontrxName
- transaction- Returns:
- true if no error
-
get
@Deprecated public static MCostDetail get(Properties ctx, String whereClause, int ID, int M_AttributeSetInstance_ID, String trxName) Deprecated.Get Cost Detail- Parameters:
ctx
- contextwhereClause
- where clauseID
- 1st parameterM_AttributeSetInstance_ID
- ASItrxName
- trx- Returns:
- cost detail
-
get
public static MCostDetail get(Properties ctx, String whereClause, int ID, int M_AttributeSetInstance_ID, int C_AcctSchema_ID, String trxName) Get Cost Detail- Parameters:
ctx
- contextwhereClause
- where clause for record id (1st parameter)ID
- record id (1st parameter)M_AttributeSetInstance_ID
- ASI (2nd parameter)C_AcctSchema_ID
- accounting schema (3rd parameter)trxName
- trx- Returns:
- cost detail
-
list
public static List<MCostDetail> list(Properties ctx, String whereClause, int ID, int M_AttributeSetInstance_ID, int C_AcctSchema_ID, String trxName) Get Cost Detail Records- Parameters:
ctx
- contextwhereClause
- where clause for record id (1st parameter)ID
- record id (1st parameter)M_AttributeSetInstance_ID
- ASI (2nd parameter)C_AcctSchema_ID
- accounting schema (3rd parameter)trxName
- trx- Returns:
- list of cost detail record
-
processProduct
Process Cost Details for product- Parameters:
product
- producttrxName
- transaction- Returns:
- true if no error
-
setAmt
Set Amt- Specified by:
setAmt
in interfaceI_M_CostDetail
- Overrides:
setAmt
in classX_M_CostDetail
- Parameters:
Amt
- amt
-
setQty
Set Qty- Specified by:
setQty
in interfaceI_M_CostDetail
- Overrides:
setQty
in classX_M_CostDetail
- Parameters:
Qty
- qty
-
isOrder
public boolean isOrder()Is Order- Returns:
- true if has order line
-
isInvoice
public boolean isInvoice()Is Invoice- Returns:
- true if has invoice line
-
isShipment
public boolean isShipment()Is Shipment- Returns:
- true if has sales order shipment line
-
isVendorRMA
public boolean isVendorRMA()- Returns:
- true if shipment line belongs to return to vendor (vendor RMA)
-
isDelta
public boolean isDelta()Is this a Delta Record (previously processed)?- Returns:
- true if delta is not null
-
beforeDelete
protected boolean beforeDelete()Before Delete- Overrides:
beforeDelete
in classPO
- Returns:
- false if processed
-
toString
String Representation- Overrides:
toString
in classX_M_CostDetail
- Returns:
- info
-
process
public boolean process()Process Cost Detail Record. The record is saved if processed.- Returns:
- true if processed
-
process
protected boolean process(MAcctSchema as, MProduct product, MCostElement ce, int Org_ID, int M_ASI_ID) Process cost detail record- Parameters:
as
- accounting schemaproduct
- productce
- cost elementOrg_ID
- org - corrected for costing levelM_ASI_ID
- - asi corrected for costing level- Returns:
- true if cost ok
-