[fix] #9824 - Calculate costing amount even if billable is unchecked (#11310)

* [fix] #9824

* fix code
diff --git a/erpnext/projects/doctype/timesheet/timesheet.js b/erpnext/projects/doctype/timesheet/timesheet.js
index 1ea5962..43f5705 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.js
+++ b/erpnext/projects/doctype/timesheet/timesheet.js
@@ -191,7 +191,6 @@
 	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 @@
 
 	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);
diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py
index ad566d5..01552a5 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.py
+++ b/erpnext/projects/doctype/timesheet/timesheet.py
@@ -49,10 +49,10 @@
 			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 @@
 
 	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):