Package org.openbravo.costing
Class CostAdjustmentLineParameters
- java.lang.Object
-
- org.openbravo.costing.CostAdjustmentLineParameters
-
public class CostAdjustmentLineParameters extends Object
This class contains the necessary information to create a Cost Adjustment Line. Based on the information stored in the class, a process will be able to create a Cost Adjustment Line afterwards. It controls that it is not possible to create a Cost Adjustment Line with an empty Transaction or an empty Cost Adjustment Header. Also, it is not possible to create an adjustment that is both Unit and Negative Correction. When the Negative Correction flag is true, the Unit Cost flag is set to false automatically.
-
-
Constructor Summary
Constructors Constructor Description CostAdjustmentLineParameters(MaterialTransaction transaction, BigDecimal adjustmentAmt, CostAdjustment costAdjustmentHeader)
It creates a new object based on the given parameters.CostAdjustmentLineParameters(MaterialTransaction transaction, BigDecimal adjustmentAmt, CostAdjustment costAdjustmentHeader, Currency currency)
It creates a new object based on the given parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BigDecimal
getAdjustmentAmount()
CostAdjustment
getCostAdjustmentHeader()
Currency
getCurrency()
MaterialTransaction
getTransaction()
boolean
isBackdatedTransaction()
boolean
isNeedPosting()
boolean
isNegativeCorrection()
boolean
isRelatedTransactionAdjusted()
boolean
isSource()
boolean
isUnitCost()
void
setBackdatedTransaction(boolean isBackdatedTransaction)
Sets the value of the Backdated Transaction flag.void
setNeedPosting(boolean isNeedPosting)
Sets the value of the is Need Posting flag.void
setNegativeCorrection(boolean isNegativeCorrection)
Sets the value of the Negative Correction flag.void
setRelatedTransactionAdjusted(boolean isRelatedTransactionAdjusted)
Sets the is Related Transaction Adjusted flag.void
setSource(boolean isSource)
Set the is Source flag value.void
setUnitCost(boolean isUnitCost)
Sets the value of the Unit Cost flag.
-
-
-
Constructor Detail
-
CostAdjustmentLineParameters
public CostAdjustmentLineParameters(MaterialTransaction transaction, BigDecimal adjustmentAmt, CostAdjustment costAdjustmentHeader)
It creates a new object based on the given parameters. It also defaults the values of some other variables:- isSource: false
- isUnitCost: true>
- isBackdatedTransaction: false
- isNegativeCorrection: false
- isNeedsPosting: true
- isRelatedTransactionAdjusted: false
- Parameters:
transaction
- The Transaction for which the adjustment is going to be madeadjustmentAmt
- The amount that will be adjusted against the TransactioncostAdjustmentHeader
- The Cost Adjustment Document that will contain the adjustment line
-
CostAdjustmentLineParameters
public CostAdjustmentLineParameters(MaterialTransaction transaction, BigDecimal adjustmentAmt, CostAdjustment costAdjustmentHeader, Currency currency)
It creates a new object based on the given parameters. It also defaults the values of some other variables:- isSource: false
- isUnitCost: true>
- isBackdatedTransaction: false
- isNegativeCorrection: false
- isNeedsPosting: true
- isRelatedTransactionAdjusted: false
- Parameters:
transaction
- The Transaction for which the adjustment is going to be madeadjustmentAmt
- The amount that will be adjusted against the TransactioncostAdjustmentHeader
- The Cost Adjustment Document that will contain the adjustment linecurrency
- The Currency for which the adjustment amount is done
-
-
Method Detail
-
isSource
public boolean isSource()
- Returns:
- the value of the is Source flag. An adjustment that is source can create several other adjustments in cascade.
-
setSource
public void setSource(boolean isSource)
Set the is Source flag value. An adjustment that is source can create several other adjustments in cascade.
-
isUnitCost
public boolean isUnitCost()
- Returns:
- the value of the is Unit Cost flag. An adjustment that is Unit Cost will modify the unitary cost of the Transaction (the intrinsic cost, not taking additional costs like Landed Costs into account) A Unit Cost can not be a Negative Correction at the same time.
-
setUnitCost
public void setUnitCost(boolean isUnitCost)
Sets the value of the Unit Cost flag. An adjustment that is Unit Cost will modify the unitary cost of the Transaction (the intrinsic cost, not taking additional costs like Landed Costs into account) A Unit Cost can not be a Negative Correction at the same time. If the value of the Unit Cost is true, then the value of the Negative Correction is set to false automatically.
-
isBackdatedTransaction
public boolean isBackdatedTransaction()
- Returns:
- the value of the is Backdated Transaction flag. A Backdated Transaction adjustment means that it will take place in the past, and it will affect transactions between the past and the present.
-
setBackdatedTransaction
public void setBackdatedTransaction(boolean isBackdatedTransaction)
Sets the value of the Backdated Transaction flag. A Backdated Transaction adjustment means that it will take place in the past, and it will affect transactions between the past and the present.
-
isNegativeCorrection
public boolean isNegativeCorrection()
- Returns:
- the value of the Negative Correction flag. A Negative Correction Adjustment happens when there is negative stock and the related transaction is going to increase the stock quantity. A Negative Correction can not be a Unit Cost adjustment at the same time.
-
setNegativeCorrection
public void setNegativeCorrection(boolean isNegativeCorrection)
Sets the value of the Negative Correction flag. A Negative Correction Adjustment happens when there is negative stock and the related transaction is going to increase the stock quantity. A Negative Correction can not be a Unit Cost adjustment at the same time. If the value of the Negative Correction is true, then the value of the Unit Cost is set to false automatically.
-
isNeedPosting
public boolean isNeedPosting()
- Returns:
- the value of the is Need Posting flag. It is used to differentiate the adjustments that needs to be posted to the ledger to the ones that are not needed
-
setNeedPosting
public void setNeedPosting(boolean isNeedPosting)
Sets the value of the is Need Posting flag. It is used to differentiate the adjustments that needs to be posted to the ledger to the ones that are not needed
-
isRelatedTransactionAdjusted
public boolean isRelatedTransactionAdjusted()
- Returns:
- the value of the is Related Transaction Adjusted flag. It is true when the related transaction has been taken into account already in the adjustment process
-
setRelatedTransactionAdjusted
public void setRelatedTransactionAdjusted(boolean isRelatedTransactionAdjusted)
Sets the is Related Transaction Adjusted flag. It is true when the related transaction has been taken into account already in the adjustment process
-
getTransaction
public MaterialTransaction getTransaction()
- Returns:
- The transaction that is being adjusted
-
getCostAdjustmentHeader
public CostAdjustment getCostAdjustmentHeader()
- Returns:
- The Cost Adjustment document that is going to contain the cost adjustment line
-
getAdjustmentAmount
public BigDecimal getAdjustmentAmount()
- Returns:
- The amount that is going to be adjusted to the transaction
-
getCurrency
public Currency getCurrency()
- Returns:
- The currency for which the adjustment is made
-
-