How Wafeq handles negative inventory

You can approve a sales invoice for a tracked inventory item (product) in Wafeq even when the quantity recorded in stock isn't enough to cover the quantity sold. For example, you might sell the goods and approve the sales invoice before recording the supplier's purchase invoice for it, so the on-hand quantity goes below zero until the purchase invoice is later recorded. This article explains how Wafeq calculates the cost of goods sold and the inventory balance in this case, how it automatically corrects these values once the purchase is recorded, and what you can do to keep your inventory numbers accurate.

 

How Wafeq costs a sale when stock is available

Wafeq values tracked inventory at the weighted average cost. Every movement that adds stock, such as a purchase bill, an inventory adjustment, or a finished manufacturing order, adds its quantity and its value to the item's inventory. The average cost is the total inventory value divided by the quantity on hand. Every sale is costed at that average and reduces both the quantity and the value.
 

Example: you record two bills for the same item, then sell part of it.

  • Bill for 100 units at 5 SAR: quantity on hand 100, inventory value 500 SAR, average cost 5.00 SAR.
  • Bill for 100 units at 7 SAR: quantity on hand 200, inventory value 1,200 SAR, average cost 1,200 ÷ 200 = 6.00 SAR.
  • Invoice for 50 units: COGS = 50 × 6.00 = 300 SAR. Quantity on hand 150, inventory value 900 SAR, average cost still 6.00 SAR.

The COGS amount is posted to the item's Expense Account on the invoice date, and the same amount is deducted from the inventory asset account.

 

What happens when you sell more than you have

When an invoice takes the quantity on hand below zero, Wafeq splits the sold quantity into two parts:

  • The covered part: the units that were on hand are costed at the current average cost, exactly as in a normal sale.
  • The shortfall: the units that were not on hand are costed from the stock that later satisfies the sale, oldest receipt first, at that receipt's actual unit cost. If it takes more than one receipt to cover the shortfall, each receipt prices the units it supplies.

Until such a receipt exists, Wafeq records an estimated cost for the shortfall. The estimate is the last known average cost of the item. If the item has no cost history at all, Wafeq uses the Purchase Cost entered on the item. If that is blank too, the estimate is zero.

 

As soon as you record the bill (or adjustment) that supplies the missing units, Wafeq replaces the estimate with the real cost automatically. The correction is posted on the original invoice date, so the cost of goods sold lands in the month of the sale, not in the month the bill was entered.

 

Example 1: a partial shortfall.

  • 1 January, bill for 100 units at 5 SAR: quantity 100, value 500 SAR, average 5.00 SAR.
  • 2 January, invoice for 150 units. 100 units are covered: 100 × 5.00 = 500 SAR. 50 units are short and estimated at the last known average: 50 × 5.00 = 250 SAR. Estimated COGS = 750 SAR. The Inventory Movement Report shows quantity −50 and value −250 SAR.
  • 10 January, bill for 200 units at 6 SAR. The 50 short units are re-costed at this bill's price: 50 × 6.00 = 300 SAR. Final COGS on the 2 January invoice = 500 + 300 = 800 SAR. The remaining 150 units are on hand at 6.00 SAR: quantity 150, value 900 SAR.

 

Example 2: selling with no stock and no cost history.

  • 7 May, invoice for 300 units. Nothing is on hand and no bill has ever been recorded for this item, so the estimated COGS is 0 SAR. The report shows quantity −300 and value 0.
  • 14 May, bill for 300 units at 4.65 SAR (1,395 SAR). The 7 May invoice is re-costed to 300 × 4.65 = 1,395 SAR. Quantity 0, value 0.
  • 16 May, invoice for 300 units, before its bill is entered. The last known cost is 4.65 SAR, so the estimated COGS is 300 × 4.65 = 1,395 SAR.
  • 18 May, bill for 300 units at 4.80 SAR (1,440 SAR). The 16 May invoice is re-costed to 300 × 4.80 = 1,440 SAR. Quantity 0, value 0, and total COGS for the two sales = 1,395 + 1,440 = 2,835 SAR, which is exactly what you paid for the goods.

 

Example 3: one shortfall covered by two bills.

  • 1 January, invoice for 300 units with nothing on hand: estimated COGS 0 SAR.
  • 5 January, bill for 100 units at 4 SAR. 100 of the 300 units are priced at 4.00 = 400 SAR. The other 200 are still short and estimated at the last known cost of 4.00 = 800 SAR. Estimated COGS = 1,200 SAR.
  • 8 January, bill for 200 units at 5 SAR. The remaining 200 units are priced at 5.00 = 1,000 SAR. Final COGS = 400 + 1,000 = 1,400 SAR. Quantity 0, value 0.

 

Example 4: one bill covering several sales.

  • 1 January, invoice for 10 units and 2 January, invoice for 5 units, both with nothing on hand.
  • 3 January, bill for 20 units at 4 SAR. The oldest sale is priced first: the 1 January invoice gets 10 × 4.00 = 40 SAR, the 2 January invoice gets 5 × 4.00 = 20 SAR, and the 5 units left over stay on hand at 4.00 SAR: quantity 5, value 20 SAR.

 

Reports and financial statements reflect the estimate until the bill is recorded. Enter the bill as soon as you receive it so that the cost of goods sold and the inventory balance are final.

 

Editing, back-dating, or voiding the bill that prices a sale

