[selling] [calculations] server side calculations, test cases and rounding based on currency number format

This commit is contained in:
Anand Doshi
2013-05-10 18:08:32 +05:30
parent b8b1e58c4d
commit 21f4ea36b2
13 changed files with 843 additions and 69 deletions

View File

@@ -1,8 +1,8 @@
[
{
"creation": "2013-04-03 09:10:44",
"creation": "2013-05-06 12:03:40",
"docstatus": 0,
"modified": "2013-04-03 09:58:02",
"modified": "2013-05-06 13:07:37",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -239,11 +239,19 @@
"oldfieldname": "net_total",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 0,
"print_hide": 1,
"read_only": 1,
"reqd": 0,
"width": "100px"
},
{
"doctype": "DocField",
"fieldname": "net_total_export",
"fieldtype": "Currency",
"label": "Net Total (Export)",
"options": "currency",
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "recalculate_values",

View File

@@ -518,6 +518,8 @@ cur_frm.cscript.calc_doc_values = function(doc, cdt, cdn, tname, fname, other_fn
if(flt(doc.conversion_rate)>1) {
net_total_incl *= flt(doc.conversion_rate);
}
// TODO: store net_total_export
doc.net_total = inclusive_rate ? flt(net_total_incl) : flt(net_total);
doc.other_charges_total = roundNumber(flt(other_charges_total), 2);

View File

@@ -1,8 +1,8 @@
[
{
"creation": "2013-03-07 14:48:34",
"creation": "2013-05-06 12:03:43",
"docstatus": 0,
"modified": "2013-01-29 17:14:58",
"modified": "2013-05-06 13:06:37",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -251,11 +251,19 @@
"oldfieldname": "net_total",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 0,
"print_hide": 1,
"read_only": 1,
"reqd": 0,
"width": "150px"
},
{
"doctype": "DocField",
"fieldname": "net_total_export",
"fieldtype": "Currency",
"label": "Net Total (Export)",
"options": "currency",
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "recalculate_values",
@@ -955,7 +963,6 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"report": 0,
"role": "Sales Manager",
@@ -978,7 +985,6 @@
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"match": "",
"permlevel": 0,
"report": 1,
"role": "Sales User",
@@ -990,7 +996,6 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"report": 0,
"role": "Sales User",
@@ -1013,7 +1018,6 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"role": "Maintenance Manager",
"submit": 0
@@ -1034,7 +1038,6 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"role": "Maintenance User",
"submit": 0