fixes for base_rate, base_amount, tax_amount: mass search and replace
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 4e0570f..a289c03 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -275,36 +275,36 @@
 		# tax table gl entries
 		valuation_tax = {}
 		for tax in self.get("taxes"):
-			if tax.category in ("Total", "Valuation and Total") and flt(tax.tax_amount):
+			if tax.category in ("Total", "Valuation and Total") and flt(tax.base_tax_amount_after_discount_amount):
 				gl_entries.append(
 					self.get_gl_dict({
 						"account": tax.account_head,
 						"against": self.credit_to,
-						"debit": tax.add_deduct_tax == "Add" and tax.tax_amount or 0,
-						"credit": tax.add_deduct_tax == "Deduct" and tax.tax_amount or 0,
+						"debit": tax.add_deduct_tax == "Add" and tax.base_tax_amount_after_discount_amount or 0,
+						"credit": tax.add_deduct_tax == "Deduct" and tax.base_tax_amount_after_discount_amount or 0,
 						"remarks": self.remarks,
 						"cost_center": tax.cost_center
 					})
 				)
 
 			# accumulate valuation tax
-			if tax.category in ("Valuation", "Valuation and Total") and flt(tax.tax_amount):
+			if tax.category in ("Valuation", "Valuation and Total") and flt(tax.base_tax_amount_after_discount_amount):
 				if auto_accounting_for_stock and not tax.cost_center:
 					frappe.throw(_("Cost Center is required in row {0} in Taxes table for type {1}").format(tax.idx, _(tax.category)))
 				valuation_tax.setdefault(tax.cost_center, 0)
 				valuation_tax[tax.cost_center] += \
-					(tax.add_deduct_tax == "Add" and 1 or -1) * flt(tax.tax_amount)
+					(tax.add_deduct_tax == "Add" and 1 or -1) * flt(tax.base_tax_amount_after_discount_amount)
 
 		# item gl entries
 		negative_expense_to_be_booked = 0.0
 		stock_items = self.get_stock_items()
 		for item in self.get("items"):
