fixed conflict
diff --git a/erpnext/accounts/doctype/c_form/c_form.py b/erpnext/accounts/doctype/c_form/c_form.py
index c04e7c2..a0a9dc1 100644
--- a/erpnext/accounts/doctype/c_form/c_form.py
+++ b/erpnext/accounts/doctype/c_form/c_form.py
@@ -54,17 +54,17 @@
 			frappe.throw(_("Please enter atleast 1 invoice in the table"))
 
 	def set_total_invoiced_amount(self):
-		total = sum([flt(d.grand_total) for d in self.get('invoices')])
+		total = sum([flt(d.base_grand_total) for d in self.get('invoices')])
 		frappe.db.set(self, 'total_invoiced_amount', total)
 
 	def get_invoice_details(self, invoice_no):
 		"""	Pull details from invoices for referrence """
 		if invoice_no:
 			inv = frappe.db.get_value("Sales Invoice", invoice_no,
-				["posting_date", "territory", "net_total", "grand_total"], as_dict=True)
+				["posting_date", "territory", "base_net_total", "base_grand_total"], as_dict=True)
 			return {
 				'invoice_date' : inv.posting_date,
 				'territory'    : inv.territory,
-				'net_total'    : inv.net_total,
-				'grand_total'  : inv.grand_total
+				'net_total'    : inv.base_net_total,
+				'grand_total'  : inv.base_grand_total
 			}
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index 05f2e59..66e4854 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -221,7 +221,7 @@
 	def validate_against_order_fields(self, doctype, payment_against_voucher):
 		for voucher_no, payment_list in payment_against_voucher.items():
 			voucher_properties = frappe.db.get_value(doctype, voucher_no,
-				["docstatus", "per_billed", "status", "advance_paid", "grand_total"])
+				["docstatus", "per_billed", "status", "advance_paid", "base_grand_total"])
 
 			if voucher_properties[0] != 1:
 				frappe.throw(_("{0} {1} is not submitted").format(doctype, voucher_no))
diff --git a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.js b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.js
index ffd8ea7..2b79e29 100644
--- a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.js
+++ b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.js
@@ -1,7 +1,7 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-cur_frm.set_query("default_account", "mode_of_payment_details", function(doc, cdt, cdn) {
+cur_frm.set_query("default_account", "accounts", function(doc, cdt, cdn) {
 	return{
 		filters: [
 			['Account', 'account_type', 'in', 'Bank, Cash'],
@@ -9,4 +9,4 @@
 			['Account', 'company', '=', doc.company]
 		]
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/accounts/doctype/payment_tool/payment_tool.py b/erpnext/accounts/doctype/payment_tool/payment_tool.py
index 9a8df4d..3ff3dc9 100644
--- a/erpnext/accounts/doctype/payment_tool/payment_tool.py
+++ b/erpnext/accounts/doctype/payment_tool/payment_tool.py
@@ -82,8 +82,8 @@
 	orders = frappe.db.sql("""
 		select
 			name as voucher_no,
-			ifnull(grand_total, 0) as invoice_amount,
-			(ifnull(grand_total, 0) - ifnull(advance_paid, 0)) as outstanding_amount,
+			ifnull(base_grand_total, 0) as invoice_amount,
+			(ifnull(base_grand_total, 0) - ifnull(advance_paid, 0)) as outstanding_amount,
 			transaction_date as posting_date
 		from
 			`tab%s`
@@ -91,7 +91,7 @@
 			%s = %s
 			and docstatus = 1
 			and ifnull(status, "") != "Stopped"
-			and ifnull(grand_total, 0) > ifnull(advance_paid, 0)
+			and ifnull(base_grand_total, 0) > ifnull(advance_paid, 0)
 			and abs(100 - ifnull(per_billed, 0)) > 0.01
 		""" % (voucher_type, 'customer' if party_type == "Customer" else 'supplier', '%s'),
 			party, as_dict = True)
@@ -106,9 +106,9 @@
 @frappe.whitelist()
 def get_against_voucher_amount(against_voucher_type, against_voucher_no):
 	if against_voucher_type in ["Sales Order", "Purchase Order"]:
-		select_cond = "grand_total as total_amount, ifnull(grand_total, 0) - ifnull(advance_paid, 0) as outstanding_amount"
+		select_cond = "base_grand_total as total_amount, ifnull(base_grand_total, 0) - ifnull(advance_paid, 0) as outstanding_amount"
 	elif against_voucher_type in ["Sales Invoice", "Purchase Invoice"]:
-		select_cond = "grand_total as total_amount, outstanding_amount"
+		select_cond = "base_grand_total as total_amount, outstanding_amount"
 	elif against_voucher_type == "Journal Entry":
 		select_cond = "total_debit as total_amount"
 
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index 95bfad5..6f16dcd 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -94,7 +94,7 @@
 	},
 
 	allocated_amount: function() {
-		this.calculate_total_advance("Purchase Invoice", "advances");
+		this.calculate_total_advance();
 		this.frm.refresh_fields();
 	},
 
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
index 4054dd5..6c32971 100755
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
@@ -265,7 +265,7 @@
   }, 
   {
    "description": "Will be calculated automatically when you enter the details", 
-   "fieldname": "net_total", 
+   "fieldname": "base_net_total", 
    "fieldtype": "Currency", 
    "label": "Net Total (Company Currency)", 
    "oldfieldname": "net_total", 
@@ -281,7 +281,7 @@
    "permlevel": 0
   }, 
   {
-   "fieldname": "net_total_import", 
+   "fieldname": "net_total", 
    "fieldtype": "Currency", 
    "label": "Net Total", 
    "oldfieldname": "net_total_import", 
@@ -340,7 +340,7 @@
    "read_only": 0
   }, 
   {
-   "fieldname": "other_charges_added", 
+   "fieldname": "base_taxes_and_charges_added", 
    "fieldtype": "Currency", 
    "label": "Taxes and Charges Added (Company Currency)", 
    "oldfieldname": "other_charges_added", 
@@ -351,7 +351,7 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "other_charges_deducted", 
+   "fieldname": "base_taxes_and_charges_deducted", 
    "fieldtype": "Currency", 
    "label": "Taxes and Charges Deducted (Company Currency)", 
    "oldfieldname": "other_charges_deducted", 
@@ -362,7 +362,18 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "grand_total", 
+   "fieldname": "base_total_taxes_and_charges", 
+   "fieldtype": "Currency", 
+   "label": "Total Taxes and Charges (Company Currency)", 
+   "oldfieldname": "total_tax", 
+   "oldfieldtype": "Currency", 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1
+  }, 
+  {
+   "fieldname": "base_grand_total", 
    "fieldtype": "Currency", 
    "label": "Grand Total (Company Currency)", 
    "oldfieldname": "grand_total", 
@@ -374,7 +385,7 @@
   }, 
   {
    "description": "In Words will be visible once you save the Purchase Invoice.", 
-   "fieldname": "in_words", 
+   "fieldname": "base_in_words", 
    "fieldtype": "Data", 
    "label": "In Words (Company Currency)", 
    "oldfieldname": "in_words", 
@@ -393,7 +404,7 @@
    "width": "50%"
   }, 
   {
-   "fieldname": "other_charges_added_import", 
+   "fieldname": "taxes_and_charges_added", 
    "fieldtype": "Currency", 
    "label": "Taxes and Charges Added", 
    "oldfieldname": "other_charges_added_import", 
@@ -404,7 +415,7 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "other_charges_deducted_import", 
+   "fieldname": "taxes_and_charges_deducted", 
    "fieldtype": "Currency", 
    "label": "Taxes and Charges Deducted", 
    "oldfieldname": "other_charges_deducted_import", 
@@ -415,7 +426,15 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "grand_total_import", 
+   "fieldname": "total_taxes_and_charges", 
+   "fieldtype": "Currency", 
+   "label": "Total Taxes and Charges", 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": ""
+  }, 
+  {
+   "fieldname": "grand_total", 
    "fieldtype": "Currency", 
    "in_list_view": 1, 
    "label": "Grand Total", 
@@ -427,7 +446,7 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "in_words_import", 
+   "fieldname": "in_words", 
    "fieldtype": "Data", 
    "label": "In Words", 
    "oldfieldname": "in_words_import", 
@@ -462,17 +481,6 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "total_tax", 
-   "fieldtype": "Currency", 
-   "label": "Total Tax (Company Currency)", 
-   "oldfieldname": "total_tax", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1
-  }, 
-  {
    "fieldname": "outstanding_amount", 
    "fieldtype": "Currency", 
    "in_filter": 1, 
@@ -880,7 +888,7 @@
  "icon": "icon-file-text", 
  "idx": 1, 
  "is_submittable": 1, 
- "modified": "2015-02-05 05:11:43.312905", 
+ "modified": "2015-02-11 16:56:27.871736", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Purchase Invoice", 
@@ -970,7 +978,7 @@
   }
  ], 
  "read_only_onload": 1, 
- "search_fields": "posting_date, supplier, fiscal_year, bill_no, grand_total, outstanding_amount", 
+ "search_fields": "posting_date, supplier, fiscal_year, bill_no, base_grand_total, outstanding_amount", 
  "sort_field": "modified", 
  "sort_order": "DESC", 
  "title_field": "supplier_name"
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 9b0b8b1..4e0570f 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -240,7 +240,7 @@
 		self.check_prev_docstatus()
 
 		frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype,
-			self.company, self.grand_total)
+			self.company, self.base_grand_total)
 
 		# this sequence because outstanding may get -negative
 		self.make_gl_entries()
@@ -258,7 +258,7 @@
 		gl_entries = []
 
 		# parent's gl entry
