Commonified taxes and totals calculation in server side
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index 321417f..6e8d7f1 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -19,7 +19,7 @@
 		if self.doc.meta.get_field("discount_amount"):
 			self.apply_discount_amount()
 
-		if self.doctype in ["Sales Invoice", "Purchase Invoice"]:
+		if self.doc.doctype in ["Sales Invoice", "Purchase Invoice"]:
 			self.calculate_total_advance()
 
 	def _calculate(self):
@@ -37,7 +37,7 @@
 		self.calculate_item_values()
 		self.initialize_taxes()
 
-		if self.doctype in ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]:
+		if self.doc.doctype in ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]:
 			self.determine_exclusive_rate()
 
 		self.calculate_net_total()
@@ -186,7 +186,7 @@
 			self.doc.base_net_total += item.base_amount
 			self.doc.net_total += item.amount
 
-		self.round_floats_in(self.doc, ["base_net_total", "net_total"])
+		self.doc.round_floats_in(self.doc, ["base_net_total", "net_total"])
 
 	def calculate_taxes(self):
 		# maintain actual tax rate based on idx
@@ -296,7 +296,7 @@
 		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.doctype in ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]:
+		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
 
@@ -384,13 +384,13 @@
 		# write_off_amount is only for POS Invoice
 		# total_advance is only for non POS Invoice
 
-		if self.doctype == "Sales Invoice":
-			self.round_floats_in(self.doc, ["base_grand_total", "total_advance", "write_off_amount", "paid_amount"])
+		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.round_floats_in(self.doc, ["total_advance", "write_off_amount"])
+			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,
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index b454c54..663f6ab 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -18,7 +18,7 @@
 		}
 
 		// Sales person's commission
-		if(in_list(["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"])) {
+		if(in_list(["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"], this.frm.doc.doctype)) {
 			this.calculate_commission();
 			this.calculate_contribution();
 		}
@@ -316,7 +316,7 @@
 		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"])) {
+		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;
 
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index bc72d13..c8b028b 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -8,7 +8,6 @@
 erpnext.TransactionController = erpnext.taxes_and_totals.extend({
 	onload: function() {
 		var me = this;
-
 		if(this.frm.doc.__islocal) {
 			var today = get_today(),
 				currency = frappe.defaults.get_user_default("currency");
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 73eb9a6..640e992 100644
--- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json
+++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
@@ -177,15 +177,6 @@
    "width": "100px"
   }, 
   {
-   "fieldname": "net_amount", 
-   "fieldtype": "Currency", 
-   "label": "Net Amount", 
-   "options": "currency", 
-   "permlevel": 0, 
-   "precision": "", 
-   "read_only": 1
-  }, 
-  {
    "fieldname": "col_break3", 
    "fieldtype": "Column Break", 
    "permlevel": 0
@@ -220,15 +211,6 @@
    "width": "100px"
   }, 
   {
-   "fieldname": "base_net_amount", 
-   "fieldtype": "Currency", 
-   "label": "Net Amount (Company Currency)", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "precision": "", 
-   "read_only": 1
-  }, 
-  {
    "fieldname": "pricing_rule", 
    "fieldtype": "Link", 
    "label": "Pricing Rule", 
@@ -433,7 +415,7 @@
  ], 
  "idx": 1, 
  "istable": 1, 
- "modified": "2015-01-22 13:52:44.959126", 
+ "modified": "2015-02-17 12:50:20.121459", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Sales Order Item",