minor changes

This commit is contained in:
Rohit Waghchaure 2016-09-09 15:05:17 +05:30
parent c940440fbe
commit 1d0e8ea9c6
3 changed files with 10 additions and 7 deletions

View File

@ -96,7 +96,7 @@
"columns": 0, "columns": 0,
"fieldname": "timesheet_detail", "fieldname": "timesheet_detail",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 1,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
@ -126,7 +126,7 @@
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-09-08 05:36:00.922319", "modified": "2016-09-09 14:01:04.095775",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Invoice Timesheet", "name": "Sales Invoice Timesheet",

View File

@ -156,9 +156,12 @@ var calculate_time_and_amount = function(frm) {
for(var i=0; i<tl.length; i++) { for(var i=0; i<tl.length; i++) {
if (tl[i].hours) { if (tl[i].hours) {
total_working_hr += tl[i].hours; total_working_hr += tl[i].hours;
total_billing_hr += tl[i].billing_hours;
total_billing_amount += tl[i].billing_amount; total_billing_amount += tl[i].billing_amount;
total_costing_amount += tl[i].costing_amount; total_costing_amount += tl[i].costing_amount;
if(tl[i].billable){
total_billing_hr += tl[i].billing_hours;
}
} }
} }

View File

@ -246,12 +246,12 @@ 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 (not data.billing_amount or not data.costing_amount): if data.activity_type and 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
if rate: if rate:
data.billing_rate = flt(rate.get('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')) 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 * hours
@ -262,7 +262,7 @@ def get_projectwise_timesheet_data(project, parent=None):
cond = "and parent = %(parent)s" cond = "and parent = %(parent)s"
return frappe.db.sql("""select name, parent, billing_hours, billing_amount as billing_amt return frappe.db.sql("""select name, parent, billing_hours, billing_amount as billing_amt
from `tabTimesheet Detail` where docstatus=1 and project = %(project)s {0} from `tabTimesheet Detail` where docstatus=1 and project = %(project)s {0} and billable = 1
and sales_invoice is null""".format(cond), {'project': project, 'parent': parent}, as_dict=1) and sales_invoice is null""".format(cond), {'project': project, 'parent': parent}, as_dict=1)
@frappe.whitelist() @frappe.whitelist()