-			if flt(item.base_amount):
+			if flt(item.base_net_amount):
 				gl_entries.append(
 					self.get_gl_dict({
 						"account": item.expense_account,
 						"against": self.credit_to,
-						"debit": item.base_amount,
+						"debit": item.base_net_amount,
 						"remarks": self.remarks,
 						"cost_center": item.cost_center
 					})
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index f3ff9e1..3b901c4 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -496,12 +496,12 @@
 
 	def make_tax_gl_entries(self, gl_entries):
 		for tax in self.get("taxes"):
-			if flt(tax.tax_amount_after_discount_amount):
+			if flt(tax.base_tax_amount_after_discount_amount):
 				gl_entries.append(
 					self.get_gl_dict({
 						"account": tax.account_head,
 						"against": self.debit_to,
-						"credit": flt(tax.tax_amount_after_discount_amount),
+						"credit": flt(tax.base_tax_amount_after_discount_amount),
 						"remarks": self.remarks,
 						"cost_center": tax.cost_center
 					})
@@ -510,12 +510,12 @@
 	def make_item_gl_entries(self, gl_entries):
 		# income account gl entries
 		for item in self.get("items"):
-			if flt(item.base_amount):
+			if flt(item.base_net_amount):
 				gl_entries.append(
 					self.get_gl_dict({
 						"account": item.income_account,
 						"against": self.debit_to,
-						"credit": item.base_amount,
+						"credit": item.base_net_amount,
 						"remarks": self.remarks,
 						"cost_center": item.cost_center
 					})
diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py
index d212965..7ea9af9 100644
--- a/erpnext/accounts/report/gross_profit/gross_profit.py
+++ b/erpnext/accounts/report/gross_profit/gross_profit.py
@@ -95,7 +95,7 @@
 			if self.skip_row(row, self.sales_boms):
 				continue
 
-			row.selling_amount = flt(row.base_amount)
+			row.selling_amount = flt(row.base_net_amount)
 
 			sales_boms = self.sales_boms.get(row.parenttype, {}).get(row.name, frappe._dict())
 
@@ -175,7 +175,7 @@
 		# sorted by posting_date desc, posting_time desc
 		if item_code in self.non_stock_items:
 			# average purchasing rate for non-stock items
-			item_rate = frappe.db.sql("""select sum(base_amount) / sum(qty)
+			item_rate = frappe.db.sql("""select sum(base_net_amount) / sum(qty)
 				from `tabPurchase Invoice Item`
 				where item_code = %s and docstatus=1""", item_code)
 
@@ -211,7 +211,7 @@
 				si.customer, si.customer_group, si.territory,
 				item.item_code, item.item_name, item.description, item.warehouse,
 				item.item_group, item.brand, item.dn_detail, item.delivery_note,
-				item.qty, item.base_rate, item.base_amount, item.name as "item_row",
+				item.qty, item.base_net_rate, item.base_net_amount, item.name as "item_row",
 				sales.sales_person, sales.sales_designation, sales.allocated_amount,
 				sales.incentives
 			from `tabSales Invoice` si
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 27f1249..4a8427e 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
@@ -28,13 +28,13 @@
 		expense_account = d.expense_account or aii_account_map.get(d.company)
 		row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.supplier,
 			d.supplier_name, d.credit_to, d.project_name, d.company, d.purchase_order,
-			purchase_receipt, expense_account, d.qty, d.base_rate, d.base_amount]
+			purchase_receipt, expense_account, d.qty, d.base_net_rate, d.base_net_amount]
 
 		for tax in tax_accounts:
 			row.append(item_tax.get(d.parent, {}).get(d.item_code, {}).get(tax, 0))
 
 		total_tax = sum(row[last_col:])
-		row += [total_tax, d.base_amount + total_tax]
+		row += [total_tax, d.base_net_amount + total_tax]
 
 		data.append(row)
 
@@ -70,7 +70,7 @@
 	return frappe.db.sql("""select pi_item.parent, pi.posting_date, pi.credit_to, pi.company,
 		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
+		pi_item.expense_account, pi_item.qty, pi_item.base_net_rate, pi_item.base_net_amount, pi.supplier_name
 		from `tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item
 		where pi.name = pi_item.parent and pi.docstatus = 1 %s %s
 		order by pi.posting_date desc, pi_item.item_code desc""" % (conditions, match_conditions), filters, as_dict=1)
@@ -86,7 +86,7 @@
 	for d in item_list:
 		invoice_wise_items.setdefault(d.parent, []).append(d)
 
-	tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail, charge_type, tax_amount
+	tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail, charge_type, base_tax_amount_after_discount_amount
 		from `tabPurchase Taxes and Charges` where parenttype = 'Purchase Invoice'
 		and docstatus = 1 and ifnull(account_head, '') != '' and category in ('Total', 'Valuation and Total')
 		and parent in (%s)""" % ', '.join(['%s']*len(invoice_wise_items)), tuple(invoice_wise_items.keys()))
@@ -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.base_net_total
+					(tax_amount * d.base_net_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 fef397f..524773e 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
@@ -26,13 +26,13 @@
 
 		row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.customer, d.customer_name,
 			d.customer_group, d.debit_to, d.territory, d.project_name, d.company, d.sales_order,
-			delivery_note, d.income_account, d.qty, d.base_rate, d.base_amount]
+			delivery_note, d.income_account, d.qty, d.base_net_rate, d.base_net_amount]
 
 		for tax in tax_accounts:
 			row.append(item_tax.get(d.parent, {}).get(d.item_code, {}).get(tax, 0))
 
 		total_tax = sum(row[last_col:])
-		row += [total_tax, d.base_amount + total_tax]
+		row += [total_tax, d.base_net_amount + total_tax]
 
 		data.append(row)
 
@@ -69,7 +69,7 @@
 	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.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_item.qty, si_item.base_net_rate, si_item.base_net_amount, si.customer_name,
 		si.customer_group, si_item.so_detail
 		from `tabSales Invoice` si, `tabSales Invoice Item` si_item
 		where si.name = si_item.parent and si.docstatus = 1 %s
@@ -83,7 +83,8 @@
 	for d in item_list:
 		invoice_wise_items.setdefault(d.parent, []).append(d)
 
-	tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail, charge_type, tax_amount
+	tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail,
+		charge_type, base_tax_amount_after_discount_amount
 		from `tabSales Taxes and Charges` where parenttype = 'Sales Invoice'
 		and docstatus = 1 and ifnull(account_head, '') != ''
 		and parent in (%s)""" % ', '.join(['%s']*len(invoice_wise_items)),
@@ -104,7 +105,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.base_net_total)
+					flt((tax_amount * d.base_net_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 724b678..1e92733 100644
--- a/erpnext/accounts/report/purchase_register/purchase_register.py
+++ b/erpnext/accounts/report/purchase_register/purchase_register.py
@@ -114,7 +114,7 @@
 
 
 def get_invoice_expense_map(invoice_list):
-	expense_details = frappe.db.sql("""select parent, expense_account, sum(base_amount) as amount
+	expense_details = frappe.db.sql("""select parent, expense_account, sum(base_net_amount) as amount
 		from `tabPurchase Invoice Item` where parent in (%s) group by parent, expense_account""" %
 		', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
 
@@ -126,7 +126,7 @@
 	return invoice_expense_map
 
 def get_invoice_tax_map(invoice_list, invoice_expense_map, expense_accounts):
-	tax_details = frappe.db.sql("""select parent, account_head, sum(tax_amount) as tax_amount
+	tax_details = frappe.db.sql("""select parent, account_head, sum(base_tax_amount_after_discount_amount) as tax_amount
 		from `tabPurchase Taxes and Charges` where parent in (%s) group by parent, account_head""" %
 		', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
 
diff --git a/erpnext/accounts/report/sales_register/sales_register.py b/erpnext/accounts/report/sales_register/sales_register.py
index 3bd82b6..5fa03f7 100644
--- a/erpnext/accounts/report/sales_register/sales_register.py
+++ b/erpnext/accounts/report/sales_register/sales_register.py
@@ -78,7 +78,7 @@
 
 		tax_accounts = 	frappe.db.sql_list("""select distinct account_head
 			from `tabSales Taxes and Charges` where parenttype = 'Sales Invoice'
-			and docstatus = 1 and ifnull(tax_amount_after_discount_amount, 0) != 0
+			and docstatus = 1 and ifnull(base_tax_amount_after_discount_amount, 0) != 0
 			and parent in (%s) order by account_head""" %
 			', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]))
 
@@ -113,7 +113,7 @@
 		conditions, filters, as_dict=1)
 
 def get_invoice_income_map(invoice_list):
-	income_details = frappe.db.sql("""select parent, income_account, sum(base_amount) as amount
+	income_details = frappe.db.sql("""select parent, income_account, sum(base_net_amount) as amount
 		from `tabSales Invoice Item` where parent in (%s) group by parent, income_account""" %
 		', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
 
@@ -126,7 +126,7 @@
 
 def get_invoice_tax_map(invoice_list, invoice_income_map, income_accounts):
 	tax_details = frappe.db.sql("""select parent, account_head,
-		sum(tax_amount_after_discount_amount) as tax_amount
+		sum(base_tax_amount_after_discount_amount) as tax_amount
 		from `tabSales Taxes and Charges` where parent in (%s) group by parent, account_head""" %
 		', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
 
diff --git a/erpnext/buying/page/purchase_analytics/purchase_analytics.js b/erpnext/buying/page/purchase_analytics/purchase_analytics.js
index 470e44c..6afad76 100644
--- a/erpnext/buying/page/purchase_analytics/purchase_analytics.js
+++ b/erpnext/buying/page/purchase_analytics/purchase_analytics.js
@@ -209,7 +209,7 @@
 				if (posting_date >= from_date && posting_date <= to_date) {
 					var item = me.item_by_name[tl[me.tree_grid.item_key]] ||
 						me.item_by_name['Not Set'];
-					item[me.column_map[tl.posting_date].field] += (is_val ? tl.base_amount : tl.qty);
+					item[me.column_map[tl.posting_date].field] += (is_val ? tl.base_net_amount : tl.qty);
 				}
 			}
 		});
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index 4e4e507..7d01f81 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -94,16 +94,16 @@
 		for d in self.get(parentfield):
 			if d.item_code and d.item_code in stock_items:
 				stock_items_qty += flt(d.qty)
-				stock_items_amount += flt(d.base_amount)
+				stock_items_amount += flt(d.base_net_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.base_tax_amount_after_discount_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:
-				item_proportion = flt(item.base_amount) / stock_items_amount if stock_items_amount \
+				item_proportion = flt(item.base_net_amount) / stock_items_amount if stock_items_amount \
 					else flt(item.qty) / stock_items_qty
 
 				if i == (last_stock_item_idx - 1):
@@ -124,7 +124,7 @@
 				landed_cost_voucher_amount = flt(item.landed_cost_voucher_amount) \
 					if self.doctype == "Purchase Receipt" else 0.0
 
-				item.valuation_rate = ((item.base_amount + item.item_tax_amount + rm_supp_cost
+				item.valuation_rate = ((item.base_net_amount + item.item_tax_amount + rm_supp_cost
 					 + landed_cost_voucher_amount) / qty_in_stock_uom)
 			else:
 				item.valuation_rate = 0.0
diff --git a/erpnext/controllers/trends.py b/erpnext/controllers/trends.py
index c2d5e00..dc7039e 100644
--- a/erpnext/controllers/trends.py
+++ b/erpnext/controllers/trends.py
@@ -132,9 +132,9 @@
 	else:
 		pwc = [_(filters.get("fiscal_year")) + " ("+_("Qty") + "):Float:120",
 			_(filters.get("fiscal_year")) + " ("+ _("Amt") + "):Currency:120"]
-		query_details = " SUM(t2.qty), SUM(t2.base_amount),"
+		query_details = " SUM(t2.qty), SUM(t2.base_net_amount),"
 
-	query_details += 'SUM(t2.qty), SUM(t2.base_amount)'
+	query_details += 'SUM(t2.qty), SUM(t2.base_net_amount)'
 	return pwc, query_details
 
 def get_period_wise_columns(bet_dates, period, pwc):
@@ -147,7 +147,7 @@
 
 def get_period_wise_query(bet_dates, trans_date, query_details):
 	query_details += """SUM(IF(t1.%(trans_date)s BETWEEN '%(sd)s' AND '%(ed)s', t2.qty, NULL)),
-					SUM(IF(t1.%(trans_date)s BETWEEN '%(sd)s' AND '%(ed)s', t2.base_amount, NULL)),
+					SUM(IF(t1.%(trans_date)s BETWEEN '%(sd)s' AND '%(ed)s', t2.base_net_amount, NULL)),
 				""" % {"trans_date": trans_date, "sd": bet_dates[0],"ed": bet_dates[1]}
 	return query_details
 
diff --git a/erpnext/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py b/erpnext/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py
index 538b7ed..9146e42 100644
--- a/erpnext/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py
+++ b/erpnext/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py
@@ -13,19 +13,19 @@
 
 	data = []
 	for project in proj_details:
-		data.append([project.name, pr_item_map.get(project.name, 0), 
-			se_item_map.get(project.name, 0), dn_item_map.get(project.name, 0), 
-			project.project_name, project.status, project.company, 
-			project.customer, project.project_value, project.project_start_date, 
+		data.append([project.name, pr_item_map.get(project.name, 0),
+			se_item_map.get(project.name, 0), dn_item_map.get(project.name, 0),
+			project.project_name, project.status, project.company,
+			project.customer, project.project_value, project.project_start_date,
 			project.completion_date])
 
-	return columns, data 
+	return columns, data
 
 def get_columns():
 	return [_("Project Id") + ":Link/Project:140", _("Cost of Purchased Items") + ":Currency:160",
-		_("Cost of Issued Items") + ":Currency:160", _("Cost of Delivered Items") + ":Currency:160", 
-		_("Project Name") + "::120", _("Project Status") + "::120", _("Company") + ":Link/Company:100", 
-		_("Customer") + ":Link/Customer:140", _("Project Value") + ":Currency:120", 
+		_("Cost of Issued Items") + ":Currency:160", _("Cost of Delivered Items") + ":Currency:160",
+		_("Project Name") + "::120", _("Project Status") + "::120", _("Company") + ":Link/Company:100",
+		_("Customer") + ":Link/Customer:140", _("Project Value") + ":Currency:120",
 		_("Project Start Date") + ":Date:120", _("Completion Date") + ":Date:120"]
 
 def get_project_details():
@@ -33,8 +33,8 @@
 		project_start_date, completion_date from tabProject where docstatus < 2""", as_dict=1)
 
 def get_purchased_items_cost():
-	pr_items = frappe.db.sql("""select project_name, sum(base_amount) as amount
-		from `tabPurchase Receipt Item` where ifnull(project_name, '') != '' 
+	pr_items = frappe.db.sql("""select project_name, sum(base_net_amount) as amount
+		from `tabPurchase Receipt Item` where ifnull(project_name, '') != ''
 		and docstatus = 1 group by project_name""", as_dict=1)
 
 	pr_item_map = {}
@@ -46,7 +46,7 @@
 def get_issued_items_cost():
 	se_items = frappe.db.sql("""select se.project_name, sum(se_item.amount) as amount
 		from `tabStock Entry` se, `tabStock Entry Detail` se_item
-		where se.name = se_item.parent and se.docstatus = 1 and ifnull(se_item.t_warehouse, '') = '' 
+		where se.name = se_item.parent and se.docstatus = 1 and ifnull(se_item.t_warehouse, '') = ''
 		and ifnull(se.project_name, '') != '' group by se.project_name""", as_dict=1)
 
 	se_item_map = {}
@@ -56,14 +56,14 @@
 	return se_item_map
 
 def get_delivered_items_cost():
-	dn_items = frappe.db.sql("""select dn.project_name, sum(dn_item.base_amount) as amount
+	dn_items = frappe.db.sql("""select dn.project_name, sum(dn_item.base_net_amount) as amount
 		from `tabDelivery Note` dn, `tabDelivery Note Item` dn_item
 		where dn.name = dn_item.parent and dn.docstatus = 1 and ifnull(dn.project_name, '') != ''
 		group by dn.project_name""", as_dict=1)
 
-	si_items = frappe.db.sql("""select si.project_name, sum(si_item.base_amount) as amount
+	si_items = frappe.db.sql("""select si.project_name, sum(si_item.base_net_amount) as amount
 		from `tabSales Invoice` si, `tabSales Invoice Item` si_item
-		where si.name = si_item.parent and si.docstatus = 1 and ifnull(si.update_stock, 0) = 1 
+		where si.name = si_item.parent and si.docstatus = 1 and ifnull(si.update_stock, 0) = 1
 		and ifnull(si.is_pos, 0) = 1 and ifnull(si.project_name, '') != ''
 		group by si.project_name""", as_dict=1)
 
@@ -75,4 +75,4 @@
 	for item in si_items:
 		dn_item_map.setdefault(item.project_name, item.amount)
 
-	return dn_item_map
\ No newline at end of file
+	return dn_item_map
diff --git a/erpnext/public/js/feature_setup.js b/erpnext/public/js/feature_setup.js
index bb83170..259c2cf 100644
--- a/erpnext/public/js/feature_setup.js
+++ b/erpnext/public/js/feature_setup.js
@@ -111,34 +111,54 @@
 		'Sales Order': {'items':['page_break']}
 	},
 	'fs_exports': {
-		'Delivery Note': {'fields':['conversion_rate','currency','base_grand_total','base_in_words','base_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',
+				'base_total', 'base_net_total', 'base_discount_amount', 'base_total_taxes_and_charges'],
+			'items': ['base_price_list_rate','base_amount','base_rate', 'base_net_rate', 'base_net_amount']
+		},
 		'POS Setting': {'fields':['conversion_rate','currency']},
-		'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']},
+		'Quotation': {
+			'fields': ['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total',
+				'base_total', 'base_net_total', 'base_discount_amount', 'base_total_taxes_and_charges'],
+			'items': ['base_price_list_rate','base_amount','base_rate', 'base_net_rate', 'base_net_amount']
+		},
+		'Sales Invoice': {
+			'fields': ['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total',
+				'base_total', 'base_net_total', 'base_discount_amount', 'base_total_taxes_and_charges'],
+			'items': ['base_price_list_rate','base_amount','base_rate', 'base_net_rate', 'base_net_amount']
+		},
 		'Sales BOM': {'fields':['currency']},
-		'Sales Order': {'fields':['conversion_rate','currency','base_grand_total','base_in_words','base_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',
+				'base_total', 'base_net_total', 'base_discount_amount', 'base_total_taxes_and_charges'],
+			'items': ['base_price_list_rate','base_amount','base_rate', 'base_net_rate', 'base_net_amount']
+		}
 	},
 
 	'fs_imports': {
 		'Purchase Invoice': {
-			'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']
+			'fields': ['conversion_rate', 'currency', 'base_grand_total', 'base_discount_amount',
+		 		'base_in_words', 'base_total', 'base_net_total', 'base_taxes_and_charges_added',
+		 		'base_taxes_and_charges_deducted', 'base_total_taxes_and_charges'],
+			'items': ['base_price_list_rate', 'base_amount','base_rate', 'base_net_rate', 'base_net_amount']
 		},
 		'Purchase Order': {
-			'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']
+			'fields': ['conversion_rate','currency', 'base_grand_total', 'base_discount_amount',
+				'base_in_words', 'base_total', 'base_net_total', 'base_taxes_and_charges_added',
+			 	'base_taxes_and_charges_deducted', 'base_total_taxes_and_charges'],
+			'items': ['base_price_list_rate', 'base_amount','base_rate', 'base_net_rate', 'base_net_amount']
 		},
 		'Purchase Receipt': {
-			'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']
+			'fields': ['conversion_rate', 'currency','base_grand_total', 'base_in_words', 'base_total',
+			 	'base_net_total', 'base_taxes_and_charges_added', 'base_taxes_and_charges_deducted',
+				'base_total_taxes_and_charges', 'base_discount_amount'],
+			'items': ['base_price_list_rate','base_amount','base_rate', 'base_net_rate', 'base_net_amount']
 		},
 		'Supplier Quotation': {
-			'fields':['conversion_rate','currency']
+			'fields': ['conversion_rate', 'currency','base_grand_total', 'base_in_words', 'base_total',
+			 	'base_net_total', 'base_taxes_and_charges_added', 'base_taxes_and_charges_deducted',
+				'base_total_taxes_and_charges', 'base_discount_amount'],
+			'items': ['base_price_list_rate','base_amount','base_rate', 'base_net_rate', 'base_net_amount']
 		}
 	},
 
diff --git a/erpnext/selling/page/sales_analytics/sales_analytics.js b/erpnext/selling/page/sales_analytics/sales_analytics.js
index bbe69d7..197b6ac 100644
--- a/erpnext/selling/page/sales_analytics/sales_analytics.js
+++ b/erpnext/selling/page/sales_analytics/sales_analytics.js
@@ -204,7 +204,7 @@
 				if (posting_date >= from_date && posting_date <= to_date) {
 					var item = me.item_by_name[tl[me.tree_grid.item_key]] ||
 						me.item_by_name['Not Set'];
-					item[me.column_map[tl.posting_date].field] += (is_val ? tl.base_amount : tl.qty);
+					item[me.column_map[tl.posting_date].field] += (is_val ? tl.base_net_amount : tl.qty);
 				}
 			}
 		});
diff --git a/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py b/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py
index 7471317..93dd74c 100644
--- a/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py
+++ b/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py
@@ -82,7 +82,7 @@
 def get_achieved_details(filters):
 	start_date, end_date = get_fiscal_year(fiscal_year = filters["fiscal_year"])[1:]
 
-	item_details = frappe.db.sql("""select soi.item_code, soi.qty, soi.base_amount, so.transaction_date,
+	item_details = frappe.db.sql("""select soi.item_code, soi.qty, soi.base_net_amount, so.transaction_date,
 		st.sales_person, MONTHNAME(so.transaction_date) as month_name
 		from `tabSales Order Item` soi, `tabSales Order` so, `tabSales Team` st
 		where soi.parent=so.name and so.docstatus=1 and
@@ -125,7 +125,7 @@
 				if (filters["target_on"] == "Amount"):
 					tav_dict.target = flt(sd.target_amount) * month_percentage / 100
 					if ad.month_name == month:
-							tav_dict.achieved += ad.base_amount
+							tav_dict.achieved += ad.base_net_amount
 
 	return sim_map
 
diff --git a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py
index c970431..8cac80c 100644
--- a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py
+++ b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py
@@ -16,7 +16,7 @@
 		data.append([
 			d.name, d.customer, d.territory, d.posting_date, d.item_code,
 			item_details.get(d.item_code, {}).get("item_group"), item_details.get(d.item_code, {}).get("brand"),
-			d.qty, d.base_amount, d.sales_person, d.allocated_percentage, d.contribution_amt
+			d.qty, d.base_net_amount, d.sales_person, d.allocated_percentage, d.contribution_amt
 		])
 
 	return columns, data
@@ -36,8 +36,8 @@
 	date_field = filters["doc_type"] == "Sales Order" and "transaction_date" or "posting_date"
 	conditions, items = get_conditions(filters, date_field)
 	entries = frappe.db.sql("""select dt.name, dt.customer, dt.territory, dt.%s as posting_date,
-		dt_item.item_code, dt_item.qty, dt_item.base_amount, st.sales_person,
-		st.allocated_percentage, dt_item.base_amount*st.allocated_percentage/100 as contribution_amt
+		dt_item.item_code, dt_item.qty, dt_item.base_net_amount, st.sales_person,
+		st.allocated_percentage, dt_item.base_net_amount*st.allocated_percentage/100 as contribution_amt
 		from `tab%s` dt, `tab%s Item` dt_item, `tabSales Team` st
 		where st.parent = dt.name and dt.name = dt_item.parent and st.parenttype = %s
 		and dt.docstatus = 1 %s order by st.sales_person, dt.name desc""" %
diff --git a/erpnext/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.py b/erpnext/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.py
index 6c3a2c3..4f19c73 100644
--- a/erpnext/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.py
+++ b/erpnext/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.py
@@ -5,7 +5,6 @@
 import frappe
 from frappe import _, msgprint
 from frappe.utils import flt
-import time
 from erpnext.accounts.utils import get_fiscal_year
 from erpnext.controllers.trends import get_period_date_ranges, get_period_month_ranges
 
@@ -81,7 +80,7 @@
 def get_achieved_details(filters):
 	start_date, end_date = get_fiscal_year(fiscal_year = filters["fiscal_year"])[1:]
 
-	item_details = frappe.db.sql("""select soi.item_code, soi.qty, soi.base_amount, so.transaction_date,
+	item_details = frappe.db.sql("""select soi.item_code, soi.qty, soi.base_net_amount, so.transaction_date,
 		so.territory, MONTHNAME(so.transaction_date) as month_name
 		from `tabSales Order Item` soi, `tabSales Order` so
 		where soi.parent=so.name and so.docstatus=1 and so.transaction_date>=%s and
@@ -125,7 +124,7 @@
 				if (filters["target_on"] == "Amount"):
 					tav_dict.target = flt(td.target_amount) * month_percentage / 100
 					if ad.month_name == month:
-							tav_dict.achieved += ad.base_amount
+							tav_dict.achieved += ad.base_net_amount
 
 	return tim_map
 
diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py
index 7b83616..754eccb 100644
--- a/erpnext/shopping_cart/cart.py
+++ b/erpnext/shopping_cart/cart.py
@@ -141,7 +141,7 @@
 		d["formatted_amount"] = fmt_money(d.get("amount"), currency=doc.currency)
 
 	for d in doc.get("taxes", []):
-		d["formatted_tax_amount"] = fmt_money(flt(d.get("tax_amount")) / doc.conversion_rate,
+		d["formatted_tax_amount"] = fmt_money(flt(d.get("tax_amount_after_discount_amount")),
 			currency=doc.currency)
 
 	doc.formatted_grand_total_export = fmt_money(doc.grand_total,
diff --git a/erpnext/startup/report_data_map.py b/erpnext/startup/report_data_map.py
index b864cbc..4bd0afe 100644
--- a/erpnext/startup/report_data_map.py
+++ b/erpnext/startup/report_data_map.py
@@ -174,7 +174,7 @@
 		}
 	},
 	"Sales Invoice Item": {
-		"columns": ["name", "parent", "item_code", "qty", "base_amount"],
+		"columns": ["name", "parent", "item_code", "qty", "base_net_amount"],
 		"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
 		"order_by": "parent",
 		"links": {
@@ -192,7 +192,7 @@
 		}
 	},
 	"Sales Order Item[Sales Analytics]": {
-		"columns": ["name", "parent", "item_code", "qty", "base_amount"],
+		"columns": ["name", "parent", "item_code", "qty", "base_net_amount"],
 		"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
 		"order_by": "parent",
 		"links": {
@@ -210,7 +210,7 @@
 		}
 	},
 	"Delivery Note Item[Sales Analytics]": {
-		"columns": ["name", "parent", "item_code", "qty", "base_amount"],
+		"columns": ["name", "parent", "item_code", "qty", "base_net_amount"],
 		"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
 		"order_by": "parent",
 		"links": {
@@ -242,7 +242,7 @@
 		}
 	},
 	"Purchase Invoice Item": {
-		"columns": ["name", "parent", "item_code", "qty", "base_amount"],
+		"columns": ["name", "parent", "item_code", "qty", "base_net_amount"],
 		"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
 		"order_by": "parent",
 		"links": {
@@ -260,7 +260,7 @@
 		}
 	},
 	"Purchase Order Item[Purchase Analytics]": {
-		"columns": ["name", "parent", "item_code", "qty", "base_amount"],
+		"columns": ["name", "parent", "item_code", "qty", "base_net_amount"],
 		"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
 		"order_by": "parent",
 		"links": {
@@ -278,7 +278,7 @@
 		}
 	},
 	"Purchase Receipt Item[Purchase Analytics]": {
-		"columns": ["name", "parent", "item_code", "qty", "base_amount"],
+		"columns": ["name", "parent", "item_code", "qty", "base_net_amount"],
 		"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
 		"order_by": "parent",
 		"links": {
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index 9395e84..2785cc1 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -295,7 +295,7 @@
 						"cost_center": d.cost_center,
 						"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
 						"debit": flt(flt(d.valuation_rate, val_rate_db_precision) * flt(d.qty) * flt(d.conversion_factor),
-							self.precision("base_amount", d))
+							self.precision("base_net_amount", d))
 					}))
 
 					# stock received but not billed
@@ -304,7 +304,7 @@
 						"against": warehouse_account[d.warehouse],
 						"cost_center": d.cost_center,
 						"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
-						"credit": flt(d.base_amount, self.precision("base_amount", d))
+						"credit": flt(d.base_net_amount, self.precision("base_net_amount", d))
 					}))
 
 					negative_expense_to_be_booked += flt(d.item_tax_amount)
@@ -332,12 +332,12 @@
 					# divisional loss adjustment
 					if not self.get("other_charges"):
 						sle_valuation_amount = flt(flt(d.valuation_rate, val_rate_db_precision) * flt(d.qty) * flt(d.conversion_factor),
-								self.precision("base_amount", d))
+								self.precision("base_net_amount", d))
 
-						distributed_amount = flt(flt(d.base_amount, self.precision("base_amount", d))) + \
+						distributed_amount = flt(flt(d.base_net_amount, self.precision("base_net_amount", d))) + \
 							flt(d.landed_cost_voucher_amount) + flt(d.rm_supp_cost)
 
-						divisional_loss = flt(distributed_amount - sle_valuation_amount, self.precision("base_amount", d))
+						divisional_loss = flt(distributed_amount - sle_valuation_amount, self.precision("base_net_amount", d))
 						if divisional_loss:
 							gl_entries.append(self.get_gl_dict({
 								"account": stock_rbnb,
@@ -354,12 +354,12 @@
 		# Cost center-wise amount breakup for other charges included for valuation
 		valuation_tax = {}
 		for tax in self.get("taxes"):
-			if tax.category in ("Valuation", "Valuation and Total") and flt(tax.tax_amount):
+			if tax.category in ("Valuation", "Valuation and Total") and flt(tax.base_tax_amount_after_discount_amount):
 				if not tax.cost_center:
 					frappe.throw(_("Cost Center is required in row {0} in Taxes table for type {1}").format(tax.idx, _(tax.category)))
 				valuation_tax.setdefault(tax.cost_center, 0)
 				valuation_tax[tax.cost_center] += \
-					(tax.add_deduct_tax == "Add" and 1 or -1) * flt(tax.tax_amount)
+					(tax.add_deduct_tax == "Add" and 1 or -1) * flt(tax.base_tax_amount_after_discount_amount)
 
 		if negative_expense_to_be_booked and valuation_tax:
 			# Backward compatibility:
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index d7ace2f..44f60d7 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -170,6 +170,8 @@
 		"base_rate": 0.0,
 		"amount": 0.0,
 		"base_amount": 0.0,
+		"net_rate": 0.0,
+		"net_amount": 0.0,
 		"discount_percentage": 0.0
 	})