A line's COGS (cost of goods sold) is calculated when the order is prepared, in the same step that lowers stock. Fenicia spends lots by FIFO or FEFO and stores the per-lot breakdown in items[].cogs. What the lots do not cover comes out of stock without a lot at the product's unitCost. If there is neither a lot nor a unitCost, the row is left with costMissing: true and does not count toward total COGS until you correct it.
A line's original cogs is never modified. Each correction appends a row to items[].cogsAdjustments[] with who made it, when, why, and the previous and new breakdown.
A row with a lot does not accept a free amount
A free amount on a row that spent a lot would make the lots and the COGS stop matching. To correct the cost of a line that has a lot, correct the lot's cost in Lots and valuation: Fenicia recalculates every line that spent it. Only lines without a lot are corrected on this page.
Returns the line with its original cogs and its cogsAdjustments[] history, now with the new correction. The line's current COGS is the newTotalCogs of the latest correction. If the line has reversals from returns, the correction is also recorded on each affected reversal.
Required permission:orders:costs. Fenicia grants it by default only to the administrator role.
Returns how many orders and lines were corrected. It only changes lines of that SKU and of your tenant that did not spend a lot, and each one receives its row in cogsAdjustments[]. Use it after entering the product's unitCost when there are lines with costMissing.
Returns the additional cost with source: "supply" and the breakdown of what was spent. The supply is spent from its lots by FIFO, or from its stock without a lot at unitCost.
When a return is accepted, Fenicia records the COGS reversal of the returned pieces in items[].cogsReversals[], with the per-lot breakdown, and hands the merchandise to inventory as a reception of type return. Each piece goes back to its original lot when released. See Returns and refunds and Receipts and receiving tray.