[minor] project cost
This commit is contained in:
parent
4765d75b83
commit
e270c7261d
@ -91,8 +91,8 @@ class Project(Document):
|
||||
self.percent_complete = flt(completed) / total * 100
|
||||
|
||||
def update_costing(self):
|
||||
total_cost = frappe.db.sql("""select sum(total_costing_amount) as costing_amount,
|
||||
sum(total_billing_amount) as billing_amount, sum(total_expense_claim) as expense_claim,
|
||||
total_cost = frappe.db.sql("""select sum(ifnull(total_costing_amount, 0)) as costing_amount,
|
||||
sum(ifnull(total_billing_amount, 0)) as billing_amount, sum(ifnull(total_expense_claim, 0)) as expense_claim,
|
||||
min(act_start_date) as start_date, max(act_end_date) as end_date, sum(actual_time) as time
|
||||
from `tabTask` where project = %s""", self.name, as_dict=1)[0]
|
||||
|
||||
@ -107,10 +107,10 @@ class Project(Document):
|
||||
self.per_gross_margin = (self.gross_margin / flt(self.total_billing_amount)) *100
|
||||
|
||||
def update_purchase_costing(self):
|
||||
total_purchase_cost = frappe.db.sql("""select sum(base_net_amount)
|
||||
from `tabPurchase Invoice Item` where project_name = %s and docstatus=1 """, self.name)
|
||||
total_purchase_cost = frappe.db.sql("""select sum(ifnull(base_net_amount, 0))
|
||||
from `tabPurchase Invoice Item` where project_name = %s and docstatus=1""", self.name)
|
||||
|
||||
self.total_purchase_cost = total_purchase_cost[0][0] if total_purchase_cost else 0
|
||||
self.total_purchase_cost = total_purchase_cost and total_purchase_cost[0][0] or 0
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_cost_center_name(project_name):
|
||||
|
Loading…
x
Reference in New Issue
Block a user