* [fix] #9824 * fix code
This commit is contained in:
parent
47caf51efe
commit
07ab4622e8
@ -191,7 +191,6 @@ var update_time_rates = function(frm, cdt, cdn){
|
|||||||
var child = locals[cdt][cdn];
|
var child = locals[cdt][cdn];
|
||||||
if(!child.billable){
|
if(!child.billable){
|
||||||
frappe.model.set_value(cdt, cdn, 'billing_rate', 0.0);
|
frappe.model.set_value(cdt, cdn, 'billing_rate', 0.0);
|
||||||
frappe.model.set_value(cdt, cdn, 'costing_rate', 0.0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,9 +201,8 @@ var calculate_billing_costing_amount = function(frm, cdt, cdn){
|
|||||||
|
|
||||||
if(child.billing_hours && child.billable){
|
if(child.billing_hours && child.billable){
|
||||||
billing_amount = (child.billing_hours * child.billing_rate);
|
billing_amount = (child.billing_hours * child.billing_rate);
|
||||||
costing_amount = flt(child.costing_rate * child.billing_hours);
|
|
||||||
}
|
}
|
||||||
|
costing_amount = flt(child.costing_rate * child.hours);
|
||||||
frappe.model.set_value(cdt, cdn, 'billing_amount', billing_amount);
|
frappe.model.set_value(cdt, cdn, 'billing_amount', billing_amount);
|
||||||
frappe.model.set_value(cdt, cdn, 'costing_amount', costing_amount);
|
frappe.model.set_value(cdt, cdn, 'costing_amount', costing_amount);
|
||||||
calculate_time_and_amount(frm);
|
calculate_time_and_amount(frm);
|
||||||
|
|||||||
@ -49,10 +49,10 @@ class Timesheet(Document):
|
|||||||
self.update_time_rates(d)
|
self.update_time_rates(d)
|
||||||
|
|
||||||
self.total_hours += flt(d.hours)
|
self.total_hours += flt(d.hours)
|
||||||
|
self.total_costing_amount += flt(d.costing_amount)
|
||||||
if d.billable:
|
if d.billable:
|
||||||
self.total_billable_hours += flt(d.billing_hours)
|
self.total_billable_hours += flt(d.billing_hours)
|
||||||
self.total_billable_amount += flt(d.billing_amount)
|
self.total_billable_amount += flt(d.billing_amount)
|
||||||
self.total_costing_amount += flt(d.costing_amount)
|
|
||||||
self.total_billed_amount += flt(d.billing_amount) if d.sales_invoice else 0.0
|
self.total_billed_amount += flt(d.billing_amount) if d.sales_invoice else 0.0
|
||||||
self.total_billed_hours += flt(d.billing_hours) if d.sales_invoice else 0.0
|
self.total_billed_hours += flt(d.billing_hours) if d.sales_invoice else 0.0
|
||||||
|
|
||||||
@ -265,19 +265,19 @@ class Timesheet(Document):
|
|||||||
|
|
||||||
def update_cost(self):
|
def update_cost(self):
|
||||||
for data in self.time_logs:
|
for data in self.time_logs:
|
||||||
if data.activity_type and data.billable:
|
if data.activity_type or data.billable:
|
||||||
rate = get_activity_cost(self.employee, data.activity_type)
|
rate = get_activity_cost(self.employee, data.activity_type)
|
||||||
hours = data.billing_hours or 0
|
hours = data.billing_hours or 0
|
||||||
|
costing_hours = data.billing_hours or data.hours or 0
|
||||||
if rate:
|
if rate:
|
||||||
data.billing_rate = flt(rate.get('billing_rate')) if flt(data.billing_rate) == 0 else data.billing_rate
|
data.billing_rate = flt(rate.get('billing_rate')) if flt(data.billing_rate) == 0 else data.billing_rate
|
||||||
data.costing_rate = flt(rate.get('costing_rate')) if flt(data.costing_rate) == 0 else data.costing_rate
|
data.costing_rate = flt(rate.get('costing_rate')) if flt(data.costing_rate) == 0 else data.costing_rate
|
||||||
data.billing_amount = data.billing_rate * hours
|
data.billing_amount = data.billing_rate * hours
|
||||||
data.costing_amount = data.costing_rate * hours
|
data.costing_amount = data.costing_rate * costing_hours
|
||||||
|
|
||||||
def update_time_rates(self, ts_detail):
|
def update_time_rates(self, ts_detail):
|
||||||
if not ts_detail.billable:
|
if not ts_detail.billable:
|
||||||
ts_detail.billing_rate = 0.0
|
ts_detail.billing_rate = 0.0
|
||||||
ts_detail.costing_rate = 0.0
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_projectwise_timesheet_data(project, parent=None):
|
def get_projectwise_timesheet_data(project, parent=None):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user