Skip to content

Instantly share code, notes, and snippets.

@lxthien
Created October 14, 2013 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lxthien/d9354689723d2f419b2c to your computer and use it in GitHub Desktop.
Save lxthien/d9354689723d2f419b2c to your computer and use it in GitHub Desktop.
si_std = {
print_item_table: function() {
var table = print_table(
'Journal Voucher',
doc.name,
'entries',
'Journal Voucher Detail',
['SR', 'account', 'cost_center', 'debit', 'credit', 'balance'],
['Sr', 'Account', 'Cost Center', 'Debit', 'Credit', 'Account Balances'],
['5%', '29%', '20%', '13%', '13%', '20%']
);
// This code takes care of page breaks
if(table.appendChild) {
out = table.innerHTML;
}else {
out = '';
for(var i=0; i < (table.length-1); i++) {
out += table[i].innerHTML +
'<div style = "page-break-after: always;" \
class = "page_break"></div>\
<div class="page-settings"></div>';
}
out += table[table.length-1].innerHTML;
}
return out;
},
print_other_charges: function(parent) {
var oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');
var rows = '<table width=100%>\n';
for(var i=0; i<9; i++) {
if(!oc[i].included_in_print_rate) {
rows +=
'<tr>\n' +
'\t<td>thu</td>\n' +
'\t<td></td>\n' +
'\t<td width=38%>thu</td>\n' +
'</tr>\n';
}
}
return rows + '</table>\n';
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment