View source | View content page | Page history | Printable version   

Projects:Cost Adjustments/TechnicalSpecs



In this document is described in detail all the developments that need to be delivered to fulfill the Cost Adjustment project.

The document is structured in the different main processes that are included in the project. The main Cost Adjustment document, and the 5 different processes which generates the adjustments. Landed Cost can be considered a project by itself but it is included in this document.

Cost Adjustment document

Window Cost Adjustments

In this window generated and processed adjustments can be reviewed.

Header tab (M_CostAdjustment table):

Reference Date
The date when the adjustment is done.
Document Type and Number
To assign a unique document number to each adjustment for further reference.
Source Process
Process source of the adjustment.
Button to cancel the adjustment.

Lines tab (M_CostAdjustmentLine table):

The transaction that needs to be adjusted
Transaction new date
Date when transaction cost has to be calculated, for backdated transactions.
Adjustment Amount
The amount that needs to be added to the cost. Negative when cost needs to be decreased.
Is Source flag
Boolean flag that indicates if the line is a source of adjustments.
Needs posting flag
Boolean flag that indicates if the adjustment has to be posted in the ledger.
Accounting Date
Date of the adjustment in the ledger.


The process has 4 steps:

  1. Checks.
  2. Searching of involved transactions.
  3. Calculating adjustment amounts.
  4. Generation of Transaction Cost records.

While process is running the Costing Background process should be disabled.

Step 1: Checks

In this step some checks are done that can throw an exception stopping the process.

Modules can include new checks implementing CostAdjustmentCheck interface.

Step 2: Searching involved Transactions

In this step all the transactions affected by the required adjustment are added to the cost adjustment. The process adds all transactions since the first transaction added as a source adjustment until a closing inventory of a inventory amount adjustment transaction is found.

When the adjusted transaction is related to a negative production. The adjustment has to be applied to the produced products involved in that manufacturing.

Step 3: Calculating adjustment amounts

In this process using the API each algorithm in use calculates the corresponding adjustment amount.

Once the algorithms have calculated the amounts any line with zero amount that it is not a source line is deleted.

Step 4: Generation of Transaction Cost records

In this step all the transactions that needs to be adjusted are included in the lines. For each of them a new record in the M_Transaction_Cost table is created.

When this step is finished the adjustment is set as Processed.

Cancel Process

A Cost Adjustment cannot be reopened or modified. If there is an error and its changes needs to be reverted it has to be canceled.

The Cancel Process generates a new Cost Adjustment. The canceling cost adjustment has the same lines than the original with negated amounts. When the canceling cost adjustment is processed it searches new transactions that might be affected by the cancellation.

Costing Algorithms API and Implementation

Average Algorithm

Standard Algorithm

FIFO Algorithm

Price Difference Corrections

This process is in charge of adjusting all the transaction costs affected by processes that are known to cause differences between the costs balance and the ledger balance.

Known causes are:

Due to rounding issues there can be products with no on hand stock but some amount in the cost balance. This process should also check it.

Boolean flag checkPriceDifference in Transactions table, defaults to false. Set to true when:

Is set to false when the Price Difference Corrections process is run.

The process is run when:

The process checks all the transactions with the flag enabled. Calculates the transaction cost based on the invoice price, if no invoice exists with the purchase price. This cost is compared with the cost already calculated for that transaction. Including other price difference corrections. In case there is any difference it is added a line in the cost adjustment document.

When the process is launched from the Inventory Amount Update process only transactions of the required product are reviewed.

Inventory Amount Update

Process that enables the ability to set a specific Inventory Amount on a date. The process is launch from a window. In this window there is a header for each execution of the process and one line for each product cost that needs to be adjusted.


Document Type and Number
To assign a unique document number to each inventory amount update for further reference.
Document Date
Default to current date
Button to process and generate the adjustments.


The product that needs to be adjusted.
Reference Date
The date when the amount is set.
Only when the costing rule in use on the reference date has the warehouse dimension enabled.
Inventory Amount
The new amount. Calculated based on the unit cost and the quantity.
Current Inventory Amount
The current amount. Read only is calculated when the product, date and warehouse are set.
On hand quantity
The on hand quantity on the reference date, including all the transactions on that date.
Unit Cost
The new unit cost. Calculated based on this and the quantity.
Current Unit Cost
The unit cost on the reference date.

The process requires that the inventory amount and the calculated costs on the date are synchronized. The ledger amount and the sum of the costs must be the same. If this is not correct it is required to launch the Price Difference Corrections process.

Creates a pair of Closing/Opening inventories. The closing inventory cost needs to be the balance on that moment. The lines of the opening inventory are created setting the unit cost defined in the paremeter. The product quantities need to be calculated on the reference date. If the reference date is not current date a backdated transaction adjustment is done automatically generating a new cost adjustment document.

Backdated Transactions adjustments

A backdated transaction is a transaction that is processed after a transaction whose movement date is newer. The Costing Server is in charge of detecting this kind of transactions when its cost is calculated. When one is detected an adjustment is automatically created to adjust the cost.

Backdated Transaction detection

When the cost of any transaction is calculated by the CostingServer class. It checks if there is any transaction with cost calculated whose movement date is after the movement date of the current transaction. The Costing Background process should not calculate any newer transaction until the backdated transaction is adjusted.

The line of the cost adjustment has as transaction date the movement date of the transaction and the adjustment amount empty.

Manual Cost Corrections

Process to manually set a new cost to a specific transaction. This process is implemented in a java class with a public method that receives the transaction and the new amount and returns the cost adjustment header. If there is an error it throws an OBException with a translated message.

The process creates a new cost adjustment. It includes a single line with the difference between current transaction cost including adjustments and the desired cost. The lines inserted by this process needs to have the needs posting flag as true.

Once the cost adjustment is created it is processed.

This process can be launched from several methods:

New computed field Adjusted Cost in the Transactions tab of product with the sum of all its Transaction Costs.

Cost Adjustment Accounting

Landed Cost

2 different types of landed costs can be delivered:

Basic Landed Cost
where the amount is added manually in the receipt without a related invoice justifying the cost
Advanced Landed Cost
where the invoices of the landed cost is related to the receipts manually when all the documents are available.

Landed Cost window

Header tab (M_LandedCost table):

Reference Date
The date when the landed cost is done.
Document Type and Number
To assign a unique document number to each adjustment for further reference.
Button to process the landed cost and generate the needed adjustments.

Costs tab (M_LC_Cost table, level 1):

Landed Cost Type
The landed cost type of this cost amount.
Distribution Algorithm

Receipt Lines Amount table (M_LC_ReceiptLine table, level 1):


Receipt window

Landed Cost tab (M_LandedCost_Cost table, level 1 child of header)

Landed Cost Type
The landed cost type of this cost amount.
Distribution Algorithm
Bulbgraph.png   Note that M_LandedCost_Cost table is child of 2 different tables, the M_LandedCost_ID FK should be optional

Landed Cost Type window

Header tab (M_LC_Type)

Default distribution algorithm

Landed Cost Distribution Algorithm window

Header tab (M_LC_Distribution_Alg)


Costing Server process

Extension of Costing Server process. When the cost of a Receipt is calculated it has to be checked if it has a Landed Cost whose cost is not processed and calculated.

Landed Cost process

Process that distributes the amount through all the related receipt lines. If the line's cost is already calculated a new Cost Adjustment is created to include the landed cost amount. If the receipt cost is not calculated yet the line's amount is left pending to adjust.

Retrieved from ""

This page has been accessed 2,703 times. This page was last modified on 11 August 2014, at 11:16. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.