mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-15 19:19:17 +00:00
Total Purchase Cost added to Projects
This commit is contained in:
@@ -303,6 +303,15 @@
|
||||
"precision": "",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "total_purchase_cost",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"label": "Total Purchase Cost (via Purchase Invoice)",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "margin",
|
||||
"fieldtype": "Section Break",
|
||||
@@ -347,7 +356,7 @@
|
||||
"icon": "icon-puzzle-piece",
|
||||
"idx": 1,
|
||||
"max_attachments": 4,
|
||||
"modified": "2015-04-23 05:51:53.642253",
|
||||
"modified": "2015-04-27 07:37:44.239930",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Projects",
|
||||
"name": "Project",
|
||||
|
||||
@@ -89,6 +89,10 @@ class Project(Document):
|
||||
self.gross_margin = flt(total_cost.billing_amount) - flt(total_cost.costing_amount)
|
||||
if self.total_billing_amount:
|
||||
self.per_gross_margin = (self.gross_margin / flt(self.total_billing_amount)) *100
|
||||
|
||||
def update_purchase_costing(self):
|
||||
self.total_purchase_cost = frappe.db.sql("""select sum(grand_total) as cost
|
||||
from `tabPurchase Invoice` where project = %s and docstatus=1 """, self.name, as_dict=1)[0].cost
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_cost_center_name(project_name):
|
||||
|
||||
Reference in New Issue
Block a user