-		if self.grand_total:
+		if self.base_grand_total:
 			gl_entries.append(
 				self.get_gl_dict({
 					"account": self.credit_to,
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js
index 82112d1..1c43b7e 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js
@@ -3,7 +3,7 @@
 
 // render
 frappe.listview_settings['Purchase Invoice'] = {
-	add_fields: ["supplier", "supplier_name", "grand_total", "outstanding_amount", "due_date", "company",
+	add_fields: ["supplier", "supplier_name", "base_grand_total", "outstanding_amount", "due_date", "company",
 		"currency"],
 	get_indicator: function(doc) {
 		if(doc.outstanding_amount > 0 && doc.docstatus==1) {
diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
index ffb9ad0..49011b0 100644
--- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
@@ -145,7 +145,7 @@
 			self.assertEqual(item.item_tax_amount, expected_values[i][1])
 			self.assertEqual(item.valuation_rate, expected_values[i][2])
 
-		self.assertEqual(wrapper.net_total, 1250)
+		self.assertEqual(wrapper.base_net_total, 1250)
 
 		# tax amounts
 		expected_values = [
@@ -179,7 +179,7 @@
 			self.assertEqual(item.item_tax_amount, expected_values[i][1])
 			self.assertEqual(item.valuation_rate, expected_values[i][2])
 
-		self.assertEqual(wrapper.net_total, 1250)
+		self.assertEqual(wrapper.base_net_total, 1250)
 
 		# tax amounts
 		expected_values = [
diff --git a/erpnext/accounts/doctype/purchase_invoice/test_records.json b/erpnext/accounts/doctype/purchase_invoice/test_records.json
index dd5daea..9139e0c 100644
--- a/erpnext/accounts/doctype/purchase_invoice/test_records.json
+++ b/erpnext/accounts/doctype/purchase_invoice/test_records.json
@@ -41,7 +41,7 @@
    }
   ],
   "fiscal_year": "_Test Fiscal Year 2013",
-  "grand_total_import": 0,
+  "grand_total": 0,
   "naming_series": "_T-BILL",
   "taxes": [
    {
@@ -164,7 +164,7 @@
    }
   ],
   "fiscal_year": "_Test Fiscal Year 2013",
-  "grand_total_import": 0,
+  "grand_total": 0,
   "naming_series": "_T-Purchase Invoice-",
   "taxes": [
    {
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js
index b0988b2..4f91c56 100644
--- a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js
+++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js
@@ -8,15 +8,15 @@
 }
 
 // For customizing print
-cur_frm.pformat.net_total_import = function(doc) {
+cur_frm.pformat.net_total = function(doc) {
 	return '';
 }
 
-cur_frm.pformat.grand_total_import = function(doc) {
+cur_frm.pformat.grand_total = function(doc) {
 	return '';
 }
 
-cur_frm.pformat.in_words_import = function(doc) {
+cur_frm.pformat.in_words = function(doc) {
 	return '';
 }
 
@@ -49,8 +49,8 @@
 
 	// main table
 	out +='<table class="noborder" style="width:100%">';
-	if(!print_hide('net_total_import'))
-		out += make_row('Net Total', doc.net_total_import, 1);
+	if(!print_hide('net_total'))
+		out += make_row('Net Total', doc.net_total, 1);
 
 	// add rows
 	if(cl.length){
@@ -60,14 +60,14 @@
 	}
 
 	// grand total
-	if(!print_hide('grand_total_import'))
-		out += make_row('Grand Total', doc.grand_total_import, 1);
+	if(!print_hide('grand_total'))
+		out += make_row('Grand Total', doc.grand_total, 1);
 
-	if(doc.in_words_import && !print_hide('in_words_import')) {
+	if(doc.in_words && !print_hide('in_words')) {
 		out += '</table></td></tr>';
 		out += '<tr><td colspan = "2">';
 		out += '<table><tr><td style="width:25%;"><b>In Words</b></td>';
-		out += '<td style="width:50%;">' + doc.in_words_import + '</td></tr>';
+		out += '<td style="width:50%;">' + doc.in_words + '</td></tr>';
 	}
 
 	out +='</table></td></tr></table></div>';
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index fac9442..820e42d 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -54,7 +54,7 @@
 				frappe.set_route("query-report", "General Ledger");
 			}, "icon-table");
 
-			// var percent_paid = cint(flt(doc.grand_total - doc.outstanding_amount) / flt(doc.grand_total) * 100);
+			// var percent_paid = cint(flt(doc.base_grand_total - doc.outstanding_amount) / flt(doc.base_grand_total) * 100);
 			// cur_frm.dashboard.add_progress(percent_paid + "% Paid", percent_paid);
 
 			cur_frm.add_custom_button(__('Send SMS'), cur_frm.cscript.send_sms, 'icon-mobile-phone');
@@ -167,17 +167,16 @@
 	},
 
 	allocated_amount: function() {
-		this.calculate_total_advance("Sales Invoice", "advances");
+		this.calculate_total_advance();
 		this.frm.refresh_fields();
 	},
 
 	write_off_outstanding_amount_automatically: function() {
 		if(cint(this.frm.doc.write_off_outstanding_amount_automatically)) {
-			frappe.model.round_floats_in(this.frm.doc, ["grand_total", "paid_amount"]);
+			frappe.model.round_floats_in(this.frm.doc, ["base_grand_total", "paid_amount"]);
 			// this will make outstanding amount 0
 			this.frm.set_value("write_off_amount",
-				flt(this.frm.doc.grand_total - this.frm.doc.paid_amount,
-					precision("write_off_amount"))
+				flt(this.frm.doc.base_grand_total - this.frm.doc.paid_amount, precision("write_off_amount"))
 			);
 		}
 
@@ -249,7 +248,7 @@
 	if(doc.is_pos) {
 		return cur_frm.call({
 			method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_bank_cash_account",
-			args: { 
+			args: {
 				"mode_of_payment": doc.mode_of_payment,
 				"company": doc.company
 			 },
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index 7ceab70..8e79603 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -332,7 +332,7 @@
    "permlevel": 0
   }, 
   {
-   "fieldname": "net_total", 
+   "fieldname": "base_net_total", 
    "fieldtype": "Currency", 
    "label": "Net Total (Company Currency)", 
    "oldfieldname": "net_total", 
@@ -349,7 +349,7 @@
    "permlevel": 0
   }, 
   {
-   "fieldname": "net_total_export", 
+   "fieldname": "net_total", 
    "fieldtype": "Currency", 
    "label": "Net Total", 
    "options": "currency", 
@@ -423,7 +423,7 @@
    "permlevel": 0
   }, 
   {
-   "fieldname": "other_charges_total_export", 
+   "fieldname": "total_taxes_and_charges", 
    "fieldtype": "Currency", 
    "label": "Total Taxes and Charges", 
    "options": "currency", 
@@ -432,7 +432,7 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "other_charges_total", 
+   "fieldname": "base_total_taxes_and_charges", 
    "fieldtype": "Currency", 
    "label": "Total Taxes and Charges (Company Currency)", 
    "oldfieldname": "other_charges_total", 
@@ -476,7 +476,7 @@
    "read_only": 0
   }, 
   {
-   "fieldname": "grand_total", 
+   "fieldname": "base_grand_total", 
    "fieldtype": "Currency", 
    "in_filter": 1, 
    "label": "Grand Total (Company Currency)", 
@@ -490,7 +490,7 @@
    "search_index": 0
   }, 
   {
-   "fieldname": "rounded_total", 
+   "fieldname": "base_rounded_total", 
    "fieldtype": "Currency", 
    "label": "Rounded Total (Company Currency)", 
    "oldfieldname": "rounded_total", 
@@ -502,7 +502,7 @@
   }, 
   {
    "description": "In Words will be visible once you save the Sales Invoice.", 
-   "fieldname": "in_words", 
+   "fieldname": "base_in_words", 
    "fieldtype": "Data", 
    "label": "In Words (Company Currency)", 
    "oldfieldname": "in_words", 
@@ -545,7 +545,7 @@
    "width": "50%"
   }, 
   {
-   "fieldname": "grand_total_export", 
+   "fieldname": "grand_total", 
    "fieldtype": "Currency", 
    "in_list_view": 1, 
    "label": "Grand Total", 
@@ -558,7 +558,7 @@
    "reqd": 1
   }, 
   {
-   "fieldname": "rounded_total_export", 
+   "fieldname": "rounded_total", 
    "fieldtype": "Currency", 
    "label": "Rounded Total", 
    "oldfieldname": "rounded_total_export", 
@@ -569,7 +569,7 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "in_words_export", 
+   "fieldname": "in_words", 
    "fieldtype": "Data", 
    "label": "In Words", 
    "oldfieldname": "in_words_export", 
@@ -1202,7 +1202,7 @@
  "icon": "icon-file-text", 
  "idx": 1, 
  "is_submittable": 1, 
- "modified": "2015-02-05 05:11:45.330358", 
+ "modified": "2015-02-11 15:57:57.399512", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Sales Invoice", 
@@ -1258,7 +1258,7 @@
   }
  ], 
  "read_only_onload": 1, 
- "search_fields": "posting_date, due_date, customer, fiscal_year, grand_total, outstanding_amount", 
+ "search_fields": "posting_date, due_date, customer, fiscal_year, base_grand_total, outstanding_amount", 
  "sort_field": "modified", 
  "sort_order": "DESC", 
  "title_field": "customer_name"
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 132304f..4e46fde 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -77,7 +77,7 @@
 			# Check for Approving Authority
 			if not self.recurring_id:
 				frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype,
-				 	self.company, self.grand_total, self)
+				 	self.company, self.base_grand_total, self)
 
 		self.check_prev_docstatus()
 
@@ -329,7 +329,7 @@
 			frappe.throw(_("Cash or Bank Account is mandatory for making payment entry"))
 
 		if flt(self.paid_amount) + flt(self.write_off_amount) \
-				- flt(self.grand_total) > 1/(10**(self.precision("grand_total") + 1)):
+				- flt(self.base_grand_total) > 1/(10**(self.precision("base_grand_total") + 1)):
 			frappe.throw(_("""Paid amount + Write Off Amount can not be greater than Grand Total"""))
 
 
@@ -410,7 +410,7 @@
 			if flt(self.paid_amount) == 0:
 				if self.cash_bank_account:
 					frappe.db.set(self, 'paid_amount',
-						(flt(self.grand_total) - flt(self.write_off_amount)))
+						(flt(self.base_grand_total) - flt(self.write_off_amount)))
 				else:
 					# show message that the amount is not paid
 					frappe.db.set(self,'paid_amount',0)
@@ -483,14 +483,14 @@
 		return gl_entries
 
 	def make_customer_gl_entry(self, gl_entries):
-		if self.grand_total:
+		if self.base_grand_total:
 			gl_entries.append(
 				self.get_gl_dict({
 					"account": self.debit_to,
 					"party_type": "Customer",
 					"party": self.customer,
 					"against": self.against_income_account,
-					"debit": self.grand_total,
+					"debit": self.base_grand_total,
 					"remarks": self.remarks,
 					"against_voucher": self.name,
 					"against_voucher_type": self.doctype,
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js
index 46b7201..01dcc0e 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js
@@ -3,7 +3,7 @@
 
 // render
 frappe.listview_settings['Sales Invoice'] = {
-	add_fields: ["customer", "customer_name", "grand_total", "outstanding_amount", "due_date", "company",
+	add_fields: ["customer", "customer_name", "base_grand_total", "outstanding_amount", "due_date", "company",
 		"currency"],
 	get_indicator: function(doc) {
 		if(doc.outstanding_amount==0) {
@@ -14,5 +14,5 @@
 			return [__("Overdue"), "red", "outstanding_amount,>,0|due_date,<=,Today"]
 		}
 	},
-	right_column: "grand_total_export"
+	right_column: "grand_total"
 };
diff --git a/erpnext/accounts/doctype/sales_invoice/test_records.json b/erpnext/accounts/doctype/sales_invoice/test_records.json
index abc360b..dc69339 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_records.json
+++ b/erpnext/accounts/doctype/sales_invoice/test_records.json
@@ -25,11 +25,11 @@
    }
   ],
   "fiscal_year": "_Test Fiscal Year 2013",
+  "base_grand_total": 561.8,
   "grand_total": 561.8,
-  "grand_total_export": 561.8,
   "is_pos": 0,
   "naming_series": "_T-Sales Invoice-",
-  "net_total": 500.0,
+  "base_net_total": 500.0,
   "taxes": [
    {
     "account_head": "_Test Account VAT - _TC",
@@ -95,11 +95,11 @@
    }
   ],
   "fiscal_year": "_Test Fiscal Year 2013",
+  "base_grand_total": 630.0,
   "grand_total": 630.0,
-  "grand_total_export": 630.0,
   "is_pos": 0,
   "naming_series": "_T-Sales Invoice-",
-  "net_total": 500.0,
+  "base_net_total": 500.0,
   "taxes": [
    {
     "account_head": "_Test Account VAT - _TC",
@@ -163,7 +163,7 @@
    }
   ],
   "fiscal_year": "_Test Fiscal Year 2013",
-  "grand_total_export": 0,
+  "grand_total": 0,
   "is_pos": 0,
   "naming_series": "_T-Sales Invoice-",
   "taxes": [
@@ -287,7 +287,7 @@
    }
   ],
   "fiscal_year": "_Test Fiscal Year 2013",
-  "grand_total_export": 0,
+  "grand_total": 0,
   "is_pos": 0,
   "naming_series": "_T-Sales Invoice-",
   "taxes": [
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index a0c2fb6..a8e92c9 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -53,8 +53,8 @@
 				self.assertEquals(d.get(k), expected_values[d.item_code][i])
 
 		# check net total
+		self.assertEquals(si.base_net_total, 1250)
 		self.assertEquals(si.net_total, 1250)
-		self.assertEquals(si.net_total_export, 1250)
 
 		# check tax calculation
 		expected_values = {
@@ -73,8 +73,8 @@
 			for i, k in enumerate(expected_values["keys"]):
 				self.assertEquals(d.get(k), expected_values[d.account_head][i])
 
+		self.assertEquals(si.base_grand_total, 1627.05)
 		self.assertEquals(si.grand_total, 1627.05)
-		self.assertEquals(si.grand_total_export, 1627.05)
 
 	def test_sales_invoice_calculation_export_currency(self):
 		si = frappe.copy_doc(test_records[2])
@@ -103,8 +103,8 @@
 				self.assertEquals(d.get(k), expected_values[d.item_code][i])
 
 		# check net total
-		self.assertEquals(si.net_total, 1250)
-		self.assertEquals(si.net_total_export, 25)
+		self.assertEquals(si.base_net_total, 1250)
+		self.assertEquals(si.net_total, 25)
 
 		# check tax calculation
 		expected_values = {
@@ -123,8 +123,8 @@
 			for i, k in enumerate(expected_values["keys"]):
 				self.assertEquals(d.get(k), expected_values[d.account_head][i])
 
-		self.assertEquals(si.grand_total, 1627.05)
-		self.assertEquals(si.grand_total_export, 32.54)
+		self.assertEquals(si.base_grand_total, 1627.05)
+		self.assertEquals(si.grand_total, 32.54)
 
 	def test_sales_invoice_discount_amount(self):
 		si = frappe.copy_doc(test_records[3])
@@ -157,8 +157,8 @@
 				self.assertEquals(d.get(k), expected_values[d.item_code][i])
 
 		# check net total
-		self.assertEquals(si.net_total, 1163.45)
-		self.assertEquals(si.net_total_export, 1578.3)
+		self.assertEquals(si.base_net_total, 1163.45)
+		self.assertEquals(si.net_total, 1578.3)
 
 		# check tax calculation
 		expected_values = {
@@ -178,8 +178,8 @@
 			for i, k in enumerate(expected_values["keys"]):
 				self.assertEquals(d.get(k), expected_values[d.account_head][i])
 
+		self.assertEquals(si.base_grand_total, 1500)
 		self.assertEquals(si.grand_total, 1500)
-		self.assertEquals(si.grand_total_export, 1500)
 
 	def test_discount_amount_gl_entry(self):
 		si = frappe.copy_doc(test_records[3])
@@ -268,8 +268,8 @@
 				self.assertEquals(d.get(k), expected_values[d.item_code][i])
 
 		# check net total
-		self.assertEquals(si.net_total, 1249.98)
-		self.assertEquals(si.net_total_export, 1578.3)
+		self.assertEquals(si.base_net_total, 1249.98)
+		self.assertEquals(si.net_total, 1578.3)
 
 		# check tax calculation
 		expected_values = {
@@ -288,8 +288,8 @@
 			for i, k in enumerate(expected_values["keys"]):
 				self.assertEquals(d.get(k), expected_values[d.account_head][i])
 
+		self.assertEquals(si.base_grand_total, 1622.98)
 		self.assertEquals(si.grand_total, 1622.98)
-		self.assertEquals(si.grand_total_export, 1622.98)
 
 	def test_sales_invoice_calculation_export_currency_with_tax_inclusive_price(self):
 		# prepare
@@ -320,8 +320,8 @@
 				self.assertEquals(d.get(k), expected_values[d.item_code][i])
 
 		# check net total
-		self.assertEquals(si.net_total, 49501.7)
-		self.assertEquals(si.net_total_export, 1250)
+		self.assertEquals(si.base_net_total, 49501.7)
+		self.assertEquals(si.net_total, 1250)
 
 		# check tax calculation
 		expected_values = {
@@ -340,12 +340,12 @@
 			for i, k in enumerate(expected_values["keys"]):
 				self.assertEquals(d.get(k), expected_values[d.account_head][i])
 
-		self.assertEquals(si.grand_total, 65205.16)
-		self.assertEquals(si.grand_total_export, 1304.1)
+		self.assertEquals(si.base_grand_total, 65205.16)
+		self.assertEquals(si.grand_total, 1304.1)
 
 	def test_outstanding(self):
 		w = self.make()
-		self.assertEquals(w.outstanding_amount, w.grand_total)
+		self.assertEquals(w.outstanding_amount, w.base_grand_total)
 
 	def test_payment(self):
 		frappe.db.sql("""delete from `tabGL Entry`""")
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
index ae77fe8..af744e9 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
@@ -13,7 +13,7 @@
 }
 
 // For customizing print
-cur_frm.pformat.net_total_export = function(doc) {
+cur_frm.pformat.net_total = function(doc) {
 	return '';
 }
 
@@ -21,15 +21,15 @@
 	return '';
 }
 
-cur_frm.pformat.grand_total_export = function(doc) {
+cur_frm.pformat.grand_total = function(doc) {
 	return '';
 }
 
-cur_frm.pformat.rounded_total_export = function(doc) {
+cur_frm.pformat.rounded_total = function(doc) {
 	return '';
 }
 
-cur_frm.pformat.in_words_export = function(doc) {
+cur_frm.pformat.in_words = function(doc) {
 	return '';
 }
 
@@ -63,8 +63,8 @@
 
 		out +='<table class="noborder" style="width:100%">';
 
-		if(!print_hide('net_total_export')) {
-			out += make_row('Net Total', doc.net_total_export, 1);
+		if(!print_hide('net_total')) {
+			out += make_row('Net Total', doc.net_total, 1);
 		}
 
 		// add rows
@@ -80,17 +80,17 @@
 			out += make_row('Discount Amount', doc.discount_amount, 0);
 
 		// grand total
-		if(!print_hide('grand_total_export'))
-			out += make_row('Grand Total', doc.grand_total_export, 1);
+		if(!print_hide('grand_total'))
+			out += make_row('Grand Total', doc.grand_total, 1);
 
-		if(!print_hide('rounded_total_export'))
-			out += make_row('Rounded Total', doc.rounded_total_export, 1);
+		if(!print_hide('rounded_total'))
+			out += make_row('Rounded Total', doc.rounded_total, 1);
 
-		if(doc.in_words_export && !print_hide('in_words_export')) {
+		if(doc.in_words && !print_hide('in_words')) {
 			out +='</table></td></tr>';
 			out += '<tr><td colspan = "2">';
 			out += '<table><tr><td style="width:25%;"><b>In Words</b></td>';
-			out += '<td style="width:50%;">' + doc.in_words_export + '</td></tr>';
+			out += '<td style="width:50%;">' + doc.in_words + '</td></tr>';
 		}
 		out += '</table></td></tr></table></div>';
 	}
diff --git a/erpnext/accounts/print_format/pos_invoice/pos_invoice.json b/erpnext/accounts/print_format/pos_invoice/pos_invoice.json
index fcda513..997eb84 100644
--- a/erpnext/accounts/print_format/pos_invoice/pos_invoice.json
+++ b/erpnext/accounts/print_format/pos_invoice/pos_invoice.json
@@ -3,9 +3,9 @@
  "doc_type": "Sales Invoice",
  "docstatus": 0,
  "doctype": "Print Format",
- "html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ doc.company }}<br>\n\t{{ doc.select_print_heading or _(\"Invoice\") }}<br>\n</p>\n<p>\n\t<b>{{ _(\"Receipt No\") }}:</b> {{ doc.name }}<br>\n\t<b>{{ _(\"Date\") }}:</b> {{ doc.get_formatted(\"posting_date\") }}<br>\n\t<b>{{ _(\"Customer\") }}:</b> {{ doc.customer_name }}\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"60%\">{{ _(\"Item\") }}</b></th>\n\t\t\t<th width=\"10%\" class=\"text-right\">{{ _(\"Qty\") }}</th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Rate\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{%- for item in doc.items -%}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t<br>{{ item.item_name }}{%- endif -%}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}</td>\n\t\t\t<td class=\"text-right\">{{ item.amount }}</td>\n\t\t</tr>\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ _(\"Net Total\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"net_total_export\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- for row in doc.taxes -%}\n\t\t{%- if not row.included_in_print_rate -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t{%- endfor -%}\n\t\t{%- if doc.discount_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t<b>{{ _(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"grand_total_export\") }}\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>\n{% if doc.get(\"taxes\", filters={\"included_in_print_rate\": 1}) %}\n<hr>\n<p><b>Taxes Included:</b></p>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t{%- for row in doc.taxes -%}\n\t\t{%- if row.included_in_print_rate -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ row.get_formatted(\"tax_amount_after_discount_amount\", doc) }}\n\t\t\t</td>\n\t\t<tr>\n\t\t{%- endif -%}\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n{%- endif -%}\n<hr>\n<p>{{ doc.terms or \"\" }}</p>\n<p class=\"text-center\">{{ _(\"Thank you, please visit again.\") }}</p>",
+ "html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ doc.company }}<br>\n\t{{ doc.select_print_heading or _(\"Invoice\") }}<br>\n</p>\n<p>\n\t<b>{{ _(\"Receipt No\") }}:</b> {{ doc.name }}<br>\n\t<b>{{ _(\"Date\") }}:</b> {{ doc.get_formatted(\"posting_date\") }}<br>\n\t<b>{{ _(\"Customer\") }}:</b> {{ doc.customer_name }}\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"60%\">{{ _(\"Item\") }}</b></th>\n\t\t\t<th width=\"10%\" class=\"text-right\">{{ _(\"Qty\") }}</th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Rate\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{%- for item in doc.items -%}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t<br>{{ item.item_name }}{%- endif -%}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}</td>\n\t\t\t<td class=\"text-right\">{{ item.amount }}</td>\n\t\t</tr>\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ _(\"Net Total\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"net_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- for row in doc.taxes -%}\n\t\t{%- if not row.included_in_print_rate -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t{%- endfor -%}\n\t\t{%- if doc.discount_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t<b>{{ _(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"grand_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>\n{% if doc.get(\"taxes\", filters={\"included_in_print_rate\": 1}) %}\n<hr>\n<p><b>Taxes Included:</b></p>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t{%- for row in doc.taxes -%}\n\t\t{%- if row.included_in_print_rate -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ row.get_formatted(\"tax_amount_after_discount_amount\", doc) }}\n\t\t\t</td>\n\t\t<tr>\n\t\t{%- endif -%}\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n{%- endif -%}\n<hr>\n<p>{{ doc.terms or \"\" }}</p>\n<p class=\"text-center\">{{ _(\"Thank you, please visit again.\") }}</p>",
  "idx": 1,
- "modified": "2014-12-26 02:08:26.603223",
+ "modified": "2015-02-12 02:08:26.603223",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "POS Invoice",
diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
index f0ca4c8..dbfdee7 100644
--- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
+++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
@@ -68,7 +68,7 @@
 	match_conditions = frappe.build_match_conditions("Purchase Invoice")
 
 	return frappe.db.sql("""select pi_item.parent, pi.posting_date, pi.credit_to, pi.company,
-		pi.supplier, pi.remarks, pi.net_total, pi_item.item_code, pi_item.item_name, pi_item.item_group,
+		pi.supplier, pi.remarks, pi.base_net_total, pi_item.item_code, pi_item.item_name, pi_item.item_group,
 		pi_item.project_name, pi_item.purchase_order, pi_item.purchase_receipt, pi_item.po_detail
 		pi_item.expense_account, pi_item.qty, pi_item.base_rate, pi_item.base_amount, pi.supplier_name
 		from `tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item
@@ -107,7 +107,7 @@
 		elif charge_type == "Actual" and tax_amount:
 			for d in invoice_wise_items.get(parent, []):
 				item_tax.setdefault(parent, {}).setdefault(d.item_code, {})[account_head] = \
-					(tax_amount * d.base_amount) / d.net_total
+					(tax_amount * d.base_amount) / d.base_net_total
 
 	tax_accounts.sort()
 	columns += [account_head + ":Currency:80" for account_head in tax_accounts]
diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
index d79db0f..4907cbb 100644
--- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
+++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
@@ -67,7 +67,7 @@
 def get_items(filters):
 	conditions = get_conditions(filters)
 	return frappe.db.sql("""select si_item.parent, si.posting_date, si.debit_to, si.project_name,
-		si.customer, si.remarks, si.territory, si.company, si.net_total, si_item.item_code, si_item.item_name,
+		si.customer, si.remarks, si.territory, si.company, si.base_net_total, si_item.item_code, si_item.item_name,
 		si_item.item_group, si_item.sales_order, si_item.delivery_note, si_item.income_account,
 		si_item.qty, si_item.base_rate, si_item.base_amount, si.customer_name,
 		si.customer_group, si_item.so_detail
@@ -104,7 +104,7 @@
 		elif charge_type == "Actual" and tax_amount:
 			for d in invoice_wise_items.get(parent, []):
 				item_tax.setdefault(parent, {}).setdefault(d.item_code, {})[account_head] = \
-					flt((tax_amount * d.base_amount) / d.net_total)
+					flt((tax_amount * d.base_amount) / d.base_net_total)
 
 	tax_accounts.sort()
 	columns += [account_head + ":Currency:80" for account_head in tax_accounts]
diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py
index 244a20c..727a663 100644
--- a/erpnext/accounts/report/purchase_register/purchase_register.py
+++ b/erpnext/accounts/report/purchase_register/purchase_register.py
@@ -35,14 +35,14 @@
 			", ".join(purchase_order), ", ".join(purchase_receipt)]
 
 		# map expense values
-		net_total = 0
+		base_net_total = 0
 		for expense_acc in expense_accounts:
 			expense_amount = flt(invoice_expense_map.get(inv.name, {}).get(expense_acc))
-			net_total += expense_amount
+			base_net_total += expense_amount
 			row.append(expense_amount)
 
 		# net total
-		row.append(net_total or inv.net_total)
+		row.append(base_net_total or inv.base_net_total)
 
 		# tax account
 		total_tax = 0
@@ -53,7 +53,7 @@
 				row.append(tax_amount)
 
 		# total tax, grand total, outstanding amount & rounded total
-		row += [total_tax, inv.grand_total, flt(inv.grand_total, 2), inv.outstanding_amount]
+		row += [total_tax, inv.base_grand_total, flt(inv.base_grand_total, 2), inv.outstanding_amount]
 		data.append(row)
 		# raise Exception
 
@@ -108,7 +108,7 @@
 def get_invoices(filters):
 	conditions = get_conditions(filters)
 	return frappe.db.sql("""select name, posting_date, credit_to, supplier, supplier_name
-		bill_no, bill_date, remarks, net_total, grand_total, outstanding_amount
+		bill_no, bill_date, remarks, base_net_total, base_grand_total, outstanding_amount
 		from `tabPurchase Invoice` where docstatus = 1 %s
 		order by posting_date desc, name desc""" % conditions, filters, as_dict=1)
 
diff --git a/erpnext/accounts/report/sales_partners_commission/sales_partners_commission.json b/erpnext/accounts/report/sales_partners_commission/sales_partners_commission.json
index 4ac7dbc..592e93d 100644
--- a/erpnext/accounts/report/sales_partners_commission/sales_partners_commission.json
+++ b/erpnext/accounts/report/sales_partners_commission/sales_partners_commission.json
@@ -1,17 +1,17 @@
 {
- "apply_user_permissions": 1, 
- "creation": "2013-05-06 12:28:23", 
- "docstatus": 0, 
- "doctype": "Report", 
- "idx": 1, 
- "is_standard": "Yes", 
- "modified": "2014-06-03 07:18:17.302063", 
- "modified_by": "Administrator", 
- "module": "Accounts", 
- "name": "Sales Partners Commission", 
- "owner": "Administrator", 
- "query": "SELECT\n    sales_partner as \"Sales Partner:Link/Sales Partner:150\",\n\tsum(net_total) as \"Invoiced Amount (Exculsive Tax):Currency:210\",\n\tsum(total_commission) as \"Total Commission:Currency:150\",\n\tsum(total_commission)*100/sum(net_total) as \"Average Commission Rate:Currency:170\"\nFROM\n\t`tabSales Invoice`\nWHERE\n\tdocstatus = 1 and ifnull(net_total, 0) > 0 and ifnull(total_commission, 0) > 0\nGROUP BY\n\tsales_partner\nORDER BY\n\t\"Total Commission:Currency:120\"", 
- "ref_doctype": "Sales Invoice", 
- "report_name": "Sales Partners Commission", 
+ "apply_user_permissions": 1,
+ "creation": "2013-05-06 12:28:23",
+ "docstatus": 0,
+ "doctype": "Report",
+ "idx": 1,
+ "is_standard": "Yes",
+ "modified": "2015-02-12 07:18:17.302063",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Sales Partners Commission",
+ "owner": "Administrator",
+ "query": "SELECT\n    sales_partner as \"Sales Partner:Link/Sales Partner:150\",\n\tsum(base_net_total) as \"Invoiced Amount (Exculsive Tax):Currency:210\",\n\tsum(total_commission) as \"Total Commission:Currency:150\",\n\tsum(total_commission)*100/sum(base_net_total) as \"Average Commission Rate:Currency:170\"\nFROM\n\t`tabSales Invoice`\nWHERE\n\tdocstatus = 1 and ifnull(base_net_total, 0) > 0 and ifnull(total_commission, 0) > 0\nGROUP BY\n\tsales_partner\nORDER BY\n\t\"Total Commission:Currency:120\"",
+ "ref_doctype": "Sales Invoice",
+ "report_name": "Sales Partners Commission",
  "report_type": "Query Report"
-}
\ No newline at end of file
+}
diff --git a/erpnext/accounts/report/sales_register/sales_register.py b/erpnext/accounts/report/sales_register/sales_register.py
index 01e7bad..bdce7bd 100644
--- a/erpnext/accounts/report/sales_register/sales_register.py
+++ b/erpnext/accounts/report/sales_register/sales_register.py
@@ -34,14 +34,14 @@
 		inv.debit_to, inv.project_name, inv.remarks, ", ".join(sales_order), ", ".join(delivery_note)]
 
 		# map income values
-		net_total = 0
+		base_net_total = 0
 		for income_acc in income_accounts:
 			income_amount = flt(invoice_income_map.get(inv.name, {}).get(income_acc))
-			net_total += income_amount
+			base_net_total += income_amount
 			row.append(income_amount)
 
 		# net total
-		row.append(net_total or inv.net_total)
+		row.append(base_net_total or inv.base_net_total)
 
 		# tax account
 		total_tax = 0
@@ -52,7 +52,7 @@
 				row.append(tax_amount)
 
 		# total tax, grand total, outstanding amount & rounded total
-		row += [total_tax, inv.grand_total, inv.rounded_total, inv.outstanding_amount]
+		row += [total_tax, inv.base_grand_total, inv.base_rounded_total, inv.outstanding_amount]
 
 		data.append(row)
 
@@ -107,7 +107,7 @@
 def get_invoices(filters):
 	conditions = get_conditions(filters)
 	return frappe.db.sql("""select name, posting_date, debit_to, project_name, customer,
-		customer_name, remarks, net_total, grand_total, rounded_total, outstanding_amount
+		customer_name, remarks, base_net_total, base_grand_total, base_rounded_total, outstanding_amount
 		from `tabSales Invoice`
 		where docstatus = 1 %s order by posting_date desc, name desc""" %
 		conditions, filters, as_dict=1)
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js
index 67c11a7..6759550 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.js
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.js
@@ -2,8 +2,9 @@
 // License: GNU General Public License v3. See license.txt
 
 frappe.provide("erpnext.buying");
-frappe.require("assets/erpnext/js/transaction.js");
-{% include "public/js/controllers/accounts.js" %}
+frappe.require("assets/erpnext/js/controllers/transaction.js");
+
+{% include "public/js/controllers/accounts.js" %};
 
 cur_frm.email_field = "contact_email";
 
@@ -171,128 +172,16 @@
 		}
 	},
 
-	calculate_taxes_and_totals: function() {
-		this._super();
-		this.calculate_total_advance("Purchase Invoice", "advances");
-		this.frm.refresh_fields();
-	},
-
-	calculate_item_values: function() {
-		var me = this;
-
-		$.each(this.frm.doc["items"] || [], function(i, item) {
-			frappe.model.round_floats_in(item);
-			item.amount = flt(item.rate * item.qty, precision("amount", item));
-			item.item_tax_amount = 0.0;
-
-			me._set_in_company_currency(item, "price_list_rate", "base_price_list_rate");
-			me._set_in_company_currency(item, "rate", "base_rate");
-			me._set_in_company_currency(item, "amount", "base_amount");
-		});
-
-	},
-
-	calculate_net_total: function() {
-		var me = this;
-
-		this.frm.doc.net_total = this.frm.doc.net_total_import = 0.0;
-		$.each(this.frm.doc["items"] || [], function(i, item) {
-			me.frm.doc.net_total += item.base_amount;
-			me.frm.doc.net_total_import += item.amount;
-		});
-
-		frappe.model.round_floats_in(this.frm.doc, ["net_total", "net_total_import"]);
-	},
-
-	calculate_totals: function() {
-		var tax_count = this.frm.doc["taxes"] ? this.frm.doc["taxes"].length : 0;
-		this.frm.doc.grand_total = flt(tax_count ? this.frm.doc["taxes"][tax_count - 1].total : this.frm.doc.net_total);
-
-		this.frm.doc.total_tax = flt(this.frm.doc.grand_total - this.frm.doc.net_total, precision("total_tax"));
-
-		this.frm.doc.grand_total = flt(this.frm.doc.grand_total, precision("grand_total"));
-
-		// rounded totals
-		if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total", this.frm.doc.name)) {
-			this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total);
-		}
-
-		// other charges added/deducted
-		this.frm.doc.other_charges_added = 0.0
-		this.frm.doc.other_charges_deducted = 0.0
-		if(tax_count) {
-			this.frm.doc.other_charges_added = frappe.utils.sum($.map(this.frm.doc["taxes"],
-				function(tax) { return (tax.add_deduct_tax == "Add"
-					&& in_list(["Valuation and Total", "Total"], tax.category)) ?
-					tax.tax_amount : 0.0; }));
-
-			this.frm.doc.other_charges_deducted = frappe.utils.sum($.map(this.frm.doc["taxes"],
-				function(tax) { return (tax.add_deduct_tax == "Deduct"
-					&& in_list(["Valuation and Total", "Total"], tax.category)) ?
-					tax.tax_amount : 0.0; }));
-
-			frappe.model.round_floats_in(this.frm.doc,
-				["other_charges_added", "other_charges_deducted"]);
-		}
-
-		this.frm.doc.grand_total_import = flt((this.frm.doc.other_charges_added || this.frm.doc.other_charges_deducted) ?
-			flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total_import);
-
-		this.frm.doc.grand_total_import = flt(this.frm.doc.grand_total_import, precision("grand_total_import"));
-
-		if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total_import", this.frm.doc.name)) {
-			this.frm.doc.rounded_total_import = Math.round(this.frm.doc.grand_total_import);
-		}
-
-		this.frm.doc.other_charges_added_import = flt(this.frm.doc.other_charges_added /
-			this.frm.doc.conversion_rate, precision("other_charges_added_import"));
-		this.frm.doc.other_charges_deducted_import = flt(this.frm.doc.other_charges_deducted /
-			this.frm.doc.conversion_rate, precision("other_charges_deducted_import"));
-	},
-
-	_cleanup: function() {
-		this._super();
-		this.frm.doc.in_words = this.frm.doc.in_words_import = "";
-
-		if(this.frm.doc["items"].length) {
-			if(!frappe.meta.get_docfield(this.frm.doc["items"][0].doctype, "item_tax_amount", this.frm.doctype)) {
-				$.each(this.frm.doc["items"] || [], function(i, item) {
-					delete item["item_tax_amount"];
-				});
-			}
-		}
-
-		if(this.frm.doc["taxes"].length) {
-			if(!frappe.meta.get_docfield(this.frm.doc["taxes"][0].doctype, "tax_amount_after_discount_amount", this.frm.doctype)) {
-				$.each(this.frm.doc["taxes"] || [], function(i, tax) {
-					delete tax["tax_amount_after_discount_amount"];
-				});
-			}
-		}
-	},
-
 	calculate_outstanding_amount: function() {
 		if(this.frm.doc.doctype == "Purchase Invoice" && this.frm.doc.docstatus < 2) {
-			frappe.model.round_floats_in(this.frm.doc, ["grand_total", "total_advance", "write_off_amount"]);
-			this.frm.doc.total_amount_to_pay = flt(this.frm.doc.grand_total - this.frm.doc.write_off_amount,
+			frappe.model.round_floats_in(this.frm.doc, ["base_grand_total", "total_advance", "write_off_amount"]);
+			this.frm.doc.total_amount_to_pay = flt(this.frm.doc.base_grand_total - this.frm.doc.write_off_amount,
 				precision("total_amount_to_pay"));
 			this.frm.doc.outstanding_amount = flt(this.frm.doc.total_amount_to_pay - this.frm.doc.total_advance,
 				precision("outstanding_amount"));
 		}
 	},
 
-	set_item_tax_amount: function(item, tax, current_tax_amount) {
-		// item_tax_amount is the total tax amount applied on that item
-		// stored for valuation
-		//
-		// TODO: rename item_tax_amount to valuation_tax_amount
-		if(["Valuation", "Valuation and Total"].indexOf(tax.category) != -1 &&
-			frappe.meta.get_docfield(item.doctype, "item_tax_amount", item.parent || item.name)) {
-				// accumulate only if tax is for Valuation / Valuation and Total
-				item.item_tax_amount += flt(current_tax_amount, precision("item_tax_amount", item));
-		}
-	},
-
 	change_form_labels: function(company_currency) {
 		var me = this;
 		var field_label_map = {};
@@ -308,13 +197,13 @@
 		};
 
 
-		setup_field_label_map(["net_total", "total_tax", "grand_total", "in_words",
-			"other_charges_added", "other_charges_deducted",
-			"outstanding_amount", "total_advance", "total_amount_to_pay", "rounded_total"],
+		setup_field_label_map(["base_net_total", "base_total_taxes_and_charges", "base_grand_total", "base_in_words",
+			"base_taxes_and_charges_added", "base_taxes_and_charges_deducted",
+			"outstanding_amount", "total_advance", "total_amount_to_pay", "base_rounded_total"],
 			company_currency);
 
-		setup_field_label_map(["net_total_import", "grand_total_import", "in_words_import",
-			"other_charges_added_import", "other_charges_deducted_import"], this.frm.doc.currency);
+		setup_field_label_map(["net_total", "grand_total", "in_words",
+			"taxes_and_charges_added", "taxes_and_charges_deducted"], this.frm.doc.currency);
 
 		cur_frm.set_df_property("conversion_rate", "description", "1 " + this.frm.doc.currency
 			+ " = [?] " + company_currency);
@@ -325,8 +214,8 @@
 		}
 
 		// toggle fields
-		this.frm.toggle_display(["conversion_rate", "net_total", "grand_total",
-			"in_words", "other_charges_added", "other_charges_deducted"],
+		this.frm.toggle_display(["conversion_rate", "base_net_total", "base_grand_total",
+			"base_in_words", "base_taxes_and_charges_added", "base_taxes_and_charges_deducted"],
 			this.frm.doc.currency !== company_currency);
 
 		this.frm.toggle_display(["plc_conversion_rate", "price_list_currency"],
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json
index 4fb74ad..c1fbe64 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.json
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.json
@@ -230,7 +230,7 @@
    "permlevel": 0
   }, 
   {
-   "fieldname": "net_total", 
+   "fieldname": "base_net_total", 
    "fieldtype": "Currency", 
    "label": "Net Total (Company Currency)", 
    "no_copy": 1, 
@@ -248,7 +248,7 @@
    "permlevel": 0
   }, 
   {
-   "fieldname": "net_total_import", 
+   "fieldname": "net_total", 
    "fieldtype": "Currency", 
    "label": "Net Total", 
    "no_copy": 0, 
@@ -316,7 +316,7 @@
    "permlevel": 0
   }, 
   {
-   "fieldname": "other_charges_added", 
+   "fieldname": "base_taxes_and_charges_added", 
    "fieldtype": "Currency", 
    "label": "Taxes and Charges Added (Company Currency)", 
    "no_copy": 0, 
@@ -328,7 +328,7 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "other_charges_deducted", 
+   "fieldname": "base_taxes_and_charges_deducted", 
    "fieldtype": "Currency", 
    "label": "Taxes and Charges Deducted (Company Currency)", 
    "no_copy": 0, 
@@ -340,9 +340,9 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "total_tax", 
+   "fieldname": "base_taxes_and_charges", 
    "fieldtype": "Currency", 
-   "label": "Total Tax (Company Currency)", 
+   "label": "Total Taxes and Charges (Company Currency)", 
    "no_copy": 1, 
    "oldfieldname": "total_tax", 
    "oldfieldtype": "Currency", 
@@ -352,7 +352,7 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "grand_total", 
+   "fieldname": "base_grand_total", 
    "fieldtype": "Currency", 
    "label": "Grand Total (Company Currency)", 
    "no_copy": 1, 
@@ -365,7 +365,7 @@
   }, 
   {
    "description": "In Words will be visible once you save the Purchase Order.", 
-   "fieldname": "in_words", 
+   "fieldname": "base_in_words", 
    "fieldtype": "Data", 
    "label": "In Words (Company Currency)", 
    "oldfieldname": "in_words", 
@@ -375,7 +375,7 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "rounded_total", 
+   "fieldname": "base_rounded_total", 
    "fieldtype": "Currency", 
    "label": "Rounded Total (Company Currency)", 
    "oldfieldname": "rounded_total", 
@@ -401,7 +401,7 @@
    "print_hide": 0
   }, 
   {
-   "fieldname": "other_charges_added_import", 
+   "fieldname": "taxes_and_charges_added", 
    "fieldtype": "Currency", 
    "label": "Taxes and Charges Added", 
    "no_copy": 0, 
@@ -414,7 +414,7 @@
    "report_hide": 0
   }, 
   {
-   "fieldname": "other_charges_deducted_import", 
+   "fieldname": "taxes_and_charges_deducted", 
    "fieldtype": "Currency", 
    "label": "Taxes and Charges Deducted", 
    "no_copy": 0, 
@@ -427,7 +427,15 @@
    "report_hide": 0
   }, 
   {
-   "fieldname": "grand_total_import", 
+   "fieldname": "total_taxes_and_charges", 
+   "fieldtype": "Currency", 
+   "label": "Total Taxes and Charges", 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": ""
+  }, 
+  {
+   "fieldname": "grand_total", 
    "fieldtype": "Currency", 
    "in_list_view": 1, 
    "label": "Grand Total", 
@@ -441,7 +449,7 @@
    "report_hide": 0
   }, 
   {
-   "fieldname": "in_words_import", 
+   "fieldname": "in_words", 
    "fieldtype": "Data", 
    "label": "In Words", 
    "oldfieldname": "in_words_import", 
@@ -775,7 +783,7 @@
  "icon": "icon-file-text", 
  "idx": 1, 
  "is_submittable": 1, 
- "modified": "2015-02-05 05:11:43.673323", 
+ "modified": "2015-02-11 16:13:52.294735", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Purchase Order", 
@@ -846,7 +854,7 @@
   }
  ], 
  "read_only_onload": 1, 
- "search_fields": "status, transaction_date, supplier,grand_total", 
+ "search_fields": "status, transaction_date, supplier,base_grand_total", 
  "sort_field": "modified", 
  "sort_order": "DESC", 
  "title_field": "supplier_name"
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index cf4d006..383b0ad 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -183,7 +183,7 @@
 		self.update_ordered_qty()
 
 		frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype,
-			self.company, self.grand_total)
+			self.company, self.base_grand_total)
 
 		purchase_controller.update_last_purchase_rate(self, is_submit = 1)
 
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order_list.js b/erpnext/buying/doctype/purchase_order/purchase_order_list.js
index fe96641..b094a65 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order_list.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order_list.js
@@ -1,5 +1,5 @@
 frappe.listview_settings['Purchase Order'] = {
-	add_fields: ["grand_total", "company", "currency", "supplier",
+	add_fields: ["base_grand_total", "company", "currency", "supplier",
 		"supplier_name", "per_received", "per_billed", "status"],
 	get_indicator: function(doc) {
         if(doc.status==="Stopped") {
diff --git a/erpnext/buying/doctype/purchase_order/test_records.json b/erpnext/buying/doctype/purchase_order/test_records.json
index 2b329af..bbe02cc 100644
--- a/erpnext/buying/doctype/purchase_order/test_records.json
+++ b/erpnext/buying/doctype/purchase_order/test_records.json
@@ -7,11 +7,11 @@
   "currency": "INR", 
   "doctype": "Purchase Order", 
   "fiscal_year": "_Test Fiscal Year 2013", 
+  "base_grand_total": 5000.0, 
   "grand_total": 5000.0, 
-  "grand_total_import": 5000.0, 
   "is_subcontracted": "Yes", 
   "naming_series": "_T-Purchase Order-", 
-  "net_total": 5000.0, 
+  "base_net_total": 5000.0, 
   "items": [
    {
     "base_amount": 5000.0, 
@@ -41,11 +41,11 @@
   "currency": "INR", 
   "doctype": "Purchase Order", 
   "fiscal_year": "_Test Fiscal Year 2013", 
+  "base_grand_total": 5000.0, 
   "grand_total": 5000.0, 
-  "grand_total_import": 5000.0, 
   "is_subcontracted": "No", 
   "naming_series": "_T-Purchase Order-", 
-  "net_total": 5000.0, 
+  "base_net_total": 5000.0, 
   "items": [
    {
     "base_amount": 5000.0, 
diff --git a/erpnext/buying/doctype/supplier/supplier.py b/erpnext/buying/doctype/supplier/supplier.py
index 974ed38..6f79f0c 100644
--- a/erpnext/buying/doctype/supplier/supplier.py
+++ b/erpnext/buying/doctype/supplier/supplier.py
@@ -89,7 +89,7 @@
 		out[doctype] = frappe.db.get_value(doctype,
 			{"supplier": supplier, "docstatus": ["!=", 2] }, "count(*)")
 
-	billing = frappe.db.sql("""select sum(grand_total), sum(outstanding_amount)
+	billing = frappe.db.sql("""select sum(base_grand_total), sum(outstanding_amount)
 		from `tabPurchase Invoice`
 		where supplier=%s
 			and docstatus = 1
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
index ff365cc..bd1e93a 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
@@ -229,7 +229,7 @@
    "permlevel": 0
   }, 
   {
-   "fieldname": "net_total", 
+   "fieldname": "base_net_total", 
    "fieldtype": "Currency", 
    "label": "Net Total (Company Currency)", 
    "no_copy": 1, 
@@ -247,7 +247,7 @@
    "permlevel": 0
   }, 
   {
-   "fieldname": "net_total_import", 
+   "fieldname": "net_total", 
    "fieldtype": "Currency", 
    "label": "Net Total", 
    "no_copy": 0, 
@@ -306,7 +306,7 @@
    "permlevel": 0
   }, 
   {
-   "fieldname": "other_charges_added", 
+   "fieldname": "base_taxes_and_charges_added", 
    "fieldtype": "Currency", 
    "label": "Taxes and Charges Added (Company Currency)", 
    "no_copy": 0, 
@@ -318,7 +318,7 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "other_charges_deducted", 
+   "fieldname": "base_taxes_and_charges_deducted", 
    "fieldtype": "Currency", 
    "label": "Taxes and Charges Deducted (Company Currency)", 
    "no_copy": 0, 
@@ -330,9 +330,9 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "total_tax", 
+   "fieldname": "base_total_taxes_and_charges", 
    "fieldtype": "Currency", 
-   "label": "Total Tax (Company Currency)", 
+   "label": "Total Taxes and Charges (Company Currency)", 
    "no_copy": 1, 
    "oldfieldname": "total_tax", 
    "oldfieldtype": "Currency", 
@@ -342,7 +342,7 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "grand_total", 
+   "fieldname": "base_grand_total", 
    "fieldtype": "Currency", 
    "label": "Grand Total (Company Currency)", 
    "no_copy": 1, 
@@ -354,7 +354,7 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "rounded_total", 
+   "fieldname": "base_rounded_total", 
    "fieldtype": "Currency", 
    "label": "Rounded Total (Company Currency)", 
    "oldfieldname": "rounded_total", 
@@ -366,7 +366,7 @@
   }, 
   {
    "description": "In Words will be visible once you save the Purchase Order.", 
-   "fieldname": "in_words", 
+   "fieldname": "base_in_words", 
    "fieldtype": "Data", 
    "label": "In Words (Company Currency)", 
    "oldfieldname": "in_words", 
@@ -383,7 +383,7 @@
    "print_hide": 0
   }, 
   {
-   "fieldname": "other_charges_added_import", 
+   "fieldname": "taxes_and_charges_added", 
    "fieldtype": "Currency", 
    "label": "Taxes and Charges Added", 
    "no_copy": 0, 
@@ -396,7 +396,7 @@
    "report_hide": 0
   }, 
   {
-   "fieldname": "other_charges_deducted_import", 
+   "fieldname": "taxes_and_charges_deducted", 
    "fieldtype": "Currency", 
    "label": "Taxes and Charges Deducted", 
    "no_copy": 0, 
@@ -409,7 +409,15 @@
    "report_hide": 0
   }, 
   {
-   "fieldname": "grand_total_import", 
+   "fieldname": "total_taxes_and_charges", 
+   "fieldtype": "Currency", 
+   "label": "Total Taxes and Charges", 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": ""
+  }, 
+  {
+   "fieldname": "grand_total", 
    "fieldtype": "Currency", 
    "in_list_view": 1, 
    "label": "Grand Total", 
@@ -423,7 +431,7 @@
    "report_hide": 0
   }, 
   {
-   "fieldname": "in_words_import", 
+   "fieldname": "in_words", 
    "fieldtype": "Data", 
    "label": "In Words", 
    "oldfieldname": "in_words_import", 
@@ -575,7 +583,7 @@
  "icon": "icon-shopping-cart", 
  "idx": 1, 
  "is_submittable": 1, 
- "modified": "2015-02-05 05:11:47.602292", 
+ "modified": "2015-02-11 16:08:30.374140", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Supplier Quotation", 
@@ -665,7 +673,7 @@
   }
  ], 
  "read_only_onload": 1, 
- "search_fields": "status, transaction_date, supplier,grand_total", 
+ "search_fields": "status, transaction_date, supplier,base_grand_total", 
  "sort_field": "modified", 
  "sort_order": "DESC", 
  "title_field": "supplier_name"
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation_list.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation_list.js
index 400a820..9555439 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation_list.js
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation_list.js
@@ -1,5 +1,5 @@
 frappe.listview_settings['Supplier Quotation'] = {
-	add_fields: ["supplier", "grand_total", "status", "company", "currency"],
+	add_fields: ["supplier", "base_grand_total", "status", "company", "currency"],
 	get_indicator: function(doc) {
 		if(doc.status==="Ordered") {
 			return [__("Ordered"), "green", "status,=,Ordered"];
diff --git a/erpnext/buying/doctype/supplier_quotation/test_records.json b/erpnext/buying/doctype/supplier_quotation/test_records.json
index 70e32fe..5233fe2 100644
--- a/erpnext/buying/doctype/supplier_quotation/test_records.json
+++ b/erpnext/buying/doctype/supplier_quotation/test_records.json
@@ -6,11 +6,11 @@
   "currency": "INR", 
   "doctype": "Supplier Quotation", 
   "fiscal_year": "_Test Fiscal Year 2013", 
+  "base_grand_total": 5000.0, 
   "grand_total": 5000.0, 
-  "grand_total_import": 5000.0, 
   "is_subcontracted": "No", 
   "naming_series": "_T-Supplier Quotation-", 
-  "net_total": 5000.0, 
+  "base_net_total": 5000.0, 
   "items": [
    {
     "base_amount": 5000.0, 
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index bb5531f..def1585 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -4,12 +4,11 @@
 from __future__ import unicode_literals
 import frappe
 from frappe import _, throw
-from frappe.utils import cint, today, flt
+from frappe.utils import today, flt
 from erpnext.setup.utils import get_company_currency, get_exchange_rate
 from erpnext.accounts.utils import get_fiscal_year, validate_fiscal_year
 from erpnext.utilities.transaction_base import TransactionBase
 from erpnext.controllers.recurring_document import convert_to_recurring, validate_recurring_document
-import json
 
 class AccountsController(TransactionBase):
 	def validate(self):
@@ -18,7 +17,7 @@
 		self.validate_date_with_fiscal_year()
 		if self.meta.get_field("currency"):
 			self.calculate_taxes_and_totals()
-			self.validate_value("grand_total", ">=", 0)
+			self.validate_value("base_grand_total", ">=", 0)
 			self.set_total_in_words()
 
 		self.validate_due_date()
@@ -52,6 +51,14 @@
 					self.fiscal_year = get_fiscal_year(self.get(fieldname))[0]
 				break
 
+	def calculate_taxes_and_totals(self):
+		from erpnext.controllers.taxes_and_totals import taxes_and_totals
+		taxes_and_totals(self).calculate()
+
+		if self.doctype in ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]:
+			self.calculate_commission()
+			self.calculate_contribution()
+
 	def validate_date_with_fiscal_year(self):
 		if self.meta.get_field("fiscal_year") :
 			date_field = ""
@@ -152,214 +159,11 @@
 		self.set("taxes", [])
 		self.set_taxes("taxes", "taxes_and_charges")
 
-	def calculate_taxes_and_totals(self):
-		self.discount_amount_applied = False
-		self._calculate_taxes_and_totals()
-
-		if self.meta.get_field("discount_amount"):
-			self.apply_discount_amount()
-
-	def _calculate_taxes_and_totals(self):
-		# validate conversion rate
-		company_currency = get_company_currency(self.company)
-		if not self.currency or self.currency == company_currency:
-			self.currency = company_currency
-			self.conversion_rate = 1.0
-		else:
-			validate_conversion_rate(self.currency, self.conversion_rate,
-				self.meta.get_label("conversion_rate"), self.company)
-
-		self.conversion_rate = flt(self.conversion_rate)
-
-		self.calculate_item_values()
-		self.initialize_taxes()
-
-		if hasattr(self, "determine_exclusive_rate"):
-			self.determine_exclusive_rate()
-
-		self.calculate_net_total()
-		self.calculate_taxes()
-		self.calculate_totals()
-		self._cleanup()
-
-	def initialize_taxes(self):
-		for tax in self.get("taxes"):
-			tax.item_wise_tax_detail = {}
-			tax_fields = ["total", "tax_amount_after_discount_amount",
-				"tax_amount_for_current_item", "grand_total_for_current_item",
-				"tax_fraction_for_current_item", "grand_total_fraction_for_current_item"]
-
-			if not self.discount_amount_applied:
-				tax_fields.append("tax_amount")
-
-			for fieldname in tax_fields:
-				tax.set(fieldname, 0.0)
-
-			self.validate_on_previous_row(tax)
-			self.validate_inclusive_tax(tax)
-			self.round_floats_in(tax)
-
-	def validate_on_previous_row(self, tax):
-		"""
-			validate if a valid row id is mentioned in case of
-			On Previous Row Amount and On Previous Row Total
-		"""
-		if tax.charge_type in ["On Previous Row Amount", "On Previous Row Total"] and \
-				(not tax.row_id or cint(tax.row_id) >= tax.idx):
-			throw(_("Please specify a valid Row ID for {0} in row {1}").format(_(tax.doctype), tax.idx))
-
-	def validate_inclusive_tax(self, tax):
-		def _on_previous_row_error(row_range):
-			throw(_("To include tax in row {0} in Item rate, taxes in rows {1} must also be included").format(tax.idx,
-				row_range))
-
-		if cint(getattr(tax, "included_in_print_rate", None)):
-			if tax.charge_type == "Actual":
-				# inclusive tax cannot be of type Actual
-				throw(_("Charge of type 'Actual' in row {0} cannot be included in Item Rate").format(tax.idx))
-			elif tax.charge_type == "On Previous Row Amount" and \
-					not cint(self.get("taxes")[cint(tax.row_id) - 1].included_in_print_rate):
-				# referred row should also be inclusive
-				_on_previous_row_error(tax.row_id)
-			elif tax.charge_type == "On Previous Row Total" and \
-					not all([cint(t.included_in_print_rate) for t in self.get("taxes")[:cint(tax.row_id) - 1]]):
-				# all rows about the reffered tax should be inclusive
-				_on_previous_row_error("1 - %d" % (tax.row_id,))
-
-	def calculate_taxes(self):
-		# maintain actual tax rate based on idx
-		actual_tax_dict = dict([[tax.idx, flt(tax.rate, self.precision("tax_amount", tax))] for tax in self.get("taxes")
-			if tax.charge_type == "Actual"])
-
-		for n, item in enumerate(self.get("items")):
-			item_tax_map = self._load_item_tax_rate(item.item_tax_rate)
-
-			for i, tax in enumerate(self.get("taxes")):
-				# tax_amount represents the amount of tax for the current step
-				current_tax_amount = self.get_current_tax_amount(item, tax, item_tax_map)
-
-				# Adjust divisional loss to the last item
-				if tax.charge_type == "Actual":
-					actual_tax_dict[tax.idx] -= current_tax_amount
-					if n == len(self.get("items")) - 1:
-						current_tax_amount += actual_tax_dict[tax.idx]
-
-				# store tax_amount for current item as it will be used for
-				# charge type = 'On Previous Row Amount'
-				tax.tax_amount_for_current_item = current_tax_amount
-
-				# accumulate tax amount into tax.tax_amount
-				if not self.discount_amount_applied:
-					tax.tax_amount += current_tax_amount
-
-				tax.tax_amount_after_discount_amount += current_tax_amount
-
-				if getattr(tax, "category", None):
-					# if just for valuation, do not add the tax amount in total
-					# hence, setting it as 0 for further steps
-					current_tax_amount = 0.0 if (tax.category == "Valuation") \
-						else current_tax_amount
-
-					current_tax_amount *= -1.0 if (tax.add_deduct_tax == "Deduct") else 1.0
-
-				# Calculate tax.total viz. grand total till that step
-				# note: grand_total_for_current_item contains the contribution of
-				# item's amount, previously applied tax and the current tax on that item
-				if i==0:
-					tax.grand_total_for_current_item = flt(item.base_amount + current_tax_amount,
-						self.precision("total", tax))
-				else:
-					tax.grand_total_for_current_item = \
-						flt(self.get("taxes")[i-1].grand_total_for_current_item +
-							current_tax_amount, self.precision("total", tax))
-
-				# in tax.total, accumulate grand total of each item
-				tax.total += tax.grand_total_for_current_item
-
-				# set precision in the last item iteration
-				if n == len(self.get("items")) - 1:
-					self.round_off_totals(tax)
-
-					# adjust Discount Amount loss in last tax iteration
-					if i == (len(self.get("taxes")) - 1) and self.discount_amount_applied:
-						self.adjust_discount_amount_loss(tax)
-
-	def round_off_totals(self, tax):
-		tax.total = flt(tax.total, self.precision("total", tax))
-		tax.tax_amount = flt(tax.tax_amount, self.precision("tax_amount", tax))
-		tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount,
-			self.precision("tax_amount", tax))
-
-	def adjust_discount_amount_loss(self, tax):
-		discount_amount_loss = self.grand_total - flt(self.base_discount_amount) - tax.total
-		tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount +
-			discount_amount_loss, self.precision("tax_amount", tax))
-		tax.total = flt(tax.total + discount_amount_loss, self.precision("total", tax))
-
-	def get_current_tax_amount(self, item, tax, item_tax_map):
-		tax_rate = self._get_tax_rate(tax, item_tax_map)
-		current_tax_amount = 0.0
-
-		if tax.charge_type == "Actual":
-			# distribute the tax amount proportionally to each item row
-			actual = flt(tax.rate, self.precision("tax_amount", tax))
-			current_tax_amount = (self.net_total
-				and ((item.base_amount / self.net_total) * actual)
-				or 0)
-		elif tax.charge_type == "On Net Total":
-			current_tax_amount = (tax_rate / 100.0) * item.base_amount
-		elif tax.charge_type == "On Previous Row Amount":
-			current_tax_amount = (tax_rate / 100.0) * \
-				self.get("taxes")[cint(tax.row_id) - 1].tax_amount_for_current_item
-		elif tax.charge_type == "On Previous Row Total":
-			current_tax_amount = (tax_rate / 100.0) * \
-				self.get("taxes")[cint(tax.row_id) - 1].grand_total_for_current_item
-
-		current_tax_amount = flt(current_tax_amount, self.precision("tax_amount", tax))
-
-		# store tax breakup for each item
-		key = item.item_code or item.item_name
-		if tax.item_wise_tax_detail.get(key):
-			item_wise_tax_amount = tax.item_wise_tax_detail[key][1] + current_tax_amount
-			tax.item_wise_tax_detail[key] = [tax_rate,item_wise_tax_amount]
-		else:
-			tax.item_wise_tax_detail[key] = [tax_rate,current_tax_amount]
-
-		return current_tax_amount
-
-	def _load_item_tax_rate(self, item_tax_rate):
-		return json.loads(item_tax_rate) if item_tax_rate else {}
-
-	def _get_tax_rate(self, tax, item_tax_map):
-		if item_tax_map.has_key(tax.account_head):
-			return flt(item_tax_map.get(tax.account_head), self.precision("rate", tax))
-		else:
-			return tax.rate
-
-	def _cleanup(self):
-		for tax in self.get("taxes"):
-			tax.item_wise_tax_detail = json.dumps(tax.item_wise_tax_detail, separators=(',', ':'))
-
-	def _set_in_company_currency(self, item, print_field, base_field):
-		"""set values in base currency"""
-		value_in_company_currency = flt(self.conversion_rate *
-			flt(item.get(print_field), self.precision(print_field, item)),
-			self.precision(base_field, item))
-		item.set(base_field, value_in_company_currency)
-
 	def validate_enabled_taxes_and_charges(self):
 		taxes_and_charges_doctype = self.meta.get_options("taxes_and_charges")
 		if frappe.db.get_value(taxes_and_charges_doctype, self.taxes_and_charges, "disabled"):
 			frappe.throw(_("{0} '{1}' is disabled").format(taxes_and_charges_doctype, self.taxes_and_charges))
 
-	def calculate_total_advance(self, parenttype, advance_parentfield):
-		if self.doctype == parenttype and self.docstatus < 2:
-			sum_of_allocated_amount = sum([flt(adv.allocated_amount, self.precision("allocated_amount", adv))
-				for adv in self.get(advance_parentfield)])
-
-			self.total_advance = flt(sum_of_allocated_amount, self.precision("total_advance"))
-
-			self.calculate_outstanding_amount()
 
 	def get_gl_dict(self, args):
 		"""this method populates the common properties of a gl entry record"""
@@ -510,12 +314,12 @@
 
 		if advance_paid:
 			advance_paid = flt(advance_paid[0][0], self.precision("advance_paid"))
-		if flt(self.grand_total) >= advance_paid:
+		if flt(self.base_grand_total) >= advance_paid:
 			frappe.db.set_value(self.doctype, self.name, "advance_paid", advance_paid)
 		else:
 			frappe.throw(_("Total advance ({0}) against Order {1} cannot be greater \
 				than the Grand Total ({2})")
-			.format(advance_paid, self.name, self.grand_total))
+			.format(advance_paid, self.name, self.base_grand_total))
 
 	@property
 	def company_abbr(self):
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index 72b4ba0..93a0145 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -4,7 +4,7 @@
 from __future__ import unicode_literals
 import frappe
 from frappe import _, msgprint
-from frappe.utils import flt, rounded
+from frappe.utils import flt
 
 from erpnext.setup.utils import get_company_currency
 from erpnext.accounts.party import get_party_details
@@ -21,7 +21,7 @@
 
 	def get_feed(self):
 		return _("From {0} | {1} {2}").format(self.supplier_name, self.currency,
-			self.grand_total_import)
+			self.grand_total)
 
 	def validate(self):
 		super(BuyingController, self).validate()
@@ -74,87 +74,10 @@
 	def set_total_in_words(self):
 		from frappe.utils import money_in_words
 		company_currency = get_company_currency(self.company)
+		if self.meta.get_field("base_in_words"):
+			self.base_in_words = money_in_words(self.base_grand_total, company_currency)
 		if self.meta.get_field("in_words"):
-			self.in_words = money_in_words(self.grand_total, company_currency)
-		if self.meta.get_field("in_words_import"):
-			self.in_words_import = money_in_words(self.grand_total_import,
-		 		self.currency)
-
-	def calculate_taxes_and_totals(self):
-		super(BuyingController, self).calculate_taxes_and_totals()
-		self.calculate_total_advance("Purchase Invoice", "advances")
-
-	def calculate_item_values(self):
-		for item in self.get("items"):
-			self.round_floats_in(item)
-
-			if item.discount_percentage == 100.0:
-				item.rate = 0.0
-			elif not item.rate:
-				item.rate = flt(item.price_list_rate * (1.0 - (item.discount_percentage / 100.0)),
-					self.precision("rate", item))
-
-			item.amount = flt(item.rate * item.qty, self.precision("amount", item))
-			item.item_tax_amount = 0.0;
-
-			self._set_in_company_currency(item, "amount", "base_amount")
-			self._set_in_company_currency(item, "price_list_rate", "base_price_list_rate")
-			self._set_in_company_currency(item, "rate", "base_rate")
-
-
-	def calculate_net_total(self):
-		self.net_total = self.net_total_import = 0.0
-
-		for item in self.get("items"):
-			self.net_total += item.base_amount
-			self.net_total_import += item.amount
-
-		self.round_floats_in(self, ["net_total", "net_total_import"])
-
-	def calculate_totals(self):
-		self.grand_total = flt(self.get("taxes")[-1].total if self.get("taxes") else self.net_total)
-
-		self.total_tax = flt(self.grand_total - self.net_total, self.precision("total_tax"))
-
-		self.grand_total = flt(self.grand_total, self.precision("grand_total"))
-
-		if self.meta.get_field("rounded_total"):
-			self.rounded_total = rounded(self.grand_total)
-
-		if self.meta.get_field("other_charges_added"):
-			self.other_charges_added = flt(sum([flt(d.tax_amount) for d in self.get("taxes")
-				if d.add_deduct_tax=="Add" and d.category in ["Valuation and Total", "Total"]]),
-				self.precision("other_charges_added"))
-
-		if self.meta.get_field("other_charges_deducted"):
-			self.other_charges_deducted = flt(sum([flt(d.tax_amount) for d in self.get("taxes")
-				if d.add_deduct_tax=="Deduct" and d.category in ["Valuation and Total", "Total"]]),
-				self.precision("other_charges_deducted"))
-
-		self.grand_total_import = flt(self.grand_total / self.conversion_rate) \
-			if (self.other_charges_added or self.other_charges_deducted) else self.net_total_import
-
-		self.grand_total_import = flt(self.grand_total_import, self.precision("grand_total_import"))
-
-		if self.meta.get_field("rounded_total_import"):
-			self.rounded_total_import = rounded(self.grand_total_import)
-
-		if self.meta.get_field("other_charges_added_import"):
-			self.other_charges_added_import = flt(self.other_charges_added /
-				self.conversion_rate, self.precision("other_charges_added_import"))
-
-		if self.meta.get_field("other_charges_deducted_import"):
-			self.other_charges_deducted_import = flt(self.other_charges_deducted /
-				self.conversion_rate, self.precision("other_charges_deducted_import"))
-
-	def calculate_outstanding_amount(self):
-		if self.doctype == "Purchase Invoice" and self.docstatus == 0:
-			self.total_advance = flt(self.total_advance,
-				self.precision("total_advance"))
-			self.total_amount_to_pay = flt(self.grand_total - flt(self.write_off_amount,
-				self.precision("write_off_amount")), self.precision("total_amount_to_pay"))
-			self.outstanding_amount = flt(self.total_amount_to_pay - self.total_advance,
-				self.precision("outstanding_amount"))
+			self.in_words = money_in_words(self.grand_total, self.currency)
 
 	# update valuation rate
 	def update_valuation_rate(self, parentfield):
@@ -174,11 +97,9 @@
 				stock_items_amount += flt(d.base_amount)
 				last_stock_item_idx = d.idx
 
-		total_valuation_amount = sum([flt(d.tax_amount) for d in
-			self.get("taxes")
+		total_valuation_amount = sum([flt(d.tax_amount) for d in self.get("taxes")
 			if d.category in ["Valuation", "Valuation and Total"]])
 
-
 		valuation_amount_adjustment = total_valuation_amount
 		for i, item in enumerate(self.get(parentfield)):
 			if item.item_code and item.qty and item.item_code in stock_items:
@@ -357,7 +278,6 @@
 
 		return self._purchase_items
 
-
 	def is_item_table_empty(self):
 		if not len(self.get("items")):
 			frappe.throw(_("Item table can not be blank"))
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index 4e06b6b..e6ec2af 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -3,7 +3,7 @@
 
 from __future__ import unicode_literals
 import frappe
-from frappe.utils import cint, flt, rounded, cstr, comma_or
+from frappe.utils import cint, flt, cstr, comma_or
 from erpnext.setup.utils import get_company_currency
 from frappe import _, throw
 from erpnext.stock.get_item_details import get_available_qty
@@ -19,7 +19,7 @@
 
 	def get_feed(self):
 		return _("To {0} | {1} {2}").format(self.customer_name, self.currency,
-			self.grand_total_export)
+			self.grand_total)
 
 	def onload(self):
 		if self.doctype in ("Sales Order", "Delivery Note", "Sales Invoice"):
@@ -65,7 +65,7 @@
 	def apply_shipping_rule(self):
 		if self.shipping_rule:
 			shipping_rule = frappe.get_doc("Shipping Rule", self.shipping_rule)
-			value = self.net_total
+			value = self.base_net_total
 
 			# TODO
 			# shipping rule calculation based on item's net weight
@@ -114,171 +114,20 @@
 		disable_rounded_total = cint(frappe.db.get_value("Global Defaults", None,
 			"disable_rounded_total"))
 
+		if self.meta.get_field("base_in_words"):
+			self.base_in_words = money_in_words(disable_rounded_total and
+				self.base_grand_total or self.base_rounded_total, company_currency)
 		if self.meta.get_field("in_words"):
 			self.in_words = money_in_words(disable_rounded_total and
-				self.grand_total or self.rounded_total, company_currency)
-		if self.meta.get_field("in_words_export"):
-			self.in_words_export = money_in_words(disable_rounded_total and
-				self.grand_total_export or self.rounded_total_export, self.currency)
-
-	def calculate_taxes_and_totals(self):
-		super(SellingController, self).calculate_taxes_and_totals()
-
-		self.calculate_total_advance("Sales Invoice", "advances")
-		self.calculate_commission()
-		self.calculate_contribution()
-
-	def determine_exclusive_rate(self):
-		if not any((cint(tax.included_in_print_rate) for tax in self.get("taxes"))):
-			# no inclusive tax
-			return
-
-		for item in self.get("items"):
-			item_tax_map = self._load_item_tax_rate(item.item_tax_rate)
-			cumulated_tax_fraction = 0
-			for i, tax in enumerate(self.get("taxes")):
-				tax.tax_fraction_for_current_item = self.get_current_tax_fraction(tax, item_tax_map)
-
-				if i==0:
-					tax.grand_total_fraction_for_current_item = 1 + tax.tax_fraction_for_current_item
-				else:
-					tax.grand_total_fraction_for_current_item = \
-						self.get("taxes")[i-1].grand_total_fraction_for_current_item \
-						+ tax.tax_fraction_for_current_item
-
-				cumulated_tax_fraction += tax.tax_fraction_for_current_item
-
-			if cumulated_tax_fraction and not self.discount_amount_applied and item.qty:
-				item.base_amount = flt((item.amount * self.conversion_rate) /
-					(1 + cumulated_tax_fraction), self.precision("base_amount", item))
-
-				item.base_rate = flt(item.base_amount / item.qty, self.precision("base_rate", item))
-				item.discount_percentage = flt(item.discount_percentage, self.precision("discount_percentage", item))
-
-				if item.discount_percentage == 100:
-					item.base_price_list_rate = item.base_rate
-					item.base_rate = 0.0
-				else:
-					item.base_price_list_rate = flt(item.base_rate / (1 - (item.discount_percentage / 100.0)),
-						self.precision("base_price_list_rate", item))
-
-	def get_current_tax_fraction(self, tax, item_tax_map):
-		"""
-			Get tax fraction for calculating tax exclusive amount
-			from tax inclusive amount
-		"""
-		current_tax_fraction = 0
-
-		if cint(tax.included_in_print_rate):
-			tax_rate = self._get_tax_rate(tax, item_tax_map)
-
-			if tax.charge_type == "On Net Total":
-				current_tax_fraction = tax_rate / 100.0
-
-			elif tax.charge_type == "On Previous Row Amount":
-				current_tax_fraction = (tax_rate / 100.0) * \
-					self.get("taxes")[cint(tax.row_id) - 1].tax_fraction_for_current_item
-
-			elif tax.charge_type == "On Previous Row Total":
-				current_tax_fraction = (tax_rate / 100.0) * \
-					self.get("taxes")[cint(tax.row_id) - 1].grand_total_fraction_for_current_item
-
-		return current_tax_fraction
-
-	def calculate_item_values(self):
-		if not self.discount_amount_applied:
-			for item in self.get("items"):
-				self.round_floats_in(item)
-
-				if item.discount_percentage == 100:
-					item.rate = 0
-				elif not item.rate:
-					item.rate = flt(item.price_list_rate * (1.0 - (item.discount_percentage / 100.0)),
-						self.precision("rate", item))
-
-				item.amount = flt(item.rate * item.qty,
-					self.precision("amount", item))
-
-				self._set_in_company_currency(item, "price_list_rate", "base_price_list_rate")
-				self._set_in_company_currency(item, "rate", "base_rate")
-				self._set_in_company_currency(item, "amount", "base_amount")
-
-	def calculate_net_total(self):
-		self.net_total = self.net_total_export = 0.0
-
-		for item in self.get("items"):
-			self.net_total += item.base_amount
-			self.net_total_export += item.amount
-
-		self.round_floats_in(self, ["net_total", "net_total_export"])
-
-	def calculate_totals(self):
-		self.grand_total = flt(self.get("taxes")[-1].total if self.get("taxes") else self.net_total)
-
-		self.other_charges_total = flt(self.grand_total - self.net_total, self.precision("other_charges_total"))
-
-		self.grand_total_export = flt(self.grand_total / self.conversion_rate) \
-			if (self.other_charges_total or self.discount_amount) else self.net_total_export
-
-		self.other_charges_total_export = flt(self.grand_total_export - self.net_total_export +
-			flt(self.discount_amount), self.precision("other_charges_total_export"))
-
-		self.grand_total = flt(self.grand_total, self.precision("grand_total"))
-		self.grand_total_export = flt(self.grand_total_export, self.precision("grand_total_export"))
-
-		self.rounded_total = rounded(self.grand_total)
-		self.rounded_total_export = rounded(self.grand_total_export)
-
-	def apply_discount_amount(self):
-		if self.discount_amount:
-			self.base_discount_amount = flt(self.discount_amount * self.conversion_rate, self.precision("base_discount_amount"))
-
-			grand_total_for_discount_amount = self.get_grand_total_for_discount_amount()
-
-			if grand_total_for_discount_amount:
-				# calculate item amount after Discount Amount
-				for item in self.get("items"):
-					distributed_amount = flt(self.base_discount_amount) * item.base_amount / grand_total_for_discount_amount
-					item.base_amount = flt(item.base_amount - distributed_amount, self.precision("base_amount", item))
-
-				self.discount_amount_applied = True
-				self._calculate_taxes_and_totals()
-		else:
-			self.base_discount_amount = 0
-
-	def get_grand_total_for_discount_amount(self):
-		actual_taxes_dict = {}
-
-		for tax in self.get("taxes"):
-			if tax.charge_type == "Actual":
-				actual_taxes_dict.setdefault(tax.idx, tax.tax_amount)
-			elif tax.row_id in actual_taxes_dict:
-				actual_tax_amount = flt(actual_taxes_dict.get(tax.row_id, 0)) * \
-					flt(tax.rate) / 100
-				actual_taxes_dict.setdefault(tax.idx, actual_tax_amount)
-
-		grand_total_for_discount_amount = flt(self.grand_total - sum(actual_taxes_dict.values()),
-			self.precision("grand_total"))
-		return grand_total_for_discount_amount
-
-	def calculate_outstanding_amount(self):
-		# NOTE:
-		# write_off_amount is only for POS Invoice
-		# total_advance is only for non POS Invoice
-		if self.doctype == "Sales Invoice" and self.docstatus == 0:
-			self.round_floats_in(self, ["grand_total", "total_advance", "write_off_amount",
-				"paid_amount"])
-			total_amount_to_pay = self.grand_total - self.write_off_amount
-			self.outstanding_amount = flt(total_amount_to_pay - self.total_advance \
-				- self.paid_amount,	self.precision("outstanding_amount"))
+				self.grand_total or self.rounded_total, self.currency)
 
 	def calculate_commission(self):
 		if self.meta.get_field("commission_rate"):
-			self.round_floats_in(self, ["net_total", "commission_rate"])
+			self.round_floats_in(self, ["base_net_total", "commission_rate"])
 			if self.commission_rate > 100.0:
 				throw(_("Commission rate cannot be greater than 100"))
 
-			self.total_commission = flt(self.net_total * self.commission_rate / 100.0,
+			self.total_commission = flt(self.base_net_total * self.commission_rate / 100.0,
 				self.precision("total_commission"))
 
 	def calculate_contribution(self):
@@ -291,7 +140,7 @@
 			self.round_floats_in(sales_person)
 
 			sales_person.allocated_amount = flt(
-				self.net_total * sales_person.allocated_percentage / 100.0,
+				self.base_net_total * sales_person.allocated_percentage / 100.0,
 				self.precision("allocated_amount", sales_person))
 
 			total += sales_person.allocated_percentage
diff --git a/erpnext/controllers/status_updater.py b/erpnext/controllers/status_updater.py
index e16c725..2989d1b 100644
--- a/erpnext/controllers/status_updater.py
+++ b/erpnext/controllers/status_updater.py
@@ -196,7 +196,7 @@
 		ref_fieldname = ref_dt.lower().replace(" ", "_")
 		zero_amount_refdoc = []
 		all_zero_amount_refdoc = frappe.db.sql_list("""select name from `tab%s`
-			where docstatus=1 and net_total = 0""" % ref_dt)
+			where docstatus=1 and base_net_total = 0""" % ref_dt)
 
 		for item in self.get("items"):
 			if item.get(ref_fieldname) \
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
new file mode 100644
index 0000000..6e8d7f1
--- /dev/null
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -0,0 +1,397 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import json
+from frappe import _, throw
+from frappe.utils import cint, flt, rounded
+from erpnext.setup.utils import get_company_currency
+from erpnext.controllers.accounts_controller import validate_conversion_rate
+
+class taxes_and_totals(object):
+	def __init__(self, doc):
+		self.doc = doc
+
+	def calculate(self):
+		self.discount_amount_applied = False
+		self._calculate()
+
+		if self.doc.meta.get_field("discount_amount"):
+			self.apply_discount_amount()
+
+		if self.doc.doctype in ["Sales Invoice", "Purchase Invoice"]:
+			self.calculate_total_advance()
+
+	def _calculate(self):
+		# validate conversion rate
+		company_currency = get_company_currency(self.doc.company)
+		if not self.doc.currency or self.doc.currency == company_currency:
+			self.doc.currency = company_currency
+			self.doc.conversion_rate = 1.0
+		else:
+			validate_conversion_rate(self.doc.currency, self.doc.conversion_rate,
+				self.doc.meta.get_label("conversion_rate"), self.doc.company)
+
+		self.doc.conversion_rate = flt(self.doc.conversion_rate)
+
+		self.calculate_item_values()
+		self.initialize_taxes()
+
+		if self.doc.doctype in ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]:
+			self.determine_exclusive_rate()
+
+		self.calculate_net_total()
+		self.calculate_taxes()
+		self.calculate_totals()
+		self._cleanup()
+
+	def calculate_item_values(self):
+		if not self.discount_amount_applied:
+			for item in self.doc.get("items"):
+				self.doc.round_floats_in(item)
+
+				if item.discount_percentage == 100:
+					item.rate = 0.0
+				elif not item.rate:
+					item.rate = flt(item.price_list_rate * (1.0 - (item.discount_percentage / 100.0)),
+						self.doc.precision("rate", item))
+
+				item.amount = flt(item.rate * item.qty,	self.doc.precision("amount", item))
+				item.item_tax_amount = 0.0;
+
+				self._set_in_company_currency(item, "price_list_rate", "base_price_list_rate")
+				self._set_in_company_currency(item, "rate", "base_rate")
+				self._set_in_company_currency(item, "amount", "base_amount")
+
+	def _set_in_company_currency(self, item, print_field, base_field):
+		"""set values in base currency"""
+		value_in_company_currency = flt(self.doc.conversion_rate *
+			flt(item.get(print_field), self.doc.precision(print_field, item)), self.doc.precision(base_field, item))
+		item.set(base_field, value_in_company_currency)
+
+	def initialize_taxes(self):
+		for tax in self.doc.get("taxes"):
+			tax.item_wise_tax_detail = {}
+			tax_fields = ["total", "tax_amount_after_discount_amount",
+				"tax_amount_for_current_item", "grand_total_for_current_item",
+				"tax_fraction_for_current_item", "grand_total_fraction_for_current_item"]
+
+			if not self.discount_amount_applied:
+				tax_fields.append("tax_amount")
+
+			for fieldname in tax_fields:
+				tax.set(fieldname, 0.0)
+
+			self.validate_on_previous_row(tax)
+			self.validate_inclusive_tax(tax)
+			self.doc.round_floats_in(tax)
+
+	def validate_on_previous_row(self, tax):
+		"""
+			validate if a valid row id is mentioned in case of
+			On Previous Row Amount and On Previous Row Total
+		"""
+		if tax.charge_type in ["On Previous Row Amount", "On Previous Row Total"] and \
+				(not tax.row_id or cint(tax.row_id) >= tax.idx):
+			throw(_("Please specify a valid Row ID for {0} in row {1}").format(_(tax.doctype), tax.idx))
+
+	def validate_inclusive_tax(self, tax):
+		def _on_previous_row_error(row_range):
+			throw(_("To include tax in row {0} in Item rate, taxes in rows {1} must also be included").format(tax.idx,
+				row_range))
+
+		if cint(getattr(tax, "included_in_print_rate", None)):
+			if tax.charge_type == "Actual":
+				# inclusive tax cannot be of type Actual
+				throw(_("Charge of type 'Actual' in row {0} cannot be included in Item Rate").format(tax.idx))
+			elif tax.charge_type == "On Previous Row Amount" and \
+					not cint(self.doc.get("taxes")[cint(tax.row_id) - 1].included_in_print_rate):
+				# referred row should also be inclusive
+				_on_previous_row_error(tax.row_id)
+			elif tax.charge_type == "On Previous Row Total" and \
+					not all([cint(t.included_in_print_rate) for t in self.doc.get("taxes")[:cint(tax.row_id) - 1]]):
+				# all rows about the reffered tax should be inclusive
+				_on_previous_row_error("1 - %d" % (tax.row_id,))
+
+	def determine_exclusive_rate(self):
+		if not any((cint(tax.included_in_print_rate) for tax in self.doc.get("taxes"))):
+			# no inclusive tax
+			return
+
+		for item in self.doc.get("items"):
+			item_tax_map = self._load_item_tax_rate(item.item_tax_rate)
+			cumulated_tax_fraction = 0
+			for i, tax in enumerate(self.doc.get("taxes")):
+				tax.tax_fraction_for_current_item = self.get_current_tax_fraction(tax, item_tax_map)
+
+				if i==0:
+					tax.grand_total_fraction_for_current_item = 1 + tax.tax_fraction_for_current_item
+				else:
+					tax.grand_total_fraction_for_current_item = \
+						self.doc.get("taxes")[i-1].grand_total_fraction_for_current_item \
+						+ tax.tax_fraction_for_current_item
+
+				cumulated_tax_fraction += tax.tax_fraction_for_current_item
+
+			if cumulated_tax_fraction and not self.discount_amount_applied and item.qty:
+				item.base_amount = flt((item.amount * self.doc.conversion_rate) /
+					(1 + cumulated_tax_fraction), self.doc.precision("base_amount", item))
+
+				item.base_rate = flt(item.base_amount / item.qty, self.doc.precision("base_rate", item))
+				item.discount_percentage = flt(item.discount_percentage, self.doc.precision("discount_percentage", item))
+
+				if item.discount_percentage == 100:
+					item.base_price_list_rate = item.base_rate
+					item.base_rate = 0.0
+				else:
+					item.base_price_list_rate = flt(item.base_rate / (1 - (item.discount_percentage / 100.0)),
+						self.doc.precision("base_price_list_rate", item))
+
+	def _load_item_tax_rate(self, item_tax_rate):
+		return json.loads(item_tax_rate) if item_tax_rate else {}
+
+	def get_current_tax_fraction(self, tax, item_tax_map):
+		"""
+			Get tax fraction for calculating tax exclusive amount
+			from tax inclusive amount
+		"""
+		current_tax_fraction = 0
+
+		if cint(tax.included_in_print_rate):
+			tax_rate = self._get_tax_rate(tax, item_tax_map)
+
+			if tax.charge_type == "On Net Total":
+				current_tax_fraction = tax_rate / 100.0
+
+			elif tax.charge_type == "On Previous Row Amount":
+				current_tax_fraction = (tax_rate / 100.0) * \
+					self.doc.get("taxes")[cint(tax.row_id) - 1].tax_fraction_for_current_item
+
+			elif tax.charge_type == "On Previous Row Total":
+				current_tax_fraction = (tax_rate / 100.0) * \
+					self.doc.get("taxes")[cint(tax.row_id) - 1].grand_total_fraction_for_current_item
+
+		return current_tax_fraction
+
+	def _get_tax_rate(self, tax, item_tax_map):
+		if item_tax_map.has_key(tax.account_head):
+			return flt(item_tax_map.get(tax.account_head), self.doc.precision("rate", tax))
+		else:
+			return tax.rate
+
+	def calculate_net_total(self):
+		self.doc.base_net_total = self.doc.net_total = 0.0
+
+		for item in self.doc.get("items"):
+			self.doc.base_net_total += item.base_amount
+			self.doc.net_total += item.amount
+
+		self.doc.round_floats_in(self.doc, ["base_net_total", "net_total"])
+
+	def calculate_taxes(self):
+		# maintain actual tax rate based on idx
+		actual_tax_dict = dict([[tax.idx, flt(tax.rate, self.doc.precision("tax_amount", tax))]
+			for tax in self.doc.get("taxes") if tax.charge_type == "Actual"])
+
+		for n, item in enumerate(self.doc.get("items")):
+			item_tax_map = self._load_item_tax_rate(item.item_tax_rate)
+
+			for i, tax in enumerate(self.doc.get("taxes")):
+				# tax_amount represents the amount of tax for the current step
+				current_tax_amount = self.get_current_tax_amount(item, tax, item_tax_map)
+
+				# Adjust divisional loss to the last item
+				if tax.charge_type == "Actual":
+					actual_tax_dict[tax.idx] -= current_tax_amount
+					if n == len(self.doc.get("items")) - 1:
+						current_tax_amount += actual_tax_dict[tax.idx]
+
+				# store tax_amount for current item as it will be used for
+				# charge type = 'On Previous Row Amount'
+				tax.tax_amount_for_current_item = current_tax_amount
+
+				# accumulate tax amount into tax.tax_amount
+				if not self.discount_amount_applied:
+					tax.tax_amount += current_tax_amount
+
+				tax.tax_amount_after_discount_amount += current_tax_amount
+
+				if getattr(tax, "category", None):
+					# if just for valuation, do not add the tax amount in total
+					# hence, setting it as 0 for further steps
+					current_tax_amount = 0.0 if (tax.category == "Valuation") \
+						else current_tax_amount
+
+					current_tax_amount *= -1.0 if (tax.add_deduct_tax == "Deduct") else 1.0
+
+				# Calculate tax.total viz. grand total till that step
+				# note: grand_total_for_current_item contains the contribution of
+				# item's amount, previously applied tax and the current tax on that item
+				if i==0:
+					tax.grand_total_for_current_item = flt(item.base_amount + current_tax_amount,
+						self.doc.precision("total", tax))
+				else:
+					tax.grand_total_for_current_item = \
+						flt(self.doc.get("taxes")[i-1].grand_total_for_current_item +
+							current_tax_amount, self.doc.precision("total", tax))
+
+				# in tax.total, accumulate grand total of each item
+				tax.total += tax.grand_total_for_current_item
+
+				# set precision in the last item iteration
+				if n == len(self.doc.get("items")) - 1:
+					self.round_off_totals(tax)
+
+					# adjust Discount Amount loss in last tax iteration
+					if i == (len(self.doc.get("taxes")) - 1) and self.discount_amount_applied:
+						self.adjust_discount_amount_loss(tax)
+
+	def get_current_tax_amount(self, item, tax, item_tax_map):
+		tax_rate = self._get_tax_rate(tax, item_tax_map)
+		current_tax_amount = 0.0
+
+		if tax.charge_type == "Actual":
+			# distribute the tax amount proportionally to each item row
+			actual = flt(tax.rate, self.doc.precision("tax_amount", tax))
+			current_tax_amount = (self.doc.base_net_total
+				and ((item.base_amount / self.doc.base_net_total) * actual)
+				or 0)
+		elif tax.charge_type == "On Net Total":
+			current_tax_amount = (tax_rate / 100.0) * item.base_amount
+		elif tax.charge_type == "On Previous Row Amount":
+			current_tax_amount = (tax_rate / 100.0) * \
+				self.doc.get("taxes")[cint(tax.row_id) - 1].tax_amount_for_current_item
+		elif tax.charge_type == "On Previous Row Total":
+			current_tax_amount = (tax_rate / 100.0) * \
+				self.doc.get("taxes")[cint(tax.row_id) - 1].grand_total_for_current_item
+
+		current_tax_amount = flt(current_tax_amount, self.doc.precision("tax_amount", tax))
+
+		# store tax breakup for each item
+		key = item.item_code or item.item_name
+		if tax.item_wise_tax_detail.get(key):
+			item_wise_tax_amount = tax.item_wise_tax_detail[key][1] + current_tax_amount
+			tax.item_wise_tax_detail[key] = [tax_rate,item_wise_tax_amount]
+		else:
+			tax.item_wise_tax_detail[key] = [tax_rate,current_tax_amount]
+
+		return current_tax_amount
+
+	def round_off_totals(self, tax):
+		tax.total = flt(tax.total, self.doc.precision("total", tax))
+		tax.tax_amount = flt(tax.tax_amount, self.doc.precision("tax_amount", tax))
+		tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount,
+			self.doc.precision("tax_amount", tax))
+
+	def adjust_discount_amount_loss(self, tax):
+		discount_amount_loss = self.doc.base_grand_total - flt(self.doc.base_discount_amount) - tax.total
+		tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount +
+			discount_amount_loss, self.doc.precision("tax_amount", tax))
+		tax.total = flt(tax.total + discount_amount_loss, self.doc.precision("total", tax))
+
+	def calculate_totals(self):
+		self.doc.base_grand_total = flt(self.doc.get("taxes")[-1].total
+			if self.doc.get("taxes") else self.doc.base_net_total)
+
+		self.doc.base_total_taxes_and_charges = flt(self.doc.base_grand_total - self.doc.base_net_total,
+			self.doc.precision("base_total_taxes_and_charges"))
+
+		if self.doc.doctype in ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]:
+			self.doc.grand_total = flt(self.doc.base_grand_total / self.doc.conversion_rate) \
+				if (self.doc.base_total_taxes_and_charges or self.doc.discount_amount) else self.doc.net_total
+
+			self.doc.total_taxes_and_charges = flt(self.doc.grand_total - self.doc.net_total +
+				flt(self.doc.discount_amount), self.doc.precision("total_taxes_and_charges"))
+		else:
+			self.doc.base_taxes_and_charges_added, self.base_taxes_and_charges_deducted = 0.0, 0.0
+			for tax in self.doc.get("taxes"):
+				if tax.category in ["Valuation and Total", "Total"]:
+					if tax.add_deduct_tax == "Add":
+						self.doc.base_taxes_and_charges_added += flt(tax.tax_amount)
+					else:
+						self.doc.base_taxes_and_charges_deducted += flt(tax.tax_amount)
+
+			self.doc.round_floats_in(self.doc, ["base_taxes_and_charges_added", "base_taxes_and_charges_deducted"])
+
+			self.doc.grand_total = flt(self.doc.base_grand_total / self.doc.conversion_rate) \
+				if (self.doc.base_taxes_and_charges_added or self.doc.base_taxes_and_charges_deducted) else self.doc.net_total
+
+			self.doc.total_taxes_and_charges = flt(self.doc.grand_total - self.doc.net_total,
+				self.doc.precision("total_taxes_and_charges"))
+
+			self.doc.taxes_and_charges_added = flt(self.doc.base_taxes_and_charges_added / self.doc.conversion_rate,
+				self.doc.precision("taxes_and_charges_added"))
+			self.doc.taxes_and_charges_deducted = flt(self.doc.base_taxes_and_charges_deducted / self.doc.conversion_rate,
+				self.doc.precision("taxes_and_charges_deducted"))
+
+		self.doc.base_grand_total = flt(self.doc.base_grand_total, self.doc.precision("base_grand_total"))
+		self.doc.grand_total = flt(self.doc.grand_total, self.doc.precision("grand_total"))
+
+		if self.doc.meta.get_field("base_rounded_total"):
+			self.doc.base_rounded_total = rounded(self.doc.base_grand_total)
+		if self.doc.meta.get_field("rounded_total"):
+			self.doc.rounded_total = rounded(self.doc.grand_total)
+
+	def _cleanup(self):
+		for tax in self.doc.get("taxes"):
+			tax.item_wise_tax_detail = json.dumps(tax.item_wise_tax_detail, separators=(',', ':'))
+
+	def apply_discount_amount(self):
+		if self.doc.discount_amount:
+			self.doc.base_discount_amount = flt(self.doc.discount_amount * self.doc.conversion_rate,
+				self.doc.precision("base_discount_amount"))
+
+			grand_total_for_discount_amount = self.get_grand_total_for_discount_amount()
+
+			if grand_total_for_discount_amount:
+				# calculate item amount after Discount Amount
+				for item in self.doc.get("items"):
+					distributed_amount = flt(self.doc.base_discount_amount) * item.base_amount / grand_total_for_discount_amount
+					item.base_amount = flt(item.base_amount - distributed_amount, self.doc.precision("base_amount", item))
+
+				self.discount_amount_applied = True
+				self._calculate()
+		else:
+			self.doc.base_discount_amount = 0
+
+	def get_grand_total_for_discount_amount(self):
+		actual_taxes_dict = {}
+
+		for tax in self.doc.get("taxes"):
+			if tax.charge_type == "Actual":
+				actual_taxes_dict.setdefault(tax.idx, tax.tax_amount)
+			elif tax.row_id in actual_taxes_dict:
+				actual_tax_amount = flt(actual_taxes_dict.get(tax.row_id, 0)) * flt(tax.rate) / 100
+				actual_taxes_dict.setdefault(tax.idx, actual_tax_amount)
+
+		grand_total_for_discount_amount = flt(self.doc.base_grand_total - sum(actual_taxes_dict.values()),
+			self.doc.precision("base_grand_total"))
+		return grand_total_for_discount_amount
+
+
+	def calculate_total_advance(self, parenttype, advance_parentfield):
+		if self.docstatus < 2:
+			sum_of_allocated_amount = sum([flt(adv.allocated_amount, self.doc.precision("allocated_amount", adv))
+				for adv in self.doc.get("advances")])
+
+			self.doc.total_advance = flt(sum_of_allocated_amount, self.doc.precision("total_advance"))
+
+			if self.docstatus == 0:
+				self.calculate_outstanding_amount()
+
+	def calculate_outstanding_amount(self):
+		# NOTE:
+		# write_off_amount is only for POS Invoice
+		# total_advance is only for non POS Invoice
+
+		if self.doc.doctype == "Sales Invoice":
+			self.doc.round_floats_in(self.doc, ["base_grand_total", "total_advance", "write_off_amount", "paid_amount"])
+			total_amount_to_pay = self.doc.base_grand_total - self.doc.write_off_amount
+			self.doc.outstanding_amount = flt(total_amount_to_pay - self.doc.total_advance - self.doc.paid_amount,
+				self.doc.precision("outstanding_amount"))
+		else:
+			self.doc.round_floats_in(self.doc, ["total_advance", "write_off_amount"])
+			self.doc.total_amount_to_pay = flt(self.doc.base_grand_total - self.doc.write_off_amount,
+				self.doc.precision("total_amount_to_pay"))
+			self.doc.outstanding_amount = flt(self.doc.total_amount_to_pay - self.doc.total_advance,
+				self.doc.precision("outstanding_amount"))
diff --git a/erpnext/crm/doctype/opportunity/opportunity.json b/erpnext/crm/doctype/opportunity/opportunity.json
index 751df21..9863d42 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.json
+++ b/erpnext/crm/doctype/opportunity/opportunity.json
@@ -1,436 +1,436 @@
 {
- "allow_import": 1, 
- "autoname": "naming_series:", 
- "creation": "2013-03-07 18:50:30", 
- "description": "Potential Sales Deal", 
- "docstatus": 0, 
- "doctype": "DocType", 
- "document_type": "Transaction", 
+ "allow_import": 1,
+ "autoname": "naming_series:",
+ "creation": "2013-03-07 18:50:30",
+ "description": "Potential Sales Deal",
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "Transaction",
  "fields": [
   {
-   "fieldname": "from_section", 
-   "fieldtype": "Section Break", 
-   "label": "From", 
-   "options": "icon-user", 
+   "fieldname": "from_section",
+   "fieldtype": "Section Break",
+   "label": "From",
+   "options": "icon-user",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "naming_series", 
-   "fieldtype": "Select", 
-   "label": "Series", 
-   "no_copy": 1, 
-   "oldfieldname": "naming_series", 
-   "oldfieldtype": "Select", 
-   "options": "OPTY-", 
-   "permlevel": 0, 
-   "read_only": 0, 
+   "fieldname": "naming_series",
+   "fieldtype": "Select",
+   "label": "Series",
+   "no_copy": 1,
+   "oldfieldname": "naming_series",
+   "oldfieldtype": "Select",
+   "options": "OPTY-",
+   "permlevel": 0,
+   "read_only": 0,
    "reqd": 1
-  }, 
+  },
   {
-   "fieldname": "enquiry_from", 
-   "fieldtype": "Select", 
-   "in_list_view": 0, 
-   "label": "Opportunity From", 
-   "oldfieldname": "enquiry_from", 
-   "oldfieldtype": "Select", 
-   "options": "\nLead\nCustomer", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
+   "fieldname": "enquiry_from",
+   "fieldtype": "Select",
+   "in_list_view": 0,
+   "label": "Opportunity From",
+   "oldfieldname": "enquiry_from",
+   "oldfieldtype": "Select",
+   "options": "\nLead\nCustomer",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
    "reqd": 1
-  }, 
+  },
   {
-   "depends_on": "eval:doc.enquiry_from===\"Customer\"", 
-   "fieldname": "customer", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "in_filter": 1, 
-   "in_list_view": 0, 
-   "label": "Customer", 
-   "no_copy": 1, 
-   "oldfieldname": "customer", 
-   "oldfieldtype": "Link", 
-   "options": "Customer", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "reqd": 0, 
+   "depends_on": "eval:doc.enquiry_from===\"Customer\"",
+   "fieldname": "customer",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "in_filter": 1,
+   "in_list_view": 0,
+   "label": "Customer",
+   "no_copy": 1,
+   "oldfieldname": "customer",
+   "oldfieldtype": "Link",
+   "options": "Customer",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "reqd": 0,
    "search_index": 0
-  }, 
+  },
   {
-   "depends_on": "eval:doc.enquiry_from===\"Lead\"", 
-   "fieldname": "lead", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "in_filter": 1, 
-   "in_list_view": 0, 
-   "label": "Lead", 
-   "oldfieldname": "lead", 
-   "oldfieldtype": "Link", 
-   "options": "Lead", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "depends_on": "eval:doc.enquiry_from===\"Lead\"",
+   "fieldname": "lead",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "in_filter": 1,
+   "in_list_view": 0,
+   "label": "Lead",
+   "oldfieldname": "lead",
+   "oldfieldtype": "Link",
+   "options": "Lead",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "depends_on": "", 
-   "fieldname": "customer_name", 
-   "fieldtype": "Data", 
-   "hidden": 1, 
-   "label": "Customer / Lead Name", 
-   "permlevel": 0, 
-   "print_hide": 0, 
+   "depends_on": "",
+   "fieldname": "customer_name",
+   "fieldtype": "Data",
+   "hidden": 1,
+   "label": "Customer / Lead Name",
+   "permlevel": 0,
+   "print_hide": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "column_break0", 
-   "fieldtype": "Column Break", 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
-   "read_only": 0, 
+   "fieldname": "column_break0",
+   "fieldtype": "Column Break",
+   "oldfieldtype": "Column Break",
+   "permlevel": 0,
+   "read_only": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "fieldname": "enquiry_type", 
-   "fieldtype": "Select", 
-   "label": "Opportunity Type", 
-   "oldfieldname": "enquiry_type", 
-   "oldfieldtype": "Select", 
-   "options": "\nSales\nMaintenance", 
-   "permlevel": 0, 
-   "read_only": 0, 
+   "fieldname": "enquiry_type",
+   "fieldtype": "Select",
+   "label": "Opportunity Type",
+   "oldfieldname": "enquiry_type",
+   "oldfieldtype": "Select",
+   "options": "\nSales\nMaintenance",
+   "permlevel": 0,
+   "read_only": 0,
    "reqd": 1
-  }, 
+  },
   {
-   "default": "Draft", 
-   "fieldname": "status", 
-   "fieldtype": "Select", 
-   "in_list_view": 0, 
-   "label": "Status", 
-   "no_copy": 1, 
-   "oldfieldname": "status", 
-   "oldfieldtype": "Select", 
-   "options": "Draft\nSubmitted\nQuotation\nLost\nCancelled\nReplied\nOpen", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
+   "default": "Draft",
+   "fieldname": "status",
+   "fieldtype": "Select",
+   "in_list_view": 0,
+   "label": "Status",
+   "no_copy": 1,
+   "oldfieldname": "status",
+   "oldfieldtype": "Select",
+   "options": "Draft\nSubmitted\nQuotation\nLost\nCancelled\nReplied\nOpen",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
    "reqd": 1
-  }, 
+  },
   {
-   "fieldname": "items_section", 
-   "fieldtype": "Section Break", 
-   "label": "Items", 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-shopping-cart", 
-   "permlevel": 0, 
+   "fieldname": "items_section",
+   "fieldtype": "Section Break",
+   "label": "Items",
+   "oldfieldtype": "Section Break",
+   "options": "icon-shopping-cart",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "description": "Items which do not exist in Item master can also be entered on customer's request", 
-   "fieldname": "items", 
-   "fieldtype": "Table", 
-   "label": "Items", 
-   "oldfieldname": "enquiry_details", 
-   "oldfieldtype": "Table", 
-   "options": "Opportunity Item", 
-   "permlevel": 0, 
+   "description": "Items which do not exist in Item master can also be entered on customer's request",
+   "fieldname": "items",
+   "fieldtype": "Table",
+   "label": "Items",
+   "oldfieldname": "enquiry_details",
+   "oldfieldtype": "Table",
+   "options": "Opportunity Item",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "fold", 
-   "fieldtype": "Fold", 
+   "fieldname": "fold",
+   "fieldtype": "Fold",
    "permlevel": 0
-  }, 
+  },
   {
-   "depends_on": "eval:doc.lead || doc.customer", 
-   "fieldname": "contact_info", 
-   "fieldtype": "Section Break", 
-   "label": "Contact Info", 
-   "options": "icon-bullhorn", 
-   "permlevel": 0, 
+   "depends_on": "eval:doc.lead || doc.customer",
+   "fieldname": "contact_info",
+   "fieldtype": "Section Break",
+   "label": "Contact Info",
+   "options": "icon-bullhorn",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "depends_on": "eval:doc.customer || doc.lead", 
-   "fieldname": "customer_address", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "label": "Customer / Lead Address", 
-   "options": "Address", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "depends_on": "eval:doc.customer || doc.lead",
+   "fieldname": "customer_address",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "label": "Customer / Lead Address",
+   "options": "Address",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "address_display", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "label": "Address", 
-   "oldfieldname": "address", 
-   "oldfieldtype": "Small Text", 
-   "permlevel": 0, 
+   "fieldname": "address_display",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "label": "Address",
+   "oldfieldname": "address",
+   "oldfieldtype": "Small Text",
+   "permlevel": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "depends_on": "customer", 
-   "description": "", 
-   "fieldname": "territory", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "in_list_view": 1, 
-   "label": "Territory", 
-   "options": "Territory", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "reqd": 0, 
+   "depends_on": "customer",
+   "description": "",
+   "fieldname": "territory",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "in_list_view": 1,
+   "label": "Territory",
+   "options": "Territory",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "reqd": 0,
    "search_index": 1
-  }, 
+  },
   {
-   "depends_on": "customer", 
-   "description": "", 
-   "fieldname": "customer_group", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "in_filter": 1, 
-   "label": "Customer Group", 
-   "oldfieldname": "customer_group", 
-   "oldfieldtype": "Link", 
-   "options": "Customer Group", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "reqd": 0, 
+   "depends_on": "customer",
+   "description": "",
+   "fieldname": "customer_group",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "in_filter": 1,
+   "label": "Customer Group",
+   "oldfieldname": "customer_group",
+   "oldfieldtype": "Link",
+   "options": "Customer Group",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "reqd": 0,
    "search_index": 1
-  }, 
+  },
   {
-   "fieldname": "column_break3", 
-   "fieldtype": "Column Break", 
-   "permlevel": 0, 
+   "fieldname": "column_break3",
+   "fieldtype": "Column Break",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "depends_on": "eval:doc.lead || doc.customer", 
-   "fieldname": "contact_person", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "label": "Contact Person", 
-   "options": "Contact", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "depends_on": "eval:doc.lead || doc.customer",
+   "fieldname": "contact_person",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "label": "Contact Person",
+   "options": "Contact",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "depends_on": "customer", 
-   "fieldname": "contact_display", 
-   "fieldtype": "Small Text", 
-   "label": "Contact", 
-   "permlevel": 0, 
+   "depends_on": "customer",
+   "fieldname": "contact_display",
+   "fieldtype": "Small Text",
+   "label": "Contact",
+   "permlevel": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "depends_on": "eval:doc.lead || doc.customer", 
-   "fieldname": "contact_email", 
-   "fieldtype": "Small Text", 
-   "label": "Contact Email", 
-   "permlevel": 0, 
+   "depends_on": "eval:doc.lead || doc.customer",
+   "fieldname": "contact_email",
+   "fieldtype": "Small Text",
+   "label": "Contact Email",
+   "permlevel": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "depends_on": "eval:doc.lead || doc.customer", 
-   "fieldname": "contact_mobile", 
-   "fieldtype": "Small Text", 
-   "label": "Contact Mobile No", 
-   "permlevel": 0, 
+   "depends_on": "eval:doc.lead || doc.customer",
+   "fieldname": "contact_mobile",
+   "fieldtype": "Small Text",
+   "label": "Contact Mobile No",
+   "permlevel": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "more_info", 
-   "fieldtype": "Section Break", 
-   "label": "More Info", 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-file-text", 
-   "permlevel": 0, 
+   "fieldname": "more_info",
+   "fieldtype": "Section Break",
+   "label": "More Info",
+   "oldfieldtype": "Section Break",
+   "options": "icon-file-text",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "column_break1", 
-   "fieldtype": "Column Break", 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
-   "read_only": 0, 
+   "fieldname": "column_break1",
+   "fieldtype": "Column Break",
+   "oldfieldtype": "Column Break",
+   "permlevel": 0,
+   "read_only": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "default": "Today", 
-   "fieldname": "transaction_date", 
-   "fieldtype": "Date", 
-   "label": "Opportunity Date", 
-   "oldfieldname": "transaction_date", 
-   "oldfieldtype": "Date", 
-   "permlevel": 0, 
-   "read_only": 0, 
-   "reqd": 1, 
+   "default": "Today",
+   "fieldname": "transaction_date",
+   "fieldtype": "Date",
+   "label": "Opportunity Date",
+   "oldfieldname": "transaction_date",
+   "oldfieldtype": "Date",
+   "permlevel": 0,
+   "read_only": 0,
+   "reqd": 1,
    "width": "50px"
-  }, 
+  },
   {
-   "fieldname": "company", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "label": "Company", 
-   "oldfieldname": "company", 
-   "oldfieldtype": "Link", 
-   "options": "Company", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "reqd": 1, 
+   "fieldname": "company",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "label": "Company",
+   "oldfieldname": "company",
+   "oldfieldtype": "Link",
+   "options": "Company",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "reqd": 1,
    "search_index": 1
-  }, 
+  },
   {
-   "fieldname": "source", 
-   "fieldtype": "Select", 
-   "label": "Source", 
-   "oldfieldname": "source", 
-   "oldfieldtype": "Select", 
-   "options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign\nWalk In", 
-   "permlevel": 0, 
+   "fieldname": "source",
+   "fieldtype": "Select",
+   "label": "Source",
+   "oldfieldname": "source",
+   "oldfieldtype": "Select",
+   "options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign\nWalk In",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "description": "Enter name of campaign if source of enquiry is campaign", 
-   "fieldname": "campaign", 
-   "fieldtype": "Link", 
-   "label": "Campaign", 
-   "oldfieldname": "campaign", 
-   "oldfieldtype": "Link", 
-   "options": "Campaign", 
-   "permlevel": 0, 
+   "description": "Enter name of campaign if source of enquiry is campaign",
+   "fieldname": "campaign",
+   "fieldtype": "Link",
+   "label": "Campaign",
+   "oldfieldname": "campaign",
+   "oldfieldtype": "Link",
+   "options": "Campaign",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "fiscal_year", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "label": "Fiscal Year", 
-   "oldfieldname": "fiscal_year", 
-   "oldfieldtype": "Select", 
-   "options": "Fiscal Year", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "reqd": 1, 
+   "fieldname": "fiscal_year",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "label": "Fiscal Year",
+   "oldfieldname": "fiscal_year",
+   "oldfieldtype": "Select",
+   "options": "Fiscal Year",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "reqd": 1,
    "search_index": 1
-  }, 
+  },
   {
-   "depends_on": "eval:!doc.__islocal", 
-   "fieldname": "order_lost_reason", 
-   "fieldtype": "Text", 
-   "label": "Lost Reason", 
-   "no_copy": 1, 
-   "permlevel": 0, 
+   "depends_on": "eval:!doc.__islocal",
+   "fieldname": "order_lost_reason",
+   "fieldtype": "Text",
+   "label": "Lost Reason",
+   "no_copy": 1,
+   "permlevel": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "column_break2", 
-   "fieldtype": "Column Break", 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
-   "read_only": 0, 
+   "fieldname": "column_break2",
+   "fieldtype": "Column Break",
+   "oldfieldtype": "Column Break",
+   "permlevel": 0,
+   "read_only": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "description": "Your sales person who will contact the customer in future", 
-   "fieldname": "contact_by", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "label": "Next Contact By", 
-   "oldfieldname": "contact_by", 
-   "oldfieldtype": "Link", 
-   "options": "User", 
-   "permlevel": 0, 
-   "read_only": 0, 
+   "description": "Your sales person who will contact the customer in future",
+   "fieldname": "contact_by",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "label": "Next Contact By",
+   "oldfieldname": "contact_by",
+   "oldfieldtype": "Link",
+   "options": "User",
+   "permlevel": 0,
+   "read_only": 0,
    "width": "75px"
-  }, 
+  },
   {
-   "description": "Your sales person will get a reminder on this date to contact the customer", 
-   "fieldname": "contact_date", 
-   "fieldtype": "Datetime", 
-   "label": "Next Contact Date", 
-   "oldfieldname": "contact_date", 
-   "oldfieldtype": "Date", 
-   "permlevel": 0, 
+   "description": "Your sales person will get a reminder on this date to contact the customer",
+   "fieldname": "contact_date",
+   "fieldtype": "Datetime",
+   "label": "Next Contact Date",
+   "oldfieldname": "contact_date",
+   "oldfieldtype": "Date",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "to_discuss", 
-   "fieldtype": "Small Text", 
-   "label": "To Discuss", 
-   "no_copy": 1, 
-   "oldfieldname": "to_discuss", 
-   "oldfieldtype": "Small Text", 
-   "permlevel": 0, 
+   "fieldname": "to_discuss",
+   "fieldtype": "Small Text",
+   "label": "To Discuss",
+   "no_copy": 1,
+   "oldfieldname": "to_discuss",
+   "oldfieldtype": "Small Text",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "amended_from", 
-   "fieldtype": "Link", 
-   "ignore_user_permissions": 1, 
-   "label": "Amended From", 
-   "no_copy": 1, 
-   "oldfieldname": "amended_from", 
-   "oldfieldtype": "Data", 
-   "options": "Opportunity", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
+   "fieldname": "amended_from",
+   "fieldtype": "Link",
+   "ignore_user_permissions": 1,
+   "label": "Amended From",
+   "no_copy": 1,
+   "oldfieldname": "amended_from",
+   "oldfieldtype": "Data",
+   "options": "Opportunity",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
    "width": "150px"
   }
- ], 
- "icon": "icon-info-sign", 
- "idx": 1, 
- "is_submittable": 1, 
- "modified": "2015-02-16 23:52:23.489259", 
- "modified_by": "Administrator", 
- "module": "CRM", 
- "name": "Opportunity", 
- "owner": "Administrator", 
+ ],
+ "icon": "icon-info-sign",
+ "idx": 1,
+ "is_submittable": 1,
+ "modified": "2015-02-16 23:52:23.489259",
+ "modified_by": "Administrator",
+ "module": "CRM",
+ "name": "Opportunity",
+ "owner": "Administrator",
  "permissions": [
   {
-   "amend": 1, 
-   "apply_user_permissions": 1, 
-   "cancel": 1, 
-   "create": 1, 
-   "delete": 1, 
-   "email": 1, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Sales User", 
-   "share": 1, 
-   "submit": 1, 
+   "amend": 1,
+   "apply_user_permissions": 1,
+   "cancel": 1,
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Sales User",
+   "share": 1,
+   "submit": 1,
    "write": 1
-  }, 
+  },
   {
-   "amend": 1, 
-   "cancel": 1, 
-   "create": 1, 
-   "delete": 1, 
-   "email": 1, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Sales Manager", 
-   "share": 1, 
-   "submit": 1, 
+   "amend": 1,
+   "cancel": 1,
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Sales Manager",
+   "share": 1,
+   "submit": 1,
    "write": 1
   }
- ], 
- "search_fields": "status,transaction_date,customer,lead,enquiry_type,territory,company", 
- "sort_field": "modified", 
- "sort_order": "DESC", 
+ ],
+ "search_fields": "status,transaction_date,customer,lead,enquiry_type,territory,company",
+ "sort_field": "modified",
+ "sort_order": "DESC",
  "title_field": "customer_name"
-}
\ No newline at end of file
+}
diff --git a/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.json b/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.json
index 2b6c393..39634fe 100644
--- a/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.json
+++ b/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.json
@@ -1,6 +1,6 @@
 {
  "autoname": "PP/.SO/.#####", 
- "creation": "2013-02-22 01:27:49.000000", 
+ "creation": "2013-02-22 01:27:49", 
  "docstatus": 0, 
  "doctype": "DocType", 
  "fields": [
@@ -29,6 +29,12 @@
    "width": "120px"
   }, 
   {
+   "fieldname": "col_break1", 
+   "fieldtype": "Column Break", 
+   "permlevel": 0, 
+   "precision": ""
+  }, 
+  {
    "fieldname": "customer", 
    "fieldtype": "Link", 
    "in_list_view": 1, 
@@ -53,9 +59,10 @@
  ], 
  "idx": 1, 
  "istable": 1, 
- "modified": "2013-12-20 19:23:25.000000", 
+ "modified": "2015-02-17 14:29:14.479541", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "Production Plan Sales Order", 
- "owner": "Administrator"
+ "owner": "Administrator", 
+ "permissions": []
 }
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
index 47b3ccb..6eddb3f 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
@@ -16,12 +16,12 @@
 
 	def get_so_details(self, so):
 		"""Pull other details from so"""
-		so = frappe.db.sql("""select transaction_date, customer, grand_total
+		so = frappe.db.sql("""select transaction_date, customer, base_grand_total
 			from `tabSales Order` where name = %s""", so, as_dict = 1)
 		ret = {
 			'sales_order_date': so and so[0]['transaction_date'] or '',
 			'customer' : so[0]['customer'] or '',
-			'grand_total': so[0]['grand_total']
+			'grand_total': so[0]['base_grand_total']
 		}
 		return ret
 
@@ -61,7 +61,7 @@
 			item_filter += ' and item.name = "' + self.fg_item + '"'
 
 		open_so = frappe.db.sql("""
-			select distinct so.name, so.transaction_date, so.customer, so.grand_total
+			select distinct so.name, so.transaction_date, so.customer, so.base_grand_total
 			from `tabSales Order` so, `tabSales Order Item` so_item
 			where so_item.parent = so.name
 				and so.docstatus = 1 and so.status != "Stopped"
@@ -90,7 +90,7 @@
 				pp_so.sales_order = r['name']
 				pp_so.sales_order_date = cstr(r['transaction_date'])
 				pp_so.customer = cstr(r['customer'])
-				pp_so.grand_total = flt(r['grand_total'])
+				pp_so.grand_total = flt(r['base_grand_total'])
 
 	def get_items_from_so(self):
 		""" Pull items from Sales Order, only proction item
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 85f5bda..6ea16db 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -97,6 +97,8 @@
 execute:frappe.rename_doc("DocType", "Support Ticket", "Issue", force=True)
 erpnext.patches.v5_0.set_default_company_in_bom
 erpnext.patches.v5_0.capacity_planning
+execute:frappe.reload_doc('crm', 'doctype', 'lead')
+execute:frappe.reload_doc('crm', 'doctype', 'opportunity')
 erpnext.patches.v5_0.rename_table_fieldnames
 execute:frappe.db.sql("update `tabJournal Entry` set voucher_type='Journal Entry' where ifnull(voucher_type, '')=''")
 erpnext.patches.v4_2.party_model
@@ -108,6 +110,9 @@
 erpnext.patches.v5_0.update_companywise_payment_account
 erpnext.patches.v5_0.remove_birthday_events
 erpnext.patches.v5_0.update_item_name_in_bom
+erpnext.patches.v5_0.rename_customer_issue
+erpnext.patches.v5_0.rename_total_fields
+erpnext.patches.v5_0.replace_renamed_fields_in_custom_script_and_print_formats
 erpnext.patches.v5_0.new_crm_module
 erpnext.patches.v5_0.rename_customer_issue
 erpnext.patches.v5_0.update_material_transfer_for_manufacture
diff --git a/erpnext/patches/v5_0/rename_customer_issue.py b/erpnext/patches/v5_0/rename_customer_issue.py
index c3c38a7..68bab3f 100644
--- a/erpnext/patches/v5_0/rename_customer_issue.py
+++ b/erpnext/patches/v5_0/rename_customer_issue.py
@@ -2,4 +2,4 @@
 
 def execute():
 	if frappe.db.table_exists("tabCustomer Issue"):
-		frappe.rename_doc("DocType", "Customer Issue", "Warrany Claim")
+		frappe.rename_doc("DocType", "Customer Issue", "Warranty Claim")
diff --git a/erpnext/patches/v5_0/rename_table_fieldnames.py b/erpnext/patches/v5_0/rename_table_fieldnames.py
index eed4c1c..5514a00 100644
--- a/erpnext/patches/v5_0/rename_table_fieldnames.py
+++ b/erpnext/patches/v5_0/rename_table_fieldnames.py
@@ -105,7 +105,6 @@
 		["experience_in_company_details", "internal_work_history"]
 	],
 	"Event": [
-		["event_individuals", "users"],
 		["event_roles", "roles"]
 	],
 	"Expense Claim": [
diff --git a/erpnext/patches/v5_0/rename_total_fields.py b/erpnext/patches/v5_0/rename_total_fields.py
new file mode 100644
index 0000000..d9465fa
--- /dev/null
+++ b/erpnext/patches/v5_0/rename_total_fields.py
@@ -0,0 +1,51 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model import rename_field
+from frappe.modules import scrub, get_doctype_module
+
+selling_doctypes = ("Quotation", "Sales Order", "Delivery Note", "Sales Invoice")
+
+buying_doctypes = ("Supplier Quotation", "Purchase Order", "Purchase Receipt", "Purchase Invoice")
+
+selling_renamed_fields = (
+	("net_total", "base_net_total"),
+	("net_total_export", "net_total"),
+	("other_charges_total", "base_total_taxes_and_charges"),
+	("other_charges_total_export", "total_taxes_and_charges"),
+	("grand_total", "base_grand_total"),
+	("grand_total_export", "grand_total"),
+	("rounded_total", "base_rounded_total"),
+	("rounded_total_export", "rounded_total"),
+	("in_words", "base_in_words"),
+	("in_words_export", "in_words")
+)
+
+buying_renamed_fields = (
+	("net_total", "base_net_total"),
+	("net_total_import", "net_total"),
+	("grand_total", "base_grand_total"),
+	("grand_total_import", "grand_total"),
+	("rounded_total", "base_rounded_total"),
+	("rounded_total_import", "rounded_total"),
+	("in_words", "base_in_words"),
+	("in_words_import", "in_words"),
+	("other_charges_added", "base_taxes_and_charges_added"),
+	("other_charges_added_import", "taxes_and_charges_added"),
+	("other_charges_deducted", "base_taxes_and_charges_deducted"),
+	("other_charges_deducted_import", "taxes_and_charges_deducted"),
+	("total_tax", "base_total_taxes_and_charges")
+)
+
+def execute():
+	for dt in selling_doctypes:
+		frappe.reload_doc(get_doctype_module(dt), "doctype", scrub(dt))
+
+		for f in selling_renamed_fields:
+			rename_field(dt, f[0], f[1])
+
+		# Added new field "total_taxes_and_charges" in buying cycle, updating value
+		frappe.db.sql("""update `tab{0}`
+			set total_taxes_and_charges = round(base_total_taxes_and_charges/conversion_rate, 2)""".format(dt))
diff --git a/erpnext/patches/v5_0/replace_renamed_fields_in_custom_script_and_print_formats.py b/erpnext/patches/v5_0/replace_renamed_fields_in_custom_script_and_print_formats.py
new file mode 100644
index 0000000..f8775c1
--- /dev/null
+++ b/erpnext/patches/v5_0/replace_renamed_fields_in_custom_script_and_print_formats.py
@@ -0,0 +1,54 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+import re
+
+def execute():
+	# NOTE: sequence is important
+	renamed_fields = get_all_renamed_fields()
+
+	for dt, script_field in (("Custom Script", "script"), ("Print Format", "html")):
+
+		cond1 = " or ".join("""{0} like "%%{1}%%" """.format(script_field, d[0].replace("_", "\\_")) for d in renamed_fields)
+		cond2 = " and standard = 'No'" if dt == "Print Format" else ""
+
+		for name, script in frappe.db.sql("select name, {0} as script from `tab{1}` where ({2}) {3}".format(script_field, dt, cond1, cond2)):
+			update_script(dt, name, script_field, script, renamed_fields)
+
+def get_all_renamed_fields():
+	from erpnext.patches.v5_0.rename_table_fieldnames import rename_map
+
+	renamed_fields = (
+		("net_total", "base_net_total"),
+		("net_total_export", "net_total"),
+		("net_total_import", "net_total"),
+		("other_charges_total", "base_total_taxes_and_charges"),
+		("other_charges_total_export", "total_taxes_and_charges"),
+		("other_charges_added", "base_taxes_and_charges_added"),
+		("other_charges_added_import", "taxes_and_charges_added"),
+		("other_charges_deducted", "base_taxes_and_charges_deducted"),
+		("other_charges_deducted_import", "taxes_and_charges_deducted"),
+		("total_tax", "base_total_taxes_and_charges"),
+		("grand_total", "base_grand_total"),
+		("grand_total_export", "grand_total"),
+		("grand_total_import", "grand_total"),
+		("rounded_total", "base_rounded_total"),
+		("rounded_total_export", "rounded_total"),
+		("rounded_total_import", "rounded_total"),
+		("in_words", "base_in_words"),
+		("in_words_export", "in_words"),
+		("in_words_import", "in_words")
+	)
+
+	for fields in rename_map.values():
+		renamed_fields += tuple(fields)
+
+	return renamed_fields
+
+def update_script(dt, name, script_field, script, renamed_fields):
+	for from_field, to_field in renamed_fields:
+		script = re.sub(r"\b{}\b".format(from_field), to_field, script)
+
+	frappe.db.set_value(dt, name, script_field, script)
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
new file mode 100644
index 0000000..663f6ab
--- /dev/null
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -0,0 +1,424 @@
+// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+// License: GNU General Public License v3. See license.txt
+
+frappe.provide("erpnext");
+frappe.require("assets/erpnext/js/controllers/stock_controller.js");
+
+erpnext.taxes_and_totals = erpnext.stock.StockController.extend({
+	calculate_taxes_and_totals: function(update_paid_amount) {
+		this.discount_amount_applied = false;
+		this._calculate_taxes_and_totals();
+
+		if (frappe.meta.get_docfield(this.frm.doc.doctype, "discount_amount"))
+			this.apply_discount_amount();
+
+		// Advance calculation applicable to Sales /Purchase Invoice
+		if(in_list(["Sales Invoice", "Purchase Invoice"], this.frm.doc.doctype) && this.frm.doc.docstatus < 2) {
+			this.calculate_total_advance(update_paid_amount);
+		}
+
+		// Sales person's commission
+		if(in_list(["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"], this.frm.doc.doctype)) {
+			this.calculate_commission();
+			this.calculate_contribution();
+		}
+
+		this.frm.refresh_fields();
+	},
+
+	_calculate_taxes_and_totals: function() {
+		this.validate_conversion_rate();
+		this.calculate_item_values();
+		this.initialize_taxes();
+		this.determine_exclusive_rate();
+		this.calculate_net_total();
+		this.calculate_taxes();
+		this.calculate_totals();
+		this._cleanup();
+		this.show_item_wise_taxes();
+	},
+
+	calculate_item_values: function() {
+		var me = this;
+
+		if (!this.discount_amount_applied) {
+			$.each(this.frm.doc["items"] || [], function(i, item) {
+				frappe.model.round_floats_in(item);
+				item.amount = flt(item.rate * item.qty, precision("amount", item));
+				item.item_tax_amount = 0.0;
+
+				$.each(["price_list_rate", "rate", "amount"], function(i, f) {
+					item["base_" + f] = flt(item[f] * me.frm.doc.conversion_rate, precision("base_" + f, item));
+				})
+			});
+		}
+	},
+
+	initialize_taxes: function() {
+		var me = this;
+
+		$.each(this.frm.doc["taxes"] || [], function(i, tax) {
+			tax.item_wise_tax_detail = {};
+			tax_fields = ["total", "tax_amount_after_discount_amount",
+				"tax_amount_for_current_item", "grand_total_for_current_item",
+				"tax_fraction_for_current_item", "grand_total_fraction_for_current_item"]
+
+			if (!me.discount_amount_applied)
+				tax_fields.push("tax_amount");
+
+			$.each(tax_fields, function(i, fieldname) { tax[fieldname] = 0.0 });
+
+			me.validate_on_previous_row(tax);
+			me.validate_inclusive_tax(tax);
+			frappe.model.round_floats_in(tax);
+		});
+	},
+
+	determine_exclusive_rate: function() {
+		if(!in_list(["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"], this.frm.doc.doctype)) return;
+
+		var me = this;
+		$.each(me.frm.doc["items"] || [], function(n, item) {
+			var item_tax_map = me._load_item_tax_rate(item.item_tax_rate);
+			var cumulated_tax_fraction = 0.0;
+
+			$.each(me.frm.doc["taxes"] || [], function(i, tax) {
+				tax.tax_fraction_for_current_item = me.get_current_tax_fraction(tax, item_tax_map);
+
+				if(i==0) {
+					tax.grand_total_fraction_for_current_item = 1 + tax.tax_fraction_for_current_item;
+				} else {
+					tax.grand_total_fraction_for_current_item =
+						me.frm.doc["taxes"][i-1].grand_total_fraction_for_current_item +
+						tax.tax_fraction_for_current_item;
+				}
+
+				cumulated_tax_fraction += tax.tax_fraction_for_current_item;
+			});
+
+			if(cumulated_tax_fraction && !me.discount_amount_applied) {
+				item.base_amount = flt(
+					(item.amount * me.frm.doc.conversion_rate) / (1 + cumulated_tax_fraction),
+					precision("base_amount", item));
+
+				item.base_rate = flt(item.base_amount / item.qty, precision("base_rate", item));
+
+				if(item.discount_percentage == 100) {
+					item.base_price_list_rate = item.base_rate;
+					item.base_rate = 0.0;
+				} else {
+					item.base_price_list_rate = flt(item.base_rate / (1 - item.discount_percentage / 100.0),
+						precision("base_price_list_rate", item));
+				}
+			}
+		});
+	},
+
+	get_current_tax_fraction: function(tax, item_tax_map) {
+		// Get tax fraction for calculating tax exclusive amount
+		// from tax inclusive amount
+		var current_tax_fraction = 0.0;
+
+		if(cint(tax.included_in_print_rate)) {
+			var tax_rate = this._get_tax_rate(tax, item_tax_map);
+
+			if(tax.charge_type == "On Net Total") {
+				current_tax_fraction = (tax_rate / 100.0);
+
+			} else if(tax.charge_type == "On Previous Row Amount") {
+				current_tax_fraction = (tax_rate / 100.0) *
+					this.frm.doc["taxes"][cint(tax.row_id) - 1].tax_fraction_for_current_item;
+
+			} else if(tax.charge_type == "On Previous Row Total") {
+				current_tax_fraction = (tax_rate / 100.0) *
+					this.frm.doc["taxes"][cint(tax.row_id) - 1].grand_total_fraction_for_current_item;
+			}
+		}
+
+		return current_tax_fraction;
+	},
+
+	_get_tax_rate: function(tax, item_tax_map) {
+		return (keys(item_tax_map).indexOf(tax.account_head) != -1) ?
+			flt(item_tax_map[tax.account_head], precision("rate", tax)) :
+			tax.rate;
+	},
+
+	calculate_net_total: function() {
+		var me = this;
+		this.frm.doc.base_net_total = this.frm.doc.net_total = 0.0;
+
+		$.each(this.frm.doc["items"] || [], function(i, item) {
+			me.frm.doc.base_net_total += item.base_amount;
+			me.frm.doc.net_total += item.amount;
+		});
+
+		frappe.model.round_floats_in(this.frm.doc, ["base_net_total", "net_total"]);
+	},
+
+	calculate_taxes: function() {
+		var me = this;
+		var actual_tax_dict = {};
+
+		// maintain actual tax rate based on idx
+		$.each(this.frm.doc["taxes"] || [], function(i, tax) {
+			if (tax.charge_type == "Actual") {
+				actual_tax_dict[tax.idx] = flt(tax.rate, precision("tax_amount", tax));
+			}
+		});
+
+		$.each(this.frm.doc["items"] || [], function(n, item) {
+			var item_tax_map = me._load_item_tax_rate(item.item_tax_rate);
+
+			$.each(me.frm.doc["taxes"] || [], function(i, tax) {
+				// tax_amount represents the amount of tax for the current step
+				var current_tax_amount = me.get_current_tax_amount(item, tax, item_tax_map);
+
+				// Adjust divisional loss to the last item
+				if (tax.charge_type == "Actual") {
+					actual_tax_dict[tax.idx] -= current_tax_amount;
+					if (n == me.frm.doc["items"].length - 1) {
+						current_tax_amount += actual_tax_dict[tax.idx]
+					}
+				}
+
+				// store tax_amount for current item as it will be used for
+				// charge type = 'On Previous Row Amount'
+				tax.tax_amount_for_current_item = current_tax_amount;
+
+				// accumulate tax amount into tax.tax_amount
+				if (!me.discount_amount_applied)
+					tax.tax_amount += current_tax_amount;
+
+				tax.tax_amount_after_discount_amount += current_tax_amount;
+
+				// for buying
+				if(tax.category) {
+					// if just for valuation, do not add the tax amount in total
+					// hence, setting it as 0 for further steps
+					current_tax_amount = (tax.category == "Valuation") ? 0.0 : current_tax_amount;
+
+					current_tax_amount *= (tax.add_deduct_tax == "Deduct") ? -1.0 : 1.0;
+				}
+
+				// Calculate tax.total viz. grand total till that step
+				// note: grand_total_for_current_item contains the contribution of
+				// item's amount, previously applied tax and the current tax on that item
+				if(i==0) {
+					tax.grand_total_for_current_item = flt(item.base_amount + current_tax_amount,
+						precision("total", tax));
+				} else {
+					tax.grand_total_for_current_item =
+						flt(me.frm.doc["taxes"][i-1].grand_total_for_current_item + current_tax_amount,
+							precision("total", tax));
+				}
+
+				// in tax.total, accumulate grand total for each item
+				tax.total += tax.grand_total_for_current_item;
+
+				// set precision in the last item iteration
+				if (n == me.frm.doc["items"].length - 1) {
+					me.round_off_totals(tax);
+
+					// adjust Discount Amount loss in last tax iteration
+					if ((i == me.frm.doc["taxes"].length - 1) && me.discount_amount_applied)
+						me.adjust_discount_amount_loss(tax);
+				}
+			});
+		});
+	},
+
+	_load_item_tax_rate: function(item_tax_rate) {
+		return item_tax_rate ? JSON.parse(item_tax_rate) : {};
+	},
+
+	get_current_tax_amount: function(item, tax, item_tax_map) {
+		var tax_rate = this._get_tax_rate(tax, item_tax_map);
+		var current_tax_amount = 0.0;
+
+		if(tax.charge_type == "Actual") {
+			// distribute the tax amount proportionally to each item row
+			var actual = flt(tax.rate, precision("tax_amount", tax));
+			current_tax_amount = this.frm.doc.base_net_total ?
+			((item.base_amount / this.frm.doc.base_net_total) * actual) : 0.0;
+
+		} else if(tax.charge_type == "On Net Total") {
+			current_tax_amount = (tax_rate / 100.0) * item.base_amount;
+
+		} else if(tax.charge_type == "On Previous Row Amount") {
+			current_tax_amount = (tax_rate / 100.0) *
+				this.frm.doc["taxes"][cint(tax.row_id) - 1].tax_amount_for_current_item;
+
+		} else if(tax.charge_type == "On Previous Row Total") {
+			current_tax_amount = (tax_rate / 100.0) *
+				this.frm.doc["taxes"][cint(tax.row_id) - 1].grand_total_for_current_item;
+		}
+
+		current_tax_amount = flt(current_tax_amount, precision("tax_amount", tax));
+
+		// store tax breakup for each item
+		tax.item_wise_tax_detail[item.item_code || item.item_name] = [tax_rate, current_tax_amount];
+
+		return current_tax_amount;
+	},
+
+	round_off_totals: function(tax) {
+		tax.total = flt(tax.total, precision("total", tax));
+		tax.tax_amount = flt(tax.tax_amount, precision("tax_amount", tax));
+		tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount,
+			precision("tax_amount", tax));
+	},
+
+	adjust_discount_amount_loss: function(tax) {
+		var discount_amount_loss = this.frm.doc.base_grand_total - flt(this.frm.doc.base_discount_amount) - tax.total;
+		tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount +
+			discount_amount_loss, precision("tax_amount", tax));
+		tax.total = flt(tax.total + discount_amount_loss, precision("total", tax));
+	},
+
+
+	_cleanup: function() {
+		this.frm.doc.base_in_words = this.frm.doc.in_words = this.frm.doc.in_words = "";
+
+		if(this.frm.doc["items"] && this.frm.doc["items"].length) {
+			if(!frappe.meta.get_docfield(this.frm.doc["items"][0].doctype, "item_tax_amount", this.frm.doctype)) {
+				$.each(this.frm.doc["items"] || [], function(i, item) {
+					delete item["item_tax_amount"];
+				});
+			}
+		}
+
+
+		if(this.frm.doc["taxes"] && this.frm.doc["taxes"].length) {
+			var temporary_fields = ["tax_amount_for_current_item", "grand_total_for_current_item",
+				"tax_fraction_for_current_item", "grand_total_fraction_for_current_item"]
+
+			if(!frappe.meta.get_docfield(this.frm.doc["taxes"][0].doctype, "tax_amount_after_discount_amount", this.frm.doctype)) {
+				temporary_fields.push("tax_amount_after_discount_amount");
+			}
+
+			$.each(this.frm.doc["taxes"] || [], function(i, tax) {
+				$.each(temporary_fields, function(i, fieldname) {
+					delete tax[fieldname];
+				});
+
+				tax.item_wise_tax_detail = JSON.stringify(tax.item_wise_tax_detail);
+			});
+		}
+	},
+
+	calculate_totals: function() {
+		// Changing sequence can cause roundiing issue and on-screen discrepency
+
+		var tax_count = this.frm.doc["taxes"] ? this.frm.doc["taxes"].length : 0;
+		this.frm.doc.base_grand_total = flt(tax_count ? this.frm.doc["taxes"][tax_count - 1].total : this.frm.doc.base_net_total);
+
+		this.frm.doc.base_total_taxes_and_charges = flt(this.frm.doc.base_grand_total - this.frm.doc.base_net_total,
+			precision("base_total_taxes_and_charges"));
+
+		if(in_list(["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"], this.frm.doc.doctype)) {
+			this.frm.doc.grand_total = (this.frm.doc.base_total_taxes_and_charges || this.frm.doc.discount_amount) ?
+				flt(this.frm.doc.base_grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total;
+
+			this.frm.doc.total_taxes_and_charges = flt(this.frm.doc.grand_total - this.frm.doc.net_total
+				+ flt(this.frm.doc.discount_amount), precision("total_taxes_and_charges"));
+		} else {
+			// other charges added/deducted
+			this.frm.doc.base_taxes_and_charges_added = 0.0
+			this.frm.doc.base_taxes_and_charges_deducted = 0.0
+			if(tax_count) {
+				this.frm.doc.base_taxes_and_charges_added = frappe.utils.sum($.map(this.frm.doc["taxes"],
+					function(tax) { return (tax.add_deduct_tax == "Add"
+						&& in_list(["Valuation and Total", "Total"], tax.category)) ?
+						tax.tax_amount : 0.0; }));
+
+				this.frm.doc.base_taxes_and_charges_deducted = frappe.utils.sum($.map(this.frm.doc["taxes"],
+					function(tax) { return (tax.add_deduct_tax == "Deduct"
+						&& in_list(["Valuation and Total", "Total"], tax.category)) ?
+						tax.tax_amount : 0.0; }));
+
+				frappe.model.round_floats_in(this.frm.doc,
+					["base_taxes_and_charges_added", "base_taxes_and_charges_deducted"]);
+			}
+
+			this.frm.doc.grand_total = flt((this.frm.doc.base_taxes_and_charges_added || this.frm.doc.base_taxes_and_charges_deducted) ?
+				flt(this.frm.doc.base_grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total);
+
+			this.frm.doc.total_taxes_and_charges = flt(this.frm.doc.grand_total - this.frm.doc.net_total,
+				precision("total_taxes_and_charges"));
+
+			this.frm.doc.taxes_and_charges_added = flt(this.frm.doc.base_taxes_and_charges_added /
+				this.frm.doc.conversion_rate, precision("taxes_and_charges_added"));
+			this.frm.doc.taxes_and_charges_deducted = flt(this.frm.doc.base_taxes_and_charges_deducted /
+				this.frm.doc.conversion_rate, precision("taxes_and_charges_deducted"));
+		}
+
+		// Round grand total as per precision
+		this.frm.doc.base_grand_total = flt(this.frm.doc.base_grand_total, precision("base_grand_total"));
+		this.frm.doc.grand_total = flt(this.frm.doc.grand_total, precision("grand_total"));
+
+		// rounded totals
+		if(frappe.meta.get_docfield(this.frm.doc.doctype, "base_rounded_total", this.frm.doc.name)) {
+			this.frm.doc.base_rounded_total = Math.round(this.frm.doc.base_grand_total);
+		}
+		if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total", this.frm.doc.name)) {
+			this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total);
+		}
+	},
+
+	apply_discount_amount: function() {
+		var me = this;
+		var distributed_amount = 0.0;
+
+		if (this.frm.doc.discount_amount) {
+			this.frm.set_value("base_discount_amount",
+				flt(this.frm.doc.discount_amount * this.frm.doc.conversion_rate, precision("base_discount_amount")))
+
+			var grand_total_for_discount_amount = this.get_grand_total_for_discount_amount();
+			// calculate item amount after Discount Amount
+			if (grand_total_for_discount_amount) {
+				$.each(this.frm.doc["items"] || [], function(i, item) {
+					distributed_amount = flt(me.frm.doc.base_discount_amount) * item.base_amount / grand_total_for_discount_amount;
+					item.base_amount = flt(item.base_amount - distributed_amount, precision("base_amount", item));
+				});
+
+				this.discount_amount_applied = true;
+				this._calculate_taxes_and_totals();
+			}
+		} else {
+			this.frm.set_value("base_discount_amount", 0);
+		}
+	},
+
+	get_grand_total_for_discount_amount: function() {
+		var me = this;
+		var total_actual_tax = 0.0;
+		var actual_taxes_dict = {};
+
+		$.each(this.frm.doc["taxes"] || [], function(i, tax) {
+			if (tax.charge_type == "Actual")
+				actual_taxes_dict[tax.idx] = tax.tax_amount;
+			else if (actual_taxes_dict[tax.row_id] !== null) {
+				actual_tax_amount = flt(actual_taxes_dict[tax.row_id]) * flt(tax.rate) / 100;
+				actual_taxes_dict[tax.idx] = actual_tax_amount;
+			}
+		});
+
+		$.each(actual_taxes_dict, function(key, value) {
+			if (value)
+				total_actual_tax += value;
+		});
+
+		grand_total_for_discount_amount = flt(this.frm.doc.base_grand_total - total_actual_tax,
+			precision("base_grand_total"));
+		return grand_total_for_discount_amount;
+	},
+
+	calculate_total_advance: function(update_paid_amount) {
+		this.frm.doc.total_advance = flt(frappe.utils.sum(
+			$.map(this.frm.doc["advances"] || [], function(adv) { return adv.allocated_amount })
+		), precision("total_advance"));
+
+		this.calculate_outstanding_amount(update_paid_amount);
+	}
+})
diff --git a/erpnext/public/js/transaction.js b/erpnext/public/js/controllers/transaction.js
similarity index 73%
rename from erpnext/public/js/transaction.js
rename to erpnext/public/js/controllers/transaction.js
index 897fea4..c8b028b 100644
--- a/erpnext/public/js/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -2,15 +2,12 @@
 // License: GNU General Public License v3. See license.txt
 
 frappe.provide("erpnext");
-frappe.require("assets/erpnext/js/controllers/stock_controller.js");
+frappe.require("assets/erpnext/js/controllers/taxes_and_totals.js");
 frappe.require("assets/erpnext/js/utils.js");
 
-
-erpnext.TransactionController = erpnext.stock.StockController.extend({
+erpnext.TransactionController = erpnext.taxes_and_totals.extend({
 	onload: function() {
 		var me = this;
-		this._super();
-
 		if(this.frm.doc.__islocal) {
 			var today = get_today(),
 				currency = frappe.defaults.get_user_default("currency");
@@ -471,16 +468,6 @@
 		}
 	},
 
-	_load_item_tax_rate: function(item_tax_rate) {
-		return item_tax_rate ? JSON.parse(item_tax_rate) : {};
-	},
-
-	_get_tax_rate: function(tax, item_tax_map) {
-		return (keys(item_tax_map).indexOf(tax.account_head) != -1) ?
-			flt(item_tax_map[tax.account_head], precision("rate", tax)) :
-			tax.rate;
-	},
-
 	get_item_wise_taxes_html: function() {
 		var item_tax = {};
 		var tax_accounts = [];
@@ -578,188 +565,6 @@
 		}
 	},
 
-	calculate_taxes_and_totals: function() {
-		this.discount_amount_applied = false;
-		this._calculate_taxes_and_totals();
-		if (frappe.meta.get_docfield(this.frm.doc.doctype, "discount_amount"))
-			this.apply_discount_amount();
-	},
-
-	_calculate_taxes_and_totals: function() {
-		this.validate_conversion_rate();
-		this.calculate_item_values();
-		this.initialize_taxes();
-		this.determine_exclusive_rate && this.determine_exclusive_rate();
-		this.calculate_net_total();
-		this.calculate_taxes();
-		this.calculate_totals();
-		this._cleanup();
-		this.show_item_wise_taxes();
-	},
-
-	initialize_taxes: function() {
-		var me = this;
-
-		$.each(this.frm.doc["taxes"] || [], function(i, tax) {
-			tax.item_wise_tax_detail = {};
-			tax_fields = ["total", "tax_amount_after_discount_amount",
-				"tax_amount_for_current_item", "grand_total_for_current_item",
-				"tax_fraction_for_current_item", "grand_total_fraction_for_current_item"]
-
-			if (!me.discount_amount_applied)
-				tax_fields.push("tax_amount");
-
-			$.each(tax_fields, function(i, fieldname) { tax[fieldname] = 0.0 });
-
-			me.validate_on_previous_row(tax);
-			me.validate_inclusive_tax(tax);
-			frappe.model.round_floats_in(tax);
-		});
-	},
-
-	calculate_taxes: function() {
-		var me = this;
-		var actual_tax_dict = {};
-
-		// maintain actual tax rate based on idx
-		$.each(this.frm.doc["taxes"] || [], function(i, tax) {
-			if (tax.charge_type == "Actual") {
-				actual_tax_dict[tax.idx] = flt(tax.rate, precision("tax_amount", tax));
-			}
-		});
-
-		$.each(this.frm.doc["items"] || [], function(n, item) {
-			var item_tax_map = me._load_item_tax_rate(item.item_tax_rate);
-
-			$.each(me.frm.doc["taxes"] || [], function(i, tax) {
-				// tax_amount represents the amount of tax for the current step
-				var current_tax_amount = me.get_current_tax_amount(item, tax, item_tax_map);
-
-				// Adjust divisional loss to the last item
-				if (tax.charge_type == "Actual") {
-					actual_tax_dict[tax.idx] -= current_tax_amount;
-					if (n == me.frm.doc["items"].length - 1) {
-						current_tax_amount += actual_tax_dict[tax.idx]
-					}
-				}
-
-				// store tax_amount for current item as it will be used for
-				// charge type = 'On Previous Row Amount'
-				tax.tax_amount_for_current_item = current_tax_amount;
-
-				// accumulate tax amount into tax.tax_amount
-				if (!me.discount_amount_applied)
-					tax.tax_amount += current_tax_amount;
-
-				tax.tax_amount_after_discount_amount += current_tax_amount;
-
-				// for buying
-				if(tax.category) {
-					// if just for valuation, do not add the tax amount in total
-					// hence, setting it as 0 for further steps
-					current_tax_amount = (tax.category == "Valuation") ? 0.0 : current_tax_amount;
-
-					current_tax_amount *= (tax.add_deduct_tax == "Deduct") ? -1.0 : 1.0;
-				}
-
-				// Calculate tax.total viz. grand total till that step
-				// note: grand_total_for_current_item contains the contribution of
-				// item's amount, previously applied tax and the current tax on that item
-				if(i==0) {
-					tax.grand_total_for_current_item = flt(item.base_amount + current_tax_amount,
-						precision("total", tax));
-				} else {
-					tax.grand_total_for_current_item =
-						flt(me.frm.doc["taxes"][i-1].grand_total_for_current_item + current_tax_amount,
-							precision("total", tax));
-				}
-
-				// in tax.total, accumulate grand total for each item
-				tax.total += tax.grand_total_for_current_item;
-
-				// set precision in the last item iteration
-				if (n == me.frm.doc["items"].length - 1) {
-					me.round_off_totals(tax);
-
-					// adjust Discount Amount loss in last tax iteration
-					if ((i == me.frm.doc["taxes"].length - 1) && me.discount_amount_applied)
-						me.adjust_discount_amount_loss(tax);
-				}
-			});
-		});
-	},
-
-	round_off_totals: function(tax) {
-		tax.total = flt(tax.total, precision("total", tax));
-		tax.tax_amount = flt(tax.tax_amount, precision("tax_amount", tax));
-		tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount,
-			precision("tax_amount", tax));
-	},
-
-	adjust_discount_amount_loss: function(tax) {
-		var discount_amount_loss = this.frm.doc.grand_total - flt(this.frm.doc.base_discount_amount) - tax.total;
-		tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount +
-			discount_amount_loss, precision("tax_amount", tax));
-		tax.total = flt(tax.total + discount_amount_loss, precision("total", tax));
-	},
-
-	get_current_tax_amount: function(item, tax, item_tax_map) {
-		var tax_rate = this._get_tax_rate(tax, item_tax_map);
-		var current_tax_amount = 0.0;
-
-		if(tax.charge_type == "Actual") {
-			// distribute the tax amount proportionally to each item row
-			var actual = flt(tax.rate, precision("tax_amount", tax));
-			current_tax_amount = this.frm.doc.net_total ?
-			((item.base_amount / this.frm.doc.net_total) * actual) : 0.0;
-
-		} else if(tax.charge_type == "On Net Total") {
-			current_tax_amount = (tax_rate / 100.0) * item.base_amount;
-
-		} else if(tax.charge_type == "On Previous Row Amount") {
-			current_tax_amount = (tax_rate / 100.0) *
-				this.frm.doc["taxes"][cint(tax.row_id) - 1].tax_amount_for_current_item;
-
-		} else if(tax.charge_type == "On Previous Row Total") {
-			current_tax_amount = (tax_rate / 100.0) *
-				this.frm.doc["taxes"][cint(tax.row_id) - 1].grand_total_for_current_item;
-		}
-
-		current_tax_amount = flt(current_tax_amount, precision("tax_amount", tax));
-
-		// store tax breakup for each item
-		tax.item_wise_tax_detail[item.item_code || item.item_name] = [tax_rate, current_tax_amount];
-
-		return current_tax_amount;
-	},
-
-	_cleanup: function() {
-		$.each(this.frm.doc["taxes"] || [], function(i, tax) {
-			$.each(["tax_amount_for_current_item", "grand_total_for_current_item",
-				"tax_fraction_for_current_item", "grand_total_fraction_for_current_item"],
-				function(i, fieldname) { delete tax[fieldname]; });
-
-			tax.item_wise_tax_detail = JSON.stringify(tax.item_wise_tax_detail);
-		});
-	},
-
-	calculate_total_advance: function(parenttype, advance_parentfield, update_paid_amount) {
-		if(this.frm.doc.doctype == parenttype && this.frm.doc.docstatus < 2) {
-			var advance_doclist = this.frm.doc[advance_parentfield] || [];
-			this.frm.doc.total_advance = flt(frappe.utils.sum(
-				$.map(advance_doclist, function(adv) { return adv.allocated_amount })
-			), precision("total_advance"));
-
-			this.calculate_outstanding_amount(update_paid_amount);
-		}
-	},
-
-	_set_in_company_currency: function(item, print_field, base_field) {
-		// set values in base currency
-		item[base_field] = flt(item[print_field] * this.frm.doc.conversion_rate,
-			precision(base_field, item));
-	},
-
 	get_terms: function() {
 		var me = this;
 		if(this.frm.doc.tc_name) {
diff --git a/erpnext/public/js/feature_setup.js b/erpnext/public/js/feature_setup.js
index 91720f2..bb83170 100644
--- a/erpnext/public/js/feature_setup.js
+++ b/erpnext/public/js/feature_setup.js
@@ -111,30 +111,30 @@
 		'Sales Order': {'items':['page_break']}
 	},
 	'fs_exports': {
-		'Delivery Note': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']},
+		'Delivery Note': {'fields':['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']},
 		'POS Setting': {'fields':['conversion_rate','currency']},
-		'Quotation': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']},
-		'Sales Invoice': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']},
+		'Quotation': {'fields':['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']},
+		'Sales Invoice': {'fields':['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']},
 		'Sales BOM': {'fields':['currency']},
-		'Sales Order': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']}
+		'Sales Order': {'fields':['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']}
 	},
 
 	'fs_imports': {
 		'Purchase Invoice': {
-			'fields': ['conversion_rate', 'currency', 'grand_total',
-		 		'in_words', 'net_total', 'other_charges_added',
-		 		'other_charges_deducted'],
+			'fields': ['conversion_rate', 'currency', 'base_grand_total',
+		 		'base_in_words', 'base_net_total', 'base_taxes_and_charges_added',
+		 		'base_taxes_and_charges_deducted'],
 			'items': ['base_price_list_rate', 'base_amount','base_rate']
 		},
 		'Purchase Order': {
-			'fields': ['conversion_rate','currency', 'grand_total',
-			'in_words', 'net_total', 'other_charges_added',
-			 'other_charges_deducted'],
+			'fields': ['conversion_rate','currency', 'base_grand_total',
+			'base_in_words', 'base_net_total', 'base_taxes_and_charges_added',
+			 'base_taxes_and_charges_deducted'],
 			'items': ['base_price_list_rate', 'base_amount','base_rate']
 		},
 		'Purchase Receipt': {
-			'fields': ['conversion_rate', 'currency','grand_total', 'in_words',
-			 	'net_total', 'other_charges_added', 'other_charges_deducted'],
+			'fields': ['conversion_rate', 'currency','base_grand_total', 'base_in_words',
+			 	'base_net_total', 'base_taxes_and_charges_added', 'base_taxes_and_charges_deducted'],
 			'items': ['base_price_list_rate','base_amount','base_rate']
 		},
 		'Supplier Quotation': {
diff --git a/erpnext/public/js/pos/pos.js b/erpnext/public/js/pos/pos.js
index e6394f6..5aaadb4 100644
--- a/erpnext/public/js/pos/pos.js
+++ b/erpnext/public/js/pos/pos.js
@@ -26,23 +26,19 @@
 
 		// Check whether the transaction is "Sales" or "Purchase"
 		if (frappe.meta.has_field(cur_frm.doc.doctype, "customer")) {
-			this.set_transaction_defaults("Customer", "export");
+			this.set_transaction_defaults("Customer");
 		}
 		else if (frappe.meta.has_field(cur_frm.doc.doctype, "supplier")) {
-			this.set_transaction_defaults("Supplier", "import");
+			this.set_transaction_defaults("Supplier");
 		}
 	},
-	set_transaction_defaults: function(party, export_or_import) {
+	set_transaction_defaults: function(party) {
 		var me = this;
 		this.party = party;
 		this.price_list = (party == "Customer" ?
 			this.frm.doc.selling_price_list : this.frm.doc.buying_price_list);
 		this.price_list_field = (party == "Customer" ? "selling_price_list" : "buying_price_list");
 		this.sales_or_purchase = (party == "Customer" ? "Sales" : "Purchase");
-		this.net_total = "net_total_" + export_or_import;
-		this.grand_total = "grand_total_" + export_or_import;
-		// this.amount = export_or_import + "_amount";
-		// this.rate = export_or_import + "_rate";
 	},
 	make: function() {
 		this.make_party();
@@ -282,10 +278,8 @@
 	},
 	set_totals: function() {
 		var me = this;
-		this.wrapper.find(".net-total").text(format_currency(this.frm.doc[this.net_total],
-			me.frm.doc.currency));
-		this.wrapper.find(".grand-total").text(format_currency(this.frm.doc[this.grand_total],
-			me.frm.doc.currency));
+		this.wrapper.find(".net-total").text(format_currency(me.frm.doc["net_total"], me.frm.doc.currency));
+		this.wrapper.find(".grand-total").text(format_currency(me.frm.doc.grand_total, me.frm.doc.currency));
 	},
 	call_when_local: function() {
 		var me = this;
@@ -414,12 +408,12 @@
 						title: 'Payment',
 						fields: [
 							{fieldtype:'Currency', fieldname:'total_amount', label: __('Total Amount'), read_only:1,
-								options:"currency", default:me.frm.doc.grand_total_export, read_only: 1},
+								options:"currency", default:me.frm.doc.grand_total, read_only: 1},
 							{fieldtype:'Select', fieldname:'mode_of_payment', label: __('Mode of Payment'),
 								options:modes_of_payment.join('\n'), reqd: 1, default: default_mode},
 							{fieldtype:'Currency', fieldname:'paid_amount', label:__('Amount Paid'), reqd:1,
 								options: "currency",
-								default:me.frm.doc.grand_total_export, hidden: 1},
+								default:me.frm.doc.grand_total, hidden: 1},
 							{fieldtype:'Currency', fieldname:'change', label: __('Change'), options: "currency",
 								default: 0.0, hidden: 1},
 							{fieldtype:'Currency', fieldname:'write_off_amount', label: __('Write Off'), options: "currency",
@@ -473,7 +467,7 @@
 						me.frm.set_value("paid_amount", paid_amount);
 
 						// specifying writeoff amount here itself, so as to avoid recursion issue
-						me.frm.set_value("write_off_amount", me.frm.doc.grand_total - paid_amount);
+						me.frm.set_value("write_off_amount", me.frm.doc.base_grand_total - paid_amount);
 						me.frm.set_value("outstanding_amount", 0);
 
 						me.frm.savesubmit(this);
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index 8a50de5..6a5546b 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -123,7 +123,7 @@
 		out[doctype] = frappe.db.get_value(doctype,
 			{"customer": customer, "docstatus": ["!=", 2] }, "count(*)")
 
-	billing = frappe.db.sql("""select sum(grand_total), sum(outstanding_amount)
+	billing = frappe.db.sql("""select sum(base_grand_total), sum(outstanding_amount)
 		from `tabSales Invoice`
 		where customer=%s
 			and docstatus = 1
@@ -174,7 +174,7 @@
 
 	# Outstanding based on Sales Order
 	outstanding_based_on_so = frappe.db.sql("""
-		select sum(grand_total*(100 - ifnull(per_billed, 0))/100)
+		select sum(base_grand_total*(100 - ifnull(per_billed, 0))/100)
 		from `tabSales Order`
 		where customer=%s and docstatus = 1 and company=%s
 		and ifnull(per_billed, 0) < 100 and status != 'Stopped'""", (customer, company))
@@ -189,8 +189,8 @@
 					(ifnull(dn_item.amount, 0) - ifnull((select sum(ifnull(amount, 0))
 						from `tabSales Invoice Item`
 						where ifnull(dn_detail, '') = dn_item.name and docstatus = 1), 0)
-					)/dn.net_total
-				)*dn.grand_total
+					)/dn.base_net_total
+				)*dn.base_grand_total
 			)
 		from `tabDelivery Note` dn, `tabDelivery Note Item` dn_item
 		where
diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json
index deb578d..9c8ddaa 100644
--- a/erpnext/selling/doctype/quotation/quotation.json
+++ b/erpnext/selling/doctype/quotation/quotation.json
@@ -1,946 +1,946 @@
 {
- "allow_import": 1,
- "autoname": "naming_series:",
- "creation": "2013-05-24 19:29:08",
- "docstatus": 0,
- "doctype": "DocType",
- "document_type": "Transaction",
+ "allow_import": 1, 
+ "autoname": "naming_series:", 
+ "creation": "2013-05-24 19:29:08", 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Transaction", 
  "fields": [
   {
-   "fieldname": "customer_section",
-   "fieldtype": "Section Break",
-   "label": "Customer",
-   "options": "icon-user",
+   "fieldname": "customer_section", 
+   "fieldtype": "Section Break", 
+   "label": "Customer", 
+   "options": "icon-user", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "column_break0",
-   "fieldtype": "Column Break",
-   "permlevel": 0,
-   "read_only": 0,
+   "fieldname": "column_break0", 
+   "fieldtype": "Column Break", 
+   "permlevel": 0, 
+   "read_only": 0, 
    "width": "50%"
-  },
+  }, 
   {
-   "fieldname": "naming_series",
-   "fieldtype": "Select",
-   "label": "Series",
-   "no_copy": 1,
-   "oldfieldname": "naming_series",
-   "oldfieldtype": "Select",
-   "options": "QTN-",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
+   "fieldname": "naming_series", 
+   "fieldtype": "Select", 
+   "label": "Series", 
+   "no_copy": 1, 
+   "oldfieldname": "naming_series", 
+   "oldfieldtype": "Select", 
+   "options": "QTN-", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
    "reqd": 1
-  },
+  }, 
   {
-   "default": "Customer",
-   "fieldname": "quotation_to",
-   "fieldtype": "Select",
-   "in_filter": 1,
-   "label": "Quotation To",
-   "oldfieldname": "quotation_to",
-   "oldfieldtype": "Select",
-   "options": "\nLead\nCustomer",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
-   "report_hide": 0,
+   "default": "Customer", 
+   "fieldname": "quotation_to", 
+   "fieldtype": "Select", 
+   "in_filter": 1, 
+   "label": "Quotation To", 
+   "oldfieldname": "quotation_to", 
+   "oldfieldtype": "Select", 
+   "options": "\nLead\nCustomer", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "report_hide": 0, 
    "reqd": 1
-  },
+  }, 
   {
-   "depends_on": "eval:doc.quotation_to == \"Customer\"",
-   "fieldname": "customer",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "in_filter": 1,
-   "label": "Customer",
-   "oldfieldname": "customer",
-   "oldfieldtype": "Link",
-   "options": "Customer",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
+   "depends_on": "eval:doc.quotation_to == \"Customer\"", 
+   "fieldname": "customer", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "in_filter": 1, 
+   "label": "Customer", 
+   "oldfieldname": "customer", 
+   "oldfieldtype": "Link", 
+   "options": "Customer", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
    "search_index": 1
-  },
+  }, 
   {
-   "depends_on": "eval:doc.quotation_to == \"Lead\"",
-   "fieldname": "lead",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "in_filter": 1,
-   "label": "Lead",
-   "oldfieldname": "lead",
-   "oldfieldtype": "Link",
-   "options": "Lead",
-   "permlevel": 0,
-   "print_hide": 1,
+   "depends_on": "eval:doc.quotation_to == \"Lead\"", 
+   "fieldname": "lead", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "in_filter": 1, 
+   "label": "Lead", 
+   "oldfieldname": "lead", 
+   "oldfieldtype": "Link", 
+   "options": "Lead", 
+   "permlevel": 0, 
+   "print_hide": 1, 
    "read_only": 0
-  },
+  }, 
   {
-   "fieldname": "customer_name",
-   "fieldtype": "Data",
-   "hidden": 1,
-   "in_list_view": 0,
-   "label": "Customer / Lead Name",
-   "permlevel": 0,
+   "fieldname": "customer_name", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "in_list_view": 0, 
+   "label": "Customer / Lead Name", 
+   "permlevel": 0, 
    "read_only": 1
-  },
+  }, 
   {
-   "fieldname": "address_display",
-   "fieldtype": "Small Text",
-   "hidden": 1,
-   "in_filter": 0,
-   "label": "Address",
-   "oldfieldname": "customer_address",
-   "oldfieldtype": "Small Text",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 1,
-   "reqd": 0,
+   "fieldname": "address_display", 
+   "fieldtype": "Small Text", 
+   "hidden": 1, 
+   "in_filter": 0, 
+   "label": "Address", 
+   "oldfieldname": "customer_address", 
+   "oldfieldtype": "Small Text", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 1, 
+   "reqd": 0, 
    "search_index": 0
-  },
+  }, 
   {
-   "fieldname": "contact_display",
-   "fieldtype": "Small Text",
-   "hidden": 1,
-   "in_filter": 0,
-   "label": "Contact",
-   "permlevel": 0,
-   "print_hide": 0,
+   "fieldname": "contact_display", 
+   "fieldtype": "Small Text", 
+   "hidden": 1, 
+   "in_filter": 0, 
+   "label": "Contact", 
+   "permlevel": 0, 
+   "print_hide": 0, 
    "read_only": 1
-  },
+  }, 
   {
-   "fieldname": "contact_mobile",
-   "fieldtype": "Small Text",
-   "hidden": 1,
-   "label": "Mobile No",
-   "permlevel": 0,
-   "print_hide": 0,
+   "fieldname": "contact_mobile", 
+   "fieldtype": "Small Text", 
+   "hidden": 1, 
+   "label": "Mobile No", 
+   "permlevel": 0, 
+   "print_hide": 0, 
    "read_only": 1
-  },
+  }, 
   {
-   "fieldname": "contact_email",
-   "fieldtype": "Small Text",
-   "hidden": 1,
-   "label": "Contact Email",
-   "permlevel": 0,
-   "print_hide": 1,
+   "fieldname": "contact_email", 
+   "fieldtype": "Small Text", 
+   "hidden": 1, 
+   "label": "Contact Email", 
+   "permlevel": 0, 
+   "print_hide": 1, 
    "read_only": 1
-  },
+  }, 
   {
-   "fieldname": "column_break1",
-   "fieldtype": "Column Break",
-   "oldfieldtype": "Column Break",
-   "permlevel": 0,
-   "read_only": 0,
+   "fieldname": "column_break1", 
+   "fieldtype": "Column Break", 
+   "oldfieldtype": "Column Break", 
+   "permlevel": 0, 
+   "read_only": 0, 
    "width": "50%"
-  },
+  }, 
   {
-   "fieldname": "amended_from",
-   "fieldtype": "Link",
-   "ignore_user_permissions": 1,
-   "label": "Amended From",
-   "no_copy": 1,
-   "oldfieldname": "amended_from",
-   "oldfieldtype": "Data",
-   "options": "Quotation",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
+   "fieldname": "amended_from", 
+   "fieldtype": "Link", 
+   "ignore_user_permissions": 1, 
+   "label": "Amended From", 
+   "no_copy": 1, 
+   "oldfieldname": "amended_from", 
+   "oldfieldtype": "Data", 
+   "options": "Quotation", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
    "width": "150px"
-  },
+  }, 
   {
-   "description": "",
-   "fieldname": "company",
-   "fieldtype": "Link",
-   "in_filter": 1,
-   "label": "Company",
-   "oldfieldname": "company",
-   "oldfieldtype": "Link",
-   "options": "Company",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
-   "reqd": 1,
-   "search_index": 0,
+   "description": "", 
+   "fieldname": "company", 
+   "fieldtype": "Link", 
+   "in_filter": 1, 
+   "label": "Company", 
+   "oldfieldname": "company", 
+   "oldfieldtype": "Link", 
+   "options": "Company", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
    "width": "150px"
-  },
+  }, 
   {
-   "default": "Today",
-   "fieldname": "transaction_date",
-   "fieldtype": "Date",
-   "in_filter": 1,
-   "label": "Date",
-   "no_copy": 1,
-   "oldfieldname": "transaction_date",
-   "oldfieldtype": "Date",
-   "permlevel": 0,
-   "read_only": 0,
-   "reqd": 1,
-   "search_index": 1,
+   "default": "Today", 
+   "fieldname": "transaction_date", 
+   "fieldtype": "Date", 
+   "in_filter": 1, 
+   "label": "Date", 
+   "no_copy": 1, 
+   "oldfieldname": "transaction_date", 
+   "oldfieldtype": "Date", 
+   "permlevel": 0, 
+   "read_only": 0, 
+   "reqd": 1, 
+   "search_index": 1, 
    "width": "100px"
-  },
+  }, 
   {
-   "default": "Sales",
-   "fieldname": "order_type",
-   "fieldtype": "Select",
-   "in_filter": 1,
-   "label": "Order Type",
-   "oldfieldname": "order_type",
-   "oldfieldtype": "Select",
-   "options": "\nSales\nMaintenance\nShopping Cart",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
-   "reqd": 1,
+   "default": "Sales", 
+   "fieldname": "order_type", 
+   "fieldtype": "Select", 
+   "in_filter": 1, 
+   "label": "Order Type", 
+   "oldfieldname": "order_type", 
+   "oldfieldtype": "Select", 
+   "options": "\nSales\nMaintenance\nShopping Cart", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "reqd": 1, 
    "search_index": 0
-  },
+  }, 
   {
-   "fieldname": "currency_and_price_list",
-   "fieldtype": "Section Break",
-   "label": "Currency and Price List",
-   "options": "icon-tag",
-   "permlevel": 0,
+   "fieldname": "currency_and_price_list", 
+   "fieldtype": "Section Break", 
+   "label": "Currency and Price List", 
+   "options": "icon-tag", 
+   "permlevel": 0, 
    "read_only": 0
-  },
+  }, 
   {
-   "fieldname": "currency",
-   "fieldtype": "Link",
-   "in_filter": 1,
-   "label": "Currency",
-   "oldfieldname": "currency",
-   "oldfieldtype": "Select",
-   "options": "Currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
-   "reqd": 1,
-   "search_index": 0,
+   "fieldname": "currency", 
+   "fieldtype": "Link", 
+   "in_filter": 1, 
+   "label": "Currency", 
+   "oldfieldname": "currency", 
+   "oldfieldtype": "Select", 
+   "options": "Currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
    "width": "100px"
-  },
+  }, 
   {
-   "description": "Rate at which customer's currency is converted to company's base currency",
-   "fieldname": "conversion_rate",
-   "fieldtype": "Float",
-   "label": "Exchange Rate",
-   "oldfieldname": "conversion_rate",
-   "oldfieldtype": "Currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
-   "reqd": 1,
+   "description": "Rate at which customer's currency is converted to company's base currency", 
+   "fieldname": "conversion_rate", 
+   "fieldtype": "Float", 
+   "label": "Exchange Rate", 
+   "oldfieldname": "conversion_rate", 
+   "oldfieldtype": "Currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "reqd": 1, 
    "width": "100px"
-  },
+  }, 
   {
-   "fieldname": "column_break2",
-   "fieldtype": "Column Break",
-   "permlevel": 0,
-   "read_only": 0,
+   "fieldname": "column_break2", 
+   "fieldtype": "Column Break", 
+   "permlevel": 0, 
+   "read_only": 0, 
    "width": "50%"
-  },
+  }, 
   {
-   "fieldname": "selling_price_list",
-   "fieldtype": "Link",
-   "in_filter": 1,
-   "label": "Price List",
-   "oldfieldname": "price_list_name",
-   "oldfieldtype": "Select",
-   "options": "Price List",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
-   "reqd": 1,
-   "search_index": 0,
+   "fieldname": "selling_price_list", 
+   "fieldtype": "Link", 
+   "in_filter": 1, 
+   "label": "Price List", 
+   "oldfieldname": "price_list_name", 
+   "oldfieldtype": "Select", 
+   "options": "Price List", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
    "width": "100px"
-  },
+  }, 
   {
-   "fieldname": "price_list_currency",
-   "fieldtype": "Link",
-   "label": "Price List Currency",
-   "options": "Currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
+   "fieldname": "price_list_currency", 
+   "fieldtype": "Link", 
+   "label": "Price List Currency", 
+   "options": "Currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
    "reqd": 1
-  },
+  }, 
   {
-   "description": "Rate at which Price list currency is converted to company's base currency",
-   "fieldname": "plc_conversion_rate",
-   "fieldtype": "Float",
-   "label": "Price List Exchange Rate",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
+   "description": "Rate at which Price list currency is converted to company's base currency", 
+   "fieldname": "plc_conversion_rate", 
+   "fieldtype": "Float", 
+   "label": "Price List Exchange Rate", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
    "reqd": 1
-  },
+  }, 
   {
-   "fieldname": "ignore_pricing_rule",
-   "fieldtype": "Check",
-   "label": "Ignore Pricing Rule",
-   "no_copy": 1,
-   "permlevel": 1,
+   "fieldname": "ignore_pricing_rule", 
+   "fieldtype": "Check", 
+   "label": "Ignore Pricing Rule", 
+   "no_copy": 1, 
+   "permlevel": 1, 
    "print_hide": 1
-  },
+  }, 
   {
-   "fieldname": "items_section",
-   "fieldtype": "Section Break",
-   "label": "Items",
-   "oldfieldtype": "Section Break",
-   "options": "icon-shopping-cart",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
+   "fieldname": "items_section", 
+   "fieldtype": "Section Break", 
+   "label": "Items", 
+   "oldfieldtype": "Section Break", 
+   "options": "icon-shopping-cart", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
    "search_index": 0
-  },
+  }, 
   {
-   "allow_on_submit": 1,
-   "fieldname": "items",
-   "fieldtype": "Table",
-   "label": "Items",
-   "oldfieldname": "quotation_details",
-   "oldfieldtype": "Table",
-   "options": "Quotation Item",
-   "permlevel": 0,
-   "read_only": 0,
-   "reqd": 0,
+   "allow_on_submit": 1, 
+   "fieldname": "items", 
+   "fieldtype": "Table", 
+   "label": "Items", 
+   "oldfieldname": "quotation_details", 
+   "oldfieldtype": "Table", 
+   "options": "Quotation Item", 
+   "permlevel": 0, 
+   "read_only": 0, 
+   "reqd": 0, 
    "width": "40px"
-  },
+  }, 
   {
-   "fieldname": "sec_break23",
-   "fieldtype": "Section Break",
-   "permlevel": 0,
+   "fieldname": "sec_break23", 
+   "fieldtype": "Section Break", 
+   "permlevel": 0, 
    "read_only": 0
-  },
+  }, 
   {
-   "fieldname": "net_total",
-   "fieldtype": "Currency",
-   "label": "Net Total (Company Currency)",
-   "no_copy": 0,
-   "oldfieldname": "net_total",
-   "oldfieldtype": "Currency",
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
-   "reqd": 0,
+   "fieldname": "base_net_total", 
+   "fieldtype": "Currency", 
+   "label": "Net Total (Company Currency)", 
+   "no_copy": 0, 
+   "oldfieldname": "net_total", 
+   "oldfieldtype": "Currency", 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "reqd": 0, 
    "width": "100px"
-  },
+  }, 
   {
-   "fieldname": "column_break_28",
-   "fieldtype": "Column Break",
+   "fieldname": "column_break_28", 
+   "fieldtype": "Column Break", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "net_total_export",
-   "fieldtype": "Currency",
-   "label": "Net Total",
-   "options": "currency",
-   "permlevel": 0,
+   "fieldname": "net_total", 
+   "fieldtype": "Currency", 
+   "label": "Net Total", 
+   "options": "currency", 
+   "permlevel": 0, 
    "read_only": 1
-  },
+  }, 
   {
-   "fieldname": "taxes_section",
-   "fieldtype": "Section Break",
-   "label": "Taxes and Charges",
-   "oldfieldtype": "Section Break",
-   "options": "icon-money",
-   "permlevel": 0,
+   "fieldname": "taxes_section", 
+   "fieldtype": "Section Break", 
+   "label": "Taxes and Charges", 
+   "oldfieldtype": "Section Break", 
+   "options": "icon-money", 
+   "permlevel": 0, 
    "read_only": 0
-  },
+  }, 
   {
-   "fieldname": "taxes_and_charges",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "label": "Taxes and Charges",
-   "oldfieldname": "charge",
-   "oldfieldtype": "Link",
-   "options": "Sales Taxes and Charges Master",
-   "permlevel": 0,
-   "print_hide": 1,
+   "fieldname": "taxes_and_charges", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "label": "Taxes and Charges", 
+   "oldfieldname": "charge", 
+   "oldfieldtype": "Link", 
+   "options": "Sales Taxes and Charges Master", 
+   "permlevel": 0, 
+   "print_hide": 1, 
    "read_only": 0
-  },
+  }, 
   {
-   "fieldname": "column_break_34",
-   "fieldtype": "Column Break",
+   "fieldname": "column_break_34", 
+   "fieldtype": "Column Break", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "shipping_rule",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "label": "Shipping Rule",
-   "oldfieldtype": "Button",
-   "options": "Shipping Rule",
-   "permlevel": 0,
-   "print_hide": 1,
+   "fieldname": "shipping_rule", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "label": "Shipping Rule", 
+   "oldfieldtype": "Button", 
+   "options": "Shipping Rule", 
+   "permlevel": 0, 
+   "print_hide": 1, 
    "read_only": 0
-  },
+  }, 
   {
-   "fieldname": "section_break_36",
-   "fieldtype": "Section Break",
+   "fieldname": "section_break_36", 
+   "fieldtype": "Section Break", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "taxes",
-   "fieldtype": "Table",
-   "label": "Sales Taxes and Charges",
-   "oldfieldname": "other_charges",
-   "oldfieldtype": "Table",
-   "options": "Sales Taxes and Charges",
-   "permlevel": 0,
+   "fieldname": "taxes", 
+   "fieldtype": "Table", 
+   "label": "Sales Taxes and Charges", 
+   "oldfieldname": "other_charges", 
+   "oldfieldtype": "Table", 
+   "options": "Sales Taxes and Charges", 
+   "permlevel": 0, 
    "read_only": 0
-  },
+  }, 
   {
-   "fieldname": "other_charges_calculation",
-   "fieldtype": "HTML",
-   "label": "Taxes and Charges Calculation",
-   "oldfieldtype": "HTML",
-   "permlevel": 0,
-   "print_hide": 1,
+   "fieldname": "other_charges_calculation", 
+   "fieldtype": "HTML", 
+   "label": "Taxes and Charges Calculation", 
+   "oldfieldtype": "HTML", 
+   "permlevel": 0, 
+   "print_hide": 1, 
    "read_only": 0
-  },
+  }, 
   {
-   "fieldname": "section_break_39",
-   "fieldtype": "Section Break",
+   "fieldname": "section_break_39", 
+   "fieldtype": "Section Break", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "other_charges_total_export",
-   "fieldtype": "Currency",
-   "label": "Taxes and Charges Total",
-   "options": "currency",
-   "permlevel": 0,
-   "print_hide": 1,
+   "fieldname": "total_taxes_and_charges", 
+   "fieldtype": "Currency", 
+   "label": "Total Taxes and Charges", 
+   "options": "currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
    "read_only": 1
-  },
+  }, 
   {
-   "fieldname": "other_charges_total",
-   "fieldtype": "Currency",
-   "label": "Taxes and Charges Total (Company Currency)",
-   "oldfieldname": "other_charges_total",
-   "oldfieldtype": "Currency",
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "print_hide": 1,
+   "fieldname": "base_total_taxes_and_charges", 
+   "fieldtype": "Currency", 
+   "label": "Total Taxes and Charges (Company Currency)", 
+   "oldfieldname": "other_charges_total", 
+   "oldfieldtype": "Currency", 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
    "read_only": 1
-  },
+  }, 
   {
-   "fieldname": "column_break_42",
-   "fieldtype": "Column Break",
+   "fieldname": "column_break_42", 
+   "fieldtype": "Column Break", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "discount_amount",
-   "fieldtype": "Currency",
-   "label": "Discount Amount",
-   "options": "currency",
+   "fieldname": "discount_amount", 
+   "fieldtype": "Currency", 
+   "label": "Discount Amount", 
+   "options": "currency", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "base_discount_amount",
-   "fieldtype": "Currency",
-   "label": "Discount Amount (Company Currency)",
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
+   "fieldname": "base_discount_amount", 
+   "fieldtype": "Currency", 
+   "label": "Discount Amount (Company Currency)", 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
    "read_only": 1
-  },
+  }, 
   {
-   "fieldname": "totals",
-   "fieldtype": "Section Break",
-   "label": "Totals",
-   "oldfieldtype": "Section Break",
-   "options": "icon-money",
-   "permlevel": 0,
-   "print_hide": 1,
+   "fieldname": "totals", 
+   "fieldtype": "Section Break", 
+   "label": "Totals", 
+   "oldfieldtype": "Section Break", 
+   "options": "icon-money", 
+   "permlevel": 0, 
+   "print_hide": 1, 
    "read_only": 0
-  },
+  }, 
   {
-   "fieldname": "grand_total",
-   "fieldtype": "Currency",
-   "label": "Grand Total (Company Currency)",
-   "no_copy": 0,
-   "oldfieldname": "grand_total",
-   "oldfieldtype": "Currency",
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
-   "reqd": 0,
+   "fieldname": "base_grand_total", 
+   "fieldtype": "Currency", 
+   "label": "Grand Total (Company Currency)", 
+   "no_copy": 0, 
+   "oldfieldname": "grand_total", 
+   "oldfieldtype": "Currency", 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "reqd": 0, 
    "width": "200px"
-  },
+  }, 
   {
-   "fieldname": "rounded_total",
-   "fieldtype": "Currency",
-   "label": "Rounded Total (Company Currency)",
-   "no_copy": 0,
-   "oldfieldname": "rounded_total",
-   "oldfieldtype": "Currency",
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
+   "fieldname": "base_rounded_total", 
+   "fieldtype": "Currency", 
+   "label": "Rounded Total (Company Currency)", 
+   "no_copy": 0, 
+   "oldfieldname": "rounded_total", 
+   "oldfieldtype": "Currency", 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
    "width": "200px"
-  },
+  }, 
   {
-   "description": "In Words will be visible once you save the Quotation.",
-   "fieldname": "in_words",
-   "fieldtype": "Data",
-   "label": "In Words (Company Currency)",
-   "no_copy": 0,
-   "oldfieldname": "in_words",
-   "oldfieldtype": "Data",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
+   "description": "In Words will be visible once you save the Quotation.", 
+   "fieldname": "base_in_words", 
+   "fieldtype": "Data", 
+   "label": "In Words (Company Currency)", 
+   "no_copy": 0, 
+   "oldfieldname": "in_words", 
+   "oldfieldtype": "Data", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
    "width": "200px"
-  },
+  }, 
   {
-   "fieldname": "column_break3",
-   "fieldtype": "Column Break",
-   "oldfieldtype": "Column Break",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
+   "fieldname": "column_break3", 
+   "fieldtype": "Column Break", 
+   "oldfieldtype": "Column Break", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
    "width": "50%"
-  },
+  }, 
   {
-   "fieldname": "grand_total_export",
-   "fieldtype": "Currency",
-   "in_list_view": 1,
-   "label": "Grand Total",
-   "no_copy": 0,
-   "oldfieldname": "grand_total_export",
-   "oldfieldtype": "Currency",
-   "options": "currency",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 1,
-   "reqd": 0,
+   "fieldname": "grand_total", 
+   "fieldtype": "Currency", 
+   "in_list_view": 1, 
+   "label": "Grand Total", 
+   "no_copy": 0, 
+   "oldfieldname": "grand_total_export", 
+   "oldfieldtype": "Currency", 
+   "options": "currency", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 1, 
+   "reqd": 0, 
    "width": "200px"
-  },
+  }, 
   {
-   "fieldname": "rounded_total_export",
-   "fieldtype": "Currency",
-   "label": "Rounded Total",
-   "no_copy": 0,
-   "oldfieldname": "rounded_total_export",
-   "oldfieldtype": "Currency",
-   "options": "currency",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 1,
-   "reqd": 0,
+   "fieldname": "rounded_total", 
+   "fieldtype": "Currency", 
+   "label": "Rounded Total", 
+   "no_copy": 0, 
+   "oldfieldname": "rounded_total_export", 
+   "oldfieldtype": "Currency", 
+   "options": "currency", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 1, 
+   "reqd": 0, 
    "width": "200px"
-  },
+  }, 
   {
-   "fieldname": "in_words_export",
-   "fieldtype": "Data",
-   "label": "In Words",
-   "no_copy": 0,
-   "oldfieldname": "in_words_export",
-   "oldfieldtype": "Data",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 1,
+   "fieldname": "in_words", 
+   "fieldtype": "Data", 
+   "label": "In Words", 
+   "no_copy": 0, 
+   "oldfieldname": "in_words_export", 
+   "oldfieldtype": "Data", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 1, 
    "width": "200px"
-  },
+  }, 
   {
-   "fieldname": "fold",
-   "fieldtype": "Fold",
-   "label": "Fold",
+   "fieldname": "fold", 
+   "fieldtype": "Fold", 
+   "label": "Fold", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "terms_section_break",
-   "fieldtype": "Section Break",
-   "label": "Terms and Conditions",
-   "oldfieldtype": "Section Break",
-   "options": "icon-legal",
-   "permlevel": 0,
-   "print_hide": 0,
+   "fieldname": "terms_section_break", 
+   "fieldtype": "Section Break", 
+   "label": "Terms and Conditions", 
+   "oldfieldtype": "Section Break", 
+   "options": "icon-legal", 
+   "permlevel": 0, 
+   "print_hide": 0, 
    "read_only": 0
-  },
+  }, 
   {
-   "fieldname": "tc_name",
-   "fieldtype": "Link",
-   "label": "Terms",
-   "oldfieldname": "tc_name",
-   "oldfieldtype": "Link",
-   "options": "Terms and Conditions",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
+   "fieldname": "tc_name", 
+   "fieldtype": "Link", 
+   "label": "Terms", 
+   "oldfieldname": "tc_name", 
+   "oldfieldtype": "Link", 
+   "options": "Terms and Conditions", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
    "report_hide": 1
-  },
+  }, 
   {
-   "fieldname": "terms",
-   "fieldtype": "Text Editor",
-   "label": "Term Details",
-   "oldfieldname": "terms",
-   "oldfieldtype": "Text Editor",
-   "permlevel": 0,
+   "fieldname": "terms", 
+   "fieldtype": "Text Editor", 
+   "label": "Term Details", 
+   "oldfieldname": "terms", 
+   "oldfieldtype": "Text Editor", 
+   "permlevel": 0, 
    "read_only": 0
-  },
+  }, 
   {
-   "fieldname": "contact_section",
-   "fieldtype": "Section Break",
-   "label": "Contact Info",
-   "options": "icon-bullhorn",
-   "permlevel": 0,
+   "fieldname": "contact_section", 
+   "fieldtype": "Section Break", 
+   "label": "Contact Info", 
+   "options": "icon-bullhorn", 
+   "permlevel": 0, 
    "read_only": 0
-  },
+  }, 
   {
-   "description": "",
-   "fieldname": "territory",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "in_filter": 1,
-   "label": "Territory",
-   "options": "Territory",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
-   "reqd": 1,
+   "description": "", 
+   "fieldname": "territory", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "in_filter": 1, 
+   "label": "Territory", 
+   "options": "Territory", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "reqd": 1, 
    "search_index": 0
-  },
+  }, 
   {
-   "depends_on": "customer",
-   "description": "",
-   "fieldname": "customer_group",
-   "fieldtype": "Link",
-   "in_filter": 1,
-   "label": "Customer Group",
-   "oldfieldname": "customer_group",
-   "oldfieldtype": "Link",
-   "options": "Customer Group",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
-   "reqd": 0,
+   "depends_on": "customer", 
+   "description": "", 
+   "fieldname": "customer_group", 
+   "fieldtype": "Link", 
+   "in_filter": 1, 
+   "label": "Customer Group", 
+   "oldfieldname": "customer_group", 
+   "oldfieldtype": "Link", 
+   "options": "Customer Group", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "reqd": 0, 
    "search_index": 0
-  },
+  }, 
   {
-   "fieldname": "shipping_address_name",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "label": "Shipping Address",
-   "options": "Address",
-   "permlevel": 0,
+   "fieldname": "shipping_address_name", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "label": "Shipping Address", 
+   "options": "Address", 
+   "permlevel": 0, 
    "print_hide": 1
-  },
+  }, 
   {
-   "fieldname": "shipping_address",
-   "fieldtype": "Small Text",
-   "hidden": 1,
-   "label": "Shipping Address",
-   "permlevel": 0,
-   "print_hide": 1,
+   "fieldname": "shipping_address", 
+   "fieldtype": "Small Text", 
+   "hidden": 1, 
+   "label": "Shipping Address", 
+   "permlevel": 0, 
+   "print_hide": 1, 
    "read_only": 1
-  },
+  }, 
   {
-   "depends_on": "customer",
-   "fieldname": "col_break98",
-   "fieldtype": "Column Break",
-   "permlevel": 0,
-   "read_only": 0,
+   "depends_on": "customer", 
+   "fieldname": "col_break98", 
+   "fieldtype": "Column Break", 
+   "permlevel": 0, 
+   "read_only": 0, 
    "width": "50%"
-  },
+  }, 
   {
-   "fieldname": "customer_address",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "in_filter": 1,
-   "label": "Customer Address",
-   "options": "Address",
-   "permlevel": 0,
-   "print_hide": 1,
+   "fieldname": "customer_address", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "in_filter": 1, 
+   "label": "Customer Address", 
+   "options": "Address", 
+   "permlevel": 0, 
+   "print_hide": 1, 
    "read_only": 0
-  },
+  }, 
   {
-   "depends_on": "eval:doc.customer",
-   "fieldname": "contact_person",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "in_filter": 1,
-   "label": "Contact Person",
-   "oldfieldname": "contact_person",
-   "oldfieldtype": "Link",
-   "options": "Contact",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
+   "depends_on": "eval:doc.customer", 
+   "fieldname": "contact_person", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "in_filter": 1, 
+   "label": "Contact Person", 
+   "oldfieldname": "contact_person", 
+   "oldfieldtype": "Link", 
+   "options": "Contact", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
    "reqd": 0
-  },
+  }, 
   {
-   "fieldname": "more_info",
-   "fieldtype": "Section Break",
-   "label": "More Info",
-   "oldfieldtype": "Section Break",
-   "options": "icon-file-text",
-   "permlevel": 0,
-   "print_hide": 1,
+   "fieldname": "more_info", 
+   "fieldtype": "Section Break", 
+   "label": "More Info", 
+   "oldfieldtype": "Section Break", 
+   "options": "icon-file-text", 
+   "permlevel": 0, 
+   "print_hide": 1, 
    "read_only": 0
-  },
+  }, 
   {
-   "fieldname": "campaign",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "label": "Campaign",
-   "no_copy": 0,
-   "oldfieldname": "campaign",
-   "oldfieldtype": "Link",
-   "options": "Campaign",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
+   "fieldname": "campaign", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "label": "Campaign", 
+   "no_copy": 0, 
+   "oldfieldname": "campaign", 
+   "oldfieldtype": "Link", 
+   "options": "Campaign", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
    "report_hide": 0
-  },
+  }, 
   {
-   "fieldname": "source",
-   "fieldtype": "Select",
-   "hidden": 0,
-   "label": "Source",
-   "no_copy": 0,
-   "oldfieldname": "source",
-   "oldfieldtype": "Select",
-   "options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
+   "fieldname": "source", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "label": "Source", 
+   "no_copy": 0, 
+   "oldfieldname": "source", 
+   "oldfieldtype": "Select", 
+   "options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
    "report_hide": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "default": "Draft",
-   "fieldname": "status",
-   "fieldtype": "Select",
-   "in_filter": 1,
-   "in_list_view": 1,
-   "label": "Status",
-   "no_copy": 1,
-   "oldfieldname": "status",
-   "oldfieldtype": "Select",
-   "options": "Draft\nSubmitted\nOrdered\nLost\nCancelled\nOpen\nReplied",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
-   "reqd": 1,
+   "allow_on_submit": 0, 
+   "default": "Draft", 
+   "fieldname": "status", 
+   "fieldtype": "Select", 
+   "in_filter": 1, 
+   "in_list_view": 1, 
+   "label": "Status", 
+   "no_copy": 1, 
+   "oldfieldname": "status", 
+   "oldfieldtype": "Select", 
+   "options": "Draft\nSubmitted\nOrdered\nLost\nCancelled\nOpen\nReplied", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "reqd": 1, 
    "search_index": 0
-  },
+  }, 
   {
-   "allow_on_submit": 1,
-   "fieldname": "order_lost_reason",
-   "fieldtype": "Small Text",
-   "label": "Quotation Lost Reason",
-   "no_copy": 1,
-   "oldfieldname": "order_lost_reason",
-   "oldfieldtype": "Small Text",
-   "permlevel": 0,
-   "print_hide": 1,
+   "allow_on_submit": 1, 
+   "fieldname": "order_lost_reason", 
+   "fieldtype": "Small Text", 
+   "label": "Quotation Lost Reason", 
+   "no_copy": 1, 
+   "oldfieldname": "order_lost_reason", 
+   "oldfieldtype": "Small Text", 
+   "permlevel": 0, 
+   "print_hide": 1, 
    "read_only": 0
-  },
+  }, 
   {
-   "fieldname": "column_break4",
-   "fieldtype": "Column Break",
-   "oldfieldtype": "Column Break",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
+   "fieldname": "column_break4", 
+   "fieldtype": "Column Break", 
+   "oldfieldtype": "Column Break", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
    "width": "50%"
-  },
+  }, 
   {
-   "allow_on_submit": 1,
-   "fieldname": "letter_head",
-   "fieldtype": "Link",
-   "label": "Letter Head",
-   "oldfieldname": "letter_head",
-   "oldfieldtype": "Select",
-   "options": "Letter Head",
-   "permlevel": 0,
-   "print_hide": 1,
+   "allow_on_submit": 1, 
+   "fieldname": "letter_head", 
+   "fieldtype": "Link", 
+   "label": "Letter Head", 
+   "oldfieldname": "letter_head", 
+   "oldfieldtype": "Select", 
+   "options": "Letter Head", 
+   "permlevel": 0, 
+   "print_hide": 1, 
    "read_only": 0
-  },
+  }, 
   {
-   "allow_on_submit": 1,
-   "fieldname": "select_print_heading",
-   "fieldtype": "Link",
-   "label": "Print Heading",
-   "no_copy": 1,
-   "oldfieldname": "select_print_heading",
-   "oldfieldtype": "Link",
-   "options": "Print Heading",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
+   "allow_on_submit": 1, 
+   "fieldname": "select_print_heading", 
+   "fieldtype": "Link", 
+   "label": "Print Heading", 
+   "no_copy": 1, 
+   "oldfieldname": "select_print_heading", 
+   "oldfieldtype": "Link", 
+   "options": "Print Heading", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
    "report_hide": 1
-  },
+  }, 
   {
-   "fieldname": "fiscal_year",
-   "fieldtype": "Link",
-   "in_filter": 1,
-   "label": "Fiscal Year",
-   "oldfieldname": "fiscal_year",
-   "oldfieldtype": "Select",
-   "options": "Fiscal Year",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
-   "reqd": 1,
+   "fieldname": "fiscal_year", 
+   "fieldtype": "Link", 
+   "in_filter": 1, 
+   "label": "Fiscal Year", 
+   "oldfieldname": "fiscal_year", 
+   "oldfieldtype": "Select", 
+   "options": "Fiscal Year", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "reqd": 1, 
    "search_index": 0
-  },
+  }, 
   {
-   "fieldname": "enq_det",
-   "fieldtype": "Text",
-   "hidden": 1,
-   "label": "Opportunity Item",
-   "no_copy": 0,
-   "oldfieldname": "enq_det",
-   "oldfieldtype": "Text",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
+   "fieldname": "enq_det", 
+   "fieldtype": "Text", 
+   "hidden": 1, 
+   "label": "Opportunity Item", 
+   "no_copy": 0, 
+   "oldfieldname": "enq_det", 
+   "oldfieldtype": "Text", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
    "report_hide": 0
   }
