[flat discount] flat discount implemented on sales cycle
diff --git a/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt b/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt
index aab8e18..0907c4a 100644
--- a/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt
+++ b/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt
@@ -2,14 +2,14 @@
  {
   "creation": "2011-12-21 11:08:55", 
   "docstatus": 0, 
-  "modified": "2013-09-13 17:17:47", 
+  "modified": "2013-12-26 18:13:48", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
  {
   "doc_type": "Sales Invoice", 
   "doctype": "Print Format", 
-  "html": "<html>\n<head>\n<!--Item Table, Totals and Other Charges-->\n<script>\nfunction get_print_format() {\n    var oc = getchildren('Sales Invoice Item', doc.name, 'entries');\n\tvar rows = '<table width=\"100%\" cellpadding=\"0\" class=\"cart\">\\\n                <tr>\\\n                    <td colspan=\"3\"><hr></td>\\\n                </tr>\\\n                <tr>\\\n                    <td width=\"60%\" align=\"left\">ITEM NAME.</td>\\\n                    <td width=\"10%\" align=\"right\">QTY</td>\\\n                    <td width=\"30%\" align=\"right\">AMOUNT</td>\\\n                </tr>\\\n                <tr>\\\n                    <td colspan=\"3\"><hr></td>\\\n                </tr>';\n\tfor (var x=0; x<oc.length; x++) {\n        console.log(oc[x].item_code!=oc[x].item_name);\n\t\trows += '<tr>\\\n                    <td align=\"left\">' + oc[x].item_code + \n                        (oc[x].item_code!=oc[x].item_name ? ('<br>' + oc[x].item_name) : '') + '</td>\\\n                    <td align=\"right\" style=\"vertical-align:top;\">' + oc[x].qty + '</td>\\\n                    <td align=\"right\" valign=\"top\">' + format_currency(oc[x].export_amount, doc.currency) + '</td>\\\n                </tr>';\n\t}\n    rows += '<tr>\\\n                <td colspan=\"3\"><hr></td>\\\n            </tr>\\\n            <tr>\\\n                <td colspan=\"2\" align=\"right\">Net Total</td>\\\n                <td align=\"right\">' + format_currency(doc.net_total_export, doc.currency) + '</td>\\\n            </tr>';\n    if (doc.other_charges_total_export != 0) {\n        var taxes = wn.model.get_children(\"Sales Taxes and Charges\", doc.name, \"other_charges\", \"Sales Invoice\");\n\t\t$.each(taxes, function(i, d) {\n\t\t\trows += '<tr>\\\n        \t\t\t\t<td colspan=\"2\" align=\"right\">' + d.description + '</td>\\\n        \t\t\t\t<td style=\"text-align: right;\">' + format_currency(d.tax_amount / doc.conversion_rate, doc.currency) + '</td>\\\n        \t\t\t<tr>';\n\t\t});\n    }\n    rows += '<tr>\\\n                <td colspan=\"2\" align=\"right\" style=\"vertical-align:middle;\">Grand Total</td>\\\n                <td align=\"right\"><hr width=\"90%\" align=\"right\">' + format_currency(doc.grand_total_export, doc.currency) + '<br>\\\n                    <hr width=\"90%\" align=\"right\"></td>\\\n            </tr>\\\n            <tr>\\\n                <td align=\"center\" colspan=\"3\">Thank You. Please visit again.</td>\\\n            </tr>\\\n            </table>';\n\treturn rows;\n}\n</script>\n<style>\n    table, tr, td, div, p {\n        font-family: Monospace;\n        line-height: 200%;\n    }\n    h1, h2, h3, h4, h5, h6 {\n        text-align: center;\n    }\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 4in;\n\t\t}\n\t}\n</style>\n</head>\n\n<body>\n<table width=\"100%\" cellpadding=\"4\">\n    <tr>\n        <td align=\"left\">RECEIPT NO: <script>doc.name</script></td>\n        <td align=\"right\">DATE: <script>date.str_to_user(doc.posting_date)</script></td>\n    </tr>\n    <tr>\n        <td>M/s <script>doc.customer</script></td>\n    </tr>\n</table>\n<!--Item Table & Totals-->\n<div><script>get_print_format();</script></div>\n</body>\n</html>\n", 
+  "html": "<html>\n<head>\n<!--Item Table, Totals and Other Charges-->\n<script>\nfunction get_print_format() {\n\tvar oc = getchildren('Sales Invoice Item', doc.name, 'entries');\n\tvar rows = '<table width=\"100%\" cellpadding=\"0\" class=\"cart\">\\\n                <tr>\\\n                    <td colspan=\"3\"><hr></td>\\\n                </tr>\\\n                <tr>\\\n                    <td width=\"60%\" align=\"left\">ITEM NAME</td>\\\n                    <td width=\"10%\" align=\"right\">QTY</td>\\\n                    <td width=\"30%\" align=\"right\">AMOUNT</td>\\\n                </tr>\\\n                <tr>\\\n                    <td colspan=\"3\"><hr></td>\\\n                </tr>';\n\n\tfor (var x=0; x<oc.length; x++) {\n\t\trows += '<tr>\\\n                    <td align=\"left\">' + oc[x].item_code + \n                        (oc[x].item_code!=oc[x].item_name ? ('<br>' + oc[x].item_name) : '') + '</td>\\\n                    <td align=\"right\" style=\"vertical-align:top;\">' + oc[x].qty + '</td>\\\n                    <td align=\"right\" valign=\"top\">' + format_currency(oc[x].export_amount, doc.currency) + '</td>\\\n                </tr>';\n\t}\n\n    rows += '<tr>\\\n                <td colspan=\"3\"><hr></td>\\\n            </tr>\\\n            <tr>\\\n                <td colspan=\"2\" align=\"right\"><b>Net Total</b></td>\\\n                <td align=\"right\">' + format_currency(doc.net_total_export, doc.currency) + '</td>\\\n            </tr>';\n\n    if (doc.other_charges_total_export != 0) {\n        var taxes = wn.model.get_children(\"Sales Taxes and Charges\", doc.name, \"other_charges\", \"Sales Invoice\");\n\t\t$.each(taxes, function(i, d) {\n\t\t\trows += '<tr>\\\n        \t\t\t\t<td colspan=\"2\" align=\"right\">' + d.description + '</td>\\\n        \t\t\t\t<td style=\"text-align: right;\">' + format_currency(d.tax_amount / doc.conversion_rate, doc.currency) + '</td>\\\n        \t\t\t<tr>';\n\t\t});\n    }\n\n    if (doc.flat_discount) {\n\t\trows += '<tr>\\\n        \t\t\t<td colspan=\"2\" align=\"right\" style=\"vertical-align:middle;\">Flat Discount</td>\\\n        \t\t\t<td style=\"text-align: right;\">' + format_currency(doc.flat_discount, doc.currency) + '</td>\\\n        \t\t<tr>';\n    }\n\n    rows += '<tr>\\\n                <td colspan=\"2\" align=\"right\" style=\"vertical-align:middle;\"><b>Grand Total</b></td>\\\n                <td align=\"right\"><hr width=\"90%\" align=\"right\">' + format_currency(doc.grand_total_export, doc.currency) + '<br>\\\n                    <hr width=\"90%\" align=\"right\"></td>\\\n            </tr>\\\n            <tr>\\\n                <td align=\"center\" colspan=\"3\">Thank You. Please visit again.</td>\\\n            </tr>\\\n            </table>';\n\treturn rows;\n}\n</script>\n<style>\n    table, tr, td, div, p {\n        font-family: Monospace;\n        line-height: 200%;\n    }\n    h1, h2, h3, h4, h5, h6 {\n        text-align: center;\n    }\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 4in;\n\t\t}\n\t}\n</style>\n</head>\n\n<body>\n<table width=\"100%\" cellpadding=\"4\">\n    <tr>\n        <td align=\"left\">RECEIPT NO: <script>doc.name</script></td>\n        <td align=\"right\">DATE: <script>date.str_to_user(doc.posting_date)</script></td>\n    </tr>\n    <tr>\n        <td>M/s <script>doc.customer</script></td>\n    </tr>\n</table>\n<!--Item Table & Totals-->\n<div><script>get_print_format();</script></div>\n</body>\n</html>\n", 
   "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 fc99597..4e8b12b 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-08-07 20:14:53", 
+  "modified": "2013-12-26 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\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>\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'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.flat_discount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Flat Discount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.flat_discount, 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 07946f7..6808c00 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-08-07 20:12:16", 
+  "modified": "2013-12-26 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\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>\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: \"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.flat_discount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Flat Discount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.flat_discount, 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 57c02fe..45905fc 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-08-07 19:50:51", 
+  "modified": "2013-12-26 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\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>\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'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.flat_discount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Flat Discount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.flat_discount, 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/doctype/sales_invoice/pos.js b/erpnext/accounts/doctype/sales_invoice/pos.js
index c432765..1da6f73 100644
--- a/erpnext/accounts/doctype/sales_invoice/pos.js
+++ b/erpnext/accounts/doctype/sales_invoice/pos.js
@@ -30,12 +30,14 @@
 						</div>\
 						<br>\
 						<div class="totals-area" style="margin-left: 40%;">\
-							<table class="table table-condensed">\
-								<tr>\
-									<td><b>Net Total</b></td>\
-									<td style="text-align: right;" class="net-total"></td>\
-								</tr>\
-							</table>\
+							<div class="net-total-area">\
+								<table class="table table-condensed">\
+									<tr>\
+										<td><b>Net Total</b></td>\
+										<td style="text-align: right;" class="net-total"></td>\
+									</tr>\
+								</table>\
+							</div>\
 							<div class="tax-table" style="display: none;">\
 								<table class="table table-condensed">\
 									<thead>\
@@ -48,6 +50,18 @@
 									</tbody>\
 								</table>\
 							</div>\
+							<div class="flat-discount-area">\
+								<table class="table table-condensed">\
+									<tr>\
+										<td style="vertical-align: middle;" width="50%"><b>Flat Discount</b></td>\
+										<td width="20%"></td>\
+										<td style="text-align: right;">\
+											<input type="text" class="form-control flat-discount" \
+												style="text-align: right;">\
+										</td>\
+									</tr>\
+								</table>\
+							</div>\
 							<div class="grand-total-area">\
 								<table class="table table-condensed">\
 									<tr>\
@@ -82,6 +96,10 @@
 			me.refresh();
 		});
 
