Replaced renamed total fields in code files

This commit is contained in:
Nabin Hait 2015-02-12 16:09:11 +05:30
parent dd1c2d3018
commit 5690be103c
67 changed files with 1235 additions and 1241 deletions

View File

@ -54,17 +54,17 @@ class CForm(Document):
frappe.throw(_("Please enter atleast 1 invoice in the table")) frappe.throw(_("Please enter atleast 1 invoice in the table"))
def set_total_invoiced_amount(self): def set_total_invoiced_amount(self):
total = sum([flt(d.grand_total) for d in self.get('invoices')]) total = sum([flt(d.base_grand_total) for d in self.get('invoices')])
frappe.db.set(self, 'total_invoiced_amount', total) frappe.db.set(self, 'total_invoiced_amount', total)
def get_invoice_details(self, invoice_no): def get_invoice_details(self, invoice_no):
""" Pull details from invoices for referrence """ """ Pull details from invoices for referrence """
if invoice_no: if invoice_no:
inv = frappe.db.get_value("Sales Invoice", invoice_no, inv = frappe.db.get_value("Sales Invoice", invoice_no,
["posting_date", "territory", "net_total", "grand_total"], as_dict=True) ["posting_date", "territory", "base_net_total", "base_grand_total"], as_dict=True)
return { return {
'invoice_date' : inv.posting_date, 'invoice_date' : inv.posting_date,
'territory' : inv.territory, 'territory' : inv.territory,
'net_total' : inv.net_total, 'net_total' : inv.base_net_total,
'grand_total' : inv.grand_total 'grand_total' : inv.base_grand_total
} }

View File

@ -220,7 +220,7 @@ class JournalEntry(AccountsController):
def validate_against_order_fields(self, doctype, payment_against_voucher): def validate_against_order_fields(self, doctype, payment_against_voucher):
for voucher_no, payment_list in payment_against_voucher.items(): for voucher_no, payment_list in payment_against_voucher.items():
voucher_properties = frappe.db.get_value(doctype, voucher_no, voucher_properties = frappe.db.get_value(doctype, voucher_no,
["docstatus", "per_billed", "status", "advance_paid", "grand_total"]) ["docstatus", "per_billed", "status", "advance_paid", "base_grand_total"])
if voucher_properties[0] != 1: if voucher_properties[0] != 1:
frappe.throw(_("{0} {1} is not submitted").format(doctype, voucher_no)) frappe.throw(_("{0} {1} is not submitted").format(doctype, voucher_no))

View File

@ -1,7 +1,7 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt // License: GNU General Public License v3. See license.txt
cur_frm.set_query("default_account", "mode_of_payment_details", function(doc, cdt, cdn) { cur_frm.set_query("default_account", "accounts", function(doc, cdt, cdn) {
return{ return{
filters: [ filters: [
['Account', 'account_type', 'in', 'Bank, Cash'], ['Account', 'account_type', 'in', 'Bank, Cash'],
@ -9,4 +9,4 @@ cur_frm.set_query("default_account", "mode_of_payment_details", function(doc, cd
['Account', 'company', '=', doc.company] ['Account', 'company', '=', doc.company]
] ]
} }
}); });

View File

@ -82,8 +82,8 @@ def get_orders_to_be_billed(party_type, party):
orders = frappe.db.sql(""" orders = frappe.db.sql("""
select select
name as voucher_no, name as voucher_no,
ifnull(grand_total, 0) as invoice_amount, ifnull(base_grand_total, 0) as invoice_amount,
(ifnull(grand_total, 0) - ifnull(advance_paid, 0)) as outstanding_amount, (ifnull(base_grand_total, 0) - ifnull(advance_paid, 0)) as outstanding_amount,
transaction_date as posting_date transaction_date as posting_date
from from
`tab%s` `tab%s`
@ -91,7 +91,7 @@ def get_orders_to_be_billed(party_type, party):
%s = %s %s = %s
and docstatus = 1 and docstatus = 1
and ifnull(status, "") != "Stopped" and ifnull(status, "") != "Stopped"
and ifnull(grand_total, 0) > ifnull(advance_paid, 0) and ifnull(base_grand_total, 0) > ifnull(advance_paid, 0)
and abs(100 - ifnull(per_billed, 0)) > 0.01 and abs(100 - ifnull(per_billed, 0)) > 0.01
""" % (voucher_type, 'customer' if party_type == "Customer" else 'supplier', '%s'), """ % (voucher_type, 'customer' if party_type == "Customer" else 'supplier', '%s'),
party, as_dict = True) party, as_dict = True)
@ -106,9 +106,9 @@ def get_orders_to_be_billed(party_type, party):
@frappe.whitelist() @frappe.whitelist()
def get_against_voucher_amount(against_voucher_type, against_voucher_no): def get_against_voucher_amount(against_voucher_type, against_voucher_no):
if against_voucher_type in ["Sales Order", "Purchase Order"]: if against_voucher_type in ["Sales Order", "Purchase Order"]:
select_cond = "grand_total as total_amount, ifnull(grand_total, 0) - ifnull(advance_paid, 0) as outstanding_amount" select_cond = "base_grand_total as total_amount, ifnull(base_grand_total, 0) - ifnull(advance_paid, 0) as outstanding_amount"
elif against_voucher_type in ["Sales Invoice", "Purchase Invoice"]: elif against_voucher_type in ["Sales Invoice", "Purchase Invoice"]:
select_cond = "grand_total as total_amount, outstanding_amount" select_cond = "base_grand_total as total_amount, outstanding_amount"
elif against_voucher_type == "Journal Entry": elif against_voucher_type == "Journal Entry":
select_cond = "total_debit as total_amount" select_cond = "total_debit as total_amount"

View File

@ -978,7 +978,7 @@
} }
], ],
"read_only_onload": 1, "read_only_onload": 1,
"search_fields": "posting_date, supplier, fiscal_year, bill_no, grand_total, outstanding_amount", "search_fields": "posting_date, supplier, fiscal_year, bill_no, base_grand_total, outstanding_amount",
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"title_field": "supplier_name" "title_field": "supplier_name"

View File