- ],
- "hide_toolbar": 0,
- "icon": "icon-shopping-cart",
- "idx": 1,
- "is_submittable": 1,
- "max_attachments": 1,
- "modified": "2015-02-05 05:11:44.426544",
- "modified_by": "Administrator",
- "module": "Selling",
- "name": "Quotation",
- "owner": "Administrator",
+ ], 
+ "hide_toolbar": 0, 
+ "icon": "icon-shopping-cart", 
+ "idx": 1, 
+ "is_submittable": 1, 
+ "max_attachments": 1, 
+ "modified": "2015-02-11 15:15:29.475837", 
+ "modified_by": "Administrator", 
+ "module": "Selling", 
+ "name": "Quotation", 
+ "owner": "Administrator", 
  "permissions": [
   {
-   "amend": 1,
-   "cancel": 1,
-   "create": 1,
-   "delete": 1,
-   "email": 1,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Sales User",
-   "share": 1,
-   "submit": 1,
+   "amend": 1, 
+   "cancel": 1, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Sales User", 
+   "share": 1, 
+   "submit": 1, 
    "write": 1
-  },
+  }, 
   {
-   "amend": 0,
-   "cancel": 0,
-   "create": 0,
-   "delete": 0,
-   "match": "",
-   "permlevel": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Sales User",
-   "submit": 0,
+   "amend": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "match": "", 
+   "permlevel": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Sales User", 
+   "submit": 0, 
    "write": 0
-  },
+  }, 
   {
-   "cancel": 0,
-   "delete": 0,
-   "email": 1,
-   "match": "",
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
+   "cancel": 0, 
+   "delete": 0, 
+   "email": 1, 
+   "match": "", 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
    "role": "Customer"
-  },
+  }, 
   {
-   "amend": 0,
-   "cancel": 0,
-   "create": 0,
-   "delete": 0,
-   "match": "",
-   "permlevel": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Sales Manager",
-   "submit": 0,
+   "amend": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "match": "", 
+   "permlevel": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Sales Manager", 
+   "submit": 0, 
    "write": 0
-  },
+  }, 
   {
-   "amend": 1,
-   "cancel": 1,
-   "create": 1,
-   "delete": 1,
-   "email": 1,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Sales Manager",
-   "share": 1,
-   "submit": 1,
+   "amend": 1, 
+   "cancel": 1, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Sales Manager", 
+   "share": 1, 
+   "submit": 1, 
    "write": 1
-  },
+  }, 
   {
-   "amend": 1,
-   "cancel": 1,
-   "create": 1,
-   "delete": 1,
-   "email": 1,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Maintenance Manager",
-   "share": 1,
-   "submit": 1,
+   "amend": 1, 
+   "cancel": 1, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Maintenance Manager", 
+   "share": 1, 
+   "submit": 1, 
    "write": 1
-  },
+  }, 
   {
-   "amend": 0,
-   "cancel": 0,
-   "create": 0,
-   "delete": 0,
-   "match": "",
-   "permlevel": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Maintenance Manager",
+   "amend": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "match": "", 
+   "permlevel": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Maintenance Manager", 
    "submit": 0
-  },
+  }, 
   {
-   "amend": 1,
-   "cancel": 1,
-   "create": 1,
-   "delete": 1,
-   "email": 1,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Maintenance User",
-   "share": 1,
-   "submit": 1,
+   "amend": 1, 
+   "cancel": 1, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Maintenance User", 
+   "share": 1, 
+   "submit": 1, 
    "write": 1
-  },
+  }, 
   {
-   "amend": 0,
-   "cancel": 0,
-   "create": 0,
-   "delete": 0,
-   "match": "",
-   "permlevel": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Maintenance User",
+   "amend": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "match": "", 
+   "permlevel": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Maintenance User", 
    "submit": 0
   }
