[fix] round percentages in get_indicator

This commit is contained in:
Anand Doshi 2015-09-22 16:36:04 +05:30
parent 53a0de7607
commit b6ec680c46
3 changed files with 11 additions and 11 deletions

View File

@ -4,17 +4,17 @@ frappe.listview_settings['Purchase Order'] = {
get_indicator: function(doc) { get_indicator: function(doc) {
if(doc.status==="Stopped") { if(doc.status==="Stopped") {
return [__("Stopped"), "darkgrey", "status,=,Stopped"]; return [__("Stopped"), "darkgrey", "status,=,Stopped"];
} else if(flt(doc.per_received) < 100 && doc.status!=="Stopped") { } else if(flt(doc.per_received, 2) < 100 && doc.status!=="Stopped") {
if(flt(doc.per_billed) < 100) { if(flt(doc.per_billed, 2) < 100) {
return [__("To Receive and Bill"), "orange", return [__("To Receive and Bill"), "orange",
"per_received,<,100|per_billed,<,100|status,!=,Stopped"]; "per_received,<,100|per_billed,<,100|status,!=,Stopped"];
} else { } else {
return [__("To Receive"), "orange", return [__("To Receive"), "orange",
"per_received,<,100|per_billed,=,100|status,!=,Stopped"]; "per_received,<,100|per_billed,=,100|status,!=,Stopped"];
} }
} else if(flt(doc.per_received) == 100 && flt(doc.per_billed) < 100 && doc.status!=="Stopped") { } else if(flt(doc.per_received, 2) == 100 && flt(doc.per_billed, 2) < 100 && doc.status!=="Stopped") {
return [__("To Bill"), "orange", "per_received,=,100|per_billed,<,100|status,!=,Stopped"]; return [__("To Bill"), "orange", "per_received,=,100|per_billed,<,100|status,!=,Stopped"];
} else if(flt(doc.per_received) == 100 && flt(doc.per_billed) == 100 && doc.status!=="Stopped") { } else if(flt(doc.per_received, 2) == 100 && flt(doc.per_billed, 2) == 100 && doc.status!=="Stopped") {
return [__("Completed"), "green", "per_received,=,100|per_billed,=,100|status,!=,Stopped"]; return [__("Completed"), "green", "per_received,=,100|per_billed,=,100|status,!=,Stopped"];
} }
}, },

View File

@ -4,14 +4,14 @@ frappe.listview_settings['Sales Order'] = {
get_indicator: function(doc) { get_indicator: function(doc) {
if(doc.status==="Stopped") { if(doc.status==="Stopped") {
return [__("Stopped"), "darkgrey", "status,=,Stopped"]; return [__("Stopped"), "darkgrey", "status,=,Stopped"];
} else if(flt(doc.per_delivered) < 100 && frappe.datetime.get_diff(doc.delivery_date) < 0) { } else if(flt(doc.per_delivered, 2) < 100 && frappe.datetime.get_diff(doc.delivery_date) < 0) {
// to bill & overdue // to bill & overdue
return [__("Overdue"), "red", "per_delivered,<,100|delivery_date,<,Today|status,!=,Stopped"]; return [__("Overdue"), "red", "per_delivered,<,100|delivery_date,<,Today|status,!=,Stopped"];
} else if(flt(doc.per_delivered) < 100 && doc.status!=="Stopped") { } else if(flt(doc.per_delivered, 2) < 100 && doc.status!=="Stopped") {
// not delivered // not delivered
if(flt(doc.per_billed) < 100) { if(flt(doc.per_billed, 2) < 100) {
// not delivered & not billed // not delivered & not billed
return [__("To Deliver and Bill"), "orange", return [__("To Deliver and Bill"), "orange",
@ -23,11 +23,11 @@ frappe.listview_settings['Sales Order'] = {
"per_delivered,<,100|per_billed,=,100|status,!=,Stopped"]; "per_delivered,<,100|per_billed,=,100|status,!=,Stopped"];
} }
} else if(flt(doc.per_delivered) == 100 && flt(doc.per_billed) < 100 && doc.status!=="Stopped") { } else if(flt(doc.per_delivered, 2) == 100 && flt(doc.per_billed, 2) < 100 && doc.status!=="Stopped") {
// to bill // to bill
return [__("To Bill"), "orange", "per_delivered,=,100|per_billed,<,100|status,!=,Stopped"]; return [__("To Bill"), "orange", "per_delivered,=,100|per_billed,<,100|status,!=,Stopped"];
} else if(flt(doc.per_delivered) == 100 && flt(doc.per_billed) == 100 && doc.status!=="Stopped") { } else if(flt(doc.per_delivered, 2) == 100 && flt(doc.per_billed, 2) == 100 && doc.status!=="Stopped") {
return [__("Completed"), "green", "per_delivered,=,100|per_billed,=,100|status,!=,Stopped"]; return [__("Completed"), "green", "per_delivered,=,100|per_billed,=,100|status,!=,Stopped"];
} }

View File

@ -3,9 +3,9 @@ frappe.listview_settings['Material Request'] = {
get_indicator: function(doc) { get_indicator: function(doc) {
if(doc.status=="Stopped") { if(doc.status=="Stopped") {
return [__("Stopped"), "red", "status,=,Stopped"]; return [__("Stopped"), "red", "status,=,Stopped"];
} else if(doc.docstatus==1 && flt(doc.per_ordered) < 100) { } else if(doc.docstatus==1 && flt(doc.per_ordered, 2) < 100) {
return [__("Pending"), "orange", "per_ordered,<,100"]; return [__("Pending"), "orange", "per_ordered,<,100"];
} else if(doc.docstatus==1 && flt(doc.per_ordered) == 100) { } else if(doc.docstatus==1 && flt(doc.per_ordered, 2) == 100) {
if (doc.material_request_type == "Purchase") { if (doc.material_request_type == "Purchase") {
return [__("Ordered"), "green", "per_ordered,=,100"]; return [__("Ordered"), "green", "per_ordered,=,100"];
} else if (doc.material_request_type == "Material Transfer") { } else if (doc.material_request_type == "Material Transfer") {