diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index 1b1527b7eb..0b32d47cd5 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -187,15 +187,15 @@ class calculate_taxes_and_totals(object): return tax.rate def calculate_net_total(self): - self.doc.print_total = self.doc.base_print_total = self.doc.net_total = self.doc.base_net_total = 0.0 + self.doc.total = self.doc.base_total = self.doc.net_total = self.doc.base_net_total = 0.0 for item in self.doc.get("items"): - self.doc.print_total += item.amount - self.doc.base_print_total += item.base_amount + self.doc.total += item.amount + self.doc.base_total += item.base_amount self.doc.net_total += item.net_amount self.doc.base_net_total += item.base_net_amount - self.doc.round_floats_in(self.doc, ["print_total", "base_print_total", "net_total", "base_net_total"]) + self.doc.round_floats_in(self.doc, ["total", "base_total", "net_total", "base_net_total"]) def calculate_taxes(self): # maintain actual tax rate based on idx diff --git a/erpnext/public/js/controllers/accounts.js b/erpnext/public/js/controllers/accounts.js index c8bb86cfaa..8911832016 100644 --- a/erpnext/public/js/controllers/accounts.js +++ b/erpnext/public/js/controllers/accounts.js @@ -85,7 +85,7 @@ cur_frm.set_query("cost_center", "taxes", function(doc) { }); // For customizing print -cur_frm.pformat.print_total = function(doc) { return ''; } +cur_frm.pformat.total = function(doc) { return ''; } cur_frm.pformat.discount_amount = function(doc) { return ''; } cur_frm.pformat.grand_total = function(doc) { return ''; } cur_frm.pformat.rounded_total = function(doc) { return ''; } @@ -116,8 +116,8 @@ cur_frm.pformat.taxes= function(doc){ out +=''; - if(!print_hide('print_total')) { - out += make_row('Net Total', doc.print_total, 1); + if(!print_hide('total')) { + out += make_row('Total', doc.total, 1); } // Discount Amount on net total diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index 603b147a00..4018742c3d 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -179,16 +179,16 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({ calculate_net_total: function() { var me = this; - this.frm.doc.print_total = this.frm.doc.base_print_total = this.frm.doc.net_total = this.frm.doc.base_net_total = 0.0; + this.frm.doc.total = this.frm.doc.base_total = this.frm.doc.net_total = this.frm.doc.base_net_total = 0.0; $.each(this.frm.doc["items"] || [], function(i, item) { - me.frm.doc.print_total += item.amount; - me.frm.doc.base_print_total += item.base_amount; + me.frm.doc.total += item.amount; + me.frm.doc.base_total += item.base_amount; me.frm.doc.net_total += item.net_amount; me.frm.doc.base_net_total += item.base_net_amount; }); - frappe.model.round_floats_in(this.frm.doc, ["print_total", "base_print_total", "net_total", "base_net_total"]); + frappe.model.round_floats_in(this.frm.doc, ["total", "base_total", "net_total", "base_net_total"]); }, calculate_taxes: function() { diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json index 7a00237c9f..675e6b0fd7 100644 --- a/erpnext/selling/doctype/quotation/quotation.json +++ b/erpnext/selling/doctype/quotation/quotation.json @@ -313,9 +313,9 @@ "read_only": 0 }, { - "fieldname": "base_print_total", + "fieldname": "base_total", "fieldtype": "Currency", - "label": "Print Total (Company Currency)", + "label": "Total (Company Currency)", "options": "Company:company:default_currency", "permlevel": 0, "precision": "", @@ -343,9 +343,9 @@ "permlevel": 0 }, { - "fieldname": "print_total", + "fieldname": "total", "fieldtype": "Currency", - "label": "Print Total", + "label": "Total", "options": "currency", "permlevel": 0, "precision": "", @@ -844,7 +844,7 @@ "idx": 1, "is_submittable": 1, "max_attachments": 1, - "modified": "2015-02-23 00:55:17.519474", + "modified": "2015-02-23 01:18:17.421144", "modified_by": "Administrator", "module": "Selling", "name": "Quotation", diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js index 2c520f6edd..1414912dfd 100644 --- a/erpnext/selling/sales_common.js +++ b/erpnext/selling/sales_common.js @@ -326,12 +326,12 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ } }); }; - setup_field_label_map(["base_net_total", "base_total_taxes_and_charges", "base_discount_amount", "base_grand_total", - "base_rounded_total", "base_in_words", + setup_field_label_map(["base_total", "base_net_total", "base_total_taxes_and_charges", + "base_discount_amount", "base_grand_total", "base_rounded_total", "base_in_words", "outstanding_amount", "total_advance", "paid_amount", "write_off_amount"], company_currency); - setup_field_label_map(["net_total", "total_taxes_and_charges", "discount_amount", "grand_total", + setup_field_label_map(["total", "net_total", "total_taxes_and_charges", "discount_amount", "grand_total", "rounded_total", "in_words"], this.frm.doc.currency); cur_frm.set_df_property("conversion_rate", "description", "1 " + this.frm.doc.currency @@ -343,7 +343,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ } // toggle fields - this.frm.toggle_display(["conversion_rate", "base_net_total", "base_total_taxes_and_charges", + this.frm.toggle_display(["conversion_rate", "base_total", "base_net_total", "base_total_taxes_and_charges", "base_grand_total", "base_rounded_total", "base_in_words", "base_discount_amount"], this.frm.doc.currency != company_currency); @@ -372,13 +372,15 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ }); } - setup_field_label_map(["base_rate", "base_price_list_rate", "base_amount"], + setup_field_label_map(["base_rate", "base_net_rate", "base_price_list_rate", "base_amount", "base_net_amount"], company_currency, "items"); - setup_field_label_map(["rate", "price_list_rate", "amount"], + setup_field_label_map(["rate", "net_rate", "price_list_rate", "amount", "net_amount"], this.frm.doc.currency, "items"); - setup_field_label_map(["tax_amount", "total"], company_currency, "taxes"); + setup_field_label_map(["tax_amount", "total", "tax_amount_after_discount"], this.frm.doc.currency, "taxes"); + + setup_field_label_map(["base_tax_amount", "base_total", "base_tax_amount_after_discount"], company_currency, "taxes"); if(this.frm.fields_dict["advances"]) { setup_field_label_map(["advance_amount", "allocated_amount"], company_currency, @@ -387,15 +389,24 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ // toggle columns var item_grid = this.frm.fields_dict["items"].grid; - var show = (this.frm.doc.currency != company_currency) || - ((cur_frm.doc.taxes || []).filter( - function(d) { return d.included_in_print_rate===1}).length); - $.each(["base_rate", "base_price_list_rate", "base_amount"], function(i, fname) { + if(frappe.meta.get_docfield(item_grid.doctype, fname)) + item_grid.set_column_disp(fname, this.frm.doc.currency != company_currency); + }); + + var show = (cint(cur_frm.doc.discount_amount)) || + ((cur_frm.doc.taxes || []).filter(function(d) {return d.included_in_print_rate===1}).length); + + $.each(["net_rate", "net_amount"], function(i, fname) { if(frappe.meta.get_docfield(item_grid.doctype, fname)) item_grid.set_column_disp(fname, show); }); + $.each(["base_net_rate", "base_net_amount"], function(i, fname) { + if(frappe.meta.get_docfield(item_grid.doctype, fname)) + item_grid.set_column_disp(fname, (show && (this.frm.doc.currency != company_currency))); + }); + // set labels var $wrapper = $(this.frm.wrapper); $.each(field_label_map, function(fname, label) {