Skip to content

Why do backdated entries break FIFO cost? Wrong COGS in your ERP

  • Home
  • Blog
  • Why do backdated entries break FIFO cost? Wrong COGS in your ERP
Why do backdated entries break FIFO cost? Wrong COGS in your ERP
Short answer

In an ERP, the cost of an issue is calculated at the moment the document is posted, based on the receipts up to that date. When a receipt or issue is later added with an earlier date, or stock goes negative, the cost of every issue after that date no longer reflects reality, and cost of goods sold (COGS) and gross profit are reported wrongly. The fix is to clear negative stock and date errors first, then run cost recalculation on a test copy, with periods locked, starting from the earliest affected date.

Symptoms: the figures do not add up, but there is no error message

  • The cost of the same product jumps between two sales; some line margins are close to 100 percent, others are negative.
  • The monthly gross profit report gives a different result when you rerun it for a past month.
  • The total of the inventory valuation report does not match the inventory account in the general ledger (in the Turkish chart of accounts, 153 Merchandise).
  • Some products have a unit cost of zero or far above their purchase prices; quantity is zero but a value balance remains.
  • The stock ledger shows quantities that briefly drop below zero during the day and then turn positive again.
  • The system raises no error; the problem only becomes visible when reports are compared. Some ERPs show warnings such as “cost must be recalculated” or “negative balance” on certain screens.

Root cause: cost depends on date order, documents arrive out of order

The IAS 2 Inventories standard prescribes the first-in, first-out (FIFO) or weighted average cost formula for items that are ordinarily interchangeable, and requires the carrying amount of inventories to be recognised as an expense (cost of goods sold) when they are sold. With both methods, the cost of an issue depends on the receipts that happened before it. In other words, the result depends on the date order of transactions.

An ERP, however, values an issue the moment it is posted. Microsoft’s Dynamics 365 documentation describes this behaviour explicitly: under the FIFO model, until inventory close is run, issues are valued at the running average at the time they were posted; FIFO matching and adjustments only happen during close or recalculation, based on the financial date of the transactions. Other ERPs may call it “cost recalculation”, “cost distribution” or “inventory close”, but the logic is the same.

The problem appears in three ways. First, a backdated receipt: if a purchase invoice entered on 20 March is posted with a date of 5 March, the correct cost of every issue between 5 and 20 March changes, yet those issues remain recorded at the old cost. Second, a backdated issue: a sale inserted into the past shifts which cost layer later issues draw from. Third, and most damaging, negative stock: if a sale is invoiced before the goods physically arrive, the system finds no receipt to value the issue against and falls back to a value such as the item’s cost price, the last purchase price or zero. In Microsoft’s published example on negative inventory, for an item where every purchase was at 7,500.00 per unit, fallback values and averaging leave the remaining stock valued at 18,750.00 per unit, and the error carries forward into later transactions. The same article notes that inventory close cannot fully adjust issues while the balance is still negative.

Step-by-step fix

  1. Before touching anything, take a full database backup and restore it to a separate test environment. You will run the recalculation on this copy first.
  2. Find the affected products and the earliest affected date. List documents where the document date differs greatly from the entry (creation) date; these are the backdated entries.
  3. For each product, compute the cumulative quantity in date order and find the points where it drops below zero. The query below is a generic, read-only example; adapt table and column names to your ERP’s stock movement table.
  4. Fix the cause of negative stock: post forgotten purchase invoices or production receipts with the correct date, and correct the dates of wrongly dated documents. While a balance stays negative, recalculation cannot produce a correct result.
  5. Lock all periods except those that must stay open. Schedule the work outside business hours so users do not post new documents during the recalculation.
  6. On the test copy, run the cost recalculation starting from the earliest affected date. If you proceed month by month, always go from oldest to newest; calculating a newer month and then going back to an older one invalidates the newer month’s result again.
  7. Verify the result: compare COGS per product, period-end inventory value and the ledger inventory account before and after recalculation. If the differences make sense, repeat the same process on the live system in the same order.
  8. If the recalculation does not update the accounting entries automatically, post the resulting differences as adjusting entries together with your accountant. Changing figures in periods for which tax returns were filed or the e-Defter (Turkey’s mandatory electronic ledger) was already signed off requires a separate accounting decision.
-- GENERIC EXAMPLE, read-only. Table/column names vary by ERP.
-- Goal: find rows where cumulative quantity per product drops below zero in date order.
SELECT *
FROM (
    SELECT item_code, doc_date, doc_no, signed_qty,
           SUM(signed_qty) OVER (
               PARTITION BY item_code
               ORDER BY doc_date, doc_no
               ROWS UNBOUNDED PRECEDING) AS cumulative_qty
    FROM stock_movements
) AS t
WHERE t.cumulative_qty < 0
ORDER BY item_code, doc_date;

Cost recalculation changes the cost fields of all past issue documents in bulk, and most ERPs have no undo button for it. Before running it on the live system, always take a current full backup, try it on the test copy first, and make sure no users post documents while it runs.

Preventing recurrence

  • Close periods regularly: run cost calculation at every month end and lock the period. According to Microsoft’s Dynamics 365 documentation, after inventory close you can no longer post in periods before the closing date; most ERPs have a similar period lock.
  • Do not allow negative stock for items costed at actual cost (FIFO or weighted average). If the business process requires it, define a meaningful item cost price for temporary valuation.
  • Require a permission to enter document dates more than a set number of days in the past, and grant it to only a few people.
  • If sales must be invoiced before goods are physically received, introduce a rule that the receipt document (delivery note or goods receipt) is posted first.
  • Add the backdated document report and the negative balance report to the month-end checklist.

When to call an expert

If the affected period spans several months, if thousands of items have negative balances, if closed and declared periods are involved, or if you are unsure how your ERP’s cost calculation affects accounting entries, a recalculation run in the wrong order can make the error worse. A significant share of the cost differences we see in the field at businesses in Denizli come from documents entered out of order and from permitted negative stock. As part of its ERP and ERP support service, Workas analyses stock movements, runs cost recalculation in a test environment and sets up period-closing rules, planned together with your accountant; we work Monday to Saturday from 08:00 to 18:00 and respond with priority in emergencies.

Frequently Asked Questions

Will recalculation change my sales invoices?

No. Sales prices and invoice amounts stay the same; what changes are the cost fields of issue documents and, with them, COGS and inventory value.

Is negative stock still a problem if it only lasted briefly?

Yes. An issue posted while the balance was negative is costed at a fallback value, which carries into later averages. A recalculation is needed for a lasting correction.

Will switching from FIFO to weighted average solve the problem?

No. With weighted average the cost of an issue also depends on receipts up to that date; backdated documents and negative stock distort this method too.

How often should I run recalculation?

At least at every month end, before locking the period. Where backdated documents are frequent, an interim run during the month makes reports more reliable.

Sources

  1. IAS 2 Inventories – IFRS Foundation
  2. Inventory close – Dynamics 365 Supply Chain Management – Microsoft Learn
  3. FIFO with physical value and marking – Microsoft Learn
  4. Negative inventory in inventory accounting – Microsoft Dynamics 365 Blog

Let's Get Started

Let's Work Together!

Let's plan your company's IT needs together — we'll quickly find the right solution for you.

x

Since 2002, Workas Software Technology has provided businesses in Denizli with ERP, cybersecurity, network, server and backup, custom software and AI solutions.

Address
Kınıklı, Hüseyin Yılmaz Cd. No:67,
B Blok Z06, 20160 Pamukkale/Denizli, Türkiye
Get in Touch
0549 669 99 06
0535 089 29 29
Working Hours
Mon - Sat: 8:00 - 18:00