Merge pull request #1414 from akhileshdarjee/4.0-hotfix

Customer and Supplier dashboard set to company currency
diff --git a/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt b/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt
index 09caf55..761be67 100644
--- a/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt
+++ b/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt
@@ -9,7 +9,7 @@
  {
   "doc_type": "Sales Invoice", 
   "doctype": "Print Format", 
-  "html": "<html>\n\t<head>\n\n\t\t<!-- Style Settings -->\n\t\t<style>\n\t\t\ttable, tr, td, div, p {\n\t\t\t\tfont-family: Monospace;\n\t\t\t\tline-height: 200%;\n\t\t\t\tvertical-align: middle;\n\t\t\t}\n\t\t\t@media screen {\n\t\t\t\tbody {\n\t\t\t\t\twidth: 4in;\n\t\t\t\t}\n\t\t\t}\n\t\t</style>\n\n\t\t<!-- Javascript -->\n\t\t<script>\n\t\t\tfunction print_header() {\n\t\t\t\tvar header = '<table width=\"100%\" cellpadding=\"4\">';\n\n\t\t\t\theader += '<tr>\\\n\t\t\t\t\t<td colspan=\"2\" align=\"center\"><h3>' + (doc.select_print_heading || \"Invoice\") + '</h3></td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\theader += '<tr>\\\n\t\t\t\t\t<td align=\"left\"><b>RECEIPT NO:</b> ' + doc.name + '</td>\\\n\t\t\t\t\t<td align=\"right\"><b>DATE:</b> ' + date.str_to_user(doc.posting_date) + '</td>\\\n\t\t\t\t</tr>\\\n\t\t\t\t<tr>\\\n\t\t\t\t\t<td colspan=\"2\"><b>M/s.</b> ' + doc.customer + '</td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\treturn header + '</table>';\n\t\t\t}\n\n\t\t\tfunction print_items() {\n\t\t\t\tvar rows = '<table width=\"100%\" cellpadding=\"0\" class=\"cart\">';\n\n\t\t\t\trows += '<tr>\\\n\t\t\t\t\t<td colspan=\"3\"><hr></td>\\\n\t\t\t\t</tr>\\\n\t\t\t\t<tr>\\\n\t\t\t\t\t<td width=\"60%\" align=\"left\"><b>ITEM CODE / DESC.</b></td>\\\n\t\t\t\t\t<td width=\"10%\" align=\"right\"><b>QTY</b></td>\\\n\t\t\t\t\t<td width=\"30%\" align=\"right\"><b>RATE</b></td>\\\n\t\t\t\t</tr>\\\n\t\t\t\t<tr>\\\n\t\t\t\t\t<td colspan=\"3\"><hr></td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\t// print items\n\t\t\t\tvar items = getchildren('Sales Invoice Item', doc.name, 'entries');\n\t\t\t\tfor (var x=0; x<items.length; x++) {\n\t\t\t\t\trows += '<tr>\\\n\t\t\t\t\t\t<td align=\"left\">' + items[x].item_code + '<br>' + items[x].item_name + '</td>\\\n\t\t\t\t\t\t<td align=\"right\" style=\"vertical-align:top;\">' + items[x].qty + '</td>\\\n\t\t\t\t\t\t<td align=\"right\" style=\"vertical-align:top;\">' + format_currency(items[x].export_amount) + '</td>\\\n\t\t\t\t\t</tr>';\n\t\t\t\t}\n\n\t\t\t\trows += '<tr>\\\n\t\t\t\t\t<td colspan=\"3\"><hr></td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\treturn rows + '</table>';\n\t\t\t}\n\n\t\t\tfunction print_other_charges_and_totals() {\n\t\t\t\tvar totals = '<table width=\"100%\">';\n\t\t\t\t// print net total\n\t\t\t\ttotals +='<tr>\\\n\t\t\t\t\t<td align=\"right\" width=\"70%\">Net Total</td>\\\n\t\t\t\t\t<td align=\"right\">' + format_currency(doc.net_total_export) + '</td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\t// print exclusive taxes\n\t\t\t\tvar taxes = wn.model.get_children(\"Sales Taxes and Charges\", doc.name, \"other_charges\", \"Sales Invoice\");\n\t\t\t\tif (taxes) {\n\t\t\t\t\t$.each(taxes, function(i, d) {\n\t\t\t\t\t\tif (!d.included_in_print_rate && d.tax_amount) {\n\t\t\t\t\t\t\ttotals += '<tr>\\\n\t\t\t\t\t\t\t\t<td align=\"right\">' + d.description + '</td>\\\n\t\t\t\t\t\t\t\t<td align=\"right\">' + format_currency(d.tax_amount) + '</td>\\\n\t\t\t\t\t\t\t<tr>';\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// show discount amount\n\t\t\t\tif (doc.discount_amount) {\n\t\t\t\t\ttotals += '<tr>\\\n\t\t\t\t\t\t<td align=\"right\">Discount Amount</td>\\\n\t\t\t\t\t\t<td align=\"right\">' + format_currency(doc.discount_amount) + '</td>\\\n\t\t\t\t\t<tr>';\n\t\t\t\t}\n\n\t\t\t\t// print grand total\n\t\t\t\ttotals += '<tr>\\\n\t\t\t\t\t<td align=\"right\">Grand Total</td>\\\n\t\t\t\t\t<td align=\"right\"><hr width=\"90%\" align=\"right\">' + format_currency(doc.grand_total_export) + '<br>\\\n\t\t\t\t\t<hr width=\"90%\" align=\"right\"></td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\treturn totals + '</table>';\n\t\t\t}\n\n\t\t\tfunction print_inclusive_taxes() {\n\t\t\t\tvar count = 0;\n\t\t\t\tvar inc_tax = '';\n\t\t\t\tvar taxes = wn.model.get_children(\"Sales Taxes and Charges\", doc.name, \"other_charges\", \"Sales Invoice\");\n\t\t\t\tif (taxes) {\n\t\t\t\t\t$.each(taxes, function(i, d) {\n\t\t\t\t\t\tif (d.included_in_print_rate && d.tax_amount) {\n\t\t\t\t\t\t\tif (count == 0) {\n\t\t\t\t\t\t\t\tinc_tax = '<table width=\"100%\">\\\n\t\t\t\t\t\t\t\t\t<tr>\\\n\t\t\t\t\t\t\t\t\t\t<td colspan=\"2\"><b>Inclusive Taxes</b></td>\\\n\t\t\t\t\t\t\t\t\t</tr>';\n\t\t\t\t\t\t\t\tcount += 1;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tinc_tax += '<tr>\\\n\t\t\t\t\t\t\t\t<td width=\"60%\">' + d.description + '</td>\\\n\t\t\t\t\t\t\t\t<td>' + format_currency(d.tax_amount) + '</td>\\\n\t\t\t\t\t\t\t<tr>';\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tif (inc_tax) {\n\t\t\t\t\tinc_tax += '<tr>\\\n\t\t\t\t\t\t<td colspan=\"2\"><hr></td>\\\n\t\t\t\t\t</tr></table>';\n\t\t\t\t}\n\n\t\t\t\treturn inc_tax;\n\t\t\t}\n\n\t\t\tfunction print_footer() {\n\t\t\t\tvar footer = '<table width=\"100%\">';\n\n\t\t\t\t// print terms\n\t\t\t\tif (doc.terms) {\n\t\t\t\t\tfooter += '<tr>\\\n\t\t\t\t\t\t<td align=\"center\">' + doc.terms + '</td>\\\n\t\t\t\t\t</tr>';\n\t\t\t\t}\n\n\t\t\t\tfooter +='<tr>\\\n\t\t\t\t\t<td align=\"center\">Thank You. Please visit again.</td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\treturn footer + '</table>';\n\t\t\t}\n\t\t</script>\n\t</head>\n\n\t<body>\n\t\t<!--Headers, Item Table, Totals & Footer-->\n\t\t<div><script>print_header();</script></div>\n\t\t<div><script>print_items();</script></div>\n\t\t<div><script>print_inclusive_taxes();</script></div>\n\t\t<div><script>print_other_charges_and_totals();</script></div>\n\t\t<div><script>print_footer();</script></div>\n\t</body>\n</html>", 
+  "html": "<html>\n\t<head>\n\n\t\t<!-- Style Settings -->\n\t\t<style>\n\t\t\ttable, tr, td, div, p {\n\t\t\t\tfont-family: Monospace;\n\t\t\t\tline-height: 200%;\n\t\t\t\tvertical-align: middle;\n\t\t\t}\n\t\t\t@media screen {\n\t\t\t\tbody {\n\t\t\t\t\twidth: 4in;\n\t\t\t\t}\n\t\t\t}\n\t\t</style>\n\n\t\t<!-- Javascript -->\n\t\t<script>\n\t\t\tfunction print_header() {\n\t\t\t\tvar header = '<table width=\"100%\" cellpadding=\"4\">';\n\n\t\t\t\theader += '<tr>\\\n\t\t\t\t\t<td colspan=\"2\" align=\"center\"><h3>' + (doc.select_print_heading || \"Invoice\") + '</h3></td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\theader += '<tr>\\\n\t\t\t\t\t<td align=\"left\"><b>RECEIPT NO:</b> ' + doc.name + '</td>\\\n\t\t\t\t\t<td align=\"right\"><b>DATE:</b> ' + date.str_to_user(doc.posting_date) + '</td>\\\n\t\t\t\t</tr>\\\n\t\t\t\t<tr>\\\n\t\t\t\t\t<td colspan=\"2\"><b>M/s.</b> ' + doc.customer + '</td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\treturn header + '</table>';\n\t\t\t}\n\n\t\t\tfunction print_items() {\n\t\t\t\tvar rows = '<table width=\"100%\" cellpadding=\"0\" class=\"cart\">';\n\n\t\t\t\trows += '<tr>\\\n\t\t\t\t\t<td colspan=\"3\"><hr></td>\\\n\t\t\t\t</tr>\\\n\t\t\t\t<tr>\\\n\t\t\t\t\t<td width=\"60%\" align=\"left\"><b>ITEM CODE / DESC.</b></td>\\\n\t\t\t\t\t<td width=\"10%\" align=\"right\"><b>QTY</b></td>\\\n\t\t\t\t\t<td width=\"30%\" align=\"right\"><b>RATE</b></td>\\\n\t\t\t\t</tr>\\\n\t\t\t\t<tr>\\\n\t\t\t\t\t<td colspan=\"3\"><hr></td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\t// print items\n\t\t\t\tvar items = getchildren('Sales Invoice Item', doc.name, 'entries');\n\t\t\t\tfor (var x=0; x<items.length; x++) {\n\t\t\t\t\trows += '<tr>\\\n\t\t\t\t\t\t<td align=\"left\">' + items[x].item_code + '<br>' + items[x].item_name + '</td>\\\n\t\t\t\t\t\t<td align=\"right\" style=\"vertical-align:top;\">' + items[x].qty + '</td>\\\n\t\t\t\t\t\t<td align=\"right\" style=\"vertical-align:top;\">' + format_currency(items[x].amount) + '</td>\\\n\t\t\t\t\t</tr>';\n\t\t\t\t}\n\n\t\t\t\trows += '<tr>\\\n\t\t\t\t\t<td colspan=\"3\"><hr></td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\treturn rows + '</table>';\n\t\t\t}\n\n\t\t\tfunction print_other_charges_and_totals() {\n\t\t\t\tvar totals = '<table width=\"100%\">';\n\t\t\t\t// print net total\n\t\t\t\ttotals +='<tr>\\\n\t\t\t\t\t<td align=\"right\" width=\"70%\">Net Total</td>\\\n\t\t\t\t\t<td align=\"right\">' + format_currency(doc.net_total_export) + '</td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\t// print exclusive taxes\n\t\t\t\tvar taxes = wn.model.get_children(\"Sales Taxes and Charges\", doc.name, \"other_charges\", \"Sales Invoice\");\n\t\t\t\tif (taxes) {\n\t\t\t\t\t$.each(taxes, function(i, d) {\n\t\t\t\t\t\tif (!d.included_in_print_rate && d.tax_amount) {\n\t\t\t\t\t\t\ttotals += '<tr>\\\n\t\t\t\t\t\t\t\t<td align=\"right\">' + d.description + '</td>\\\n\t\t\t\t\t\t\t\t<td align=\"right\">' + format_currency(d.tax_amount) + '</td>\\\n\t\t\t\t\t\t\t<tr>';\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// show discount amount\n\t\t\t\tif (doc.discount_amount) {\n\t\t\t\t\ttotals += '<tr>\\\n\t\t\t\t\t\t<td align=\"right\">Discount Amount</td>\\\n\t\t\t\t\t\t<td align=\"right\">' + format_currency(doc.discount_amount) + '</td>\\\n\t\t\t\t\t<tr>';\n\t\t\t\t}\n\n\t\t\t\t// print grand total\n\t\t\t\ttotals += '<tr>\\\n\t\t\t\t\t<td align=\"right\">Grand Total</td>\\\n\t\t\t\t\t<td align=\"right\"><hr width=\"90%\" align=\"right\">' + format_currency(doc.grand_total_export) + '<br>\\\n\t\t\t\t\t<hr width=\"90%\" align=\"right\"></td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\treturn totals + '</table>';\n\t\t\t}\n\n\t\t\tfunction print_inclusive_taxes() {\n\t\t\t\tvar count = 0;\n\t\t\t\tvar inc_tax = '';\n\t\t\t\tvar taxes = wn.model.get_children(\"Sales Taxes and Charges\", doc.name, \"other_charges\", \"Sales Invoice\");\n\t\t\t\tif (taxes) {\n\t\t\t\t\t$.each(taxes, function(i, d) {\n\t\t\t\t\t\tif (d.included_in_print_rate && d.tax_amount) {\n\t\t\t\t\t\t\tif (count == 0) {\n\t\t\t\t\t\t\t\tinc_tax = '<table width=\"100%\">\\\n\t\t\t\t\t\t\t\t\t<tr>\\\n\t\t\t\t\t\t\t\t\t\t<td colspan=\"2\"><b>Inclusive Taxes</b></td>\\\n\t\t\t\t\t\t\t\t\t</tr>';\n\t\t\t\t\t\t\t\tcount += 1;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tinc_tax += '<tr>\\\n\t\t\t\t\t\t\t\t<td width=\"60%\">' + d.description + '</td>\\\n\t\t\t\t\t\t\t\t<td>' + format_currency(d.tax_amount) + '</td>\\\n\t\t\t\t\t\t\t<tr>';\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tif (inc_tax) {\n\t\t\t\t\tinc_tax += '<tr>\\\n\t\t\t\t\t\t<td colspan=\"2\"><hr></td>\\\n\t\t\t\t\t</tr></table>';\n\t\t\t\t}\n\n\t\t\t\treturn inc_tax;\n\t\t\t}\n\n\t\t\tfunction print_footer() {\n\t\t\t\tvar footer = '<table width=\"100%\">';\n\n\t\t\t\t// print terms\n\t\t\t\tif (doc.terms) {\n\t\t\t\t\tfooter += '<tr>\\\n\t\t\t\t\t\t<td align=\"center\">' + doc.terms + '</td>\\\n\t\t\t\t\t</tr>';\n\t\t\t\t}\n\n\t\t\t\tfooter +='<tr>\\\n\t\t\t\t\t<td align=\"center\">Thank You. Please visit again.</td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\treturn footer + '</table>';\n\t\t\t}\n\t\t</script>\n\t</head>\n\n\t<body>\n\t\t<!--Headers, Item Table, Totals & Footer-->\n\t\t<div><script>print_header();</script></div>\n\t\t<div><script>print_items();</script></div>\n\t\t<div><script>print_inclusive_taxes();</script></div>\n\t\t<div><script>print_other_charges_and_totals();</script></div>\n\t\t<div><script>print_footer();</script></div>\n\t</body>\n</html>", 
   "module": "Accounts", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt b/erpnext/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt
index 09fcb91..3dcf7f2 100644
--- a/erpnext/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt
+++ b/erpnext/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt
@@ -2,14 +2,14 @@
  {
   "creation": "2013-04-19 13:30:27", 
   "docstatus": 0, 
-  "modified": "2013-12-26 17:33:08", 
+  "modified": "2014-02-11 17:33:08", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
  {
   "doc_type": "Sales Invoice", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Georgia\", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Georgia\", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Invoice',\n\t\t\t\tdoc.name,\n\t\t\t\t'entries',\n\t\t\t\t'Sales Invoice Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'export_rate', 'export_amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.ref_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>'<h1>' + (doc.select_print_heading || 'Invoice') + '</h1>'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=40%><b>Invoice Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.posting_date)</script></td>\n\t\t\t\t\t<tr>\n                    <tr>\n    \t\t\t\t\t<td width=40%><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?\"<b>Invoice Period</b>\"\n                            :\"\";\n    \t\t\t\t\t</script></td>\n\t\t\t\t\t\t<td><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?(date.str_to_user(doc.invoice_period_from_date) +\n                                ' to ' + date.str_to_user(doc.invoice_period_to_date))\n                            :\"\";\n                        </script></td>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Due Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.due_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Georgia\", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Georgia\", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Invoice',\n\t\t\t\tdoc.name,\n\t\t\t\t'entries',\n\t\t\t\t'Sales Invoice Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>'<h1>' + (doc.select_print_heading || 'Invoice') + '</h1>'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=40%><b>Invoice Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.posting_date)</script></td>\n\t\t\t\t\t<tr>\n                    <tr>\n    \t\t\t\t\t<td width=40%><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?\"<b>Invoice Period</b>\"\n                            :\"\";\n    \t\t\t\t\t</script></td>\n\t\t\t\t\t\t<td><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?(date.str_to_user(doc.invoice_period_from_date) +\n                                ' to ' + date.str_to_user(doc.invoice_period_to_date))\n                            :\"\";\n                        </script></td>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Due Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.due_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Accounts", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt b/erpnext/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt
index a85a11a..4194acf 100644
--- a/erpnext/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt
+++ b/erpnext/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt
@@ -2,14 +2,14 @@
  {
   "creation": "2013-04-19 13:30:27", 
   "docstatus": 0, 
-  "modified": "2013-12-26 17:33:05", 
+  "modified": "2014-02-11 17:33:05", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
  {
   "doc_type": "Sales Invoice", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n        line-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Invoice',\n\t\t\t\tdoc.name,\n\t\t\t\t'entries',\n\t\t\t\t'Sales Invoice Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'export_rate', 'export_amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.ref_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Invoice') + '</h1>'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style=\"height:15px\"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class='imp-details'>\n\t\t\t\t\t\t<td><b>Invoice No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=40%><b>Invoice Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.posting_date)</script></td>\n\t\t\t\t\t<tr>\n                    <tr>\n        \t\t\t\t<td width=40%><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?\"<b>Invoice Period</b>\"\n                            :\"\";\n    \t\t\t\t\t</script></td>\n\t\t\t\t\t\t<td><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?(date.str_to_user(doc.invoice_period_from_date) +\n                                ' to ' + date.str_to_user(doc.invoice_period_to_date))\n                            :\"\";\n                        </script></td>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Due Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.due_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold' class='imp-details'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n        line-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Invoice',\n\t\t\t\tdoc.name,\n\t\t\t\t'entries',\n\t\t\t\t'Sales Invoice Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Invoice') + '</h1>'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style=\"height:15px\"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class='imp-details'>\n\t\t\t\t\t\t<td><b>Invoice No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=40%><b>Invoice Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.posting_date)</script></td>\n\t\t\t\t\t<tr>\n                    <tr>\n        \t\t\t\t<td width=40%><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?\"<b>Invoice Period</b>\"\n                            :\"\";\n    \t\t\t\t\t</script></td>\n\t\t\t\t\t\t<td><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?(date.str_to_user(doc.invoice_period_from_date) +\n                                ' to ' + date.str_to_user(doc.invoice_period_to_date))\n                            :\"\";\n                        </script></td>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Due Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.due_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold' class='imp-details'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Accounts", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt b/erpnext/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt
index e0850e1..56a4901 100644
--- a/erpnext/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt
+++ b/erpnext/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt
@@ -2,14 +2,14 @@
  {
   "creation": "2013-04-19 13:30:27", 
   "docstatus": 0, 
-  "modified": "2013-12-26 17:34:00", 
+  "modified": "2014-02-11 17:34:00", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
  {
   "doc_type": "Sales Invoice", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Invoice',\n\t\t\t\tdoc.name,\n\t\t\t\t'entries',\n\t\t\t\t'Sales Invoice Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'export_rate', 'export_amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.ref_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td></td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Invoice') + '</h1>'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=40%><b>Invoice Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.posting_date)</script></td>\n\t\t\t\t\t<tr>\n                    <tr>\n        \t\t\t\t<td width=40%><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?\"<b>Invoice Period</b>\"\n                            :\"\";\n    \t\t\t\t\t</script></td>\n\t\t\t\t\t\t<td><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?(date.str_to_user(doc.invoice_period_from_date) +\n                                ' to ' + date.str_to_user(doc.invoice_period_to_date))\n                            :\"\";\n                        </script></td>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Due Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.due_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Invoice',\n\t\t\t\tdoc.name,\n\t\t\t\t'entries',\n\t\t\t\t'Sales Invoice Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td></td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Invoice') + '</h1>'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=40%><b>Invoice Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.posting_date)</script></td>\n\t\t\t\t\t<tr>\n                    <tr>\n        \t\t\t\t<td width=40%><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?\"<b>Invoice Period</b>\"\n                            :\"\";\n    \t\t\t\t\t</script></td>\n\t\t\t\t\t\t<td><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?(date.str_to_user(doc.invoice_period_from_date) +\n                                ' to ' + date.str_to_user(doc.invoice_period_to_date))\n                            :\"\";\n                        </script></td>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Due Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.due_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Accounts", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/accounts/Print Format/SalesInvoice/SalesInvoice.html b/erpnext/accounts/Print Format/SalesInvoice/SalesInvoice.html
index bb27897..9375b04 100644
--- a/erpnext/accounts/Print Format/SalesInvoice/SalesInvoice.html
+++ b/erpnext/accounts/Print Format/SalesInvoice/SalesInvoice.html
@@ -72,8 +72,8 @@
 				<td style="width: 37%;">{{ row.description }}</td>
 				<td style="width: 5%; text-align: right;">{{ row.qty }}</td>
 				<td style="width: 5%;">{{ row.stock_uom }}</td>
-				<td style="width: 15%; text-align: right;">{{ utils.fmt_money(row.export_rate, currency=doc.currency) }}</td>
-				<td style="width: 15%; text-align: right;">{{ utils.fmt_money(row.export_amount, currency=doc.currency) }}</td>
+				<td style="width: 15%; text-align: right;">{{ utils.fmt_money(row.rate, currency=doc.currency) }}</td>
+				<td style="width: 15%; text-align: right;">{{ utils.fmt_money(row.amount, currency=doc.currency) }}</td>
 			</tr>
 			{% endfor -%}
 		</tbody>
diff --git a/erpnext/accounts/doctype/pos_setting/pos_setting.py b/erpnext/accounts/doctype/pos_setting/pos_setting.py
index a5a11e9..3198859 100755
--- a/erpnext/accounts/doctype/pos_setting/pos_setting.py
+++ b/erpnext/accounts/doctype/pos_setting/pos_setting.py
@@ -61,4 +61,4 @@
 				webnotes.defaults.set_global_default("is_pos", 1)
 
 	def on_trash(self):
-		self.on_update()
+		self.on_update()
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index 30998e4..deece75 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -109,7 +109,7 @@
 	
 	entries_add: function(doc, cdt, cdn) {
 		var row = wn.model.get_doc(cdt, cdn);
-		this.frm.script_manager.copy_from_first_row("entries", row, ["expense_head", "cost_center"]);
+		this.frm.script_manager.copy_from_first_row("entries", row, ["expense_account", "cost_center"]);
 	}
 });
 
@@ -175,19 +175,19 @@
 	}	
 }
 
-cur_frm.set_query("expense_head", "entries", function(doc) {
+cur_frm.set_query("expense_account", "entries", function(doc) {
 	return{
 		query: "accounts.doctype.purchase_invoice.purchase_invoice.get_expense_account",
 		filters: {'company': doc.company}
 	}
 });
 
-cur_frm.cscript.expense_head = function(doc, cdt, cdn){
+cur_frm.cscript.expense_account = function(doc, cdt, cdn){
 	var d = locals[cdt][cdn];
-	if(d.idx == 1 && d.expense_head){
+	if(d.idx == 1 && d.expense_account){
 		var cl = getchildren('Purchase Invoice Item', doc.name, 'entries', doc.doctype);
 		for(var i = 0; i < cl.length; i++){
-			if(!cl[i].expense_head) cl[i].expense_head = d.expense_head;
+			if(!cl[i].expense_account) cl[i].expense_account = d.expense_account;
 		}
 	}
 	refresh_field('entries');
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 9fc04e6..ab7b5b1 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -27,8 +27,8 @@
 			'target_field': 'billed_amt',
 			'target_parent_dt': 'Purchase Order',
 			'target_parent_field': 'per_billed',
-			'target_ref_field': 'import_amount',
-			'source_field': 'import_amount',
+			'target_ref_field': 'amount',
+			'source_field': 'amount',
 			'percent_join_field': 'purchase_order',
 		}]
 		
@@ -54,7 +54,7 @@
 		self.validate_write_off_account()
 		self.update_raw_material_cost()
 		self.update_valuation_rate("entries")
-		self.validate_multiple_billing("Purchase Receipt", "pr_detail", "import_amount", 
+		self.validate_multiple_billing("Purchase Receipt", "pr_detail", "amount", 
 			"purchase_receipt_details")
 	
 	def set_missing_values(self, for_validate=False):
@@ -169,13 +169,13 @@
 			super(DocType, self).validate_with_previous_doc(self.tname, {
 				"Purchase Order Item": {
 					"ref_dn_field": "po_detail",
-					"compare_fields": [["import_rate", "="]],
+					"compare_fields": [["rate", "="]],
 					"is_child_table": True,
 					"allow_duplicate_prev_row_id": True
 				},
 				"Purchase Receipt Item": {
 					"ref_dn_field": "pr_detail",
-					"compare_fields": [["import_rate", "="]],
+					"compare_fields": [["rate", "="]],
 					"is_child_table": True
 				}
 			})
@@ -201,19 +201,19 @@
 					and self.doc.is_opening == 'No':
 				# in case of auto inventory accounting, against expense account is always
 				# Stock Received But Not Billed for a stock item
-				item.expense_head = stock_not_billed_account
+				item.expense_account = stock_not_billed_account
 				item.cost_center = None
 				
 				if stock_not_billed_account not in against_accounts:
 					against_accounts.append(stock_not_billed_account)
 			
-			elif not item.expense_head:
+			elif not item.expense_account:
 				msgprint(_("Expense account is mandatory for item") + ": " + 
 					(item.item_code or item.item_name), raise_exception=1)
 			
-			elif item.expense_head not in against_accounts:
+			elif item.expense_account not in against_accounts:
 				# if no auto_accounting_for_stock or not a stock item
-				against_accounts.append(item.expense_head)
+				against_accounts.append(item.expense_account)
 				
 		self.doc.against_expense_account = ",".join(against_accounts)
 
@@ -342,25 +342,25 @@
 					# expense will be booked in sales invoice
 					stock_item_and_auto_accounting_for_stock = True
 					
-					valuation_amt = flt(item.amount + item.item_tax_amount + item.rm_supp_cost, 
-						self.precision("amount", item))
+					valuation_amt = flt(item.base_amount + item.item_tax_amount + item.rm_supp_cost, 
+						self.precision("base_amount", item))
 					
 					gl_entries.append(
 						self.get_gl_dict({
-							"account": item.expense_head,
+							"account": item.expense_account,
 							"against": self.doc.credit_to,
 							"debit": valuation_amt,
 							"remarks": self.doc.remarks or "Accounting Entry for Stock"
 						})
 					)
 			
-			elif flt(item.amount):
+			elif flt(item.base_amount):
 				# if not a stock item or auto inventory accounting disabled, book the expense
 				gl_entries.append(
 					self.get_gl_dict({
-						"account": item.expense_head,
+						"account": item.expense_account,
 						"against": self.doc.credit_to,
-						"debit": item.amount,
+						"debit": item.base_amount,
 						"remarks": self.doc.remarks,
 						"cost_center": item.cost_center
 					})
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt
index d0eb1b3..3fafc1c 100755
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-05-21 16:16:39", 
   "docstatus": 0, 
-  "modified": "2014-01-29 15:26:54", 
+  "modified": "2014-02-11 12:01:59", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -743,6 +743,15 @@
   "read_only": 0
  }, 
  {
+  "allow_on_submit": 1, 
+  "doctype": "DocField", 
+  "fieldname": "letter_head", 
+  "fieldtype": "Select", 
+  "label": "Letter Head", 
+  "options": "link:Letter Head", 
+  "print_hide": 1
+ }, 
+ {
   "doctype": "DocField", 
   "fieldname": "fiscal_year", 
   "fieldtype": "Select", 
diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
index e276219..6cca6e4 100644
--- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
@@ -77,7 +77,7 @@
 		
 		pi = webnotes.bean(copy=test_records[1])
 		pi.doclist[1].item_code = "_Test Non Stock Item"
-		pi.doclist[1].expense_head = "_Test Account Cost for Goods Sold - _TC"
+		pi.doclist[1].expense_account = "_Test Account Cost for Goods Sold - _TC"
 		pi.doclist.pop(2)
 		pi.doclist.pop(3)
 		pi.run_method("calculate_taxes_and_totals")
@@ -220,7 +220,8 @@
 			"company": "_Test Company",
 			"currency": "INR",
 			"conversion_rate": 1,
-			"grand_total_import": 0 # for feed
+			"grand_total_import": 0, # for feed
+			"buying_price_list": "_Test Price List"
 		},
 		# items
 		{
@@ -229,13 +230,13 @@
 			"item_code": "_Test Item Home Desktop 100",
 			"item_name": "_Test Item Home Desktop 100",
 			"qty": 10,
-			"import_rate": 50,
-			"import_amount": 500,
 			"rate": 50,
 			"amount": 500,
+			"base_rate": 50,
+			"base_amount": 500,
 			"uom": "_Test UOM",
 			"item_tax_rate": json.dumps({"_Test Account Excise Duty - _TC": 10}),
-			"expense_head": "_Test Account Cost for Goods Sold - _TC",
+			"expense_account": "_Test Account Cost for Goods Sold - _TC",
 			"cost_center": "_Test Cost Center - _TC",
 			"conversion_factor": 1.0,
 		
@@ -246,12 +247,12 @@
 			"item_code": "_Test Item Home Desktop 200",
 			"item_name": "_Test Item Home Desktop 200",
 			"qty": 5,
-			"import_rate": 150,
-			"import_amount": 750,
 			"rate": 150,
 			"amount": 750,
+			"base_rate": 150,
+			"base_amount": 750,
 			"uom": "_Test UOM",
-			"expense_head": "_Test Account Cost for Goods Sold - _TC",
+			"expense_account": "_Test Account Cost for Goods Sold - _TC",
 			"cost_center": "_Test Cost Center - _TC",
 			"conversion_factor": 1.0,
 		},
@@ -362,7 +363,8 @@
 			"company": "_Test Company",
 			"currency": "INR",
 			"conversion_rate": 1.0,
-			"grand_total_import": 0 # for feed
+			"grand_total_import": 0, # for feed
+			"buying_price_list": "_Test Price List"
 		},
 		# items
 		{
@@ -371,9 +373,9 @@
 			"item_code": "_Test Item",
 			"item_name": "_Test Item",
 			"qty": 10.0,
-			"import_rate": 50.0,
+			"rate": 50.0,
 			"uom": "_Test UOM",
-			"expense_head": "_Test Account Cost for Goods Sold - _TC",
+			"expense_account": "_Test Account Cost for Goods Sold - _TC",
 			"cost_center": "_Test Cost Center - _TC",
 			"conversion_factor": 1.0,
 		},
diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt
index 7c249d7..5bb3f5a 100755
--- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt
+++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-05-22 12:43:10", 
   "docstatus": 0, 
-  "modified": "2014-02-03 12:30:39", 
+  "modified": "2014-02-10 17:29:13", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -120,7 +120,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "import_ref_rate", 
+  "fieldname": "price_list_rate", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Price List Rate", 
@@ -130,7 +130,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "discount_rate", 
+  "fieldname": "discount_percentage", 
   "fieldtype": "Float", 
   "in_list_view": 0, 
   "label": "Discount %", 
@@ -144,7 +144,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "purchase_ref_rate", 
+  "fieldname": "base_price_list_rate", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Price List Rate (Company Currency)", 
@@ -159,7 +159,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "import_rate", 
+  "fieldname": "rate", 
   "fieldtype": "Currency", 
   "in_list_view": 1, 
   "label": "Rate ", 
@@ -172,7 +172,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "import_amount", 
+  "fieldname": "amount", 
   "fieldtype": "Currency", 
   "in_list_view": 1, 
   "label": "Amount", 
@@ -189,7 +189,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "rate", 
+  "fieldname": "base_rate", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Rate (Company Currency)", 
@@ -202,7 +202,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "amount", 
+  "fieldname": "base_amount", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Amount (Company Currency)", 
@@ -222,7 +222,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "expense_head", 
+  "fieldname": "expense_account", 
   "fieldtype": "Link", 
   "in_list_view": 0, 
   "label": "Expense Head", 
diff --git a/erpnext/accounts/doctype/sales_invoice/pos.js b/erpnext/accounts/doctype/sales_invoice/pos.js
index 991dad8..673b35b 100644
--- a/erpnext/accounts/doctype/sales_invoice/pos.js
+++ b/erpnext/accounts/doctype/sales_invoice/pos.js
@@ -131,8 +131,8 @@
 		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";
+		// this.amount = export_or_import + "_amount";
+		// this.rate = export_or_import + "_rate";
 	},
 	call_function: function(class_name, fn, event_name) {
 		this.wrapper.find("." + class_name).on(event_name || "click", fn);
@@ -252,7 +252,7 @@
 								</div>', 
 							{
 								item_code: obj.name,
-								item_price: format_currency(obj.ref_rate, obj.currency),
+								item_price: format_currency(obj.price_list_rate, obj.currency),
 								item_name: obj.name===obj.item_name ? "" : obj.item_name,
 								item_image: image
 							})).appendTo($wrap);
@@ -401,8 +401,8 @@
 					item_code: d.item_code,
 					item_name: d.item_name===d.item_code ? "" : ("<br>" + d.item_name),
 					qty: d.qty,
-					rate: format_currency(d[me.rate], me.frm.doc.currency),
-					amount: format_currency(d[me.amount], me.frm.doc.currency)
+					rate: format_currency(d.rate, me.frm.doc.currency),
+					amount: format_currency(d.amount, me.frm.doc.currency)
 				}
 			)).appendTo($items);
 		});
diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py
index e35d64b..aba7ad8 100644
--- a/erpnext/accounts/doctype/sales_invoice/pos.py
+++ b/erpnext/accounts/doctype/sales_invoice/pos.py
@@ -22,9 +22,9 @@
 		args["name"] = "%%%s%%" % item
 
 	return webnotes.conn.sql("""select i.name, i.item_name, i.image, 
-		item_det.ref_rate, item_det.currency 
+		item_det.price_list_rate, item_det.currency 
 		from `tabItem` i LEFT JOIN 
-			(select item_code, ref_rate, currency from 
+			(select item_code, price_list_rate, currency from 
 				`tabItem Price`	where price_list=%s) item_det
 		ON
 			item_det.item_code=i.name
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index f57f6f0..165d483 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -29,12 +29,12 @@
 		self.status_updater = [{
 			'source_dt': 'Sales Invoice Item',
 			'target_field': 'billed_amt',
-			'target_ref_field': 'export_amount',
+			'target_ref_field': 'amount',
 			'target_dt': 'Sales Order Item',
 			'join_field': 'so_detail',
 			'target_parent_dt': 'Sales Order',
 			'target_parent_field': 'per_billed',
-			'source_field': 'export_amount',
+			'source_field': 'amount',
 			'join_field': 'so_detail',
 			'percent_join_field': 'sales_order',
 			'status_field': 'billing_status',
@@ -73,7 +73,7 @@
 		self.validate_c_form()
 		self.validate_time_logs_are_submitted()
 		self.validate_recurring_invoice()
-		self.validate_multiple_billing("Delivery Note", "dn_detail", "export_amount", 
+		self.validate_multiple_billing("Delivery Note", "dn_detail", "amount", 
 			"delivery_note_details")
 
 	def on_submit(self):
@@ -177,7 +177,7 @@
 		if cint(self.doc.is_pos) != 1:
 			return
 		
-		from erpnext.selling.utils import get_pos_settings, apply_pos_settings	
+		from erpnext.stock.get_item_details import get_pos_settings_item_details, get_pos_settings	
 		pos = get_pos_settings(self.doc.company)
 			
 		if pos:
@@ -196,9 +196,9 @@
 			# set pos values in items
 			for item in self.doclist.get({"parentfield": "entries"}):
 				if item.fields.get('item_code'):
-					for fieldname, val in apply_pos_settings(pos, item.fields).items():
-						if (not for_validate) or (for_validate and not item.fields.get(fieldname)):
-							item.fields[fieldname] = val
+					for fname, val in get_pos_settings_item_details(pos, item.fields, pos).items():
+						if (not for_validate) or (for_validate and not item.fields.get(fname)):
+							item.fields[fname] = val
 
 			# fetch terms	
 			if self.doc.tc_name and not self.doc.terms:
@@ -295,13 +295,13 @@
 			super(DocType, self).validate_with_previous_doc(self.tname, {
 				"Sales Order Item": {
 					"ref_dn_field": "so_detail",
-					"compare_fields": [["export_rate", "="]],
+					"compare_fields": [["rate", "="]],
 					"is_child_table": True,
 					"allow_duplicate_prev_row_id": True
 				},
 				"Delivery Note Item": {
 					"ref_dn_field": "dn_detail",
-					"compare_fields": [["export_rate", "="]],
+					"compare_fields": [["rate", "="]],
 					"is_child_table": True
 				}
 			})
@@ -522,12 +522,12 @@
 	def make_item_gl_entries(self, gl_entries):			
 		# income account gl entries	
 		for item in self.doclist.get({"parentfield": "entries"}):
-			if flt(item.amount):
+			if flt(item.base_amount):
 				gl_entries.append(
 					self.get_gl_dict({
 						"account": item.income_account,
 						"against": self.doc.debit_to,
-						"credit": item.amount,
+						"credit": item.base_amount,
 						"remarks": self.doc.remarks,
 						"cost_center": item.cost_center
 					})
@@ -805,10 +805,10 @@
 		bean.run_method("onload_post_render")
 		
 	def update_item(source_doc, target_doc, source_parent):
+		target_doc.base_amount = (flt(source_doc.qty) - flt(source_doc.delivered_qty)) * \
+			flt(source_doc.base_rate)
 		target_doc.amount = (flt(source_doc.qty) - flt(source_doc.delivered_qty)) * \
-			flt(source_doc.basic_rate)
-		target_doc.export_amount = (flt(source_doc.qty) - flt(source_doc.delivered_qty)) * \
-			flt(source_doc.export_rate)
+			flt(source_doc.rate)
 		target_doc.qty = flt(source_doc.qty) - flt(source_doc.delivered_qty)
 	
 	doclist = get_mapped_doclist("Sales Invoice", source_name, 	{
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice_map.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice_map.js
index 179cba3..71bbdb6 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice_map.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice_map.js
@@ -8,7 +8,7 @@
 		},
 		field_map: {
 			"Sales Invoice Item": {
-				"basic_rate": "rate",
+				"base_rate": "rate",
 				"time_log_batch": "name",
 				"qty": "total_hours",
 				"stock_uom": "=Hour",
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index 2ed9847..d2aac03 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -47,8 +47,8 @@
 		si.insert()
 		
 		expected_values = {
-			"keys": ["ref_rate", "adj_rate", "export_rate", "export_amount", 
-				"base_ref_rate", "basic_rate", "amount"],
+			"keys": ["price_list_rate", "discount_percentage", "rate", "amount", 
+				"base_price_list_rate", "base_rate", "base_amount"],
 			"_Test Item Home Desktop 100": [50, 0, 50, 500, 50, 50, 500],
 			"_Test Item Home Desktop 200": [150, 0, 150, 750, 150, 150, 750],
 		}
@@ -90,15 +90,15 @@
 		si = webnotes.bean(copy=test_records[2])
 		si.doc.currency = "USD"
 		si.doc.conversion_rate = 50
-		si.doclist[1].export_rate = 1
-		si.doclist[1].ref_rate = 1
-		si.doclist[2].export_rate = 3
-		si.doclist[2].ref_rate = 3
+		si.doclist[1].rate = 1
+		si.doclist[1].price_list_rate = 1
+		si.doclist[2].rate = 3
+		si.doclist[2].price_list_rate = 3
 		si.insert()
 		
 		expected_values = {
-			"keys": ["ref_rate", "adj_rate", "export_rate", "export_amount", 
-				"base_ref_rate", "basic_rate", "amount"],
+			"keys": ["price_list_rate", "discount_percentage", "rate", "amount", 
+				"base_price_list_rate", "base_rate", "base_amount"],
 			"_Test Item Home Desktop 100": [1, 0, 1, 10, 50, 50, 500],
 			"_Test Item Home Desktop 200": [3, 0, 3, 15, 150, 150, 750],
 		}
@@ -153,8 +153,8 @@
 		si.insert()
 		
 		expected_values = {
-			"keys": ["ref_rate", "adj_rate", "export_rate", "export_amount", 
-				"base_ref_rate", "basic_rate", "amount"],
+			"keys": ["price_list_rate", "discount_percentage", "rate", "amount", 
+				"base_price_list_rate", "base_rate", "base_amount"],
 			"_Test Item Home Desktop 100": [62.5, 0, 62.5, 625.0, 50, 50, 465.37],
 			"_Test Item Home Desktop 200": [190.66, 0, 190.66, 953.3, 150, 150, 698.08],
 		}
@@ -248,8 +248,8 @@
 		for i, tax in enumerate(si.doclist.get({"parentfield": "other_charges"})):
 			tax.idx = i+1
 		
-		si.doclist[1].ref_rate = 62.5
-		si.doclist[1].ref_rate = 191
+		si.doclist[1].price_list_rate = 62.5
+		si.doclist[1].price_list_rate = 191
 		for i in [3, 5, 6, 7, 8, 9]:
 			si.doclist[i].included_in_print_rate = 1
 		
@@ -266,8 +266,8 @@
 		si.insert()
 		
 		expected_values = {
-			"keys": ["ref_rate", "adj_rate", "export_rate", "export_amount", 
-				"base_ref_rate", "basic_rate", "amount"],
+			"keys": ["price_list_rate", "discount_percentage", "rate", "amount", 
+				"base_price_list_rate", "base_rate", "base_amount"],
 			"_Test Item Home Desktop 100": [62.5, 0, 62.5, 625.0, 50, 50, 499.98],
 			"_Test Item Home Desktop 200": [190.66, 0, 190.66, 953.3, 150, 150, 750],
 		}
@@ -310,17 +310,17 @@
 		si = webnotes.bean(copy=test_records[3])
 		si.doc.currency = "USD"
 		si.doc.conversion_rate = 50
-		si.doclist[1].ref_rate = 55.56
-		si.doclist[1].adj_rate = 10
-		si.doclist[2].ref_rate = 187.5
-		si.doclist[2].adj_rate = 20
+		si.doclist[1].price_list_rate = 55.56
+		si.doclist[1].discount_percentage = 10
+		si.doclist[2].price_list_rate = 187.5
+		si.doclist[2].discount_percentage = 20
 		si.doclist[9].rate = 5000
 		
 		si.insert()
 		
 		expected_values = {
-			"keys": ["ref_rate", "adj_rate", "export_rate", "export_amount", 
-				"base_ref_rate", "basic_rate", "amount"],
+			"keys": ["price_list_rate", "discount_percentage", "rate", "amount", 
+				"base_price_list_rate", "base_rate", "base_amount"],
 			"_Test Item Home Desktop 100": [55.56, 10, 50, 500, 2222.11, 1999.9, 19999.04],
 			"_Test Item Home Desktop 200": [187.5, 20, 150, 750, 7375.66, 5900.53, 29502.66],
 		}
@@ -889,12 +889,12 @@
 			"territory": "_Test Territory"
 		}, 
 		{
-			"amount": 500.0, 
-			"basic_rate": 500.0, 
+			"base_amount": 500.0, 
+			"base_rate": 500.0, 
 			"description": "138-CMS Shoe", 
 			"doctype": "Sales Invoice Item", 
-			"export_amount": 500.0, 
-			"export_rate": 500.0, 
+			"amount": 500.0, 
+			"rate": 500.0, 
 			"income_account": "Sales - _TC",
 			"cost_center": "_Test Cost Center - _TC",
 			"item_name": "138-CMS Shoe", 
@@ -959,10 +959,10 @@
 			"doctype": "Sales Invoice Item", 
 			"parentfield": "entries",
 			"qty": 1.0,
-			"basic_rate": 500.0,
+			"base_rate": 500.0,
+			"base_amount": 500.0, 
+			"price_list_rate": 500.0, 
 			"amount": 500.0, 
-			"ref_rate": 500.0, 
-			"export_amount": 500.0, 
 			"income_account": "Sales - _TC",
 			"expense_account": "_Test Account Cost for Goods Sold - _TC",
 			"cost_center": "_Test Cost Center - _TC",
@@ -1011,8 +1011,8 @@
 			"item_code": "_Test Item Home Desktop 100",
 			"item_name": "_Test Item Home Desktop 100",
 			"qty": 10,
-			"ref_rate": 50,
-			"export_rate": 50,
+			"price_list_rate": 50,
+			"rate": 50,
 			"stock_uom": "_Test UOM",
 			"item_tax_rate": json.dumps({"_Test Account Excise Duty - _TC": 10}),
 			"income_account": "Sales - _TC",
@@ -1025,8 +1025,8 @@
 			"item_code": "_Test Item Home Desktop 200",
 			"item_name": "_Test Item Home Desktop 200",
 			"qty": 5,
-			"ref_rate": 150,
-			"export_rate": 150,
+			"price_list_rate": 150,
+			"rate": 150,
 			"stock_uom": "_Test UOM",
 			"income_account": "Sales - _TC",
 			"cost_center": "_Test Cost Center - _TC",
@@ -1137,7 +1137,7 @@
 			"item_code": "_Test Item Home Desktop 100",
 			"item_name": "_Test Item Home Desktop 100",
 			"qty": 10,
-			"ref_rate": 62.5,
+			"price_list_rate": 62.5,
 			"stock_uom": "_Test UOM",
 			"item_tax_rate": json.dumps({"_Test Account Excise Duty - _TC": 10}),
 			"income_account": "Sales - _TC",
@@ -1150,7 +1150,7 @@
 			"item_code": "_Test Item Home Desktop 200",
 			"item_name": "_Test Item Home Desktop 200",
 			"qty": 5,
-			"ref_rate": 190.66,
+			"price_list_rate": 190.66,
 			"stock_uom": "_Test UOM",
 			"income_account": "Sales - _TC",
 			"cost_center": "_Test Cost Center - _TC",
diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.txt b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.txt
index 4d7ae0c..a6b6c6e 100644
--- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.txt
+++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-06-04 11:02:19", 
   "docstatus": 0, 
-  "modified": "2013-12-31 18:27:41", 
+  "modified": "2014-02-10 17:28:47", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -111,7 +111,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "ref_rate", 
+  "fieldname": "price_list_rate", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Price List Rate", 
@@ -124,7 +124,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "adj_rate", 
+  "fieldname": "discount_percentage", 
   "fieldtype": "Float", 
   "in_list_view": 0, 
   "label": "Discount (%)", 
@@ -149,7 +149,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "base_ref_rate", 
+  "fieldname": "base_price_list_rate", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Price List Rate (Company Currency)", 
@@ -166,10 +166,10 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "export_rate", 
+  "fieldname": "rate", 
   "fieldtype": "Currency", 
   "in_list_view": 1, 
-  "label": "Basic Rate", 
+  "label": "Rate", 
   "oldfieldname": "export_rate", 
   "oldfieldtype": "Currency", 
   "options": "currency", 
@@ -178,7 +178,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "export_amount", 
+  "fieldname": "amount", 
   "fieldtype": "Currency", 
   "in_list_view": 1, 
   "label": "Amount", 
@@ -195,11 +195,11 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "basic_rate", 
+  "fieldname": "base_rate", 
   "fieldtype": "Currency", 
   "in_filter": 0, 
   "in_list_view": 0, 
-  "label": "Basic Rate (Company Currency)", 
+  "label": "Rate (Company Currency)", 
   "oldfieldname": "basic_rate", 
   "oldfieldtype": "Currency", 
   "options": "Company:company:default_currency", 
@@ -210,7 +210,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "amount", 
+  "fieldname": "base_amount", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Amount (Company Currency)", 
diff --git a/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.txt b/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.txt
index 19f4972..f16aaaa 100644
--- a/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.txt
+++ b/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-07-30 17:28:49", 
   "docstatus": 0, 
-  "modified": "2013-09-05 12:40:04", 
+  "modified": "2014-02-11 12:40:04", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -10,7 +10,7 @@
   "doctype": "Report", 
   "is_standard": "Yes", 
   "name": "__common__", 
-  "query": "select\n    `tabDelivery Note`.`name` as \"Delivery Note:Link/Delivery Note:120\",\n\t`tabDelivery Note`.`customer` as \"Customer:Link/Customer:120\",\n\t`tabDelivery Note`.`posting_date` as \"Date:Date\",\n\t`tabDelivery Note`.`project_name` as \"Project\",\n\t`tabDelivery Note Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabDelivery Note Item`.`qty` - ifnull((select sum(qty) from `tabSales Invoice Item` \n\t    where `tabSales Invoice Item`.docstatus=1 and \n            `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n\t        `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\n\t\tas \"Qty:Float:110\",\n\t(`tabDelivery Note Item`.`amount` - ifnull((select sum(amount) from `tabSales Invoice Item` \n        where `tabSales Invoice Item`.docstatus=1 and \n            `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n            `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\n\t\tas \"Amount:Currency:110\",\n\t`tabDelivery Note Item`.`item_name` as \"Item Name::150\",\n\t`tabDelivery Note Item`.`description` as \"Description::200\"\nfrom `tabDelivery Note`, `tabDelivery Note Item`\nwhere\n    `tabDelivery Note`.docstatus = 1 and\n\t`tabDelivery Note`.`status` != \"Stopped\" and\n    `tabDelivery Note`.name = `tabDelivery Note Item`.parent and\n    (`tabDelivery Note Item`.qty > ifnull((select sum(qty) from `tabSales Invoice Item` \n        where `tabSales Invoice Item`.docstatus=1 and \n            `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n            `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\norder by `tabDelivery Note`.`name` desc", 
+  "query": "select\n    `tabDelivery Note`.`name` as \"Delivery Note:Link/Delivery Note:120\",\n\t`tabDelivery Note`.`customer` as \"Customer:Link/Customer:120\",\n\t`tabDelivery Note`.`posting_date` as \"Date:Date\",\n\t`tabDelivery Note`.`project_name` as \"Project\",\n\t`tabDelivery Note Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabDelivery Note Item`.`qty` - ifnull((select sum(qty) from `tabSales Invoice Item` \n\t    where `tabSales Invoice Item`.docstatus=1 and \n            `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n\t        `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\n\t\tas \"Qty:Float:110\",\n\t(`tabDelivery Note Item`.`base_amount` - ifnull((select sum(base_amount) from `tabSales Invoice Item` \n        where `tabSales Invoice Item`.docstatus=1 and \n            `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n            `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\n\t\tas \"Amount:Currency:110\",\n\t`tabDelivery Note Item`.`item_name` as \"Item Name::150\",\n\t`tabDelivery Note Item`.`description` as \"Description::200\"\nfrom `tabDelivery Note`, `tabDelivery Note Item`\nwhere\n    `tabDelivery Note`.docstatus = 1 and\n\t`tabDelivery Note`.`status` != \"Stopped\" and\n    `tabDelivery Note`.name = `tabDelivery Note Item`.parent and\n    (`tabDelivery Note Item`.qty > ifnull((select sum(qty) from `tabSales Invoice Item` \n        where `tabSales Invoice Item`.docstatus=1 and \n            `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n            `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\norder by `tabDelivery Note`.`name` desc", 
   "ref_doctype": "Sales Invoice", 
   "report_name": "Delivered Items To Be Billed", 
   "report_type": "Query Report"
diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py
index 4f7a1e4..800f0b9 100644
--- a/erpnext/accounts/report/gross_profit/gross_profit.py
+++ b/erpnext/accounts/report/gross_profit/gross_profit.py
@@ -20,7 +20,7 @@
 		"Gross Profit:Currency", "Gross Profit %:Percent", "Project:Link/Project"]
 	data = []
 	for row in source:
-		selling_amount = flt(row.amount)
+		selling_amount = flt(row.base_amount)
 		
 		item_sales_bom_map = item_sales_bom.get(row.parenttype, {}).get(row.name, webnotes._dict())
 		
@@ -42,8 +42,8 @@
 		icon = """<a href="%s"><i class="icon icon-share" style="cursor: pointer;"></i></a>""" \
 			% ("/".join(["#Form", row.parenttype, row.name]),)
 		data.append([row.name, icon, row.posting_date, row.posting_time, row.item_code, row.item_name,
-			row.description, row.warehouse, row.qty, row.basic_rate, 
-			row.qty and (buying_amount / row.qty) or 0, row.amount, buying_amount,
+			row.description, row.warehouse, row.qty, row.base_rate, 
+			row.qty and (buying_amount / row.qty) or 0, row.base_amount, buying_amount,
 			gross_profit, gross_profit_percent, row.project])
 			
 	return columns, data
@@ -93,7 +93,7 @@
 	delivery_note_items = webnotes.conn.sql("""select item.parenttype, dn.name, 
 		dn.posting_date, dn.posting_time, dn.project_name, 
 		item.item_code, item.item_name, item.description, item.warehouse,
-		item.qty, item.basic_rate, item.amount, item.name as "item_row",
+		item.qty, item.base_rate, item.base_amount, item.name as "item_row",
 		timestamp(dn.posting_date, dn.posting_time) as posting_datetime
 		from `tabDelivery Note` dn, `tabDelivery Note Item` item
 		where item.parent = dn.name and dn.docstatus = 1 %s
@@ -102,7 +102,7 @@
 	sales_invoice_items = webnotes.conn.sql("""select item.parenttype, si.name, 
 		si.posting_date, si.posting_time, si.project_name,
 		item.item_code, item.item_name, item.description, item.warehouse,
-		item.qty, item.basic_rate, item.amount, item.name as "item_row",
+		item.qty, item.base_rate, item.base_amount, item.name as "item_row",
 		timestamp(si.posting_date, si.posting_time) as posting_datetime
 		from `tabSales Invoice` si, `tabSales Invoice Item` item
 		where item.parent = si.name and si.docstatus = 1 %s
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 7d8a358..d70e28e 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
@@ -17,15 +17,15 @@
 	
 	data = []
 	for d in item_list:
-		expense_head = d.expense_head or aii_account_map.get(d.company)
+		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_name, d.credit_to, d.project_name, d.company, d.purchase_order, 
-			d.purchase_receipt, expense_head, d.qty, d.rate, d.amount]
+			d.purchase_receipt, expense_account, d.qty, d.base_rate, d.base_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.amount + total_tax]
+		row += [total_tax, d.base_amount + total_tax]
 		
 		data.append(row)
 	
@@ -60,7 +60,7 @@
 	return webnotes.conn.sql("""select pi_item.parent, pi.posting_date, pi.credit_to, pi.company, 
 		pi.supplier, pi.remarks, 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.expense_head, pi_item.qty, pi_item.rate, pi_item.amount, pi.supplier_name
+		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 
 		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)
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 9f1fd87..0eb6761 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
@@ -18,13 +18,13 @@
 	for d in item_list:
 		row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, 
 			d.customer_name, d.debit_to, d.territory, d.project_name, d.company, d.sales_order, 
-			d.delivery_note, d.income_account, d.qty, d.basic_rate, d.amount]
+			d.delivery_note, d.income_account, d.qty, d.base_rate, d.base_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.amount + total_tax]
+		row += [total_tax, d.base_amount + total_tax]
 		
 		data.append(row)
 	
@@ -58,7 +58,7 @@
 	return webnotes.conn.sql("""select si_item.parent, si.posting_date, si.debit_to, si.project_name, 
 		si.customer, si.remarks, si.territory, si.company, 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.basic_rate, si_item.amount, si.customer_name
+		si_item.qty, si_item.base_rate, si_item.base_amount, si.customer_name
 		from `tabSales Invoice` si, `tabSales Invoice Item` si_item 
 		where si.name = si_item.parent and si.docstatus = 1 %s 
 		order by si.posting_date desc, si_item.item_code desc""" % conditions, filters, as_dict=1)
diff --git a/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.txt b/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.txt
index fd2aa6e..8960823 100644
--- a/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.txt
+++ b/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-02-21 14:26:44", 
   "docstatus": 0, 
-  "modified": "2013-02-22 15:53:01", 
+  "modified": "2014-02-11 15:53:01", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -10,7 +10,7 @@
   "doctype": "Report", 
   "is_standard": "Yes", 
   "name": "__common__", 
-  "query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`status` as \"Status\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project_name` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.amount as \"Amount:Currency:110\",\n (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1)) as \"Billed Amount:Currency:110\",\n (ifnull(`tabSales Order Item`.amount, 0) - (ifnull(`tabSales Order Item`.billed_amt, 0) * ifnull(`tabSales Order`.conversion_rate, 1))) as \"Pending Amount:Currency:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status != \"Stopped\"\n and ifnull(`tabSales Order Item`.billed_amt,0) < ifnull(`tabSales Order Item`.export_amount,0)\norder by `tabSales Order`.transaction_date asc", 
+  "query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`status` as \"Status\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project_name` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.base_amount as \"Amount:Currency:110\",\n (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1)) as \"Billed Amount:Currency:110\",\n (ifnull(`tabSales Order Item`.base_amount, 0) - (ifnull(`tabSales Order Item`.billed_amt, 0) * ifnull(`tabSales Order`.conversion_rate, 1))) as \"Pending Amount:Currency:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status != \"Stopped\"\n and ifnull(`tabSales Order Item`.billed_amt,0) < ifnull(`tabSales Order Item`.amount,0)\norder by `tabSales Order`.transaction_date asc", 
   "ref_doctype": "Sales Invoice", 
   "report_name": "Ordered Items To Be Billed", 
   "report_type": "Query Report"
diff --git a/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.txt b/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.txt
index 6b3bcf7..bcde486 100644
--- a/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.txt
+++ b/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-05-28 15:54:16", 
   "docstatus": 0, 
-  "modified": "2013-06-05 13:01:05", 
+  "modified": "2014-02-11 13:01:05", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -11,7 +11,7 @@
   "doctype": "Report", 
   "is_standard": "Yes", 
   "name": "__common__", 
-  "query": "select \n    `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n    `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order Item`.`project_name` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.amount as \"Amount:Currency:100\",\n\t`tabPurchase Order Item`.billed_amt as \"Billed Amount:Currency:100\", \n\t(`tabPurchase Order Item`.amount - ifnull(`tabPurchase Order Item`.billed_amt, 0)) as \"Amount to Bill:Currency:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status != \"Stopped\"\n\tand ifnull(`tabPurchase Order Item`.billed_amt, 0) < ifnull(`tabPurchase Order Item`.amount, 0)\norder by `tabPurchase Order`.transaction_date asc", 
+  "query": "select \n    `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n    `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order Item`.`project_name` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.base_amount as \"Amount:Currency:100\",\n\t`tabPurchase Order Item`.billed_amt as \"Billed Amount:Currency:100\", \n\t(`tabPurchase Order Item`.base_amount - ifnull(`tabPurchase Order Item`.billed_amt, 0)) as \"Amount to Bill:Currency:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status != \"Stopped\"\n\tand ifnull(`tabPurchase Order Item`.billed_amt, 0) < ifnull(`tabPurchase Order Item`.base_amount, 0)\norder by `tabPurchase Order`.transaction_date asc", 
   "ref_doctype": "Purchase Invoice", 
   "report_name": "Purchase Order Items To Be Billed", 
   "report_type": "Query Report"
diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py
index 9225a08..a3f42da 100644
--- a/erpnext/accounts/report/purchase_register/purchase_register.py
+++ b/erpnext/accounts/report/purchase_register/purchase_register.py
@@ -72,9 +72,9 @@
 	expense_accounts = tax_accounts = expense_columns = tax_columns = []
 	
 	if invoice_list:	