- ],
- "read_only_onload": 1,
- "search_fields": "status,transaction_date,customer,lead,order_type",
- "sort_field": "modified",
- "sort_order": "DESC",
+ ], 
+ "read_only_onload": 1, 
+ "search_fields": "status,transaction_date,customer,lead,order_type", 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
  "title_field": "customer_name"
-}
+}
\ No newline at end of file
diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py
index 2c2b51b..100675e 100644
--- a/erpnext/selling/doctype/quotation/quotation.py
+++ b/erpnext/selling/doctype/quotation/quotation.py
@@ -79,7 +79,7 @@
 		self.check_item_table()
 
 		# Check for Approving Authority
-		frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.grand_total, self)
+		frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.base_grand_total, self)
 
 		#update enquiry status
 		self.update_opportunity()
diff --git a/erpnext/selling/doctype/quotation/quotation_list.js b/erpnext/selling/doctype/quotation/quotation_list.js
index 7481e98..add7aef 100644
--- a/erpnext/selling/doctype/quotation/quotation_list.js
+++ b/erpnext/selling/doctype/quotation/quotation_list.js
@@ -1,5 +1,5 @@
 frappe.listview_settings['Quotation'] = {
-	add_fields: ["customer_name", "grand_total", "status",
+	add_fields: ["customer_name", "base_grand_total", "status",
 		"company", "currency"],
 	get_indicator: function(doc) {
 		if(doc.status==="Ordered") {
diff --git a/erpnext/selling/doctype/quotation/test_records.json b/erpnext/selling/doctype/quotation/test_records.json
index 1dc4b07..212d59b 100644
--- a/erpnext/selling/doctype/quotation/test_records.json
+++ b/erpnext/selling/doctype/quotation/test_records.json
@@ -8,8 +8,8 @@
   "customer_name": "_Test Customer", 
   "doctype": "Quotation", 
   "fiscal_year": "_Test Fiscal Year 2013", 
+  "base_grand_total": 1000.0, 
   "grand_total": 1000.0, 
-  "grand_total_export": 1000.0, 
   "order_type": "Sales", 
   "plc_conversion_rate": 1.0, 
   "price_list_currency": "INR", 
diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json
index 16a9bb7..3bbe694 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.json
+++ b/erpnext/selling/doctype/sales_order/sales_order.json
@@ -1,1132 +1,1132 @@
 {
- "allow_import": 1, 
- "autoname": "naming_series:", 
- "creation": "2013-06-18 12:39:59", 
- "docstatus": 0, 
- "doctype": "DocType", 
- "document_type": "Transaction", 
+ "allow_import": 1,
+ "autoname": "naming_series:",
+ "creation": "2013-06-18 12:39:59",
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "Transaction",
  "fields": [
   {
-   "fieldname": "customer_section", 
-   "fieldtype": "Section Break", 
-   "label": "Customer", 
-   "options": "icon-user", 
+   "fieldname": "customer_section",
+   "fieldtype": "Section Break",
+   "label": "Customer",
+   "options": "icon-user",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "column_break0", 
-   "fieldtype": "Column Break", 
-   "in_filter": 0, 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
-   "search_index": 0, 
+   "fieldname": "column_break0",
+   "fieldtype": "Column Break",
+   "in_filter": 0,
+   "oldfieldtype": "Column Break",
+   "permlevel": 0,
+   "search_index": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "fieldname": "naming_series", 
-   "fieldtype": "Select", 
-   "label": "Series", 
-   "no_copy": 1, 
-   "oldfieldname": "naming_series", 
-   "oldfieldtype": "Select", 
-   "options": "SO-", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "naming_series",
+   "fieldtype": "Select",
+   "label": "Series",
+   "no_copy": 1,
+   "oldfieldname": "naming_series",
+   "oldfieldtype": "Select",
+   "options": "SO-",
+   "permlevel": 0,
+   "print_hide": 1,
    "reqd": 1
-  }, 
+  },
   {
-   "fieldname": "customer", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "in_list_view": 0, 
-   "label": "Customer", 
-   "oldfieldname": "customer", 
-   "oldfieldtype": "Link", 
-   "options": "Customer", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "reqd": 1, 
+   "fieldname": "customer",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "in_list_view": 0,
+   "label": "Customer",
+   "oldfieldname": "customer",
+   "oldfieldtype": "Link",
+   "options": "Customer",
+   "permlevel": 0,
+   "print_hide": 1,
+   "reqd": 1,
    "search_index": 1
-  }, 
+  },
   {
-   "fieldname": "customer_name", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "label": "Name", 
-   "permlevel": 0, 
+   "fieldname": "customer_name",
+   "fieldtype": "Data",
+   "hidden": 0,
+   "label": "Name",
+   "permlevel": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "address_display", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "label": "Address", 
-   "permlevel": 0, 
+   "fieldname": "address_display",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "label": "Address",
+   "permlevel": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "contact_display", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "label": "Contact", 
-   "permlevel": 0, 
+   "fieldname": "contact_display",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "label": "Contact",
+   "permlevel": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "contact_mobile", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "label": "Mobile No", 
-   "permlevel": 0, 
+   "fieldname": "contact_mobile",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "label": "Mobile No",
+   "permlevel": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "contact_email", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "label": "Contact Email", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "contact_email",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "label": "Contact Email",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "default": "Sales", 
-   "fieldname": "order_type", 
-   "fieldtype": "Select", 
-   "in_list_view": 0, 
-   "label": "Order Type", 
-   "oldfieldname": "order_type", 
-   "oldfieldtype": "Select", 
-   "options": "\nSales\nMaintenance\nShopping Cart", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "default": "Sales",
+   "fieldname": "order_type",
+   "fieldtype": "Select",
+   "in_list_view": 0,
+   "label": "Order Type",
+   "oldfieldname": "order_type",
+   "oldfieldtype": "Select",
+   "options": "\nSales\nMaintenance\nShopping Cart",
+   "permlevel": 0,
+   "print_hide": 1,
    "reqd": 1
-  }, 
+  },
   {
-   "fieldname": "column_break1", 
-   "fieldtype": "Column Break", 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
+   "fieldname": "column_break1",
+   "fieldtype": "Column Break",
+   "oldfieldtype": "Column Break",
+   "permlevel": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "fieldname": "amended_from", 
-   "fieldtype": "Link", 
-   "hidden": 1, 
-   "ignore_user_permissions": 1, 
-   "label": "Amended From", 
-   "no_copy": 1, 
-   "oldfieldname": "amended_from", 
-   "oldfieldtype": "Data", 
-   "options": "Sales Order", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
+   "fieldname": "amended_from",
+   "fieldtype": "Link",
+   "hidden": 1,
+   "ignore_user_permissions": 1,
+   "label": "Amended From",
+   "no_copy": 1,
+   "oldfieldname": "amended_from",
+   "oldfieldtype": "Data",
+   "options": "Sales Order",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
    "width": "150px"
-  }, 
+  },
   {
-   "description": "", 
-   "fieldname": "company", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "label": "Company", 
-   "oldfieldname": "company", 
-   "oldfieldtype": "Link", 
-   "options": "Company", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "reqd": 1, 
-   "search_index": 1, 
+   "description": "",
+   "fieldname": "company",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "label": "Company",
+   "oldfieldname": "company",
+   "oldfieldtype": "Link",
+   "options": "Company",
+   "permlevel": 0,
+   "print_hide": 1,
+   "reqd": 1,
+   "search_index": 1,
    "width": "150px"
-  }, 
+  },
   {
-   "default": "Today", 
-   "fieldname": "transaction_date", 
-   "fieldtype": "Date", 
-   "in_filter": 1, 
-   "label": "Date", 
-   "no_copy": 1, 
-   "oldfieldname": "transaction_date", 
-   "oldfieldtype": "Date", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "reqd": 1, 
-   "search_index": 1, 
+   "default": "Today",
+   "fieldname": "transaction_date",
+   "fieldtype": "Date",
+   "in_filter": 1,
+   "label": "Date",
+   "no_copy": 1,
+   "oldfieldname": "transaction_date",
+   "oldfieldtype": "Date",
+   "permlevel": 0,
+   "print_hide": 0,
+   "reqd": 1,
+   "search_index": 1,
    "width": "160px"
-  }, 
+  },
   {
-   "depends_on": "eval:doc.order_type == 'Sales'", 
-   "fieldname": "delivery_date", 
-   "fieldtype": "Date", 
-   "hidden": 0, 
-   "in_filter": 1, 
-   "label": "Delivery Date", 
-   "oldfieldname": "delivery_date", 
-   "oldfieldtype": "Date", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "reqd": 0, 
-   "search_index": 1, 
+   "depends_on": "eval:doc.order_type == 'Sales'",
+   "fieldname": "delivery_date",
+   "fieldtype": "Date",
+   "hidden": 0,
+   "in_filter": 1,
+   "label": "Delivery Date",
+   "oldfieldname": "delivery_date",
+   "oldfieldtype": "Date",
+   "permlevel": 0,
+   "print_hide": 1,
+   "reqd": 0,
+   "search_index": 1,
    "width": "160px"
-  }, 
+  },
   {
-   "description": "Customer's Purchase Order Number", 
-   "fieldname": "po_no", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "label": "PO No", 
-   "no_copy": 0, 
-   "oldfieldname": "po_no", 
-   "oldfieldtype": "Data", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "reqd": 0, 
+   "description": "Customer's Purchase Order Number",
+   "fieldname": "po_no",
+   "fieldtype": "Data",
+   "hidden": 0,
+   "label": "PO No",
+   "no_copy": 0,
+   "oldfieldname": "po_no",
+   "oldfieldtype": "Data",
+   "permlevel": 0,
+   "print_hide": 0,
+   "reqd": 0,
    "width": "100px"
-  }, 
+  },
   {
-   "depends_on": "eval:doc.po_no", 
-   "description": "Customer's Purchase Order Date", 
-   "fieldname": "po_date", 
-   "fieldtype": "Date", 
-   "hidden": 0, 
-   "label": "PO Date", 
-   "oldfieldname": "po_date", 
-   "oldfieldtype": "Date", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "reqd": 0, 
+   "depends_on": "eval:doc.po_no",
+   "description": "Customer's Purchase Order Date",
+   "fieldname": "po_date",
+   "fieldtype": "Date",
+   "hidden": 0,
+   "label": "PO Date",
+   "oldfieldname": "po_date",
+   "oldfieldtype": "Date",
+   "permlevel": 0,
+   "print_hide": 0,
+   "reqd": 0,
    "width": "100px"
-  }, 
+  },
   {
-   "fieldname": "shipping_address_name", 
-   "fieldtype": "Link", 
-   "hidden": 1, 
-   "in_filter": 1, 
-   "label": "Shipping Address Name", 
-   "options": "Address", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "shipping_address_name",
+   "fieldtype": "Link",
+   "hidden": 1,
+   "in_filter": 1,
+   "label": "Shipping Address Name",
+   "options": "Address",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "shipping_address", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "in_filter": 0, 
-   "label": "Shipping Address", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "shipping_address",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "in_filter": 0,
+   "label": "Shipping Address",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "currency_and_price_list", 
-   "fieldtype": "Section Break", 
-   "label": "Currency and Price List", 
-   "options": "icon-tag", 
-   "permlevel": 0, 
+   "fieldname": "currency_and_price_list",
+   "fieldtype": "Section Break",
+   "label": "Currency and Price List",
+   "options": "icon-tag",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "currency", 
-   "fieldtype": "Link", 
-   "label": "Currency", 
-   "oldfieldname": "currency", 
-   "oldfieldtype": "Select", 
-   "options": "Currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "reqd": 1, 
+   "fieldname": "currency",
+   "fieldtype": "Link",
+   "label": "Currency",
+   "oldfieldname": "currency",
+   "oldfieldtype": "Select",
+   "options": "Currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "reqd": 1,
    "width": "100px"
-  }, 
+  },
   {
-   "description": "Rate at which customer's currency is converted to company's base currency", 
-   "fieldname": "conversion_rate", 
-   "fieldtype": "Float", 
-   "label": "Exchange Rate", 
-   "oldfieldname": "conversion_rate", 
-   "oldfieldtype": "Currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "reqd": 1, 
+   "description": "Rate at which customer's currency is converted to company's base currency",
+   "fieldname": "conversion_rate",
+   "fieldtype": "Float",
+   "label": "Exchange Rate",
+   "oldfieldname": "conversion_rate",
+   "oldfieldtype": "Currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "reqd": 1,
    "width": "100px"
-  }, 
+  },
   {
-   "fieldname": "column_break2", 
-   "fieldtype": "Column Break", 
-   "permlevel": 0, 
+   "fieldname": "column_break2",
+   "fieldtype": "Column Break",
+   "permlevel": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "fieldname": "selling_price_list", 
-   "fieldtype": "Link", 
-   "label": "Price List", 
-   "oldfieldname": "price_list_name", 
-   "oldfieldtype": "Select", 
-   "options": "Price List", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "reqd": 1, 
+   "fieldname": "selling_price_list",
+   "fieldtype": "Link",
+   "label": "Price List",
+   "oldfieldname": "price_list_name",
+   "oldfieldtype": "Select",
+   "options": "Price List",
+   "permlevel": 0,
+   "print_hide": 1,
+   "reqd": 1,
    "width": "100px"
-  }, 
+  },
   {
-   "fieldname": "price_list_currency", 
-   "fieldtype": "Link", 
-   "label": "Price List Currency", 
-   "options": "Currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
+   "fieldname": "price_list_currency",
+   "fieldtype": "Link",
+   "label": "Price List Currency",
+   "options": "Currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
    "reqd": 1
-  }, 
+  },
   {
-   "description": "Rate at which Price list currency is converted to company's base currency", 
-   "fieldname": "plc_conversion_rate", 
-   "fieldtype": "Float", 
-   "label": "Price List Exchange Rate", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "description": "Rate at which Price list currency is converted to company's base currency",
+   "fieldname": "plc_conversion_rate",
+   "fieldtype": "Float",
+   "label": "Price List Exchange Rate",
+   "permlevel": 0,
+   "print_hide": 1,
    "reqd": 1
-  }, 
+  },
   {
-   "fieldname": "ignore_pricing_rule", 
-   "fieldtype": "Check", 
-   "label": "Ignore Pricing Rule", 
-   "no_copy": 1, 
-   "permlevel": 1, 
+   "fieldname": "ignore_pricing_rule",
+   "fieldtype": "Check",
+   "label": "Ignore Pricing Rule",
+   "no_copy": 1,
+   "permlevel": 1,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "items_section", 
-   "fieldtype": "Section Break", 
-   "label": "Items", 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-shopping-cart", 
+   "fieldname": "items_section",
+   "fieldtype": "Section Break",
+   "label": "Items",
+   "oldfieldtype": "Section Break",
+   "options": "icon-shopping-cart",
    "permlevel": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "fieldname": "items", 
-   "fieldtype": "Table", 
-   "label": "Items", 
-   "oldfieldname": "sales_order_details", 
-   "oldfieldtype": "Table", 
-   "options": "Sales Order Item", 
-   "permlevel": 0, 
-   "print_hide": 0, 
+   "allow_on_submit": 1,
+   "fieldname": "items",
+   "fieldtype": "Table",
+   "label": "Items",
+   "oldfieldname": "sales_order_details",
+   "oldfieldtype": "Table",
+   "options": "Sales Order Item",
+   "permlevel": 0,
+   "print_hide": 0,
    "reqd": 1
-  }, 
+  },
   {
-   "fieldname": "section_break_31", 
-   "fieldtype": "Section Break", 
+   "fieldname": "section_break_31",
+   "fieldtype": "Section Break",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "column_break_33a", 
-   "fieldtype": "Column Break", 
+   "fieldname": "column_break_33a",
+   "fieldtype": "Column Break",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "net_total", 
-   "fieldtype": "Currency", 
-   "label": "Net Total (Company Currency)", 
-   "oldfieldname": "net_total", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "reqd": 0, 
+   "fieldname": "base_net_total",
+   "fieldtype": "Currency",
+   "label": "Net Total (Company Currency)",
+   "oldfieldname": "net_total",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "reqd": 0,
    "width": "150px"
-  }, 
+  },
   {
-   "fieldname": "column_break_33", 
-   "fieldtype": "Column Break", 
+   "fieldname": "column_break_33",
+   "fieldtype": "Column Break",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "net_total_export", 
-   "fieldtype": "Currency", 
-   "label": "Net Total", 
-   "options": "currency", 
-   "permlevel": 0, 
+   "fieldname": "net_total",
+   "fieldtype": "Currency",
+   "label": "Net Total",
+   "options": "currency",
+   "permlevel": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "taxes_section", 
-   "fieldtype": "Section Break", 
-   "label": "Taxes and Charges", 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-money", 
-   "permlevel": 0, 
+   "fieldname": "taxes_section",
+   "fieldtype": "Section Break",
+   "label": "Taxes and Charges",
+   "oldfieldtype": "Section Break",
+   "options": "icon-money",
+   "permlevel": 0,
    "print_hide": 0
-  }, 
+  },
   {
-   "fieldname": "taxes_and_charges", 
-   "fieldtype": "Link", 
-   "label": "Taxes and Charges", 
-   "oldfieldname": "charge", 
-   "oldfieldtype": "Link", 
-   "options": "Sales Taxes and Charges Master", 
-   "permlevel": 0, 
+   "fieldname": "taxes_and_charges",
+   "fieldtype": "Link",
+   "label": "Taxes and Charges",
+   "oldfieldname": "charge",
+   "oldfieldtype": "Link",
+   "options": "Sales Taxes and Charges Master",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "column_break_38", 
-   "fieldtype": "Column Break", 
+   "fieldname": "column_break_38",
+   "fieldtype": "Column Break",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "shipping_rule", 
-   "fieldtype": "Link", 
-   "label": "Shipping Rule", 
-   "oldfieldtype": "Button", 
-   "options": "Shipping Rule", 
-   "permlevel": 0, 
+   "fieldname": "shipping_rule",
+   "fieldtype": "Link",
+   "label": "Shipping Rule",
+   "oldfieldtype": "Button",
+   "options": "Shipping Rule",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "section_break_40", 
-   "fieldtype": "Section Break", 
+   "fieldname": "section_break_40",
+   "fieldtype": "Section Break",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "taxes", 
-   "fieldtype": "Table", 
-   "label": "Sales Taxes and Charges", 
-   "oldfieldname": "other_charges", 
-   "oldfieldtype": "Table", 
-   "options": "Sales Taxes and Charges", 
+   "fieldname": "taxes",
+   "fieldtype": "Table",
+   "label": "Sales Taxes and Charges",
+   "oldfieldname": "other_charges",
+   "oldfieldtype": "Table",
+   "options": "Sales Taxes and Charges",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "other_charges_calculation", 
-   "fieldtype": "HTML", 
-   "label": "Taxes and Charges Calculation", 
-   "oldfieldtype": "HTML", 
-   "permlevel": 0, 
+   "fieldname": "other_charges_calculation",
+   "fieldtype": "HTML",
+   "label": "Taxes and Charges Calculation",
+   "oldfieldtype": "HTML",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "section_break_43", 
-   "fieldtype": "Section Break", 
+   "fieldname": "section_break_43",
+   "fieldtype": "Section Break",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "other_charges_total_export", 
-   "fieldtype": "Currency", 
-   "label": "Taxes and Charges Total", 
-   "options": "currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "total_taxes_and_charges",
+   "fieldtype": "Currency",
+   "label": "Total Taxes and Charges",
+   "options": "currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "other_charges_total", 
-   "fieldtype": "Currency", 
-   "label": "Taxes and Charges Total (Company Currency)", 
-   "oldfieldname": "other_charges_total", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
+   "fieldname": "base_total_taxes_and_charges",
+   "fieldtype": "Currency",
+   "label": "Total Taxes and Charges (Company Currency)",
+   "oldfieldname": "other_charges_total",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
    "width": "150px"
-  }, 
+  },
   {
-   "fieldname": "column_break_46", 
-   "fieldtype": "Column Break", 
+   "fieldname": "column_break_46",
+   "fieldtype": "Column Break",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "discount_amount", 
-   "fieldtype": "Currency", 
-   "label": "Discount Amount", 
-   "options": "currency", 
-   "permlevel": 0, 
+   "fieldname": "discount_amount",
+   "fieldtype": "Currency",
+   "label": "Discount Amount",
+   "options": "currency",
+   "permlevel": 0,
    "print_hide": 0
-  }, 
+  },
   {
-   "fieldname": "base_discount_amount", 
-   "fieldtype": "Currency", 
-   "label": "Discount Amount (Company Currency)", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
+   "fieldname": "base_discount_amount",
+   "fieldtype": "Currency",
+   "label": "Discount Amount (Company Currency)",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "totals", 
-   "fieldtype": "Section Break", 
-   "label": "Totals", 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-money", 
-   "permlevel": 0, 
+   "fieldname": "totals",
+   "fieldtype": "Section Break",
+   "label": "Totals",
+   "oldfieldtype": "Section Break",
+   "options": "icon-money",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "grand_total", 
-   "fieldtype": "Currency", 
-   "label": "Grand Total (Company Currency)", 
-   "oldfieldname": "grand_total", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "reqd": 0, 
+   "fieldname": "base_grand_total",
+   "fieldtype": "Currency",
+   "label": "Grand Total (Company Currency)",
+   "oldfieldname": "grand_total",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "reqd": 0,
    "width": "150px"
-  }, 
+  },
   {
-   "fieldname": "rounded_total", 
-   "fieldtype": "Currency", 
-   "label": "Rounded Total (Company Currency)", 
-   "oldfieldname": "rounded_total", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
+   "fieldname": "base_rounded_total",
+   "fieldtype": "Currency",
+   "label": "Rounded Total (Company Currency)",
+   "oldfieldname": "rounded_total",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
    "width": "150px"
-  }, 
+  },
   {
-   "description": "In Words will be visible once you save the Sales Order.", 
-   "fieldname": "in_words", 
-   "fieldtype": "Data", 
-   "label": "In Words (Company Currency)", 
-   "oldfieldname": "in_words", 
-   "oldfieldtype": "Data", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
+   "description": "In Words will be visible once you save the Sales Order.",
+   "fieldname": "base_in_words",
+   "fieldtype": "Data",
+   "label": "In Words (Company Currency)",
+   "oldfieldname": "in_words",
+   "oldfieldtype": "Data",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
    "width": "200px"
-  }, 
+  },
   {
-   "fieldname": "column_break3", 
-   "fieldtype": "Column Break", 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "column_break3",
+   "fieldtype": "Column Break",
+   "oldfieldtype": "Column Break",
+   "permlevel": 0,
+   "print_hide": 1,
    "width": "50%"
-  }, 
+  },
   {
-   "fieldname": "grand_total_export", 
-   "fieldtype": "Currency", 
-   "in_list_view": 1, 
-   "label": "Grand Total", 
-   "oldfieldname": "grand_total_export", 
-   "oldfieldtype": "Currency", 
-   "options": "currency", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 1, 
-   "reqd": 0, 
+   "fieldname": "grand_total",
+   "fieldtype": "Currency",
+   "in_list_view": 1,
+   "label": "Grand Total",
+   "oldfieldname": "grand_total_export",
+   "oldfieldtype": "Currency",
+   "options": "currency",
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 1,
+   "reqd": 0,
    "width": "150px"
-  }, 
+  },
   {
-   "fieldname": "rounded_total_export", 
-   "fieldtype": "Currency", 
-   "label": "Rounded Total", 
-   "oldfieldname": "rounded_total_export", 
-   "oldfieldtype": "Currency", 
-   "options": "currency", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 1, 
+   "fieldname": "rounded_total",
+   "fieldtype": "Currency",
+   "label": "Rounded Total",
+   "oldfieldname": "rounded_total_export",
+   "oldfieldtype": "Currency",
+   "options": "currency",
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 1,
    "width": "150px"
-  }, 
+  },
   {
-   "fieldname": "in_words_export", 
-   "fieldtype": "Data", 
-   "label": "In Words", 
-   "oldfieldname": "in_words_export", 
-   "oldfieldtype": "Data", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 1, 
+   "fieldname": "in_words",
+   "fieldtype": "Data",
+   "label": "In Words",
+   "oldfieldname": "in_words_export",
+   "oldfieldtype": "Data",
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 1,
    "width": "200px"
-  }, 
+  },
   {
-   "fieldname": "advance_paid", 
-   "fieldtype": "Currency", 
-   "label": "Advance Paid", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "advance_paid",
+   "fieldtype": "Currency",
+   "label": "Advance Paid",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "view_details", 
-   "fieldtype": "Fold", 
-   "label": "View Details", 
+   "fieldname": "view_details",
+   "fieldtype": "Fold",
+   "label": "View Details",
    "permlevel": 0
-  }, 
+  },
   {
-   "description": "Display all the individual items delivered with the main items", 
-   "fieldname": "packing_list", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "label": "Packing List", 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-suitcase", 
-   "permlevel": 0, 
+   "description": "Display all the individual items delivered with the main items",
+   "fieldname": "packing_list",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "label": "Packing List",
+   "oldfieldtype": "Section Break",
+   "options": "icon-suitcase",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "packed_items", 
-   "fieldtype": "Table", 
-   "label": "Packed Items", 
-   "oldfieldname": "packing_details", 
-   "oldfieldtype": "Table", 
-   "options": "Packed Item", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "packed_items",
+   "fieldtype": "Table",
+   "label": "Packed Items",
+   "oldfieldname": "packing_details",
+   "oldfieldtype": "Table",
+   "options": "Packed Item",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "terms_section_break", 
-   "fieldtype": "Section Break", 
-   "label": "Terms and Conditions", 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-legal", 
-   "permlevel": 0, 
+   "fieldname": "terms_section_break",
+   "fieldtype": "Section Break",
+   "label": "Terms and Conditions",
+   "oldfieldtype": "Section Break",
+   "options": "icon-legal",
+   "permlevel": 0,
    "print_hide": 0
-  }, 
+  },
   {
-   "fieldname": "tc_name", 
-   "fieldtype": "Link", 
-   "label": "Terms", 
-   "oldfieldname": "tc_name", 
-   "oldfieldtype": "Link", 
-   "options": "Terms and Conditions", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "tc_name",
+   "fieldtype": "Link",
+   "label": "Terms",
+   "oldfieldname": "tc_name",
+   "oldfieldtype": "Link",
+   "options": "Terms and Conditions",
+   "permlevel": 0,
+   "print_hide": 1,
    "search_index": 0
-  }, 
+  },
   {
-   "fieldname": "terms", 
-   "fieldtype": "Text Editor", 
-   "label": "Terms and Conditions Details", 
-   "oldfieldname": "terms", 
-   "oldfieldtype": "Text Editor", 
-   "permlevel": 0, 
+   "fieldname": "terms",
+   "fieldtype": "Text Editor",
+   "label": "Terms and Conditions Details",
+   "oldfieldname": "terms",
+   "oldfieldtype": "Text Editor",
+   "permlevel": 0,
    "print_hide": 0
-  }, 
+  },
   {
-   "depends_on": "customer", 
-   "fieldname": "contact_info", 
-   "fieldtype": "Section Break", 
-   "label": "Contact Info", 
-   "options": "icon-bullhorn", 
+   "depends_on": "customer",
+   "fieldname": "contact_info",
+   "fieldtype": "Section Break",
+   "label": "Contact Info",
+   "options": "icon-bullhorn",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "col_break45", 
-   "fieldtype": "Column Break", 
-   "permlevel": 0, 
+   "fieldname": "col_break45",
+   "fieldtype": "Column Break",
+   "permlevel": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "description": "", 
-   "fieldname": "territory", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "label": "Territory", 
-   "options": "Territory", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "reqd": 1, 
+   "description": "",
+   "fieldname": "territory",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "label": "Territory",
+   "options": "Territory",
+   "permlevel": 0,
+   "print_hide": 1,
+   "reqd": 1,
    "search_index": 1
-  }, 
+  },
   {
-   "description": "", 
-   "fieldname": "customer_group", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "label": "Customer Group", 
-   "options": "Customer Group", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "reqd": 1, 
+   "description": "",
+   "fieldname": "customer_group",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "label": "Customer Group",
+   "options": "Customer Group",
+   "permlevel": 0,
+   "print_hide": 1,
+   "reqd": 1,
    "search_index": 1
-  }, 
+  },
   {
-   "fieldname": "col_break46", 
-   "fieldtype": "Column Break", 
-   "permlevel": 0, 
+   "fieldname": "col_break46",
+   "fieldtype": "Column Break",
+   "permlevel": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "fieldname": "customer_address", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "in_filter": 1, 
-   "label": "Customer Address", 
-   "options": "Address", 
-   "permlevel": 0, 
+   "fieldname": "customer_address",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "in_filter": 1,
+   "label": "Customer Address",
+   "options": "Address",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "contact_person", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "label": "Contact Person", 
-   "options": "Contact", 
-   "permlevel": 0, 
+   "fieldname": "contact_person",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "label": "Contact Person",
+   "options": "Contact",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "more_info", 
-   "fieldtype": "Section Break", 
-   "label": "More Info", 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-file-text", 
-   "permlevel": 0, 
+   "fieldname": "more_info",
+   "fieldtype": "Section Break",
+   "label": "More Info",
+   "oldfieldtype": "Section Break",
+   "options": "icon-file-text",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "description": "Track this Sales Order against any Project", 
-   "fieldname": "project_name", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "label": "Project Name", 
-   "oldfieldname": "project_name", 
-   "oldfieldtype": "Link", 
-   "options": "Project", 
-   "permlevel": 0, 
+   "description": "Track this Sales Order against any Project",
+   "fieldname": "project_name",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "label": "Project Name",
+   "oldfieldname": "project_name",
+   "oldfieldtype": "Link",
+   "options": "Project",
+   "permlevel": 0,
    "search_index": 1
-  }, 
+  },
   {
-   "depends_on": "eval:doc.source == 'Campaign'", 
-   "fieldname": "campaign", 
-   "fieldtype": "Link", 
-   "label": "Campaign", 
-   "oldfieldname": "campaign", 
-   "oldfieldtype": "Link", 
-   "options": "Campaign", 
-   "permlevel": 0, 
+   "depends_on": "eval:doc.source == 'Campaign'",
+   "fieldname": "campaign",
+   "fieldtype": "Link",
+   "label": "Campaign",
+   "oldfieldname": "campaign",
+   "oldfieldtype": "Link",
+   "options": "Campaign",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "source", 
-   "fieldtype": "Select", 
-   "label": "Source", 
-   "oldfieldname": "source", 
-   "oldfieldtype": "Select", 
-   "options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign", 
-   "permlevel": 0, 
+   "fieldname": "source",
+   "fieldtype": "Select",
+   "label": "Source",
+   "oldfieldname": "source",
+   "oldfieldtype": "Select",
+   "options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "column_break4", 
-   "fieldtype": "Column Break", 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "column_break4",
+   "fieldtype": "Column Break",
+   "oldfieldtype": "Column Break",
+   "permlevel": 0,
+   "print_hide": 1,
    "width": "50%"
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "fieldname": "letter_head", 
-   "fieldtype": "Link", 
-   "label": "Letter Head", 
-   "oldfieldname": "letter_head", 
-   "oldfieldtype": "Select", 
-   "options": "Letter Head", 
-   "permlevel": 0, 
+   "allow_on_submit": 1,
+   "fieldname": "letter_head",
+   "fieldtype": "Link",
+   "label": "Letter Head",
+   "oldfieldname": "letter_head",
+   "oldfieldtype": "Select",
+   "options": "Letter Head",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "fieldname": "select_print_heading", 
-   "fieldtype": "Link", 
-   "label": "Print Heading", 
-   "no_copy": 1, 
-   "oldfieldname": "select_print_heading", 
-   "oldfieldtype": "Link", 
-   "options": "Print Heading", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "allow_on_submit": 1,
+   "fieldname": "select_print_heading",
+   "fieldtype": "Link",
+   "label": "Print Heading",
+   "no_copy": 1,
+   "oldfieldname": "select_print_heading",
+   "oldfieldtype": "Link",
+   "options": "Print Heading",
+   "permlevel": 0,
+   "print_hide": 1,
    "report_hide": 1
-  }, 
+  },
   {
-   "fieldname": "fiscal_year", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "label": "Fiscal Year", 
-   "oldfieldname": "fiscal_year", 
-   "oldfieldtype": "Select", 
-   "options": "Fiscal Year", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "reqd": 1, 
-   "search_index": 1, 
+   "fieldname": "fiscal_year",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "label": "Fiscal Year",
+   "oldfieldname": "fiscal_year",
+   "oldfieldtype": "Select",
+   "options": "Fiscal Year",
+   "permlevel": 0,
+   "print_hide": 1,
+   "reqd": 1,
+   "search_index": 1,
    "width": "150px"
-  }, 
+  },
   {
-   "fieldname": "section_break_78", 
-   "fieldtype": "Section Break", 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "section_break_78",
+   "fieldtype": "Section Break",
+   "oldfieldtype": "Column Break",
+   "permlevel": 0,
+   "print_hide": 1,
    "width": "50%"
-  }, 
+  },
   {
-   "default": "Draft", 
-   "fieldname": "status", 
-   "fieldtype": "Select", 
-   "in_filter": 1, 
-   "in_list_view": 1, 
-   "label": "Status", 
-   "no_copy": 1, 
-   "oldfieldname": "status", 
-   "oldfieldtype": "Select", 
-   "options": "\nDraft\nSubmitted\nStopped\nCancelled", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "reqd": 1, 
-   "search_index": 1, 
+   "default": "Draft",
+   "fieldname": "status",
+   "fieldtype": "Select",
+   "in_filter": 1,
+   "in_list_view": 1,
+   "label": "Status",
+   "no_copy": 1,
+   "oldfieldname": "status",
+   "oldfieldtype": "Select",
+   "options": "\nDraft\nSubmitted\nStopped\nCancelled",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "reqd": 1,
+   "search_index": 1,
    "width": "100px"
-  }, 
+  },
   {
-   "fieldname": "delivery_status", 
-   "fieldtype": "Select", 
-   "hidden": 1, 
-   "label": "Delivery Status", 
-   "no_copy": 1, 
-   "options": "Not Delivered\nFully Delivered\nPartly Delivered\nClosed\nNot Applicable", 
-   "permlevel": 0, 
+   "fieldname": "delivery_status",
+   "fieldtype": "Select",
+   "hidden": 1,
+   "label": "Delivery Status",
+   "no_copy": 1,
+   "options": "Not Delivered\nFully Delivered\nPartly Delivered\nClosed\nNot Applicable",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "depends_on": "eval:!doc.__islocal", 
-   "description": "% of materials delivered against this Sales Order", 
-   "fieldname": "per_delivered", 
-   "fieldtype": "Percent", 
-   "in_filter": 1, 
-   "in_list_view": 1, 
-   "label": "%  Delivered", 
-   "no_copy": 1, 
-   "oldfieldname": "per_delivered", 
-   "oldfieldtype": "Currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
+   "depends_on": "eval:!doc.__islocal",
+   "description": "% of materials delivered against this Sales Order",
+   "fieldname": "per_delivered",
+   "fieldtype": "Percent",
+   "in_filter": 1,
+   "in_list_view": 1,
+   "label": "%  Delivered",
+   "no_copy": 1,
+   "oldfieldname": "per_delivered",
+   "oldfieldtype": "Currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
    "width": "100px"
-  }, 
+  },
   {
-   "fieldname": "column_break_81", 
-   "fieldtype": "Column Break", 
+   "fieldname": "column_break_81",
+   "fieldtype": "Column Break",
    "permlevel": 0
-  }, 
+  },
   {
-   "depends_on": "eval:!doc.__islocal", 
-   "description": "% of materials billed against this Sales Order", 
-   "fieldname": "per_billed", 
-   "fieldtype": "Percent", 
-   "in_filter": 1, 
-   "in_list_view": 1, 
-   "label": "% Amount Billed", 
-   "no_copy": 1, 
-   "oldfieldname": "per_billed", 
-   "oldfieldtype": "Currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
+   "depends_on": "eval:!doc.__islocal",
+   "description": "% of materials billed against this Sales Order",
+   "fieldname": "per_billed",
+   "fieldtype": "Percent",
+   "in_filter": 1,
+   "in_list_view": 1,
+   "label": "% Amount Billed",
+   "no_copy": 1,
+   "oldfieldname": "per_billed",
+   "oldfieldtype": "Currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
    "width": "100px"
-  }, 
+  },
   {
-   "fieldname": "billing_status", 
-   "fieldtype": "Select", 
-   "hidden": 1, 
-   "label": "Billing Status", 
-   "no_copy": 1, 
-   "options": "Not Billed\nFully Billed\nPartly Billed\nClosed", 
-   "permlevel": 0, 
+   "fieldname": "billing_status",
+   "fieldtype": "Select",
+   "hidden": 1,
+   "label": "Billing Status",
+   "no_copy": 1,
+   "options": "Not Billed\nFully Billed\nPartly Billed\nClosed",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "sales_team_section_break", 
-   "fieldtype": "Section Break", 
-   "label": "Sales Team", 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-group", 
-   "permlevel": 0, 
+   "fieldname": "sales_team_section_break",
+   "fieldtype": "Section Break",
+   "label": "Sales Team",
+   "oldfieldtype": "Section Break",
+   "options": "icon-group",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "sales_partner", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "label": "Sales Partner", 
-   "oldfieldname": "sales_partner", 
-   "oldfieldtype": "Link", 
-   "options": "Sales Partner", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "search_index": 1, 
+   "fieldname": "sales_partner",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "label": "Sales Partner",
+   "oldfieldname": "sales_partner",
+   "oldfieldtype": "Link",
+   "options": "Sales Partner",
+   "permlevel": 0,
+   "print_hide": 1,
+   "search_index": 1,
    "width": "150px"
-  }, 
+  },
   {
-   "fieldname": "column_break7", 
-   "fieldtype": "Column Break", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "column_break7",
+   "fieldtype": "Column Break",
+   "permlevel": 0,
+   "print_hide": 1,
    "width": "50%"
-  }, 
+  },
   {
-   "fieldname": "commission_rate", 
-   "fieldtype": "Float", 
-   "label": "Commission Rate", 
-   "oldfieldname": "commission_rate", 
-   "oldfieldtype": "Currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "commission_rate",
+   "fieldtype": "Float",
+   "label": "Commission Rate",
+   "oldfieldname": "commission_rate",
+   "oldfieldtype": "Currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "width": "100px"
-  }, 
+  },
   {
-   "fieldname": "total_commission", 
-   "fieldtype": "Currency", 
-   "label": "Total Commission", 
-   "oldfieldname": "total_commission", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
+   "fieldname": "total_commission",
+   "fieldtype": "Currency",
+   "label": "Total Commission",
+   "oldfieldname": "total_commission",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "section_break1", 
-   "fieldtype": "Section Break", 
-   "permlevel": 0, 
+   "fieldname": "section_break1",
+   "fieldtype": "Section Break",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "sales_team", 
-   "fieldtype": "Table", 
-   "label": "Sales Team1", 
-   "oldfieldname": "sales_team", 
-   "oldfieldtype": "Table", 
-   "options": "Sales Team", 
-   "permlevel": 0, 
+   "fieldname": "sales_team",
+   "fieldtype": "Table",
+   "label": "Sales Team1",
+   "oldfieldname": "sales_team",
+   "oldfieldtype": "Table",
+   "options": "Sales Team",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "recurring_order", 
-   "fieldtype": "Section Break", 
-   "label": "Recurring Order", 
-   "options": "icon-time", 
+   "fieldname": "recurring_order",
+   "fieldtype": "Section Break",
+   "label": "Recurring Order",
+   "options": "icon-time",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "column_break82", 
-   "fieldtype": "Column Break", 
-   "label": "Column Break", 
+   "fieldname": "column_break82",
+   "fieldtype": "Column Break",
+   "label": "Column Break",
    "permlevel": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "depends_on": "eval:doc.docstatus<2", 
-   "description": "Check if recurring order, uncheck to stop recurring or put proper End Date", 
-   "fieldname": "is_recurring", 
-   "fieldtype": "Check", 
-   "label": "Is Recurring", 
-   "no_copy": 1, 
-   "permlevel": 0, 
+   "allow_on_submit": 1,
+   "depends_on": "eval:doc.docstatus<2",
+   "description": "Check if recurring order, uncheck to stop recurring or put proper End Date",
+   "fieldname": "is_recurring",
+   "fieldtype": "Check",
+   "label": "Is Recurring",
+   "no_copy": 1,
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "Select the period when the invoice will be generated automatically", 
-   "fieldname": "recurring_type", 
-   "fieldtype": "Select", 
-   "label": "Recurring Type", 
-   "no_copy": 1, 
-   "options": "\nMonthly\nQuarterly\nHalf-yearly\nYearly", 
-   "permlevel": 0, 
+   "allow_on_submit": 1,
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "Select the period when the invoice will be generated automatically",
+   "fieldname": "recurring_type",
+   "fieldtype": "Select",
+   "label": "Recurring Type",
+   "no_copy": 1,
+   "options": "\nMonthly\nQuarterly\nHalf-yearly\nYearly",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "Start date of current order's period", 
-   "fieldname": "from_date", 
-   "fieldtype": "Date", 
-   "label": "From Date", 
-   "no_copy": 1, 
+   "allow_on_submit": 1,
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "Start date of current order's period",
+   "fieldname": "from_date",
+   "fieldtype": "Date",
+   "label": "From Date",
+   "no_copy": 1,
    "permlevel": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "End date of current order's period", 
-   "fieldname": "to_date", 
-   "fieldtype": "Date", 
-   "label": "To Date", 
-   "no_copy": 1, 
+   "allow_on_submit": 1,
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "End date of current order's period",
+   "fieldname": "to_date",
+   "fieldtype": "Date",
+   "label": "To Date",
+   "no_copy": 1,
    "permlevel": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "The day of the month on which auto order will be generated e.g. 05, 28 etc ", 
-   "fieldname": "repeat_on_day_of_month", 
-   "fieldtype": "Int", 
-   "label": "Repeat on Day of Month", 
-   "no_copy": 1, 
-   "permlevel": 0, 
+   "allow_on_submit": 1,
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "The day of the month on which auto order will be generated e.g. 05, 28 etc ",
+   "fieldname": "repeat_on_day_of_month",
+   "fieldtype": "Int",
+   "label": "Repeat on Day of Month",
+   "no_copy": 1,
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "The date on which recurring order will be stop", 
-   "fieldname": "end_date", 
-   "fieldtype": "Date", 
-   "label": "End Date", 
-   "no_copy": 1, 
-   "permlevel": 0, 
+   "allow_on_submit": 1,
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "The date on which recurring order will be stop",
+   "fieldname": "end_date",
+   "fieldtype": "Date",
+   "label": "End Date",
+   "no_copy": 1,
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "column_break83", 
-   "fieldtype": "Column Break", 
-   "label": "Column Break", 
-   "permlevel": 0, 
+   "fieldname": "column_break83",
+   "fieldtype": "Column Break",
+   "label": "Column Break",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "The date on which next invoice will be generated. It is generated on submit.", 
-   "fieldname": "next_date", 
-   "fieldtype": "Date", 
-   "label": "Next Date", 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "The date on which next invoice will be generated. It is generated on submit.",
+   "fieldname": "next_date",
+   "fieldtype": "Date",
+   "label": "Next Date",
+   "no_copy": 1,
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "depends_on": "eval:doc.is_recurring==1", 
-   "fieldname": "recurring_id", 
-   "fieldtype": "Data", 
-   "label": "Recurring Id", 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "depends_on": "eval:doc.is_recurring==1",
+   "fieldname": "recurring_id",
+   "fieldtype": "Data",
+   "label": "Recurring Id",
+   "no_copy": 1,
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "Enter email id separated by commas, order will be mailed automatically on particular date", 
-   "fieldname": "notification_email_address", 
-   "fieldtype": "Small Text", 
-   "ignore_user_permissions": 0, 
-   "label": "Notification Email Address", 
-   "no_copy": 1, 
-   "permlevel": 0, 
+   "allow_on_submit": 1,
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "Enter email id separated by commas, order will be mailed automatically on particular date",
+   "fieldname": "notification_email_address",
+   "fieldtype": "Small Text",
+   "ignore_user_permissions": 0,
+   "label": "Notification Email Address",
+   "no_copy": 1,
+   "permlevel": 0,
    "print_hide": 1
   }
