Taxes and charges category issue fixed

This commit is contained in:
Nabin Hait 2012-10-03 11:54:06 +05:30
parent cd2f40ffef
commit 9462ce9aef
4 changed files with 12 additions and 12 deletions

View File

@ -182,7 +182,7 @@ class DocType:
if 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
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)
else:
self.make_single_entry(None,doc,le_map,cancel, merge_entries)

View File

@ -37,7 +37,7 @@ tax_acc = [c[0] for c in sql("""select distinct account_head
from `tabPurchase Taxes and Charges`
where parenttype = 'Purchase Invoice'
and add_deduct_tax = 'Add'
and category in ('For Total', 'For Both')
and category in ('Total', 'Valuation and Total')
and docstatus=1
order by account_head asc""")]
@ -82,7 +82,7 @@ for r in res:
where parent = '%s'
and parenttype = 'Purchase Invoice'
and add_deduct_tax = 'Add'
and category in ('For Total', 'For Both')
and category in ('Total', 'Valuation and Total')
group by account_head
""" %(r[col_idx['ID']],))

View File

@ -498,7 +498,7 @@ cur_frm.cscript.calc_other_charges = function(doc , tname , fname , other_fname)
tax[t].tax_amount += flt(tax_amount);
var total_amount = flt(tax[t].tax_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);
prev_total += flt(tax[t].total_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
$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;
}
}
@ -526,7 +526,7 @@ cur_frm.cscript.calc_other_charges = function(doc , tname , fname , other_fname)
tax[t].tax_amount += flt(tax_amount);
var total_amount = flt(tax[t].tax_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);
prev_total -= flt(tax[t].total_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
$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;
}
}
@ -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);
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'){
other_charges_added += flt(d[j].tax_amount);

View File

@ -99,10 +99,10 @@ class DocType:
self.prwise_cost[pr] = self.prwise_cost.get(pr, 0) + 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
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.charge_type = 'Actual'
ch.description = lc.description
@ -201,7 +201,7 @@ class DocType:
total_amount = flt(ocd[oc].tax_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)
total += add_ded * flt(ocd[oc].tax_amount)
ocd[oc].total = total
@ -210,7 +210,7 @@ class DocType:
ocd[oc].total = flt(total)
ocd[oc].save()
if ocd[oc].category != "For Total":
if ocd[oc].category != "Total":
item_tax += add_ded * ocd[oc].total_amount
return total, prev_total, item_tax