* [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];
|
||||
if(!child.billable){
|
||||
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){
|
||||
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, 'costing_amount', costing_amount);
|
||||
calculate_time_and_amount(frm);
|
||||
|
@ -49,10 +49,10 @@ class Timesheet(Document):
|
||||
self.update_time_rates(d)
|
||||
|
||||
self.total_hours += flt(d.hours)
|
||||
self.total_costing_amount += flt(d.costing_amount)
|
||||
if d.billable:
|
||||
self.total_billable_hours += flt(d.billing_hours)
|
||||
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_hours += flt(d.billing_hours) if d.sales_invoice else 0.0
|
||||
|
||||
@ -265,19 +265,19 @@ class Timesheet(Document):
|
||||
|
||||
def update_cost(self):
|
||||
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)
|
||||
hours = data.billing_hours or 0
|
||||
costing_hours = data.billing_hours or data.hours or 0
|
||||
if 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.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):
|
||||
if not ts_detail.billable:
|
||||
ts_detail.billing_rate = 0.0
|
||||
ts_detail.costing_rate = 0.0
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_projectwise_timesheet_data(project, parent=None):
|
||||
|
Loading…
x
Reference in New Issue
Block a user