- ], 
- "icon": "icon-file-text", 
- "idx": 1, 
- "is_submittable": 1, 
- "issingle": 0, 
- "modified": "2015-02-05 05:11:45.731715", 
- "modified_by": "Administrator", 
- "module": "Selling", 
- "name": "Sales Order", 
- "owner": "Administrator", 
+ ],
+ "icon": "icon-file-text",
+ "idx": 1,
+ "is_submittable": 1,
+ "issingle": 0,
+ "modified": "2015-02-11 15:42:09.174504",
+ "modified_by": "Administrator",
+ "module": "Selling",
+ "name": "Sales Order",
+ "owner": "Administrator",
  "permissions": [
   {
-   "amend": 1, 
-   "apply_user_permissions": 1, 
-   "cancel": 1, 
-   "create": 1, 
-   "delete": 1, 
-   "email": 1, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Sales User", 
-   "share": 1, 
-   "submit": 1, 
+   "amend": 1,
+   "apply_user_permissions": 1,
+   "cancel": 1,
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Sales User",
+   "share": 1,
+   "submit": 1,
    "write": 1
-  }, 
+  },
   {
-   "amend": 1, 
-   "cancel": 1, 
-   "create": 1, 
-   "delete": 1, 
-   "email": 1, 
-   "export": 1, 
-   "import": 1, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Sales Manager", 
-   "set_user_permissions": 1, 
-   "share": 1, 
-   "submit": 1, 
+   "amend": 1,
+   "cancel": 1,
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "export": 1,
+   "import": 1,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Sales Manager",
+   "set_user_permissions": 1,
+   "share": 1,
+   "submit": 1,
    "write": 1
-  }, 
+  },
   {
-   "amend": 1, 
-   "apply_user_permissions": 1, 
-   "cancel": 1, 
-   "create": 1, 
-   "delete": 1, 
-   "email": 1, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Maintenance User", 
-   "share": 1, 
-   "submit": 1, 
+   "amend": 1,
+   "apply_user_permissions": 1,
+   "cancel": 1,
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Maintenance User",
+   "share": 1,
+   "submit": 1,
    "write": 1
-  }, 
+  },
   {
-   "apply_user_permissions": 1, 
-   "cancel": 0, 
-   "delete": 0, 
-   "email": 1, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
+   "apply_user_permissions": 1,
+   "cancel": 0,
+   "delete": 0,
+   "email": 1,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
    "role": "Accounts User"
-  }, 
+  },
   {
-   "apply_user_permissions": 1, 
-   "cancel": 0, 
-   "delete": 0, 
-   "email": 1, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
+   "apply_user_permissions": 1,
+   "cancel": 0,
+   "delete": 0,
+   "email": 1,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
    "role": "Customer"
-  }, 
+  },
   {
-   "apply_user_permissions": 1, 
-   "permlevel": 0, 
-   "read": 1, 
-   "report": 1, 
+   "apply_user_permissions": 1,
+   "permlevel": 0,
+   "read": 1,
+   "report": 1,
    "role": "Material User"
-  }, 
+  },
   {
-   "permlevel": 1, 
-   "read": 1, 
-   "role": "Sales Manager", 
+   "permlevel": 1,
+   "read": 1,
+   "role": "Sales Manager",
    "write": 1
   }
