[fix] [minor] item wise taxes

This commit is contained in:
Anand Doshi 2013-09-05 16:53:57 +05:30
parent 284275cb70
commit 179e3772c0
2 changed files with 18 additions and 2 deletions

View File

@ -291,7 +291,12 @@ class AccountsController(TransactionBase):
current_tax_amount = flt(current_tax_amount, self.precision("tax_amount", tax))
# store tax breakup for each item
tax.item_wise_tax_detail[item.item_code or item.item_name] = [tax_rate, current_tax_amount]
key = item.item_code or item.item_name
if tax.item_wise_tax_detail.get(key):
item_wise_tax_amount = tax.item_wise_tax_detail[key][1] + current_tax_amount
tax.item_wise_tax_detail[key] = [tax_rate, item_wise_tax_amount]
else:
tax.item_wise_tax_detail[key] = [tax_rate, current_tax_amount]
return current_tax_amount

View File

@ -338,8 +338,19 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
var headings = $.map([wn._("Item Name")].concat($.map(tax_accounts, function(head) { return head[1]; })),
function(head) { return '<th style="min-width: 100px;">' + (head || "") + "</th>" }).join("\n");
var distinct_item_names = [];
var distinct_items = [];
$.each(this.get_item_doclist(), function(i, item) {
if(distinct_item_names.indexOf(item.item_code || item.item_name)===-1) {
distinct_item_names.push(item.item_code || item.item_name);
distinct_items.push(item);
}
});
var rows = $.map(this.get_item_doclist(), function(item) {
console.log(distinct_items);
var rows = $.map(distinct_items, function(item) {
var item_tax_record = item_tax[item.item_code || item.item_name];
if(!item_tax_record) { return null; }
return repl("<tr><td>%(item_name)s</td>%(taxes)s</tr>", {