But the problem is, I don’t know how to calculate the valuation rate in stock ledger.
Anyone can help with the formula to calculate the valution rate?
Here is my screen capture from stock ledger

Please post or provide a link to a spreadsheet of that’s the stock ledger output for one of the items. This should be for all transactions for the item right from the first transaction.

With that, somebody may be able to help you better.

But let me take a stab at it for now. These calculations that ERPNext is making seem to be perfect. FIFO means that inward stock valuation is done the same as Moving Average. But outward stocks happen at the rate at which the stock first came in at. Plus you have to look at valuation at the warehouse level, as ERPNext maintains separate valuation at the warehouse level.

All transactions till the 45 Inward are fine, because they are all at Rp 5000.00. After that you have 35 coming into Stores - SMT at 4500, so the total valuation amount for 170 (Balance after the 35 inward) is 675,000 + 35*4500 = 832,500. So the valuation rate works out to be 832,500/170 = 4897.06.

Similarly for the 60 inward at 5400 and 45 inward at 6000. Now you have an outward transaction - however the outward happens at Rp 5,000.00 (because of FIFO), so the valuation amount after this transaction is Rp. 1,426,500 - 5000*20 = Rp 1,326,500. And the valuation rate is 1326500/255 = Rp 5201.96.