+		this.wrapper.find('input.flat-discount').on("change", function() {
+			wn.model.set_value(me.frm.doctype, me.frm.docname, "flat_discount", this.value);
+		});
+
 		this.call_function("delete-items", function() {me.remove_selected_item();});
 		this.call_function("make-payment", function() {me.make_payment();});
 	},
@@ -112,9 +130,9 @@
 	},
 	make: function() {
 		this.make_party();
-		this.make_item_group();
-		this.make_search();
 		this.make_barcode();
+		this.make_search();
+		this.make_item_group();
 		this.make_item_list();
 	},
 	make_party: function() {
@@ -137,23 +155,23 @@
 					me.party.toLowerCase(), this.value);
 		});
 	},
-	make_item_group: function() {
+	make_barcode: function() {
 		var me = this;
-		this.item_group = wn.ui.form.make_control({
+		this.barcode = wn.ui.form.make_control({
 			df: {
-				"fieldtype": "Link",
-				"options": "Item Group",
-				"label": "Item Group",
-				"fieldname": "pos_item_group",
-				"placeholder": "Item Group"
+				"fieldtype": "Data",
+				"label": "Barcode",
+				"fieldname": "pos_barcode",
+				"placeholder": "Barcode / Serial No"
 			},
-			parent: this.wrapper.find(".item-group-area"),
+			parent: this.wrapper.find(".barcode-area"),
 			only_input: true,
 		});
-		this.item_group.make_input();
-		this.item_group.$input.on("change", function() {
-			if(!me.item_group.autocomplete_open)
-				me.make_item_list();
+		this.barcode.make_input();
+		this.barcode.$input.on("keypress", function() {
+			if(me.barcode_timeout)
+				clearTimeout(me.barcode_timeout);
+			me.barcode_timeout = setTimeout(function() { me.add_item_thru_barcode(); }, 1000);
 		});
 	},
 	make_search: function() {
@@ -176,23 +194,23 @@
 				me.item_timeout = setTimeout(function() { me.make_item_list(); }, 1000);
 		});
 	},
-	make_barcode: function() {
+	make_item_group: function() {
 		var me = this;
-		this.barcode = wn.ui.form.make_control({
+		this.item_group = wn.ui.form.make_control({
 			df: {
-				"fieldtype": "Data",
-				"label": "Barcode",
-				"fieldname": "pos_barcode",
-				"placeholder": "Barcode / Serial No"
+				"fieldtype": "Link",
+				"options": "Item Group",
+				"label": "Item Group",
+				"fieldname": "pos_item_group",
+				"placeholder": "Item Group"
 			},
-			parent: this.wrapper.find(".barcode-area"),
+			parent: this.wrapper.find(".item-group-area"),
 			only_input: true,
 		});
-		this.barcode.make_input();
-		this.barcode.$input.on("keypress", function() {
-			if(me.barcode_timeout)
-				clearTimeout(me.barcode_timeout);
-			me.barcode_timeout = setTimeout(function() { me.add_item_thru_barcode(); }, 1000);
+		this.item_group.make_input();
+		this.item_group.$input.on("change", function() {
+			if(!me.item_group.autocomplete_open)
+				me.make_item_list();
 		});
 	},
 	make_item_list: function() {
@@ -321,6 +339,7 @@
 	refresh: function() {
 		var me = this;
 		this.party_field.set_input(this.frm.doc[this.party.toLowerCase()]);
+		this.wrapper.find('input.flat-discount').val(this.frm.doc.flat_discount);
 		this.barcode.set_input("");
 
 		this.show_items_in_item_cart();
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 9c6a9b2..136519e 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -25,7 +25,7 @@
 		}
 		
 		// toggle to pos view if is_pos is 1 in user_defaults
-		if ((cint(wn.defaults.get_user_defaults("is_pos"))===1 || cur_frm.doc.is_pos)) {
+		if ((cint(wn.defaults.get_user_defaults("is_pos"))===1 || this.frm.doc.is_pos)) {
 			if(this.frm.doc.__islocal && !this.frm.doc.amended_from && !this.frm.doc.customer) {
 				this.frm.set_value("is_pos", 1);
 				this.is_pos(function() {
@@ -145,8 +145,8 @@
 							me.set_default_values();
 							me.set_dynamic_labels();
 							me.calculate_taxes_and_totals();
-
-							if(callback_fn) callback_fn()
+							
+							if(callback_fn) callback_fn();
 						}
 					}
 				});
@@ -334,7 +334,7 @@
 // --------------------------------
 cur_frm.set_query("income_account", "entries", function(doc) {
 	return{
-		query: "accounts.doctype.sales_invoice.sales_invoice.get_income_account",
+		query: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_income_account",
 		filters: {'company': doc.company}
 	}
 });
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index f77abfe..55c2eca 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -556,12 +556,12 @@
 				
 	def make_tax_gl_entries(self, gl_entries):
 		for tax in self.doclist.get({"parentfield": "other_charges"}):
-			if flt(tax.tax_amount):
+			if flt(tax.tax_amount_after_flat_discount):
 				gl_entries.append(
 					self.get_gl_dict({
 						"account": tax.account_head,
 						"against": self.doc.debit_to,
-						"credit": flt(tax.tax_amount),
+						"credit": flt(tax.tax_amount_after_flat_discount),
 						"remarks": self.doc.remarks,
 						"cost_center": tax.cost_center
 					})
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt b/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt
index 7de68a0..0fcb79d 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-05-24 19:29:05", 
   "docstatus": 0, 
-  "modified": "2013-12-20 19:24:29", 
+  "modified": "2013-12-26 17:50:21", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -457,6 +457,14 @@
  }, 
  {
   "doctype": "DocField", 
+  "fieldname": "flat_discount", 
+  "fieldtype": "Currency", 
+  "label": "Flat Discount", 
+  "options": "Company:company:default_currency", 
+  "print_hide": 0
+ }, 
+ {
+  "doctype": "DocField", 
   "fieldname": "totals", 
   "fieldtype": "Section Break", 
   "label": "Totals", 
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index 478ed3c..4b49eb4 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -44,7 +44,6 @@
 		
 	def test_sales_invoice_calculation_base_currency(self):
 		si = webnotes.bean(copy=test_records[2])
-		si.run_method("calculate_taxes_and_totals")
 		si.insert()
 		
 		expected_values = {
@@ -136,7 +135,114 @@
 				
 		self.assertEquals(si.doc.grand_total, 1627.05)
 		self.assertEquals(si.doc.grand_total_export, 32.54)
+
+	def test_sales_invoice_flat_discount(self):
+		si = webnotes.bean(copy=test_records[3])
+		si.doc.flat_discount = 104.95
+		si.doclist.append({
+			"doctype": "Sales Taxes and Charges",
+			"parentfield": "other_charges",
+			"charge_type": "On Previous Row Amount",
+			"account_head": "_Test Account Service Tax - _TC",
+			"cost_center": "_Test Cost Center - _TC",
+			"description": "Service Tax",
+			"rate": 10,
+			"row_id": 8,
+			"idx": 9
+		})
+		si.insert()
+		
+		expected_values = {
+			"keys": ["ref_rate", "adj_rate", "export_rate", "export_amount", 
+				"base_ref_rate", "basic_rate", "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],
+		}
+		
+		# check if children are saved
+		self.assertEquals(len(si.doclist.get({"parentfield": "entries"})),
+			len(expected_values)-1)
+		
+		# check if item values are calculated
+		for d in si.doclist.get({"parentfield": "entries"}):
+			for i, k in enumerate(expected_values["keys"]):
+				self.assertEquals(d.fields.get(k), expected_values[d.item_code][i])
+		
+		# check net total
+		self.assertEquals(si.doc.net_total, 1163.45)
+		self.assertEquals(si.doc.net_total_export, 1578.3)
+		
+		# check tax calculation
+		expected_values = {
+			"keys": ["tax_amount", "tax_amount_after_flat_discount", "total"],
+			"_Test Account Excise Duty - _TC": [140, 130.31, 1293.76],
+			"_Test Account Education Cess - _TC": [2.8, 2.61, 1296.37],
+			"_Test Account S&H Education Cess - _TC": [1.4, 1.31, 1297.68],
+			"_Test Account CST - _TC": [27.88, 25.96, 1323.64],
+			"_Test Account VAT - _TC": [156.25, 145.43, 1469.07],
+			"_Test Account Customs Duty - _TC": [125, 116.35, 1585.42],
+			"_Test Account Shipping Charges - _TC": [100, 100, 1685.42],
+			"_Test Account Discount - _TC": [-180.33, -168.54, 1516.88],
+			"_Test Account Service Tax - _TC": [-18.03, -16.88, 1500]
+		}
+		
+		for d in si.doclist.get({"parentfield": "other_charges"}):
+			for i, k in enumerate(expected_values["keys"]):
+				self.assertEquals(d.fields.get(k), expected_values[d.account_head][i])
 				
+		self.assertEquals(si.doc.grand_total, 1500)
+		self.assertEquals(si.doc.grand_total_export, 1500)
+
+	def test_flat_discount_gl_entry(self):
+		si = webnotes.bean(copy=test_records[3])
+		si.doc.flat_discount = 104.95
+		si.doclist.append({
+			"doctype": "Sales Taxes and Charges",
+			"parentfield": "other_charges",
+			"charge_type": "On Previous Row Amount",
+			"account_head": "_Test Account Service Tax - _TC",
+			"cost_center": "_Test Cost Center - _TC",
+			"description": "Service Tax",
+			"rate": 10,
+			"row_id": 8,
+			"idx": 9
+		})
+		si.insert()
+		si.submit()
+
+		gl_entries = webnotes.conn.sql("""select account, debit, credit
+			from `tabGL Entry` where voucher_type='Sales Invoice' and voucher_no=%s
+			order by account asc""", si.doc.name, as_dict=1)
+
+		self.assertTrue(gl_entries)
+
+		expected_values = sorted([
+			[si.doc.debit_to, 1500, 0.0],
+			[test_records[3][1]["income_account"], 0.0, 1163.45],
+			[test_records[3][3]["account_head"], 0.0, 130.31],
+			[test_records[3][4]["account_head"], 0.0, 2.61],
+			[test_records[3][5]["account_head"], 0.0, 1.31],
+			[test_records[3][6]["account_head"], 0.0, 25.96],
+			[test_records[3][7]["account_head"], 0.0, 145.43],
+			[test_records[3][8]["account_head"], 0.0, 116.35],
+			[test_records[3][9]["account_head"], 0.0, 100],
+			[test_records[3][10]["account_head"], 168.54, 0.0],
+			["_Test Account Service Tax - _TC", 16.88, 0.0],
+		])
+
+		for i, gle in enumerate(gl_entries):
+			self.assertEquals(expected_values[i][0], gle.account)
+			self.assertEquals(expected_values[i][1], gle.debit)
+			self.assertEquals(expected_values[i][2], gle.credit)
+
+		# cancel
+		si.cancel()
+
+		gle = webnotes.conn.sql("""select * from `tabGL Entry` 
+			where voucher_type='Sales Invoice' and voucher_no=%s""", si.doc.name)
+
+		self.assertFalse(gle)
+
 	def test_inclusive_rate_validations(self):
 		si = webnotes.bean(copy=test_records[2])
 		for i, tax in enumerate(si.doclist.get({"parentfield": "other_charges"})):
@@ -148,16 +254,15 @@
 			si.doclist[i].included_in_print_rate = 1
 		
 		# tax type "Actual" cannot be inclusive
-		self.assertRaises(webnotes.ValidationError, si.run_method, "calculate_taxes_and_totals")
+		self.assertRaises(webnotes.ValidationError, si.insert)
 		
 		# taxes above included type 'On Previous Row Total' should also be included
 		si.doclist[3].included_in_print_rate = 0
-		self.assertRaises(webnotes.ValidationError, si.run_method, "calculate_taxes_and_totals")
+		self.assertRaises(webnotes.ValidationError, si.insert)
 		
 	def test_sales_invoice_calculation_base_currency_with_tax_inclusive_price(self):
 		# prepare
 		si = webnotes.bean(copy=test_records[3])
-		si.run_method("calculate_taxes_and_totals")
 		si.insert()
 		
 		expected_values = {
@@ -195,7 +300,7 @@
 		
 		for d in si.doclist.get({"parentfield": "other_charges"}):
 			for i, k in enumerate(expected_values["keys"]):
-				self.assertEquals(flt(d.fields.get(k), 6), expected_values[d.account_head][i])
+				self.assertEquals(d.fields.get(k), expected_values[d.account_head][i])
 		
 		self.assertEquals(si.doc.grand_total, 1622.98)
 		self.assertEquals(si.doc.grand_total_export, 1622.98)
@@ -211,7 +316,6 @@
 		si.doclist[2].adj_rate = 20
 		si.doclist[9].rate = 5000
 		
-		si.run_method("calculate_taxes_and_totals")
 		si.insert()
 		
 		expected_values = {
@@ -249,7 +353,7 @@
 		
 		for d in si.doclist.get({"parentfield": "other_charges"}):
 			for i, k in enumerate(expected_values["keys"]):
-				self.assertEquals(flt(d.fields.get(k), 6), expected_values[d.account_head][i])
+				self.assertEquals(d.fields.get(k), expected_values[d.account_head][i])
 		
 		self.assertEquals(si.doc.grand_total, 65205.16)
 		self.assertEquals(si.doc.grand_total_export, 1304.1)
@@ -364,7 +468,6 @@
 			from `tabGL Entry` where voucher_type='Sales Invoice' and voucher_no=%s
 			order by account asc, debit asc""", si.doc.name, as_dict=1)
 		self.assertTrue(gl_entries)
-		# print gl_entries
 		
 		stock_in_hand = webnotes.conn.get_value("Account", {"master_name": "_Test Warehouse - _TC"})
 				
@@ -404,7 +507,6 @@
 		pr = webnotes.bean(copy=pr_test_records[0])
 		pr.doc.naming_series = "_T-Purchase Receipt-"
 		pr.doclist[1].warehouse = "_Test Warehouse No Account - _TC"
-		pr.run_method("calculate_taxes_and_totals")
 		pr.insert()
 		pr.submit()
 		
@@ -449,7 +551,7 @@
 		self.assertFalse(gle)
 		set_perpetual_inventory(0)
 		
-	def test_sales_invoice_gl_entry_with_aii_no_item_code(self):	
+	def test_sales_invoice_gl_entry_with_aii_no_item_code(self):
 		self.clear_stock_account_balance()
 		set_perpetual_inventory()
 				
@@ -509,7 +611,6 @@
 			as pr_test_records
 		pr = webnotes.bean(copy=pr_test_records[0])
 		pr.doc.naming_series = "_T-Purchase Receipt-"
-		pr.run_method("calculate_taxes_and_totals")
 		pr.insert()
 		pr.submit()
 		
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt
index ab4da2a..1b3b6f8 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt
@@ -133,10 +133,19 @@
  }, 
  {
   "doctype": "DocField", 
+  "fieldname": "tax_amount_after_flat_discount", 
+  "fieldtype": "Currency", 
+  "hidden": 1, 
+  "label": "Tax Amount After Flat Discount", 
+  "options": "Company:company:default_currency", 
+  "read_only": 1
+ }, 
+ {
+  "doctype": "DocField", 
   "fieldname": "item_wise_tax_detail", 
   "fieldtype": "Small Text", 
   "hidden": 1, 
-  "label": "Item Wise Tax Detail ", 
+  "label": "Item Wise Tax Detail", 
   "oldfieldname": "item_wise_tax_detail", 
   "oldfieldtype": "Small Text", 
   "read_only": 1
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
index 0cdead9..2ac6be7 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
@@ -19,6 +19,10 @@
 	return '';
 }
 
+cur_frm.pformat.flat_discount = function(doc) {
+	return '';
+}
+
 cur_frm.pformat.grand_total_export = function(doc) {
 	return '';
 }
@@ -33,10 +37,10 @@
 
 cur_frm.pformat.other_charges= function(doc){
 	//function to make row of table
-	var make_row = function(title,val,bold){
+	var make_row = function(title, val, bold){
 		var bstart = '<b>'; var bend = '</b>';
-		return '<tr><td style="width:50%;">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'
-		 +'<td style="width:50%;text-align:right;">'+format_currency(val, doc.currency)+'</td>'
+		return '<tr><td style="width:50%;">' + (bold?bstart:'') + title + (bold?bend:'') + '</td>'
+		 +'<td style="width:50%;text-align:right;">' + format_currency(val, doc.currency) + '</td>'
 		 +'</tr>'
 	}
 
@@ -52,7 +56,7 @@
 	
 	out ='';
 	if (!doc.print_without_amount) {
-		var cl = getchildren('Sales Taxes and Charges',doc.name,'other_charges');
+		var cl = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');
 
 		// outer table	
 		var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 60%"></td><td>';
@@ -60,6 +64,7 @@
 		// main table
 
 		out +='<table class="noborder" style="width:100%">';
+
 		if(!print_hide('net_total_export')) {
 			out += make_row('Net Total', doc.net_total_export, 1);
 		}
@@ -68,26 +73,31 @@
 		if(cl.length){
 			for(var i=0;i<cl.length;i++){
 				if(convert_rate(cl[i].tax_amount)!=0 && !cl[i].included_in_print_rate)
-					out += make_row(cl[i].description,convert_rate(cl[i].tax_amount),0);
+					out += make_row(cl[i].description, convert_rate(cl[i].tax_amount), 0);
 			}
 		}
 
+		// flat discount
+		if(!print_hide('flat_discount') && doc.flat_discount) {
+			out += make_row('Flat Discount', doc.flat_discount, 0);
+		}
+
 		// grand total
 		if(!print_hide('grand_total_export')) {
-			out += make_row('Grand Total',doc.grand_total_export,1);
+			out += make_row('Grand Total', doc.grand_total_export, 1);
 		}
 		
 		if(!print_hide('rounded_total_export')) {
-			out += make_row('Rounded Total',doc.rounded_total_export,1);
+			out += make_row('Rounded Total', doc.rounded_total_export, 1);
 		}
 
 		if(doc.in_words_export && !print_hide('in_words_export')){
 			out +='</table></td></tr>';
 			out += '<tr><td colspan = "2">';
 			out += '<table><tr><td style="width:25%;"><b>In Words</b></td>'
-			out+= '<td style="width:50%;">'+doc.in_words_export+'</td></tr>'
+			out += '<td style="width:50%;">' + doc.in_words_export + '</td></tr>'
 		}
-		out +='</table></td></tr></table></div>';	 
+		out += '</table></td></tr></table></div>';	 
 	}
 	return out;
 }
@@ -99,7 +109,7 @@
 		d.charge_type = '';
 	}
 	validated = false;
-	refresh_field('charge_type',d.name,'other_charges');
+	refresh_field('charge_type', d.name, 'other_charges');
 	cur_frm.cscript.row_id(doc, cdt, cdn);
 	cur_frm.cscript.rate(doc, cdt, cdn);
 	cur_frm.cscript.tax_amount(doc, cdt, cdn);
@@ -122,7 +132,7 @@
 		}
 	}
 	validated = false;
-	refresh_field('row_id',d.name,'other_charges');
+	refresh_field('row_id', d.name, 'other_charges');
 }
 
 /*---------------------- Get rate if account_head has account_type as TAX or CHARGEABLE-------------------------------------*/
@@ -152,7 +162,7 @@
 		d.rate = '';
 	}
 	validated = false;
-	refresh_field('rate',d.name,'other_charges');
+	refresh_field('rate', d.name, 'other_charges');
 }
 
 cur_frm.cscript.tax_amount = function(doc, cdt, cdn) {
@@ -166,5 +176,5 @@
 		d.tax_amount = '';
 	}
 	validated = false;
-	refresh_field('tax_amount',d.name,'other_charges');
+	refresh_field('tax_amount', d.name, 'other_charges');
 };
\ No newline at end of file
diff --git a/erpnext/accounts/report/sales_register/sales_register.py b/erpnext/accounts/report/sales_register/sales_register.py
index 49b914e..98ef936 100644
--- a/erpnext/accounts/report/sales_register/sales_register.py
+++ b/erpnext/accounts/report/sales_register/sales_register.py
@@ -79,7 +79,7 @@
 	
 		tax_accounts = 	webnotes.conn.sql_list("""select distinct account_head 
 			from `tabSales Taxes and Charges` where parenttype = 'Sales Invoice' 
-			and docstatus = 1 and ifnull(tax_amount, 0) != 0 
+			and docstatus = 1 and ifnull(tax_amount_after_flat_discount, 0) != 0 
 			and parent in (%s) order by account_head""" % 
 			', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]))
 
@@ -126,7 +126,8 @@
 	return invoice_income_map
 	
 def get_invoice_tax_map(invoice_list, invoice_income_map, income_accounts):
-	tax_details = webnotes.conn.sql("""select parent, account_head, sum(tax_amount) as tax_amount
+	tax_details = webnotes.conn.sql("""select parent, account_head, 
+		sum(tax_amount_after_flat_discount) as tax_amount 
 		from `tabSales Taxes and Charges` where parent in (%s) group by parent, account_head""" % 
 		', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
 	
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js
index cc24925..29e4781 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.js
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.js
@@ -360,6 +360,14 @@
 				});
 			}
 		}
+
+		if(this.frm.tax_doclist.length) {
+			if(!wn.meta.get_docfield(this.frm.tax_doclist[0].doctype, "tax_amount_after_flat_discount", this.frm.doctype)) {
+				$.each(this.frm.tax_doclist, function(i, tax) {
+					delete tax["tax_amount_after_flat_discount"];
+				});
+			}
+		}
 	},
 	
 	calculate_outstanding_amount: function() {
diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
index 3659f6d..eafb3f3 100644
--- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
@@ -1,7 +1,6 @@
 # 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 unittest
 import webnotes
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index d48a7a6..9b8dc29 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -16,7 +16,10 @@
 		self.set_missing_values(for_validate=True)
 		self.validate_date_with_fiscal_year()
 		if self.meta.get_field("currency"):
+			self.flat_discount_applied = False
 			self.calculate_taxes_and_totals()
+			if hasattr(self, "apply_flat_discount"):
+				self.apply_flat_discount()
 			self.validate_value("grand_total", ">=", 0)
 			self.set_total_in_words()
 			
@@ -141,10 +144,14 @@
 		else:
 			validate_conversion_rate(self.doc.currency, self.doc.conversion_rate,
 				self.meta.get_label("conversion_rate"), self.doc.company)
-		
+
 		self.doc.conversion_rate = flt(self.doc.conversion_rate)
 		self.item_doclist = self.doclist.get({"parentfield": self.fname})
 		self.tax_doclist = self.doclist.get({"parentfield": self.other_fname})
+
+		# for buying
+		if not hasattr(self, "flat_discount_applied"):
+			self.flat_discount_applied = False
 		
 		self.calculate_item_values()
 		self.initialize_taxes()
@@ -163,11 +170,16 @@
 	def initialize_taxes(self):
 		for tax in self.tax_doclist:
 			tax.item_wise_tax_detail = {}
-			for fieldname in ["tax_amount", "total", 
-				"tax_amount_for_current_item", "grand_total_for_current_item",
-				"tax_fraction_for_current_item", "grand_total_fraction_for_current_item"]:
-					tax.fields[fieldname] = 0.0
-			
+			tax_fields = ["total", "tax_amount_after_flat_discount", 
+				"tax_amount_for_current_item", "grand_total_for_current_item", 
+				"tax_fraction_for_current_item", "grand_total_fraction_for_current_item"]
+
+			if not self.flat_discount_applied:
+				tax_fields.append("tax_amount")
+
+			for fieldname in tax_fields:
+				tax.fields[fieldname] = 0.0
+
 			self.validate_on_previous_row(tax)
 			self.validate_inclusive_tax(tax)
 			self.round_floats_in(tax)
@@ -215,39 +227,44 @@
 						"charge_type": tax.charge_type,
 					}, raise_exception=True)
 			elif tax.charge_type == "On Previous Row Amount" and \
-					not cint(self.tax_doclist[tax.row_id - 1].included_in_print_rate):
+					not cint(self.tax_doclist[cint(tax.row_id) - 1].included_in_print_rate):
 				# referred row should also be inclusive
 				_on_previous_row_error(tax.row_id)
 			elif tax.charge_type == "On Previous Row Total" and \
-					not all([cint(t.included_in_print_rate) for t in self.tax_doclist[:tax.row_id - 1]]):
+					not all([cint(t.included_in_print_rate) for t in self.tax_doclist[:cint(tax.row_id) - 1]]):
 				# all rows about the reffered tax should be inclusive
 				_on_previous_row_error("1 - %d" % (tax.row_id,))
 				
 	def calculate_taxes(self):
-		for item in self.item_doclist:
+		# maintain actual tax rate based on idx
+		actual_tax_dict = dict([[tax.idx, tax.rate] for tax in self.tax_doclist 
+			if tax.charge_type == "Actual"])
+
+		for n, item in enumerate(self.item_doclist):
 			item_tax_map = self._load_item_tax_rate(item.item_tax_rate)
 
 			for i, tax in enumerate(self.tax_doclist):
 				# tax_amount represents the amount of tax for the current step
 				current_tax_amount = self.get_current_tax_amount(item, tax, item_tax_map)
+
+				# Adjust divisional loss to the last item
+				if tax.charge_type == "Actual":
+					actual_tax_dict[tax.idx] -= current_tax_amount
+					if n == len(self.item_doclist) - 1:
+						current_tax_amount += actual_tax_dict[tax.idx]
 				
 				if hasattr(self, "set_item_tax_amount"):
 					self.set_item_tax_amount(item, tax, current_tax_amount)
 
-				# case when net total is 0 but there is an actual type charge
-				# in this case add the actual amount to tax.tax_amount
-				# and tax.grand_total_for_current_item for the first such iteration
-				if tax.charge_type=="Actual" and \
-						not (current_tax_amount or self.doc.net_total or tax.tax_amount):
-					zero_net_total_adjustment = flt(tax.rate, self.precision("tax_amount", tax))
-					current_tax_amount += zero_net_total_adjustment
-
 				# store tax_amount for current item as it will be used for
 				# charge type = 'On Previous Row Amount'
 				tax.tax_amount_for_current_item = current_tax_amount
 
 				# accumulate tax amount into tax.tax_amount
-				tax.tax_amount += current_tax_amount
+				if not self.flat_discount_applied:
+					tax.tax_amount += current_tax_amount
+
+				tax.tax_amount_after_flat_discount += current_tax_amount
 				
 				if tax.category:
 					# if just for valuation, do not add the tax amount in total
@@ -260,17 +277,36 @@
 				# 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, self.precision("total", tax))
-						
+					tax.grand_total_for_current_item = flt(item.amount + current_tax_amount,
+						self.precision("total", tax))
 				else:
 					tax.grand_total_for_current_item = \
-						flt(self.tax_doclist[i-1].grand_total_for_current_item +
+						flt(self.tax_doclist[i-1].grand_total_for_current_item + 
 							current_tax_amount, self.precision("total", tax))
 				
 				# in tax.total, accumulate grand total of each item
 				tax.total += tax.grand_total_for_current_item
-				
+
+				# set precision in the last item iteration
+				if n == len(self.item_doclist) - 1:
+					self.round_off_totals(tax)
+
+					# adjust flat discount loss in last tax iteration
+					if i == (len(self.tax_doclist) - 1) and self.flat_discount_applied:
+						self.adjust_flat_discount_loss(tax)
+
+	def round_off_totals(self, tax):
+		tax.total = flt(tax.total, self.precision("total", tax))
+		tax.tax_amount = flt(tax.tax_amount, self.precision("tax_amount", tax))
+		tax.tax_amount_after_flat_discount = flt(tax.tax_amount_after_flat_discount, 
+			self.precision("tax_amount", tax))
+
+	def adjust_flat_discount_loss(self, tax):
+		flat_discount_loss = self.doc.grand_total - self.doc.flat_discount - tax.total
+		tax.tax_amount_after_flat_discount = flt(tax.tax_amount_after_flat_discount + 
+			flat_discount_loss, self.precision("tax_amount", tax))
+		tax.total = flt(tax.total + flat_discount_loss, self.precision("total", tax))
+
 	def get_current_tax_amount(self, item, tax, item_tax_map):
 		tax_rate = self._get_tax_rate(tax, item_tax_map)
 		current_tax_amount = 0.0
@@ -289,9 +325,9 @@
 		elif tax.charge_type == "On Previous Row Total":
 			current_tax_amount = (tax_rate / 100.0) * \
 				self.tax_doclist[cint(tax.row_id) - 1].grand_total_for_current_item
-		
+
 		current_tax_amount = flt(current_tax_amount, self.precision("tax_amount", tax))
-		
+
 		# store tax breakup for each item
 		key = item.item_code or item.item_name
 		if tax.item_wise_tax_detail.get(key):
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index 40de926..be07670 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
 
@@ -161,6 +160,10 @@
 		if not self.meta.get_field("item_tax_amount", parentfield=self.fname):
 			for item in self.item_doclist:
 				del item.fields["item_tax_amount"]
+
+		if not self.meta.get_field("tax_amount_after_flat_discount", parentfield=self.other_fname):
+			for tax in self.tax_doclist:
+				del tax.fields["tax_amount_after_flat_discount"]
 				
 	def set_item_tax_amount(self, item, tax, current_tax_amount):
 		"""
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index f950f28..9e0fa1b 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -121,7 +121,7 @@
 						
 				cumulated_tax_fraction += tax.tax_fraction_for_current_item
 			
-			if cumulated_tax_fraction:
+			if cumulated_tax_fraction and not self.flat_discount_applied:
 				item.amount = flt((item.export_amount * self.doc.conversion_rate) /
 					(1 + cumulated_tax_fraction), self.precision("amount", item))
 					
@@ -158,22 +158,23 @@
 		return current_tax_fraction
 		
 	def calculate_item_values(self):
-		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))
-						
-			item.export_amount = flt(item.export_rate * item.qty,
-				self.precision("export_amount", item))
+		if not self.flat_discount_applied:
+			for item in self.item_doclist:
+				self.round_floats_in(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")
-			
+				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))
+
+				item.export_amount = flt(item.export_rate * item.qty,
+					self.precision("export_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")
+
 	def calculate_net_total(self):
 		self.doc.net_total = self.doc.net_total_export = 0.0
 
@@ -191,12 +192,40 @@
 			
 		self.doc.other_charges_total = flt(self.doc.grand_total - self.doc.net_total,
 			self.precision("other_charges_total"))
-		self.doc.other_charges_total_export = flt(self.doc.grand_total_export - self.doc.net_total_export,
-			self.precision("other_charges_total_export"))
+		self.doc.other_charges_total_export = flt(self.doc.grand_total_export - 
+			self.doc.net_total_export + flt(self.doc.flat_discount), self.precision("other_charges_total_export"))
 		
 		self.doc.rounded_total = _round(self.doc.grand_total)
 		self.doc.rounded_total_export = _round(self.doc.grand_total_export)
-		
+
+	def apply_flat_discount(self):
+		if self.doc.flat_discount:
+			total_amount_for_flat_discount = self.get_flat_discountable_amount()
+
+			if total_amount_for_flat_discount:
+				# calculate item amount after flat discount
+				for item in self.item_doclist:
+					distributed_amount = self.doc.flat_discount * item.amount / total_amount_for_flat_discount
+					item.amount = flt(item.amount - distributed_amount, self.precision("amount", item))
+
+				self.flat_discount_applied = True
+				self.calculate_taxes_and_totals()
+
+	def get_flat_discountable_amount(self):
+		actual_taxes_dict = {}
+
+		for tax in self.tax_doclist:
+			if tax.charge_type == "Actual":
+				actual_taxes_dict.setdefault(tax.idx, tax.tax_amount)
+			elif tax.row_id in actual_taxes_dict:
+				actual_tax_amount = flt(actual_taxes_dict.get(tax.row_id, 0)) * \
+					flt(tax.rate) / 100
+				actual_taxes_dict.setdefault(tax.idx, actual_tax_amount)
+
+		total_amount_for_flat_discount = flt(self.doc.grand_total - sum(actual_taxes_dict.values()), 
+			self.precision("grand_total"))
+		return total_amount_for_flat_discount
+
 	def calculate_outstanding_amount(self):
 		# NOTE: 
 		# write_off_amount is only for POS Invoice
diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py
index 350ca37..3f7cf5b 100644
--- a/erpnext/patches/patch_list.py
+++ b/erpnext/patches/patch_list.py
@@ -173,18 +173,18 @@
 	"patches.july_2013.p05_custom_doctypes_in_list_view",
 	"patches.july_2013.p06_same_sales_rate",
 	"patches.july_2013.p07_repost_billed_amt_in_sales_cycle",
-	"execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Classic') # 2013-07-22",
-	"execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Modern') # 2013-07-22",
-	"execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Spartan') # 2013-07-22",
-	"execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Classic') # 2013-07-22",
-	"execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Modern') # 2013-07-22",
-	"execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Spartan') # 2013-07-22",
-	"execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Classic') # 2013-07-22",
-	"execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Modern') # 2013-07-22",
-	"execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Spartan') # 2013-07-22",
-	"execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Classic') # 2013-07-22",
-	"execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Modern') # 2013-07-22",
-	"execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Spartan') # 2013-07-22",
+	"execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Classic') # 2013-12-26",
+	"execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Modern') # 2013-12-26",
+	"execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Spartan') # 2013-12-26",
+	"execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Classic') # 2013-12-26",
+	"execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Modern') # 2013-12-26",
+	"execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Spartan') # 2013-12-26",
+	"execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Classic') # 2013-12-26",
+	"execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Modern') # 2013-12-26",
+	"execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Spartan') # 2013-12-26",
+	"execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Classic') # 2013-12-26",
+	"execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Modern') # 2013-12-26",
+	"execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Spartan') # 2013-12-26",
 	"patches.july_2013.p08_custom_print_format_net_total_export",
 	"patches.july_2013.p09_remove_website_pyc",
 	"patches.july_2013.p10_change_partner_user_to_website_user",
@@ -263,4 +263,9 @@
 	"execute:webnotes.delete_doc('DocType', 'Warehouse Type')",
 	"patches.1312.p01_delete_old_stock_reports",
 	"patches.1312.p02_update_item_details_in_item_price",
+	"execute:webnotes.reload_doc('accounts', 'Print Format', 'POS Invoice') # 2013-12-26",
+	"execute:webnotes.reload_doc('accounts', 'doctype', 'sales_invoice') # 2013-12-26",
+	"execute:webnotes.reload_doc('selling', 'doctype', 'sales_order') # 2013-12-26",
+	"execute:webnotes.reload_doc('selling', 'doctype', 'quotation') # 2013-12-26",
+	"execute:webnotes.reload_doc('stock', 'doctype', 'delivery_note') # 2013-12-26",
 ]
\ No newline at end of file
diff --git a/erpnext/public/js/transaction.js b/erpnext/public/js/transaction.js
index 5b48820..e716c27 100644
--- a/erpnext/public/js/transaction.js
+++ b/erpnext/public/js/transaction.js
@@ -146,7 +146,9 @@
 	},
 	
 	validate: function() {
+		this.flat_discount_applied = false;
 		this.calculate_taxes_and_totals();
+		this.apply_flat_discount && this.apply_flat_discount();
 	},
 	
 	set_default_values: function() {
@@ -514,7 +516,7 @@
 		this.validate_conversion_rate();
 		this.frm.item_doclist = this.get_item_doclist();
 		this.frm.tax_doclist = this.get_tax_doclist();
-		
+
 		this.calculate_item_values();
 		this.initialize_taxes();
 		this.determine_exclusive_rate && this.determine_exclusive_rate();
@@ -528,12 +530,17 @@
 	
 	initialize_taxes: function() {
 		var me = this;
+
 		$.each(this.frm.tax_doclist, function(i, tax) {
 			tax.item_wise_tax_detail = {};
-			$.each(["tax_amount", "total",
+			tax_fields = ["total", "tax_amount_after_flat_discount", 
 				"tax_amount_for_current_item", "grand_total_for_current_item",
-				"tax_fraction_for_current_item", "grand_total_fraction_for_current_item"],
-				function(i, fieldname) { tax[fieldname] = 0.0 });
+				"tax_fraction_for_current_item", "grand_total_fraction_for_current_item"]
+
+			if (!me.flat_discount_applied)
+				tax_fields.push("tax_amount");
+
+			$.each(tax_fields, function(i, fieldname) { tax[fieldname] = 0.0 });
 			
 			me.validate_on_previous_row(tax);
 			me.validate_inclusive_tax(tax);
@@ -543,31 +550,41 @@
 	
 	calculate_taxes: function() {
 		var me = this;
+		var actual_tax_dict = {};
 		
+		// maintain actual tax rate based on idx
+		$.each(this.frm.tax_doclist, function(i, tax) {
+			if (tax.charge_type == "Actual") {
+				actual_tax_dict[tax.idx] = flt(tax.rate);
+			}
+		});
+
 		$.each(this.frm.item_doclist, function(n, item) {
 			var item_tax_map = me._load_item_tax_rate(item.item_tax_rate);
-			
+
 			$.each(me.frm.tax_doclist, function(i, tax) {
 				// tax_amount represents the amount of tax for the current step
 				var current_tax_amount = me.get_current_tax_amount(item, tax, item_tax_map);
 
-				me.set_item_tax_amount && me.set_item_tax_amount(item, tax, current_tax_amount);
-				
-				// case when net total is 0 but there is an actual type charge
-				// in this case add the actual amount to tax.tax_amount
-				// and tax.grand_total_for_current_item for the first such iteration
-				if(tax.charge_type == "Actual" && 
-					!(current_tax_amount || me.frm.doc.net_total || tax.tax_amount)) {
-						var zero_net_total_adjustment = flt(tax.rate, precision("tax_amount", tax));
-						current_tax_amount += zero_net_total_adjustment;
+				// Adjust divisional loss to the last item
+				if (tax.charge_type == "Actual") {
+					actual_tax_dict[tax.idx] -= current_tax_amount;
+					if (n == me.frm.item_doclist.length - 1) {
+						current_tax_amount += actual_tax_dict[tax.idx]
 					}
-				
+				}
+
+				me.set_item_tax_amount && me.set_item_tax_amount(item, tax, current_tax_amount);
+
 				// store tax_amount for current item as it will be used for
 				// charge type = 'On Previous Row Amount'
 				tax.tax_amount_for_current_item = current_tax_amount;
 				
 				// accumulate tax amount into tax.tax_amount
-				tax.tax_amount += current_tax_amount;
+				if (!me.flat_discount_applied)
+					tax.tax_amount += current_tax_amount;
+
+				tax.tax_amount_after_flat_discount += current_tax_amount;
 				
 				// for buying
 				if(tax.category) {
@@ -592,9 +609,32 @@
 				
 				// in tax.total, accumulate grand total for each item
 				tax.total += tax.grand_total_for_current_item;
+
+				// set precision in the last item iteration
+				if (n == me.frm.item_doclist.length - 1) {
+					me.round_off_totals(tax);
+
+					// adjust flat discount loss in last tax iteration
+					if ((i == me.frm.tax_doclist.length - 1) && me.flat_discount_applied)
+						me.adjust_flat_discount_loss(tax);
+				}
 			});
 		});
 	},
+
+	round_off_totals: function(tax) {
+		tax.total = flt(tax.total, precision("total", tax));
+		tax.tax_amount = flt(tax.tax_amount, precision("tax_amount", tax));
+		tax.tax_amount_after_flat_discount = flt(tax.tax_amount_after_flat_discount, 
+			precision("tax_amount", tax));
+	},
+
+	adjust_flat_discount_loss: function(tax) {
+		var flat_discount_loss = this.frm.doc.grand_total - this.frm.doc.flat_discount - tax.total;
+		tax.tax_amount_after_flat_discount = flt(tax.tax_amount_after_flat_discount + 
+			flat_discount_loss, precision("tax_amount", tax));
+		tax.total = flt(tax.total + flat_discount_loss, precision("total", tax));
+	},
 	
 	get_current_tax_amount: function(item, tax, item_tax_map) {
 		var tax_rate = this._get_tax_rate(tax, item_tax_map);
@@ -617,9 +657,8 @@
 		} else if(tax.charge_type == "On Previous Row Total") {
 			current_tax_amount = (tax_rate / 100.0) *
 				this.frm.tax_doclist[cint(tax.row_id) - 1].grand_total_for_current_item;
-			
 		}
-		
+
 		current_tax_amount = flt(current_tax_amount, precision("tax_amount", tax));
 		
 		// store tax breakup for each item
diff --git a/erpnext/selling/Print Format/Quotation Classic/Quotation Classic.txt b/erpnext/selling/Print Format/Quotation Classic/Quotation Classic.txt
index e7588c4..dc84529 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-08-07 19:55:11", 
+  "modified": "2013-12-26 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\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>\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'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.flat_discount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Flat Discount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.flat_discount, 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 20d380d..8b4b0d8 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-08-07 20:12:11", 
+  "modified": "2013-12-26 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\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>\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: \"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.flat_discount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Flat Discount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.flat_discount, 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 c5b4cb9..c4a1362 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-08-07 19:53:01", 
+  "modified": "2013-12-26 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\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>\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'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.flat_discount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Flat Discount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.flat_discount, 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 7f2748a..1d36ee6 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-08-07 19:45:49", 
+  "modified": "2013-12-26 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\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>\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'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.flat_discount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Flat Discount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.flat_discount, 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 e4102b2..157c8eb 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-08-07 20:12:23", 
+  "modified": "2013-12-26 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\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>\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: \"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.flat_discount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Flat Discount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.flat_discount, 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 105b65b..8dce87e 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-08-07 19:45:59", 
+  "modified": "2013-12-26 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\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>\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'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.flat_discount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Flat Discount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.flat_discount, 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/quotation/quotation.txt b/erpnext/selling/doctype/quotation/quotation.txt
index 3657e4a..5453cb4 100644
--- a/erpnext/selling/doctype/quotation/quotation.txt
+++ b/erpnext/selling/doctype/quotation/quotation.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-05-24 19:29:08", 
   "docstatus": 0, 
-  "modified": "2013-12-20 19:24:25", 
+  "modified": "2013-12-26 17:54:55", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -462,6 +462,13 @@
  }, 
  {
   "doctype": "DocField", 
+  "fieldname": "flat_discount", 
+  "fieldtype": "Currency", 
+  "label": "Flat Discount", 
+  "options": "Company:company:default_currency"
+ }, 
+ {
+  "doctype": "DocField", 
   "fieldname": "totals", 
   "fieldtype": "Section Break", 
   "label": "Totals", 
diff --git a/erpnext/selling/doctype/sales_order/sales_order.txt b/erpnext/selling/doctype/sales_order/sales_order.txt
index f9582fb..2469a46 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.txt
+++ b/erpnext/selling/doctype/sales_order/sales_order.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-06-18 12:39:59", 
   "docstatus": 0, 
-  "modified": "2013-12-20 19:24:32", 
+  "modified": "2013-12-26 17:55:43", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -482,6 +482,13 @@
  }, 
  {
   "doctype": "DocField", 
+  "fieldname": "flat_discount", 
+  "fieldtype": "Currency", 
+  "label": "Flat Discount", 
+  "options": "Company:company:default_currency"
+ }, 
+ {
+  "doctype": "DocField", 
   "fieldname": "totals", 
   "fieldtype": "Section Break", 
   "label": "Totals", 
diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js
index 1c8aed3..4562c2b 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -225,6 +225,12 @@
 		
 		this.calculate_taxes_and_totals();
 	},
+
+	flat_discount: function() {
+		this.flat_discount_applied = false;
+		this.calculate_taxes_and_totals();
+		this.apply_flat_discount();
+	},
 	
 	commission_rate: function() {
 		this.calculate_commission();
@@ -310,15 +316,17 @@
 	
 	calculate_item_values: function() {
 		var me = this;
-		$.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));
-			
-			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");
-		});
 		
+		if (!this.flat_discount_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));
+
+				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");
+			});
+		}
 	},
 	
 	determine_exclusive_rate: function() {
@@ -341,11 +349,11 @@
 				cumulated_tax_fraction += tax.tax_fraction_for_current_item;
 			});
 			
-			if(cumulated_tax_fraction) {
+			if(cumulated_tax_fraction && !me.flat_discount_applied) {
 				item.amount = flt(
 					(item.export_amount * me.frm.doc.conversion_rate) / (1 + cumulated_tax_fraction),
 					precision("amount", item));
-					
+
 				item.basic_rate = flt(item.amount / item.qty, precision("basic_rate", item));
 				
 				if(item.adj_rate == 100) {
@@ -385,18 +393,20 @@
 	
 	calculate_net_total: function() {
 		var me = this;
-
 		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;
 		});
-		
+
 		wn.model.round_floats_in(this.frm.doc, ["net_total", "net_total_export"]);
 	},
 	
 	calculate_totals: function() {
+		var me = this;
 		var tax_count = this.frm.tax_doclist.length;
+
 		this.frm.doc.grand_total = flt(
 			tax_count ? this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total,
 			precision("grand_total"));
@@ -405,13 +415,54 @@
 			
 		this.frm.doc.other_charges_total = flt(this.frm.doc.grand_total - this.frm.doc.net_total,
 			precision("other_charges_total"));
-		this.frm.doc.other_charges_total_export = flt(
-			this.frm.doc.grand_total_export - this.frm.doc.net_total_export,
+		this.frm.doc.other_charges_total_export = flt(this.frm.doc.grand_total_export - 
+			this.frm.doc.net_total_export + this.frm.doc.flat_discount,
 			precision("other_charges_total_export"));
 			
 		this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total);
 		this.frm.doc.rounded_total_export = Math.round(this.frm.doc.grand_total_export);
 	},
+
+	apply_flat_discount: function() {
+		var me = this;
+		var distributed_amount = 0.0;
+
+		if (this.frm.doc.flat_discount) {
+			var total_amount_for_flat_discount = this.get_flat_discountable_amount();
+			// calculate item amount after flat discount
+			$.each(this.frm.item_doclist, function(i, item) {
+				distributed_amount = me.frm.doc.flat_discount * item.amount / total_amount_for_flat_discount;
+				item.amount = flt(item.amount - distributed_amount, precision("amount", item));
+			});
+
+			this.flat_discount_applied = true;
+			this.calculate_taxes_and_totals();
+		}
+	},
+
+	get_flat_discountable_amount: function() {
+		var me = this;
+		var total_actual_tax = 0.0;
+		var actual_taxes_dict = {};
+
+		$.each(this.frm.tax_doclist, function(i, tax) {
+			if (tax.charge_type == "Actual")
+				actual_taxes_dict[tax.idx] = tax.tax_amount;
+			else if (actual_taxes_dict[tax.row_id] !== null) {
+				actual_tax_amount = flt(actual_taxes_dict[tax.row_id]) * flt(tax.rate) / 100;
+				actual_taxes_dict[tax.idx] = actual_tax_amount;
+			}
+		});
+
+		$.each(actual_taxes_dict, function(key, value) {
+			if (value)
+				total_actual_tax += value;
+		});
+
+		total_amount_for_flat_discount = flt(this.frm.doc.grand_total - total_actual_tax, 
+			precision("grand_total"));
+		return total_amount_for_flat_discount;
+	},
 	
 	calculate_outstanding_amount: function() {
 		// NOTE: 
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 163dffa..d16b67f 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-08-07 19:44:55", 
+  "modified": "2013-12-26 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\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>\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'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.flat_discount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Flat Discount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.flat_discount, 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 f4323a9..9965634 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-08-07 20:12:29", 
+  "modified": "2013-12-26 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\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>\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: \"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.flat_discount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Flat Discount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.flat_discount, 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 03fbef5..2623d76 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-08-07 19:44:37", 
+  "modified": "2013-12-26 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\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>\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'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.flat_discount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Flat Discount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.flat_discount, 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.txt b/erpnext/stock/doctype/delivery_note/delivery_note.txt
index 36615a2..c328874 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.txt
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-05-24 19:29:09", 
   "docstatus": 0, 
-  "modified": "2013-12-20 19:24:02", 
+  "modified": "2013-12-26 18:01:33", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -468,7 +468,7 @@
   "fieldname": "other_charges_total_export", 
   "fieldtype": "Currency", 
   "label": "Taxes and Charges Total", 
-  "options": "company", 
+  "options": "Company:company:default_currency", 
   "print_hide": 1, 
   "read_only": 1
  }, 
@@ -492,6 +492,13 @@
  }, 
  {
   "doctype": "DocField", 
+  "fieldname": "flat_discount", 
+  "fieldtype": "Currency", 
+  "label": "Flat Discount", 
+  "options": "Company:company:default_currency"
+ }, 
+ {
+  "doctype": "DocField", 
   "fieldname": "totals", 
   "fieldtype": "Section Break", 
   "label": "Totals", 
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index 1ee5e04..2384536 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -97,7 +97,8 @@
 cur_frm.fields_dict['item_tax'].grid.get_field("tax_type").get_query = function(doc, cdt, cdn) {
 	return{
 		filters:[
-			['Account', 'account_type', 'in', 'Tax, Chargeable'],
+			['Account', 'account_type', 'in',
+				'Tax, Chargeable, Income Account, Expense Account'],
 			['Account', 'docstatus', '!=', 2]
 		]
 	}
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index f9763cd..a3ee5a3 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -151,8 +151,8 @@
 			if d.tax_type:
 				account_type = webnotes.conn.get_value("Account", d.tax_type, "account_type")
 				
-				if account_type not in ['Tax', 'Chargeable']:
-					msgprint("'%s' is not Tax / Chargeable Account" % d.tax_type, raise_exception=1)
+				if account_type not in ['Tax', 'Chargeable', 'Income Account', 'Expense Account']:
+					msgprint("'%s' is not Tax / Chargeable / Income / Expense Account" % d.tax_type, raise_exception=1)
 				else:
 					if d.tax_type in check_list:
 						msgprint("Rate is entered twice for: '%s'" % d.tax_type, raise_exception=1)