@ -240,7 +240,7 @@ class PurchaseInvoice(BuyingController):
self.check_prev_docstatus() self.check_prev_docstatus()
frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype,
self.company, self.grand_total) self.company, self.base_grand_total)
# this sequence because outstanding may get -negative # this sequence because outstanding may get -negative
self.make_gl_entries() self.make_gl_entries()
@ -258,7 +258,7 @@ class PurchaseInvoice(BuyingController):
gl_entries = [] gl_entries = []
# parent's gl entry # parent's gl entry
if self.grand_total: if self.base_grand_total:
gl_entries.append( gl_entries.append(
self.get_gl_dict({ self.get_gl_dict({
"account": self.credit_to, "account": self.credit_to,

View File

@ -3,7 +3,7 @@
// render // render
frappe.listview_settings['Purchase Invoice'] = { frappe.listview_settings['Purchase Invoice'] = {
add_fields: ["supplier", "supplier_name", "grand_total", "outstanding_amount", "due_date", "company", add_fields: ["supplier", "supplier_name", "base_grand_total", "outstanding_amount", "due_date", "company",
"currency"], "currency"],
get_indicator: function(doc) { get_indicator: function(doc) {
if(doc.outstanding_amount > 0 && doc.docstatus==1) { if(doc.outstanding_amount > 0 && doc.docstatus==1) {

View File

@ -145,7 +145,7 @@ class TestPurchaseInvoice(unittest.TestCase):
self.assertEqual(item.item_tax_amount, expected_values[i][1]) self.assertEqual(item.item_tax_amount, expected_values[i][1])
self.assertEqual(item.valuation_rate, expected_values[i][2]) self.assertEqual(item.valuation_rate, expected_values[i][2])
self.assertEqual(wrapper.net_total, 1250) self.assertEqual(wrapper.base_net_total, 1250)
# tax amounts # tax amounts
expected_values = [ expected_values = [
@ -179,7 +179,7 @@ class TestPurchaseInvoice(unittest.TestCase):
self.assertEqual(item.item_tax_amount, expected_values[i][1]) self.assertEqual(item.item_tax_amount, expected_values[i][1])
self.assertEqual(item.valuation_rate, expected_values[i][2]) self.assertEqual(item.valuation_rate, expected_values[i][2])
self.assertEqual(wrapper.net_total, 1250) self.assertEqual(wrapper.base_net_total, 1250)
# tax amounts # tax amounts
expected_values = [ expected_values = [

View File

@ -41,7 +41,7 @@
} }
], ],
"fiscal_year": "_Test Fiscal Year 2013", "fiscal_year": "_Test Fiscal Year 2013",
"grand_total_import": 0, "grand_total": 0,
"naming_series": "_T-BILL", "naming_series": "_T-BILL",
"taxes": [ "taxes": [
{ {
@ -164,7 +164,7 @@
} }
], ],
"fiscal_year": "_Test Fiscal Year 2013", "fiscal_year": "_Test Fiscal Year 2013",
"grand_total_import": 0, "grand_total": 0,
"naming_series": "_T-Purchase Invoice-", "naming_series": "_T-Purchase Invoice-",
"taxes": [ "taxes": [
{ {

View File

@ -8,15 +8,15 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
} }
// For customizing print // For customizing print
cur_frm.pformat.net_total_import = function(doc) { cur_frm.pformat.net_total = function(doc) {
return ''; return '';
} }
cur_frm.pformat.grand_total_import = function(doc) { cur_frm.pformat.grand_total = function(doc) {
return ''; return '';
} }
cur_frm.pformat.in_words_import = function(doc) { cur_frm.pformat.in_words = function(doc) {
return ''; return '';
} }
@ -49,8 +49,8 @@ cur_frm.pformat.taxes= function(doc) {
// main table // main table
out +='<table class="noborder" style="width:100%">'; out +='<table class="noborder" style="width:100%">';
if(!print_hide('net_total_import')) if(!print_hide('net_total'))
out += make_row('Net Total', doc.net_total_import, 1); out += make_row('Net Total', doc.net_total, 1);
// add rows // add rows
if(cl.length){ if(cl.length){
@ -60,14 +60,14 @@ cur_frm.pformat.taxes= function(doc) {
} }
// grand total // grand total
if(!print_hide('grand_total_import')) if(!print_hide('grand_total'))
out += make_row('Grand Total', doc.grand_total_import, 1); out += make_row('Grand Total', doc.grand_total, 1);
if(doc.in_words_import && !print_hide('in_words_import')) { if(doc.in_words && !print_hide('in_words')) {
out += '</table></td></tr>'; out += '</table></td></tr>';
out += '<tr><td colspan = "2">'; out += '<tr><td colspan = "2">';
out += '<table><tr><td style="width:25%;"><b>In Words</b></td>'; out += '<table><tr><td style="width:25%;"><b>In Words</b></td>';
out += '<td style="width:50%;">' + doc.in_words_import + '</td></tr>'; out += '<td style="width:50%;">' + doc.in_words + '</td></tr>';
} }
out +='</table></td></tr></table></div>'; out +='</table></td></tr></table></div>';

View File

@ -54,7 +54,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
frappe.set_route("query-report", "General Ledger"); frappe.set_route("query-report", "General Ledger");
}, "icon-table"); }, "icon-table");
// var percent_paid = cint(flt(doc.grand_total - doc.outstanding_amount) / flt(doc.grand_total) * 100); // var percent_paid = cint(flt(doc.base_grand_total - doc.outstanding_amount) / flt(doc.base_grand_total) * 100);
// cur_frm.dashboard.add_progress(percent_paid + "% Paid", percent_paid); // cur_frm.dashboard.add_progress(percent_paid + "% Paid", percent_paid);
cur_frm.add_custom_button(__('Send SMS'), cur_frm.cscript.send_sms, 'icon-mobile-phone'); cur_frm.add_custom_button(__('Send SMS'), cur_frm.cscript.send_sms, 'icon-mobile-phone');
@ -173,10 +173,10 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
write_off_outstanding_amount_automatically: function() { write_off_outstanding_amount_automatically: function() {
if(cint(this.frm.doc.write_off_outstanding_amount_automatically)) { if(cint(this.frm.doc.write_off_outstanding_amount_automatically)) {
frappe.model.round_floats_in(this.frm.doc, ["grand_total", "paid_amount"]); frappe.model.round_floats_in(this.frm.doc, ["base_grand_total", "paid_amount"]);
// this will make outstanding amount 0 // this will make outstanding amount 0
this.frm.set_value("write_off_amount", this.frm.set_value("write_off_amount",
flt(this.frm.doc.grand_total - this.frm.doc.paid_amount, precision("write_off_amount")) flt(this.frm.doc.base_grand_total - this.frm.doc.paid_amount, precision("write_off_amount"))
); );
} }

View File

@ -1258,7 +1258,7 @@
} }
], ],
"read_only_onload": 1, "read_only_onload": 1,
"search_fields": "posting_date, due_date, customer, fiscal_year, grand_total, outstanding_amount", "search_fields": "posting_date, due_date, customer, fiscal_year, base_grand_total, outstanding_amount",
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"title_field": "customer_name" "title_field": "customer_name"

View File

@ -77,7 +77,7 @@ class SalesInvoice(SellingController):
# Check for Approving Authority # Check for Approving Authority
if not self.recurring_id: if not self.recurring_id:
frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype,
self.company, self.grand_total, self) self.company, self.base_grand_total, self)
self.check_prev_docstatus() self.check_prev_docstatus()
@ -329,7 +329,7 @@ class SalesInvoice(SellingController):
frappe.throw(_("Cash or Bank Account is mandatory for making payment entry")) frappe.throw(_("Cash or Bank Account is mandatory for making payment entry"))
if flt(self.paid_amount) + flt(self.write_off_amount) \ if flt(self.paid_amount) + flt(self.write_off_amount) \
- flt(self.grand_total) > 1/(10**(self.precision("grand_total") + 1)): - flt(self.base_grand_total) > 1/(10**(self.precision("base_grand_total") + 1)):
frappe.throw(_("""Paid amount + Write Off Amount can not be greater than Grand Total""")) frappe.throw(_("""Paid amount + Write Off Amount can not be greater than Grand Total"""))
@ -410,7 +410,7 @@ class SalesInvoice(SellingController):
if flt(self.paid_amount) == 0: if flt(self.paid_amount) == 0:
if self.cash_bank_account: if self.cash_bank_account:
frappe.db.set(self, 'paid_amount', frappe.db.set(self, 'paid_amount',
(flt(self.grand_total) - flt(self.write_off_amount))) (flt(self.base_grand_total) - flt(self.write_off_amount)))
else: else:
# show message that the amount is not paid # show message that the amount is not paid
frappe.db.set(self,'paid_amount',0) frappe.db.set(self,'paid_amount',0)
@ -483,14 +483,14 @@ class SalesInvoice(SellingController):
return gl_entries return gl_entries
def make_customer_gl_entry(self, gl_entries): def make_customer_gl_entry(self, gl_entries):
if self.grand_total: if self.base_grand_total:
gl_entries.append( gl_entries.append(
self.get_gl_dict({ self.get_gl_dict({
"account": self.debit_to, "account": self.debit_to,
"party_type": "Customer", "party_type": "Customer",
"party": self.customer, "party": self.customer,
"against": self.against_income_account, "against": self.against_income_account,
"debit": self.grand_total, "debit": self.base_grand_total,
"remarks": self.remarks, "remarks": self.remarks,
"against_voucher": self.name, "against_voucher": self.name,
"against_voucher_type": self.doctype, "against_voucher_type": self.doctype,

View File

@ -3,7 +3,7 @@
// render // render
frappe.listview_settings['Sales Invoice'] = { frappe.listview_settings['Sales Invoice'] = {
add_fields: ["customer", "customer_name", "grand_total", "outstanding_amount", "due_date", "company", add_fields: ["customer", "customer_name", "base_grand_total", "outstanding_amount", "due_date", "company",
"currency"], "currency"],
get_indicator: function(doc) { get_indicator: function(doc) {
if(doc.outstanding_amount==0) { if(doc.outstanding_amount==0) {
@ -14,5 +14,5 @@ frappe.listview_settings['Sales Invoice'] = {
return [__("Overdue"), "red", "outstanding_amount,>,0|due_date,<=,Today"] return [__("Overdue"), "red", "outstanding_amount,>,0|due_date,<=,Today"]
} }
}, },
right_column: "grand_total_export" right_column: "grand_total"
}; };

View File

@ -25,11 +25,11 @@
} }
], ],
"fiscal_year": "_Test Fiscal Year 2013", "fiscal_year": "_Test Fiscal Year 2013",
"base_grand_total": 561.8,
"grand_total": 561.8, "grand_total": 561.8,
"grand_total_export": 561.8,
"is_pos": 0, "is_pos": 0,
"naming_series": "_T-Sales Invoice-", "naming_series": "_T-Sales Invoice-",
"net_total": 500.0, "base_net_total": 500.0,
"taxes": [ "taxes": [
{ {
"account_head": "_Test Account VAT - _TC", "account_head": "_Test Account VAT - _TC",
@ -95,11 +95,11 @@
} }
], ],
"fiscal_year": "_Test Fiscal Year 2013", "fiscal_year": "_Test Fiscal Year 2013",
"base_grand_total": 630.0,
"grand_total": 630.0, "grand_total": 630.0,
"grand_total_export": 630.0,
"is_pos": 0, "is_pos": 0,
"naming_series": "_T-Sales Invoice-", "naming_series": "_T-Sales Invoice-",
"net_total": 500.0, "base_net_total": 500.0,
"taxes": [ "taxes": [
{ {
"account_head": "_Test Account VAT - _TC", "account_head": "_Test Account VAT - _TC",
@ -163,7 +163,7 @@
} }
], ],
"fiscal_year": "_Test Fiscal Year 2013", "fiscal_year": "_Test Fiscal Year 2013",
"grand_total_export": 0, "grand_total": 0,
"is_pos": 0, "is_pos": 0,
"naming_series": "_T-Sales Invoice-", "naming_series": "_T-Sales Invoice-",
"taxes": [ "taxes": [
@ -287,7 +287,7 @@
} }
], ],
"fiscal_year": "_Test Fiscal Year 2013", "fiscal_year": "_Test Fiscal Year 2013",
"grand_total_export": 0, "grand_total": 0,
"is_pos": 0, "is_pos": 0,
"naming_series": "_T-Sales Invoice-", "naming_series": "_T-Sales Invoice-",
"taxes": [ "taxes": [

View File

@ -53,8 +53,8 @@ class TestSalesInvoice(unittest.TestCase):
self.assertEquals(d.get(k), expected_values[d.item_code][i]) self.assertEquals(d.get(k), expected_values[d.item_code][i])
# check net total # check net total
self.assertEquals(si.base_net_total, 1250)
self.assertEquals(si.net_total, 1250) self.assertEquals(si.net_total, 1250)
self.assertEquals(si.net_total_export, 1250)
# check tax calculation # check tax calculation
expected_values = { expected_values = {
@ -73,8 +73,8 @@ class TestSalesInvoice(unittest.TestCase):
for i, k in enumerate(expected_values["keys"]): for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.account_head][i]) self.assertEquals(d.get(k), expected_values[d.account_head][i])
self.assertEquals(si.base_grand_total, 1627.05)
self.assertEquals(si.grand_total, 1627.05) self.assertEquals(si.grand_total, 1627.05)
self.assertEquals(si.grand_total_export, 1627.05)
def test_sales_invoice_calculation_export_currency(self): def test_sales_invoice_calculation_export_currency(self):
si = frappe.copy_doc(test_records[2]) si = frappe.copy_doc(test_records[2])
@ -103,8 +103,8 @@ class TestSalesInvoice(unittest.TestCase):
self.assertEquals(d.get(k), expected_values[d.item_code][i]) self.assertEquals(d.get(k), expected_values[d.item_code][i])
# check net total # check net total
self.assertEquals(si.net_total, 1250) self.assertEquals(si.base_net_total, 1250)
self.assertEquals(si.net_total_export, 25) self.assertEquals(si.net_total, 25)
# check tax calculation # check tax calculation
expected_values = { expected_values = {
@ -123,8 +123,8 @@ class TestSalesInvoice(unittest.TestCase):
for i, k in enumerate(expected_values["keys"]): for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.account_head][i]) self.assertEquals(d.get(k), expected_values[d.account_head][i])
self.assertEquals(si.grand_total, 1627.05) self.assertEquals(si.base_grand_total, 1627.05)
self.assertEquals(si.grand_total_export, 32.54) self.assertEquals(si.grand_total, 32.54)
def test_sales_invoice_discount_amount(self): def test_sales_invoice_discount_amount(self):
si = frappe.copy_doc(test_records[3]) si = frappe.copy_doc(test_records[3])
@ -157,8 +157,8 @@ class TestSalesInvoice(unittest.TestCase):
self.assertEquals(d.get(k), expected_values[d.item_code][i]) self.assertEquals(d.get(k), expected_values[d.item_code][i])
# check net total # check net total
self.assertEquals(si.net_total, 1163.45) self.assertEquals(si.base_net_total, 1163.45)
self.assertEquals(si.net_total_export, 1578.3) self.assertEquals(si.net_total, 1578.3)
# check tax calculation # check tax calculation
expected_values = { expected_values = {
@ -178,8 +178,8 @@ class TestSalesInvoice(unittest.TestCase):
for i, k in enumerate(expected_values["keys"]): for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.account_head][i]) self.assertEquals(d.get(k), expected_values[d.account_head][i])
self.assertEquals(si.base_grand_total, 1500)
self.assertEquals(si.grand_total, 1500) self.assertEquals(si.grand_total, 1500)
self.assertEquals(si.grand_total_export, 1500)
def test_discount_amount_gl_entry(self): def test_discount_amount_gl_entry(self):
si = frappe.copy_doc(test_records[3]) si = frappe.copy_doc(test_records[3])
@ -268,8 +268,8 @@ class TestSalesInvoice(unittest.TestCase):
self.assertEquals(d.get(k), expected_values[d.item_code][i]) self.assertEquals(d.get(k), expected_values[d.item_code][i])
# check net total # check net total
self.assertEquals(si.net_total, 1249.98) self.assertEquals(si.base_net_total, 1249.98)
self.assertEquals(si.net_total_export, 1578.3) self.assertEquals(si.net_total, 1578.3)
# check tax calculation # check tax calculation
expected_values = { expected_values = {
@ -288,8 +288,8 @@ class TestSalesInvoice(unittest.TestCase):
for i, k in enumerate(expected_values["keys"]): for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.account_head][i]) self.assertEquals(d.get(k), expected_values[d.account_head][i])
self.assertEquals(si.base_grand_total, 1622.98)
self.assertEquals(si.grand_total, 1622.98) self.assertEquals(si.grand_total, 1622.98)
self.assertEquals(si.grand_total_export, 1622.98)
def test_sales_invoice_calculation_export_currency_with_tax_inclusive_price(self): def test_sales_invoice_calculation_export_currency_with_tax_inclusive_price(self):
# prepare # prepare
@ -320,8 +320,8 @@ class TestSalesInvoice(unittest.TestCase):
self.assertEquals(d.get(k), expected_values[d.item_code][i]) self.assertEquals(d.get(k), expected_values[d.item_code][i])
# check net total # check net total
self.assertEquals(si.net_total, 49501.7) self.assertEquals(si.base_net_total, 49501.7)
self.assertEquals(si.net_total_export, 1250) self.assertEquals(si.net_total, 1250)
# check tax calculation # check tax calculation
expected_values = { expected_values = {
@ -340,12 +340,12 @@ class TestSalesInvoice(unittest.TestCase):
for i, k in enumerate(expected_values["keys"]): for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.account_head][i]) self.assertEquals(d.get(k), expected_values[d.account_head][i])
self.assertEquals(si.grand_total, 65205.16) self.assertEquals(si.base_grand_total, 65205.16)
self.assertEquals(si.grand_total_export, 1304.1) self.assertEquals(si.grand_total, 1304.1)
def test_outstanding(self): def test_outstanding(self):
w = self.make() w = self.make()
self.assertEquals(w.outstanding_amount, w.grand_total) self.assertEquals(w.outstanding_amount, w.base_grand_total)
def test_payment(self): def test_payment(self):
frappe.db.sql("""delete from `tabGL Entry`""") frappe.db.sql("""delete from `tabGL Entry`""")

View File

@ -13,7 +13,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
} }
// For customizing print // For customizing print
cur_frm.pformat.net_total_export = function(doc) { cur_frm.pformat.net_total = function(doc) {
return ''; return '';
} }
@ -21,15 +21,15 @@ cur_frm.pformat.discount_amount = function(doc) {
return ''; return '';
} }
cur_frm.pformat.grand_total_export = function(doc) { cur_frm.pformat.grand_total = function(doc) {
return ''; return '';
} }
cur_frm.pformat.rounded_total_export = function(doc) { cur_frm.pformat.rounded_total = function(doc) {
return ''; return '';
} }
cur_frm.pformat.in_words_export = function(doc) { cur_frm.pformat.in_words = function(doc) {
return ''; return '';
} }
@ -63,8 +63,8 @@ cur_frm.pformat.taxes= function(doc){
out +='<table class="noborder" style="width:100%">'; out +='<table class="noborder" style="width:100%">';
if(!print_hide('net_total_export')) { if(!print_hide('net_total')) {
out += make_row('Net Total', doc.net_total_export, 1); out += make_row('Net Total', doc.net_total, 1);
} }
// add rows // add rows
@ -80,17 +80,17 @@ cur_frm.pformat.taxes= function(doc){
out += make_row('Discount Amount', doc.discount_amount, 0); out += make_row('Discount Amount', doc.discount_amount, 0);
// grand total // grand total
if(!print_hide('grand_total_export')) if(!print_hide('grand_total'))
out += make_row('Grand Total', doc.grand_total_export, 1); out += make_row('Grand Total', doc.grand_total, 1);
if(!print_hide('rounded_total_export')) if(!print_hide('rounded_total'))
out += make_row('Rounded Total', doc.rounded_total_export, 1); out += make_row('Rounded Total', doc.rounded_total, 1);
if(doc.in_words_export && !print_hide('in_words_export')) { if(doc.in_words && !print_hide('in_words')) {
out +='</table></td></tr>'; out +='</table></td></tr>';
out += '<tr><td colspan = "2">'; out += '<tr><td colspan = "2">';
out += '<table><tr><td style="width:25%;"><b>In Words</b></td>'; out += '<table><tr><td style="width:25%;"><b>In Words</b></td>';
out += '<td style="width:50%;">' + doc.in_words_export + '</td></tr>'; out += '<td style="width:50%;">' + doc.in_words + '</td></tr>';
} }
out += '</table></td></tr></table></div>'; out += '</table></td></tr></table></div>';
} }

View File

@ -3,9 +3,9 @@
"doc_type": "Sales Invoice", "doc_type": "Sales Invoice",
"docstatus": 0, "docstatus": 0,
"doctype": "Print Format", "doctype": "Print Format",
"html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ doc.company }}<br>\n\t{{ doc.select_print_heading or _(\"Invoice\") }}<br>\n</p>\n<p>\n\t<b>{{ _(\"Receipt No\") }}:</b> {{ doc.name }}<br>\n\t<b>{{ _(\"Date\") }}:</b> {{ doc.get_formatted(\"posting_date\") }}<br>\n\t<b>{{ _(\"Customer\") }}:</b> {{ doc.customer_name }}\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"60%\">{{ _(\"Item\") }}</b></th>\n\t\t\t<th width=\"10%\" class=\"text-right\">{{ _(\"Qty\") }}</th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Rate\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{%- for item in doc.items -%}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t<br>{{ item.item_name }}{%- endif -%}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}</td>\n\t\t\t<td class=\"text-right\">{{ item.amount }}</td>\n\t\t</tr>\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ _(\"Net Total\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"net_total_export\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- for row in doc.taxes -%}\n\t\t{%- if not row.included_in_print_rate -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t{%- endfor -%}\n\t\t{%- if doc.discount_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t<b>{{ _(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"grand_total_export\") }}\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>\n{% if doc.get(\"taxes\", filters={\"included_in_print_rate\": 1}) %}\n<hr>\n<p><b>Taxes Included:</b></p>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t{%- for row in doc.taxes -%}\n\t\t{%- if row.included_in_print_rate -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ row.get_formatted(\"tax_amount_after_discount_amount\", doc) }}\n\t\t\t</td>\n\t\t<tr>\n\t\t{%- endif -%}\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n{%- endif -%}\n<hr>\n<p>{{ doc.terms or \"\" }}</p>\n<p class=\"text-center\">{{ _(\"Thank you, please visit again.\") }}</p>", "html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ doc.company }}<br>\n\t{{ doc.select_print_heading or _(\"Invoice\") }}<br>\n</p>\n<p>\n\t<b>{{ _(\"Receipt No\") }}:</b> {{ doc.name }}<br>\n\t<b>{{ _(\"Date\") }}:</b> {{ doc.get_formatted(\"posting_date\") }}<br>\n\t<b>{{ _(\"Customer\") }}:</b> {{ doc.customer_name }}\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"60%\">{{ _(\"Item\") }}</b></th>\n\t\t\t<th width=\"10%\" class=\"text-right\">{{ _(\"Qty\") }}</th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Rate\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{%- for item in doc.items -%}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t<br>{{ item.item_name }}{%- endif -%}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}</td>\n\t\t\t<td class=\"text-right\">{{ item.amount }}</td>\n\t\t</tr>\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ _(\"Net Total\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"net_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- for row in doc.taxes -%}\n\t\t{%- if not row.included_in_print_rate -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t{%- endfor -%}\n\t\t{%- if doc.discount_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t<b>{{ _(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"grand_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>\n{% if doc.get(\"taxes\", filters={\"included_in_print_rate\": 1}) %}\n<hr>\n<p><b>Taxes Included:</b></p>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t{%- for row in doc.taxes -%}\n\t\t{%- if row.included_in_print_rate -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ row.get_formatted(\"tax_amount_after_discount_amount\", doc) }}\n\t\t\t</td>\n\t\t<tr>\n\t\t{%- endif -%}\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n{%- endif -%}\n<hr>\n<p>{{ doc.terms or \"\" }}</p>\n<p class=\"text-center\">{{ _(\"Thank you, please visit again.\") }}</p>",
"idx": 1, "idx": 1,
"modified": "2014-12-26 02:08:26.603223", "modified": "2015-02-12 02:08:26.603223",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "POS Invoice", "name": "POS Invoice",

View File

@ -68,7 +68,7 @@ def get_items(filters):
match_conditions = frappe.build_match_conditions("Purchase Invoice") match_conditions = frappe.build_match_conditions("Purchase Invoice")
return frappe.db.sql("""select pi_item.parent, pi.posting_date, pi.credit_to, pi.company, return frappe.db.sql("""select pi_item.parent, pi.posting_date, pi.credit_to, pi.company,
pi.supplier, pi.remarks, pi.net_total, pi_item.item_code, pi_item.item_name, pi_item.item_group, pi.supplier, pi.remarks, pi.base_net_total, pi_item.item_code, pi_item.item_name, pi_item.item_group,
pi_item.project_name, pi_item.purchase_order, pi_item.purchase_receipt, pi_item.po_detail pi_item.project_name, pi_item.purchase_order, pi_item.purchase_receipt, pi_item.po_detail
pi_item.expense_account, pi_item.qty, pi_item.base_rate, pi_item.base_amount, pi.supplier_name pi_item.expense_account, pi_item.qty, pi_item.base_rate, pi_item.base_amount, pi.supplier_name
from `tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item from `tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item
@ -107,7 +107,7 @@ def get_tax_accounts(item_list, columns):
elif charge_type == "Actual" and tax_amount: elif charge_type == "Actual" and tax_amount:
for d in invoice_wise_items.get(parent, []): for d in invoice_wise_items.get(parent, []):
item_tax.setdefault(parent, {}).setdefault(d.item_code, {})[account_head] = \ item_tax.setdefault(parent, {}).setdefault(d.item_code, {})[account_head] = \
(tax_amount * d.base_amount) / d.net_total (tax_amount * d.base_amount) / d.base_net_total
tax_accounts.sort() tax_accounts.sort()
columns += [account_head + ":Currency:80" for account_head in tax_accounts] columns += [account_head + ":Currency:80" for account_head in tax_accounts]

View File

@ -67,7 +67,7 @@ def get_conditions(filters):
def get_items(filters): def get_items(filters):
conditions = get_conditions(filters) conditions = get_conditions(filters)
return frappe.db.sql("""select si_item.parent, si.posting_date, si.debit_to, si.project_name, return frappe.db.sql("""select si_item.parent, si.posting_date, si.debit_to, si.project_name,
si.customer, si.remarks, si.territory, si.company, si.net_total, si_item.item_code, si_item.item_name, si.customer, si.remarks, si.territory, si.company, si.base_net_total, si_item.item_code, si_item.item_name,
si_item.item_group, si_item.sales_order, si_item.delivery_note, si_item.income_account, si_item.item_group, si_item.sales_order, si_item.delivery_note, si_item.income_account,
si_item.qty, si_item.base_rate, si_item.base_amount, si.customer_name, si_item.qty, si_item.base_rate, si_item.base_amount, si.customer_name,
si.customer_group, si_item.so_detail si.customer_group, si_item.so_detail
@ -104,7 +104,7 @@ def get_tax_accounts(item_list, columns):
elif charge_type == "Actual" and tax_amount: elif charge_type == "Actual" and tax_amount:
for d in invoice_wise_items.get(parent, []): for d in invoice_wise_items.get(parent, []):
item_tax.setdefault(parent, {}).setdefault(d.item_code, {})[account_head] = \ item_tax.setdefault(parent, {}).setdefault(d.item_code, {})[account_head] = \
flt((tax_amount * d.base_amount) / d.net_total) flt((tax_amount * d.base_amount) / d.base_net_total)
tax_accounts.sort() tax_accounts.sort()
columns += [account_head + ":Currency:80" for account_head in tax_accounts] columns += [account_head + ":Currency:80" for account_head in tax_accounts]

View File

@ -35,14 +35,14 @@ def execute(filters=None):
", ".join(purchase_order), ", ".join(purchase_receipt)] ", ".join(purchase_order), ", ".join(purchase_receipt)]
# map expense values # map expense values
net_total = 0 base_net_total = 0
for expense_acc in expense_accounts: for expense_acc in expense_accounts:
expense_amount = flt(invoice_expense_map.get(inv.name, {}).get(expense_acc)) expense_amount = flt(invoice_expense_map.get(inv.name, {}).get(expense_acc))
net_total += expense_amount base_net_total += expense_amount
row.append(expense_amount) row.append(expense_amount)
# net total # net total
row.append(net_total or inv.net_total) row.append(base_net_total or inv.base_net_total)
# tax account # tax account
total_tax = 0 total_tax = 0
@ -53,7 +53,7 @@ def execute(filters=None):
row.append(tax_amount) row.append(tax_amount)
# total tax, grand total, outstanding amount & rounded total # total tax, grand total, outstanding amount & rounded total
row += [total_tax, inv.grand_total, flt(inv.grand_total, 2), inv.outstanding_amount] row += [total_tax, inv.base_grand_total, flt(inv.base_grand_total, 2), inv.outstanding_amount]
data.append(row) data.append(row)
# raise Exception # raise Exception
@ -108,7 +108,7 @@ def get_conditions(filters):
def get_invoices(filters): def get_invoices(filters):
conditions = get_conditions(filters) conditions = get_conditions(filters)
return frappe.db.sql("""select name, posting_date, credit_to, supplier, supplier_name return frappe.db.sql("""select name, posting_date, credit_to, supplier, supplier_name
bill_no, bill_date, remarks, net_total, grand_total, outstanding_amount bill_no, bill_date, remarks, base_net_total, base_grand_total, outstanding_amount
from `tabPurchase Invoice` where docstatus = 1 %s from `tabPurchase Invoice` where docstatus = 1 %s
order by posting_date desc, name desc""" % conditions, filters, as_dict=1) order by posting_date desc, name desc""" % conditions, filters, as_dict=1)

View File

@ -1,17 +1,17 @@
{ {
"apply_user_permissions": 1, "apply_user_permissions": 1,
"creation": "2013-05-06 12:28:23", "creation": "2013-05-06 12:28:23",
"docstatus": 0, "docstatus": 0,
"doctype": "Report", "doctype": "Report",
"idx": 1, "idx": 1,
"is_standard": "Yes", "is_standard": "Yes",
"modified": "2014-06-03 07:18:17.302063", "modified": "2015-02-12 07:18:17.302063",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Partners Commission", "name": "Sales Partners Commission",
"owner": "Administrator", "owner": "Administrator",
"query": "SELECT\n sales_partner as \"Sales Partner:Link/Sales Partner:150\",\n\tsum(net_total) as \"Invoiced Amount (Exculsive Tax):Currency:210\",\n\tsum(total_commission) as \"Total Commission:Currency:150\",\n\tsum(total_commission)*100/sum(net_total) as \"Average Commission Rate:Currency:170\"\nFROM\n\t`tabSales Invoice`\nWHERE\n\tdocstatus = 1 and ifnull(net_total, 0) > 0 and ifnull(total_commission, 0) > 0\nGROUP BY\n\tsales_partner\nORDER BY\n\t\"Total Commission:Currency:120\"", "query": "SELECT\n sales_partner as \"Sales Partner:Link/Sales Partner:150\",\n\tsum(base_net_total) as \"Invoiced Amount (Exculsive Tax):Currency:210\",\n\tsum(total_commission) as \"Total Commission:Currency:150\",\n\tsum(total_commission)*100/sum(base_net_total) as \"Average Commission Rate:Currency:170\"\nFROM\n\t`tabSales Invoice`\nWHERE\n\tdocstatus = 1 and ifnull(base_net_total, 0) > 0 and ifnull(total_commission, 0) > 0\nGROUP BY\n\tsales_partner\nORDER BY\n\t\"Total Commission:Currency:120\"",
"ref_doctype": "Sales Invoice", "ref_doctype": "Sales Invoice",
"report_name": "Sales Partners Commission", "report_name": "Sales Partners Commission",
"report_type": "Query Report" "report_type": "Query Report"
} }

View File

@ -34,14 +34,14 @@ def execute(filters=None):
inv.debit_to, inv.project_name, inv.remarks, ", ".join(sales_order), ", ".join(delivery_note)] inv.debit_to, inv.project_name, inv.remarks, ", ".join(sales_order), ", ".join(delivery_note)]
# map income values # map income values
net_total = 0 base_net_total = 0
for income_acc in income_accounts: for income_acc in income_accounts:
income_amount = flt(invoice_income_map.get(inv.name, {}).get(income_acc)) income_amount = flt(invoice_income_map.get(inv.name, {}).get(income_acc))
net_total += income_amount base_net_total += income_amount
row.append(income_amount) row.append(income_amount)
# net total # net total
row.append(net_total or inv.net_total) row.append(base_net_total or inv.base_net_total)
# tax account # tax account
total_tax = 0 total_tax = 0
@ -52,7 +52,7 @@ def execute(filters=None):
row.append(tax_amount) row.append(tax_amount)
# total tax, grand total, outstanding amount & rounded total # total tax, grand total, outstanding amount & rounded total
row += [total_tax, inv.grand_total, inv.rounded_total, inv.outstanding_amount] row += [total_tax, inv.base_grand_total, inv.base_rounded_total, inv.outstanding_amount]
data.append(row) data.append(row)
@ -107,7 +107,7 @@ def get_conditions(filters):
def get_invoices(filters): def get_invoices(filters):
conditions = get_conditions(filters) conditions = get_conditions(filters)
return frappe.db.sql("""select name, posting_date, debit_to, project_name, customer, return frappe.db.sql("""select name, posting_date, debit_to, project_name, customer,
customer_name, remarks, net_total, grand_total, rounded_total, outstanding_amount customer_name, remarks, base_net_total, base_grand_total, base_rounded_total, outstanding_amount
from `tabSales Invoice` from `tabSales Invoice`
where docstatus = 1 %s order by posting_date desc, name desc""" % where docstatus = 1 %s order by posting_date desc, name desc""" %
conditions, filters, as_dict=1) conditions, filters, as_dict=1)

View File

@ -175,65 +175,65 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
calculate_net_total: function() { calculate_net_total: function() {
var me = this; var me = this;
this.frm.doc.net_total = this.frm.doc.net_total_import = 0.0; this.frm.doc.base_net_total = this.frm.doc.net_total = 0.0;
$.each(this.frm.doc["items"] || [], function(i, item) { $.each(this.frm.doc["items"] || [], function(i, item) {
me.frm.doc.net_total += item.base_amount; me.frm.doc.base_net_total += item.base_amount;
me.frm.doc.net_total_import += item.amount; me.frm.doc.net_total += item.amount;
}); });
frappe.model.round_floats_in(this.frm.doc, ["net_total", "net_total_import"]); frappe.model.round_floats_in(this.frm.doc, ["base_net_total", "net_total"]);
}, },
calculate_totals: function() { calculate_totals: function() {
var tax_count = this.frm.doc["taxes"] ? this.frm.doc["taxes"].length : 0; var tax_count = this.frm.doc["taxes"] ? this.frm.doc["taxes"].length : 0;
this.frm.doc.grand_total = flt(tax_count ? this.frm.doc["taxes"][tax_count - 1].total : this.frm.doc.net_total); this.frm.doc.base_grand_total = flt(tax_count ? this.frm.doc["taxes"][tax_count - 1].total : this.frm.doc.base_net_total);
this.frm.doc.total_tax = flt(this.frm.doc.grand_total - this.frm.doc.net_total, precision("total_tax")); this.frm.doc.base_total_taxes_and_charges = flt(this.frm.doc.base_grand_total - this.frm.doc.base_net_total, precision("base_total_taxes_and_charges"));
this.frm.doc.grand_total = flt(this.frm.doc.grand_total, precision("grand_total")); this.frm.doc.base_grand_total = flt(this.frm.doc.base_grand_total, precision("base_grand_total"));
// rounded totals // rounded totals
if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total", this.frm.doc.name)) { if(frappe.meta.get_docfield(this.frm.doc.doctype, "base_rounded_total", this.frm.doc.name)) {
this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total); this.frm.doc.base_rounded_total = Math.round(this.frm.doc.base_grand_total);
} }
// other charges added/deducted // other charges added/deducted
this.frm.doc.other_charges_added = 0.0 this.frm.doc.base_taxes_and_charges_added = 0.0
this.frm.doc.other_charges_deducted = 0.0 this.frm.doc.base_taxes_and_charges_deducted = 0.0
if(tax_count) { if(tax_count) {
this.frm.doc.other_charges_added = frappe.utils.sum($.map(this.frm.doc["taxes"], this.frm.doc.base_taxes_and_charges_added = frappe.utils.sum($.map(this.frm.doc["taxes"],
function(tax) { return (tax.add_deduct_tax == "Add" function(tax) { return (tax.add_deduct_tax == "Add"
&& in_list(["Valuation and Total", "Total"], tax.category)) ? && in_list(["Valuation and Total", "Total"], tax.category)) ?
tax.tax_amount : 0.0; })); tax.tax_amount : 0.0; }));
this.frm.doc.other_charges_deducted = frappe.utils.sum($.map(this.frm.doc["taxes"], this.frm.doc.base_taxes_and_charges_deducted = frappe.utils.sum($.map(this.frm.doc["taxes"],
function(tax) { return (tax.add_deduct_tax == "Deduct" function(tax) { return (tax.add_deduct_tax == "Deduct"
&& in_list(["Valuation and Total", "Total"], tax.category)) ? && in_list(["Valuation and Total", "Total"], tax.category)) ?
tax.tax_amount : 0.0; })); tax.tax_amount : 0.0; }));
frappe.model.round_floats_in(this.frm.doc, frappe.model.round_floats_in(this.frm.doc,
["other_charges_added", "other_charges_deducted"]); ["base_taxes_and_charges_added", "base_taxes_and_charges_deducted"]);
} }
this.frm.doc.grand_total_import = flt((this.frm.doc.other_charges_added || this.frm.doc.other_charges_deducted) ? this.frm.doc.grand_total = flt((this.frm.doc.base_taxes_and_charges_added || this.frm.doc.base_taxes_and_charges_deducted) ?
flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total_import); flt(this.frm.doc.base_grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total);
this.frm.doc.grand_total_import = flt(this.frm.doc.grand_total_import, precision("grand_total_import")); this.frm.doc.grand_total = flt(this.frm.doc.grand_total, precision("grand_total"));
if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total_import", this.frm.doc.name)) { if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total", this.frm.doc.name)) {
this.frm.doc.rounded_total_import = Math.round(this.frm.doc.grand_total_import); this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total);
} }
this.frm.doc.other_charges_added_import = flt(this.frm.doc.other_charges_added / this.frm.doc.taxes_and_charges_added = flt(this.frm.doc.base_taxes_and_charges_added /
this.frm.doc.conversion_rate, precision("other_charges_added_import")); this.frm.doc.conversion_rate, precision("taxes_and_charges_added"));
this.frm.doc.other_charges_deducted_import = flt(this.frm.doc.other_charges_deducted / this.frm.doc.taxes_and_charges_deducted = flt(this.frm.doc.base_taxes_and_charges_deducted /
this.frm.doc.conversion_rate, precision("other_charges_deducted_import")); this.frm.doc.conversion_rate, precision("taxes_and_charges_deducted"));
}, },
calculate_outstanding_amount: function() { calculate_outstanding_amount: function() {
if(this.frm.doc.doctype == "Purchase Invoice" && this.frm.doc.docstatus < 2) { if(this.frm.doc.doctype == "Purchase Invoice" && this.frm.doc.docstatus < 2) {
frappe.model.round_floats_in(this.frm.doc, ["grand_total", "total_advance", "write_off_amount"]); frappe.model.round_floats_in(this.frm.doc, ["base_grand_total", "total_advance", "write_off_amount"]);
this.frm.doc.total_amount_to_pay = flt(this.frm.doc.grand_total - this.frm.doc.write_off_amount, this.frm.doc.total_amount_to_pay = flt(this.frm.doc.base_grand_total - this.frm.doc.write_off_amount,
precision("total_amount_to_pay")); precision("total_amount_to_pay"));
this.frm.doc.outstanding_amount = flt(this.frm.doc.total_amount_to_pay - this.frm.doc.total_advance, this.frm.doc.outstanding_amount = flt(this.frm.doc.total_amount_to_pay - this.frm.doc.total_advance,
precision("outstanding_amount")); precision("outstanding_amount"));
@ -267,13 +267,13 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
}; };
setup_field_label_map(["net_total", "total_tax", "grand_total", "in_words", setup_field_label_map(["base_net_total", "base_total_taxes_and_charges", "base_grand_total", "base_in_words",
"other_charges_added", "other_charges_deducted", "base_taxes_and_charges_added", "base_taxes_and_charges_deducted",
"outstanding_amount", "total_advance", "total_amount_to_pay", "rounded_total"], "outstanding_amount", "total_advance", "total_amount_to_pay", "base_rounded_total"],
company_currency); company_currency);
setup_field_label_map(["net_total_import", "grand_total_import", "in_words_import", setup_field_label_map(["net_total", "grand_total", "in_words",
"other_charges_added_import", "other_charges_deducted_import"], this.frm.doc.currency); "taxes_and_charges_added", "taxes_and_charges_deducted"], this.frm.doc.currency);
cur_frm.set_df_property("conversion_rate", "description", "1 " + this.frm.doc.currency cur_frm.set_df_property("conversion_rate", "description", "1 " + this.frm.doc.currency
+ " = [?] " + company_currency); + " = [?] " + company_currency);
@ -284,8 +284,8 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
} }
// toggle fields // toggle fields
this.frm.toggle_display(["conversion_rate", "net_total", "grand_total", this.frm.toggle_display(["conversion_rate", "base_net_total", "base_grand_total",
"in_words", "other_charges_added", "other_charges_deducted"], "base_in_words", "base_taxes_and_charges_added", "base_taxes_and_charges_deducted"],
this.frm.doc.currency !== company_currency); this.frm.doc.currency !== company_currency);
this.frm.toggle_display(["plc_conversion_rate", "price_list_currency"], this.frm.toggle_display(["plc_conversion_rate", "price_list_currency"],

View File

@ -854,7 +854,7 @@
} }
], ],
"read_only_onload": 1, "read_only_onload": 1,
"search_fields": "status, transaction_date, supplier,grand_total", "search_fields": "status, transaction_date, supplier,base_grand_total",
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"title_field": "supplier_name" "title_field": "supplier_name"

View File

@ -183,7 +183,7 @@ class PurchaseOrder(BuyingController):
self.update_ordered_qty() self.update_ordered_qty()
frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype,
self.company, self.grand_total) self.company, self.base_grand_total)
purchase_controller.update_last_purchase_rate(self, is_submit = 1) purchase_controller.update_last_purchase_rate(self, is_submit = 1)

View File

@ -1,5 +1,5 @@
frappe.listview_settings['Purchase Order'] = { frappe.listview_settings['Purchase Order'] = {
add_fields: ["grand_total", "company", "currency", "supplier", add_fields: ["base_grand_total", "company", "currency", "supplier",
"supplier_name", "per_received", "per_billed", "status"], "supplier_name", "per_received", "per_billed", "status"],
get_indicator: function(doc) { get_indicator: function(doc) {
if(doc.status==="Stopped") { if(doc.status==="Stopped") {

View File

@ -7,11 +7,11 @@
"currency": "INR", "currency": "INR",
"doctype": "Purchase Order", "doctype": "Purchase Order",
"fiscal_year": "_Test Fiscal Year 2013", "fiscal_year": "_Test Fiscal Year 2013",
"base_grand_total": 5000.0,
"grand_total": 5000.0, "grand_total": 5000.0,
"grand_total_import": 5000.0,
"is_subcontracted": "Yes", "is_subcontracted": "Yes",
"naming_series": "_T-Purchase Order-", "naming_series": "_T-Purchase Order-",
"net_total": 5000.0, "base_net_total": 5000.0,
"items": [ "items": [
{ {
"base_amount": 5000.0, "base_amount": 5000.0,
@ -41,11 +41,11 @@
"currency": "INR", "currency": "INR",
"doctype": "Purchase Order", "doctype": "Purchase Order",
"fiscal_year": "_Test Fiscal Year 2013", "fiscal_year": "_Test Fiscal Year 2013",
"base_grand_total": 5000.0,
"grand_total": 5000.0, "grand_total": 5000.0,
"grand_total_import": 5000.0,
"is_subcontracted": "No", "is_subcontracted": "No",
"naming_series": "_T-Purchase Order-", "naming_series": "_T-Purchase Order-",
"net_total": 5000.0, "base_net_total": 5000.0,
"items": [ "items": [
{ {
"base_amount": 5000.0, "base_amount": 5000.0,

View File

@ -89,7 +89,7 @@ def get_dashboard_info(supplier):
out[doctype] = frappe.db.get_value(doctype, out[doctype] = frappe.db.get_value(doctype,
{"supplier": supplier, "docstatus": ["!=", 2] }, "count(*)") {"supplier": supplier, "docstatus": ["!=", 2] }, "count(*)")
billing = frappe.db.sql("""select sum(grand_total), sum(outstanding_amount) billing = frappe.db.sql("""select sum(base_grand_total), sum(outstanding_amount)
from `tabPurchase Invoice` from `tabPurchase Invoice`
where supplier=%s where supplier=%s
and docstatus = 1 and docstatus = 1

View File

@ -673,7 +673,7 @@
} }
], ],
"read_only_onload": 1, "read_only_onload": 1,
"search_fields": "status, transaction_date, supplier,grand_total", "search_fields": "status, transaction_date, supplier,base_grand_total",
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"title_field": "supplier_name" "title_field": "supplier_name"

View File

@ -1,5 +1,5 @@
frappe.listview_settings['Supplier Quotation'] = { frappe.listview_settings['Supplier Quotation'] = {
add_fields: ["supplier", "grand_total", "status", "company", "currency"], add_fields: ["supplier", "base_grand_total", "status", "company", "currency"],
get_indicator: function(doc) { get_indicator: function(doc) {
if(doc.status==="Ordered") { if(doc.status==="Ordered") {
return [__("Ordered"), "green", "status,=,Ordered"]; return [__("Ordered"), "green", "status,=,Ordered"];

View File

@ -6,11 +6,11 @@
"currency": "INR", "currency": "INR",
"doctype": "Supplier Quotation", "doctype": "Supplier Quotation",
"fiscal_year": "_Test Fiscal Year 2013", "fiscal_year": "_Test Fiscal Year 2013",
"base_grand_total": 5000.0,
"grand_total": 5000.0, "grand_total": 5000.0,
"grand_total_import": 5000.0,
"is_subcontracted": "No", "is_subcontracted": "No",
"naming_series": "_T-Supplier Quotation-", "naming_series": "_T-Supplier Quotation-",
"net_total": 5000.0, "base_net_total": 5000.0,
"items": [ "items": [
{ {
"base_amount": 5000.0, "base_amount": 5000.0,

View File

@ -18,7 +18,7 @@ class AccountsController(TransactionBase):
self.validate_date_with_fiscal_year() self.validate_date_with_fiscal_year()
if self.meta.get_field("currency"): if self.meta.get_field("currency"):
self.calculate_taxes_and_totals() self.calculate_taxes_and_totals()
self.validate_value("grand_total", ">=", 0) self.validate_value("base_grand_total", ">=", 0)
self.set_total_in_words() self.set_total_in_words()
self.validate_due_date() self.validate_due_date()
@ -291,7 +291,7 @@ class AccountsController(TransactionBase):
self.precision("tax_amount", tax)) self.precision("tax_amount", tax))
def adjust_discount_amount_loss(self, tax): def adjust_discount_amount_loss(self, tax):
discount_amount_loss = self.grand_total - flt(self.base_discount_amount) - tax.total discount_amount_loss = self.base_grand_total - flt(self.base_discount_amount) - tax.total
tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount + tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount +
discount_amount_loss, self.precision("tax_amount", tax)) discount_amount_loss, self.precision("tax_amount", tax))
tax.total = flt(tax.total + discount_amount_loss, self.precision("total", tax)) tax.total = flt(tax.total + discount_amount_loss, self.precision("total", tax))
@ -303,8 +303,8 @@ class AccountsController(TransactionBase):
if tax.charge_type == "Actual": if tax.charge_type == "Actual":
# distribute the tax amount proportionally to each item row # distribute the tax amount proportionally to each item row
actual = flt(tax.rate, self.precision("tax_amount", tax)) actual = flt(tax.rate, self.precision("tax_amount", tax))
current_tax_amount = (self.net_total current_tax_amount = (self.base_net_total
and ((item.base_amount / self.net_total) * actual) and ((item.base_amount / self.base_net_total) * actual)
or 0) or 0)
elif tax.charge_type == "On Net Total": elif tax.charge_type == "On Net Total":
current_tax_amount = (tax_rate / 100.0) * item.base_amount current_tax_amount = (tax_rate / 100.0) * item.base_amount
@ -510,12 +510,12 @@ class AccountsController(TransactionBase):
if advance_paid: if advance_paid:
advance_paid = flt(advance_paid[0][0], self.precision("advance_paid")) advance_paid = flt(advance_paid[0][0], self.precision("advance_paid"))
if flt(self.grand_total) >= advance_paid: if flt(self.base_grand_total) >= advance_paid:
frappe.db.set_value(self.doctype, self.name, "advance_paid", advance_paid) frappe.db.set_value(self.doctype, self.name, "advance_paid", advance_paid)
else: else:
frappe.throw(_("Total advance ({0}) against Order {1} cannot be greater \ frappe.throw(_("Total advance ({0}) against Order {1} cannot be greater \
than the Grand Total ({2})") than the Grand Total ({2})")
.format(advance_paid, self.name, self.grand_total)) .format(advance_paid, self.name, self.base_grand_total))
@property @property
def company_abbr(self): def company_abbr(self):

View File

@ -21,7 +21,7 @@ class BuyingController(StockController):
def get_feed(self): def get_feed(self):
return _("From {0} | {1} {2}").format(self.supplier_name, self.currency, return _("From {0} | {1} {2}").format(self.supplier_name, self.currency,
self.grand_total_import) self.grand_total)
def validate(self): def validate(self):
super(BuyingController, self).validate() super(BuyingController, self).validate()
@ -74,10 +74,10 @@ class BuyingController(StockController):
def set_total_in_words(self): def set_total_in_words(self):
from frappe.utils import money_in_words from frappe.utils import money_in_words
company_currency = get_company_currency(self.company) company_currency = get_company_currency(self.company)
if self.meta.get_field("base_in_words"):
self.base_in_words = money_in_words(self.base_grand_total, company_currency)
if self.meta.get_field("in_words"): if self.meta.get_field("in_words"):
self.in_words = money_in_words(self.grand_total, company_currency) self.in_words = money_in_words(self.grand_total,
if self.meta.get_field("in_words_import"):
self.in_words_import = money_in_words(self.grand_total_import,
self.currency) self.currency)
def calculate_taxes_and_totals(self): def calculate_taxes_and_totals(self):
@ -103,55 +103,55 @@ class BuyingController(StockController):
def calculate_net_total(self): def calculate_net_total(self):
self.net_total = self.net_total_import = 0.0 self.base_net_total = self.net_total = 0.0
for item in self.get("items"): for item in self.get("items"):
self.net_total += item.base_amount self.base_net_total += item.base_amount
self.net_total_import += item.amount self.net_total += item.amount
self.round_floats_in(self, ["net_total", "net_total_import"]) self.round_floats_in(self, ["base_net_total", "net_total"])
def calculate_totals(self): def calculate_totals(self):
self.grand_total = flt(self.get("taxes")[-1].total if self.get("taxes") else self.net_total) self.base_grand_total = flt(self.get("taxes")[-1].total if self.get("taxes") else self.base_net_total)
self.total_tax = flt(self.grand_total - self.net_total, self.precision("total_tax")) self.base_total_taxes_and_charges = flt(self.base_grand_total - self.base_net_total, self.precision("base_total_taxes_and_charges"))
self.base_grand_total = flt(self.base_grand_total, self.precision("base_grand_total"))
if self.meta.get_field("base_rounded_total"):
self.base_rounded_total = rounded(self.base_grand_total)
if self.meta.get_field("base_taxes_and_charges_added"):
self.base_taxes_and_charges_added = flt(sum([flt(d.tax_amount) for d in self.get("taxes")
if d.add_deduct_tax=="Add" and d.category in ["Valuation and Total", "Total"]]),
self.precision("base_taxes_and_charges_added"))
if self.meta.get_field("base_taxes_and_charges_deducted"):
self.base_taxes_and_charges_deducted = flt(sum([flt(d.tax_amount) for d in self.get("taxes")
if d.add_deduct_tax=="Deduct" and d.category in ["Valuation and Total", "Total"]]),
self.precision("base_taxes_and_charges_deducted"))
self.grand_total = flt(self.base_grand_total / self.conversion_rate) \
if (self.base_taxes_and_charges_added or self.base_taxes_and_charges_deducted) else self.net_total
self.grand_total = flt(self.grand_total, self.precision("grand_total")) self.grand_total = flt(self.grand_total, self.precision("grand_total"))
if self.meta.get_field("rounded_total"): if self.meta.get_field("rounded_total"):
self.rounded_total = rounded(self.grand_total) self.rounded_total = rounded(self.grand_total)
if self.meta.get_field("other_charges_added"): if self.meta.get_field("taxes_and_charges_added"):
self.other_charges_added = flt(sum([flt(d.tax_amount) for d in self.get("taxes") self.taxes_and_charges_added = flt(self.base_taxes_and_charges_added /
if d.add_deduct_tax=="Add" and d.category in ["Valuation and Total", "Total"]]), self.conversion_rate, self.precision("taxes_and_charges_added"))
self.precision("other_charges_added"))
if self.meta.get_field("other_charges_deducted"): if self.meta.get_field("taxes_and_charges_deducted"):
self.other_charges_deducted = flt(sum([flt(d.tax_amount) for d in self.get("taxes") self.taxes_and_charges_deducted = flt(self.base_taxes_and_charges_deducted /
if d.add_deduct_tax=="Deduct" and d.category in ["Valuation and Total", "Total"]]), self.conversion_rate, self.precision("taxes_and_charges_deducted"))
self.precision("other_charges_deducted"))
self.grand_total_import = flt(self.grand_total / self.conversion_rate) \
if (self.other_charges_added or self.other_charges_deducted) else self.net_total_import
self.grand_total_import = flt(self.grand_total_import, self.precision("grand_total_import"))
if self.meta.get_field("rounded_total_import"):
self.rounded_total_import = rounded(self.grand_total_import)
if self.meta.get_field("other_charges_added_import"):
self.other_charges_added_import = flt(self.other_charges_added /
self.conversion_rate, self.precision("other_charges_added_import"))
if self.meta.get_field("other_charges_deducted_import"):
self.other_charges_deducted_import = flt(self.other_charges_deducted /
self.conversion_rate, self.precision("other_charges_deducted_import"))
def calculate_outstanding_amount(self): def calculate_outstanding_amount(self):
if self.doctype == "Purchase Invoice" and self.docstatus == 0: if self.doctype == "Purchase Invoice" and self.docstatus == 0:
self.total_advance = flt(self.total_advance, self.total_advance = flt(self.total_advance,
self.precision("total_advance")) self.precision("total_advance"))
self.total_amount_to_pay = flt(self.grand_total - flt(self.write_off_amount, self.total_amount_to_pay = flt(self.base_grand_total - flt(self.write_off_amount,
self.precision("write_off_amount")), self.precision("total_amount_to_pay")) self.precision("write_off_amount")), self.precision("total_amount_to_pay"))
self.outstanding_amount = flt(self.total_amount_to_pay - self.total_advance, self.outstanding_amount = flt(self.total_amount_to_pay - self.total_advance,
self.precision("outstanding_amount")) self.precision("outstanding_amount"))

View File

@ -19,7 +19,7 @@ class SellingController(StockController):
def get_feed(self): def get_feed(self):
return _("To {0} | {1} {2}").format(self.customer_name, self.currency, return _("To {0} | {1} {2}").format(self.customer_name, self.currency,
self.grand_total_export) self.grand_total)
def onload(self): def onload(self):
if self.doctype in ("Sales Order", "Delivery Note", "Sales Invoice"): if self.doctype in ("Sales Order", "Delivery Note", "Sales Invoice"):
@ -65,7 +65,7 @@ class SellingController(StockController):
def apply_shipping_rule(self): def apply_shipping_rule(self):
if self.shipping_rule: if self.shipping_rule:
shipping_rule = frappe.get_doc("Shipping Rule", self.shipping_rule) shipping_rule = frappe.get_doc("Shipping Rule", self.shipping_rule)
value = self.net_total value = self.base_net_total
# TODO # TODO
# shipping rule calculation based on item's net weight # shipping rule calculation based on item's net weight
@ -114,12 +114,12 @@ class SellingController(StockController):
disable_rounded_total = cint(frappe.db.get_value("Global Defaults", None, disable_rounded_total = cint(frappe.db.get_value("Global Defaults", None,
"disable_rounded_total")) "disable_rounded_total"))
if self.meta.get_field("base_in_words"):
self.base_in_words = money_in_words(disable_rounded_total and
self.base_grand_total or self.base_rounded_total, company_currency)
if self.meta.get_field("in_words"): if self.meta.get_field("in_words"):
self.in_words = money_in_words(disable_rounded_total and self.in_words = money_in_words(disable_rounded_total and
self.grand_total or self.rounded_total, company_currency) self.grand_total or self.rounded_total, self.currency)
if self.meta.get_field("in_words_export"):
self.in_words_export = money_in_words(disable_rounded_total and
self.grand_total_export or self.rounded_total_export, self.currency)
def calculate_taxes_and_totals(self): def calculate_taxes_and_totals(self):
super(SellingController, self).calculate_taxes_and_totals() super(SellingController, self).calculate_taxes_and_totals()
@ -204,30 +204,30 @@ class SellingController(StockController):
self._set_in_company_currency(item, "amount", "base_amount") self._set_in_company_currency(item, "amount", "base_amount")
def calculate_net_total(self): def calculate_net_total(self):
self.net_total = self.net_total_export = 0.0 self.base_net_total = self.net_total = 0.0
for item in self.get("items"): for item in self.get("items"):
self.net_total += item.base_amount self.base_net_total += item.base_amount
self.net_total_export += item.amount self.net_total += item.amount
self.round_floats_in(self, ["net_total", "net_total_export"]) self.round_floats_in(self, ["base_net_total", "net_total"])
def calculate_totals(self): def calculate_totals(self):
self.grand_total = flt(self.get("taxes")[-1].total if self.get("taxes") else self.net_total) self.base_grand_total = flt(self.get("taxes")[-1].total if self.get("taxes") else self.base_net_total)
self.other_charges_total = flt(self.grand_total - self.net_total, self.precision("other_charges_total")) self.base_total_taxes_and_charges = flt(self.base_grand_total - self.base_net_total, self.precision("base_total_taxes_and_charges"))
self.grand_total_export = flt(self.grand_total / self.conversion_rate) \ self.grand_total = flt(self.base_grand_total / self.conversion_rate) \
if (self.other_charges_total or self.discount_amount) else self.net_total_export if (self.base_total_taxes_and_charges or self.discount_amount) else self.net_total
self.other_charges_total_export = flt(self.grand_total_export - self.net_total_export + self.total_taxes_and_charges = flt(self.grand_total - self.net_total +
flt(self.discount_amount), self.precision("other_charges_total_export")) flt(self.discount_amount), self.precision("total_taxes_and_charges"))
self.base_grand_total = flt(self.base_grand_total, self.precision("base_grand_total"))
self.grand_total = flt(self.grand_total, self.precision("grand_total")) self.grand_total = flt(self.grand_total, self.precision("grand_total"))
self.grand_total_export = flt(self.grand_total_export, self.precision("grand_total_export"))
self.base_rounded_total = rounded(self.base_grand_total)
self.rounded_total = rounded(self.grand_total) self.rounded_total = rounded(self.grand_total)
self.rounded_total_export = rounded(self.grand_total_export)
def apply_discount_amount(self): def apply_discount_amount(self):
if self.discount_amount: if self.discount_amount:
@ -257,8 +257,8 @@ class SellingController(StockController):
flt(tax.rate) / 100 flt(tax.rate) / 100
actual_taxes_dict.setdefault(tax.idx, actual_tax_amount) actual_taxes_dict.setdefault(tax.idx, actual_tax_amount)
grand_total_for_discount_amount = flt(self.grand_total - sum(actual_taxes_dict.values()), grand_total_for_discount_amount = flt(self.base_grand_total - sum(actual_taxes_dict.values()),
self.precision("grand_total")) self.precision("base_grand_total"))
return grand_total_for_discount_amount return grand_total_for_discount_amount
def calculate_outstanding_amount(self): def calculate_outstanding_amount(self):
@ -266,19 +266,19 @@ class SellingController(StockController):
# write_off_amount is only for POS Invoice # write_off_amount is only for POS Invoice
# total_advance is only for non POS Invoice # total_advance is only for non POS Invoice
if self.doctype == "Sales Invoice" and self.docstatus == 0: if self.doctype == "Sales Invoice" and self.docstatus == 0:
self.round_floats_in(self, ["grand_total", "total_advance", "write_off_amount", self.round_floats_in(self, ["base_grand_total", "total_advance", "write_off_amount",
"paid_amount"]) "paid_amount"])
total_amount_to_pay = self.grand_total - self.write_off_amount total_amount_to_pay = self.base_grand_total - self.write_off_amount
self.outstanding_amount = flt(total_amount_to_pay - self.total_advance \ self.outstanding_amount = flt(total_amount_to_pay - self.total_advance \
- self.paid_amount, self.precision("outstanding_amount")) - self.paid_amount, self.precision("outstanding_amount"))
def calculate_commission(self): def calculate_commission(self):
if self.meta.get_field("commission_rate"): if self.meta.get_field("commission_rate"):
self.round_floats_in(self, ["net_total", "commission_rate"]) self.round_floats_in(self, ["base_net_total", "commission_rate"])
if self.commission_rate > 100.0: if self.commission_rate > 100.0:
throw(_("Commission rate cannot be greater than 100")) throw(_("Commission rate cannot be greater than 100"))
self.total_commission = flt(self.net_total * self.commission_rate / 100.0, self.total_commission = flt(self.base_net_total * self.commission_rate / 100.0,
self.precision("total_commission")) self.precision("total_commission"))
def calculate_contribution(self): def calculate_contribution(self):
@ -291,7 +291,7 @@ class SellingController(StockController):
self.round_floats_in(sales_person) self.round_floats_in(sales_person)
sales_person.allocated_amount = flt( sales_person.allocated_amount = flt(
self.net_total * sales_person.allocated_percentage / 100.0, self.base_net_total * sales_person.allocated_percentage / 100.0,
self.precision("allocated_amount", sales_person)) self.precision("allocated_amount", sales_person))
total += sales_person.allocated_percentage total += sales_person.allocated_percentage

View File

@ -196,7 +196,7 @@ class StatusUpdater(Document):
ref_fieldname = ref_dt.lower().replace(" ", "_") ref_fieldname = ref_dt.lower().replace(" ", "_")
zero_amount_refdoc = [] zero_amount_refdoc = []
all_zero_amount_refdoc = frappe.db.sql_list("""select name from `tab%s` all_zero_amount_refdoc = frappe.db.sql_list("""select name from `tab%s`
where docstatus=1 and net_total = 0""" % ref_dt) where docstatus=1 and base_net_total = 0""" % ref_dt)
for item in self.get("items"): for item in self.get("items"):
if item.get(ref_fieldname) \ if item.get(ref_fieldname) \

View File

@ -16,12 +16,12 @@ class ProductionPlanningTool(Document):
def get_so_details(self, so): def get_so_details(self, so):
"""Pull other details from so""" """Pull other details from so"""
so = frappe.db.sql("""select transaction_date, customer, grand_total so = frappe.db.sql("""select transaction_date, customer, base_grand_total
from `tabSales Order` where name = %s""", so, as_dict = 1) from `tabSales Order` where name = %s""", so, as_dict = 1)
ret = { ret = {
'sales_order_date': so and so[0]['transaction_date'] or '', 'sales_order_date': so and so[0]['transaction_date'] or '',
'customer' : so[0]['customer'] or '', 'customer' : so[0]['customer'] or '',
'grand_total': so[0]['grand_total'] 'grand_total': so[0]['base_grand_total']
} }
return ret return ret
@ -61,7 +61,7 @@ class ProductionPlanningTool(Document):
item_filter += ' and item.name = "' + self.fg_item + '"' item_filter += ' and item.name = "' + self.fg_item + '"'
open_so = frappe.db.sql(""" open_so = frappe.db.sql("""
select distinct so.name, so.transaction_date, so.customer, so.grand_total select distinct so.name, so.transaction_date, so.customer, so.base_grand_total
from `tabSales Order` so, `tabSales Order Item` so_item from `tabSales Order` so, `tabSales Order Item` so_item
where so_item.parent = so.name where so_item.parent = so.name
and so.docstatus = 1 and so.status != "Stopped" and so.docstatus = 1 and so.status != "Stopped"
@ -90,7 +90,7 @@ class ProductionPlanningTool(Document):
pp_so.sales_order = r['name'] pp_so.sales_order = r['name']
pp_so.sales_order_date = cstr(r['transaction_date']) pp_so.sales_order_date = cstr(r['transaction_date'])
pp_so.customer = cstr(r['customer']) pp_so.customer = cstr(r['customer'])
pp_so.grand_total = flt(r['grand_total']) pp_so.grand_total = flt(r['base_grand_total'])
def get_items_from_so(self): def get_items_from_so(self):
""" Pull items from Sales Order, only proction item """ Pull items from Sales Order, only proction item

View File

@ -227,8 +227,8 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({
if(tax.charge_type == "Actual") { if(tax.charge_type == "Actual") {
// distribute the tax amount proportionally to each item row // distribute the tax amount proportionally to each item row
var actual = flt(tax.rate, precision("tax_amount", tax)); var actual = flt(tax.rate, precision("tax_amount", tax));
current_tax_amount = this.frm.doc.net_total ? current_tax_amount = this.frm.doc.base_net_total ?
((item.base_amount / this.frm.doc.net_total) * actual) : 0.0; ((item.base_amount / this.frm.doc.base_net_total) * actual) : 0.0;
} else if(tax.charge_type == "On Net Total") { } else if(tax.charge_type == "On Net Total") {
current_tax_amount = (tax_rate / 100.0) * item.base_amount; current_tax_amount = (tax_rate / 100.0) * item.base_amount;
@ -258,7 +258,7 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({
}, },
adjust_discount_amount_loss: function(tax) { adjust_discount_amount_loss: function(tax) {
var discount_amount_loss = this.frm.doc.grand_total - flt(this.frm.doc.base_discount_amount) - tax.total; var discount_amount_loss = this.frm.doc.base_grand_total - flt(this.frm.doc.base_discount_amount) - tax.total;
tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount + tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount +
discount_amount_loss, precision("tax_amount", tax)); discount_amount_loss, precision("tax_amount", tax));
tax.total = flt(tax.total + discount_amount_loss, precision("total", tax)); tax.total = flt(tax.total + discount_amount_loss, precision("total", tax));
@ -266,7 +266,7 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({
_cleanup: function() { _cleanup: function() {
this.frm.doc.in_words = this.frm.doc.in_words_import = this.frm.doc.in_words_export = ""; this.frm.doc.base_in_words = this.frm.doc.in_words = this.frm.doc.in_words = "";
if(this.frm.doc["items"] && this.frm.doc["items"].length) { if(this.frm.doc["items"] && this.frm.doc["items"].length) {
if(!frappe.meta.get_docfield(this.frm.doc["items"][0].doctype, "item_tax_amount", this.frm.doctype)) { if(!frappe.meta.get_docfield(this.frm.doc["items"][0].doctype, "item_tax_amount", this.frm.doctype)) {
@ -338,8 +338,8 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({
total_actual_tax += value; total_actual_tax += value;
}); });
grand_total_for_discount_amount = flt(this.frm.doc.grand_total - total_actual_tax, grand_total_for_discount_amount = flt(this.frm.doc.base_grand_total - total_actual_tax,
precision("grand_total")); precision("base_grand_total"));
return grand_total_for_discount_amount; return grand_total_for_discount_amount;
}, },

View File

@ -111,30 +111,30 @@ erpnext.feature_setup.feature_dict = {
'Sales Order': {'items':['page_break']} 'Sales Order': {'items':['page_break']}
}, },
'fs_exports': { 'fs_exports': {
'Delivery Note': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']}, 'Delivery Note': {'fields':['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']},
'POS Setting': {'fields':['conversion_rate','currency']}, 'POS Setting': {'fields':['conversion_rate','currency']},
'Quotation': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']}, 'Quotation': {'fields':['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']},
'Sales Invoice': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']}, 'Sales Invoice': {'fields':['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']},
'Sales BOM': {'fields':['currency']}, 'Sales BOM': {'fields':['currency']},
'Sales Order': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']} 'Sales Order': {'fields':['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']}
}, },
'fs_imports': { 'fs_imports': {
'Purchase Invoice': { 'Purchase Invoice': {
'fields': ['conversion_rate', 'currency', 'grand_total', 'fields': ['conversion_rate', 'currency', 'base_grand_total',
'in_words', 'net_total', 'other_charges_added', 'base_in_words', 'base_net_total', 'base_taxes_and_charges_added',
'other_charges_deducted'], 'base_taxes_and_charges_deducted'],
'items': ['base_price_list_rate', 'base_amount','base_rate'] 'items': ['base_price_list_rate', 'base_amount','base_rate']
}, },
'Purchase Order': { 'Purchase Order': {
'fields': ['conversion_rate','currency', 'grand_total', 'fields': ['conversion_rate','currency', 'base_grand_total',
'in_words', 'net_total', 'other_charges_added', 'base_in_words', 'base_net_total', 'base_taxes_and_charges_added',
'other_charges_deducted'], 'base_taxes_and_charges_deducted'],
'items': ['base_price_list_rate', 'base_amount','base_rate'] 'items': ['base_price_list_rate', 'base_amount','base_rate']
}, },
'Purchase Receipt': { 'Purchase Receipt': {
'fields': ['conversion_rate', 'currency','grand_total', 'in_words', 'fields': ['conversion_rate', 'currency','base_grand_total', 'base_in_words',
'net_total', 'other_charges_added', 'other_charges_deducted'], 'base_net_total', 'base_taxes_and_charges_added', 'base_taxes_and_charges_deducted'],
'items': ['base_price_list_rate','base_amount','base_rate'] 'items': ['base_price_list_rate','base_amount','base_rate']
}, },
'Supplier Quotation': { 'Supplier Quotation': {

View File

@ -26,23 +26,19 @@ erpnext.pos.PointOfSale = Class.extend({
// Check whether the transaction is "Sales" or "Purchase" // Check whether the transaction is "Sales" or "Purchase"
if (frappe.meta.has_field(cur_frm.doc.doctype, "customer")) { if (frappe.meta.has_field(cur_frm.doc.doctype, "customer")) {
this.set_transaction_defaults("Customer", "export"); this.set_transaction_defaults("Customer");
} }
else if (frappe.meta.has_field(cur_frm.doc.doctype, "supplier")) { else if (frappe.meta.has_field(cur_frm.doc.doctype, "supplier")) {
this.set_transaction_defaults("Supplier", "import"); this.set_transaction_defaults("Supplier");
} }
}, },
set_transaction_defaults: function(party, export_or_import) { set_transaction_defaults: function(party) {
var me = this; var me = this;
this.party = party; this.party = party;
this.price_list = (party == "Customer" ? this.price_list = (party == "Customer" ?
this.frm.doc.selling_price_list : this.frm.doc.buying_price_list); this.frm.doc.selling_price_list : this.frm.doc.buying_price_list);
this.price_list_field = (party == "Customer" ? "selling_price_list" : "buying_price_list"); this.price_list_field = (party == "Customer" ? "selling_price_list" : "buying_price_list");
this.sales_or_purchase = (party == "Customer" ? "Sales" : "Purchase"); this.sales_or_purchase = (party == "Customer" ? "Sales" : "Purchase");
this.net_total = "net_total_" + export_or_import;
this.grand_total = "grand_total_" + export_or_import;
// this.amount = export_or_import + "_amount";
// this.rate = export_or_import + "_rate";
}, },
make: function() { make: function() {
this.make_party(); this.make_party();
@ -282,10 +278,8 @@ erpnext.pos.PointOfSale = Class.extend({
}, },
set_totals: function() { set_totals: function() {
var me = this; var me = this;
this.wrapper.find(".net-total").text(format_currency(this.frm.doc[this.net_total], this.wrapper.find(".net-total").text(format_currency(me.frm.doc["net_total"], me.frm.doc.currency));
me.frm.doc.currency)); this.wrapper.find(".grand-total").text(format_currency(me.frm.doc.grand_total, me.frm.doc.currency));
this.wrapper.find(".grand-total").text(format_currency(this.frm.doc[this.grand_total],
me.frm.doc.currency));
}, },
call_when_local: function() { call_when_local: function() {
var me = this; var me = this;
@ -414,12 +408,12 @@ erpnext.pos.PointOfSale = Class.extend({
title: 'Payment', title: 'Payment',
fields: [ fields: [
{fieldtype:'Currency', fieldname:'total_amount', label: __('Total Amount'), read_only:1, {fieldtype:'Currency', fieldname:'total_amount', label: __('Total Amount'), read_only:1,
options:"currency", default:me.frm.doc.grand_total_export, read_only: 1}, options:"currency", default:me.frm.doc.grand_total, read_only: 1},
{fieldtype:'Select', fieldname:'mode_of_payment', label: __('Mode of Payment'), {fieldtype:'Select', fieldname:'mode_of_payment', label: __('Mode of Payment'),
options:modes_of_payment.join('\n'), reqd: 1, default: default_mode}, options:modes_of_payment.join('\n'), reqd: 1, default: default_mode},
{fieldtype:'Currency', fieldname:'paid_amount', label:__('Amount Paid'), reqd:1, {fieldtype:'Currency', fieldname:'paid_amount', label:__('Amount Paid'), reqd:1,
options: "currency", options: "currency",
default:me.frm.doc.grand_total_export, hidden: 1}, default:me.frm.doc.grand_total, hidden: 1},
{fieldtype:'Currency', fieldname:'change', label: __('Change'), options: "currency", {fieldtype:'Currency', fieldname:'change', label: __('Change'), options: "currency",
default: 0.0, hidden: 1}, default: 0.0, hidden: 1},
{fieldtype:'Currency', fieldname:'write_off_amount', label: __('Write Off'), options: "currency", {fieldtype:'Currency', fieldname:'write_off_amount', label: __('Write Off'), options: "currency",
@ -473,7 +467,7 @@ erpnext.pos.PointOfSale = Class.extend({
me.frm.set_value("paid_amount", paid_amount); me.frm.set_value("paid_amount", paid_amount);
// specifying writeoff amount here itself, so as to avoid recursion issue // specifying writeoff amount here itself, so as to avoid recursion issue
me.frm.set_value("write_off_amount", me.frm.doc.grand_total - paid_amount); me.frm.set_value("write_off_amount", me.frm.doc.base_grand_total - paid_amount);
me.frm.set_value("outstanding_amount", 0); me.frm.set_value("outstanding_amount", 0);
me.frm.savesubmit(this); me.frm.savesubmit(this);

View File

@ -123,7 +123,7 @@ def get_dashboard_info(customer):
out[doctype] = frappe.db.get_value(doctype, out[doctype] = frappe.db.get_value(doctype,
{"customer": customer, "docstatus": ["!=", 2] }, "count(*)") {"customer": customer, "docstatus": ["!=", 2] }, "count(*)")
billing = frappe.db.sql("""select sum(grand_total), sum(outstanding_amount) billing = frappe.db.sql("""select sum(base_grand_total), sum(outstanding_amount)
from `tabSales Invoice` from `tabSales Invoice`
where customer=%s where customer=%s
and docstatus = 1 and docstatus = 1
@ -174,7 +174,7 @@ def get_customer_outstanding(customer, company):
# Outstanding based on Sales Order # Outstanding based on Sales Order
outstanding_based_on_so = frappe.db.sql(""" outstanding_based_on_so = frappe.db.sql("""
select sum(grand_total*(100 - ifnull(per_billed, 0))/100) select sum(base_grand_total*(100 - ifnull(per_billed, 0))/100)
from `tabSales Order` from `tabSales Order`
where customer=%s and docstatus = 1 and company=%s where customer=%s and docstatus = 1 and company=%s
and ifnull(per_billed, 0) < 100 and status != 'Stopped'""", (customer, company)) and ifnull(per_billed, 0) < 100 and status != 'Stopped'""", (customer, company))
@ -189,8 +189,8 @@ def get_customer_outstanding(customer, company):
(ifnull(dn_item.amount, 0) - ifnull((select sum(ifnull(amount, 0)) (ifnull(dn_item.amount, 0) - ifnull((select sum(ifnull(amount, 0))
from `tabSales Invoice Item` from `tabSales Invoice Item`
where ifnull(dn_detail, '') = dn_item.name and docstatus = 1), 0) where ifnull(dn_detail, '') = dn_item.name and docstatus = 1), 0)
)/dn.net_total )/dn.base_net_total
)*dn.grand_total )*dn.base_grand_total
) )
from `tabDelivery Note` dn, `tabDelivery Note Item` dn_item from `tabDelivery Note` dn, `tabDelivery Note Item` dn_item
where where

View File

@ -79,7 +79,7 @@ class Quotation(SellingController):
self.check_item_table() self.check_item_table()
# Check for Approving Authority # Check for Approving Authority
frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.grand_total, self) frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.base_grand_total, self)
#update enquiry status #update enquiry status
self.update_opportunity() self.update_opportunity()

View File

@ -1,5 +1,5 @@
frappe.listview_settings['Quotation'] = { frappe.listview_settings['Quotation'] = {
add_fields: ["customer_name", "grand_total", "status", add_fields: ["customer_name", "base_grand_total", "status",
"company", "currency"], "company", "currency"],
get_indicator: function(doc) { get_indicator: function(doc) {
if(doc.status==="Ordered") { if(doc.status==="Ordered") {

View File

@ -8,8 +8,8 @@
"customer_name": "_Test Customer", "customer_name": "_Test Customer",
"doctype": "Quotation", "doctype": "Quotation",
"fiscal_year": "_Test Fiscal Year 2013", "fiscal_year": "_Test Fiscal Year 2013",
"base_grand_total": 1000.0,
"grand_total": 1000.0, "grand_total": 1000.0,
"grand_total_export": 1000.0,
"order_type": "Sales", "order_type": "Sales",
"plc_conversion_rate": 1.0, "plc_conversion_rate": 1.0,
"price_list_currency": "INR", "price_list_currency": "INR",

File diff suppressed because it is too large Load Diff

View File

@ -142,7 +142,7 @@ class SalesOrder(SellingController):
self.check_credit_limit() self.check_credit_limit()
self.update_stock_ledger(update_stock = 1) self.update_stock_ledger(update_stock = 1)
frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.grand_total, self) frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.base_grand_total, self)
self.update_prevdoc_status('submit') self.update_prevdoc_status('submit')
frappe.db.set(self, 'status', 'Submitted') frappe.db.set(self, 'status', 'Submitted')

View File

@ -1,5 +1,5 @@
frappe.listview_settings['Sales Order'] = { frappe.listview_settings['Sales Order'] = {
add_fields: ["grand_total", "customer_name", "currency", "delivery_date", "per_delivered", "per_billed", add_fields: ["base_grand_total", "customer_name", "currency", "delivery_date", "per_delivered", "per_billed",
"status"], "status"],
get_indicator: function(doc) { get_indicator: function(doc) {
if(doc.status==="Stopped") { if(doc.status==="Stopped") {

View File

@ -10,8 +10,8 @@
"delivery_date": "2013-02-23", "delivery_date": "2013-02-23",
"doctype": "Sales Order", "doctype": "Sales Order",
"fiscal_year": "_Test Fiscal Year 2013", "fiscal_year": "_Test Fiscal Year 2013",
"base_grand_total": 1000.0,
"grand_total": 1000.0, "grand_total": 1000.0,
"grand_total_export": 1000.0,
"naming_series": "_T-Sales Order-", "naming_series": "_T-Sales Order-",
"order_type": "Sales", "order_type": "Sales",
"plc_conversion_rate": 1.0, "plc_conversion_rate": 1.0,

View File

@ -17,7 +17,7 @@ def execute(filters=None):
if filters.get("company"): if filters.get("company"):
company_condition = ' and company=%(company)s' company_condition = ' and company=%(company)s'
for si in frappe.db.sql("""select posting_date, customer, grand_total from `tabSales Invoice` for si in frappe.db.sql("""select posting_date, customer, base_grand_total from `tabSales Invoice`
where docstatus=1 and posting_date <= %(to_date)s where docstatus=1 and posting_date <= %(to_date)s
{company_condition} order by posting_date""".format(company_condition=company_condition), {company_condition} order by posting_date""".format(company_condition=company_condition),
filters, as_dict=1): filters, as_dict=1):
@ -26,12 +26,12 @@ def execute(filters=None):
if not si.customer in customers: if not si.customer in customers:
new_customers_in.setdefault(key, [0, 0.0]) new_customers_in.setdefault(key, [0, 0.0])
new_customers_in[key][0] += 1 new_customers_in[key][0] += 1
new_customers_in[key][1] += si.grand_total new_customers_in[key][1] += si.base_grand_total
customers.append(si.customer) customers.append(si.customer)
else: else:
repeat_customers_in.setdefault(key, [0, 0.0]) repeat_customers_in.setdefault(key, [0, 0.0])
repeat_customers_in[key][0] += 1 repeat_customers_in[key][0] += 1
repeat_customers_in[key][1] += si.grand_total repeat_customers_in[key][1] += si.base_grand_total
# time series # time series
from_year, from_month, temp = filters.get("from_date").split("-") from_year, from_month, temp = filters.get("from_date").split("-")

View File

@ -30,10 +30,10 @@ def get_so_details():
cust.territory, cust.territory,
cust.customer_group, cust.customer_group,
count(distinct(so.name)) as 'num_of_order', count(distinct(so.name)) as 'num_of_order',
sum(net_total) as 'total_order_value', sum(base_net_total) as 'total_order_value',
sum(if(so.status = "Stopped", sum(if(so.status = "Stopped",
so.net_total * so.per_delivered/100, so.base_net_total * so.per_delivered/100,
so.net_total)) as 'total_order_considered', so.base_net_total)) as 'total_order_considered',
max(so.transaction_date) as 'last_sales_order_date', max(so.transaction_date) as 'last_sales_order_date',
DATEDIFF(CURDATE(), max(so.transaction_date)) as 'days_since_last_order' DATEDIFF(CURDATE(), max(so.transaction_date)) as 'days_since_last_order'
from `tabCustomer` cust, `tabSales Order` so from `tabCustomer` cust, `tabSales Order` so
@ -42,7 +42,7 @@ def get_so_details():
order by 'days_since_last_order' desc """,as_list=1) order by 'days_since_last_order' desc """,as_list=1)
def get_last_so_amt(customer): def get_last_so_amt(customer):
res = frappe.db.sql("""select net_total from `tabSales Order` res = frappe.db.sql("""select base_net_total from `tabSales Order`
where customer ='%(customer)s' and docstatus = 1 order by transaction_date desc where customer ='%(customer)s' and docstatus = 1 order by transaction_date desc
limit 1""" % {'customer':customer}) limit 1""" % {'customer':customer})

View File

@ -178,20 +178,20 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
}, },
total_commission: function() { total_commission: function() {
if(this.frm.doc.net_total) { if(this.frm.doc.base_net_total) {
frappe.model.round_floats_in(this.frm.doc, ["net_total", "total_commission"]); frappe.model.round_floats_in(this.frm.doc, ["base_net_total", "total_commission"]);
if(this.frm.doc.net_total < this.frm.doc.total_commission) { if(this.frm.doc.base_net_total < this.frm.doc.total_commission) {
var msg = (__("[Error]") + " " + var msg = (__("[Error]") + " " +
__(frappe.meta.get_label(this.frm.doc.doctype, "total_commission", __(frappe.meta.get_label(this.frm.doc.doctype, "total_commission",
this.frm.doc.name)) + " > " + this.frm.doc.name)) + " > " +
__(frappe.meta.get_label(this.frm.doc.doctype, "net_total", this.frm.doc.name))); __(frappe.meta.get_label(this.frm.doc.doctype, "base_net_total", this.frm.doc.name)));
msgprint(msg); msgprint(msg);
throw msg; throw msg;
} }
this.frm.set_value("commission_rate", this.frm.set_value("commission_rate",
flt(this.frm.doc.total_commission * 100.0 / this.frm.doc.net_total)); flt(this.frm.doc.total_commission * 100.0 / this.frm.doc.base_net_total));
} }
}, },
@ -201,7 +201,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
if(sales_person.allocated_percentage) { if(sales_person.allocated_percentage) {
sales_person.allocated_percentage = flt(sales_person.allocated_percentage, sales_person.allocated_percentage = flt(sales_person.allocated_percentage,
precision("allocated_percentage", sales_person)); precision("allocated_percentage", sales_person));
sales_person.allocated_amount = flt(this.frm.doc.net_total * sales_person.allocated_amount = flt(this.frm.doc.base_net_total *
sales_person.allocated_percentage / 100.0, sales_person.allocated_percentage / 100.0,
precision("allocated_amount", sales_person)); precision("allocated_amount", sales_person));
@ -235,37 +235,37 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
calculate_net_total: function() { calculate_net_total: function() {
var me = this; var me = this;
this.frm.doc.net_total = this.frm.doc.net_total_export = 0.0; this.frm.doc.base_net_total = this.frm.doc.net_total = 0.0;
$.each(this.frm.doc["items"] || [], function(i, item) { $.each(this.frm.doc["items"] || [], function(i, item) {
me.frm.doc.net_total += item.base_amount; me.frm.doc.base_net_total += item.base_amount;
me.frm.doc.net_total_export += item.amount; me.frm.doc.net_total += item.amount;
}); });
frappe.model.round_floats_in(this.frm.doc, ["net_total", "net_total_export"]); frappe.model.round_floats_in(this.frm.doc, ["base_net_total", "net_total"]);
}, },
calculate_totals: function() { calculate_totals: function() {
var me = this; var me = this;
var tax_count = this.frm.doc["taxes"] ? this.frm.doc["taxes"].length: 0; var tax_count = this.frm.doc["taxes"] ? this.frm.doc["taxes"].length: 0;
this.frm.doc.grand_total = flt(tax_count ? this.frm.doc["taxes"][tax_count - 1].total : this.frm.doc.net_total); this.frm.doc.base_grand_total = flt(tax_count ? this.frm.doc["taxes"][tax_count - 1].total : this.frm.doc.base_net_total);
this.frm.doc.other_charges_total = flt(this.frm.doc.grand_total - this.frm.doc.net_total, this.frm.doc.base_total_taxes_and_charges = flt(this.frm.doc.base_grand_total - this.frm.doc.base_net_total,
precision("other_charges_total")); precision("base_total_taxes_and_charges"));
this.frm.doc.grand_total_export = (this.frm.doc.other_charges_total || this.frm.doc.discount_amount) ? this.frm.doc.grand_total = (this.frm.doc.base_total_taxes_and_charges || this.frm.doc.discount_amount) ?
flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total_export; flt(this.frm.doc.base_grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total;
this.frm.doc.other_charges_total_export = flt(this.frm.doc.grand_total_export - this.frm.doc.total_taxes_and_charges = flt(this.frm.doc.grand_total -
this.frm.doc.net_total_export + flt(this.frm.doc.discount_amount), this.frm.doc.net_total + flt(this.frm.doc.discount_amount),
precision("other_charges_total_export")); precision("total_taxes_and_charges"));
this.frm.doc.base_grand_total = flt(this.frm.doc.base_grand_total, precision("base_grand_total"));
this.frm.doc.grand_total = flt(this.frm.doc.grand_total, precision("grand_total")); this.frm.doc.grand_total = flt(this.frm.doc.grand_total, precision("grand_total"));
this.frm.doc.grand_total_export = flt(this.frm.doc.grand_total_export, precision("grand_total_export"));
this.frm.doc.base_rounded_total = Math.round(this.frm.doc.base_grand_total);
this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total); this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total);
this.frm.doc.rounded_total_export = Math.round(this.frm.doc.grand_total_export);
}, },
calculate_outstanding_amount: function(update_paid_amount) { calculate_outstanding_amount: function(update_paid_amount) {
@ -273,9 +273,9 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
// paid_amount and write_off_amount is only for POS Invoice // paid_amount and write_off_amount is only for POS Invoice
// total_advance is only for non POS Invoice // total_advance is only for non POS Invoice
if(this.frm.doc.doctype == "Sales Invoice" && this.frm.doc.docstatus==0) { if(this.frm.doc.doctype == "Sales Invoice" && this.frm.doc.docstatus==0) {
frappe.model.round_floats_in(this.frm.doc, ["grand_total", "total_advance", "write_off_amount", frappe.model.round_floats_in(this.frm.doc, ["base_grand_total", "total_advance", "write_off_amount",
"paid_amount"]); "paid_amount"]);
var total_amount_to_pay = this.frm.doc.grand_total - this.frm.doc.write_off_amount var total_amount_to_pay = this.frm.doc.base_grand_total - this.frm.doc.write_off_amount
- this.frm.doc.total_advance; - this.frm.doc.total_advance;
if(this.frm.doc.is_pos) { if(this.frm.doc.is_pos) {
if(!this.frm.doc.paid_amount || update_paid_amount===undefined || update_paid_amount) { if(!this.frm.doc.paid_amount || update_paid_amount===undefined || update_paid_amount) {
@ -301,7 +301,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
throw msg; throw msg;
} }
this.frm.doc.total_commission = flt(this.frm.doc.net_total * this.frm.doc.commission_rate / 100.0, this.frm.doc.total_commission = flt(this.frm.doc.base_net_total * this.frm.doc.commission_rate / 100.0,
precision("total_commission")); precision("total_commission"));
} }
}, },
@ -312,7 +312,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
frappe.model.round_floats_in(sales_person); frappe.model.round_floats_in(sales_person);
if(sales_person.allocated_percentage) { if(sales_person.allocated_percentage) {
sales_person.allocated_amount = flt( sales_person.allocated_amount = flt(
me.frm.doc.net_total * sales_person.allocated_percentage / 100.0, me.frm.doc.base_net_total * sales_person.allocated_percentage / 100.0,
precision("allocated_amount", sales_person)); precision("allocated_amount", sales_person));
} }
}); });
@ -371,13 +371,13 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
} }
}); });
}; };
setup_field_label_map(["net_total", "other_charges_total", "base_discount_amount", "grand_total", setup_field_label_map(["base_net_total", "base_total_taxes_and_charges", "base_discount_amount", "base_grand_total",
"rounded_total", "in_words", "base_rounded_total", "base_in_words",
"outstanding_amount", "total_advance", "paid_amount", "write_off_amount"], "outstanding_amount", "total_advance", "paid_amount", "write_off_amount"],
company_currency); company_currency);
setup_field_label_map(["net_total_export", "other_charges_total_export", "discount_amount", "grand_total_export", setup_field_label_map(["net_total", "total_taxes_and_charges", "discount_amount", "grand_total",
"rounded_total_export", "in_words_export"], this.frm.doc.currency); "rounded_total", "in_words"], this.frm.doc.currency);
cur_frm.set_df_property("conversion_rate", "description", "1 " + this.frm.doc.currency cur_frm.set_df_property("conversion_rate", "description", "1 " + this.frm.doc.currency
+ " = [?] " + company_currency) + " = [?] " + company_currency)
@ -388,8 +388,8 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
} }
// toggle fields // toggle fields
this.frm.toggle_display(["conversion_rate", "net_total", "other_charges_total", this.frm.toggle_display(["conversion_rate", "base_net_total", "base_total_taxes_and_charges",
"grand_total", "rounded_total", "in_words", "base_discount_amount"], "base_grand_total", "base_rounded_total", "base_in_words", "base_discount_amount"],
this.frm.doc.currency != company_currency); this.frm.doc.currency != company_currency);
this.frm.toggle_display(["plc_conversion_rate", "price_list_currency"], this.frm.toggle_display(["plc_conversion_rate", "price_list_currency"],

View File

@ -246,15 +246,15 @@ class EmailDigest(Document):
date_field="transaction_date") date_field="transaction_date")
def get_new_quotations(self): def get_new_quotations(self):
return self.get_new_sum("Quotation", self.meta.get_label("new_quotations"), "grand_total", return self.get_new_sum("Quotation", self.meta.get_label("new_quotations"), "base_grand_total",
date_field="transaction_date") date_field="transaction_date")
def get_new_sales_orders(self): def get_new_sales_orders(self):
return self.get_new_sum("Sales Order", self.meta.get_label("new_sales_orders"), "grand_total", return self.get_new_sum("Sales Order", self.meta.get_label("new_sales_orders"), "base_grand_total",
date_field="transaction_date") date_field="transaction_date")
def get_new_delivery_notes(self): def get_new_delivery_notes(self):
return self.get_new_sum("Delivery Note", self.meta.get_label("new_delivery_notes"), "grand_total", return self.get_new_sum("Delivery Note", self.meta.get_label("new_delivery_notes"), "base_grand_total",
date_field="posting_date") date_field="posting_date")
def get_new_purchase_requests(self): def get_new_purchase_requests(self):
@ -263,15 +263,15 @@ class EmailDigest(Document):
def get_new_supplier_quotations(self): def get_new_supplier_quotations(self):
return self.get_new_sum("Supplier Quotation", self.meta.get_label("new_supplier_quotations"), return self.get_new_sum("Supplier Quotation", self.meta.get_label("new_supplier_quotations"),
"grand_total", date_field="transaction_date") "base_grand_total", date_field="transaction_date")
def get_new_purchase_orders(self): def get_new_purchase_orders(self):
return self.get_new_sum("Purchase Order", self.meta.get_label("new_purchase_orders"), return self.get_new_sum("Purchase Order", self.meta.get_label("new_purchase_orders"),
"grand_total", date_field="transaction_date") "base_grand_total", date_field="transaction_date")
def get_new_purchase_receipts(self): def get_new_purchase_receipts(self):
return self.get_new_sum("Purchase Receipt", self.meta.get_label("new_purchase_receipts"), return self.get_new_sum("Purchase Receipt", self.meta.get_label("new_purchase_receipts"),
"grand_total", date_field="posting_date") "base_grand_total", date_field="posting_date")
def get_new_stock_entries(self): def get_new_stock_entries(self):
return self.get_new_sum("Stock Entry", self.meta.get_label("new_stock_entries"), "total_amount", return self.get_new_sum("Stock Entry", self.meta.get_label("new_stock_entries"), "total_amount",

View File

@ -57,8 +57,8 @@ class GlobalDefaults(Document):
# Make property setters to hide rounded total fields # Make property setters to hide rounded total fields
for doctype in ("Quotation", "Sales Order", "Sales Invoice", "Delivery Note"): for doctype in ("Quotation", "Sales Order", "Sales Invoice", "Delivery Note"):
make_property_setter(doctype, "rounded_total", "hidden", self.disable_rounded_total, "Check") make_property_setter(doctype, "base_rounded_total", "hidden", self.disable_rounded_total, "Check")
make_property_setter(doctype, "rounded_total", "print_hide", 1, "Check") make_property_setter(doctype, "base_rounded_total", "print_hide", 1, "Check")
make_property_setter(doctype, "rounded_total_export", "hidden", self.disable_rounded_total, "Check") make_property_setter(doctype, "rounded_total", "hidden", self.disable_rounded_total, "Check")
make_property_setter(doctype, "rounded_total_export", "print_hide", self.disable_rounded_total, "Check") make_property_setter(doctype, "rounded_total", "print_hide", self.disable_rounded_total, "Check")

View File

@ -144,7 +144,7 @@ def decorate_quotation_doc(quotation_doc):
d["formatted_tax_amount"] = fmt_money(flt(d.get("tax_amount")) / doc.conversion_rate, d["formatted_tax_amount"] = fmt_money(flt(d.get("tax_amount")) / doc.conversion_rate,
currency=doc.currency) currency=doc.currency)
doc.formatted_grand_total_export = fmt_money(doc.grand_total_export, doc.formatted_grand_total_export = fmt_money(doc.grand_total,
currency=doc.currency) currency=doc.currency)
return doc return doc

View File

@ -84,7 +84,7 @@ class TestShoppingCart(unittest.TestCase):
self.assertEquals(quotation.get("items")[0].item_code, "_Test Item") self.assertEquals(quotation.get("items")[0].item_code, "_Test Item")
self.assertEquals(quotation.get("items")[0].qty, 5) self.assertEquals(quotation.get("items")[0].qty, 5)
self.assertEquals(quotation.get("items")[0].amount, 50) self.assertEquals(quotation.get("items")[0].amount, 50)
self.assertEquals(quotation.net_total, 70) self.assertEquals(quotation.base_net_total, 70)
self.assertEquals(len(quotation.get("items")), 2) self.assertEquals(len(quotation.get("items")), 2)
def test_remove_from_cart(self): def test_remove_from_cart(self):
@ -97,13 +97,13 @@ class TestShoppingCart(unittest.TestCase):
self.assertEquals(quotation.get("items")[0].item_code, "_Test Item 2") self.assertEquals(quotation.get("items")[0].item_code, "_Test Item 2")
self.assertEquals(quotation.get("items")[0].qty, 1) self.assertEquals(quotation.get("items")[0].qty, 1)
self.assertEquals(quotation.get("items")[0].amount, 20) self.assertEquals(quotation.get("items")[0].amount, 20)
self.assertEquals(quotation.net_total, 20) self.assertEquals(quotation.base_net_total, 20)
self.assertEquals(len(quotation.get("items")), 1) self.assertEquals(len(quotation.get("items")), 1)
# remove second item # remove second item
set_item_in_cart("_Test Item 2", 0) set_item_in_cart("_Test Item 2", 0)
quotation = self.test_get_cart_lead() quotation = self.test_get_cart_lead()
self.assertEquals(quotation.net_total, 0) self.assertEquals(quotation.base_net_total, 0)
self.assertEquals(len(quotation.get("items")), 0) self.assertEquals(len(quotation.get("items")), 0)
def test_set_billing_address(self): def test_set_billing_address(self):

View File

@ -1110,7 +1110,7 @@
} }
], ],
"read_only_onload": 1, "read_only_onload": 1,
"search_fields": "status,customer,customer_name, territory,grand_total", "search_fields": "status,customer,customer_name, territory,base_grand_total",
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"title_field": "customer_name" "title_field": "customer_name"

View File

@ -67,7 +67,7 @@ class DeliveryNote(SellingController):
item_meta = frappe.get_meta("Delivery Note Item") item_meta = frappe.get_meta("Delivery Note Item")
print_hide_fields = { print_hide_fields = {
"parent": ["grand_total_export", "rounded_total_export", "in_words_export", "currency", "net_total_export"], "parent": ["grand_total", "rounded_total", "in_words", "currency", "net_total"],
"items": ["rate", "amount", "price_list_rate", "discount_percentage"] "items": ["rate", "amount", "price_list_rate", "discount_percentage"]
} }
@ -186,7 +186,7 @@ class DeliveryNote(SellingController):
self.validate_packed_qty() self.validate_packed_qty()
# Check for Approving Authority # Check for Approving Authority
frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.grand_total, self) frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.base_grand_total, self)
# update delivered qty in sales order # update delivered qty in sales order
self.update_prevdoc_status() self.update_prevdoc_status()

View File

@ -1,4 +1,4 @@
frappe.listview_settings['Delivery Note'] = { frappe.listview_settings['Delivery Note'] = {
add_fields: ["customer", "customer_name", "grand_total", "per_installed", add_fields: ["customer", "customer_name", "base_grand_total", "per_installed",
"transporter_name", "grand_total_export"] "transporter_name", "grand_total"]
}; };

View File

@ -24,10 +24,10 @@
], ],
"doctype": "Delivery Note", "doctype": "Delivery Note",
"fiscal_year": "_Test Fiscal Year 2013", "fiscal_year": "_Test Fiscal Year 2013",
"base_grand_total": 500.0,
"grand_total": 500.0, "grand_total": 500.0,
"grand_total_export": 500.0,
"naming_series": "_T-Delivery Note-", "naming_series": "_T-Delivery Note-",
"net_total": 500.0, "base_net_total": 500.0,
"plc_conversion_rate": 1.0, "plc_conversion_rate": 1.0,
"posting_date": "2013-02-21", "posting_date": "2013-02-21",
"posting_time": "9:00:00", "posting_time": "9:00:00",

View File

@ -21,7 +21,7 @@ erpnext.stock.LandedCostVoucher = erpnext.stock.StockController.extend({
this.frm.add_fetch("purchase_receipt", "supplier", "supplier"); this.frm.add_fetch("purchase_receipt", "supplier", "supplier");
this.frm.add_fetch("purchase_receipt", "posting_date", "posting_date"); this.frm.add_fetch("purchase_receipt", "posting_date", "posting_date");
this.frm.add_fetch("purchase_receipt", "grand_total", "grand_total"); this.frm.add_fetch("purchase_receipt", "base_grand_total", "grand_total");
}, },

View File

@ -80,7 +80,7 @@ class TestLandedCostVoucher(unittest.TestCase):
"purchase_receipt": pr.name, "purchase_receipt": pr.name,
"supplier": pr.supplier, "supplier": pr.supplier,
"posting_date": pr.posting_date, "posting_date": pr.posting_date,
"grand_total": pr.grand_total "grand_total": pr.base_grand_total
}]) }])
lcv.set("taxes", [{ lcv.set("taxes", [{
"description": "Insurance Charges", "description": "Insurance Charges",

View File

@ -212,7 +212,7 @@ class PurchaseReceipt(BuyingController):
purchase_controller = frappe.get_doc("Purchase Common") purchase_controller = frappe.get_doc("Purchase Common")
# Check for Approving Authority # Check for Approving Authority
frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.grand_total) frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.base_grand_total)
# Set status as Submitted # Set status as Submitted
frappe.db.set(self, 'status', 'Submitted') frappe.db.set(self, 'status', 'Submitted')

View File

@ -1,4 +1,4 @@
frappe.listview_settings['Purchase Receipt'] = { frappe.listview_settings['Purchase Receipt'] = {
add_fields: ["supplier", "supplier_name", "grand_total", "is_subcontracted", add_fields: ["supplier", "supplier_name", "base_grand_total", "is_subcontracted",
"transporter_name"] "transporter_name"]
}; };

View File

@ -6,9 +6,9 @@
"currency": "INR", "currency": "INR",
"doctype": "Purchase Receipt", "doctype": "Purchase Receipt",
"fiscal_year": "_Test Fiscal Year 2013", "fiscal_year": "_Test Fiscal Year 2013",
"grand_total": 720.0, "base_grand_total": 720.0,
"naming_series": "_T-Purchase Receipt-", "naming_series": "_T-Purchase Receipt-",
"net_total": 500.0, "base_net_total": 500.0,
"taxes": [ "taxes": [
{ {
"account_head": "_Test Account Shipping Charges - _TC", "account_head": "_Test Account Shipping Charges - _TC",
@ -94,9 +94,9 @@
"currency": "INR", "currency": "INR",
"doctype": "Purchase Receipt", "doctype": "Purchase Receipt",
"fiscal_year": "_Test Fiscal Year 2013", "fiscal_year": "_Test Fiscal Year 2013",
"grand_total": 5000.0, "base_grand_total": 5000.0,
"is_subcontracted": "Yes", "is_subcontracted": "Yes",
"net_total": 5000.0, "base_net_total": 5000.0,
"posting_date": "2013-02-12", "posting_date": "2013-02-12",
"posting_time": "15:33:30", "posting_time": "15:33:30",
"items": [ "items": [

View File

@ -55,7 +55,7 @@
<tr> <tr>
<td>Net Total</td> <td>Net Total</td>
<td width=40% style="text-align: right;">{{ <td width=40% style="text-align: right;">{{
frappe.utils.fmt_money(doc.net_total/doc.conversion_rate, currency=doc.currency) frappe.utils.fmt_money(doc.base_net_total/doc.conversion_rate, currency=doc.currency)
}}</td> }}</td>
</tr> </tr>
{%- for charge in doc.get({"doctype":"Sales Taxes and Charges"}) -%} {%- for charge in doc.get({"doctype":"Sales Taxes and Charges"}) -%}
@ -68,11 +68,11 @@
{%- endfor -%} {%- endfor -%}
<tr> <tr>
<td>Grand Total</td> <td>Grand Total</td>
<td style="text-align: right;">{{ frappe.utils.fmt_money(doc.grand_total_export, currency=doc.currency) }}</td> <td style="text-align: right;">{{ frappe.utils.fmt_money(doc.grand_total, currency=doc.currency) }}</td>
</tr> </tr>
<tr style='font-weight: bold'> <tr style='font-weight: bold'>
<td>Rounded Total</td> <td>Rounded Total</td>
<td style="text-align: right;">{{ frappe.utils.fmt_money(doc.rounded_total_export, currency=doc.currency) }}</td> <td style="text-align: right;">{{ frappe.utils.fmt_money(doc.rounded_total, currency=doc.currency) }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -10,7 +10,7 @@ $(document).ready(function() {
<script> <script>
var render = function(doc) { var render = function(doc) {
doc.grand_total_export = format_currency(doc.grand_total_export, doc.currency); doc.grand_total = format_currency(doc.grand_total, doc.currency);
if(!doc.status) doc.status = ""; if(!doc.status) doc.status = "";
$(repl('<a href="{{ page }}?name=%(name)s" class="list-group-item">\ $(repl('<a href="{{ page }}?name=%(name)s" class="list-group-item">\
@ -20,7 +20,7 @@ $(document).ready(function() {
<div class="row col-md-12 text-muted">%(items)s</div>\ <div class="row col-md-12 text-muted">%(items)s</div>\
<div class="row col-md-12">%(status)s</div>\ <div class="row col-md-12">%(status)s</div>\
</div>\ </div>\
<div class="col-md-3 text-right">%(grand_total_export)s</div>\ <div class="col-md-3 text-right">%(grand_total)s</div>\
<div class="col-md-3 text-right text-muted">%(creation)s</div>\ <div class="col-md-3 text-right text-muted">%(creation)s</div>\
</div>\ </div>\
</a>', doc)).appendTo($list); </a>', doc)).appendTo($list);

View File

@ -33,7 +33,7 @@ def get_transaction_list(doctype, start, additional_fields=None):
else: else:
additional_fields = "" additional_fields = ""
transactions = frappe.db.sql("""select name, creation, currency, grand_total_export transactions = frappe.db.sql("""select name, creation, currency, grand_total
%s %s
from `tab%s` where customer=%s and docstatus=1 from `tab%s` where customer=%s and docstatus=1
order by creation desc order by creation desc