- ], 
- "read_only_onload": 1, 
- "search_fields": "status,transaction_date,customer,customer_name, territory,order_type,company", 
- "sort_field": "modified", 
- "sort_order": "DESC", 
+ ],
+ "read_only_onload": 1,
+ "search_fields": "status,transaction_date,customer,customer_name, territory,order_type,company",
+ "sort_field": "modified",
+ "sort_order": "DESC",
  "title_field": "customer_name"
-}
\ No newline at end of file
+}
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index d4b92e4..64523a9 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -142,7 +142,7 @@
 		self.check_credit_limit()
 		self.update_stock_ledger(update_stock = 1)
 
-		frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.grand_total, self)
+		frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.base_grand_total, self)
 
 		self.update_prevdoc_status('submit')
 		frappe.db.set(self, 'status', 'Submitted')
diff --git a/erpnext/selling/doctype/sales_order/sales_order_list.js b/erpnext/selling/doctype/sales_order/sales_order_list.js
index 36220c5..eef9162 100644
--- a/erpnext/selling/doctype/sales_order/sales_order_list.js
+++ b/erpnext/selling/doctype/sales_order/sales_order_list.js
@@ -1,5 +1,5 @@
 frappe.listview_settings['Sales Order'] = {
-	add_fields: ["grand_total", "customer_name", "currency", "delivery_date", "per_delivered", "per_billed",
+	add_fields: ["base_grand_total", "customer_name", "currency", "delivery_date", "per_delivered", "per_billed",
 		"status"],
 	get_indicator: function(doc) {
         if(doc.status==="Stopped") {
diff --git a/erpnext/selling/doctype/sales_order/test_records.json b/erpnext/selling/doctype/sales_order/test_records.json
index 0154d32..95a43b9 100644
--- a/erpnext/selling/doctype/sales_order/test_records.json
+++ b/erpnext/selling/doctype/sales_order/test_records.json
@@ -10,8 +10,8 @@
   "delivery_date": "2013-02-23", 
   "doctype": "Sales Order", 
   "fiscal_year": "_Test Fiscal Year 2013", 
+  "base_grand_total": 1000.0, 
   "grand_total": 1000.0, 
-  "grand_total_export": 1000.0, 
   "naming_series": "_T-Sales Order-", 
   "order_type": "Sales", 
   "plc_conversion_rate": 1.0, 
diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.json b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
index c906c48..640e992 100644
--- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json
+++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
@@ -415,7 +415,7 @@
  ], 
  "idx": 1, 
  "istable": 1, 
- "modified": "2015-01-01 14:29:59.458236", 
+ "modified": "2015-02-17 12:50:20.121459", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Sales Order Item", 
diff --git a/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py b/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py
index 1ec9871..bbf6163 100644
--- a/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py
+++ b/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py
@@ -17,7 +17,7 @@
 	if filters.get("company"):
 		company_condition = ' and company=%(company)s'
 
-	for si in frappe.db.sql("""select posting_date, customer, grand_total from `tabSales Invoice`
+	for si in frappe.db.sql("""select posting_date, customer, base_grand_total from `tabSales Invoice`
 		where docstatus=1 and posting_date <= %(to_date)s 
 		{company_condition} order by posting_date""".format(company_condition=company_condition), 
 		filters, as_dict=1):
@@ -26,12 +26,12 @@
 		if not si.customer in customers:
 			new_customers_in.setdefault(key, [0, 0.0])
 			new_customers_in[key][0] += 1
-			new_customers_in[key][1] += si.grand_total
+			new_customers_in[key][1] += si.base_grand_total
 			customers.append(si.customer)
 		else:
 			repeat_customers_in.setdefault(key, [0, 0.0])
 			repeat_customers_in[key][0] += 1
-			repeat_customers_in[key][1] += si.grand_total
+			repeat_customers_in[key][1] += si.base_grand_total
 			
 	# time series
 	from_year, from_month, temp = filters.get("from_date").split("-")
diff --git a/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py b/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py
index a87c4a1..5b1eb9b 100644
--- a/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py
+++ b/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py
@@ -30,10 +30,10 @@
 			cust.territory,
 			cust.customer_group,
 			count(distinct(so.name)) as 'num_of_order',
-			sum(net_total) as 'total_order_value',
+			sum(base_net_total) as 'total_order_value',
 			sum(if(so.status = "Stopped",
-				so.net_total * so.per_delivered/100,
-				so.net_total)) as 'total_order_considered',
+				so.base_net_total * so.per_delivered/100,
+				so.base_net_total)) as 'total_order_considered',
 			max(so.transaction_date) as 'last_sales_order_date',
 			DATEDIFF(CURDATE(), max(so.transaction_date)) as 'days_since_last_order'
 		from `tabCustomer` cust, `tabSales Order` so
@@ -42,7 +42,7 @@
 		order by 'days_since_last_order' desc """,as_list=1)
 
 def get_last_so_amt(customer):
-	res =  frappe.db.sql("""select net_total from `tabSales Order`
+	res =  frappe.db.sql("""select base_net_total from `tabSales Order`
 		where customer ='%(customer)s' and docstatus = 1 order by transaction_date desc
 		limit 1""" % {'customer':customer})
 
diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js
index dbea723..3a01ca0 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -3,9 +3,9 @@
 
 
 frappe.provide("erpnext.selling");
-frappe.require("assets/erpnext/js/transaction.js");
+frappe.require("assets/erpnext/js/controllers/transaction.js");
 
-{% include "public/js/controllers/accounts.js" %}
+{% include "public/js/controllers/accounts.js" %};
 
 cur_frm.email_field = "contact_email";
 
@@ -178,20 +178,20 @@
 	},
 
 	total_commission: function() {
-		if(this.frm.doc.net_total) {
-			frappe.model.round_floats_in(this.frm.doc, ["net_total", "total_commission"]);
+		if(this.frm.doc.base_net_total) {
+			frappe.model.round_floats_in(this.frm.doc, ["base_net_total", "total_commission"]);
 
-			if(this.frm.doc.net_total < this.frm.doc.total_commission) {
+			if(this.frm.doc.base_net_total < this.frm.doc.total_commission) {
 				var msg = (__("[Error]") + " " +
 					__(frappe.meta.get_label(this.frm.doc.doctype, "total_commission",
 						this.frm.doc.name)) + " > " +
-					__(frappe.meta.get_label(this.frm.doc.doctype, "net_total", this.frm.doc.name)));
+					__(frappe.meta.get_label(this.frm.doc.doctype, "base_net_total", this.frm.doc.name)));
 				msgprint(msg);
 				throw msg;
 			}
 
 			this.frm.set_value("commission_rate",
-				flt(this.frm.doc.total_commission * 100.0 / this.frm.doc.net_total));
+				flt(this.frm.doc.total_commission * 100.0 / this.frm.doc.base_net_total));
 		}
 	},
 
@@ -201,7 +201,7 @@
 		if(sales_person.allocated_percentage) {
 			sales_person.allocated_percentage = flt(sales_person.allocated_percentage,
 				precision("allocated_percentage", sales_person));
-			sales_person.allocated_amount = flt(this.frm.doc.net_total *
+			sales_person.allocated_amount = flt(this.frm.doc.base_net_total *
 				sales_person.allocated_percentage / 100.0,
 				precision("allocated_amount", sales_person));
 
@@ -233,185 +233,14 @@
 		}
 	},
 
-	calculate_taxes_and_totals: function(update_paid_amount) {
-		this._super();
-		this.calculate_total_advance("Sales Invoice", "advances", update_paid_amount);
-		this.calculate_commission();
-		this.calculate_contribution();
-
-		// TODO check for custom_recalc in custom scripts of server
-
-		this.frm.refresh_fields();
-	},
-
-	calculate_item_values: function() {
-		var me = this;
-
-		if (!this.discount_amount_applied) {
-			$.each(this.frm.doc["items"] || [], function(i, item) {
-				frappe.model.round_floats_in(item);
-				item.amount = flt(item.rate * item.qty, precision("amount", item));
-
-				me._set_in_company_currency(item, "price_list_rate", "base_price_list_rate");
-				me._set_in_company_currency(item, "rate", "base_rate");
-				me._set_in_company_currency(item, "amount", "base_amount");
-			});
-		}
-	},
-
-	determine_exclusive_rate: function() {
-		var me = this;
-		$.each(me.frm.doc["items"] || [], function(n, item) {
-			var item_tax_map = me._load_item_tax_rate(item.item_tax_rate);
-			var cumulated_tax_fraction = 0.0;
-
-			$.each(me.frm.doc["taxes"] || [], function(i, tax) {
-				tax.tax_fraction_for_current_item = me.get_current_tax_fraction(tax, item_tax_map);
-
-				if(i==0) {
-					tax.grand_total_fraction_for_current_item = 1 + tax.tax_fraction_for_current_item;
-				} else {
-					tax.grand_total_fraction_for_current_item =
-						me.frm.doc["taxes"][i-1].grand_total_fraction_for_current_item +
-						tax.tax_fraction_for_current_item;
-				}
-
-				cumulated_tax_fraction += tax.tax_fraction_for_current_item;
-			});
-
-			if(cumulated_tax_fraction && !me.discount_amount_applied) {
-				item.base_amount = flt(
-					(item.amount * me.frm.doc.conversion_rate) / (1 + cumulated_tax_fraction),
-					precision("base_amount", item));
-
-				item.base_rate = flt(item.base_amount / item.qty, precision("base_rate", item));
-
-				if(item.discount_percentage == 100) {
-					item.base_price_list_rate = item.base_rate;
-					item.base_rate = 0.0;
-				} else {
-					item.base_price_list_rate = flt(item.base_rate / (1 - item.discount_percentage / 100.0),
-						precision("base_price_list_rate", item));
-				}
-			}
-		});
-	},
-
-	get_current_tax_fraction: function(tax, item_tax_map) {
-		// Get tax fraction for calculating tax exclusive amount
-		// from tax inclusive amount
-		var current_tax_fraction = 0.0;
-
-		if(cint(tax.included_in_print_rate)) {
-			var tax_rate = this._get_tax_rate(tax, item_tax_map);
-
-			if(tax.charge_type == "On Net Total") {
-				current_tax_fraction = (tax_rate / 100.0);
-
-			} else if(tax.charge_type == "On Previous Row Amount") {
-				current_tax_fraction = (tax_rate / 100.0) *
-					this.frm.doc["taxes"][cint(tax.row_id) - 1].tax_fraction_for_current_item;
-
-			} else if(tax.charge_type == "On Previous Row Total") {
-				current_tax_fraction = (tax_rate / 100.0) *
-					this.frm.doc["taxes"][cint(tax.row_id) - 1].grand_total_fraction_for_current_item;
-			}
-		}
-
-		return current_tax_fraction;
-	},
-
-	calculate_net_total: function() {
-		var me = this;
-		this.frm.doc.net_total = this.frm.doc.net_total_export = 0.0;
-
-		$.each(this.frm.doc["items"] || [], function(i, item) {
-			me.frm.doc.net_total += item.base_amount;
-			me.frm.doc.net_total_export += item.amount;
-		});
-
-		frappe.model.round_floats_in(this.frm.doc, ["net_total", "net_total_export"]);
-	},
-
-	calculate_totals: function() {
-		var me = this;
-		var tax_count = this.frm.doc["taxes"] ? this.frm.doc["taxes"].length: 0;
-
-		this.frm.doc.grand_total = flt(tax_count ? this.frm.doc["taxes"][tax_count - 1].total : this.frm.doc.net_total);
-
-		this.frm.doc.other_charges_total = flt(this.frm.doc.grand_total - this.frm.doc.net_total,
-			precision("other_charges_total"));
-
-		this.frm.doc.grand_total_export = (this.frm.doc.other_charges_total || this.frm.doc.discount_amount) ?
-			flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total_export;
-
-		this.frm.doc.other_charges_total_export = flt(this.frm.doc.grand_total_export -
-			this.frm.doc.net_total_export + flt(this.frm.doc.discount_amount),
-			precision("other_charges_total_export"));
-
-		this.frm.doc.grand_total = flt(this.frm.doc.grand_total, precision("grand_total"));
-		this.frm.doc.grand_total_export = flt(this.frm.doc.grand_total_export, precision("grand_total_export"));
-
-		this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total);
-		this.frm.doc.rounded_total_export = Math.round(this.frm.doc.grand_total_export);
-	},
-
-	apply_discount_amount: function() {
-		var me = this;
-		var distributed_amount = 0.0;
-
-		if (this.frm.doc.discount_amount) {
-			this.frm.set_value("base_discount_amount",
-				flt(this.frm.doc.discount_amount * this.frm.doc.conversion_rate, precision("base_discount_amount")))
-
-			var grand_total_for_discount_amount = this.get_grand_total_for_discount_amount();
-			// calculate item amount after Discount Amount
-			if (grand_total_for_discount_amount) {
-				$.each(this.frm.doc["items"] || [], function(i, item) {
-					distributed_amount = flt(me.frm.doc.base_discount_amount) * item.base_amount / grand_total_for_discount_amount;
-					item.base_amount = flt(item.base_amount - distributed_amount, precision("base_amount", item));
-				});
-
-				this.discount_amount_applied = true;
-				this._calculate_taxes_and_totals();
-			}
-		} else {
-			this.frm.set_value("base_discount_amount", 0);
-		}
-	},
-
-	get_grand_total_for_discount_amount: function() {
-		var me = this;
-		var total_actual_tax = 0.0;
-		var actual_taxes_dict = {};
-
-		$.each(this.frm.doc["taxes"] || [], function(i, tax) {
-			if (tax.charge_type == "Actual")
-				actual_taxes_dict[tax.idx] = tax.tax_amount;
-			else if (actual_taxes_dict[tax.row_id] !== null) {
-				actual_tax_amount = flt(actual_taxes_dict[tax.row_id]) * flt(tax.rate) / 100;
-				actual_taxes_dict[tax.idx] = actual_tax_amount;
-			}
-		});
-
-		$.each(actual_taxes_dict, function(key, value) {
-			if (value)
-				total_actual_tax += value;
-		});
-
-		grand_total_for_discount_amount = flt(this.frm.doc.grand_total - total_actual_tax,
-			precision("grand_total"));
-		return grand_total_for_discount_amount;
-	},
-
 	calculate_outstanding_amount: function(update_paid_amount) {
 		// NOTE:
 		// paid_amount and write_off_amount is only for POS Invoice
 		// total_advance is only for non POS Invoice
 		if(this.frm.doc.doctype == "Sales Invoice" && this.frm.doc.docstatus==0) {
-			frappe.model.round_floats_in(this.frm.doc, ["grand_total", "total_advance", "write_off_amount",
+			frappe.model.round_floats_in(this.frm.doc, ["base_grand_total", "total_advance", "write_off_amount",
 				"paid_amount"]);
-			var total_amount_to_pay = this.frm.doc.grand_total - this.frm.doc.write_off_amount
+			var total_amount_to_pay = this.frm.doc.base_grand_total - this.frm.doc.write_off_amount
 				- this.frm.doc.total_advance;
 			if(this.frm.doc.is_pos) {
 				if(!this.frm.doc.paid_amount || update_paid_amount===undefined || update_paid_amount) {
@@ -437,7 +266,7 @@
 				throw msg;
 			}
 
-			this.frm.doc.total_commission = flt(this.frm.doc.net_total * this.frm.doc.commission_rate / 100.0,
+			this.frm.doc.total_commission = flt(this.frm.doc.base_net_total * this.frm.doc.commission_rate / 100.0,
 				precision("total_commission"));
 		}
 	},
@@ -448,17 +277,12 @@
 				frappe.model.round_floats_in(sales_person);
 				if(sales_person.allocated_percentage) {
 					sales_person.allocated_amount = flt(
-						me.frm.doc.net_total * sales_person.allocated_percentage / 100.0,
+						me.frm.doc.base_net_total * sales_person.allocated_percentage / 100.0,
 						precision("allocated_amount", sales_person));
 				}
 			});
 	},
 
-	_cleanup: function() {
-		this._super();
-		this.frm.doc.in_words = this.frm.doc.in_words_export = "";
-	},
-
 	shipping_rule: function() {
 		var me = this;
 		if(this.frm.doc.shipping_rule) {
@@ -512,13 +336,13 @@
 				}
 			});
 		};
-		setup_field_label_map(["net_total", "other_charges_total", "base_discount_amount", "grand_total",
-			"rounded_total", "in_words",
+		setup_field_label_map(["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_export", "other_charges_total_export", "discount_amount", "grand_total_export",
-			"rounded_total_export", "in_words_export"], this.frm.doc.currency);
+		setup_field_label_map(["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
 			+ " = [?] " + company_currency)
@@ -529,8 +353,8 @@
 		}
 
 		// toggle fields
-		this.frm.toggle_display(["conversion_rate", "net_total", "other_charges_total",
-			"grand_total", "rounded_total", "in_words", "base_discount_amount"],
+		this.frm.toggle_display(["conversion_rate", "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);
 
 		this.frm.toggle_display(["plc_conversion_rate", "price_list_currency"],
diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py
index 4e0d766..098a4a9 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.py
+++ b/erpnext/setup/doctype/email_digest/email_digest.py
@@ -247,15 +247,15 @@
 			date_field="transaction_date")
 
 	def get_new_quotations(self):
-		return self.get_new_sum("Quotation", self.meta.get_label("new_quotations"), "grand_total",
+		return self.get_new_sum("Quotation", self.meta.get_label("new_quotations"), "base_grand_total",
 			date_field="transaction_date")
 
 	def get_new_sales_orders(self):
-		return self.get_new_sum("Sales Order", self.meta.get_label("new_sales_orders"), "grand_total",
+		return self.get_new_sum("Sales Order", self.meta.get_label("new_sales_orders"), "base_grand_total",
 			date_field="transaction_date")
 
 	def get_new_delivery_notes(self):
-		return self.get_new_sum("Delivery Note", self.meta.get_label("new_delivery_notes"), "grand_total",
+		return self.get_new_sum("Delivery Note", self.meta.get_label("new_delivery_notes"), "base_grand_total",
 			date_field="posting_date")
 
 	def get_new_purchase_requests(self):
@@ -264,15 +264,15 @@
 
 	def get_new_supplier_quotations(self):
 		return self.get_new_sum("Supplier Quotation", self.meta.get_label("new_supplier_quotations"),
-			"grand_total", date_field="transaction_date")
+			"base_grand_total", date_field="transaction_date")
 
 	def get_new_purchase_orders(self):
 		return self.get_new_sum("Purchase Order", self.meta.get_label("new_purchase_orders"),
-			"grand_total", date_field="transaction_date")
+			"base_grand_total", date_field="transaction_date")
 
 	def get_new_purchase_receipts(self):
 		return self.get_new_sum("Purchase Receipt", self.meta.get_label("new_purchase_receipts"),
-			"grand_total", date_field="posting_date")
+			"base_grand_total", date_field="posting_date")
 
 	def get_new_stock_entries(self):
 		return self.get_new_sum("Stock Entry", self.meta.get_label("new_stock_entries"), "total_amount",
diff --git a/erpnext/setup/doctype/global_defaults/global_defaults.py b/erpnext/setup/doctype/global_defaults/global_defaults.py
index e67ba444..5f5bd6c 100644
--- a/erpnext/setup/doctype/global_defaults/global_defaults.py
+++ b/erpnext/setup/doctype/global_defaults/global_defaults.py
@@ -57,8 +57,8 @@
 
 		# Make property setters to hide rounded total fields
 		for doctype in ("Quotation", "Sales Order", "Sales Invoice", "Delivery Note"):
-			make_property_setter(doctype, "rounded_total", "hidden", self.disable_rounded_total, "Check")
-			make_property_setter(doctype, "rounded_total", "print_hide", 1, "Check")
+			make_property_setter(doctype, "base_rounded_total", "hidden", self.disable_rounded_total, "Check")
+			make_property_setter(doctype, "base_rounded_total", "print_hide", 1, "Check")
 
-			make_property_setter(doctype, "rounded_total_export", "hidden", self.disable_rounded_total, "Check")
-			make_property_setter(doctype, "rounded_total_export", "print_hide", self.disable_rounded_total, "Check")
+			make_property_setter(doctype, "rounded_total", "hidden", self.disable_rounded_total, "Check")
+			make_property_setter(doctype, "rounded_total", "print_hide", self.disable_rounded_total, "Check")
diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py
index 5b54485..7b83616 100644
--- a/erpnext/shopping_cart/cart.py
+++ b/erpnext/shopping_cart/cart.py
@@ -144,7 +144,7 @@
 		d["formatted_tax_amount"] = fmt_money(flt(d.get("tax_amount")) / doc.conversion_rate,
 			currency=doc.currency)
 
-	doc.formatted_grand_total_export = fmt_money(doc.grand_total_export,
+	doc.formatted_grand_total_export = fmt_money(doc.grand_total,
 		currency=doc.currency)
 
 	return doc
diff --git a/erpnext/shopping_cart/test_shopping_cart.py b/erpnext/shopping_cart/test_shopping_cart.py
index 9d124b7..00222bb 100644
--- a/erpnext/shopping_cart/test_shopping_cart.py
+++ b/erpnext/shopping_cart/test_shopping_cart.py
@@ -84,7 +84,7 @@
 		self.assertEquals(quotation.get("items")[0].item_code, "_Test Item")
 		self.assertEquals(quotation.get("items")[0].qty, 5)
 		self.assertEquals(quotation.get("items")[0].amount, 50)
-		self.assertEquals(quotation.net_total, 70)
+		self.assertEquals(quotation.base_net_total, 70)
 		self.assertEquals(len(quotation.get("items")), 2)
 
 	def test_remove_from_cart(self):
@@ -97,13 +97,13 @@
 		self.assertEquals(quotation.get("items")[0].item_code, "_Test Item 2")
 		self.assertEquals(quotation.get("items")[0].qty, 1)
 		self.assertEquals(quotation.get("items")[0].amount, 20)
-		self.assertEquals(quotation.net_total, 20)
+		self.assertEquals(quotation.base_net_total, 20)
 		self.assertEquals(len(quotation.get("items")), 1)
 
 		# remove second item
 		set_item_in_cart("_Test Item 2", 0)
 		quotation = self.test_get_cart_lead()
-		self.assertEquals(quotation.net_total, 0)
+		self.assertEquals(quotation.base_net_total, 0)
 		self.assertEquals(len(quotation.get("items")), 0)
 
 	def test_set_billing_address(self):
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json
index 4eb9357..d518e8c 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.json
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.json
@@ -341,7 +341,7 @@
    "permlevel": 0
   }, 
   {
-   "fieldname": "net_total", 
+   "fieldname": "base_net_total", 
    "fieldtype": "Currency", 
    "label": "Net Total (Company Currency)", 
    "no_copy": 0, 
@@ -361,7 +361,7 @@
    "permlevel": 0
   }, 
   {
-   "fieldname": "net_total_export", 
+   "fieldname": "net_total", 
    "fieldtype": "Currency", 
    "label": "Net Total", 
    "options": "currency", 
@@ -435,18 +435,18 @@
    "permlevel": 0
   }, 
   {
-   "fieldname": "other_charges_total_export", 
+   "fieldname": "total_taxes_and_charges", 
    "fieldtype": "Currency", 
-   "label": "Taxes and Charges Total", 
-   "options": "Company:company:default_currency", 
+   "label": "Total Taxes and Charges", 
+   "options": "currency", 
    "permlevel": 0, 
    "print_hide": 1, 
    "read_only": 1
   }, 
   {
-   "fieldname": "other_charges_total", 
+   "fieldname": "base_total_taxes_and_charges", 
    "fieldtype": "Currency", 
-   "label": "Taxes and Charges Total (Company Currency)", 
+   "label": "Total Taxes and Charges (Company Currency)", 
    "oldfieldname": "other_charges_total", 
    "oldfieldtype": "Currency", 
    "options": "Company:company:default_currency", 
@@ -489,7 +489,7 @@
    "read_only": 0
   }, 
   {
-   "fieldname": "grand_total", 
+   "fieldname": "base_grand_total", 
    "fieldtype": "Currency", 
    "label": "Grand Total (Company Currency)", 
    "no_copy": 0, 
@@ -504,7 +504,7 @@
    "width": "150px"
   }, 
   {
-   "fieldname": "rounded_total", 
+   "fieldname": "base_rounded_total", 
    "fieldtype": "Currency", 
    "label": "Rounded Total (Company Currency)", 
    "no_copy": 0, 
@@ -519,7 +519,7 @@
   }, 
   {
    "description": "In Words will be visible once you save the Delivery Note.", 
-   "fieldname": "in_words", 
+   "fieldname": "base_in_words", 
    "fieldtype": "Data", 
    "label": "In Words (Company Currency)", 
    "no_copy": 0, 
@@ -539,7 +539,7 @@
    "read_only": 0
   }, 
   {
-   "fieldname": "grand_total_export", 
+   "fieldname": "grand_total", 
    "fieldtype": "Currency", 
    "in_list_view": 1, 
    "label": "Grand Total", 
@@ -555,7 +555,7 @@
    "width": "150px"
   }, 
   {
-   "fieldname": "rounded_total_export", 
+   "fieldname": "rounded_total", 
    "fieldtype": "Currency", 
    "label": "Rounded Total", 
    "no_copy": 0, 
@@ -570,7 +570,7 @@
   }, 
   {
    "description": "In Words (Export) will be visible once you save the Delivery Note.", 
-   "fieldname": "in_words_export", 
+   "fieldname": "in_words", 
    "fieldtype": "Data", 
    "label": "In Words", 
    "no_copy": 0, 
@@ -1024,7 +1024,7 @@
  "idx": 1, 
  "in_create": 0, 
  "is_submittable": 1, 
- "modified": "2015-02-05 05:11:37.151596", 
+ "modified": "2015-02-11 15:45:06.803707", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Delivery Note", 
@@ -1110,7 +1110,7 @@
   }
  ], 
  "read_only_onload": 1, 
- "search_fields": "status,customer,customer_name, territory,grand_total", 
+ "search_fields": "status,customer,customer_name, territory,base_grand_total", 
  "sort_field": "modified", 
  "sort_order": "DESC", 
  "title_field": "customer_name"
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index 4c73b3b..ec45623 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -67,7 +67,7 @@
 
 		item_meta = frappe.get_meta("Delivery Note Item")
 		print_hide_fields = {
-			"parent": ["grand_total_export", "rounded_total_export", "in_words_export", "currency", "net_total_export"],
+			"parent": ["grand_total", "rounded_total", "in_words", "currency", "net_total"],
 			"items": ["rate", "amount", "price_list_rate", "discount_percentage"]
 		}
 
@@ -186,7 +186,7 @@
 		self.validate_packed_qty()
 
 		# Check for Approving Authority
-		frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.grand_total, self)
+		frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.base_grand_total, self)
 
 		# update delivered qty in sales order
 		self.update_prevdoc_status()
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note_list.js b/erpnext/stock/doctype/delivery_note/delivery_note_list.js
index 065f896..d30dec9 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note_list.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note_list.js
@@ -1,4 +1,4 @@
 frappe.listview_settings['Delivery Note'] = {
-	add_fields: ["customer", "customer_name", "grand_total", "per_installed",
-		"transporter_name", "grand_total_export"]
+	add_fields: ["customer", "customer_name", "base_grand_total", "per_installed",
+		"transporter_name", "grand_total"]
 };
diff --git a/erpnext/stock/doctype/delivery_note/test_records.json b/erpnext/stock/doctype/delivery_note/test_records.json
index 803e864..ff06637 100644
--- a/erpnext/stock/doctype/delivery_note/test_records.json
+++ b/erpnext/stock/doctype/delivery_note/test_records.json
@@ -24,10 +24,10 @@
   ], 
   "doctype": "Delivery Note", 
   "fiscal_year": "_Test Fiscal Year 2013", 
+  "base_grand_total": 500.0, 
   "grand_total": 500.0, 
-  "grand_total_export": 500.0, 
   "naming_series": "_T-Delivery Note-", 
-  "net_total": 500.0, 
+  "base_net_total": 500.0, 
   "plc_conversion_rate": 1.0, 
   "posting_date": "2013-02-21", 
   "posting_time": "9:00:00", 
diff --git a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js
index 1eb557f..09cfcfd 100644
--- a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js
+++ b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js
@@ -21,7 +21,7 @@
 
 		this.frm.add_fetch("purchase_receipt", "supplier", "supplier");
 		this.frm.add_fetch("purchase_receipt", "posting_date", "posting_date");
-		this.frm.add_fetch("purchase_receipt", "grand_total", "grand_total");
+		this.frm.add_fetch("purchase_receipt", "base_grand_total", "grand_total");
 
 	},
 
diff --git a/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py b/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py
index 4b0e23c..6345bec 100644
--- a/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py
+++ b/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py
@@ -80,7 +80,7 @@
 			"purchase_receipt": pr.name,
 			"supplier": pr.supplier,
 			"posting_date": pr.posting_date,
-			"grand_total": pr.grand_total
+			"grand_total": pr.base_grand_total
 		}])
 		lcv.set("taxes", [{
 			"description": "Insurance Charges",
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
index dc35407..4d4ad70 100755
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
@@ -229,7 +229,7 @@
    "permlevel": 0
   }, 
   {
-   "fieldname": "net_total", 
+   "fieldname": "base_net_total", 
    "fieldtype": "Currency", 
    "label": "Net Total (Company Currency)", 
    "oldfieldname": "net_total", 
@@ -257,7 +257,7 @@
    "permlevel": 0
   }, 
   {
-   "fieldname": "net_total_import", 
+   "fieldname": "net_total", 
    "fieldtype": "Currency", 
    "label": "Net Total", 
    "oldfieldname": "net_total_import", 
@@ -314,7 +314,7 @@
    "permlevel": 0
   }, 
   {
-   "fieldname": "other_charges_added", 
+   "fieldname": "base_taxes_and_charges_added", 
    "fieldtype": "Currency", 
    "label": "Taxes and Charges Added (Company Currency)", 
    "oldfieldname": "other_charges_added", 
@@ -325,7 +325,7 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "other_charges_deducted", 
+   "fieldname": "base_taxes_and_charges_deducted", 
    "fieldtype": "Currency", 
    "label": "Taxes and Charges Deducted (Company Currency)", 
    "oldfieldname": "other_charges_deducted", 
@@ -336,9 +336,9 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "total_tax", 
+   "fieldname": "base_total_taxes_and_charges", 
    "fieldtype": "Currency", 
-   "label": "Total Tax (Company Currency)", 
+   "label": "Total Taxes and Charges (Company Currency)", 
    "oldfieldname": "total_tax", 
    "oldfieldtype": "Currency", 
    "options": "Company:company:default_currency", 
@@ -347,7 +347,7 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "grand_total", 
+   "fieldname": "base_grand_total", 
    "fieldtype": "Currency", 
    "label": "Grand Total (Company Currency)", 
    "oldfieldname": "grand_total", 
@@ -358,7 +358,7 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "rounded_total", 
+   "fieldname": "base_rounded_total", 
    "fieldtype": "Currency", 
    "label": "Rounded Total (Company Currency)", 
    "oldfieldname": "rounded_total", 
@@ -370,7 +370,7 @@
   }, 
   {
    "description": "In Words will be visible once you save the Purchase Receipt.", 
-   "fieldname": "in_words", 
+   "fieldname": "base_in_words", 
    "fieldtype": "Data", 
    "label": "In Words (Company Currency)", 
    "oldfieldname": "in_words", 
@@ -387,7 +387,7 @@
    "width": "50%"
   }, 
   {
-   "fieldname": "other_charges_added_import", 
+   "fieldname": "taxes_and_charges_added", 
    "fieldtype": "Currency", 
    "label": "Taxes and Charges Added", 
    "oldfieldname": "other_charges_added_import", 
@@ -398,7 +398,7 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "other_charges_deducted_import", 
+   "fieldname": "taxes_and_charges_deducted", 
    "fieldtype": "Currency", 
    "label": "Taxes and Charges Deducted", 
    "oldfieldname": "other_charges_deducted_import", 
@@ -409,7 +409,15 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "grand_total_import", 
+   "fieldname": "total_taxes_and_charges", 
+   "fieldtype": "Currency", 
+   "label": "Total Taxes and Charges", 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": ""
+  }, 
+  {
+   "fieldname": "grand_total", 
    "fieldtype": "Currency", 
    "in_list_view": 1, 
    "label": "Grand Total", 
@@ -421,7 +429,7 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "in_words_import", 
+   "fieldname": "in_words", 
    "fieldtype": "Data", 
    "label": "In Words", 
    "oldfieldname": "in_words_import", 
@@ -767,7 +775,7 @@
  "icon": "icon-truck", 
  "idx": 1, 
  "is_submittable": 1, 
- "modified": "2015-02-05 05:11:43.969108", 
+ "modified": "2015-02-11 16:13:02.294088", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Purchase Receipt", 
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index 504c996..9395e84 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -212,7 +212,7 @@
 		purchase_controller = frappe.get_doc("Purchase Common")
 
 		# Check for Approving Authority
-		frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.grand_total)
+		frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.base_grand_total)
 
 		# Set status as Submitted
 		frappe.db.set(self, 'status', 'Submitted')
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt_list.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt_list.js
index 7869f7f..b0559ce 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt_list.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt_list.js
@@ -1,4 +1,4 @@
 frappe.listview_settings['Purchase Receipt'] = {
-	add_fields: ["supplier", "supplier_name", "grand_total", "is_subcontracted",
+	add_fields: ["supplier", "supplier_name", "base_grand_total", "is_subcontracted",
 		"transporter_name"]
 };
diff --git a/erpnext/stock/doctype/purchase_receipt/test_records.json b/erpnext/stock/doctype/purchase_receipt/test_records.json
index 47253ad..481bb17 100644
--- a/erpnext/stock/doctype/purchase_receipt/test_records.json
+++ b/erpnext/stock/doctype/purchase_receipt/test_records.json
@@ -6,9 +6,9 @@
   "currency": "INR", 
   "doctype": "Purchase Receipt", 
   "fiscal_year": "_Test Fiscal Year 2013", 
-  "grand_total": 720.0, 
+  "base_grand_total": 720.0, 
   "naming_series": "_T-Purchase Receipt-", 
-  "net_total": 500.0, 
+  "base_net_total": 500.0, 
   "taxes": [
    {
     "account_head": "_Test Account Shipping Charges - _TC", 
@@ -94,9 +94,9 @@
   "currency": "INR", 
   "doctype": "Purchase Receipt", 
   "fiscal_year": "_Test Fiscal Year 2013", 
-  "grand_total": 5000.0, 
+  "base_grand_total": 5000.0, 
   "is_subcontracted": "Yes", 
-  "net_total": 5000.0, 
+  "base_net_total": 5000.0, 
   "posting_date": "2013-02-12", 
   "posting_time": "15:33:30", 
   "items": [
diff --git a/erpnext/templates/includes/sale.html b/erpnext/templates/includes/sale.html
index e823248..6323995 100644
--- a/erpnext/templates/includes/sale.html
+++ b/erpnext/templates/includes/sale.html
@@ -55,7 +55,7 @@
 			<tr>
 				<td>Net Total</td>
 				<td width=40% style="text-align: right;">{{
-					frappe.utils.fmt_money(doc.net_total/doc.conversion_rate, currency=doc.currency)
+					frappe.utils.fmt_money(doc.base_net_total/doc.conversion_rate, currency=doc.currency)
 				}}</td>
 			</tr>
 			{%- for charge in doc.get({"doctype":"Sales Taxes and Charges"}) -%}
@@ -68,11 +68,11 @@
 			{%- endfor -%}
 			<tr>
 				<td>Grand Total</td>
-				<td style="text-align: right;">{{ frappe.utils.fmt_money(doc.grand_total_export, currency=doc.currency) }}</td>
+				<td style="text-align: right;">{{ frappe.utils.fmt_money(doc.grand_total, currency=doc.currency) }}</td>
 			</tr>
 			<tr style='font-weight: bold'>
 				<td>Rounded Total</td>
-				<td style="text-align: right;">{{ frappe.utils.fmt_money(doc.rounded_total_export, currency=doc.currency) }}</td>
+				<td style="text-align: right;">{{ frappe.utils.fmt_money(doc.rounded_total, currency=doc.currency) }}</td>
 			</tr>
 		</tbody>
 		</table>
diff --git a/erpnext/templates/includes/sales_transactions.html b/erpnext/templates/includes/sales_transactions.html
index e8717af..465f5ed 100644
--- a/erpnext/templates/includes/sales_transactions.html
+++ b/erpnext/templates/includes/sales_transactions.html
@@ -10,7 +10,7 @@
 
 <script>
 	var render = function(doc) {
-		doc.grand_total_export = format_currency(doc.grand_total_export, doc.currency);
+		doc.grand_total = format_currency(doc.grand_total, doc.currency);
 		if(!doc.status) doc.status = "";
 
 		$(repl('<a href="{{ page }}?name=%(name)s" class="list-group-item">\
@@ -20,7 +20,7 @@
 						<div class="row col-md-12 text-muted">%(items)s</div>\
 						<div class="row col-md-12">%(status)s</div>\
 					</div>\
-					<div class="col-md-3 text-right">%(grand_total_export)s</div>\
+					<div class="col-md-3 text-right">%(grand_total)s</div>\
 					<div class="col-md-3 text-right text-muted">%(creation)s</div>\
 				</div>\
 			</a>', doc)).appendTo($list);
diff --git a/erpnext/templates/utils.py b/erpnext/templates/utils.py
index 139e63a..9108acf 100644
--- a/erpnext/templates/utils.py
+++ b/erpnext/templates/utils.py
@@ -33,7 +33,7 @@
 		else:
 			additional_fields = ""
 
-		transactions = frappe.db.sql("""select name, creation, currency, grand_total_export
+		transactions = frappe.db.sql("""select name, creation, currency, grand_total
 			%s
 			from `tab%s` where customer=%s and docstatus=1
 			order by creation desc