ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Project Gross Margin - is this calculated correctly?


#1

Hi All:
how is Project Gross Margin is calculated?
Total Consumed Material Cost (via Stock Entry)
Total Purchase Cost (via Purchase Invoice)
I see that Consumed Martial Cost is not included if purchase invoice is not liked to a certain project.
let me explain with a case
we purchases 25,000 box to use for different orders (projects)
in project 1 we used 3200 box
value of 3200 is included in Total Consumed Material but not affect the margin
any one can explain the formula or business behind the project screen?

why journal entry can be assigned to a project while project screen is not affected by any journal entry?

thanks


#2

well I found the formula
self.gross_margin = flt(self.total_billed_amount) - (flt(self.total_costing_amount) + flt(self.total_expense_claim) + flt(self.total_purchase_cost))

Total Consumed Material Cost (via Stock Entry) is not included

Is it correct?


#3

“Is it correct?”

Presumably yes unless someone ‘proves’ otherwise - have you a counterexample?


#4

No not correct, margin ignored Consumed materials related to the project which came from purchase invoice not liked to the project

Let me explain again with an example
we purchased 1000 Empty box PO 1 for 1000$, for different sales orders (not linked to a project)
we purchased 250 kg raw material PO2 for specific Sales order for 500$
we linked PO2 to Project P1
packed every kg in a box and sold 250 item for 3$
Sock movement for 250 box and 250 kg raw material will be linked to P1
linked the sales, INvoice, Payment to P1

currently ERPNext will ignore the cost of boxes in calculating the margin for P1 as PO1 is not linked the P1

there should be a new field for Total Consumed Material Cost (via Stock Entry) not in Purchase Orders


#5

try to implement this case
you have 3 items only in your manufacturing process
Raw Material item lets name it Raw 1
Boxes for packing let’s name it Box
Finished item witch is Raw 1 Packed in Box name item Finished Product

Lets have the following scenario
Purchase Order PO1
1000 Box for 1$ Total 1000$

Sales Order SO1
250 Finished Product 4$ Each Total 1000$

Link SO1 to Project P1
from P1 Make PO2
250 Raw Material, 2$ Each, Total 500$

Receive Raw Material and link to P1
make Supplier invoice , payment Link to P1
Deliver Goods , make invoice, payment and Link to P1

now ERPNext will show the follwing
Total Sales Amount (via Sales Order) 1000$ (correct)
Total Billed Amount (via Sales Invoices) 1000$ (correct)
Total Consumed Material Cost (via Stock Entry) 750$ (correct)
Total Purchase Cost (via Purchase Invoice) 500$ (correct)

Gross Margin 500$ (Wrong)

Margin should be 250$ only
as Cost should include 250$ Boxes


#6

any reply?


#7

Well my ‘gross profit margin’ search uncovered this here https://github.com/frappe/erpnext/issues/13548

Maybe comment there or create and link to your own distinct issue?


#8

#9

How can I capture expenses made through Journal entry to ensure it affect the Gross Margin of a project too?


#10

As a related issue, if in a profitability report by project you add a column for gross margin (or vice versa) you can observe some projects have different gross profits and margins! Some I have tracked down to:

  • date filter handled differently
  • margin sometimes including Purch Orders and Sales Orders and profitability only Sales and Purch invoices

But, even for projects where everything is in time period filter, everything is invoiced still get differences cannot explain and not always margin > profitability or vice versa


#11

Hi, anyone to assist on the above? Thanks