-		expense_accounts = webnotes.conn.sql_list("""select distinct expense_head 
-			from `tabPurchase Invoice Item` where docstatus = 1 and ifnull(expense_head, '') != '' 
-			and parent in (%s) order by expense_head""" % 
+		expense_accounts = webnotes.conn.sql_list("""select distinct expense_account 
+			from `tabPurchase Invoice Item` where docstatus = 1 and ifnull(expense_account, '') != '' 
+			and parent in (%s) order by expense_account""" % 
 			', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]))
 		
 		tax_accounts = 	webnotes.conn.sql_list("""select distinct account_head 
@@ -116,14 +116,14 @@
 	
 	
 def get_invoice_expense_map(invoice_list):
-	expense_details = webnotes.conn.sql("""select parent, expense_head, sum(amount) as amount
-		from `tabPurchase Invoice Item` where parent in (%s) group by parent, expense_head""" % 
+	expense_details = webnotes.conn.sql("""select parent, expense_account, sum(base_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)
 	
 	invoice_expense_map = {}
 	for d in expense_details:
-		invoice_expense_map.setdefault(d.parent, webnotes._dict()).setdefault(d.expense_head, [])
-		invoice_expense_map[d.parent][d.expense_head] = flt(d.amount)
+		invoice_expense_map.setdefault(d.parent, webnotes._dict()).setdefault(d.expense_account, [])
+		invoice_expense_map[d.parent][d.expense_account] = flt(d.amount)
 	
 	return invoice_expense_map
 	
diff --git a/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.txt b/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.txt
index b792684..f7afd3b 100644
--- a/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.txt
+++ b/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-07-30 18:35:10", 
   "docstatus": 0, 
-  "modified": "2013-07-31 11:46:57", 
+  "modified": "2014-02-11 11:46:57", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -10,7 +10,7 @@
   "doctype": "Report", 
   "is_standard": "Yes", 
   "name": "__common__", 
-  "query": "select\n    `tabPurchase Receipt`.`name` as \"Purchase Receipt:Link/Purchase Receipt:120\",\n    `tabPurchase Receipt`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Receipt`.`posting_date` as \"Date:Date\",\n\t`tabPurchase Receipt Item`.`project_name` as \"Project\",\n\t`tabPurchase Receipt Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabPurchase Receipt Item`.`qty` - ifnull((select sum(qty) from `tabPurchase Invoice Item` \n\t    where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n\t        `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\n\t\tas \"Qty:Float:110\",\n\t(`tabPurchase Receipt Item`.`amount` - ifnull((select sum(amount) from `tabPurchase Invoice Item` \n        where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n            `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\n\t\tas \"Amount:Currency:110\",\n\t`tabPurchase Receipt Item`.`item_name` as \"Item Name::150\",\n\t`tabPurchase Receipt Item`.`description` as \"Description::200\"\nfrom `tabPurchase Receipt`, `tabPurchase Receipt Item`\nwhere\n    `tabPurchase Receipt`.docstatus = 1 and\n\t`tabPurchase Receipt`.`status` != \"Stopped\" and\n    `tabPurchase Receipt`.name = `tabPurchase Receipt Item`.parent and\n    (`tabPurchase Receipt Item`.qty > ifnull((select sum(qty) from `tabPurchase Invoice Item` \n        where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n            `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\norder by `tabPurchase Receipt`.`name` desc", 
+  "query": "select\n    `tabPurchase Receipt`.`name` as \"Purchase Receipt:Link/Purchase Receipt:120\",\n    `tabPurchase Receipt`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Receipt`.`posting_date` as \"Date:Date\",\n\t`tabPurchase Receipt Item`.`project_name` as \"Project\",\n\t`tabPurchase Receipt Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabPurchase Receipt Item`.`qty` - ifnull((select sum(qty) from `tabPurchase Invoice Item` \n\t    where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n\t        `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\n\t\tas \"Qty:Float:110\",\n\t(`tabPurchase Receipt Item`.`base_amount` - ifnull((select sum(base_amount) from `tabPurchase Invoice Item` \n        where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n            `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\n\t\tas \"Amount:Currency:110\",\n\t`tabPurchase Receipt Item`.`item_name` as \"Item Name::150\",\n\t`tabPurchase Receipt Item`.`description` as \"Description::200\"\nfrom `tabPurchase Receipt`, `tabPurchase Receipt Item`\nwhere\n    `tabPurchase Receipt`.docstatus = 1 and\n\t`tabPurchase Receipt`.`status` != \"Stopped\" and\n    `tabPurchase Receipt`.name = `tabPurchase Receipt Item`.parent and\n    (`tabPurchase Receipt Item`.qty > ifnull((select sum(qty) from `tabPurchase Invoice Item` \n        where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n            `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\norder by `tabPurchase Receipt`.`name` desc", 
   "ref_doctype": "Purchase Invoice", 
   "report_name": "Received Items To Be Billed", 
   "report_type": "Query Report"
diff --git a/erpnext/accounts/report/sales_register/sales_register.py b/erpnext/accounts/report/sales_register/sales_register.py
index 8fab6a9..4ed1cdd 100644
--- a/erpnext/accounts/report/sales_register/sales_register.py
+++ b/erpnext/accounts/report/sales_register/sales_register.py
@@ -114,7 +114,7 @@
 		conditions, filters, as_dict=1)
 	
 def get_invoice_income_map(invoice_list):
-	income_details = webnotes.conn.sql("""select parent, income_account, sum(amount) as amount
+	income_details = webnotes.conn.sql("""select parent, income_account, sum(base_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)
 	
diff --git a/erpnext/buying/Print Format/Purchase Order Classic/Purchase Order Classic.txt b/erpnext/buying/Print Format/Purchase Order Classic/Purchase Order Classic.txt
index f1514c9..508dfd0 100644
--- a/erpnext/buying/Print Format/Purchase Order Classic/Purchase Order Classic.txt
+++ b/erpnext/buying/Print Format/Purchase Order Classic/Purchase Order Classic.txt
@@ -2,14 +2,14 @@
  {
   "creation": "2012-04-17 11:29:12", 
   "docstatus": 0, 
-  "modified": "2013-08-07 20:00:45", 
+  "modified": "2014-02-11 20:00:45", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
  {
   "doc_type": "Purchase Order", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Georgia\", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Georgia\", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Purchase Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'po_details',\n\t\t\t\t'Purchase Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'import_rate', 'import_amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t]\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Purchase Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\trows +=\n\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount / (doc.conversion_rate || 1), doc.currency) + '</td>\\n' +\n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>'<h1>' + (doc.select_print_heading || 'Purchase Order') + '</h1>'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.supplier_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Purchase Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_import</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Georgia\", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Georgia\", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Purchase Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'po_details',\n\t\t\t\t'Purchase Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t]\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Purchase Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\trows +=\n\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount / (doc.conversion_rate || 1), doc.currency) + '</td>\\n' +\n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>'<h1>' + (doc.select_print_heading || 'Purchase Order') + '</h1>'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.supplier_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Purchase Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_import</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n", 
   "module": "Buying", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/buying/Print Format/Purchase Order Modern/Purchase Order Modern.txt b/erpnext/buying/Print Format/Purchase Order Modern/Purchase Order Modern.txt
index 9e0693a..ddeb99a 100644
--- a/erpnext/buying/Print Format/Purchase Order Modern/Purchase Order Modern.txt
+++ b/erpnext/buying/Print Format/Purchase Order Modern/Purchase Order Modern.txt
@@ -2,14 +2,14 @@
  {
   "creation": "2012-04-17 11:29:12", 
   "docstatus": 0, 
-  "modified": "2013-08-07 20:12:05", 
+  "modified": "2014-02-11 20:12:05", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
  {
   "doc_type": "Purchase Order", 
   "doctype": "Print Format", 
-  "html": "<!--\n    Sample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n        line-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Purchase Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'po_details',\n\t\t\t\t'Purchase Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'import_rate', 'import_amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t]\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Purchase Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\trows +=\n\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount / (doc.conversion_rate || 1), doc.currency) + '</td>\\n' +\n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Purchase Order') + '</h1>'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style=\"height:15px\"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.supplier_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class='imp-details'>\n\t\t\t\t\t\t<td><b>Purchase Order No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Purchase Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr style='font-weight: bold' class='imp-details'>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_import</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>\n", 
+  "html": "<!--\n    Sample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n        line-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Purchase Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'po_details',\n\t\t\t\t'Purchase Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t]\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Purchase Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\trows +=\n\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount / (doc.conversion_rate || 1), doc.currency) + '</td>\\n' +\n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Purchase Order') + '</h1>'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style=\"height:15px\"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.supplier_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class='imp-details'>\n\t\t\t\t\t\t<td><b>Purchase Order No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Purchase Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr style='font-weight: bold' class='imp-details'>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_import</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>\n", 
   "module": "Buying", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/buying/Print Format/Purchase Order Spartan/Purchase Order Spartan.txt b/erpnext/buying/Print Format/Purchase Order Spartan/Purchase Order Spartan.txt
index 79016a7..632305b 100644
--- a/erpnext/buying/Print Format/Purchase Order Spartan/Purchase Order Spartan.txt
+++ b/erpnext/buying/Print Format/Purchase Order Spartan/Purchase Order Spartan.txt
@@ -2,14 +2,14 @@
  {
   "creation": "2012-04-17 11:29:12", 
   "docstatus": 0, 
-  "modified": "2013-08-07 20:01:38", 
+  "modified": "2014-02-11 20:01:38", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
  {
   "doc_type": "Purchase Order", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Purchase Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'po_details',\n\t\t\t\t'Purchase Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'import_rate', 'import_amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t]\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Purchase Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\trows +=\n\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount / (doc.conversion_rate || 1), doc.currency) + '</td>\\n' +\n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Purchase Order') + '</h1>'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.supplier_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Purchase Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_import</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Purchase Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'po_details',\n\t\t\t\t'Purchase Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t]\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Purchase Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\trows +=\n\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount / (doc.conversion_rate || 1), doc.currency) + '</td>\\n' +\n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Purchase Order') + '</h1>'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.supplier_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Purchase Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_import</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n", 
   "module": "Buying", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js
index 95250ba..937e60d 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.js
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.js
@@ -73,70 +73,33 @@
 		this.supplier_address();
 	},
 	
-	item_code: function(doc, cdt, cdn) {
-		var me = this;
-		var item = wn.model.get_doc(cdt, cdn);
-		if(item.item_code) {
-			if(!this.validate_company_and_party("supplier")) {
-				cur_frm.fields_dict[me.frm.cscript.fname].grid.grid_rows[item.idx - 1].remove();
-			} else {
-				return this.frm.call({
-					method: "erpnext.buying.utils.get_item_details",
-					child: item,
-					args: {
-						args: {
-							item_code: item.item_code,
-							warehouse: item.warehouse,
-							doctype: me.frm.doc.doctype,
-							docname: me.frm.doc.name,
-							supplier: me.frm.doc.supplier,
-							conversion_rate: me.frm.doc.conversion_rate,
-							buying_price_list: me.frm.doc.buying_price_list,
-							price_list_currency: me.frm.doc.price_list_currency,
-							plc_conversion_rate: me.frm.doc.plc_conversion_rate,
-							is_subcontracted: me.frm.doc.is_subcontracted,
-							company: me.frm.doc.company,
-							currency: me.frm.doc.currency,
-							transaction_date: me.frm.doc.transaction_date
-						}
-					},
-					callback: function(r) {
-						if(!r.exc) {
-							me.frm.script_manager.trigger("import_ref_rate", cdt, cdn);
-						}
-					}
-				});
-			}
-		}
-	},
-	
 	buying_price_list: function() {
 		this.get_price_list_currency("Buying");
 	},
 	
-	import_ref_rate: function(doc, cdt, cdn) {
+	price_list_rate: function(doc, cdt, cdn) {
 		var item = wn.model.get_doc(cdt, cdn);
-		wn.model.round_floats_in(item, ["import_ref_rate", "discount_rate"]);
+		wn.model.round_floats_in(item, ["price_list_rate", "discount_percentage"]);
 		
-		item.import_rate = flt(item.import_ref_rate * (1 - item.discount_rate / 100.0),
-			precision("import_rate", item));
+		item.rate = flt(item.price_list_rate * (1 - item.discount_percentage / 100.0),
+			precision("rate", item));
 		
 		this.calculate_taxes_and_totals();
 	},
 	
-	discount_rate: function(doc, cdt, cdn) {
-		this.import_ref_rate(doc, cdt, cdn);
+	discount_percentage: function(doc, cdt, cdn) {
+		this.price_list_rate(doc, cdt, cdn);
 	},
 	
-	import_rate: function(doc, cdt, cdn) {
+	rate: function(doc, cdt, cdn) {
 		var item = wn.model.get_doc(cdt, cdn);
-		wn.model.round_floats_in(item, ["import_rate", "discount_rate"]);
+		wn.model.round_floats_in(item, ["rate", "discount_percentage"]);
 		
-		if(item.import_ref_rate) {
-			item.discount_rate = flt((1 - item.import_rate / item.import_ref_rate) * 100.0,
-				precision("discount_rate", item));
+		if(item.price_list_rate) {
+			item.discount_percentage = flt((1 - item.rate / item.price_list_rate) * 100.0,
+				precision("discount_percentage", item));
 		} else {
-			item.discount_rate = 0.0;
+			item.discount_percentage = 0.0;
 		}
 		
 		this.calculate_taxes_and_totals();
@@ -219,25 +182,14 @@
 	calculate_item_values: function() {
 		var me = this;
 		
-		if(this.frm.doc.doctype != "Purchase Invoice") {
-			// hack!
-			var purchase_rate_df = wn.meta.get_docfield(this.tname, "rate", this.frm.doc.name);
-			wn.meta.docfield_copy[this.tname][this.frm.doc.name]["rate"] = 
-				$.extend({}, purchase_rate_df);
-		}
-		
 		$.each(this.frm.item_doclist, function(i, item) {
-			if(me.frm.doc.doctype != "Purchase Invoice") {
-				item.rate = item.purchase_rate;
-			}
-			
 			wn.model.round_floats_in(item);
-			item.import_amount = flt(item.import_rate * item.qty, precision("import_amount", item));
+			item.amount = flt(item.rate * item.qty, precision("amount", item));
 			item.item_tax_amount = 0.0;
 			
-			me._set_in_company_currency(item, "import_ref_rate", "purchase_ref_rate");
-			me._set_in_company_currency(item, "import_rate", "rate");
-			me._set_in_company_currency(item, "import_amount", "amount");
+			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");
 		});
 		
 	},
@@ -247,8 +199,8 @@
 
 		this.frm.doc.net_total = this.frm.doc.net_total_import = 0.0;
 		$.each(this.frm.item_doclist, function(i, item) {
-			me.frm.doc.net_total += item.amount;
-			me.frm.doc.net_total_import += item.import_amount;
+			me.frm.doc.net_total += item.base_amount;
+			me.frm.doc.net_total_import += item.amount;
 		});
 		
 		wn.model.round_floats_in(this.frm.doc, ["net_total", "net_total_import"]);
@@ -300,18 +252,6 @@
 	_cleanup: function() {
 		this._super();
 		this.frm.doc.in_words = this.frm.doc.in_words_import = "";
-
-		// except in purchase invoice, rate field is purchase_rate		
-		// reset fieldname of rate
-		if(this.frm.doc.doctype != "Purchase Invoice") {
-			// clear hack
-			delete wn.meta.docfield_copy[this.tname][this.frm.doc.name]["rate"];
-			
-			$.each(this.frm.item_doclist, function(i, item) {
-				item.purchase_rate = item.rate;
-				delete item["rate"];
-			});
-		}
 		
 		if(this.frm.item_doclist.length) {
 			if(!wn.meta.get_docfield(this.frm.item_doclist[0].doctype, "item_tax_amount", this.frm.doctype)) {
@@ -414,10 +354,10 @@
 			});
 		};
 		
-		setup_field_label_map(["purchase_rate", "purchase_ref_rate", "amount", "rate"],
+		setup_field_label_map(["base_rate", "base_price_list_rate", "base_amount", "base_rate"],
 			company_currency, this.fname);
 		
-		setup_field_label_map(["import_rate", "import_ref_rate", "import_amount"],
+		setup_field_label_map(["rate", "price_list_rate", "amount"],
 			this.frm.doc.currency, this.fname);
 		
 		if(this.frm.fields_dict[this.other_fname]) {
@@ -431,7 +371,7 @@
 		
 		// toggle columns
 		var item_grid = this.frm.fields_dict[this.fname].grid;
-		var fieldnames = $.map(["purchase_rate", "purchase_ref_rate", "amount", "rate"], function(fname) {
+		var fieldnames = $.map(["base_rate", "base_price_list_rate", "base_amount", "base_rate"], function(fname) {
 			return wn.meta.get_docfield(item_grid.doctype, fname, me.frm.docname) ? fname : null;
 		});
 		
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.py b/erpnext/buying/doctype/purchase_common/purchase_common.py
index 2ec67fd..49c8793 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.py
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.py
@@ -8,7 +8,7 @@
 from webnotes.model.utils import getlist
 from webnotes import msgprint, _
 
-from erpnext.buying.utils import get_last_purchase_details
+from erpnext.stock.doctype.item.item import get_last_purchase_details
 from erpnext.controllers.buying_controller import BuyingController
 
 class DocType(BuyingController):
@@ -30,12 +30,12 @@
 			last_purchase_rate = None
 			if last_purchase_details and \
 					(last_purchase_details.purchase_date > this_purchase_date):
-				last_purchase_rate = last_purchase_details['purchase_rate']
+				last_purchase_rate = last_purchase_details['base_rate']
 			elif is_submit == 1:
 				# even if this transaction is the latest one, it should be submitted
 				# for it to be considered for latest purchase rate
 				if flt(d.conversion_factor):
-					last_purchase_rate = flt(d.purchase_rate) / flt(d.conversion_factor)
+					last_purchase_rate = flt(d.base_rate) / flt(d.conversion_factor)
 				else:
 					webnotes.throw(_("Row ") + cstr(d.idx) + ": " + 
 						_("UOM Conversion Factor is mandatory"))
@@ -55,20 +55,20 @@
 				last_purchase_details = get_last_purchase_details(d.item_code, doc_name)
 
 				if last_purchase_details:
-					d.purchase_ref_rate = last_purchase_details['purchase_ref_rate'] * (flt(d.conversion_factor) or 1.0)
-					d.discount_rate = last_purchase_details['discount_rate']
-					d.purchase_rate = last_purchase_details['purchase_rate'] * (flt(d.conversion_factor) or 1.0)
-					d.import_ref_rate = d.purchase_ref_rate / conversion_rate
-					d.import_rate = d.purchase_rate / conversion_rate
+					d.base_price_list_rate = last_purchase_details['base_price_list_rate'] * (flt(d.conversion_factor) or 1.0)
+					d.discount_percentage = last_purchase_details['discount_percentage']
+					d.base_rate = last_purchase_details['base_rate'] * (flt(d.conversion_factor) or 1.0)
+					d.price_list_rate = d.base_price_list_rate / conversion_rate
+					d.rate = d.base_rate / conversion_rate
 				else:
 					# if no last purchase found, reset all values to 0
-					d.purchase_ref_rate = d.purchase_rate = d.import_ref_rate = d.import_rate = d.discount_rate = 0
+					d.base_price_list_rate = d.base_rate = d.price_list_rate = d.rate = d.discount_percentage = 0
 					
 					item_last_purchase_rate = webnotes.conn.get_value("Item",
 						d.item_code, "last_purchase_rate")
 					if item_last_purchase_rate:
-						d.purchase_ref_rate = d.purchase_rate = d.import_ref_rate \
-							= d.import_rate = item_last_purchase_rate
+						d.base_price_list_rate = d.base_rate = d.price_list_rate \
+							= d.rate = item_last_purchase_rate
 			
 	def validate_for_items(self, obj):
 		check_list, chk_dupl_itm=[],[]
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index 89e9806..b35b388 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -58,7 +58,7 @@
 			},
 			"Supplier Quotation Item": {
 				"ref_dn_field": "supplier_quotation_item",
-				"compare_fields": [["import_rate", "="], ["project_name", "="], ["item_code", "="], 
+				"compare_fields": [["rate", "="], ["project_name", "="], ["item_code", "="], 
 					["uom", "="]],
 				"is_child_table": True
 			}
@@ -190,8 +190,8 @@
 	def update_item(obj, target, source_parent):
 		target.qty = flt(obj.qty) - flt(obj.received_qty)
 		target.stock_qty = (flt(obj.qty) - flt(obj.received_qty)) * flt(obj.conversion_factor)
-		target.import_amount = (flt(obj.qty) - flt(obj.received_qty)) * flt(obj.import_rate)
-		target.amount = (flt(obj.qty) - flt(obj.received_qty)) * flt(obj.purchase_rate)
+		target.amount = (flt(obj.qty) - flt(obj.received_qty)) * flt(obj.rate)
+		target.base_amount = (flt(obj.qty) - flt(obj.received_qty)) * flt(obj.base_rate)
 
 	doclist = get_mapped_doclist("Purchase Order", source_name,	{
 		"Purchase Order": {
@@ -227,10 +227,10 @@
 		bean.run_method("set_missing_values")
 
 	def update_item(obj, target, source_parent):
-		target.import_amount = flt(obj.import_amount) - flt(obj.billed_amt)
-		target.amount = target.import_amount * flt(source_parent.conversion_rate)
-		if flt(obj.purchase_rate):
-			target.qty = target.amount / flt(obj.purchase_rate)
+		target.amount = flt(obj.amount) - flt(obj.billed_amt)
+		target.base_amount = target.amount * flt(source_parent.conversion_rate)
+		if flt(obj.base_rate):
+			target.qty = target.base_amount / flt(obj.base_rate)
 
 	doclist = get_mapped_doclist("Purchase Order", source_name,	{
 		"Purchase Order": {
@@ -244,10 +244,9 @@
 			"field_map": {
 				"name": "po_detail", 
 				"parent": "purchase_order", 
-				"purchase_rate": "rate"
 			},
 			"postprocess": update_item,
-			"condition": lambda doc: doc.amount==0 or doc.billed_amt < doc.import_amount 
+			"condition": lambda doc: doc.base_amount==0 or doc.billed_amt < doc.amount 
 		}, 
 		"Purchase Taxes and Charges": {
 			"doctype": "Purchase Taxes and Charges", 
diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
index 2aede08..5585080 100644
--- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
@@ -129,6 +129,7 @@
 			"net_total": 5000.0, 
 			"grand_total": 5000.0,
 			"grand_total_import": 5000.0,
+			"buying_price_list": "_Test Price List"
 		}, 
 		{
 			"conversion_factor": 1.0, 
@@ -138,8 +139,8 @@
 			"item_name": "_Test FG Item", 
 			"parentfield": "po_details", 
 			"qty": 10.0,
-			"import_rate": 500.0,
-			"amount": 5000.0,
+			"rate": 500.0,
+			"base_amount": 5000.0,
 			"warehouse": "_Test Warehouse - _TC", 
 			"stock_uom": "_Test UOM", 
 			"uom": "_Test UOM",
diff --git a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.txt b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.txt
index 8400973..334c74b 100755
--- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.txt
+++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-05-24 19:29:06", 
   "docstatus": 0, 
-  "modified": "2014-02-03 12:08:21", 
+  "modified": "2014-02-10 17:29:01", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -178,7 +178,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "import_ref_rate", 
+  "fieldname": "price_list_rate", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Price List Rate", 
@@ -188,7 +188,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "discount_rate", 
+  "fieldname": "discount_percentage", 
   "fieldtype": "Float", 
   "in_list_view": 0, 
   "label": "Discount %", 
@@ -202,7 +202,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "purchase_ref_rate", 
+  "fieldname": "base_price_list_rate", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Price List Rate (Company Currency)", 
@@ -217,7 +217,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "import_rate", 
+  "fieldname": "rate", 
   "fieldtype": "Currency", 
   "hidden": 0, 
   "in_list_view": 1, 
@@ -230,7 +230,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "import_amount", 
+  "fieldname": "amount", 
   "fieldtype": "Currency", 
   "in_list_view": 1, 
   "label": "Amount", 
@@ -246,7 +246,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "purchase_rate", 
+  "fieldname": "base_rate", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Rate (Company Currency)", 
@@ -261,7 +261,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "amount", 
+  "fieldname": "base_amount", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Amount (Company Currency)", 
diff --git a/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py
index 82444ea..23d593e 100644
--- a/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py
+++ b/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py
@@ -46,7 +46,8 @@
 			"net_total": 5000.0, 
 			"grand_total": 5000.0,
 			"grand_total_import": 5000.0,
-			"naming_series": "_T-Supplier Quotation-"
+			"naming_series": "_T-Supplier Quotation-",
+			"buying_price_list": "_Test Price List"
 		}, 
 		{
 			"description": "_Test FG Item", 
@@ -55,8 +56,8 @@
 			"item_name": "_Test FG Item", 
 			"parentfield": "quotation_items", 
 			"qty": 10.0,
-			"import_rate": 500.0,
-			"amount": 5000.0,
+			"rate": 500.0,
+			"base_amount": 5000.0,
 			"warehouse": "_Test Warehouse - _TC", 
 			"uom": "_Test UOM",
 		}
diff --git a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt
index cffe811..30666bb 100644
--- a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt
+++ b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-05-22 12:43:10", 
   "docstatus": 0, 
-  "modified": "2014-02-03 11:47:21", 
+  "modified": "2014-02-10 17:28:54", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -106,7 +106,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "import_ref_rate", 
+  "fieldname": "price_list_rate", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Price List Rate", 
@@ -116,7 +116,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "discount_rate", 
+  "fieldname": "discount_percentage", 
   "fieldtype": "Float", 
   "in_list_view": 0, 
   "label": "Discount %", 
@@ -145,7 +145,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "purchase_ref_rate", 
+  "fieldname": "base_price_list_rate", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Price List Rate (Company Currency)", 
@@ -160,7 +160,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "import_rate", 
+  "fieldname": "rate", 
   "fieldtype": "Currency", 
   "hidden": 0, 
   "in_list_view": 1, 
@@ -173,7 +173,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "import_amount", 
+  "fieldname": "amount", 
   "fieldtype": "Currency", 
   "in_list_view": 1, 
   "label": "Amount", 
@@ -189,7 +189,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "purchase_rate", 
+  "fieldname": "base_rate", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Rate (Company Currency)", 
@@ -204,7 +204,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "amount", 
+  "fieldname": "base_amount", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Amount (Company Currency)", 
diff --git a/erpnext/buying/report/item_wise_purchase_history/item_wise_purchase_history.txt b/erpnext/buying/report/item_wise_purchase_history/item_wise_purchase_history.txt
index 2775022..ca6b424 100644
--- a/erpnext/buying/report/item_wise_purchase_history/item_wise_purchase_history.txt
+++ b/erpnext/buying/report/item_wise_purchase_history/item_wise_purchase_history.txt
@@ -11,7 +11,7 @@
   "doctype": "Report", 
   "is_standard": "Yes", 
   "name": "__common__", 
-  "query": "select\n    po_item.item_code as \"Item Code:Link/Item:120\",\n\tpo_item.item_name as \"Item Name::120\",\n\tpo_item.description as \"Description::150\",\n\tpo_item.qty as \"Qty:Float:100\",\n\tpo_item.stock_uom as \"UOM:Link/UOM:80\",\n\tpo_item.purchase_rate as \"Rate:Currency:120\",\n\tpo_item.amount as \"Amount:Currency:120\",\n\tpo.name as \"Purchase Order:Link/Purchase Order:120\",\n\tpo.transaction_date as \"Transaction Date:Date:140\",\n\tpo.supplier as \"Supplier:Link/Supplier:130\",\n\tpo_item.project_name as \"Project:Link/Project:130\",\n\tifnull(po_item.received_qty, 0) as \"Received Qty:Float:120\"\nfrom\n\t`tabPurchase Order` po, `tabPurchase Order Item` po_item\nwhere\n\tpo.name = po_item.parent and po.docstatus = 1\norder by po.name desc", 
+  "query": "select\n    po_item.item_code as \"Item Code:Link/Item:120\",\n\tpo_item.item_name as \"Item Name::120\",\n\tpo_item.description as \"Description::150\",\n\tpo_item.qty as \"Qty:Float:100\",\n\tpo_item.stock_uom as \"UOM:Link/UOM:80\",\n\tpo_item.base_rate as \"Rate:Currency:120\",\n\tpo_item.base_amount as \"Amount:Currency:120\",\n\tpo.name as \"Purchase Order:Link/Purchase Order:120\",\n\tpo.transaction_date as \"Transaction Date:Date:140\",\n\tpo.supplier as \"Supplier:Link/Supplier:130\",\n\tpo_item.project_name as \"Project:Link/Project:130\",\n\tifnull(po_item.received_qty, 0) as \"Received Qty:Float:120\"\nfrom\n\t`tabPurchase Order` po, `tabPurchase Order Item` po_item\nwhere\n\tpo.name = po_item.parent and po.docstatus = 1\norder by po.name desc", 
   "ref_doctype": "Purchase Order", 
   "report_name": "Item-wise Purchase History", 
   "report_type": "Query Report"
diff --git a/erpnext/buying/utils.py b/erpnext/buying/utils.py
deleted file mode 100644
index d686b71..0000000
--- a/erpnext/buying/utils.py
+++ /dev/null
@@ -1,204 +0,0 @@
-# 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 webnotes
-from webnotes import msgprint, _, throw
-from webnotes.utils import getdate, flt, add_days, cstr
-import json
-
-@webnotes.whitelist()
-def get_item_details(args):
-	"""
-		args = {
-			"doctype": "",
-			"docname": "",
-			"item_code": "",
-			"warehouse": None,
-			"supplier": None,
-			"transaction_date": None,
-			"conversion_rate": 1.0,
-			"buying_price_list": None,
-			"price_list_currency": None,
-			"plc_conversion_rate": 1.0,
-			"is_subcontracted": "Yes" / "No"
-		}
-	"""
-	if isinstance(args, basestring):
-		args = json.loads(args)
-		
-	args = webnotes._dict(args)
-	
-	item_bean = webnotes.bean("Item", args.item_code)
-	item = item_bean.doc
-	
-	_validate_item_details(args, item)
-	
-	out = _get_basic_details(args, item_bean)
-	
-	out.supplier_part_no = _get_supplier_part_no(args, item_bean)
-	
-	if not out.warehouse:
-		out.warehouse = item_bean.doc.default_warehouse
-	
-	if out.warehouse:
-		out.projected_qty = get_projected_qty(item.name, out.warehouse)
-	
-	if args.transaction_date and item.lead_time_days:
-		out.schedule_date = out.lead_time_date = add_days(args.transaction_date,
-			item.lead_time_days)
-			
-	meta = webnotes.get_doctype(args.doctype)
-	
-	if meta.get_field("currency"):
-		out.purchase_ref_rate = out.discount_rate = out.purchase_rate = \
-			out.import_ref_rate = out.import_rate = 0.0
-		out.update(_get_price_list_rate(args, item_bean, meta))
-	
-	if args.doctype == "Material Request":
-		out.min_order_qty = flt(item.min_order_qty)
-	
-	return out
-	
-def _get_basic_details(args, item_bean):
-	item = item_bean.doc
-	
-	out = webnotes._dict({
-		"description": item.description_html or item.description,
-		"qty": 1.0,
-		"uom": item.stock_uom,
-		"conversion_factor": 1.0,
-		"warehouse": args.warehouse or item.default_warehouse,
-		"item_tax_rate": json.dumps(dict(([d.tax_type, d.tax_rate] for d in 
-			item_bean.doclist.get({"parentfield": "item_tax"})))),
-		"batch_no": None,
-		"expense_head": item.purchase_account \
-			or webnotes.conn.get_value("Company", args.company, "default_expense_account"),
-		"cost_center": item.cost_center
-	})
-	
-	for fieldname in ("item_name", "item_group", "brand", "stock_uom"):
-		out[fieldname] = item.fields.get(fieldname)
-	
-	return out
-	
-def _get_price_list_rate(args, item_bean, meta):
-	from erpnext.utilities.transaction_base import validate_currency
-	item = item_bean.doc
-	out = webnotes._dict()
-	
-	# try fetching from price list
-	if args.buying_price_list and args.price_list_currency:
-		price_list_rate = webnotes.conn.sql("""select ip.ref_rate from 
-			`tabItem Price` ip, `tabPrice List` pl 
-			where ip.price_list=pl.name and ip.price_list=%s and 
-			ip.item_code=%s and ip.buying=1 and pl.enabled=1""", 
-			(args.buying_price_list, args.item_code), as_dict=1)
-		
-		if price_list_rate:
-			validate_currency(args, item_bean.doc, meta)
-				
-			out.import_ref_rate = flt(price_list_rate[0].ref_rate) * \
-				flt(args.plc_conversion_rate) / flt(args.conversion_rate)
-		
-	# if not found, fetch from last purchase transaction
-	if not out.import_ref_rate:
-		last_purchase = get_last_purchase_details(item.name, args.docname, args.conversion_rate)
-		if last_purchase:
-			out.update(last_purchase)
-	
-	if out.import_ref_rate or out.import_rate:
-		validate_currency(args, item, meta)
-	
-	return out
-	
-def _get_supplier_part_no(args, item_bean):
-	item_supplier = item_bean.doclist.get({"parentfield": "item_supplier_details",
-		"supplier": args.supplier})
-	
-	return item_supplier and item_supplier[0].supplier_part_no or None
-
-def _validate_item_details(args, item):
-	# TODO
-	# from erpnext.utilities.transaction_base import validate_item_fetch
-	# validate_item_fetch(args, item)
-	
-	# validate if purchase item or subcontracted item
-	if item.is_purchase_item != "Yes":
-		throw(_("Item") + (" %s: " % item.name) + _("not a purchase item"))
-	
-	if args.is_subcontracted == "Yes" and item.is_sub_contracted_item != "Yes":
-		throw(_("Item") + (" %s: " % item.name) + 
-			_("not a sub-contracted item.") +
-			_("Please select a sub-contracted item or do not sub-contract the transaction."))
-
-def get_last_purchase_details(item_code, doc_name=None, conversion_rate=1.0):
-	"""returns last purchase details in stock uom"""
-	# get last purchase order item details
-	last_purchase_order = webnotes.conn.sql("""\
-		select po.name, po.transaction_date, po.conversion_rate,
-			po_item.conversion_factor, po_item.purchase_ref_rate, 
-			po_item.discount_rate, po_item.purchase_rate
-		from `tabPurchase Order` po, `tabPurchase Order Item` po_item
-		where po.docstatus = 1 and po_item.item_code = %s and po.name != %s and 
-			po.name = po_item.parent
-		order by po.transaction_date desc, po.name desc
-		limit 1""", (item_code, cstr(doc_name)), as_dict=1)
-
-	# get last purchase receipt item details		
-	last_purchase_receipt = webnotes.conn.sql("""\
-		select pr.name, pr.posting_date, pr.posting_time, pr.conversion_rate,
-			pr_item.conversion_factor, pr_item.purchase_ref_rate, pr_item.discount_rate,
-			pr_item.purchase_rate
-		from `tabPurchase Receipt` pr, `tabPurchase Receipt Item` pr_item
-		where pr.docstatus = 1 and pr_item.item_code = %s and pr.name != %s and
-			pr.name = pr_item.parent
-		order by pr.posting_date desc, pr.posting_time desc, pr.name desc
-		limit 1""", (item_code, cstr(doc_name)), as_dict=1)
-
-	purchase_order_date = getdate(last_purchase_order and last_purchase_order[0].transaction_date \
-		or "1900-01-01")
-	purchase_receipt_date = getdate(last_purchase_receipt and \
-		last_purchase_receipt[0].posting_date or "1900-01-01")
-
-	if (purchase_order_date > purchase_receipt_date) or \
-			(last_purchase_order and not last_purchase_receipt):
-		# use purchase order
-		last_purchase = last_purchase_order[0]
-		purchase_date = purchase_order_date
-		
-	elif (purchase_receipt_date > purchase_order_date) or \
-			(last_purchase_receipt and not last_purchase_order):
-		# use purchase receipt
-		last_purchase = last_purchase_receipt[0]
-		purchase_date = purchase_receipt_date
-		
-	else:
-		return webnotes._dict()
-	
-	conversion_factor = flt(last_purchase.conversion_factor)
-	out = webnotes._dict({
-		"purchase_ref_rate": flt(last_purchase.purchase_ref_rate) / conversion_factor,
-		"purchase_rate": flt(last_purchase.purchase_rate) / conversion_factor,
-		"discount_rate": flt(last_purchase.discount_rate),
-		"purchase_date": purchase_date
-	})
-
-	conversion_rate = flt(conversion_rate) or 1.0
-	out.update({
-		"import_ref_rate": out.purchase_ref_rate / conversion_rate,
-		"import_rate": out.purchase_rate / conversion_rate,
-		"rate": out.purchase_rate
-	})
-	
-	return out
-	
-@webnotes.whitelist()
-def get_conversion_factor(item_code, uom):
-	return {"conversion_factor": webnotes.conn.get_value("UOM Conversion Detail",
-		{"parent": item_code, "uom": uom}, "conversion_factor")}
-		
-@webnotes.whitelist()
-def get_projected_qty(item_code, warehouse):
-	return webnotes.conn.get_value("Bin", {"item_code": item_code, 
-			"warehouse": warehouse}, "projected_qty")
\ No newline at end of file
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 2e05903..2bc3852 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -8,7 +8,7 @@
 from webnotes.model.code import get_obj
 from erpnext.setup.utils import get_company_currency
 from erpnext.accounts.utils import get_fiscal_year, validate_fiscal_year
-from erpnext.utilities.transaction_base import TransactionBase, validate_conversion_rate
+from erpnext.utilities.transaction_base import TransactionBase
 import json
 
 class AccountsController(TransactionBase):
@@ -84,8 +84,9 @@
 		exchange = "%s-%s" % (from_currency, to_currency)
 		return flt(webnotes.conn.get_value("Currency Exchange", exchange, "exchange_rate"))
 
-	def set_missing_item_details(self, get_item_details):
+	def set_missing_item_details(self):
 		"""set missing item values"""
+		from erpnext.stock.get_item_details import get_item_details
 		for item in self.doclist.get({"parentfield": self.fname}):
 			if item.fields.get("item_code"):
 				args = item.fields.copy().update(self.doc.fields)
@@ -149,6 +150,7 @@
 			self.doc.currency = company_currency
 			self.doc.conversion_rate = 1.0
 		else:
+			from erpnext.setup.doctype.currency.currency import validate_conversion_rate
 			validate_conversion_rate(self.doc.currency, self.doc.conversion_rate,
 				self.meta.get_label("conversion_rate"), self.doc.company)
 
@@ -275,7 +277,7 @@
 				# 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.amount + current_tax_amount,
+					tax.grand_total_for_current_item = flt(item.base_amount + current_tax_amount,
 						self.precision("total", tax))
 				else:
 					tax.grand_total_for_current_item = \
@@ -313,10 +315,10 @@
 			# distribute the tax amount proportionally to each item row
 			actual = flt(tax.rate, self.precision("tax_amount", tax))
 			current_tax_amount = (self.doc.net_total
-				and ((item.amount / self.doc.net_total) * actual)
+				and ((item.base_amount / self.doc.net_total) * actual)
 				or 0)
 		elif tax.charge_type == "On Net Total":
-			current_tax_amount = (tax_rate / 100.0) * item.amount
+			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.tax_doclist[cint(tax.row_id) - 1].tax_amount_for_current_item
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index 00fb05e..7617685 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -5,7 +5,6 @@
 import webnotes
 from webnotes import _, msgprint
 from webnotes.utils import flt, _round
-from erpnext.buying.utils import get_item_details
 from erpnext.setup.utils import get_company_currency
 from erpnext.accounts.party import get_party_details
 
@@ -35,7 +34,7 @@
 		if self.doc.supplier:
 			self.doc.update_if_missing(get_party_details(self.doc.supplier, party_type="Supplier"))
 
-		self.set_missing_item_details(get_item_details)
+		self.set_missing_item_details()
 		if self.doc.fields.get("__islocal"):
 			self.set_taxes("other_charges", "taxes_and_charges")
 
@@ -79,39 +78,30 @@
 		self.calculate_total_advance("Purchase Invoice", "advance_allocation_details")
 		
 	def calculate_item_values(self):
-		# hack! - cleaned up in _cleanup()
-		if self.doc.doctype != "Purchase Invoice":
-			df = self.meta.get_field("purchase_rate", parentfield=self.fname)
-			df.fieldname = "rate"
-			
 		for item in self.item_doclist:
-			# hack! - cleaned up in _cleanup()
-			if self.doc.doctype != "Purchase Invoice":
-				item.rate = item.purchase_rate
-				
 			self.round_floats_in(item)
 
-			if item.discount_rate == 100.0:
-				item.import_rate = 0.0
-			elif not item.import_rate:
-				item.import_rate = flt(item.import_ref_rate * (1.0 - (item.discount_rate / 100.0)),
-					self.precision("import_rate", 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.import_amount = flt(item.import_rate * item.qty,
-				self.precision("import_amount", item))
+			item.amount = flt(item.rate * item.qty,
+				self.precision("amount", item))
 			item.item_tax_amount = 0.0;
 
-			self._set_in_company_currency(item, "import_amount", "amount")
-			self._set_in_company_currency(item, "import_ref_rate", "purchase_ref_rate")
-			self._set_in_company_currency(item, "import_rate", "rate")
+			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.doc.net_total = self.doc.net_total_import = 0.0
 
 		for item in self.item_doclist:
-			self.doc.net_total += item.amount
-			self.doc.net_total_import += item.import_amount
+			self.doc.net_total += item.base_amount
+			self.doc.net_total_import += item.amount
 			
 		self.round_floats_in(self.doc, ["net_total", "net_total_import"])
 		
@@ -159,16 +149,6 @@
 			
 	def _cleanup(self):
 		super(BuyingController, self)._cleanup()
-			
-		# except in purchase invoice, rate field is purchase_rate
-		# reset fieldname of rate
-		if self.doc.doctype != "Purchase Invoice":
-			df = self.meta.get_field("rate", parentfield=self.fname)
-			df.fieldname = "purchase_rate"
-			
-			for item in self.item_doclist:
-				item.purchase_rate = item.rate
-				del item.fields["rate"]
 		
 		if not self.meta.get_field("item_tax_amount", parentfield=self.fname):
 			for item in self.item_doclist:
@@ -194,7 +174,7 @@
 		for d in self.doclist.get({"parentfield": parentfield}):
 			if d.item_code and d.item_code in stock_items:
 				stock_items_qty += flt(d.qty)
-				stock_items_amount += flt(d.amount)
+				stock_items_amount += flt(d.base_amount)
 				last_stock_item_idx = d.idx
 			
 		total_valuation_amount = sum([flt(d.tax_amount) for d in 
@@ -205,7 +185,7 @@
 		valuation_amount_adjustment = total_valuation_amount
 		for i, item in enumerate(self.doclist.get({"parentfield": parentfield})):
 			if item.item_code and item.qty and item.item_code in stock_items:
-				item_proportion = flt(item.amount) / stock_items_amount if stock_items_amount \
+				item_proportion = flt(item.base_amount) / stock_items_amount if stock_items_amount \
 					else flt(item.qty) / stock_items_qty
 				
 				if i == (last_stock_item_idx - 1):
@@ -222,7 +202,7 @@
 					"UOM Conversion Detail", {"parent": item.item_code, "uom": item.uom}, 
 					"conversion_factor")) or 1
 				qty_in_stock_uom = flt(item.qty * item.conversion_factor)
-				item.valuation_rate = ((item.amount + item.item_tax_amount + item.rm_supp_cost)
+				item.valuation_rate = ((item.base_amount + item.item_tax_amount + item.rm_supp_cost)
 					/ qty_in_stock_uom)
 			else:
 				item.valuation_rate = 0.0
@@ -276,7 +256,6 @@
 			d.rm_supp_cost = raw_materials_cost
 
 	def get_items_from_default_bom(self, item_code):
-		# print webnotes.conn.sql("""select name from `tabBOM` where item = '_Test FG Item'""")
 		bom_items = webnotes.conn.sql("""select t2.item_code, t2.qty_consumed_per_unit, 
 			t2.rate, t2.stock_uom, t2.name, t2.description 
 			from `tabBOM` t1, `tabBOM Item` t2 
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index a075ad4..90ab919 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -5,7 +5,6 @@
 import webnotes
 from webnotes.utils import cint, flt, comma_or, _round, cstr
 from erpnext.setup.utils import get_company_currency
-from erpnext.selling.utils import get_item_details
 from webnotes import msgprint, _
 
 from erpnext.controllers.stock_controller import StockController
@@ -42,7 +41,7 @@
 						
 	def set_price_list_and_item_details(self):
 		self.set_price_list_currency("Selling")
-		self.set_missing_item_details(get_item_details)
+		self.set_missing_item_details()
 										
 	def apply_shipping_rule(self):
 		if self.doc.shipping_rule:
@@ -112,17 +111,17 @@
 				cumulated_tax_fraction += tax.tax_fraction_for_current_item
 			
 			if cumulated_tax_fraction and not self.discount_amount_applied:
-				item.amount = flt((item.export_amount * self.doc.conversion_rate) /
-					(1 + cumulated_tax_fraction), self.precision("amount", item))
+				item.base_amount = flt((item.amount * self.doc.conversion_rate) /
+					(1 + cumulated_tax_fraction), self.precision("base_amount", item))
 					
-				item.basic_rate = flt(item.amount / item.qty, self.precision("basic_rate", item))
+				item.base_rate = flt(item.base_amount / item.qty, self.precision("base_rate", item))
 				
-				if item.adj_rate == 100:
-					item.base_ref_rate = item.basic_rate
-					item.basic_rate = 0.0
+				if item.discount_percentage == 100:
+					item.base_price_list_rate = item.base_rate
+					item.base_rate = 0.0
 				else:
-					item.base_ref_rate = flt(item.basic_rate / (1 - (item.adj_rate / 100.0)),
-						self.precision("base_ref_rate", item))
+					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):
 		"""
@@ -152,25 +151,25 @@
 			for item in self.item_doclist:
 				self.round_floats_in(item)
 
-				if item.adj_rate == 100:
-					item.export_rate = 0
-				elif not item.export_rate:
-					item.export_rate = flt(item.ref_rate * (1.0 - (item.adj_rate / 100.0)),
-						self.precision("export_rate", 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.export_amount = flt(item.export_rate * item.qty,
-					self.precision("export_amount", item))
+				item.amount = flt(item.rate * item.qty,
+					self.precision("amount", item))
 
-				self._set_in_company_currency(item, "ref_rate", "base_ref_rate")
-				self._set_in_company_currency(item, "export_rate", "basic_rate")
-				self._set_in_company_currency(item, "export_amount", "amount")
+				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.doc.net_total = self.doc.net_total_export = 0.0
 
 		for item in self.item_doclist:
-			self.doc.net_total += item.amount
-			self.doc.net_total_export += item.export_amount
+			self.doc.net_total += item.base_amount
+			self.doc.net_total_export += item.amount
 		
 		self.round_floats_in(self.doc, ["net_total", "net_total_export"])
 				
@@ -197,8 +196,8 @@
 			if grand_total_for_discount_amount:
 				# calculate item amount after Discount Amount
 				for item in self.item_doclist:
-					distributed_amount = flt(self.doc.discount_amount) * item.amount / grand_total_for_discount_amount
-					item.amount = flt(item.amount - distributed_amount, self.precision("amount", item))
+					distributed_amount = flt(self.doc.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()
@@ -281,7 +280,7 @@
 		for d in self.doclist.get({"parentfield": self.fname}):
 			discount = flt(webnotes.conn.get_value("Item", d.item_code, "max_discount"))
 			
-			if discount and flt(d.adj_rate) > discount:
+			if discount and flt(d.discount_percentage) > discount:
 				webnotes.throw(_("You cannot give more than ") + cstr(discount) + "% " + 
 					_("discount on Item Code") + ": " + cstr(d.item_code))
 					
@@ -293,10 +292,10 @@
 			
 			if self.doc.doctype == "Sales Order":
 				if (webnotes.conn.get_value("Item", d.item_code, "is_stock_item") == 'Yes' or 
-					self.has_sales_bom(d.item_code)) and not d.reserved_warehouse:
+					self.has_sales_bom(d.item_code)) and not d.warehouse:
 						webnotes.throw(_("Please enter Reserved Warehouse for item ") + 
 							d.item_code + _(" as it is stock Item or packing item"))
-				reserved_warehouse = d.reserved_warehouse
+				reserved_warehouse = d.warehouse
 				if flt(d.qty) > flt(d.delivered_qty):
 					reserved_qty_for_main_item = flt(d.qty) - flt(d.delivered_qty)
 				
@@ -354,10 +353,10 @@
 		return qty and flt(qty[0][0]) or 0.0
 
 	def get_so_qty_and_warehouse(self, so_detail):
-		so_item = webnotes.conn.sql("""select qty, reserved_warehouse from `tabSales Order Item`
+		so_item = webnotes.conn.sql("""select qty, warehouse from `tabSales Order Item`
 			where name = %s and docstatus = 1""", so_detail, as_dict=1)
 		so_qty = so_item and flt(so_item[0]["qty"]) or 0.0
-		so_warehouse = so_item and so_item[0]["reserved_warehouse"] or ""
+		so_warehouse = so_item and so_item[0]["warehouse"] or ""
 		return so_qty, so_warehouse
 		
 	def check_stop_sales_order(self, ref_fieldname):
@@ -373,10 +372,10 @@
 	for d in obj.doclist.get({"parentfield": obj.fname}):
 		if d.item_code:
 			item = webnotes.conn.sql("""select docstatus, is_sales_item, 
-				is_service_item, default_income_account from tabItem where name = %s""", 
+				is_service_item, income_account from tabItem where name = %s""", 
 				d.item_code, as_dict=True)[0]
 			if item.is_sales_item == 'No' and item.is_service_item == 'No':
 				webnotes.throw(_("Item is neither Sales nor Service Item") + ": " + d.item_code)
-			if d.income_account and not item.default_income_account:
-				webnotes.conn.set_value("Item", d.item_code, "default_income_account", 
+			if d.income_account and not item.income_account:
+				webnotes.conn.set_value("Item", d.item_code, "income_account", 
 					d.income_account)
diff --git a/erpnext/hooks.txt b/erpnext/hooks.txt
index 23e0c0f..433fef7 100644
--- a/erpnext/hooks.txt
+++ b/erpnext/hooks.txt
@@ -36,7 +36,7 @@
 bean_event:Stock Entry:on_submit = erpnext.stock.doctype.material_request.material_request.update_completed_qty
 bean_event:Stock Entry:on_cancel = erpnext.stock.doctype.material_request.material_request.update_completed_qty
 
-standard_queries = Customer:erpnext.selling.utils.get_customer_list
+standard_queries = Customer:erpnext.selling.doctype.customer.customer.get_customer_list
 
 # Schedulers
 # -------------------------
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index 45e96f7..47eacf2 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -121,7 +121,7 @@
 				if not self.doc.buying_price_list:
 					webnotes.throw(_("Please select Price List"))
 				rate = webnotes.conn.get_value("Item Price", {"price_list": self.doc.buying_price_list, 
-					"item_code": arg["item_code"]}, "ref_rate") or 0
+					"item_code": arg["item_code"]}, "price_list_rate") or 0
 			elif self.doc.rm_cost_as_per == 'Standard Rate':
 				rate = arg['standard_rate']
 
@@ -415,8 +415,8 @@
 				item.description, 
 				item.stock_uom,
 				item.default_warehouse,
-				item.purchase_account as expense_account,
-				item.cost_center
+				item.expense_account as expense_account,
+				item.buying_cost_center as cost_center
 			from 
 				`tab%(table)s` bom_item, `tabItem` item 
 			where 
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 ac4b0fa..371b02c 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
@@ -108,7 +108,7 @@
 			msgprint(_("Please enter sales order in the above table"))
 			return []
 			
-		items = webnotes.conn.sql("""select distinct parent, item_code, reserved_warehouse,
+		items = webnotes.conn.sql("""select distinct parent, item_code, warehouse,
 			(qty - ifnull(delivered_qty, 0)) as pending_qty
 			from `tabSales Order Item` so_item
 			where parent in (%s) and docstatus = 1 and ifnull(qty, 0) > ifnull(delivered_qty, 0)
@@ -140,7 +140,7 @@
 				from tabItem where name=%s""", p['item_code'])
 			pi = addchild(self.doc, 'pp_details', 'Production Plan Item', self.doclist)
 			pi.sales_order				= p['parent']
-			pi.warehouse				= p['reserved_warehouse']
+			pi.warehouse				= p['warehouse']
 			pi.item_code				= p['item_code']
 			pi.description				= item_details and item_details[0][0] or ''
 			pi.stock_uom				= item_details and item_details[0][1] or ''
diff --git a/erpnext/patches/4_0/fields_to_be_renamed.py b/erpnext/patches/4_0/fields_to_be_renamed.py
new file mode 100644
index 0000000..e973cdd
--- /dev/null
+++ b/erpnext/patches/4_0/fields_to_be_renamed.py
@@ -0,0 +1,130 @@
+# 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 webnotes
+from webnotes.model import rename_field
+
+
+def execute():
+	rename_map = {
+		"Quotation Item": [
+			["ref_rate", "price_list_rate"], 
+			["base_ref_rate", "base_price_list_rate"],
+			["adj_rate", "discount_percentage"], 
+			["export_rate", "rate"], 
+			["basic_rate", "base_rate"], 
+			["amount", "base_amount"], 
+			["export_amount", "amount"]
+		],
+		
+		"Sales Order Item": [
+			["ref_rate", "price_list_rate"], 
+			["base_ref_rate", "base_price_list_rate"],
+			["adj_rate", "discount_percentage"], 
+			["export_rate", "rate"], 
+			["basic_rate", "base_rate"], 
+			["amount", "base_amount"], 
+			["export_amount", "amount"], 
+			["reserved_warehouse", "warehouse"]
+		],
+		
+		"Delivery Note Item": [
+			["ref_rate", "price_list_rate"], 
+			["base_ref_rate", "base_price_list_rate"], 
+			["adj_rate", "discount_percentage"], 
+			["export_rate", "rate"], 
+			["basic_rate", "base_rate"], 
+			["amount", "base_amount"], 
+			["export_amount", "amount"]
+		],
+
+		"Sales Invoice Item": [
+			["ref_rate", "price_list_rate"], 
+			["base_ref_rate", "base_price_list_rate"], 
+			["adj_rate", "discount_percentage"], 
+			["export_rate", "rate"], 
+			["basic_rate", "base_rate"], 
+			["amount", "base_amount"], 
+			["export_amount", "amount"]
+		],
+
+		"Supplier Quotation Item": [
+			["import_ref_rate", "price_list_rate"], 
+			["purchase_ref_rate", "base_price_list_rate"], 
+			["discount_rate", "discount_percentage"], 
+			["import_rate", "rate"], 
+			["purchase_rate", "base_rate"], 
+			["amount", "base_amount"], 
+			["import_amount", "amount"]
+		],
+	
+		"Purchase Order Item": [
+			["import_ref_rate", "price_list_rate"], 
+			["purchase_ref_rate", "base_price_list_rate"], 
+			["discount_rate", "discount_percentage"], 
+			["import_rate", "rate"], 
+			["purchase_rate", "base_rate"], 
+			["amount", "base_amount"], 
+			["import_amount", "amount"]
+		],
+	
+		"Purchase Receipt Item": [
+			["import_ref_rate", "price_list_rate"], 
+			["purchase_ref_rate", "base_price_list_rate"], 
+			["discount_rate", "discount_percentage"], 
+			["import_rate", "rate"], 
+			["purchase_rate", "base_rate"], 
+			["amount", "base_amount"], 
+			["import_amount", "amount"]
+		],
+		
+		"Purchase Invoice Item": [
+			["import_ref_rate", "price_list_rate"], 
+			["purchase_ref_rate", "base_price_list_rate"], 
+			["discount_rate", "discount_percentage"], 
+			["import_rate", "rate"], 
+			["rate", "base_rate"], 
+			["amount", "base_amount"], 
+			["import_amount", "amount"], 
+			["expense_head", "expense_account"]
+		],
+		
+		"Item": [
+			["purchase_account", "expense_account"],
+			["default_sales_cost_center", "selling_cost_center"],
+			["cost_center", "buying_cost_center"],
+			["default_income_account", "income_account"],
+		],
+		"Item Price": [
+			["ref_rate", "price_list_rate"]
+		]
+	}
+
+	reload_docs(rename_map)
+	
+	for dt, field_list in rename_map.items():
+		for field in field_list:
+			rename_field(dt, field[0], field[1])
+			
+def reload_docs(docs):
+	for dn in docs:
+		webnotes.reload_doc(get_module(dn),	"doctype", dn.lower().replace(" ", "_"))
+	
+	# reload all standard print formats
+	for pf in webnotes.conn.sql("""select name, module from `tabPrint Format` 
+			where ifnull(standard, 'No') = 'Yes'""", as_dict=1):
+		try:
+			webnotes.reload_doc(pf.module, "Print Format", pf.name)
+		except Exception, e:
+			print e
+			pass
+		
+	# reload all standard reports
+	for r in webnotes.conn.sql("""select name, ref_doctype from `tabReport` 
+		where ifnull(is_standard, 'No') = 'Yes'
+		and report_type in ('Report Builder', 'Query Report')""", as_dict=1):
+			webnotes.reload_doc(get_module(r.ref_doctype), "Report", r.name)
+			
+def get_module(dn):
+	return webnotes.conn.get_value("DocType", dn, "module").lower().replace(" ", "_")
\ No newline at end of file
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 e4b11fc..d21bf3d 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
@@ -32,7 +32,7 @@
 		project_start_date, completion_date from tabProject where docstatus < 2""", as_dict=1)
 
 def get_purchased_items_cost():
-	pr_items = webnotes.conn.sql("""select project_name, sum(amount) as amount
+	pr_items = webnotes.conn.sql("""select project_name, sum(base_amount) as amount
 		from `tabPurchase Receipt Item` where ifnull(project_name, '') != '' 
 		and docstatus = 1 group by project_name""", as_dict=1)
 
@@ -55,12 +55,12 @@
 	return se_item_map
 
 def get_delivered_items_cost():
-	dn_items = webnotes.conn.sql("""select dn.project_name, sum(dn_item.amount) as amount
+	dn_items = webnotes.conn.sql("""select dn.project_name, sum(dn_item.base_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 = webnotes.conn.sql("""select si.project_name, sum(si_item.amount) as amount
+	si_items = webnotes.conn.sql("""select si.project_name, sum(si_item.base_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 
 		and ifnull(si.is_pos, 0) = 1 and ifnull(si.project_name, '') != ''
diff --git a/erpnext/public/js/feature_setup.js b/erpnext/public/js/feature_setup.js
index f6f32d5..f3545d1 100644
--- a/erpnext/public/js/feature_setup.js
+++ b/erpnext/public/js/feature_setup.js
@@ -31,15 +31,15 @@
 		//'Sales Order': {'fields':['packing_details']}
 	},
 	'fs_discounts': {
-		'Delivery Note': {'delivery_note_details':['adj_rate']},
-		'Quotation': {'quotation_details':['adj_rate']},
-		'Sales Invoice': {'entries':['adj_rate']},
-		'Sales Order': {'sales_order_details':['adj_rate','ref_rate']}
+		'Delivery Note': {'delivery_note_details':['discount_percentage']},
+		'Quotation': {'quotation_details':['discount_percentage']},
+		'Sales Invoice': {'entries':['discount_percentage']},
+		'Sales Order': {'sales_order_details':['discount_percentage','price_list_rate']}
 	},
 	'fs_purchase_discounts': {
-		'Purchase Order': {'po_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']},
-		'Purchase Receipt': {'purchase_receipt_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']},
-		'Purchase Invoice': {'entries':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}
+		'Purchase Order': {'po_details':['base_price_list_rate', 'discount_percentage', 'price_list_rate']},
+		'Purchase Receipt': {'purchase_receipt_details':['base_price_list_rate', 'discount_percentage', 'price_list_rate']},
+		'Purchase Invoice': {'entries':['base_price_list_rate', 'discount_percentage', 'price_list_rate']}
 	},
 	'fs_brands': {
 		'Delivery Note': {'delivery_note_details':['brand']},
@@ -114,12 +114,12 @@
 		'Sales Order': {'sales_order_details':['page_break']}
 	},
 	'fs_exports': {
-		'Delivery Note': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'delivery_note_details':['base_ref_rate','amount','basic_rate']},
+		'Delivery Note': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'delivery_note_details':['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'],'quotation_details':['base_ref_rate','amount','basic_rate']},
-		'Sales Invoice': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'entries':['base_ref_rate','amount','basic_rate']},
+		'Quotation': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'quotation_details':['base_price_list_rate','base_amount','base_rate']},
+		'Sales Invoice': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'entries':['base_price_list_rate','base_amount','base_rate']},
 		'Sales BOM': {'fields':['currency']},
-		'Sales Order': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'sales_order_details':['base_ref_rate','amount','basic_rate']}
+		'Sales Order': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'sales_order_details':['base_price_list_rate','base_amount','base_rate']}
 	},
 	
 	'fs_imports': {
@@ -127,18 +127,18 @@
 			'fields': ['conversion_rate', 'currency', 'grand_total',
 		 		'in_words', 'net_total', 'other_charges_added',
 		 		'other_charges_deducted'], 
-			'entries': ['purchase_ref_rate', 'amount','rate']
+			'entries': ['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'],
-			'po_details': ['purchase_ref_rate', 'amount','purchase_rate']
+			'po_details': ['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'],
-			'purchase_receipt_details': ['purchase_ref_rate','amount','purchase_rate']
+			'purchase_receipt_details': ['base_price_list_rate','base_amount','base_rate']
 		},
 		'Supplier Quotation': {
 			'fields':['conversion_rate','currency']
diff --git a/erpnext/public/js/transaction.js b/erpnext/public/js/transaction.js
index 24fc332..d77819f 100644
--- a/erpnext/public/js/transaction.js
+++ b/erpnext/public/js/transaction.js
@@ -110,6 +110,50 @@
 			this.frm.refresh();
 		}
 	},
+	
+	
+	item_code: function(doc, cdt, cdn) {
+		var me = this;
+		var item = wn.model.get_doc(cdt, cdn);
+		if(item.item_code || item.barcode || item.serial_no) {
+			if(!this.validate_company_and_party()) {
+				cur_frm.fields_dict[me.frm.cscript.fname].grid.grid_rows[item.idx - 1].remove();
+			} else {
+				return this.frm.call({
+					method: "erpnext.stock.get_item_details.get_item_details",
+					child: item,
+					args: {
+						args: {
+							item_code: item.item_code,
+							barcode: item.barcode,
+							serial_no: item.serial_no,
+							warehouse: item.warehouse,
+							doctype: me.frm.doc.doctype,
+							docname: me.frm.doc.name,
+							customer: me.frm.doc.customer,
+							supplier: me.frm.doc.supplier,
+							currency: me.frm.doc.currency,
+							conversion_rate: me.frm.doc.conversion_rate,
+							price_list: me.frm.doc.selling_price_list ||
+								 me.frm.doc.buying_price_list,
+							price_list_currency: me.frm.doc.price_list_currency,
+							plc_conversion_rate: me.frm.doc.plc_conversion_rate,
+							company: me.frm.doc.company,
+							order_type: me.frm.doc.order_type,
+							is_pos: cint(me.frm.doc.is_pos),
+							is_subcontracted: me.frm.doc.is_subcontracted,
+							transaction_date: me.frm.doc.transaction_date
+						}
+					},
+					callback: function(r) {
+						if(!r.exc) {
+							me.frm.script_manager.trigger("price_list_rate", cdt, cdn);
+						}
+					}
+				});
+			}
+		}
+	},	
 
 	serial_no: function(doc, cdt, cdn) {
 		var me = this;
@@ -455,25 +499,18 @@
 		</table></div>';
 	},
 	
-	_validate_before_fetch: function(fieldname) {
-		var me = this;
-		if(!me.frm.doc[fieldname]) {
-			return (wn._("Please specify") + ": " + 
-				wn.meta.get_label(me.frm.doc.doctype, fieldname, me.frm.doc.name) + 
-				". " + wn._("It is needed to fetch Item Details."));
-		}
-		return null;
-	},
-	
-	validate_company_and_party: function(party_field) {
+	validate_company_and_party: function() {
 		var me = this;
 		var valid = true;
-		var msg = "";
-		$.each(["company", party_field], function(i, fieldname) {
-			var msg_for_fieldname = me._validate_before_fetch(fieldname);
-			if(msg_for_fieldname) {
-				msgprint(msg_for_fieldname);
-				valid = false;
+		
+		$.each(["company", "customer", "supplier"], function(i, fieldname) {
+			if(wn.meta.has_field(me.frm.doc.doctype, fieldname)) {
+				if (!me.frm.doc[fieldname]) {
+					msgprint(wn._("Please specify") + ": " + 
+						wn.meta.get_label(me.frm.doc.doctype, fieldname, me.frm.doc.name) + 
+						". " + wn._("It is needed to fetch Item Details."));
+						valid = false;
+				}
 			}
 		});
 		return valid;
@@ -599,7 +636,7 @@
 				// 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.amount + current_tax_amount,
+					tax.grand_total_for_current_item = flt(item.base_amount + current_tax_amount,
 						precision("total", tax));
 				} else {
 					tax.grand_total_for_current_item = 
@@ -644,11 +681,11 @@
 			// 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.amount / this.frm.doc.net_total) * actual) :
+				((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.amount;
+			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) *
diff --git a/erpnext/selling/Print Format/Quotation Classic/Quotation Classic.txt b/erpnext/selling/Print Format/Quotation Classic/Quotation Classic.txt
index 05c3c59..67fd5d8 100644
--- a/erpnext/selling/Print Format/Quotation Classic/Quotation Classic.txt
+++ b/erpnext/selling/Print Format/Quotation Classic/Quotation Classic.txt
@@ -2,14 +2,14 @@
  {
   "creation": "2013-04-19 13:30:51", 
   "docstatus": 0, 
-  "modified": "2013-12-26 17:45:37", 
+  "modified": "2014-02-11 17:45:37", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
  {
   "doc_type": "Quotation", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Georgia\", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Georgia\", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Quotation',\n\t\t\t\tdoc.name,\n\t\t\t\t'quotation_details',\n\t\t\t\t'Quotation Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'export_rate', 'export_amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.ref_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td></td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td>\n\t\t\t\t\t<script>'<h1>' + (doc.select_print_heading || 'Quotation') + '</h1>'</script>\n\t\t\t</td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Quotation Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Georgia\", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Georgia\", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Quotation',\n\t\t\t\tdoc.name,\n\t\t\t\t'quotation_details',\n\t\t\t\t'Quotation Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td></td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td>\n\t\t\t\t\t<script>'<h1>' + (doc.select_print_heading || 'Quotation') + '</h1>'</script>\n\t\t\t</td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Quotation Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Selling", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/selling/Print Format/Quotation Modern/Quotation Modern.txt b/erpnext/selling/Print Format/Quotation Modern/Quotation Modern.txt
index 35850e6..d31f8c3 100644
--- a/erpnext/selling/Print Format/Quotation Modern/Quotation Modern.txt
+++ b/erpnext/selling/Print Format/Quotation Modern/Quotation Modern.txt
@@ -2,14 +2,14 @@
  {
   "creation": "2013-04-19 13:30:51", 
   "docstatus": 0, 
-  "modified": "2013-12-26 17:45:15", 
+  "modified": "2014-02-11 17:45:15", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
  {
   "doc_type": "Quotation", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n        line-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Quotation',\n\t\t\t\tdoc.name,\n\t\t\t\t'quotation_details',\n\t\t\t\t'Quotation Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'export_rate', 'export_amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.ref_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td></td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Quotation') + '</h1>'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style=\"height:15px\"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class='imp-details'>\n\t\t\t\t\t\t<td><b>Quotation No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Quotation Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold' class='imp-details'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n        line-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Quotation',\n\t\t\t\tdoc.name,\n\t\t\t\t'quotation_details',\n\t\t\t\t'Quotation Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td></td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Quotation') + '</h1>'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style=\"height:15px\"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class='imp-details'>\n\t\t\t\t\t\t<td><b>Quotation No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Quotation Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold' class='imp-details'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Selling", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/selling/Print Format/Quotation Spartan/Quotation Spartan.txt b/erpnext/selling/Print Format/Quotation Spartan/Quotation Spartan.txt
index 3b44526..075b978 100644
--- a/erpnext/selling/Print Format/Quotation Spartan/Quotation Spartan.txt
+++ b/erpnext/selling/Print Format/Quotation Spartan/Quotation Spartan.txt
@@ -2,14 +2,14 @@
  {
   "creation": "2013-04-19 13:30:51", 
   "docstatus": 0, 
-  "modified": "2013-12-26 17:45:50", 
+  "modified": "2014-02-11 17:45:50", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
  {
   "doc_type": "Quotation", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Quotation',\n\t\t\t\tdoc.name,\n\t\t\t\t'quotation_details',\n\t\t\t\t'Quotation Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'export_rate', 'export_amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.ref_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td></td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Quotation') + '</h1>'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Quotation Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Quotation',\n\t\t\t\tdoc.name,\n\t\t\t\t'quotation_details',\n\t\t\t\t'Quotation Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td></td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Quotation') + '</h1>'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Quotation Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Selling", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/selling/Print Format/Sales Order Classic/Sales Order Classic.txt b/erpnext/selling/Print Format/Sales Order Classic/Sales Order Classic.txt
index 7ee19c0..26aa89b 100644
--- a/erpnext/selling/Print Format/Sales Order Classic/Sales Order Classic.txt
+++ b/erpnext/selling/Print Format/Sales Order Classic/Sales Order Classic.txt
@@ -2,14 +2,14 @@
  {
   "creation": "2013-04-19 13:30:51", 
   "docstatus": 0, 
-  "modified": "2013-12-26 17:35:51", 
+  "modified": "2014-02-11 17:35:51", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
  {
   "doc_type": "Sales Order", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Georgia\", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Georgia\", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'sales_order_details',\n\t\t\t\t'Sales Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'basic_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.ref_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>'<h1>' + (doc.select_print_heading || 'Sales Order') + '</h1>'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Sales Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Delivery Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.delivery_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Georgia\", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Georgia\", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'sales_order_details',\n\t\t\t\t'Sales Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'base_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>'<h1>' + (doc.select_print_heading || 'Sales Order') + '</h1>'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Sales Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Delivery Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.delivery_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Selling", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/selling/Print Format/Sales Order Modern/Sales Order Modern.txt b/erpnext/selling/Print Format/Sales Order Modern/Sales Order Modern.txt
index 7cf481d..17f9c04 100644
--- a/erpnext/selling/Print Format/Sales Order Modern/Sales Order Modern.txt
+++ b/erpnext/selling/Print Format/Sales Order Modern/Sales Order Modern.txt
@@ -2,14 +2,14 @@
  {
   "creation": "2013-04-19 13:30:51", 
   "docstatus": 0, 
-  "modified": "2013-12-26 17:34:24", 
+  "modified": "2014-02-11 17:34:24", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
  {
   "doc_type": "Sales Order", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n        line-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'sales_order_details',\n\t\t\t\t'Sales Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'basic_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.ref_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Sales Order') + '</h1>'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style=\"height:15px\"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class='imp-details'>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Sales Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Delivery Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.delivery_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold' class='imp-details'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n        line-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'sales_order_details',\n\t\t\t\t'Sales Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'base_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Sales Order') + '</h1>'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style=\"height:15px\"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class='imp-details'>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Sales Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Delivery Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.delivery_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold' class='imp-details'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Selling", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/selling/Print Format/Sales Order Spartan/Sales Order Spartan.txt b/erpnext/selling/Print Format/Sales Order Spartan/Sales Order Spartan.txt
index 8da27b7..bbb18b4 100644
--- a/erpnext/selling/Print Format/Sales Order Spartan/Sales Order Spartan.txt
+++ b/erpnext/selling/Print Format/Sales Order Spartan/Sales Order Spartan.txt
@@ -2,14 +2,14 @@
  {
   "creation": "2013-04-19 13:30:51", 
   "docstatus": 0, 
-  "modified": "2013-12-26 17:35:29", 
+  "modified": "2014-02-11 17:35:29", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
  {
   "doc_type": "Sales Order", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'sales_order_details',\n\t\t\t\t'Sales Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'basic_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.ref_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Sales Order') + '</h1>'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Sales Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Delivery Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.delivery_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'sales_order_details',\n\t\t\t\t'Sales Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'base_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Sales Order') + '</h1>'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Sales Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Delivery Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.delivery_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Selling", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index df17689..d574fe7 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -160,3 +160,18 @@
 	out["total_unpaid"] = billing[0][1]
 	
 	return out
+
+
+def get_customer_list(doctype, txt, searchfield, start, page_len, filters):
+	if webnotes.conn.get_default("cust_master_name") == "Customer Name":
+		fields = ["name", "customer_group", "territory"]
+	else:
+		fields = ["name", "customer_name", "customer_group", "territory"]
+		
+	return webnotes.conn.sql("""select %s from `tabCustomer` where docstatus < 2 
+		and (%s like %s or customer_name like %s) order by 
+		case when name like %s then 0 else 1 end,
+		case when customer_name like %s then 0 else 1 end,
+		name, customer_name limit %s, %s""" % 
+		(", ".join(fields), searchfield, "%s", "%s", "%s", "%s", "%s", "%s"), 
+		("%%%s%%" % txt, "%%%s%%" % txt, "%%%s%%" % txt, "%%%s%%" % txt, start, page_len))
\ No newline at end of file
diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js
index b1f4394..e04a68e 100644
--- a/erpnext/selling/doctype/quotation/quotation.js
+++ b/erpnext/selling/doctype/quotation/quotation.js
@@ -91,8 +91,8 @@
 	
 	validate_company_and_party: function(party_field) {
 		if(!this.frm.doc.quotation_to) {
-			msgprint(wn._("Please select a value for" + " " + wn.meta.get_label(this.frm.doc.doctype,
-				"quotation_to", this.frm.doc.name)));
+			msgprint(wn._("Please select a value for" + " " + 
+				wn.meta.get_label(this.frm.doc.doctype, "quotation_to", this.frm.doc.name)));
 			return false;
 		} else if (this.frm.doc.quotation_to == "Lead") {
 			return true;
diff --git a/erpnext/selling/doctype/quotation/test_quotation.py b/erpnext/selling/doctype/quotation/test_quotation.py
index 650095c..5bdc4d5 100644
--- a/erpnext/selling/doctype/quotation/test_quotation.py
+++ b/erpnext/selling/doctype/quotation/test_quotation.py
@@ -60,9 +60,9 @@
 			"item_name": "CPU", 
 			"parentfield": "quotation_details", 
 			"qty": 10.0,
-			"basic_rate": 100.0,
-			"export_rate": 100.0,
-			"amount": 1000.0,
+			"base_rate": 100.0,
+			"rate": 100.0,
+			"base_amount": 1000.0,
 		}
 	],	
 ]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.txt b/erpnext/selling/doctype/quotation_item/quotation_item.txt
index 531f005..735e539 100644
--- a/erpnext/selling/doctype/quotation_item/quotation_item.txt
+++ b/erpnext/selling/doctype/quotation_item/quotation_item.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-03-07 11:42:57", 
   "docstatus": 0, 
-  "modified": "2013-12-31 18:12:09", 
+  "modified": "2014-02-10 17:28:02", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -113,7 +113,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "ref_rate", 
+  "fieldname": "price_list_rate", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Price List Rate", 
@@ -128,7 +128,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "adj_rate", 
+  "fieldname": "discount_percentage", 
   "fieldtype": "Float", 
   "in_list_view": 0, 
   "label": "Discount (%)", 
@@ -161,7 +161,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "base_ref_rate", 
+  "fieldname": "base_price_list_rate", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Price List Rate (Company Currency)", 
@@ -180,7 +180,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "export_rate", 
+  "fieldname": "rate", 
   "fieldtype": "Currency", 
   "in_filter": 0, 
   "in_list_view": 1, 
@@ -197,7 +197,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "export_amount", 
+  "fieldname": "amount", 
   "fieldtype": "Currency", 
   "in_filter": 0, 
   "in_list_view": 1, 
@@ -219,7 +219,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "basic_rate", 
+  "fieldname": "base_rate", 
   "fieldtype": "Currency", 
   "in_filter": 0, 
   "in_list_view": 0, 
@@ -236,7 +236,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "amount", 
+  "fieldname": "base_amount", 
   "fieldtype": "Currency", 
   "in_filter": 0, 
   "in_list_view": 0, 
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index f393945..1402049 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -85,15 +85,15 @@
 		this.get_terms();
 	},
 	
-	reserved_warehouse: function(doc, cdt, cdn) {
+	warehouse: function(doc, cdt, cdn) {
 		var item = wn.model.get_doc(cdt, cdn);
-		if(item.item_code && item.reserved_warehouse) {
+		if(item.item_code && item.warehouse) {
 			return this.frm.call({
 				method: "erpnext.selling.utils.get_available_qty",
 				child: item,
 				args: {
 					item_code: item.item_code,
-					warehouse: item.reserved_warehouse,
+					warehouse: item.warehouse,
 				},
 			});
 		}
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 8e7a89d..2b61dd7 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -49,11 +49,11 @@
 		check_list, flag = [], 0
 		chk_dupl_itm = []
 		for d in getlist(self.doclist, 'sales_order_details'):
-			e = [d.item_code, d.description, d.reserved_warehouse, d.prevdoc_docname or '']
+			e = [d.item_code, d.description, d.warehouse, d.prevdoc_docname or '']
 			f = [d.item_code, d.description]
 
 			if webnotes.conn.get_value("Item", d.item_code, "is_stock_item") == 'Yes':
-				if not d.reserved_warehouse:
+				if not d.warehouse:
 					msgprint("""Please enter Reserved Warehouse for item %s 
 						as it is stock Item""" % d.item_code, raise_exception=1)
 				
@@ -71,7 +71,7 @@
 			d.transaction_date = self.doc.transaction_date
 			
 			tot_avail_qty = webnotes.conn.sql("select projected_qty from `tabBin` \
-				where item_code = '%s' and warehouse = '%s'" % (d.item_code,d.reserved_warehouse))
+				where item_code = '%s' and warehouse = '%s'" % (d.item_code,d.warehouse))
 			d.projected_qty = tot_avail_qty and flt(tot_avail_qty[0][0]) or 0
 
 	def validate_sales_mntc_quotation(self):
@@ -130,8 +130,8 @@
 	def validate_warehouse(self):
 		from erpnext.stock.utils import validate_warehouse_company
 		
-		warehouses = list(set([d.reserved_warehouse for d in 
-			self.doclist.get({"doctype": self.tname}) if d.reserved_warehouse]))
+		warehouses = list(set([d.warehouse for d in 
+			self.doclist.get({"doctype": self.tname}) if d.warehouse]))
 				
 		for w in warehouses:
 			validate_warehouse_company(w, self.doc.company)
@@ -270,7 +270,6 @@
 			"doctype": "Material Request Item", 
 			"field_map": {
 				"parent": "sales_order_no", 
-				"reserved_warehouse": "warehouse", 
 				"stock_uom": "uom"
 			}
 		}
@@ -281,8 +280,8 @@
 @webnotes.whitelist()
 def make_delivery_note(source_name, target_doclist=None):	
 	def update_item(obj, target, source_parent):
-		target.amount = (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.basic_rate)
-		target.export_amount = (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.export_rate)
+		target.base_amount = (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.base_rate)
+		target.amount = (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.rate)
 		target.qty = flt(obj.qty) - flt(obj.delivered_qty)
 			
 	doclist = get_mapped_doclist("Sales Order", source_name, {
@@ -299,10 +298,9 @@
 		"Sales Order Item": {
 			"doctype": "Delivery Note Item", 
 			"field_map": {
-				"export_rate": "export_rate", 
+				"rate": "rate", 
 				"name": "prevdoc_detail_docname", 
 				"parent": "against_sales_order", 
-				"reserved_warehouse": "warehouse"
 			},
 			"postprocess": update_item,
 			"condition": lambda doc: doc.delivered_qty < doc.qty
@@ -327,9 +325,9 @@
 		bean.run_method("onload_post_render")
 		
 	def update_item(obj, target, source_parent):
-		target.export_amount = flt(obj.export_amount) - flt(obj.billed_amt)
-		target.amount = target.export_amount * flt(source_parent.conversion_rate)
-		target.qty = obj.export_rate and target.export_amount / flt(obj.export_rate) or obj.qty
+		target.amount = flt(obj.amount) - flt(obj.billed_amt)
+		target.base_amount = target.amount * flt(source_parent.conversion_rate)
+		target.qty = obj.rate and target.amount / flt(obj.rate) or obj.qty
 			
 	doclist = get_mapped_doclist("Sales Order", source_name, {
 		"Sales Order": {
@@ -343,10 +341,9 @@
 			"field_map": {
 				"name": "so_detail", 
 				"parent": "sales_order", 
-				"reserved_warehouse": "warehouse"
 			},
 			"postprocess": update_item,
-			"condition": lambda doc: doc.amount==0 or doc.billed_amt < doc.export_amount
+			"condition": lambda doc: doc.base_amount==0 or doc.billed_amt < doc.amount
 		}, 
 		"Sales Taxes and Charges": {
 			"doctype": "Sales Taxes and Charges", 
diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py
index 4ee166c..ee667ce 100644
--- a/erpnext/selling/doctype/sales_order/test_sales_order.py
+++ b/erpnext/selling/doctype/sales_order/test_sales_order.py
@@ -106,20 +106,20 @@
 		
 	def test_reserved_qty_for_so(self):
 		# reset bin
-		self.delete_bin(test_records[0][1]["item_code"], test_records[0][1]["reserved_warehouse"])
+		self.delete_bin(test_records[0][1]["item_code"], test_records[0][1]["warehouse"])
 		
 		# submit
 		so = self.create_so()
-		self.check_reserved_qty(so.doclist[1].item_code, so.doclist[1].reserved_warehouse, 10.0)
+		self.check_reserved_qty(so.doclist[1].item_code, so.doclist[1].warehouse, 10.0)
 		
 		# cancel
 		so.cancel()
-		self.check_reserved_qty(so.doclist[1].item_code, so.doclist[1].reserved_warehouse, 0.0)
+		self.check_reserved_qty(so.doclist[1].item_code, so.doclist[1].warehouse, 0.0)
 		
 	
 	def test_reserved_qty_for_partial_delivery(self):
 		# reset bin
-		self.delete_bin(test_records[0][1]["item_code"], test_records[0][1]["reserved_warehouse"])
+		self.delete_bin(test_records[0][1]["item_code"], test_records[0][1]["warehouse"])
 		
 		# submit so
 		so = self.create_so()
@@ -130,25 +130,25 @@
 		# submit dn
 		dn = self.create_dn_against_so(so)
 		
-		self.check_reserved_qty(so.doclist[1].item_code, so.doclist[1].reserved_warehouse, 5.0)
+		self.check_reserved_qty(so.doclist[1].item_code, so.doclist[1].warehouse, 5.0)
 		
 		# stop so
 		so.load_from_db()
 		so.obj.stop_sales_order()
-		self.check_reserved_qty(so.doclist[1].item_code, so.doclist[1].reserved_warehouse, 0.0)
+		self.check_reserved_qty(so.doclist[1].item_code, so.doclist[1].warehouse, 0.0)
 		
 		# unstop so
 		so.load_from_db()
 		so.obj.unstop_sales_order()
-		self.check_reserved_qty(so.doclist[1].item_code, so.doclist[1].reserved_warehouse, 5.0)
+		self.check_reserved_qty(so.doclist[1].item_code, so.doclist[1].warehouse, 5.0)
 		
 		# cancel dn
 		dn.cancel()
-		self.check_reserved_qty(so.doclist[1].item_code, so.doclist[1].reserved_warehouse, 10.0)
+		self.check_reserved_qty(so.doclist[1].item_code, so.doclist[1].warehouse, 10.0)
 		
 	def test_reserved_qty_for_over_delivery(self):
 		# reset bin
-		self.delete_bin(test_records[0][1]["item_code"], test_records[0][1]["reserved_warehouse"])
+		self.delete_bin(test_records[0][1]["item_code"], test_records[0][1]["warehouse"])
 		
 		# submit so
 		so = self.create_so()
@@ -161,11 +161,11 @@
 		
 		# submit dn
 		dn = self.create_dn_against_so(so, 15)
-		self.check_reserved_qty(so.doclist[1].item_code, so.doclist[1].reserved_warehouse, 0.0)
+		self.check_reserved_qty(so.doclist[1].item_code, so.doclist[1].warehouse, 0.0)
 
 		# cancel dn
 		dn.cancel()
-		self.check_reserved_qty(so.doclist[1].item_code, so.doclist[1].reserved_warehouse, 10.0)
+		self.check_reserved_qty(so.doclist[1].item_code, so.doclist[1].warehouse, 10.0)
 		
 	def test_reserved_qty_for_so_with_packing_list(self):
 		from erpnext.selling.doctype.sales_bom.test_sales_bom import test_records as sbom_test_records
@@ -175,24 +175,24 @@
 		test_record[1]["item_code"] = "_Test Sales BOM Item"
 		
 		# reset bin
-		self.delete_bin(sbom_test_records[0][1]["item_code"], test_record[1]["reserved_warehouse"])
-		self.delete_bin(sbom_test_records[0][2]["item_code"], test_record[1]["reserved_warehouse"])
+		self.delete_bin(sbom_test_records[0][1]["item_code"], test_record[1]["warehouse"])
+		self.delete_bin(sbom_test_records[0][2]["item_code"], test_record[1]["warehouse"])
 		
 		# submit
 		so = self.create_so(test_record)
 		
 		
 		self.check_reserved_qty(sbom_test_records[0][1]["item_code"], 
-			so.doclist[1].reserved_warehouse, 50.0)
+			so.doclist[1].warehouse, 50.0)
 		self.check_reserved_qty(sbom_test_records[0][2]["item_code"], 
-			so.doclist[1].reserved_warehouse, 20.0)
+			so.doclist[1].warehouse, 20.0)
 		
 		# cancel
 		so.cancel()
 		self.check_reserved_qty(sbom_test_records[0][1]["item_code"], 
-			so.doclist[1].reserved_warehouse, 0.0)
+			so.doclist[1].warehouse, 0.0)
 		self.check_reserved_qty(sbom_test_records[0][2]["item_code"], 
-			so.doclist[1].reserved_warehouse, 0.0)
+			so.doclist[1].warehouse, 0.0)
 			
 	def test_reserved_qty_for_partial_delivery_with_packing_list(self):
 		from erpnext.selling.doctype.sales_bom.test_sales_bom import test_records as sbom_test_records
@@ -203,8 +203,8 @@
 		test_record[1]["item_code"] = "_Test Sales BOM Item"
 
 		# reset bin
-		self.delete_bin(sbom_test_records[0][1]["item_code"], test_record[1]["reserved_warehouse"])
-		self.delete_bin(sbom_test_records[0][2]["item_code"], test_record[1]["reserved_warehouse"])
+		self.delete_bin(sbom_test_records[0][1]["item_code"], test_record[1]["warehouse"])
+		self.delete_bin(sbom_test_records[0][2]["item_code"], test_record[1]["warehouse"])
 		
 		# submit
 		so = self.create_so(test_record)
@@ -216,33 +216,33 @@
 		dn = self.create_dn_against_so(so)
 		
 		self.check_reserved_qty(sbom_test_records[0][1]["item_code"], 
-			so.doclist[1].reserved_warehouse, 25.0)
+			so.doclist[1].warehouse, 25.0)
 		self.check_reserved_qty(sbom_test_records[0][2]["item_code"], 
-			so.doclist[1].reserved_warehouse, 10.0)
+			so.doclist[1].warehouse, 10.0)
 				
 		# stop so
 		so.load_from_db()
 		so.obj.stop_sales_order()
 		
 		self.check_reserved_qty(sbom_test_records[0][1]["item_code"], 
-			so.doclist[1].reserved_warehouse, 0.0)
+			so.doclist[1].warehouse, 0.0)
 		self.check_reserved_qty(sbom_test_records[0][2]["item_code"], 
-			so.doclist[1].reserved_warehouse, 0.0)
+			so.doclist[1].warehouse, 0.0)
 		
 		# unstop so
 		so.load_from_db()
 		so.obj.unstop_sales_order()
 		self.check_reserved_qty(sbom_test_records[0][1]["item_code"], 
-			so.doclist[1].reserved_warehouse, 25.0)
+			so.doclist[1].warehouse, 25.0)
 		self.check_reserved_qty(sbom_test_records[0][2]["item_code"], 
-			so.doclist[1].reserved_warehouse, 10.0)
+			so.doclist[1].warehouse, 10.0)
 		
 		# cancel dn
 		dn.cancel()
 		self.check_reserved_qty(sbom_test_records[0][1]["item_code"], 
-			so.doclist[1].reserved_warehouse, 50.0)
+			so.doclist[1].warehouse, 50.0)
 		self.check_reserved_qty(sbom_test_records[0][2]["item_code"], 
-			so.doclist[1].reserved_warehouse, 20.0)
+			so.doclist[1].warehouse, 20.0)
 			
 	def test_reserved_qty_for_over_delivery_with_packing_list(self):
 		from erpnext.selling.doctype.sales_bom.test_sales_bom import test_records as sbom_test_records
@@ -252,8 +252,8 @@
 		test_record[1]["item_code"] = "_Test Sales BOM Item"
 
 		# reset bin
-		self.delete_bin(sbom_test_records[0][1]["item_code"], test_record[1]["reserved_warehouse"])
-		self.delete_bin(sbom_test_records[0][2]["item_code"], test_record[1]["reserved_warehouse"])
+		self.delete_bin(sbom_test_records[0][1]["item_code"], test_record[1]["warehouse"])
+		self.delete_bin(sbom_test_records[0][2]["item_code"], test_record[1]["warehouse"])
 		
 		# submit
 		so = self.create_so(test_record)
@@ -268,16 +268,16 @@
 		dn = self.create_dn_against_so(so, 15)
 		
 		self.check_reserved_qty(sbom_test_records[0][1]["item_code"], 
-			so.doclist[1].reserved_warehouse, 0.0)
+			so.doclist[1].warehouse, 0.0)
 		self.check_reserved_qty(sbom_test_records[0][2]["item_code"], 
-			so.doclist[1].reserved_warehouse, 0.0)
+			so.doclist[1].warehouse, 0.0)
 
 		# cancel dn
 		dn.cancel()
 		self.check_reserved_qty(sbom_test_records[0][1]["item_code"], 
-			so.doclist[1].reserved_warehouse, 50.0)
+			so.doclist[1].warehouse, 50.0)
 		self.check_reserved_qty(sbom_test_records[0][2]["item_code"], 
-			so.doclist[1].reserved_warehouse, 20.0)
+			so.doclist[1].warehouse, 20.0)
 
 	def test_warehouse_user(self):
 		webnotes.defaults.add_default("Warehouse", "_Test Warehouse 1 - _TC1", "test@example.com", "Restriction")
@@ -294,7 +294,7 @@
 		so.doc.company = "_Test Company 1"
 		so.doc.conversion_rate = 0.02
 		so.doc.plc_conversion_rate = 0.02
-		so.doclist[1].reserved_warehouse = "_Test Warehouse 2 - _TC1"
+		so.doclist[1].warehouse = "_Test Warehouse 2 - _TC1"
 		self.assertRaises(BeanPermissionError, so.insert)
 
 		webnotes.set_user("test2@example.com")
@@ -333,10 +333,10 @@
 			"item_name": "CPU", 
 			"parentfield": "sales_order_details", 
 			"qty": 10.0,
-			"basic_rate": 100.0,
-			"export_rate": 100.0,
-			"amount": 1000.0,
-			"reserved_warehouse": "_Test Warehouse - _TC",
+			"base_rate": 100.0,
+			"rate": 100.0,
+			"base_amount": 1000.0,
+			"warehouse": "_Test Warehouse - _TC",
 		}
 	],	
 ]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.txt b/erpnext/selling/doctype/sales_order_item/sales_order_item.txt
index 38fb01c..b57ba99 100644
--- a/erpnext/selling/doctype/sales_order_item/sales_order_item.txt
+++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-03-07 11:42:58", 
   "docstatus": 0, 
-  "modified": "2013-12-31 18:07:50", 
+  "modified": "2014-02-10 17:28:08", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -107,7 +107,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "ref_rate", 
+  "fieldname": "price_list_rate", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Price List Rate", 
@@ -122,7 +122,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "adj_rate", 
+  "fieldname": "discount_percentage", 
   "fieldtype": "Float", 
   "in_list_view": 0, 
   "label": "Discount(%)", 
@@ -155,7 +155,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "base_ref_rate", 
+  "fieldname": "base_price_list_rate", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Price List Rate (Company Currency)", 
@@ -174,7 +174,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "export_rate", 
+  "fieldname": "rate", 
   "fieldtype": "Currency", 
   "in_list_view": 1, 
   "label": "Rate", 
@@ -188,7 +188,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "export_amount", 
+  "fieldname": "amount", 
   "fieldtype": "Currency", 
   "in_list_view": 1, 
   "label": "Amount", 
@@ -208,7 +208,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "basic_rate", 
+  "fieldname": "base_rate", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Basic Rate (Company Currency)", 
@@ -223,7 +223,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "amount", 
+  "fieldname": "base_amount", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Amount (Company Currency)", 
@@ -246,7 +246,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "reserved_warehouse", 
+  "fieldname": "warehouse", 
   "fieldtype": "Link", 
   "in_list_view": 0, 
   "label": "Reserved Warehouse", 
diff --git a/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.txt b/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.txt
index adbfe69..d8889da 100644
--- a/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.txt
+++ b/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-05-23 17:42:24", 
   "docstatus": 0, 
-  "modified": "2013-05-24 12:20:17", 
+  "modified": "2014-02-11 12:20:17", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -12,7 +12,7 @@
   "doctype": "Report", 
   "is_standard": "Yes", 
   "name": "__common__", 
-  "query": "select\n    so_item.item_code as \"Item Code:Link/Item:120\",\n\tso_item.item_name as \"Item Name::120\",\n\tso_item.description as \"Description::150\",\n\tso_item.qty as \"Qty:Float:100\",\n\tso_item.stock_uom as \"UOM:Link/UOM:80\",\n\tso_item.basic_rate as \"Rate:Currency:120\",\n\tso_item.amount as \"Amount:Currency:120\",\n\tso.name as \"Sales Order:Link/Sales Order:120\",\n\tso.transaction_date as \"Transaction Date:Date:140\",\n\tso.customer as \"Customer:Link/Customer:130\",\n\tso.territory as \"Territory:Link/Territory:130\",\n    so.project_name as \"Project:Link/Project:130\",\n\tifnull(so_item.delivered_qty, 0) as \"Delivered Qty:Float:120\",\n\tifnull(so_item.billed_amt, 0) as \"Billed Amount:Currency:120\"\nfrom\n\t`tabSales Order` so, `tabSales Order Item` so_item\nwhere\n\tso.name = so_item.parent\n\tand so.docstatus = 1\norder by so.name desc", 
+  "query": "select\n    so_item.item_code as \"Item Code:Link/Item:120\",\n\tso_item.item_name as \"Item Name::120\",\n\tso_item.description as \"Description::150\",\n\tso_item.qty as \"Qty:Float:100\",\n\tso_item.stock_uom as \"UOM:Link/UOM:80\",\n\tso_item.base_rate as \"Rate:Currency:120\",\n\tso_item.base_amount as \"Amount:Currency:120\",\n\tso.name as \"Sales Order:Link/Sales Order:120\",\n\tso.transaction_date as \"Transaction Date:Date:140\",\n\tso.customer as \"Customer:Link/Customer:130\",\n\tso.territory as \"Territory:Link/Territory:130\",\n    so.project_name as \"Project:Link/Project:130\",\n\tifnull(so_item.delivered_qty, 0) as \"Delivered Qty:Float:120\",\n\tifnull(so_item.billed_amt, 0) as \"Billed Amount:Currency:120\"\nfrom\n\t`tabSales Order` so, `tabSales Order Item` so_item\nwhere\n\tso.name = so_item.parent\n\tand so.docstatus = 1\norder by so.name desc", 
   "ref_doctype": "Sales Order", 
   "report_name": "Item-wise Sales History", 
   "report_type": "Query Report"
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 3e500dc..ae38de2 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
@@ -84,7 +84,7 @@
 def get_achieved_details(filters):
 	start_date, end_date = get_fiscal_year(fiscal_year = filters["fiscal_year"])[1:]
 	
-	item_details = webnotes.conn.sql("""select soi.item_code, soi.qty, soi.amount, so.transaction_date, 
+	item_details = webnotes.conn.sql("""select soi.item_code, soi.qty, soi.base_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 
@@ -127,7 +127,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.amount
+							tav_dict.achieved += ad.base_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 2c45e21..b7c030f 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
@@ -27,8 +27,8 @@
 	date_field = filters["doc_type"] == "Sales Order" and "transaction_date" or "posting_date"
 	conditions, items = get_conditions(filters, date_field)
 	entries = webnotes.conn.sql("""select dt.name, dt.customer, dt.territory, dt.%s, 
-		dt_item.item_code, dt_item.qty, dt_item.amount, st.sales_person, 
-		st.allocated_percentage, dt_item.amount*st.allocated_percentage/100
+		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
 		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 d55e210..9861db3 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
@@ -81,7 +81,7 @@
 def get_achieved_details(filters):
 	start_date, end_date = get_fiscal_year(fiscal_year = filters["fiscal_year"])[1:]
 
-	item_details = webnotes.conn.sql("""select soi.item_code, soi.qty, soi.amount, so.transaction_date, 
+	item_details = webnotes.conn.sql("""select soi.item_code, soi.qty, soi.base_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 +125,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.amount
+							tav_dict.achieved += ad.base_amount
 
 	return tim_map
 
diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js
index 718d8a6..0f7bc67 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -119,77 +119,38 @@
 		this.item_code(doc, cdt, cdn);
 	},
 	
-	item_code: function(doc, cdt, cdn) {
-		var me = this;
-		var item = wn.model.get_doc(cdt, cdn);
-		if(item.item_code || item.barcode || item.serial_no) {
-			if(!this.validate_company_and_party("customer")) {
-				cur_frm.fields_dict[me.frm.cscript.fname].grid.grid_rows[item.idx - 1].remove();
-			} else {
-				return this.frm.call({
-					method: "erpnext.selling.utils.get_item_details",
-					child: item,
-					args: {
-						args: {
-							item_code: item.item_code,
-							barcode: item.barcode,
-							serial_no: item.serial_no,
-							warehouse: item.warehouse,
-							doctype: me.frm.doc.doctype,
-							parentfield: item.parentfield,
-							customer: me.frm.doc.customer,
-							currency: me.frm.doc.currency,
-							conversion_rate: me.frm.doc.conversion_rate,
-							selling_price_list: me.frm.doc.selling_price_list,
-							price_list_currency: me.frm.doc.price_list_currency,
-							plc_conversion_rate: me.frm.doc.plc_conversion_rate,
-							company: me.frm.doc.company,
-							order_type: me.frm.doc.order_type,
-							is_pos: cint(me.frm.doc.is_pos),
-						}
-					},
-					callback: function(r) {
-						if(!r.exc) {
-							me.frm.script_manager.trigger("ref_rate", cdt, cdn);
-						}
-					}
-				});
-			}
-		}
-	},
-	
 	selling_price_list: function() {
 		this.get_price_list_currency("Selling");
 	},
 	
-	ref_rate: function(doc, cdt, cdn) {
+	price_list_rate: function(doc, cdt, cdn) {
 		var item = wn.model.get_doc(cdt, cdn);
-		wn.model.round_floats_in(item, ["ref_rate", "adj_rate"]);
+		wn.model.round_floats_in(item, ["price_list_rate", "discount_percentage"]);
 		
-		item.export_rate = flt(item.ref_rate * (1 - item.adj_rate / 100.0),
-			precision("export_rate", item));
+		item.rate = flt(item.price_list_rate * (1 - item.discount_percentage / 100.0),
+			precision("rate", item));
 		
 		this.calculate_taxes_and_totals();
 	},
 	
-	adj_rate: function(doc, cdt, cdn) {
+	discount_percentage: function(doc, cdt, cdn) {
 		var item = wn.model.get_doc(cdt, cdn);
-		if(!item.ref_rate) {
-			item.adj_rate = 0.0;
+		if(!item.price_list_rate) {
+			item.discount_percentage = 0.0;
 		} else {
-			this.ref_rate(doc, cdt, cdn);
+			this.price_list_rate(doc, cdt, cdn);
 		}
 	},
 	
-	export_rate: function(doc, cdt, cdn) {
+	rate: function(doc, cdt, cdn) {
 		var item = wn.model.get_doc(cdt, cdn);
-		wn.model.round_floats_in(item, ["export_rate", "ref_rate"]);
+		wn.model.round_floats_in(item, ["rate", "price_list_rate"]);
 		
-		if(item.ref_rate) {
-			item.adj_rate = flt((1 - item.export_rate / item.ref_rate) * 100.0,
-				precision("adj_rate", item));
+		if(item.price_list_rate) {
+			item.discount_percentage = flt((1 - item.rate / item.price_list_rate) * 100.0,
+				precision("discount_percentage", item));
 		} else {
-			item.adj_rate = 0.0;
+			item.discount_percentage = 0.0;
 		}
 		
 		this.calculate_taxes_and_totals();
@@ -262,7 +223,7 @@
 	},
 	
 	toggle_editable_price_list_rate: function() {
-		var df = wn.meta.get_docfield(this.tname, "ref_rate", this.frm.doc.name);
+		var df = wn.meta.get_docfield(this.tname, "price_list_rate", this.frm.doc.name);
 		var editable_price_list_rate = cint(wn.defaults.get_default("editable_price_list_rate"));
 		
 		if(df && editable_price_list_rate) {
@@ -287,11 +248,11 @@
 		if (!this.discount_amount_applied) {
 			$.each(this.frm.item_doclist, function(i, item) {
 				wn.model.round_floats_in(item);
-				item.export_amount = flt(item.export_rate * item.qty, precision("export_amount", item));
+				item.amount = flt(item.rate * item.qty, precision("amount", item));
 
-				me._set_in_company_currency(item, "ref_rate", "base_ref_rate");
-				me._set_in_company_currency(item, "export_rate", "basic_rate");
-				me._set_in_company_currency(item, "export_amount", "amount");
+				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");
 			});
 		}
 	},
@@ -317,18 +278,18 @@
 			});
 			
 			if(cumulated_tax_fraction && !me.discount_amount_applied) {
-				item.amount = flt(
-					(item.export_amount * me.frm.doc.conversion_rate) / (1 + cumulated_tax_fraction),
-					precision("amount", item));
+				item.base_amount = flt(
+					(item.amount * me.frm.doc.conversion_rate) / (1 + cumulated_tax_fraction),
+					precision("base_amount", item));
 
-				item.basic_rate = flt(item.amount / item.qty, precision("basic_rate", item));
+				item.base_rate = flt(item.base_amount / item.qty, precision("base_rate", item));
 				
-				if(item.adj_rate == 100) {
-					item.base_ref_rate = item.basic_rate;
-					item.basic_rate = 0.0;
+				if(item.discount_percentage == 100) {
+					item.base_price_list_rate = item.base_rate;
+					item.base_rate = 0.0;
 				} else {
-					item.base_ref_rate = flt(item.basic_rate / (1 - item.adj_rate / 100.0),
-						precision("base_ref_rate", item));
+					item.base_price_list_rate = flt(item.base_rate / (1 - item.discount_percentage / 100.0),
+						precision("base_price_list_rate", item));
 				}
 			}
 		});
@@ -363,8 +324,8 @@
 		this.frm.doc.net_total = this.frm.doc.net_total_export = 0.0;
 
 		$.each(this.frm.item_doclist, function(i, item) {
-			me.frm.doc.net_total += item.amount;
-			me.frm.doc.net_total_export += item.export_amount;
+			me.frm.doc.net_total += item.base_amount;
+			me.frm.doc.net_total_export += item.amount;
 		});
 
 		wn.model.round_floats_in(this.frm.doc, ["net_total", "net_total_export"]);
@@ -399,8 +360,8 @@
 			// calculate item amount after Discount Amount
 			if (grand_total_for_discount_amount) {
 				$.each(this.frm.item_doclist, function(i, item) {
-					distributed_amount = flt(me.frm.doc.discount_amount) * item.amount / grand_total_for_discount_amount;
-					item.amount = flt(item.amount - distributed_amount, precision("amount", item));
+					distributed_amount = flt(me.frm.doc.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;
@@ -559,10 +520,10 @@
 			});
 		}
 		
-		setup_field_label_map(["basic_rate", "base_ref_rate", "amount"],
+		setup_field_label_map(["base_rate", "base_price_list_rate", "base_amount"],
 			company_currency, this.fname);
 		
-		setup_field_label_map(["export_rate", "ref_rate", "export_amount"],
+		setup_field_label_map(["rate", "price_list_rate", "amount"],
 			this.frm.doc.currency, this.fname);
 		
 		setup_field_label_map(["tax_amount", "total"], company_currency, "other_charges");
@@ -578,7 +539,7 @@
 			(wn.model.get_doclist(cur_frm.doctype, cur_frm.docname, 
 				{parentfield: "other_charges", included_in_print_rate: 1}).length);
 		
-		$.each(["basic_rate", "base_ref_rate", "amount"], function(i, fname) {
+		$.each(["base_rate", "base_price_list_rate", "base_amount"], function(i, fname) {
 			if(wn.meta.get_docfield(item_grid.doctype, fname))
 				item_grid.set_column_disp(fname, show);
 		});
diff --git a/erpnext/selling/utils.py b/erpnext/selling/utils.py
deleted file mode 100644
index dbb691d..0000000
--- a/erpnext/selling/utils.py
+++ /dev/null
@@ -1,217 +0,0 @@
-# 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 webnotes
-from webnotes import _, throw
-from webnotes.utils import flt, cint
-import json
-
-def get_customer_list(doctype, txt, searchfield, start, page_len, filters):
-	if webnotes.conn.get_default("cust_master_name") == "Customer Name":
-		fields = ["name", "customer_group", "territory"]
-	else:
-		fields = ["name", "customer_name", "customer_group", "territory"]
-		
-	return webnotes.conn.sql("""select %s from `tabCustomer` where docstatus < 2 
-		and (%s like %s or customer_name like %s) order by 
-		case when name like %s then 0 else 1 end,
-		case when customer_name like %s then 0 else 1 end,
-		name, customer_name limit %s, %s""" % 
-		(", ".join(fields), searchfield, "%s", "%s", "%s", "%s", "%s", "%s"), 
-		("%%%s%%" % txt, "%%%s%%" % txt, "%%%s%%" % txt, "%%%s%%" % txt, start, page_len))
-		
-@webnotes.whitelist()
-def get_item_details(args):
-	"""
-		args = {
-			"item_code": "",
-			"warehouse": None,
-			"customer": "",
-			"conversion_rate": 1.0,
-			"selling_price_list": None,
-			"price_list_currency": None,
-			"plc_conversion_rate": 1.0
-		}
-	"""
-
-	if isinstance(args, basestring):
-		args = json.loads(args)
-	args = webnotes._dict(args)
-	
-	if args.barcode:
-		args.item_code = _get_item_code(barcode=args.barcode)
-	elif not args.item_code and args.serial_no:
-		args.item_code = _get_item_code(serial_no=args.serial_no)
-	
-	item_bean = webnotes.bean("Item", args.item_code)
-	
-	_validate_item_details(args, item_bean.doc)
-	
-	meta = webnotes.get_doctype(args.doctype)
-
-	# hack! for Sales Order Item
-	warehouse_fieldname = "warehouse"
-	if meta.get_field("reserved_warehouse", parentfield=args.parentfield):
-		warehouse_fieldname = "reserved_warehouse"
-	
-	out = _get_basic_details(args, item_bean, warehouse_fieldname)
-	
-	if meta.get_field("currency"):
-		out.base_ref_rate = out.basic_rate = out.ref_rate = out.export_rate = 0.0
-		
-		if args.selling_price_list and args.price_list_currency:
-			out.update(_get_price_list_rate(args, item_bean, meta))
-		
-	out.update(_get_item_discount(out.item_group, args.customer))
-	
-	if out.get(warehouse_fieldname):
-		out.update(get_available_qty(args.item_code, out.get(warehouse_fieldname)))
-	
-	out.customer_item_code = _get_customer_item_code(args, item_bean)
-	
-	if cint(args.is_pos):
-		pos_settings = get_pos_settings(args.company)
-		if pos_settings:
-			out.update(apply_pos_settings(pos_settings, out))
-		
-	if args.doctype in ("Sales Invoice", "Delivery Note"):
-		if item_bean.doc.has_serial_no == "Yes" and not args.serial_no:
-			out.serial_no = _get_serial_nos_by_fifo(args, item_bean)
-		
-	return out
-
-def _get_serial_nos_by_fifo(args, item_bean):
-	return "\n".join(webnotes.conn.sql_list("""select name from `tabSerial No` 
-		where item_code=%(item_code)s and warehouse=%(warehouse)s and status='Available' 
-		order by timestamp(purchase_date, purchase_time) asc limit %(qty)s""", {
-			"item_code": args.item_code,
-			"warehouse": args.warehouse,
-			"qty": cint(args.qty)
-		}))
-
-def _get_item_code(barcode=None, serial_no=None):
-	if barcode:
-		input_type = "Barcode"
-		item_code = webnotes.conn.sql_list("""select name from `tabItem` where barcode=%s""", barcode)
-	elif serial_no:
-		input_type = "Serial No"
-		item_code = webnotes.conn.sql_list("""select item_code from `tabSerial No` 
-			where name=%s""", serial_no)
-			
-	if not item_code:
-		throw(_("No Item found with ") + input_type + ": %s" % (barcode or serial_no))
-	
-	return item_code[0]
-	
-def _validate_item_details(args, item):
-	# TODO
-	# from erpnext.utilities.transaction_base import validate_item_fetch
-	# validate_item_fetch(args, item)
-	
-	# validate if sales item or service item
-	if args.order_type == "Maintenance":
-		if item.is_service_item != "Yes":
-			throw(_("Item") + (" %s: " % item.name) + 
-				_("not a service item.") +
-				_("Please select a service item or change the order type to Sales."))
-		
-	elif item.is_sales_item != "Yes":
-		throw(_("Item") + (" %s: " % item.name) + _("not a sales item"))
-			
-def _get_basic_details(args, item_bean, warehouse_fieldname):
-	item = item_bean.doc
-	
-	from webnotes.defaults import get_user_default_as_list
-	user_default_warehouse_list = get_user_default_as_list('warehouse')
-	user_default_warehouse = user_default_warehouse_list[0] \
-		if len(user_default_warehouse_list)==1 else ""
-	
-	out = webnotes._dict({
-			"item_code": item.name,
-			"description": item.description_html or item.description,
-			warehouse_fieldname: user_default_warehouse or item.default_warehouse \
-				or args.get(warehouse_fieldname),
-			"income_account": item.default_income_account or args.income_account \
-				or webnotes.conn.get_value("Company", args.company, "default_income_account"),
-			"expense_account": item.purchase_account or args.expense_account \
-				or webnotes.conn.get_value("Company", args.company, "default_expense_account"),
-			"cost_center": item.default_sales_cost_center or args.cost_center,
-			"qty": 1.0,
-			"export_amount": 0.0,
-			"amount": 0.0,
-			"batch_no": None,
-			"item_tax_rate": json.dumps(dict(([d.tax_type, d.tax_rate] for d in 
-				item_bean.doclist.get({"parentfield": "item_tax"})))),
-		})
-	
-	for fieldname in ("item_name", "item_group", "barcode", "brand", "stock_uom"):
-		out[fieldname] = item.fields.get(fieldname)
-			
-	return out
-	
-def _get_price_list_rate(args, item_bean, meta):
-	ref_rate = webnotes.conn.sql("""select ip.ref_rate from 
-		`tabItem Price` ip, `tabPrice List` pl 
-		where ip.price_list=pl.name and ip.price_list=%s and 
-		ip.item_code=%s and ip.selling=1 and pl.enabled=1""", 
-		(args.selling_price_list, args.item_code), as_dict=1)
-
-	if not ref_rate:
-		return {}
-	
-	# found price list rate - now we can validate
-	from erpnext.utilities.transaction_base import validate_currency
-	validate_currency(args, item_bean.doc, meta)
-	
-	return {"ref_rate": flt(ref_rate[0].ref_rate) * flt(args.plc_conversion_rate) / flt(args.conversion_rate)}
-	
-def _get_item_discount(item_group, customer):
-	parent_item_groups = [x[0] for x in webnotes.conn.sql("""SELECT parent.name 
-		FROM `tabItem Group` AS node, `tabItem Group` AS parent 
-		WHERE parent.lft <= node.lft and parent.rgt >= node.rgt and node.name = %s
-		GROUP BY parent.name 
-		ORDER BY parent.lft desc""", (item_group,))]
-		
-	discount = 0
-	for d in parent_item_groups:
-		res = webnotes.conn.sql("""select discount, name from `tabCustomer Discount` 
-			where parent = %s and item_group = %s""", (customer, d))
-		if res:
-			discount = flt(res[0][0])
-			break
-			
-	return {"adj_rate": discount}
-
-@webnotes.whitelist()
-def get_available_qty(item_code, warehouse):
-	return webnotes.conn.get_value("Bin", {"item_code": item_code, "warehouse": warehouse}, 
-		["projected_qty", "actual_qty"], as_dict=True) or {}
-		
-def _get_customer_item_code(args, item_bean):
-	customer_item_code = item_bean.doclist.get({"parentfield": "item_customer_details",
-		"customer_name": args.customer})
-	
-	return customer_item_code and customer_item_code[0].ref_code or None
-	
-def get_pos_settings(company):
-	pos_settings = webnotes.conn.sql("""select * from `tabPOS Setting` where user = %s 
-		and company = %s""", (webnotes.session['user'], company), as_dict=1)
-	
-	if not pos_settings:
-		pos_settings = webnotes.conn.sql("""select * from `tabPOS Setting` 
-			where ifnull(user,'') = '' and company = %s""", company, as_dict=1)
-			
-	return pos_settings and pos_settings[0] or None
-	
-def apply_pos_settings(pos_settings, opts):
-	out = {}
-	
-	for fieldname in ("income_account", "cost_center", "warehouse", "expense_account"):
-		if not opts.get(fieldname):
-			out[fieldname] = pos_settings.get(fieldname)
-			
-	if out.get("warehouse"):
-		out["actual_qty"] = get_available_qty(opts.item_code, out.get("warehouse")).get("actual_qty")
-	
-	return out
diff --git a/erpnext/setup/doctype/authorization_control/authorization_control.py b/erpnext/setup/doctype/authorization_control/authorization_control.py
index 6df0915..98d99b1 100644
--- a/erpnext/setup/doctype/authorization_control/authorization_control.py
+++ b/erpnext/setup/doctype/authorization_control/authorization_control.py
@@ -89,7 +89,7 @@
 		if based_on == 'Itemwise Discount':
 			if doc_obj:
 				for t in getlist(doc_obj.doclist, doc_obj.fname):
-					self.validate_auth_rule(doctype_name, t.adj_rate, based_on, add_cond, company,t.item_code )
+					self.validate_auth_rule(doctype_name, t.discount_percentage, based_on, add_cond, company,t.item_code )
 		else:
 			self.validate_auth_rule(doctype_name, auth_value, based_on, add_cond, company)
 
@@ -99,12 +99,12 @@
 	def validate_approving_authority(self, doctype_name,company, total, doc_obj = ''):
 		av_dis = 0
 		if doc_obj:
-			ref_rate, basic_rate = 0, 0
+			price_list_rate, base_rate = 0, 0
 			for d in getlist(doc_obj.doclist, doc_obj.fname):
-				if d.base_ref_rate and d.basic_rate:
-					ref_rate += flt(d.base_ref_rate)
-					basic_rate += flt(d.basic_rate)
-			if ref_rate: av_dis = 100 - flt(basic_rate * 100 / ref_rate)
+				if d.base_price_list_rate and d.base_rate:
+					price_list_rate += flt(d.base_price_list_rate)
+					base_rate += flt(d.base_rate)
+			if price_list_rate: av_dis = 100 - flt(base_rate * 100 / price_list_rate)
 
 		final_based_on = ['Grand Total','Average Discount','Customerwise Discount','Itemwise Discount']
 		# Individual User
diff --git a/erpnext/setup/doctype/currency/currency.py b/erpnext/setup/doctype/currency/currency.py
index cb6190f..8eb964b 100644
--- a/erpnext/setup/doctype/currency/currency.py
+++ b/erpnext/setup/doctype/currency/currency.py
@@ -3,7 +3,20 @@
 
 from __future__ import unicode_literals
 import webnotes
+from webnotes import throw, _
 
 class DocType:
 	def __init__(self, d, dl):
-		self.doc, self.doclist = d, dl
\ No newline at end of file
+		self.doc, self.doclist = d, dl
+		
+def validate_conversion_rate(currency, conversion_rate, conversion_rate_label, company):
+	"""common validation for currency and price list currency"""
+
+	company_currency = webnotes.conn.get_value("Company", company, "default_currency")
+
+	if not conversion_rate:
+		throw(_('%(conversion_rate_label)s is mandatory. Maybe Currency Exchange record is not created for %(from_currency)s to %(to_currency)s') % {
+			"conversion_rate_label": conversion_rate_label,
+			"from_currency": currency,
+			"to_currency": company_currency
+		})
\ No newline at end of file
diff --git a/erpnext/startup/report_data_map.py b/erpnext/startup/report_data_map.py
index b981d55..87be60a 100644
--- a/erpnext/startup/report_data_map.py
+++ b/erpnext/startup/report_data_map.py
@@ -132,11 +132,10 @@
 	},
 	
 	"Sales Order Item": {
-		"columns": ["item.name as name", "item_code", "(ifnull(qty, 0) - ifnull(delivered_qty, 0)) as qty", 
-			"reserved_warehouse as warehouse"],
+		"columns": ["item.name as name", "item_code", "(ifnull(qty, 0) - ifnull(delivered_qty, 0)) as qty", "warehouse"],
 		"from": "`tabSales Order Item` item, `tabSales Order` main",
 		"conditions": ["item.parent = main.name", "main.docstatus=1", "main.status != 'Stopped'", 
-			"ifnull(reserved_warehouse, '')!=''", "ifnull(qty, 0) > ifnull(delivered_qty, 0)"],
+			"ifnull(warehouse, '')!=''", "ifnull(qty, 0) > ifnull(delivered_qty, 0)"],
 		"links": {
 			"item_code": ["Item", "name"],
 			"warehouse": ["Warehouse", "name"]
@@ -174,7 +173,7 @@
 		}
 	},
 	"Sales Invoice Item": {
-		"columns": ["name", "parent", "item_code", "qty", "amount"],
+		"columns": ["name", "parent", "item_code", "qty", "base_amount"],
 		"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
 		"order_by": "parent",
 		"links": {
@@ -192,7 +191,7 @@
 		}
 	},
 	"Sales Order Item[Sales Analytics]": {
-		"columns": ["name", "parent", "item_code", "qty", "amount"],
+		"columns": ["name", "parent", "item_code", "qty", "base_amount"],
 		"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
 		"order_by": "parent",
 		"links": {
@@ -210,7 +209,7 @@
 		}
 	},
 	"Delivery Note Item[Sales Analytics]": {
-		"columns": ["name", "parent", "item_code", "qty", "amount"],
+		"columns": ["name", "parent", "item_code", "qty", "base_amount"],
 		"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
 		"order_by": "parent",
 		"links": {
@@ -242,7 +241,7 @@
 		}
 	},
 	"Purchase Invoice Item": {
-		"columns": ["name", "parent", "item_code", "qty", "amount"],
+		"columns": ["name", "parent", "item_code", "qty", "base_amount"],
 		"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
 		"order_by": "parent",
 		"links": {
@@ -260,7 +259,7 @@
 		}
 	},
 	"Purchase Order Item[Purchase Analytics]": {
-		"columns": ["name", "parent", "item_code", "qty", "amount"],
+		"columns": ["name", "parent", "item_code", "qty", "base_amount"],
 		"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
 		"order_by": "parent",
 		"links": {
@@ -278,7 +277,7 @@
 		}
 	},
 	"Purchase Receipt Item[Purchase Analytics]": {
-		"columns": ["name", "parent", "item_code", "qty", "amount"],
+		"columns": ["name", "parent", "item_code", "qty", "base_amount"],
 		"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
 		"order_by": "parent",
 		"links": {
diff --git a/erpnext/stock/Print Format/Delivery Note Classic/Delivery Note Classic.txt b/erpnext/stock/Print Format/Delivery Note Classic/Delivery Note Classic.txt
index d4c0cc1..282fa7a 100644
--- a/erpnext/stock/Print Format/Delivery Note Classic/Delivery Note Classic.txt
+++ b/erpnext/stock/Print Format/Delivery Note Classic/Delivery Note Classic.txt
@@ -2,14 +2,14 @@
  {
   "creation": "2013-04-19 13:31:11", 
   "docstatus": 0, 
-  "modified": "2013-12-26 17:36:51", 
+  "modified": "2014-02-11 17:36:51", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
  {
   "doc_type": "Delivery Note", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Georgia\", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Georgia\", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Delivery Note',\n\t\t\t\tdoc.name,\n\t\t\t\t'delivery_note_details',\n\t\t\t\t'Delivery Note Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'basic_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tvar to_append = ''\n\t\t\t\t\t\tif(data_row.adj_rate){\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + '% on ' +\n\t\t\t\t\t\t\t\tformat_currency(data_row.ref_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(data_row.serial_no) {\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Serial No.:' + \n\t\t\t\t\t\t\t\t((data_row.serial_no.indexOf('\\n')>-1)?'<br />':'&nbsp;') + \n\t\t\t\t\t\t\t\tdata_row.serial_no + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>'<h1>' + (doc.select_print_heading || 'Delivery Note') + '</h1>'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Delivery Note Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<script>doc.sales_order_no</script><br />\n\t\t\t\t\t\t\t<i>(<script>date.str_to_user(doc.posting_date)</script>)</i>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Georgia\", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Georgia\", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Delivery Note',\n\t\t\t\tdoc.name,\n\t\t\t\t'delivery_note_details',\n\t\t\t\t'Delivery Note Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'base_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tvar to_append = ''\n\t\t\t\t\t\tif(data_row.discount_percentage){\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' +\n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(data_row.serial_no) {\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Serial No.:' + \n\t\t\t\t\t\t\t\t((data_row.serial_no.indexOf('\\n')>-1)?'<br />':'&nbsp;') + \n\t\t\t\t\t\t\t\tdata_row.serial_no + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>'<h1>' + (doc.select_print_heading || 'Delivery Note') + '</h1>'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Delivery Note Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<script>doc.sales_order_no</script><br />\n\t\t\t\t\t\t\t<i>(<script>date.str_to_user(doc.posting_date)</script>)</i>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Stock", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/stock/Print Format/Delivery Note Modern/Delivery Note Modern.txt b/erpnext/stock/Print Format/Delivery Note Modern/Delivery Note Modern.txt
index 3b36f6f..3508746 100644
--- a/erpnext/stock/Print Format/Delivery Note Modern/Delivery Note Modern.txt
+++ b/erpnext/stock/Print Format/Delivery Note Modern/Delivery Note Modern.txt
@@ -2,14 +2,14 @@
  {
   "creation": "2013-04-19 13:31:11", 
   "docstatus": 0, 
-  "modified": "2013-12-26 17:36:26", 
+  "modified": "2014-02-11 17:36:26", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
  {
   "doc_type": "Delivery Note", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n        line-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Delivery Note',\n\t\t\t\tdoc.name,\n\t\t\t\t'delivery_note_details',\n\t\t\t\t'Delivery Note Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'basic_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tvar to_append = ''\n\t\t\t\t\t\tif(data_row.adj_rate){\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + '% on ' +\n\t\t\t\t\t\t\t\tformat_currency(data_row.ref_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(data_row.serial_no) {\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Serial No.:' + \n\t\t\t\t\t\t\t\t((data_row.serial_no.indexOf('\\n')>-1)?'<br />':'&nbsp;') + \n\t\t\t\t\t\t\t\tdata_row.serial_no + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Delivery Note') + '</h1>'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style=\"height:15px\"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class='imp-details'>\n\t\t\t\t\t\t<td><b>Delivery Note No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Delivery Note Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<script>doc.sales_order_no</script><br />\n\t\t\t\t\t\t\t<i>(<script>date.str_to_user(doc.posting_date)</script>)</i>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold' class='imp-details'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n        line-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Delivery Note',\n\t\t\t\tdoc.name,\n\t\t\t\t'delivery_note_details',\n\t\t\t\t'Delivery Note Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'base_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tvar to_append = ''\n\t\t\t\t\t\tif(data_row.discount_percentage){\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' +\n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(data_row.serial_no) {\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Serial No.:' + \n\t\t\t\t\t\t\t\t((data_row.serial_no.indexOf('\\n')>-1)?'<br />':'&nbsp;') + \n\t\t\t\t\t\t\t\tdata_row.serial_no + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Delivery Note') + '</h1>'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style=\"height:15px\"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class='imp-details'>\n\t\t\t\t\t\t<td><b>Delivery Note No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Delivery Note Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<script>doc.sales_order_no</script><br />\n\t\t\t\t\t\t\t<i>(<script>date.str_to_user(doc.posting_date)</script>)</i>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold' class='imp-details'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Stock", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/stock/Print Format/Delivery Note Spartan/Delivery Note Spartan.txt b/erpnext/stock/Print Format/Delivery Note Spartan/Delivery Note Spartan.txt
index 072d411..17506f1 100644
--- a/erpnext/stock/Print Format/Delivery Note Spartan/Delivery Note Spartan.txt
+++ b/erpnext/stock/Print Format/Delivery Note Spartan/Delivery Note Spartan.txt
@@ -2,14 +2,14 @@
  {
   "creation": "2013-04-19 13:31:11", 
   "docstatus": 0, 
-  "modified": "2013-12-26 17:37:14", 
+  "modified": "2014-02-11 17:37:14", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
  {
   "doc_type": "Delivery Note", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Delivery Note',\n\t\t\t\tdoc.name,\n\t\t\t\t'delivery_note_details',\n\t\t\t\t'Delivery Note Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'basic_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tvar to_append = ''\n\t\t\t\t\t\tif(data_row.adj_rate){\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + '% on ' +\n\t\t\t\t\t\t\t\tformat_currency(data_row.ref_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(data_row.serial_no) {\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Serial No.:' + \n\t\t\t\t\t\t\t\t((data_row.serial_no.indexOf('\\n')>-1)?'<br />':'&nbsp;') + \n\t\t\t\t\t\t\t\tdata_row.serial_no + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Delivery Note') + '</h1>'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Delivery Note Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<script>doc.sales_order_no</script><br />\n\t\t\t\t\t\t\t<i>(<script>date.str_to_user(doc.posting_date)</script>)</i>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Delivery Note',\n\t\t\t\tdoc.name,\n\t\t\t\t'delivery_note_details',\n\t\t\t\t'Delivery Note Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'base_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tvar to_append = ''\n\t\t\t\t\t\tif(data_row.discount_percentage){\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' +\n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(data_row.serial_no) {\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Serial No.:' + \n\t\t\t\t\t\t\t\t((data_row.serial_no.indexOf('\\n')>-1)?'<br />':'&nbsp;') + \n\t\t\t\t\t\t\t\tdata_row.serial_no + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Delivery Note') + '</h1>'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Delivery Note Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<script>doc.sales_order_no</script><br />\n\t\t\t\t\t\t\t<i>(<script>date.str_to_user(doc.posting_date)</script>)</i>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Stock", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index 56329a1..6239f28 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -134,17 +134,17 @@
 
 	if (doc.print_without_amount) {
 		dn_fields['currency'].print_hide = 1;
-		dn_item_fields['export_rate'].print_hide = 1;
-		dn_item_fields['adj_rate'].print_hide = 1;
-		dn_item_fields['ref_rate'].print_hide = 1;
-		dn_item_fields['export_amount'].print_hide = 1;
+		dn_item_fields['rate'].print_hide = 1;
+		dn_item_fields['discount_percentage'].print_hide = 1;
+		dn_item_fields['price_list_rate'].print_hide = 1;
+		dn_item_fields['amount'].print_hide = 1;
 	} else {
 		if (dn_fields_copy['currency'].print_hide != 1)
 			dn_fields['currency'].print_hide = 0;
-		if (dn_item_fields_copy['export_rate'].print_hide != 1)
-			dn_item_fields['export_rate'].print_hide = 0;
-		if (dn_item_fields_copy['export_amount'].print_hide != 1)
-			dn_item_fields['export_amount'].print_hide = 0;
+		if (dn_item_fields_copy['rate'].print_hide != 1)
+			dn_item_fields['rate'].print_hide = 0;
+		if (dn_item_fields_copy['amount'].print_hide != 1)
+			dn_item_fields['amount'].print_hide = 0;
 	}
 }
 
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index be0b95f..70f7f49 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -96,7 +96,7 @@
 					super(DocType, self).validate_with_previous_doc(self.tname, {
 						fn[0] + " Item": {
 							"ref_dn_field": "prevdoc_detail_docname",
-							"compare_fields": [["export_rate", "="]],
+							"compare_fields": [["rate", "="]],
 							"is_child_table": True
 						}
 					})
@@ -261,7 +261,7 @@
 		amount, total = 0, 0
 		for d in getlist(self.doclist, 'delivery_note_details'):
 			if not (d.against_sales_order or d.against_sales_invoice):
-				amount += d.amount
+				amount += d.base_amount
 		if amount != 0:
 			total = (amount/self.doc.net_total)*self.doc.grand_total
 			self.check_credit(total)
diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py
index 4213d19..3ea33ae 100644
--- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py
@@ -36,8 +36,8 @@
 		
 		self.assertEquals(len(si), len(dn.doclist))
 		
-		# modify export_amount
-		si[1].export_rate = 200
+		# modify amount
+		si[1].rate = 200
 		self.assertRaises(webnotes.ValidationError, webnotes.bean(si).insert)
 		
 	
@@ -97,8 +97,8 @@
 		# back dated purchase receipt
 		pr = webnotes.bean(copy=pr_test_records[0])
 		pr.doc.posting_date = "2013-01-01"
-		pr.doclist[1].import_rate = 100
-		pr.doclist[1].amount = 100
+		pr.doclist[1].rate = 100
+		pr.doclist[1].base_amount = 100
 		
 		pr.insert()
 		pr.submit()
@@ -243,9 +243,9 @@
 			"item_name": "_Test Item", 
 			"parentfield": "delivery_note_details", 
 			"qty": 5.0, 
-			"basic_rate": 100.0,
-			"export_rate": 100.0,
-			"amount": 500.0,
+			"base_rate": 100.0,
+			"rate": 100.0,
+			"base_amount": 500.0,
 			"warehouse": "_Test Warehouse - _TC",
 			"stock_uom": "_Test UOM",
 			"expense_account": "Cost of Goods Sold - _TC",
diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.txt b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.txt
index 7caa89d..5d04992 100644
--- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.txt
+++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-04-22 13:15:44", 
   "docstatus": 0, 
-  "modified": "2013-12-31 18:23:03", 
+  "modified": "2014-02-10 17:28:16", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -114,7 +114,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "ref_rate", 
+  "fieldname": "price_list_rate", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Price List Rate", 
@@ -130,7 +130,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "adj_rate", 
+  "fieldname": "discount_percentage", 
   "fieldtype": "Float", 
   "in_list_view": 0, 
   "label": "Discount (%)", 
@@ -163,7 +163,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "base_ref_rate", 
+  "fieldname": "base_price_list_rate", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Price List Rate (Company Currency)", 
@@ -182,7 +182,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "export_rate", 
+  "fieldname": "rate", 
   "fieldtype": "Currency", 
   "in_list_view": 1, 
   "label": "Rate", 
@@ -197,7 +197,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "export_amount", 
+  "fieldname": "amount", 
   "fieldtype": "Currency", 
   "in_list_view": 1, 
   "label": "Amount", 
@@ -217,7 +217,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "basic_rate", 
+  "fieldname": "base_rate", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Rate (Company Currency)", 
@@ -232,7 +232,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "amount", 
+  "fieldname": "base_amount", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Amount (Company Currency)", 
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index 1e89dc1..3a3129c 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -52,7 +52,7 @@
 
 // Expense Account
 // ---------------------------------
-cur_frm.fields_dict['purchase_account'].get_query = function(doc) {
+cur_frm.fields_dict['expense_account'].get_query = function(doc) {
 	return {
 		filters: {
 			'debit_or_credit': "Debit",
@@ -63,7 +63,7 @@
 
 // Income Account
 // --------------------------------
-cur_frm.fields_dict['default_income_account'].get_query = function(doc) {
+cur_frm.fields_dict['income_account'].get_query = function(doc) {
 	return {
 		filters: {
 			'debit_or_credit': "Credit",
@@ -76,7 +76,7 @@
 
 // Purchase Cost Center
 // -----------------------------
-cur_frm.fields_dict['cost_center'].get_query = function(doc) {
+cur_frm.fields_dict['buying_cost_center'].get_query = function(doc) {
 	return {
 		filters:{ 'group_or_ledger': "Ledger" }
 	}
@@ -85,7 +85,7 @@
 
 // Sales Cost Center
 // -----------------------------
-cur_frm.fields_dict['default_sales_cost_center'].get_query = function(doc) {
+cur_frm.fields_dict['selling_cost_center'].get_query = function(doc) {
 	return {
 		filters:{ 'group_or_ledger': "Ledger" }
 	}
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index dcb6c0f..2bb6d82 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -4,7 +4,7 @@
 from __future__ import unicode_literals
 import webnotes
 
-from webnotes.utils import cstr, flt
+from webnotes.utils import cstr, flt, getdate, now_datetime, formatdate
 from webnotes.model.doc import addchild
 from webnotes.model.bean import getlist
 from webnotes import msgprint, _
@@ -245,8 +245,7 @@
 			self.recalculate_bin_qty(newdn)
 			
 	def set_last_purchase_rate(self, newdn):
-		from erpnext.buying.utils import get_last_purchase_details
-		last_purchase_rate = get_last_purchase_details(newdn).get("purchase_rate", 0)
+		last_purchase_rate = get_last_purchase_details(newdn).get("base_rate", 0)
 		webnotes.conn.set_value("Item", newdn, "last_purchase_rate", last_purchase_rate)
 			
 	def recalculate_bin_qty(self, newdn):
@@ -265,7 +264,6 @@
 	if not end_of_life:
 		end_of_life = webnotes.conn.get_value("Item", item_code, "end_of_life")
 	
-	from webnotes.utils import getdate, now_datetime, formatdate
 	if end_of_life and getdate(end_of_life) <= now_datetime().date():
 		msg = (_("Item") + " %(item_code)s: " + _("reached its end of life on") + \
 			" %(date)s. " + _("Please check") + ": %(end_of_life_label)s " + \
@@ -303,4 +301,66 @@
 	if verbose:
 		msgprint(msg, raise_exception=True)
 	else:
-		raise webnotes.ValidationError, msg
\ No newline at end of file
+		raise webnotes.ValidationError, msg
+		
+		
+def get_last_purchase_details(item_code, doc_name=None, conversion_rate=1.0):
+	"""returns last purchase details in stock uom"""
+	# get last purchase order item details
+	last_purchase_order = webnotes.conn.sql("""\
+		select po.name, po.transaction_date, po.conversion_rate,
+			po_item.conversion_factor, po_item.base_price_list_rate, 
+			po_item.discount_percentage, po_item.base_rate
+		from `tabPurchase Order` po, `tabPurchase Order Item` po_item
+		where po.docstatus = 1 and po_item.item_code = %s and po.name != %s and 
+			po.name = po_item.parent
+		order by po.transaction_date desc, po.name desc
+		limit 1""", (item_code, cstr(doc_name)), as_dict=1)
+
+	# get last purchase receipt item details		
+	last_purchase_receipt = webnotes.conn.sql("""\
+		select pr.name, pr.posting_date, pr.posting_time, pr.conversion_rate,
+			pr_item.conversion_factor, pr_item.base_price_list_rate, pr_item.discount_percentage,
+			pr_item.base_rate
+		from `tabPurchase Receipt` pr, `tabPurchase Receipt Item` pr_item
+		where pr.docstatus = 1 and pr_item.item_code = %s and pr.name != %s and
+			pr.name = pr_item.parent
+		order by pr.posting_date desc, pr.posting_time desc, pr.name desc
+		limit 1""", (item_code, cstr(doc_name)), as_dict=1)
+
+	purchase_order_date = getdate(last_purchase_order and last_purchase_order[0].transaction_date \
+		or "1900-01-01")
+	purchase_receipt_date = getdate(last_purchase_receipt and \
+		last_purchase_receipt[0].posting_date or "1900-01-01")
+
+	if (purchase_order_date > purchase_receipt_date) or \
+			(last_purchase_order and not last_purchase_receipt):
+		# use purchase order
+		last_purchase = last_purchase_order[0]
+		purchase_date = purchase_order_date
+		
+	elif (purchase_receipt_date > purchase_order_date) or \
+			(last_purchase_receipt and not last_purchase_order):
+		# use purchase receipt
+		last_purchase = last_purchase_receipt[0]
+		purchase_date = purchase_receipt_date
+		
+	else:
+		return webnotes._dict()
+	
+	conversion_factor = flt(last_purchase.conversion_factor)
+	out = webnotes._dict({
+		"base_price_list_rate": flt(last_purchase.base_price_list_rate) / conversion_factor,
+		"base_rate": flt(last_purchase.base_rate) / conversion_factor,
+		"discount_percentage": flt(last_purchase.discount_percentage),
+		"purchase_date": purchase_date
+	})
+
+	conversion_rate = flt(conversion_rate) or 1.0
+	out.update({
+		"price_list_rate": out.base_price_list_rate / conversion_rate,
+		"rate": out.base_rate / conversion_rate,
+		"base_rate": out.base_rate
+	})
+	
+	return out
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item/item.txt b/erpnext/stock/doctype/item/item.txt
index 8da0d4c..db83103 100644
--- a/erpnext/stock/doctype/item/item.txt
+++ b/erpnext/stock/doctype/item/item.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-05-03 10:45:46", 
   "docstatus": 0, 
-  "modified": "2014-01-20 17:48:47", 
+  "modified": "2014-02-10 17:27:49", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -438,7 +438,7 @@
   "depends_on": "eval:doc.is_purchase_item==\"Yes\"", 
   "description": "Default Purchase Account in which cost of the item will be debited.", 
   "doctype": "DocField", 
-  "fieldname": "purchase_account", 
+  "fieldname": "expense_account", 
   "fieldtype": "Link", 
   "label": "Default Expense Account", 
   "oldfieldname": "purchase_account", 
@@ -450,9 +450,9 @@
   "depends_on": "eval:doc.is_purchase_item==\"Yes\"", 
   "description": "Default Cost Center for tracking expense for this item.", 
   "doctype": "DocField", 
-  "fieldname": "cost_center", 
+  "fieldname": "buying_cost_center", 
   "fieldtype": "Link", 
-  "label": "Default Cost Center", 
+  "label": "Default Buying Cost Center", 
   "oldfieldname": "cost_center", 
   "oldfieldtype": "Link", 
   "options": "Cost Center", 
@@ -576,7 +576,7 @@
  {
   "depends_on": "eval:doc.is_sales_item==\"Yes\"", 
   "doctype": "DocField", 
-  "fieldname": "default_income_account", 
+  "fieldname": "income_account", 
   "fieldtype": "Link", 
   "label": "Default Income Account", 
   "options": "Account", 
@@ -585,9 +585,9 @@
  {
   "depends_on": "eval:doc.is_sales_item==\"Yes\"", 
   "doctype": "DocField", 
-  "fieldname": "default_sales_cost_center", 
+  "fieldname": "selling_cost_center", 
   "fieldtype": "Link", 
-  "label": "Cost Center", 
+  "label": "Default Selling Cost Center", 
   "options": "Cost Center", 
   "read_only": 0
  }, 
diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py
index 00ce548..39b77df 100644
--- a/erpnext/stock/doctype/item/test_item.py
+++ b/erpnext/stock/doctype/item/test_item.py
@@ -5,6 +5,8 @@
 import unittest
 import webnotes
 
+from webnotes.test_runner import make_test_records
+
 test_ignore = ["BOM"]
 test_dependencies = ["Warehouse"]
 
@@ -15,6 +17,48 @@
 		item.doc.is_stock_item = "Yes"
 		item.doc.default_warehouse = None
 		self.assertRaises(WarehouseNotSet, item.insert)
+		
+	def atest_get_item_details(self):
+		from erpnext.stock.get_item_details import get_item_details
+		to_check = {
+			"item_code": "_Test Item",
+			"item_name": "_Test Item",
+			"description": "_Test Item",
+			"warehouse": "_Test Warehouse - _TC",
+			"income_account": "Sales - _TC",
+			"expense_account": "_Test Account Cost for Goods Sold - _TC",
+			"cost_center": "_Test Cost Center - _TC",
+			"qty": 1.0,
+			"price_list_rate": 100.0,
+			"base_price_list_rate": 0.0,
+			"discount_percentage": 0.0,
+			"rate": 0.0,
+			"base_rate": 0.0,
+			"amount": 0.0,
+			"base_amount": 0.0,
+			"batch_no": None,
+			"item_tax_rate": {},
+			"uom": "_Test UOM",
+			"conversion_factor": 1.0,
+		}
+		
+		make_test_records("Item Price")
+		
+		details = get_item_details({
+			"item_code": "_Test Item",
+			"company": "_Test Company",
+			"price_list": "_Test Price List",
+			"currency": "_Test Currency",
+			"doctype": "Sales Order",
+			"conversion_rate": 1,
+			"price_list_currency": "_Test Currency",
+			"plc_conversion_rate": 1,
+			"order_type": "Sales",
+			"transaction_type": "selling"
+		})
+		
+		for key, value in to_check.iteritems():
+			self.assertEquals(value, details.get(key))
 
 test_records = [
 	[{
@@ -34,9 +78,10 @@
 		"is_pro_applicable": "Yes",
 		"is_sub_contracted_item": "No",
 		"stock_uom": "_Test UOM",
-		"default_income_account": "Sales - _TC",
+		"income_account": "Sales - _TC",
 		"default_warehouse": "_Test Warehouse - _TC",
-		"purchase_account": "_Test Account Cost for Goods Sold - _TC"
+		"expense_account": "_Test Account Cost for Goods Sold - _TC",
+		"selling_cost_center": "_Test Cost Center - _TC",
 	}, {
 		"doctype": "Item Reorder",
 		"parentfield": "item_reorder",
@@ -63,9 +108,9 @@
 		"is_pro_applicable": "Yes",
 		"is_sub_contracted_item": "No",
 		"stock_uom": "_Test UOM",
-		"default_income_account": "Sales - _TC",
+		"income_account": "Sales - _TC",
 		"default_warehouse": "_Test Warehouse - _TC",
-		"purchase_account": "_Test Account Cost for Goods Sold - _TC"
+		"expense_account": "_Test Account Cost for Goods Sold - _TC"
 	}],	
 	[{
 		"doctype": "Item",
@@ -74,8 +119,8 @@
 		"description": "_Test Item Home Desktop 100",
 		"item_group": "_Test Item Group Desktops",
 		"default_warehouse": "_Test Warehouse - _TC",
-		"default_income_account": "Sales - _TC",
-		"purchase_account": "_Test Account Cost for Goods Sold - _TC",
+		"income_account": "Sales - _TC",
+		"expense_account": "_Test Account Cost for Goods Sold - _TC",
 		"is_stock_item": "Yes",
 		"is_asset_item": "No",
 		"has_batch_no": "No",
@@ -101,8 +146,8 @@
 		"description": "_Test Item Home Desktop 200",
 		"item_group": "_Test Item Group Desktops",
 		"default_warehouse": "_Test Warehouse - _TC",
-		"default_income_account": "Sales - _TC",
-		"purchase_account": "_Test Account Cost for Goods Sold - _TC",
+		"income_account": "Sales - _TC",
+		"expense_account": "_Test Account Cost for Goods Sold - _TC",
 		"is_stock_item": "Yes",
 		"is_asset_item": "No",
 		"has_batch_no": "No",
@@ -122,8 +167,8 @@
 		"item_name": "_Test Sales BOM Item",
 		"description": "_Test Sales BOM Item",
 		"item_group": "_Test Item Group Desktops",
-		"default_income_account": "Sales - _TC",
-		"purchase_account": "_Test Account Cost for Goods Sold - _TC",
+		"income_account": "Sales - _TC",
+		"expense_account": "_Test Account Cost for Goods Sold - _TC",
 		"is_stock_item": "No",
 		"is_asset_item": "No",
 		"has_batch_no": "No",
@@ -144,8 +189,8 @@
 		"item_group": "_Test Item Group Desktops",
 		"is_stock_item": "Yes",
 		"default_warehouse": "_Test Warehouse - _TC",
-		"default_income_account": "Sales - _TC",
-		"purchase_account": "_Test Account Cost for Goods Sold - _TC",
+		"income_account": "Sales - _TC",
+		"expense_account": "_Test Account Cost for Goods Sold - _TC",
 		"is_asset_item": "No",
 		"has_batch_no": "No",
 		"has_serial_no": "No",
@@ -221,8 +266,8 @@
 		"description": "_Test Item Home Desktop Manufactured",
 		"item_group": "_Test Item Group Desktops",
 		"default_warehouse": "_Test Warehouse - _TC",
-		"default_income_account": "Sales - _TC",
-		"purchase_account": "_Test Account Cost for Goods Sold - _TC",
+		"income_account": "Sales - _TC",
+		"expense_account": "_Test Account Cost for Goods Sold - _TC",
 		"is_stock_item": "Yes",
 		"is_asset_item": "No",
 		"has_batch_no": "No",
@@ -244,8 +289,8 @@
 		"item_group": "_Test Item Group Desktops",
 		"is_stock_item": "Yes",
 		"default_warehouse": "_Test Warehouse - _TC",
-		"default_income_account": "Sales - _TC",
-		"purchase_account": "_Test Account Cost for Goods Sold - _TC",
+		"income_account": "Sales - _TC",
+		"expense_account": "_Test Account Cost for Goods Sold - _TC",
 		"is_asset_item": "No",
 		"has_batch_no": "No",
 		"has_serial_no": "No",
diff --git a/erpnext/stock/doctype/item_price/item_price.txt b/erpnext/stock/doctype/item_price/item_price.txt
index 338e759..8b18876 100644
--- a/erpnext/stock/doctype/item_price/item_price.txt
+++ b/erpnext/stock/doctype/item_price/item_price.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-05-02 16:29:48", 
   "docstatus": 0, 
-  "modified": "2014-01-20 17:48:50", 
+  "modified": "2014-02-10 17:27:32", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -28,7 +28,7 @@
   "permlevel": 0
  }, 
  {
-  "cancel": 1, 
+  "cancel": 0, 
   "create": 1, 
   "delete": 1, 
   "doctype": "DocPerm", 
@@ -101,7 +101,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "ref_rate", 
+  "fieldname": "price_list_rate", 
   "fieldtype": "Currency", 
   "in_filter": 1, 
   "in_list_view": 1, 
diff --git a/erpnext/stock/doctype/item_price/test_item_price.py b/erpnext/stock/doctype/item_price/test_item_price.py
index bc695ea..ee97fc4 100644
--- a/erpnext/stock/doctype/item_price/test_item_price.py
+++ b/erpnext/stock/doctype/item_price/test_item_price.py
@@ -17,7 +17,7 @@
 			"doctype": "Item Price",
 			"price_list": "_Test Price List",
 			"item_code": "_Test Item",
-			"ref_rate": 100
+			"price_list_rate": 100
 		}
 	]
 ]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/packed_item/packed_item.py b/erpnext/stock/doctype/packed_item/packed_item.py
index ba3cb30..d92b503 100644
--- a/erpnext/stock/doctype/packed_item/packed_item.py
+++ b/erpnext/stock/doctype/packed_item/packed_item.py
@@ -65,7 +65,7 @@
 	parent_items = []
 	for d in obj.doclist.get({"parentfield": item_table_fieldname}):
 		warehouse = (item_table_fieldname == "sales_order_details") \
-			and d.reserved_warehouse or d.warehouse
+			and d.warehouse or d.warehouse
 		if webnotes.conn.get_value("Sales BOM", {"new_item_code": d.item_code}):
 			for i in get_sales_bom_items(d.item_code):
 				update_packing_list_item(obj, i['item_code'], flt(i['qty'])*flt(d.qty), 
diff --git a/erpnext/stock/doctype/price_list/test_price_list.py b/erpnext/stock/doctype/price_list/test_price_list.py
index c601b77..c4fb163 100644
--- a/erpnext/stock/doctype/price_list/test_price_list.py
+++ b/erpnext/stock/doctype/price_list/test_price_list.py
@@ -13,7 +13,8 @@
 			"price_list_name": "_Test Price List",
 			"enabled": 1,
 			"currency": "INR",
-			"selling": 1
+			"selling": 1,
+			"buying": 1
 		},
 		{
 			"doctype": "Applicable Territory",
@@ -27,7 +28,8 @@
 			"price_list_name": "_Test Price List 2",
 			"enabled": 1,
 			"currency": "INR",
-			"selling": 1
+			"selling": 1,
+			"buying": 1
 		},
 		{
 			"doctype": "Applicable Territory",
@@ -41,7 +43,8 @@
 			"price_list_name": "_Test Price List India",
 			"enabled": 1,
 			"currency": "INR",
-			"selling": 1
+			"selling": 1,
+			"buying": 1
 		},
 		{
 			"doctype": "Applicable Territory",
@@ -55,7 +58,8 @@
 			"price_list_name": "_Test Price List Rest of the World",
 			"enabled": 1,
 			"currency": "USD",
-			"selling": 1
+			"selling": 1,
+			"buying": 1
 		},
 		{
 			"doctype": "Applicable Territory",
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index 955262f..5025c87 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -121,7 +121,7 @@
 			super(DocType, self).validate_with_previous_doc(self.tname, {
 				"Purchase Order Item": {
 					"ref_dn_field": "prevdoc_detail_docname",
-					"compare_fields": [["import_rate", "="]],
+					"compare_fields": [["rate", "="]],
 					"is_child_table": True
 				}
 			})
@@ -316,7 +316,6 @@
 				"parent": "purchase_receipt", 
 				"prevdoc_detail_docname": "po_detail", 
 				"prevdoc_docname": "purchase_order", 
-				"purchase_rate": "rate"
 			},
 		}, 
 		"Purchase Taxes and Charges": {
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt
index 28c2572..44325d7 100755
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-05-21 16:16:39", 
   "docstatus": 0, 
-  "modified": "2014-01-29 15:25:14", 
+  "modified": "2014-02-11 12:01:00", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -627,6 +627,15 @@
  {
   "allow_on_submit": 1, 
   "doctype": "DocField", 
+  "fieldname": "letter_head", 
+  "fieldtype": "Select", 
+  "label": "Letter Head", 
+  "options": "link:Letter Head", 
+  "print_hide": 1
+ }, 
+ {
+  "allow_on_submit": 1, 
+  "doctype": "DocField", 
   "fieldname": "select_print_heading", 
   "fieldtype": "Link", 
   "label": "Print Heading", 
diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
index c40b72b..dbe2d27 100644
--- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
@@ -26,8 +26,8 @@
 		self.assertEquals(pi[0]["doctype"], "Purchase Invoice")
 		self.assertEquals(len(pi), len(pr.doclist))
 		
-		# modify import_rate
-		pi[1].import_rate = 200
+		# modify rate
+		pi[1].rate = 200
 		self.assertRaises(webnotes.ValidationError, webnotes.bean(pi).submit)
 		
 	def test_purchase_receipt_no_gl_entry(self):
@@ -144,6 +144,7 @@
 			"net_total": 500.0, 
 			"grand_total": 720.0,
 			"naming_series": "_T-Purchase Receipt-",
+			"buying_price_list": "_Test Price List"
 		}, 
 		{
 			"conversion_factor": 1.0, 
@@ -155,8 +156,8 @@
 			"received_qty": 5.0,
 			"qty": 5.0,
 			"rejected_qty": 0.0,
-			"import_rate": 50.0,
-			"amount": 250.0,
+			"rate": 50.0,
+			"base_amount": 250.0,
 			"warehouse": "_Test Warehouse - _TC", 
 			"stock_uom": "Nos", 
 			"uom": "_Test UOM",
@@ -171,8 +172,8 @@
 			"received_qty": 5.0,
 			"qty": 5.0,
 			"rejected_qty": 0.0,
-			"import_rate": 50.0,
-			"amount": 250.0,
+			"rate": 50.0,
+			"base_amount": 250.0,
 			"warehouse": "_Test Warehouse 1 - _TC", 
 			"stock_uom": "Nos", 
 			"uom": "_Test UOM",
@@ -225,6 +226,7 @@
 			"supplier": "_Test Supplier",
 			"net_total": 5000.0, 
 			"grand_total": 5000.0,
+			"buying_price_list": "_Test Price List"
 		}, 
 		{
 			"conversion_factor": 1.0, 
@@ -236,8 +238,8 @@
 			"received_qty": 10.0,
 			"qty": 10.0,
 			"rejected_qty": 0.0,
-			"import_rate": 500.0,
-			"amount": 5000.0,
+			"rate": 500.0,
+			"base_amount": 5000.0,
 			"warehouse": "_Test Warehouse - _TC", 
 			"stock_uom": "Nos", 
 			"uom": "_Test UOM",
diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt
index 393e1ed..efc5a17 100755
--- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt
+++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-05-24 19:29:10", 
   "docstatus": 0, 
-  "modified": "2014-02-03 12:18:24", 
+  "modified": "2014-02-10 17:29:07", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -179,7 +179,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "import_ref_rate", 
+  "fieldname": "price_list_rate", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Price List Rate", 
@@ -189,7 +189,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "discount_rate", 
+  "fieldname": "discount_percentage", 
   "fieldtype": "Float", 
   "in_list_view": 0, 
   "label": "Discount  %", 
@@ -203,7 +203,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "purchase_ref_rate", 
+  "fieldname": "base_price_list_rate", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Price List Rate (Company Currency)", 
@@ -218,7 +218,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "import_rate", 
+  "fieldname": "rate", 
   "fieldtype": "Currency", 
   "in_list_view": 1, 
   "label": "Rate", 
@@ -232,7 +232,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "import_amount", 
+  "fieldname": "amount", 
   "fieldtype": "Currency", 
   "in_list_view": 1, 
   "label": "Amount", 
@@ -248,7 +248,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "purchase_rate", 
+  "fieldname": "base_rate", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Rate (Company Currency)", 
@@ -263,7 +263,7 @@
  }, 
  {
   "doctype": "DocField", 
-  "fieldname": "amount", 
+  "fieldname": "base_amount", 
   "fieldtype": "Currency", 
   "in_list_view": 0, 
   "label": "Amount (Company Currency)", 
diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py
index 45cc89c..0408cfe 100644
--- a/erpnext/stock/doctype/serial_no/serial_no.py
+++ b/erpnext/stock/doctype/serial_no/serial_no.py
@@ -213,6 +213,10 @@
 			if len(serial_nos) and len(serial_nos) != abs(cint(sle.actual_qty)):
 				webnotes.throw(_("Serial Nos do not match with qty") + \
 					(": %s (%s)" % (sle.item_code, sle.actual_qty)), SerialNoQtyError)
+					
+			if len(serial_nos) != len(set(serial_nos)):
+				webnotes.throw(_("Duplicate Serial No entered against item") + 
+					(": %s" % sle.item_code), SerialNoDuplicateError)
 			
 			for serial_no in serial_nos:
 				if webnotes.conn.exists("Serial No", serial_no):
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 161a3ad..608f1ba 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -373,7 +373,7 @@
 	def get_item_details(self, arg):
 		arg = json.loads(arg)
 		item = webnotes.conn.sql("""select stock_uom, description, item_name, 
-			purchase_account, cost_center from `tabItem` 
+			expense_account, buying_cost_center from `tabItem` 
 			where name = %s and (ifnull(end_of_life,'')='' or end_of_life ='0000-00-00' 
 			or end_of_life > now())""", (arg.get('item_code')), as_dict = 1)
 		if not item: 
@@ -384,9 +384,9 @@
 			'stock_uom'			  	: item and item[0]['stock_uom'] or '',
 			'description'		  	: item and item[0]['description'] or '',
 			'item_name' 		  	: item and item[0]['item_name'] or '',
-			'expense_account'		: item and item[0]['purchase_account'] or arg.get("expense_account") \
+			'expense_account'		: item and item[0]['expense_account'] or arg.get("expense_account") \
 				or webnotes.conn.get_value("Company", arg.get("company"), "default_expense_account"),
-			'cost_center'			: item and item[0]['cost_center'] or arg.get("cost_center"),
+			'cost_center'			: item and item[0]['buying_cost_center'] or arg.get("cost_center"),
 			'qty'					: 0,
 			'transfer_qty'			: 0,
 			'conversion_factor'		: 1,
@@ -464,7 +464,7 @@
 			# add finished good item to Stock Entry Detail table -- along with bom_no
 			if self.doc.production_order and self.doc.purpose == "Manufacture/Repack":
 				item = webnotes.conn.get_value("Item", pro_obj.doc.production_item, ["item_name", 
-					"description", "stock_uom", "purchase_account", "cost_center"], as_dict=1)
+					"description", "stock_uom", "expense_account", "buying_cost_center"], as_dict=1)
 				self.add_to_stock_entry_detail({
 					cstr(pro_obj.doc.production_item): {
 						"to_warehouse": pro_obj.doc.fg_warehouse,
@@ -473,8 +473,8 @@
 						"item_name": item.item_name,
 						"description": item.description,
 						"stock_uom": item.stock_uom,
-						"expense_account": item.purchase_account,
-						"cost_center": item.cost_center,
+						"expense_account": item.expense_account,
+						"cost_center": item.buying_cost_center,
 					}
 				}, bom_no=pro_obj.doc.bom_no, idx=idx)
 								
@@ -483,7 +483,7 @@
 					self.doc.from_warehouse = ""
 					
 				item = webnotes.conn.sql("""select name, item_name, description, 
-					stock_uom, purchase_account, cost_center from `tabItem` 
+					stock_uom, expense_account, buying_cost_center from `tabItem` 
 					where name=(select item from tabBOM where name=%s)""", 
 					self.doc.bom_no, as_dict=1)
 				self.add_to_stock_entry_detail({
@@ -493,8 +493,8 @@
 						"description": item[0]["description"],
 						"stock_uom": item[0]["stock_uom"],
 						"from_warehouse": "",
-						"expense_account": item[0].purchase_account,
-						"cost_center": item[0].cost_center,
+						"expense_account": item[0].expense_account,
+						"cost_center": item[0].buying_cost_center,
 					}
 				}, bom_no=self.doc.bom_no, idx=idx)
 		
@@ -611,7 +611,6 @@
 	else:
 		res = webnotes.conn.get_value(ref_dt, ref_dn, 
 			["supplier", "supplier_name", "address_display as supplier_address"], as_dict=1)
-		print ref_dt, ref_dn, res
 	return res or {}
 	
 @webnotes.whitelist()
@@ -911,7 +910,7 @@
 				
 			ref_item = ref_item[0]
 			
-			account = ref_item.expense_head
+			account = ref_item.expense_account
 			
 			if account not in children:
 				children.append(account)
diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py
index 4ec6c89..7239d7a 100644
--- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py
@@ -480,7 +480,7 @@
 		pi.doc.posting_date = pr.doc.posting_date
 		pi.doc.credit_to = "_Test Supplier - _TC"
 		for d in pi.doclist.get({"parentfield": "entries"}):
-			d.expense_head = "_Test Account Cost for Goods Sold - _TC"
+			d.expense_account = "_Test Account Cost for Goods Sold - _TC"
 			d.cost_center = "_Test Cost Center - _TC"
 
 		for d in pi.doclist.get({"parentfield": "other_charges"}):
@@ -562,7 +562,7 @@
 		po = webnotes.bean(copy=purchase_order_test_records[0])
 		po.doc.is_subcontracted = None
 		po.doclist[1].item_code = "_Test Item"
-		po.doclist[1].import_rate = 50
+		po.doclist[1].rate = 50
 		po.insert()
 		po.submit()
 
@@ -583,7 +583,7 @@
 		pi.doc.posting_date = pr.doc.posting_date
 		pi.doc.credit_to = "_Test Supplier - _TC"
 		for d in pi.doclist.get({"parentfield": "entries"}):
-			d.expense_head = "_Test Account Cost for Goods Sold - _TC"
+			d.expense_account = "_Test Account Cost for Goods Sold - _TC"
 			d.cost_center = "_Test Cost Center - _TC"
 		for d in pi.doclist.get({"parentfield": "other_charges"}):
 			d.cost_center = "_Test Cost Center - _TC"
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
new file mode 100644
index 0000000..5de856d
--- /dev/null
+++ b/erpnext/stock/get_item_details.py
@@ -0,0 +1,285 @@
+# 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 webnotes
+from webnotes import _, throw
+from webnotes.utils import flt, cint, add_days
+import json
+
+@webnotes.whitelist()
+def get_item_details(args):
+	"""
+		args = {
+			"item_code": "",
+			"warehouse": None,
+			"customer": "",
+			"conversion_rate": 1.0,
+			"selling_price_list": None,
+			"price_list_currency": None,
+			"plc_conversion_rate": 1.0
+			"doctype": "",
+			"docname": "",
+			"supplier": None,
+			"transaction_date": None,
+			"conversion_rate": 1.0,
+			"buying_price_list": None,
+			"is_subcontracted": "Yes" / "No",
+			"transaction_type": "selling"
+		}
+	"""
+
+	if isinstance(args, basestring):
+		args = json.loads(args)
+	args = webnotes._dict(args)
+	
+	if not args.get("transaction_type"):
+		args.transaction_type = "selling" if args.get("customer") else "buying"
+		
+	if not args.get("price_list"):
+		args.price_list = args.get("selling_price_list") or args.get("buying_price_list")
+	
+	if args.barcode:
+		args.item_code = get_item_code(barcode=args.barcode)
+	elif not args.item_code and args.serial_no:
+		args.item_code = get_item_code(serial_no=args.serial_no)
+	
+	item_bean = webnotes.bean("Item", args.item_code)
+	item = item_bean.doc
+
+	validate_item_details(args, item)
+		
+	out = get_basic_details(args, item_bean)
+	
+	get_party_item_code(args, item_bean, out)
+
+	if out.get("warehouse"):
+		out.update(get_available_qty(args.item_code, out.warehouse))
+		out.update(get_projected_qty(item.name, out.warehouse))
+	
+	get_price_list_rate(args, item_bean, out)
+	
+	out.update(get_item_discount(out.item_group, args.customer))
+
+	if args.transaction_type == "selling" and cint(args.is_pos):
+		out.update(get_pos_settings_item_details(args.company, args))
+		
+	if args.get("doctype") in ("Sales Invoice", "Delivery Note"):
+		if item_bean.doc.has_serial_no == "Yes" and not args.serial_no:
+			out.serial_no = get_serial_nos_by_fifo(args, item_bean)
+			
+	if args.transaction_date and item.lead_time_days:
+		out.schedule_date = out.lead_time_date = add_days(args.transaction_date,
+			item.lead_time_days)
+	
+	return out
+
+def get_item_code(barcode=None, serial_no=None):
+	if barcode:
+		item_code = webnotes.conn.get_value("Item", {"barcode": barcode})
+	elif serial_no:
+		item_code = webnotes.conn.get_value("Serial No", serial_no, "item_code")
+
+	if not item_code:
+		throw(_("No Item found with ") + _("Barcode") if barcode else _("Serial No") + 
+			": %s" % (barcode or serial_no))
+	
+	return item_code
+	
+def validate_item_details(args, item):
+	if not args.company:
+		throw(_("Please specify Company"))
+	
+	from erpnext.stock.doctype.item.item import validate_end_of_life
+	validate_end_of_life(item.name, item.end_of_life)
+	
+	if args.transaction_type == "selling":
+		# validate if sales item or service item
+		if args.get("order_type") == "Maintenance":
+			if item.is_service_item != "Yes":
+				throw(_("Item") + (" %s: " % item.name) + 
+					_("not a service item.") +
+					_("Please select a service item or change the order type to Sales."))
+		
+		elif item.is_sales_item != "Yes":
+			throw(_("Item") + (" %s: " % item.name) + _("not a sales item"))
+
+	elif args.transaction_type == "buying":
+		# validate if purchase item or subcontracted item
+		if item.is_purchase_item != "Yes":
+			throw(_("Item") + (" %s: " % item.name) + _("not a purchase item"))
+	
+		if args.get("is_subcontracted") == "Yes" and item.is_sub_contracted_item != "Yes":
+			throw(_("Item") + (" %s: " % item.name) + 
+				_("not a sub-contracted item.") +
+				_("Please select a sub-contracted item or do not sub-contract the transaction."))
+			
+def get_basic_details(args, item_bean):
+	item = item_bean.doc
+	
+	from webnotes.defaults import get_user_default_as_list
+	user_default_warehouse_list = get_user_default_as_list('warehouse')
+	user_default_warehouse = user_default_warehouse_list[0] \
+		if len(user_default_warehouse_list)==1 else ""
+	
+	out = webnotes._dict({
+		"item_code": item.name,
+		"item_name": item.item_name,
+		"description": item.description_html or item.description,
+		"warehouse": user_default_warehouse or args.warehouse or item.default_warehouse,
+		"income_account": item.income_account or args.income_account \
+			or webnotes.conn.get_value("Company", args.company, "default_income_account"),
+		"expense_account": item.expense_account or args.expense_account \
+			or webnotes.conn.get_value("Company", args.company, "default_expense_account"),
+		"cost_center": item.selling_cost_center \
+			if args.transaction_type == "selling" else args.buying_cost_center,
+		"batch_no": None,
+		"item_tax_rate": json.dumps(dict(([d.tax_type, d.tax_rate] for d in 
+			item_bean.doclist.get({"parentfield": "item_tax"})))),
+		"uom": item.stock_uom,
+		"min_order_qty": flt(item.min_order_qty) if args.doctype == "Material Request" else "",
+		"conversion_factor": 1.0,
+		"qty": 1.0,
+		"price_list_rate": 0.0,
+		"base_price_list_rate": 0.0,
+		"rate": 0.0,
+		"base_rate": 0.0,
+		"amount": 0.0,
+		"base_amount": 0.0,
+		"discount_percentage": 0.0
+	})
+	
+	for fieldname in ("item_name", "item_group", "barcode", "brand", "stock_uom"):
+		out[fieldname] = item.fields.get(fieldname)
+			
+	return out
+	
+def get_price_list_rate(args, item_bean, out):
+	meta = webnotes.get_doctype(args.doctype)
+
+	if meta.get_field("currency"):
+		validate_price_list(args)
+		validate_conversion_rate(args, meta)
+
+		price_list_rate = webnotes.conn.get_value("Item Price", 
+			{"price_list": args.price_list, "item_code": args.item_code}, "price_list_rate")
+			
+		if not price_list_rate: return {}
+		
+		out.price_list_rate = flt(price_list_rate) * flt(args.plc_conversion_rate) \
+			/ flt(args.conversion_rate)
+		
+		if not out.price_list_rate and args.transaction_type == "buying":
+			from erpnext.stock.doctype.item.item import get_last_purchase_details
+			out.update(get_last_purchase_details(item_bean.doc.name, 
+				args.docname, args.conversion_rate))
+			
+def validate_price_list(args):
+	if args.get("price_list"):
+		if not webnotes.conn.get_value("Price List", 
+			{"name": args.price_list, args.transaction_type: 1, "enabled": 1}):
+				throw(_("Price List is either disabled or for not ") + _(args.transaction_type))
+	else:
+		throw(_("Price List not selected"))
+		
+def validate_conversion_rate(args, meta):
+	from erpnext.setup.doctype.currency.currency import validate_conversion_rate
+	from webnotes.model.meta import get_field_precision
+	
+	# validate currency conversion rate
+	validate_conversion_rate(args.currency, args.conversion_rate, 
+		meta.get_label("conversion_rate"), args.company)
+	
+	args.conversion_rate = flt(args.conversion_rate, 
+		get_field_precision(meta.get_field("conversion_rate"), 
+			webnotes._dict({"fields": args})))
+	
+	# validate price list currency conversion rate
+	if not args.get("price_list_currency"):
+		throw(_("Price List Currency not selected"))
+	else:
+		validate_conversion_rate(args.price_list_currency, args.plc_conversion_rate, 
+			meta.get_label("plc_conversion_rate"), args.company)
+		
+		args.plc_conversion_rate = flt(args.plc_conversion_rate, 
+			get_field_precision(meta.get_field("plc_conversion_rate"), 
+			webnotes._dict({"fields": args})))
+
+def get_item_discount(item_group, customer):
+	parent_item_groups = [x[0] for x in webnotes.conn.sql("""SELECT parent.name 
+		FROM `tabItem Group` AS node, `tabItem Group` AS parent 
+		WHERE parent.lft <= node.lft and parent.rgt >= node.rgt and node.name = %s
+		GROUP BY parent.name 
+		ORDER BY parent.lft desc""", (item_group,))]
+		
+	discount = 0
+	for d in parent_item_groups:
+		res = webnotes.conn.sql("""select discount, name from `tabCustomer Discount` 
+			where parent = %s and item_group = %s""", (customer, d))
+		if res:
+			discount = flt(res[0][0])
+			break
+			
+	return {"discount_percentage": discount}
+	
+def get_party_item_code(args, item_bean, out):
+	if args.transaction_type == "selling":
+		customer_item_code = item_bean.doclist.get({"parentfield": "item_customer_details",
+			"customer_name": args.customer})
+		out.customer_item_code = customer_item_code[0].ref_code if customer_item_code else None
+	else:
+		item_supplier = item_bean.doclist.get({"parentfield": "item_supplier_details",
+			"supplier": args.supplier})
+		out.supplier_part_no = item_supplier[0].supplier_part_no if item_supplier else None
+		
+
+def get_pos_settings_item_details(company, args, pos_settings=None):
+	res = webnotes._dict()
+	
+	if not pos_settings:
+		pos_settings = get_pos_settings(company)
+		
+	if pos_settings:
+		for fieldname in ("income_account", "cost_center", "warehouse", "expense_account"):
+			if not args.get(fieldname):
+				res[fieldname] = pos_settings.get(fieldname)
+			
+		if res.get("warehouse"):
+			res.actual_qty = get_available_qty(args.item_code, 
+				res.warehouse).get("actual_qty")
+				
+	return res
+
+def get_pos_settings(company):
+	pos_settings = webnotes.conn.sql("""select * from `tabPOS Setting` where user = %s 
+		and company = %s""", (webnotes.session['user'], company), as_dict=1)
+	
+	if not pos_settings:
+		pos_settings = webnotes.conn.sql("""select * from `tabPOS Setting` 
+			where ifnull(user,'') = '' and company = %s""", company, as_dict=1)
+			
+	return pos_settings and pos_settings[0] or None
+	
+def get_serial_nos_by_fifo(args, item_bean):
+	return "\n".join(webnotes.conn.sql_list("""select name from `tabSerial No` 
+		where item_code=%(item_code)s and warehouse=%(warehouse)s and status='Available' 
+		order by timestamp(purchase_date, purchase_time) asc limit %(qty)s""", {
+			"item_code": args.item_code,
+			"warehouse": args.warehouse,
+			"qty": cint(args.qty)
+		}))
+		
+@webnotes.whitelist()
+def get_conversion_factor(item_code, uom):
+	return {"conversion_factor": webnotes.conn.get_value("UOM Conversion Detail",
+		{"parent": item_code, "uom": uom}, "conversion_factor")}
+		
+@webnotes.whitelist()
+def get_projected_qty(item_code, warehouse):
+	return {"projected_qty": webnotes.conn.get_value("Bin", 
+		{"item_code": item_code, "warehouse": warehouse}, "projected_qty")}
+		
+@webnotes.whitelist()
+def get_available_qty(item_code, warehouse):
+	return webnotes.conn.get_value("Bin", {"item_code": item_code, "warehouse": warehouse}, 
+		["projected_qty", "actual_qty"], as_dict=True) or {}
\ No newline at end of file
diff --git a/erpnext/stock/report/item_prices/item_prices.py b/erpnext/stock/report/item_prices/item_prices.py
index 323277d..5a0234d 100644
--- a/erpnext/stock/report/item_prices/item_prices.py
+++ b/erpnext/stock/report/item_prices/item_prices.py
@@ -58,7 +58,7 @@
 	rate = {}
 
 	price_list = webnotes.conn.sql("""select ip.item_code, ip.buying, ip.selling, 
-		concat(ip.price_list, " - ", ip.currency, " ", ip.ref_rate) as price 
+		concat(ip.price_list, " - ", ip.currency, " ", ip.price_list_rate) as price 
 		from `tabItem Price` ip, `tabPrice List` pl 
 		where ip.price_list=pl.name and pl.enabled=1""", as_dict=1)
 
@@ -80,15 +80,15 @@
 
 	query = """select * from (select 
 					result.item_code,
-					result.purchase_rate
+					result.base_rate
 					from (
 						(select 
 							po_item.item_code,
 							po_item.item_name,
 							po.transaction_date as posting_date,
-							po_item.purchase_ref_rate, 
-							po_item.discount_rate, 
-							po_item.purchase_rate
+							po_item.base_price_list_rate, 
+							po_item.discount_percentage, 
+							po_item.base_rate
 						from `tabPurchase Order` po, `tabPurchase Order Item` po_item
 						where po.name = po_item.parent and po.docstatus = 1)
 						union
@@ -96,9 +96,9 @@
 							pr_item.item_code,
 							pr_item.item_name,
 							pr.posting_date,
-							pr_item.purchase_ref_rate,
-							pr_item.discount_rate,
-							pr_item.purchase_rate
+							pr_item.base_price_list_rate,
+							pr_item.discount_percentage,
+							pr_item.base_rate
 						from `tabPurchase Receipt` pr, `tabPurchase Receipt Item` pr_item
 						where pr.name = pr_item.parent and pr.docstatus = 1)
 				) result
@@ -106,7 +106,7 @@
 				group by item_code"""
 
 	for d in webnotes.conn.sql(query, as_dict=1):
-		item_last_purchase_rate_map.setdefault(d.item_code, d.purchase_rate)
+		item_last_purchase_rate_map.setdefault(d.item_code, d.base_rate)
 
 	return item_last_purchase_rate_map
 
diff --git a/erpnext/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.txt b/erpnext/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.txt
index 65ee389..0eb46bc 100644
--- a/erpnext/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.txt
+++ b/erpnext/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-02-22 18:01:55", 
   "docstatus": 0, 
-  "modified": "2013-07-08 11:17:54", 
+  "modified": "2014-02-11 11:17:54", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -10,7 +10,7 @@
   "doctype": "Report", 
   "is_standard": "Yes", 
   "name": "__common__", 
-  "query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project_name` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.qty as \"Qty:Float:140\",\n `tabSales Order Item`.delivered_qty as \"Delivered Qty:Float:140\",\n (`tabSales Order Item`.qty - ifnull(`tabSales Order Item`.delivered_qty, 0)) as \"Qty to Deliver:Float:140\",\n `tabSales Order Item`.amount as \"Amount:Float:140\",\n `tabSales Order`.`delivery_date` as \"Expected Delivery Date:Date:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\",\n `tabSales Order Item`.item_group as \"Item Group:Link/Item Group:120\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status != \"Stopped\"\n and ifnull(`tabSales Order Item`.delivered_qty,0) < ifnull(`tabSales Order Item`.qty,0)\norder by `tabSales Order`.transaction_date asc", 
+  "query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project_name` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.qty as \"Qty:Float:140\",\n `tabSales Order Item`.delivered_qty as \"Delivered Qty:Float:140\",\n (`tabSales Order Item`.qty - ifnull(`tabSales Order Item`.delivered_qty, 0)) as \"Qty to Deliver:Float:140\",\n `tabSales Order Item`.base_amount as \"Amount:Float:140\",\n `tabSales Order`.`delivery_date` as \"Expected Delivery Date:Date:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\",\n `tabSales Order Item`.item_group as \"Item Group:Link/Item Group:120\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status != \"Stopped\"\n and ifnull(`tabSales Order Item`.delivered_qty,0) < ifnull(`tabSales Order Item`.qty,0)\norder by `tabSales Order`.transaction_date asc", 
   "ref_doctype": "Delivery Note", 
   "report_name": "Ordered Items To Be Delivered", 
   "report_type": "Query Report"
diff --git a/erpnext/stock/report/purchase_in_transit/purchase_in_transit.txt b/erpnext/stock/report/purchase_in_transit/purchase_in_transit.txt
index 60ce0da..ccc374b 100644
--- a/erpnext/stock/report/purchase_in_transit/purchase_in_transit.txt
+++ b/erpnext/stock/report/purchase_in_transit/purchase_in_transit.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-05-06 12:09:05", 
   "docstatus": 0, 
-  "modified": "2013-05-06 12:22:52", 
+  "modified": "2014-02-11 12:22:52", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -10,7 +10,7 @@
   "doctype": "Report", 
   "is_standard": "Yes", 
   "name": "__common__", 
-  "query": "SELECT\n    pi.name as \"Purchase Invoice:Link/Purchase Invoice:120\",\n\tpi.posting_date as \"Posting Date:Date:100\",\n\tpi.credit_to as \"Supplier Account:Link/Account:120\",\n\tpi_item.item_code as \"Item Code:Link/Item:120\",\n\tpi_item.description as \"Description:Data:140\",\n\tpi_item.qty as \"Qty:Float:120\",\n\tpi_item.amount as \"Amount:Currency:120\",\n\tpi_item.purchase_order as \"Purchase Order:Link/Purchase Order:120\",\n\tpi_item.purchase_receipt as \"Purchase Receipt:Link/Purchase Receipt:120\",\n\tpr.posting_date as \"PR Posting Date:Date:130\",\n\tpi.company as \"Company:Link/Company:120\"\nFROM\n\t`tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item, `tabPurchase Receipt` pr\nWHERE\n\tpi.name = pi_item.parent and pi_item.purchase_receipt = pr.name\n\tand pi.docstatus = 1 and pr.posting_date > pi.posting_date\nORDER BY\n\tpi.name desc", 
+  "query": "SELECT\n    pi.name as \"Purchase Invoice:Link/Purchase Invoice:120\",\n\tpi.posting_date as \"Posting Date:Date:100\",\n\tpi.credit_to as \"Supplier Account:Link/Account:120\",\n\tpi_item.item_code as \"Item Code:Link/Item:120\",\n\tpi_item.description as \"Description:Data:140\",\n\tpi_item.qty as \"Qty:Float:120\",\n\tpi_item.base_amount as \"Amount:Currency:120\",\n\tpi_item.purchase_order as \"Purchase Order:Link/Purchase Order:120\",\n\tpi_item.purchase_receipt as \"Purchase Receipt:Link/Purchase Receipt:120\",\n\tpr.posting_date as \"PR Posting Date:Date:130\",\n\tpi.company as \"Company:Link/Company:120\"\nFROM\n\t`tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item, `tabPurchase Receipt` pr\nWHERE\n\tpi.name = pi_item.parent and pi_item.purchase_receipt = pr.name\n\tand pi.docstatus = 1 and pr.posting_date > pi.posting_date\nORDER BY\n\tpi.name desc", 
   "ref_doctype": "Purchase Receipt", 
   "report_name": "Purchase In Transit", 
   "report_type": "Query Report"
diff --git a/erpnext/support/doctype/support_ticket/support_ticket.py b/erpnext/support/doctype/support_ticket/support_ticket.py
index 1b14ccc..7af0e50 100644
--- a/erpnext/support/doctype/support_ticket/support_ticket.py
+++ b/erpnext/support/doctype/support_ticket/support_ticket.py
@@ -49,10 +49,6 @@
 				self.doc.company = webnotes.conn.get_value("Lead", self.doc.lead, "company") or \
 					webnotes.conn.get_default("company")
 
-	def on_trash(self):
-		webnotes.conn.sql("""update `tabCommunication` set support_ticket=NULL 
-			where support_ticket=%s""", (self.doc.name,))
-
 	def update_status(self):
 		status = webnotes.conn.get_value("Support Ticket", self.doc.name, "status")
 		if self.doc.status!="Open" and status =="Open" and not self.doc.first_responded_on:
diff --git a/erpnext/utilities/repost_stock.py b/erpnext/utilities/repost_stock.py
index cb0ce10..caf8c8b 100644
--- a/erpnext/utilities/repost_stock.py
+++ b/erpnext/utilities/repost_stock.py
@@ -76,7 +76,7 @@
 				(select qty as dnpi_qty, qty as so_item_qty,
 					ifnull(delivered_qty, 0) as so_item_delivered_qty, parent, name
 				from `tabSales Order Item` so_item
-				where item_code = %s and reserved_warehouse = %s 
+				where item_code = %s and warehouse = %s 
 				and exists(select * from `tabSales Order` so
 					where so.name = so_item.parent and so.docstatus = 1 
 					and so.status != 'Stopped'))
diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py
index 83a3857..b239fdc 100644
--- a/erpnext/utilities/transaction_base.py
+++ b/erpnext/utilities/transaction_base.py
@@ -190,44 +190,6 @@
 	
 	return territory
 	
-def validate_conversion_rate(currency, conversion_rate, conversion_rate_label, company):
-	"""common validation for currency and price list currency"""
-
-	company_currency = webnotes.conn.get_value("Company", company, "default_currency")
-
-	if not conversion_rate:
-		msgprint(_('%(conversion_rate_label)s is mandatory. Maybe Currency Exchange record is not created for %(from_currency)s to %(to_currency)s') % {
-				"conversion_rate_label": conversion_rate_label,
-				"from_currency": currency,
-				"to_currency": company_currency
-		}, raise_exception=True)
-	
-def validate_currency(args, item, meta=None):
-	from webnotes.model.meta import get_field_precision
-	if not meta:
-		meta = webnotes.get_doctype(args.doctype)
-		
-	# validate conversion rate
-	if meta.get_field("currency"):
-		validate_conversion_rate(args.currency, args.conversion_rate, 
-			meta.get_label("conversion_rate"), args.company)
-		
-		# round it
-		args.conversion_rate = flt(args.conversion_rate, 
-			get_field_precision(meta.get_field("conversion_rate"), 
-				webnotes._dict({"fields": args})))
-	
-	# validate price list conversion rate
-	if meta.get_field("price_list_currency") and (args.selling_price_list or args.buying_price_list) \
-		and args.price_list_currency:
-		validate_conversion_rate(args.price_list_currency, args.plc_conversion_rate, 
-			meta.get_label("plc_conversion_rate"), args.company)
-		
-		# round it
-		args.plc_conversion_rate = flt(args.plc_conversion_rate, 
-			get_field_precision(meta.get_field("plc_conversion_rate"), 
-				webnotes._dict({"fields": args})))
-	
 def delete_events(ref_type, ref_name):
 	webnotes.delete_doc("Event", webnotes.conn.sql_list("""select name from `tabEvent` 
 		where ref_type=%s and ref_name=%s""", (ref_type, ref_name)), for_reload=True)