discount calculation and in print view

This commit is contained in:
Nabin Hait
2015-02-23 01:06:00 +05:30
parent 2b019ed430
commit de9c8a9028
10 changed files with 1241 additions and 1212 deletions

View File

@@ -93,11 +93,11 @@ 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){
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;">' + format_currency(val, doc.currency) + '</td>'
+ '</tr>';
+ '<td style="width:50%;text-align:right;">' + (is_negative ? '- ' : '')
+ format_currency(val, doc.currency) + '</td></tr>';
}
function convert_rate(val) {
@@ -125,6 +125,10 @@ cur_frm.pformat.taxes= function(doc){
out += make_row('Net Total', doc.print_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++) {
@@ -133,9 +137,9 @@ cur_frm.pformat.taxes= function(doc){
}
}
// Discount Amount
if(!print_hide('discount_amount') && doc.discount_amount)
out += make_row('Discount Amount', doc.discount_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'))