Package org.openbravo.costing
Class CostAdjustmentUtils
- java.lang.Object
-
- org.openbravo.costing.CostAdjustmentUtils
-
public class CostAdjustmentUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
ENABLE_AUTO_PRICE_CORRECTION_PREF
static String
ENABLE_NEGATIVE_STOCK_CORRECTION_PREF
static String
MovementTypeRefID
static String
propADListPriority
static String
propADListReference
static String
propADListValue
static String
strCategoryCostAdj
static String
strTableCostAdj
-
Constructor Summary
Constructors Constructor Description CostAdjustmentUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static int
compareToLastTransaction(MaterialTransaction trx, TransactionLast lastTransaction, Date startingDate)
static TransactionLast
getLastTransaction(MaterialTransaction trx, boolean includeWarehouseDimension)
static Date
getLastTrxDateOfMvmntDate(Date refDate, Product product, Organization org, HashMap<CostingAlgorithm.CostDimension,BaseOBObject> costDimensions)
Returns the last transaction process date of a non backdated transactions for the given movement date or previous date.static BigDecimal
getStockOnMovementDate(Product product, Organization org, Date date, HashMap<CostingAlgorithm.CostDimension,BaseOBObject> costDimensions, boolean backdatedTransactionsFixed)
Calculates the stock of the product on the given date and for the given cost dimensions.static BigDecimal
getStockOnTransactionDate(Organization costorg, MaterialTransaction trx, HashMap<CostingAlgorithm.CostDimension,BaseOBObject> costDimensions, boolean isManufacturingProduct, boolean areBackdatedTrxFixed, Currency currency)
Calculates the stock of the product on the given date and for the given cost dimensions.static BigDecimal
getStockOnTransactionDate(Organization costorg, MaterialTransaction trx, HashMap<CostingAlgorithm.CostDimension,BaseOBObject> costDimensions, boolean isManufacturingProduct, boolean areBackdatedTrxFixed, Currency currency, Costing costing)
Calculates the stock of the product on the given date and for the given cost dimensions.static BigDecimal
getTrxCost(MaterialTransaction trx, boolean justUnitCost, Currency currency)
static long
getTrxTypePrio(String mvmntType)
Returns the priority of the given movementType.static BigDecimal
getValuedStockOnMovementDate(Product product, Organization org, Date date, HashMap<CostingAlgorithm.CostDimension,BaseOBObject> costDimensions, Currency currency, boolean backdatedTransactionsFixed)
Calculates the value of the stock of the product on the given date, for the given cost dimensions and for the given currency.static BigDecimal
getValuedStockOnMovementDateByAttrAndLocator(Product product, Organization org, Date date, HashMap<CostingAlgorithm.CostDimension,BaseOBObject> costDimensions, Locator locator, AttributeSetInstance asi, Currency currency, boolean backdatedTransactionsFixed)
Calculates the value of the stock of the product on the given date, for the given cost dimensions and for the given currency.static BigDecimal
getValuedStockOnTransactionDate(Organization costorg, MaterialTransaction trx, HashMap<CostingAlgorithm.CostDimension,BaseOBObject> costDimensions, boolean isManufacturingProduct, boolean areBackdatedTrxFixed, Currency currency)
Calculates the value of the stock of the product on the given date, for the given cost dimensions and for the given currency.static BigDecimal
getValuedStockOnTransactionDate(Organization costorg, MaterialTransaction trx, HashMap<CostingAlgorithm.CostDimension,BaseOBObject> costDimensions, boolean isManufacturingProduct, boolean areBackdatedTrxFixed, Currency currency, Costing costing)
Calculates the value of the stock of the product on the given date, for the given cost dimensions and for the given currency.static CostAdjustment
insertCostAdjustmentHeader(Organization org, String sourceProcess)
Returns a new header for a Cost Adjustmentstatic CostAdjustmentLine
insertCostAdjustmentLine(CostAdjustmentLineParameters lineParameters, Date accountingDate)
Creates a new Adjustment Line and returns itstatic CostAdjustmentLine
insertCostAdjustmentLine(CostAdjustmentLineParameters lineParameters, Date accountingDate, Long lineNo)
Creates a new Adjustment Line and returns itstatic CostAdjustmentLine
insertCostAdjustmentLine(MaterialTransaction transaction, CostAdjustment costAdjustmentHeader, BigDecimal costAdjusted, boolean isSource, Date accountingDate)
Deprecated.static CostAdjustmentLine
insertCostAdjustmentLine(MaterialTransaction transaction, CostAdjustment costAdjustmentHeader, BigDecimal costAdjusted, boolean isSource, Date accountingDate, Long lineNo)
Deprecated.static CostAdjustmentLine
insertCostAdjustmentLine(MaterialTransaction transaction, CostAdjustment costAdjustmentHeader, BigDecimal costAdjusted, boolean isSource, Date accountingDate, Long lineNo, Currency currency)
Deprecated.static CostAdjustmentLine
insertCostAdjustmentLine(MaterialTransaction transaction, CostAdjustment costAdjustmentHeader, BigDecimal costAdjusted, boolean isSource, Date accountingDate, Currency currency)
Deprecated.static boolean
isNeededBackdatedCostAdjustment(MaterialTransaction transaction, boolean includeWarehouseDimension, Date startingDate)
-
-
-
Field Detail
-
strCategoryCostAdj
public static final String strCategoryCostAdj
- See Also:
- Constant Field Values
-
strTableCostAdj
public static final String strTableCostAdj
- See Also:
- Constant Field Values
-
propADListPriority
public static final String propADListPriority
- See Also:
- Constant Field Values
-
propADListReference
public static final String propADListReference
- See Also:
- Constant Field Values
-
propADListValue
public static final String propADListValue
- See Also:
- Constant Field Values
-
MovementTypeRefID
public static final String MovementTypeRefID
- See Also:
- Constant Field Values
-
ENABLE_AUTO_PRICE_CORRECTION_PREF
public static final String ENABLE_AUTO_PRICE_CORRECTION_PREF
- See Also:
- Constant Field Values
-
ENABLE_NEGATIVE_STOCK_CORRECTION_PREF
public static final String ENABLE_NEGATIVE_STOCK_CORRECTION_PREF
- See Also:
- Constant Field Values
-
-
Method Detail
-
insertCostAdjustmentHeader
public static CostAdjustment insertCostAdjustmentHeader(Organization org, String sourceProcess)
Returns a new header for a Cost Adjustment- Parameters:
org
- organization set in recordsourceProcess
- the process that origin the Cost Adjustment: - MCC: Manual Cost Correction - IAU: Inventory Amount Update - PDC: Price Difference Correction - LC: Landed Cost - BDT: Backdated Transaction
-
insertCostAdjustmentLine
@Deprecated public static CostAdjustmentLine insertCostAdjustmentLine(MaterialTransaction transaction, CostAdjustment costAdjustmentHeader, BigDecimal costAdjusted, boolean isSource, Date accountingDate)
Deprecated.Creates a new Cost Adjustment Line and returns it.- Parameters:
transaction
- transaction to apply the cost adjustmentcostAdjustmentHeader
- header of linecostAdjusted
- amount to adjust in the costisSource
-
-
insertCostAdjustmentLine
@Deprecated public static CostAdjustmentLine insertCostAdjustmentLine(MaterialTransaction transaction, CostAdjustment costAdjustmentHeader, BigDecimal costAdjusted, boolean isSource, Date accountingDate, Currency currency)
Deprecated.
-
insertCostAdjustmentLine
@Deprecated public static CostAdjustmentLine insertCostAdjustmentLine(MaterialTransaction transaction, CostAdjustment costAdjustmentHeader, BigDecimal costAdjusted, boolean isSource, Date accountingDate, Long lineNo)
Deprecated.
-
insertCostAdjustmentLine
@Deprecated public static CostAdjustmentLine insertCostAdjustmentLine(MaterialTransaction transaction, CostAdjustment costAdjustmentHeader, BigDecimal costAdjusted, boolean isSource, Date accountingDate, Long lineNo, Currency currency)
Deprecated.
-
insertCostAdjustmentLine
public static CostAdjustmentLine insertCostAdjustmentLine(CostAdjustmentLineParameters lineParameters, Date accountingDate)
Creates a new Adjustment Line and returns it- Parameters:
lineParameters
- Object that contains most of the information needed to created the Adjustment LineaccountingDate
- The Date for which this document will be posted- Returns:
- An Adjustment Line created based on the given parameters
-
insertCostAdjustmentLine
public static CostAdjustmentLine insertCostAdjustmentLine(CostAdjustmentLineParameters lineParameters, Date accountingDate, Long lineNo)
Creates a new Adjustment Line and returns it- Parameters:
lineParameters
- Object that contains most of the information needed to created the Adjustment LineaccountingDate
- The Date for which this document will be postedlineNo
- Number to position the line within the Cost Adjustment Document- Returns:
- An Adjustment Line created based on the given parameters
-
isNeededBackdatedCostAdjustment
public static boolean isNeededBackdatedCostAdjustment(MaterialTransaction transaction, boolean includeWarehouseDimension, Date startingDate)
-
getLastTransaction
public static TransactionLast getLastTransaction(MaterialTransaction trx, boolean includeWarehouseDimension)
-
compareToLastTransaction
public static int compareToLastTransaction(MaterialTransaction trx, TransactionLast lastTransaction, Date startingDate)
-
getTrxCost
public static BigDecimal getTrxCost(MaterialTransaction trx, boolean justUnitCost, Currency currency)
-
getStockOnMovementDate
public static BigDecimal getStockOnMovementDate(Product product, Organization org, Date date, HashMap<CostingAlgorithm.CostDimension,BaseOBObject> costDimensions, boolean backdatedTransactionsFixed)
Calculates the stock of the product on the given date and for the given cost dimensions. It only takes transactions that have its cost calculated.
-
getStockOnTransactionDate
public static BigDecimal getStockOnTransactionDate(Organization costorg, MaterialTransaction trx, HashMap<CostingAlgorithm.CostDimension,BaseOBObject> costDimensions, boolean isManufacturingProduct, boolean areBackdatedTrxFixed, Currency currency)
Calculates the stock of the product on the given date and for the given cost dimensions. It only takes transactions that have its cost calculated.
-
getStockOnTransactionDate
public static BigDecimal getStockOnTransactionDate(Organization costorg, MaterialTransaction trx, HashMap<CostingAlgorithm.CostDimension,BaseOBObject> costDimensions, boolean isManufacturingProduct, boolean areBackdatedTrxFixed, Currency currency, Costing costing)
Calculates the stock of the product on the given date and for the given cost dimensions. It only takes transactions that have its cost calculated.
-
getValuedStockOnMovementDate
public static BigDecimal getValuedStockOnMovementDate(Product product, Organization org, Date date, HashMap<CostingAlgorithm.CostDimension,BaseOBObject> costDimensions, Currency currency, boolean backdatedTransactionsFixed)
Calculates the value of the stock of the product on the given date, for the given cost dimensions and for the given currency. It only takes transactions that have its cost calculated.
-
getValuedStockOnMovementDateByAttrAndLocator
public static BigDecimal getValuedStockOnMovementDateByAttrAndLocator(Product product, Organization org, Date date, HashMap<CostingAlgorithm.CostDimension,BaseOBObject> costDimensions, Locator locator, AttributeSetInstance asi, Currency currency, boolean backdatedTransactionsFixed)
Calculates the value of the stock of the product on the given date, for the given cost dimensions and for the given currency. It only takes transactions that have its cost calculated.
-
getValuedStockOnTransactionDate
public static BigDecimal getValuedStockOnTransactionDate(Organization costorg, MaterialTransaction trx, HashMap<CostingAlgorithm.CostDimension,BaseOBObject> costDimensions, boolean isManufacturingProduct, boolean areBackdatedTrxFixed, Currency currency)
Calculates the value of the stock of the product on the given date, for the given cost dimensions and for the given currency. It only takes transactions that have its cost calculated.
-
getValuedStockOnTransactionDate
public static BigDecimal getValuedStockOnTransactionDate(Organization costorg, MaterialTransaction trx, HashMap<CostingAlgorithm.CostDimension,BaseOBObject> costDimensions, boolean isManufacturingProduct, boolean areBackdatedTrxFixed, Currency currency, Costing costing)
Calculates the value of the stock of the product on the given date, for the given cost dimensions and for the given currency. It only takes transactions that have its cost calculated.
-
getLastTrxDateOfMvmntDate
public static Date getLastTrxDateOfMvmntDate(Date refDate, Product product, Organization org, HashMap<CostingAlgorithm.CostDimension,BaseOBObject> costDimensions)
Returns the last transaction process date of a non backdated transactions for the given movement date or previous date.
-
getTrxTypePrio
public static long getTrxTypePrio(String mvmntType)
Returns the priority of the given movementType.
-
-