fix(minor): fix dynamically changing grid properties
This commit is contained in:
@@ -276,74 +276,3 @@ erpnext.taxes.set_conditional_mandatory_rate_or_amount = function(grid_row) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// For customizing print
|
||||
cur_frm.pformat.total = function(doc) { return ''; }
|
||||
cur_frm.pformat.discount_amount = function(doc) { return ''; }
|
||||
cur_frm.pformat.grand_total = function(doc) { return ''; }
|
||||
cur_frm.pformat.rounded_total = function(doc) { return ''; }
|
||||
cur_frm.pformat.in_words = function(doc) { return ''; }
|
||||
|
||||
cur_frm.pformat.taxes= function(doc){
|
||||
//function to make row of table
|
||||
var make_row = function(title, val, bold, is_negative) {
|
||||
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;">' + (is_negative ? '- ' : '')
|
||||
+ format_currency(val, doc.currency) + '</td></tr>';
|
||||
}
|
||||
|
||||
function print_hide(fieldname) {
|
||||
var doc_field = frappe.meta.get_docfield(doc.doctype, fieldname, doc.name);
|
||||
return doc_field.print_hide;
|
||||
}
|
||||
|
||||
out ='';
|
||||
if (!doc.print_without_amount) {
|
||||
var cl = doc.taxes || [];
|
||||
|
||||
// outer table
|
||||
var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 60%"></td><td>';
|
||||
|
||||
// main table
|
||||
|
||||
out +='<table class="noborder" style="width:100%">';
|
||||
|
||||
if(!print_hide('total')) {
|
||||
out += make_row('Total', doc.total, 1);
|
||||
}
|
||||
|
||||
// Discount Amount on net total
|
||||
if(!print_hide('discount_amount') && doc.apply_discount_on == "Net Total" && doc.discount_amount)
|
||||
out += make_row('Discount Amount', doc.discount_amount, 0, 1);
|
||||
|
||||
// add rows
|
||||
if(cl.length){
|
||||
for(var i=0;i<cl.length;i++) {
|
||||
if(cl[i].tax_amount!=0 && !cl[i].included_in_print_rate)
|
||||
out += make_row(cl[i].description, cl[i].tax_amount, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Discount Amount on grand total
|
||||
if(!print_hide('discount_amount') && doc.apply_discount_on == "Grand Total" && doc.discount_amount)
|
||||
out += make_row('Discount Amount', doc.discount_amount, 0, 1);
|
||||
|
||||
// grand total
|
||||
if(!print_hide('grand_total'))
|
||||
out += make_row('Grand Total', doc.grand_total, 1);
|
||||
|
||||
if(!print_hide('rounded_total'))
|
||||
out += make_row('Rounded Total', doc.rounded_total, 1);
|
||||
|
||||
if(doc.in_words && !print_hide('in_words')) {
|
||||
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 + '</td></tr>';
|
||||
}
|
||||
out += '</table></td></tr></table></div>';
|
||||
}
|
||||
return out;
|
||||
}
|
||||
Reference in New Issue
Block a user