Taxes and charges category issue fixed
This commit is contained in:
parent
cd2f40ffef
commit
9462ce9aef
@ -182,7 +182,7 @@ class DocType:
|
|||||||
if le_map['table_field']:
|
if le_map['table_field']:
|
||||||
for d in getlist(doclist,le_map['table_field']):
|
for d in getlist(doclist,le_map['table_field']):
|
||||||
# purchase_tax_details is the table of other charges in purchase cycle
|
# purchase_tax_details is the table of other charges in purchase cycle
|
||||||
if le_map['table_field'] != 'purchase_tax_details' or (le_map['table_field'] == 'purchase_tax_details' and d.fields.get('category') != 'For Valuation'):
|
if le_map['table_field'] != 'purchase_tax_details' or (le_map['table_field'] == 'purchase_tax_details' and d.fields.get('category') != 'Valuation'):
|
||||||
self.make_single_entry(doc,d,le_map,cancel, merge_entries)
|
self.make_single_entry(doc,d,le_map,cancel, merge_entries)
|
||||||
else:
|
else:
|
||||||
self.make_single_entry(None,doc,le_map,cancel, merge_entries)
|
self.make_single_entry(None,doc,le_map,cancel, merge_entries)
|
||||||
|
@ -37,7 +37,7 @@ tax_acc = [c[0] for c in sql("""select distinct account_head
|
|||||||
from `tabPurchase Taxes and Charges`
|
from `tabPurchase Taxes and Charges`
|
||||||
where parenttype = 'Purchase Invoice'
|
where parenttype = 'Purchase Invoice'
|
||||||
and add_deduct_tax = 'Add'
|
and add_deduct_tax = 'Add'
|
||||||
and category in ('For Total', 'For Both')
|
and category in ('Total', 'Valuation and Total')
|
||||||
and docstatus=1
|
and docstatus=1
|
||||||
order by account_head asc""")]
|
order by account_head asc""")]
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ for r in res:
|
|||||||
where parent = '%s'
|
where parent = '%s'
|
||||||
and parenttype = 'Purchase Invoice'
|
and parenttype = 'Purchase Invoice'
|
||||||
and add_deduct_tax = 'Add'
|
and add_deduct_tax = 'Add'
|
||||||
and category in ('For Total', 'For Both')
|
and category in ('Total', 'Valuation and Total')
|
||||||
group by account_head
|
group by account_head
|
||||||
""" %(r[col_idx['ID']],))
|
""" %(r[col_idx['ID']],))
|
||||||
|
|
||||||
|
@ -498,7 +498,7 @@ cur_frm.cscript.calc_other_charges = function(doc , tname , fname , other_fname)
|
|||||||
tax[t].tax_amount += flt(tax_amount);
|
tax[t].tax_amount += flt(tax_amount);
|
||||||
var total_amount = flt(tax[t].tax_amount);
|
var total_amount = flt(tax[t].tax_amount);
|
||||||
total_tax_amount = flt(tax[t].total_tax_amount) + flt(total_amount);
|
total_tax_amount = flt(tax[t].total_tax_amount) + flt(total_amount);
|
||||||
if(tax[t].category != "For Valuation"){
|
if(tax[t].category != "Valuation"){
|
||||||
set_multiple('Purchase Taxes and Charges', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'amount':roundNumber(total_amount, 2), 'total':roundNumber(flt(total)+flt(tax[t].tax_amount), 2)}, other_fname);
|
set_multiple('Purchase Taxes and Charges', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'amount':roundNumber(total_amount, 2), 'total':roundNumber(flt(total)+flt(tax[t].tax_amount), 2)}, other_fname);
|
||||||
prev_total += flt(tax[t].total_amount);
|
prev_total += flt(tax[t].total_amount);
|
||||||
total += flt(tax[t].tax_amount); // for adding total to previous amount
|
total += flt(tax[t].tax_amount); // for adding total to previous amount
|
||||||
@ -514,7 +514,7 @@ cur_frm.cscript.calc_other_charges = function(doc , tname , fname , other_fname)
|
|||||||
else
|
else
|
||||||
$td(otc,i+1,t+1).innerHTML = '('+fmt_money(rate) + '%) ' +fmt_money(tax[t].total_amount);
|
$td(otc,i+1,t+1).innerHTML = '('+fmt_money(rate) + '%) ' +fmt_money(tax[t].total_amount);
|
||||||
|
|
||||||
if (tax[t].category != "For Total"){
|
if (tax[t].category != "Total"){
|
||||||
item_tax += tax[t].total_amount;
|
item_tax += tax[t].total_amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -526,7 +526,7 @@ cur_frm.cscript.calc_other_charges = function(doc , tname , fname , other_fname)
|
|||||||
tax[t].tax_amount += flt(tax_amount);
|
tax[t].tax_amount += flt(tax_amount);
|
||||||
var total_amount = flt(tax[t].tax_amount);
|
var total_amount = flt(tax[t].tax_amount);
|
||||||
total_tax_amount = flt(tax[t].total_tax_amount) - flt(total_amount);
|
total_tax_amount = flt(tax[t].total_tax_amount) - flt(total_amount);
|
||||||
if(tax[t].category != "For Valuation"){
|
if(tax[t].category != "Valuation"){
|
||||||
set_multiple('Purchase Taxes and Charges', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'tax_amount':roundNumber(total_amount, 2), 'total':roundNumber(flt(total)-flt(tax[t].tax_amount), 2)}, other_fname);
|
set_multiple('Purchase Taxes and Charges', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'tax_amount':roundNumber(total_amount, 2), 'total':roundNumber(flt(total)-flt(tax[t].tax_amount), 2)}, other_fname);
|
||||||
prev_total -= flt(tax[t].total_amount);
|
prev_total -= flt(tax[t].total_amount);
|
||||||
total -= flt(tax[t].tax_amount); // for adding total to previous amount
|
total -= flt(tax[t].tax_amount); // for adding total to previous amount
|
||||||
@ -542,7 +542,7 @@ cur_frm.cscript.calc_other_charges = function(doc , tname , fname , other_fname)
|
|||||||
else
|
else
|
||||||
$td(otc,i+1,t+1).innerHTML = '('+fmt_money(rate) + '%) ' +fmt_money(tax[t].total_amount);
|
$td(otc,i+1,t+1).innerHTML = '('+fmt_money(rate) + '%) ' +fmt_money(tax[t].total_amount);
|
||||||
|
|
||||||
if (tax[t].category != "For Total"){
|
if (tax[t].category != "Total"){
|
||||||
item_tax -= tax[t].total_amount;
|
item_tax -= tax[t].total_amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -608,7 +608,7 @@ cur_frm.cscript.calc_doc_values = function(doc, tname, fname, other_fname) {
|
|||||||
}
|
}
|
||||||
var d = getchildren('Purchase Taxes and Charges', doc.name, other_fname,doc.doctype);
|
var d = getchildren('Purchase Taxes and Charges', doc.name, other_fname,doc.doctype);
|
||||||
for(var j = 0; j<d.length; j++){
|
for(var j = 0; j<d.length; j++){
|
||||||
if(d[j].category != 'For Valuation'){
|
if(d[j].category != 'Valuation'){
|
||||||
|
|
||||||
if(d[j].add_deduct_tax == 'Add'){
|
if(d[j].add_deduct_tax == 'Add'){
|
||||||
other_charges_added += flt(d[j].tax_amount);
|
other_charges_added += flt(d[j].tax_amount);
|
||||||
|
@ -99,10 +99,10 @@ class DocType:
|
|||||||
self.prwise_cost[pr] = self.prwise_cost.get(pr, 0) + amt
|
self.prwise_cost[pr] = self.prwise_cost.get(pr, 0) + amt
|
||||||
cumulative_grand_total += amt
|
cumulative_grand_total += amt
|
||||||
|
|
||||||
pr_oc_row = sql("select name from `tabPurchase Taxes and Charges` where parent = %s and category = 'For Valuation' and add_deduct_tax = 'Add' and charge_type = 'Actual' and account_head = %s",(pr, lc.account_head))
|
pr_oc_row = sql("select name from `tabPurchase Taxes and Charges` where parent = %s and category = 'Valuation' and add_deduct_tax = 'Add' and charge_type = 'Actual' and account_head = %s",(pr, lc.account_head))
|
||||||
if not pr_oc_row: # add if not exists
|
if not pr_oc_row: # add if not exists
|
||||||
ch = addchild(pr_obj.doc, 'purchase_tax_details', 'Purchase Taxes and Charges', 1)
|
ch = addchild(pr_obj.doc, 'purchase_tax_details', 'Purchase Taxes and Charges', 1)
|
||||||
ch.category = 'For Valuation'
|
ch.category = 'Valuation'
|
||||||
ch.add_deduct_tax = 'Add'
|
ch.add_deduct_tax = 'Add'
|
||||||
ch.charge_type = 'Actual'
|
ch.charge_type = 'Actual'
|
||||||
ch.description = lc.description
|
ch.description = lc.description
|
||||||
@ -201,7 +201,7 @@ class DocType:
|
|||||||
total_amount = flt(ocd[oc].tax_amount)
|
total_amount = flt(ocd[oc].tax_amount)
|
||||||
total_tax_amount = flt(ocd[oc].total_tax_amount) + (add_ded * flt(total_amount))
|
total_tax_amount = flt(ocd[oc].total_tax_amount) + (add_ded * flt(total_amount))
|
||||||
|
|
||||||
if ocd[oc].category != "For Valuation":
|
if ocd[oc].category != "Valuation":
|
||||||
prev_total += add_ded * flt(ocd[oc].total_amount)
|
prev_total += add_ded * flt(ocd[oc].total_amount)
|
||||||
total += add_ded * flt(ocd[oc].tax_amount)
|
total += add_ded * flt(ocd[oc].tax_amount)
|
||||||
ocd[oc].total = total
|
ocd[oc].total = total
|
||||||
@ -210,7 +210,7 @@ class DocType:
|
|||||||
ocd[oc].total = flt(total)
|
ocd[oc].total = flt(total)
|
||||||
ocd[oc].save()
|
ocd[oc].save()
|
||||||
|
|
||||||
if ocd[oc].category != "For Total":
|
if ocd[oc].category != "Total":
|
||||||
item_tax += add_ded * ocd[oc].total_amount
|
item_tax += add_ded * ocd[oc].total_amount
|
||||||
|
|
||||||
return total, prev_total, item_tax
|
return total, prev_total, item_tax
|
||||||
|
Loading…
x
Reference in New Issue
Block a user