|
|
|
"html": "<html>\n<head>\n<!--Other charges function-->\n<script>\n var make_row = function(title,val,bold){\n var bstart = '<b>'; var bend = '</b>';\n return '<tr><td style=\"width:50%\">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'\n +'<td style=\"width:20%;text-align:right\">'+doc.currency+'</td>'\n +'<td style=\"width:30%;text-align:right\">'+(val?val:'0.00')+'</td>'\n +'</tr>'\n }\n\n function get_other_charges(){\n var out ='';\n out += '<div><table class=\"noborder\" style=\"width:100%\">';\n out += make_row('Total Amount',fmt_money(convert_rate(doc.total_amount)),1)\n +make_row('Grand Total',fmt_money(convert_rate(doc.grand_total)),1);\n out += '</table></div>';\n return out;\n }\n\n function get_buying_costs(){\n var out ='';\n if(doc.buying_cost_transport || doc.buying_cost_taxes || doc.buying_cost_other){\n out += '<div><table class=\"noborder\" style=\"width:100%\">'\n + '<tr><td style=\"width:100%\"><b>'+'Buying Cost Details'+'</b></td></tr>';\n if(doc.buying_cost_transport){ out += make_row('Transport Cost',fmt_money(convert_rate(doc.buying_cost_transport)),0)}\n if(doc.buying_cost_taxes){ out += make_row('Taxes',fmt_money(convert_rate(doc.buying_cost_taxes)),0)}\n if(doc.buying_cost_other){ out += make_row('Other Cost',fmt_money(convert_rate(doc.buying_cost_other)),0)}\n out += '</table></div>';\n }\n return out;\n }\n\nfunction get_letter_head() {\n\t// add letter head\n\tvar cp = locals['Control Panel']['Control Panel'];\n\tif(doc.letter_head)\n\t\tvar lh= cstr(_p.letter_heads[doc.letter_head]);\n\telse if(cp.letter_head)\n\t\tvar lh= cp.letter_head;\n\telse \n\t\tvar lh= '';\n\t\t\n\treturn lh;\n}\n\n \n function convert_rate(val){\n var new_val = flt(val)/flt(doc.conversion_rate);\n return new_val;\n }\n \n function get_transport_details(){\n var out = '';\n if(doc.transporter_name || doc.lr_no || doc.lr_date){\n out += '<div><table class=\"noborder\" style=\"width:40%\">'\n +'<tr><td style=\"width:80%\"><b>' + 'Transporter Details'+'</b></td><td style=\"width:20%\"></td></tr>'\n\n if(doc.transporter_name){ out += '<tr><td style=\"width:40%\">' + 'Transporter Name'+'</td><td style=\"width:60%\">'+doc.transporter_name+'</td></tr>'}\n if(doc.lr_no){ out += '<tr><td style=\"width:40%\">' + 'LR No'+'</td><td style=\"width:60%\">'+doc.lr_no+'</td></tr>'}\n if(doc.lr_date){ out += '<tr><td style=\"width:40%\">' + 'LR Date'+'</td><td style=\"width:60%\">'+doc.lr_date+'</td></tr>'}\n out += '</table></div>'\n }\n return out;\n }\n\n</script>\n</head>\n<body>\n<div style=\"border:1px solid black;padding:15px\">\n<!--header-->\n<div><script>get_letter_head()</script></div>\n<div style=\"border-bottom: 1px solid; padding-bottom: 5px;\">\n <div><br><b>Purchase Receipt: <script>doc.name</script></b></div>\n <div>Date: <script>date.str_to_user(doc.transaction_date)</script></div>\n</div>\n\n<div style=\"padding-top:15px\">\n<div><script>doc.supplier</script></div>\n<div><br><script>replace_newlines(doc.address_display)</script></div>\n</div>\n\n<div>\n<br>\n <script>\n var t = print_table('Purchase Receipt', doc.name, 'purchase_receipt_details', 'Purchase Receipt Item', ['SR', 'item_code','description','received_qty','qty','rejected_qty','po_rate','amount','billed_qty'], ['Sr', 'Item Code', 'Description','Received Quantity','Accepted Qty','Rejected Qty','Rate','Amount','Billed Qty'], ['4%','12%', '24%', '10%','10%','10%','10%','10%','10%'])\n if(t.appendChild) {\n // single\n out = t.innerHTML;\n } \n else {//multiple\n out = ''\n for(var i=0;i<t.length;i++) {\n if(i!=t.length-1){\n out += '<div style:\"padding-top:5px;\"></div>' + t[i].innerHTML +'<div style=\"page-break-after:always\"></div>';\n }\n else out += '<div style:\"padding-top:5px;\"></div>' + t[i].innerHTML;\n }\n }\n out;\n </script>\n\n</div>\n\n<!--Other charges table-->\n<div>\n<table styl
|