Calculating cost for produced products
In the production process, some materials (issued from one or multiple stores) are transformed into a certain output (entered into the store). The cost of the issue transactions has to be transferred to the receipt transactions. This is similar to the transfer and return of goods (see Calculating cost for transferred products and Calculating cost for returned products). However, the calculations are different.
During production, the receipt store orders are generated by output orders. There are two stages for calculating the cost in the receipt store orders:
Comparison between the rows in the consumption orders and the rows in the output orders. For each row in the output orders, that comparison defines which materials are used for the production of the product in the current row.
For each row in the consumption orders, the cost of the issue transactions of the current row is distributed by its relevant output orders rows from stage 1.
In the end, it is provided that on each output order row, the distributed amount comes only from the materials that are used for the produced products in the current row. This distributed amount is written as a specifically set cost in the receipt store order, which is generated by the output order.
Stage 1: Comparison of the rows in the consumption and output orders
Released, non-voided consumption orders and output orders that are sub-documents of a given work order are taken into account. For each row of an output order, the following is defined:
what part of the materials is used to produce the specified row and from which consumption order rows the materials are taken.
This data is saved in a Distributed material consumptions table (part of the output order data).
The output orders may get materials only from consumption orders released before the output order. In other words, the release order for consumption and output orders defines how the quantities in their rows will be compared. When a user creates a new output order and releases it, the distributed materials are recalculated. This is true for corrections as well.
For each output order row, the following is executed:
All rows for released, non-voided consumption orders for the current work order item are filtered (their quantities need to be taken into account). The consumption orders are released before the current output order.
From the quantities of the rows in step 1, quantities of materials distributed on the same work order item by output orders (released before the current one) are removed.
From what's left of the materials, the necessary quantities for the current row of the output order are distributed. They are defined by the Recipe in the work order. For the current row, they cannot be distributed in bigger quantities than they are allowed to. Exception is made only for the last output orders from each work order item or for the output order rows marked as Finished. The rest of the materials are distributed on Finished rows.
When releasing new consumption orders or voiding released consumption orders, these steps are executed again for each output order from the current work order. This keeps the distributions for these output orders up-to-date.
Example 1:
There is a work order producing 3 PCS of a product. The materials are 9 PCS from Material #1 and 12 PCS from Material #2. The materials are consumed in two stages:
Consumption order CO#1, which has 8 PCS from Material #1 and 8 PCS from Material #2
Consumption order CO#2, which has 1 PCS from Material #1 and 4 PCS from Material #2
Both consumption orders are released and the first output order is created for 2 PCS of the work order item.
When this output order is released, the following materials distribution is calculated:
Product, CO#1, Material #1, 6 PCS;
Product, CO#1, Material #2, 8 PCS.
Then, the user creates and releases an output order for the rest 1 PCS of the work order item.
It distributes the following:
Product, CO#1, Material #1, 2 PCS.
Product, CO#2, Material #1, 1 PCS.
Product, CO#2, Material #2, 4 PCS.
In the current stage, it is possible that no issue/receipt store transactions have been released yet. Therefore, this distribution is used to reserve materials for work order items. When the store transactions begin, the cost of the issue transactions is transferred to the receipt transactions (Stage 2) using the already calculated distribution.
Sometimes the remaining non-distributed materials from an output order are less than what is ordered by the recipe in the current output order. In this case, the output order is distributed in fewer than the technologically defined quantities. The remaining excess (if, of course, this is requested by following consumption orders) will be distributed to the last output order of the current work order item (or to a row marked as "Finished"). Let's take a look at such an example.
Example 2:
We have the same work order as in Example 1. First, CO#1 is released with 5 PCS of Material #1 and 6 PCS of Material #2. Then, an output order is released for the 2 PCS of the work order item. According to the recipe, 6 PCS of Material #1 and 8 PCS of Material #2 should be distributed. By now, no consumption orders with such quantities have been released. As a result, the output order takes fewer quantities (from CO#1):
Work order item, CO#1, Material #1, 5 PCS;
Work order item, CO#1, Material #2, 6 PCS.
Then, CO#2 is released with the rest of the materials quantities - 4 PCS and 6 PCS, respectively. When the second output order is released for the remaining 1 PCS, more materials per unit will be distributed than in the first output order:
Work order item, CO#2, Material #1, 4 PCS;
Work order item, CO#2, Material #2, 6 PCS.
There are cases when non-distributed materials remain even after the release of the last output order on one work order.
Usually, this happens if consumption orders are released after all output orders. As a final result, an output order with 0 quantity is released.
Such output orders are called completing output orders and all remaining materials are distributed to them.
Sometimes these orders are not only released, but come before the last output order with non-zero quantities. This is done when there are non-distributed materials, though the next output orders will not be released soon.
The completing output orders (also known as intermediate) "collect" all the remaining material quantities without having to release the next output order.
The two examples above describe production processes where each material from a Work Order is assigned to exactly one work order item. There are materials which cannot be assigned to a specific work order item (the work order item field in the ingredients table is empty). Instead, the quantity of the material is distributed to all work order items in the current Work Order.
This distribution may be achieved by two methods (different values in the Distribute By field):
by Standard Price - the current Standard Price Per Lot of the products from the work order rows (the work order items) is used. The price is then multiplied by the quantities in the rows and the result becomes a coefficient for materials distribution;
by Measurement - the quantities from the work order rows are used as coefficients. Each quantity is converted into a measurement category, which is specified in the material row. All products must have defined product dimensions for the specified category.
After the coefficients are defined by one of the methods, the quantities from the consumption order are distributed to an output order as follows:
All rows of released, non-voided Consumption Orders are filtered. The consumption orders are released before the current output order.
The quantities from p.1 are decreased by the material quantities distributed to output orders which are released before the current one.
The entire remaining materials quantity is distributed by the coefficients among all rows of the current output order. To define the coefficients, the quantities from the current output order are used.
Note
If all work order items have a Standard Price Per Lot of 0 (zero), the coefficients would also be 0.
In that case, the cost of all materials from p.2 is distributed equally among the work order items.
As a result, cost loss is avoided.
Example 3:
There is a Work Order with 295 PCS of a given material, which is distributed by standard price among four work order items of the work order:
Product #1 (standard price is 17 EUR), Product #2 (standard price is 9 EUR), Product #2 (standard price is 12 EUR), and Product #4 (standard price is 20 EUR). For each work order item, 2 PCS are produced.
First, CO #1 is released for 189 PCS of the material. Then, OO #1 is released with the following:
2 PCS of Product #1, 1 PCS of Product #2 and 1 PCS of Product #4.
The coefficients for distribution in the current output order are:
2 * 17 : 1 * 9 : 1 * 20 = 34 : 9 : 20.
According to these coefficients, the following distribution is achieved:
Product #1, CO#1, Material, 189 * 34 / (34 + 9 + 20) = 102 PCS;
Product #2, CO#1, Material, 189 * 9 / (34 + 9 + 20) = 27 PCS;
Product #3, CO#1, Material, 189 * 20 / (34 + 9 + 20) = 60 PCS.
Then, a new CO #2 is released for the rest 106 PCS, and the last output order is released for the rest of the work order items.
It has the following coefficients:
1 * 9 : 9 * 12 : 1 * 20 = 9 : 24 : 20.
The distribution is calculated as follows:
Product #2, CO#2, Material, 106 * 9 / (9 + 24 + 20) = 18 PCS;
Product #3, CO#2, Material, 106 * 24 / (9 + 24 + 20) = 48 PCS;
Product #4, CO#2, Material, 106 * 20 / (9 + 24 + 20) = 40 PCS.
Stage 2: Issue transactions cost distribution
Once Stage 1 is completed, the cost of the issue transactions is transferred to the receipt transactions. This operation can be explained with the quantity distribution of the materials from the consumption orders and the work order items from the output orders. The distributions are used to form proportions which help distribute the cost of the consumption order transactions among the output orders. This distribution is also saved in the "Distributed Material consumptions" table (in the output order document) and then it is used to set the cost of the receipt store transactions correctly.
When new issue transactions appear from consumption orders, an update of the distributions in all output orders (from one work order) is executed again. The quantity distributions are complemented by the cost distributions.
Let's examine this particular case:
There is a row from a consumption order which contains 15 PCS, 5 PCS of which are distributed to one output order and the rest 10 go to another output order. If there are several store transactions to issue all 15 PCS at a cost of 371 EUR, then one-third of it is distributed to the first output order and the rest is distributed to the second one. A detailed example follows.
Example 4:
There is a work order producing 3 PCS of a product. The materials are 9 PCS from Material #1 and 12 PCS of Material #2.
The materials are consumed in two stages:
Consumption order CO#1, which has 8 PCS from Material #1 and 8 PCS from Material #2
Consumption order CO#2, which has 1 PCS from Material #1 and 4 PCS from Material #2
There is an output order for 2 PCS of the work order item with the following distribution:
Product, CO#1, Material #1, 6 PCS;
Product, CO#1, Material #2, 8 PCS.
The second output order is for 1 PCS from the work order item with the following distribution:
Product, CO#1, Material #1, 2 PCS;
Product, CO#2, Material #1, 1 PCS;
Product, CO#2, Material #2, 4 PCS.
If the issue cost is 40 EUR for Material #1 and 71 EUR for Material #2 from CO#1 and 7 EUR for Material #1 and 39 EUR for Material #2 from CO#2, then a distribution is calculated where the quantity comparisons are filled with costs.
The first output order has the following:
Product, CO#1, Material #1, 6 PCS, 40 * 6 / 8 = 30 EUR;
Product, CO#1, Material #2, 8 PCS, 71 * 8 / 8 = 71 EUR.
And the cost of the produced product from this output order is 30 + 71 = 101 EUR.
For the second output order, there is the following:
Product, CO#1, Material #1, 2 PCS, 40 * 2 / 8 = 10 EUR;
Product, CO#2, Material #1, 1 PCS, 7 * 1 / 1 = 7 EUR;
Product, CO#2, Material #2, 4 PCS, 39 * 4 / 4 = 39 EUR.
And the total cost of the produced product is 10 + 7 + 39 = 56 EUR.
Issue and receipt balance
Similarly to store transfers and sales, there is a receipt limitation in the production - it cannot exceed the issue. Unlike store transfers and sales, the validation is a bit more complicated because the product in the issue transactions is different from the product in the receipt transactions. The materials are not the same as the produced product.
As a result, the total quantities of issue and receipt transactions cannot be compared directly.
The limitation is applied on all store transactions that are caused by a Work Order.
For each transaction timestamp, the following is executed:
All issues (the materials) are summed up with a transaction timestamp less than or equal to the current. By their receipts from the work order, it is defined what is the largest quantity that is available for production from these materials;
All receipts (the produced products) are summed up with a transaction timestamp less than or equal to the current;
A validation is performed to check if the maximum quantity of the product from p.1 is bigger than or equal to the receipt total from p2.
For more information about the validation, see Receipt and issue balance validation in store transfers.