Because the cost of a shortfall comes from the receipts that satisfy it, Wafeq re-costs the affected sales automatically whenever those receipts change.

  • Changing the bill price: 1 January, invoice for 150 units with nothing on hand; 5 January, bill for 200 units at 6 SAR. COGS = 150 × 6.00 = 900 SAR, and 50 units stay on hand at 300 SAR. If you change the bill's unit price to 7 SAR, the COGS becomes 150 × 7.00 = 1,050 SAR and the 50 units on hand are worth 350 SAR.
     
  • Entering an earlier-dated bill later: 1 January, invoice for 10 units; 5 January, bill for 10 units at 10 SAR, so COGS = 100 SAR. You then enter a bill dated 3 January for 5 units at 5 SAR. Since the oldest receipt prices the sale first, the COGS becomes 5 × 5.00 + 5 × 10.00 = 75 SAR, and the 5 units of the 5 January bill that were not needed stay on hand at 10.00 SAR: quantity 5, value 50 SAR.
     
  • Voiding the bill: if you void or delete the bill that priced a sale, that sale goes back to an estimated cost. In the first example above, voiding the 5 January bill puts the invoice back to an estimated COGS of 0 SAR (nothing else is known about the item) and the quantity on hand back to −150.
     

Customer returns while stock is short

A customer return is recorded with a credit note and adds the returned units back to inventory. If the item is still short when the return is recorded, the return cancels the most recent shortfall instead: the credit note carries the same cost as the units it cancels, so the two documents net to zero. A return is never used to price other sales; only bills, adjustments, and manufacturing outputs can do that.

  • 1 January: A sales invoice for 5 units is approved with nothing on hand: estimated COGS 0 SAR. 2 January: A credit note for the same 5 units is recorded — since the shortfall was still open, it cancels it out instead of restocking, so the credit note's inventory value is also 0 SAR and the quantity on hand stays at 0.
  • 5 January: A purchase bill for 5 units at 10 SAR is recorded. Since the shortfall was already cancelled, these 5 units simply go on hand at 10.00 SAR: quantity 5, value 50 SAR. The invoice and the credit note remain netted at the same amount (0 SAR), with no further effect on COGS.

When stock is already on hand, a return simply re-enters inventory at the current average cost. For example: a bill for 10 units at 100 SAR, then an invoice for 2 units (COGS 200 SAR), then a credit note for those 2 units returns 200 SAR to inventory: quantity 10, value 1,000 SAR.

 

For more details, see: How to Record a Sales Return?
 

Order of movements on the same day

When several movements of the same item are dated on the same day, Wafeq processes them in this order: stock coming in (bills, adjustments, manufacturing outputs) first, then sales, then customer returns. A bill and an invoice dated the same day therefore do not create a shortfall as long as the bill covers the sold quantity: the invoice is costed from that bill.

When you enter a bill after the goods were sold, date it on the day the goods actually arrived. The sales from that day onward are then costed from the bill directly.

 

How the average cost recovers after a shortfall

Once the shortfall is settled, the average cost is calculated from the units that remain on hand and their real cost. The average is not distorted by the price of stock that was sold before it arrived.

1 January: A purchase bill for 2 units at 100 SAR is recorded: quantity 2, value 200 SAR.

2 January: A sales invoice for 4 units is approved, 2 units are covered at the current cost of 100.00 SAR (200 SAR), while 2 units remain short.

 3 January: A purchase bill for 10 units at 50 SAR is recorded. The 2 short units are priced at this rate (50.00 SAR = 100 SAR), bringing the invoice's total COGS to 200 + 100 = 300 SAR. 

 

The remaining 8 units sit on hand at 50.00 SAR: quantity 8, value 400 SAR, average cost 50.00 SAR.

 

Stock received at zero value

If the stock that satisfies a shortfall carries no value, for example an inventory adjustment entered with a quantity but no inventory value, or free goods, the units are matched to the sale but the cost stays an estimate of zero. A later bill with a real price does not change that, because the free units are the ones that satisfied the sale.

1 January: A sales invoice for 10 units is approved with nothing on hand. 2 January: An adjustment of +10 units is recorded with an inventory value of 0 SAR. This settles the shortage, so the invoice's COGS stays at 0 SAR. 3 January: A purchase bill for 10 units at 100 SAR is recorded. Since the shortage was already cleared by the zero-value adjustment, the invoice's COGS remains at 0 SAR — the 10 newly purchased units simply sit on hand at 100.00 SAR: quantity 10, value 1,000 SAR.

 

Always enter the Inventory value on inventory adjustments that add stock, so that every unit carries a real cost.

 

Sales in a closed period

If the invoice with the estimated cost falls in a closed accounting period, Wafeq does not change it when the bill is recorded later. The estimated cost stays on the invoice, and the value of the bill stays in inventory.

5 January: A sales invoice for 10 units is approved with nothing on hand, so the estimated COGS is 0 SAR. January is then closed.

10 February: A purchase bill for 10 units at 9 SAR is recorded. Because the 5 January invoice falls in a closed period, it keeps its COGS at 0 SAR — the quantity on hand becomes 0, but the inventory value sits at 90 SAR.

 

Once the period is reopened, the next bill or inventory adjustment recorded for that item automatically re-costs the invoice and clears the difference.

 

For more details, see: How to Lock Accounting Periods

 

Keeping your inventory costs accurate

  • Record your opening stock with an inventory adjustment before you start invoicing, so that the first sales are costed from real stock. See: Setting up an initial quantity on hand for an inventory item.
  • Enter bills promptly, dated on the day the goods arrived.
  • Fill in the Purchase Cost on each tracked item, so that a sale recorded before its bill is estimated at a realistic cost instead of zero.
  • Check the Inventory Movement Report regularly for items with a negative closing quantity, and record the missing bills or adjustments. See: Inventory Movement Report.

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.