Understanding Sales, Purchase, and Perpetual Inventory Accounting with ERPNext

A basic guide to sales, purchase, and perpetual inventory in ERPNext.

January 27, 2020

Back in 2017, when I had joined Frappe Technologies, I had freshly graduated out of college and had zero ideas of Enterprise systems, and likewise, accounting. The idea of learning double-entry accounting was baffling and intimidating, to say the least.

One of the major features of an ERP is to ease and automate stock and accounting entries. ERPs (such as ERPNext) do this using a concept called Perpetual Inventory. When it comes to inventory systems, we have two broad ones that are followed: Periodical Inventory and Perpetual Inventory.

Now, before we move forward, a pre-requisite is that one understands some basic accounting topics, such as the Chart of Accounts, debit-credit, and double-entry accounting and some business terms such as orders, invoices, payment entry, etc. If you want to brush up your terms a bit, refer:

Now that we have our basics in check, let's dive right in!

1. Periodical Inventory vs Perpetual Inventory

Periodic Inventory Perpetual Inventory
The accounting for stock/inventory is not updated frequently. Stocktake is done at the end of a period (usually, year-end). The stock/inventory and accounts are updated in tandem, ie, inventory-accounting is done in real-time.
You can book the expense of an item right away when booking the purchase invoice. When booking a Purchase Invoice, the expense is not booked for the items directly. It is booked after the sale of the item is made under Cost of Goods Sold (COGS).
COGS needs to be calculated for Periodic Inventory. COGS is readily available in case of Perpetual Inventory as the booking is done on every sale.

Setting Up Perpetual Accounting In ERPNext

When setting up a company in ERPNext, the system by default has perpetual inventory enabled. You can check this, by going to the Company master in your instance under the Stocks Settings header:

ERPNext - Set Perpetual Inventory

Note that the system is asking for an inventory account. This is account will be used to record entries in case of inventory action.

Perpetual Inventory in Purchase/Buying Cycle

Let's take a simple case of sales and purchase to see how the accounting entries are generated. You are a trading company that buys and sells cell phones.  You are falling short of inventory on a certain model, so you raise a Purchase Order to your supplier for the same:

Purchase Order

Purchase Receipt

Once the order is received by the supplier, they ship the device back to you. On receiving the device, you generate a Purchase Receipt/GRN. Submitting the Receipt causes two sets of entries to be generated in the ERP. One is the stock ledger which holds information such as the quantities, the valuation rate, and balance, the other is a general ledger entry that holds the accounting information.

Let's have a look at the General Ledger entry generated for the Receipt:

Account Debit Credit
Stock In Hand 65,000 0
Stock Received But Not Billed 0 65,000
Total 65,000 65,000

As you see, since we have accepted the device in our inventory, we have added to the value of our assets. Hence Stock in Hand, our warehouse account from earlier, which falls under Assets in the Chart of Accounts is debited.

An equivalent amount is credited in a Liability account appropriately labeled Stock Received But Not Billed.

At the same time, the stock ledger is updated as well!

Stock Ledger GRN

Here you can see that 1 quantity has been accepted into the Stores warehouse. This entry is generated on submission of the receipt, at no extra steps!

Purchase Invoice

After the device is received, the supplier then sends the invoice from their end. Now, for simplicity's sake, we are not involving taxes, but if you want to go a touch deeper, you can refer to the documentation.

An invoice is sent to you for ₹65,000. You book the same by creating a Purchase Invoice in the system. On submission, the invoice generates the following entries:

Account Debit Credit
Creditors 0 65,000
Stock Received But Not Billed 65,000
Total 65,000 65,000

Since you have purchased the device, you now owe the supplier ₹65,000. Hence, Creditors, a liability account is debited. The equivalent amount is credited in Stock Received But Not Billed which you may remember from the previous transaction has a balance of 65,000 Cr. The invoice entry nullifies that account balance and sets it back to 0.

You will see that the expense of the device, is still not booked.

Now since we owe the supplier a sum, that will be promptly reflected in the Accounts Payable report:

Accounts Payable Report - ERPNext

Payment Entry

Now, you will be making the payment against the invoice from say, your bank account. You create a payment entry record in ERPNext of type Pay.

Since the amount is deducted from your bank account, which is an Asset, an entry will be made crediting 65,000 from the bank account:

Account Debit Credit
Creditors 65,000 0
HSBC 0 65,000
Total 65,000 65,000

The entry is made against Creditors which has a balance of 65000 Dr, which is nullified, and thus you have paid your supplier! This means that the invoice is removed from your Payables as well. This step completes the cycle on the purchase side.

4. Perpetual Inventory In Sales Cycle

Now coming to the sales side. When you close the deal for the device, and the customer sends a Purchase Order from their end, you book a Sales Order in ERPNext. Let's assume you closed the deal for ₹100,000.

Delivery Note

After the order is booked, you proceed to deliver the item from the system to the customer and create a Delivery Note in the system.

Account Debit Credit
Cost of Goods Sold 65,000 0
Stock in Hand 0 65,000
Total 65,000 65,000

Since delivering the device means reducing its count from your inventory, the stock has been reduced, the asset value we hold has reduced. Hence, the Stock in Hand (an Asset account) has been credited and Cost of Goods Sold, an expense account is debited. Cost of Goods Sold is an expense account, that holds or records the cost of producing and delivering goods and services. It may also be referred to as the account which records the "book value" of goods. As said earlier, this is the point when the expense of the item is booked.

Stock Ledger - Delivery Note ERPNext

Also, in the stock ledger, we see that 1 quantity of the device/item has been reduced at the stated valuation rate.

Sales Invoice

We are now sending an invoice to the customer for the sale made. The entries for the Sales Invoice look something like this:

Account Debit Credit
Debtors 100,000 0
Sales 0 100,000
Total 100,000 100,000

As we have sold the device for ₹100,000 that amount is credited to Sales, an Income account. On the flip side, the customer now owes us ₹100,000. Since we are subscribing to accrual accounting practices, we assume that the sum will be paid on a future date to us. Hence the amount is debited to Debtors, an Asset account.

Another impact the invoice will have is our Accounts Receivable report. This is a similar report to Payables on the sales cycle which shows how much you are owed your customers.

ERPNext - accounts receivables

Payment Entry

And now we are in the final stage, that of payment. The customer has paid you through a bank transfer. This transfer will be reflected in ERPNext, as a Receive type.

On submission of the payment entry, the following entries are generated:

Account Debit Credit
Debtors 0 100,000
HSBC 100,000 0
Total 100,000 100,000

As the money has been paid to our bank account, the same, represented by HSBC will be debited by 100,000. Equivalent posting is made into Debtors under credit, thus settling the account.

In this manner, your inventory, accounting, sales, and purchases are simplified and kept in sync with ERPNext!

You can start a free trial to discover more yourself and read our docs for more info 😄.

This article first appeared on Medium

Kenneth Sequeira
Kenneth Sequeira
"Resident marketing engineer."
2 comments
Nofal Mami January 29, 2020

Hi, Thanks for the post, just small typo error,

Since you have purchased the device, you now owe the supplier ₹65,000. Hence, Creditors, a liability account is debited*.

correction: credited and not debited

Kenneth Sequeira January 29, 2020

@Nofal, thanks for the heads up, it is fixed!

Add Comment