Replaced renamed total fields in code files
This commit is contained in:
parent
dd1c2d3018
commit
5690be103c
@ -54,17 +54,17 @@ class CForm(Document):
|
||||
frappe.throw(_("Please enter atleast 1 invoice in the table"))
|
||||
|
||||
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)
|
||||
|
||||
def get_invoice_details(self, invoice_no):
|
||||
""" Pull details from invoices for referrence """
|
||||
if 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 {
|
||||
'invoice_date' : inv.posting_date,
|
||||
'territory' : inv.territory,
|
||||
'net_total' : inv.net_total,
|
||||
'grand_total' : inv.grand_total
|
||||
'net_total' : inv.base_net_total,
|
||||
'grand_total' : inv.base_grand_total
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ class JournalEntry(AccountsController):
|
||||
def validate_against_order_fields(self, doctype, payment_against_voucher):
|
||||
for voucher_no, payment_list in payment_against_voucher.items():
|
||||
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:
|
||||
frappe.throw(_("{0} {1} is not submitted").format(doctype, voucher_no))
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// 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{
|
||||
filters: [
|
||||
['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]
|
||||
]
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -82,8 +82,8 @@ def get_orders_to_be_billed(party_type, party):
|
||||
orders = frappe.db.sql("""
|
||||
select
|
||||
name as voucher_no,
|
||||
ifnull(grand_total, 0) as invoice_amount,
|
||||
(ifnull(grand_total, 0) - ifnull(advance_paid, 0)) as outstanding_amount,
|
||||
ifnull(base_grand_total, 0) as invoice_amount,
|
||||
(ifnull(base_grand_total, 0) - ifnull(advance_paid, 0)) as outstanding_amount,
|
||||
transaction_date as posting_date
|
||||
from
|
||||
`tab%s`
|
||||
@ -91,7 +91,7 @@ def get_orders_to_be_billed(party_type, party):
|
||||
%s = %s
|
||||
and docstatus = 1
|
||||
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
|
||||
""" % (voucher_type, 'customer' if party_type == "Customer" else 'supplier', '%s'),
|
||||
party, as_dict = True)
|
||||
@ -106,9 +106,9 @@ def get_orders_to_be_billed(party_type, party):
|
||||
@frappe.whitelist()
|
||||
def get_against_voucher_amount(against_voucher_type, against_voucher_no):
|
||||
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"]:
|
||||
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":
|
||||
select_cond = "total_debit as total_amount"
|
||||
|
||||
|
@ -978,7 +978,7 @@
|
||||
}
|
||||
],
|
||||
"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_order": "DESC",
|
||||
"title_field": "supplier_name"
|
||||
|
@ -240,7 +240,7 @@ class PurchaseInvoice(BuyingController):
|
||||
self.check_prev_docstatus()
|
||||
|
||||
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
|
||||
self.make_gl_entries()
|
||||
@ -258,7 +258,7 @@ class PurchaseInvoice(BuyingController):
|
||||
gl_entries = []
|
||||
|
||||
# parent's gl entry
|
||||
if self.grand_total:
|
||||
if self.base_grand_total:
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": self.credit_to,
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
// render
|
||||
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"],
|
||||
get_indicator: function(doc) {
|
||||
if(doc.outstanding_amount > 0 && doc.docstatus==1) {
|
||||
|
@ -145,7 +145,7 @@ class TestPurchaseInvoice(unittest.TestCase):
|
||||
self.assertEqual(item.item_tax_amount, expected_values[i][1])
|
||||
self.assertEqual(item.valuation_rate, expected_values[i][2])
|
||||
|
||||
self.assertEqual(wrapper.net_total, 1250)
|
||||
self.assertEqual(wrapper.base_net_total, 1250)
|
||||
|
||||
# tax amounts
|
||||
expected_values = [
|
||||
@ -179,7 +179,7 @@ class TestPurchaseInvoice(unittest.TestCase):
|
||||
self.assertEqual(item.item_tax_amount, expected_values[i][1])
|
||||
self.assertEqual(item.valuation_rate, expected_values[i][2])
|
||||
|
||||
self.assertEqual(wrapper.net_total, 1250)
|
||||
self.assertEqual(wrapper.base_net_total, 1250)
|
||||
|
||||
# tax amounts
|
||||
expected_values = [
|
||||
|
@ -41,7 +41,7 @@
|
||||
}
|
||||
],
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"grand_total_import": 0,
|
||||
"grand_total": 0,
|
||||
"naming_series": "_T-BILL",
|
||||
"taxes": [
|
||||
{
|
||||
@ -164,7 +164,7 @@
|
||||
}
|
||||
],
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"grand_total_import": 0,
|
||||
"grand_total": 0,
|
||||
"naming_series": "_T-Purchase Invoice-",
|
||||
"taxes": [
|
||||
{
|
||||
|
@ -8,15 +8,15 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
}
|
||||
|
||||
// For customizing print
|
||||
cur_frm.pformat.net_total_import = function(doc) {
|
||||
cur_frm.pformat.net_total = function(doc) {
|
||||
return '';
|
||||
}
|
||||
|
||||
cur_frm.pformat.grand_total_import = function(doc) {
|
||||
cur_frm.pformat.grand_total = function(doc) {
|
||||
return '';
|
||||
}
|
||||
|
||||
cur_frm.pformat.in_words_import = function(doc) {
|
||||
cur_frm.pformat.in_words = function(doc) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@ -49,8 +49,8 @@ cur_frm.pformat.taxes= function(doc) {
|
||||
|
||||
// main table
|
||||
out +='<table class="noborder" style="width:100%">';
|
||||
if(!print_hide('net_total_import'))
|
||||
out += make_row('Net Total', doc.net_total_import, 1);
|
||||
if(!print_hide('net_total'))
|
||||
out += make_row('Net Total', doc.net_total, 1);
|
||||
|
||||
// add rows
|
||||
if(cl.length){
|
||||
@ -60,14 +60,14 @@ cur_frm.pformat.taxes= function(doc) {
|
||||
}
|
||||
|
||||
// grand total
|
||||
if(!print_hide('grand_total_import'))
|
||||
out += make_row('Grand Total', doc.grand_total_import, 1);
|
||||
if(!print_hide('grand_total'))
|
||||
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 += '<tr><td colspan = "2">';
|
||||
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>';
|
||||
|
@ -54,7 +54,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
frappe.set_route("query-report", "General Ledger");
|
||||
}, "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.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() {
|
||||
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.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"))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1258,7 +1258,7 @@
|
||||
}
|
||||
],
|
||||
"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_order": "DESC",
|
||||
"title_field": "customer_name"
|
||||
|
@ -77,7 +77,7 @@ class SalesInvoice(SellingController):
|
||||
# Check for Approving Authority
|
||||
if not self.recurring_id:
|
||||
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()
|
||||
|
||||
@ -329,7 +329,7 @@ class SalesInvoice(SellingController):
|
||||
frappe.throw(_("Cash or Bank Account is mandatory for making payment entry"))
|
||||
|
||||
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"""))
|
||||
|
||||
|
||||
@ -410,7 +410,7 @@ class SalesInvoice(SellingController):
|
||||
if flt(self.paid_amount) == 0:
|
||||
if self.cash_bank_account:
|
||||
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:
|
||||
# show message that the amount is not paid
|
||||
frappe.db.set(self,'paid_amount',0)
|
||||
@ -483,14 +483,14 @@ class SalesInvoice(SellingController):
|
||||
return gl_entries
|
||||
|
||||
def make_customer_gl_entry(self, gl_entries):
|
||||
if self.grand_total:
|
||||
if self.base_grand_total:
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": self.debit_to,
|
||||
"party_type": "Customer",
|
||||
"party": self.customer,
|
||||
"against": self.against_income_account,
|
||||
"debit": self.grand_total,
|
||||
"debit": self.base_grand_total,
|
||||
"remarks": self.remarks,
|
||||
"against_voucher": self.name,
|
||||
"against_voucher_type": self.doctype,
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
// render
|
||||
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"],
|
||||
get_indicator: function(doc) {
|
||||
if(doc.outstanding_amount==0) {
|
||||
@ -14,5 +14,5 @@ frappe.listview_settings['Sales Invoice'] = {
|
||||
return [__("Overdue"), "red", "outstanding_amount,>,0|due_date,<=,Today"]
|
||||
}
|
||||
},
|
||||
right_column: "grand_total_export"
|
||||
right_column: "grand_total"
|
||||
};
|
||||
|
@ -25,11 +25,11 @@
|
||||
}
|
||||
],
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"base_grand_total": 561.8,
|
||||
"grand_total": 561.8,
|
||||
"grand_total_export": 561.8,
|
||||
"is_pos": 0,
|
||||
"naming_series": "_T-Sales Invoice-",
|
||||
"net_total": 500.0,
|
||||
"base_net_total": 500.0,
|
||||
"taxes": [
|
||||
{
|
||||
"account_head": "_Test Account VAT - _TC",
|
||||
@ -95,11 +95,11 @@
|
||||
}
|
||||
],
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"base_grand_total": 630.0,
|
||||
"grand_total": 630.0,
|
||||
"grand_total_export": 630.0,
|
||||
"is_pos": 0,
|
||||
"naming_series": "_T-Sales Invoice-",
|
||||
"net_total": 500.0,
|
||||
"base_net_total": 500.0,
|
||||
"taxes": [
|
||||
{
|
||||
"account_head": "_Test Account VAT - _TC",
|
||||
@ -163,7 +163,7 @@
|
||||
}
|
||||
],
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"grand_total_export": 0,
|
||||
"grand_total": 0,
|
||||
"is_pos": 0,
|
||||
"naming_series": "_T-Sales Invoice-",
|
||||
"taxes": [
|
||||
@ -287,7 +287,7 @@
|
||||
}
|
||||
],
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"grand_total_export": 0,
|
||||
"grand_total": 0,
|
||||
"is_pos": 0,
|
||||
"naming_series": "_T-Sales Invoice-",
|
||||
"taxes": [
|
||||
|
@ -53,8 +53,8 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
self.assertEquals(d.get(k), expected_values[d.item_code][i])
|
||||
|
||||
# check net total
|
||||
self.assertEquals(si.base_net_total, 1250)
|
||||
self.assertEquals(si.net_total, 1250)
|
||||
self.assertEquals(si.net_total_export, 1250)
|
||||
|
||||
# check tax calculation
|
||||
expected_values = {
|
||||
@ -73,8 +73,8 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
for i, k in enumerate(expected_values["keys"]):
|
||||
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_export, 1627.05)
|
||||
|
||||
def test_sales_invoice_calculation_export_currency(self):
|
||||
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])
|
||||
|
||||
# check net total
|
||||
self.assertEquals(si.net_total, 1250)
|
||||
self.assertEquals(si.net_total_export, 25)
|
||||
self.assertEquals(si.base_net_total, 1250)
|
||||
self.assertEquals(si.net_total, 25)
|
||||
|
||||
# check tax calculation
|
||||
expected_values = {
|
||||
@ -123,8 +123,8 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
for i, k in enumerate(expected_values["keys"]):
|
||||
self.assertEquals(d.get(k), expected_values[d.account_head][i])
|
||||
|
||||
self.assertEquals(si.grand_total, 1627.05)
|
||||
self.assertEquals(si.grand_total_export, 32.54)
|
||||
self.assertEquals(si.base_grand_total, 1627.05)
|
||||
self.assertEquals(si.grand_total, 32.54)
|
||||
|
||||
def test_sales_invoice_discount_amount(self):
|
||||
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])
|
||||
|
||||
# check net total
|
||||
self.assertEquals(si.net_total, 1163.45)
|
||||
self.assertEquals(si.net_total_export, 1578.3)
|
||||
self.assertEquals(si.base_net_total, 1163.45)
|
||||
self.assertEquals(si.net_total, 1578.3)
|
||||
|
||||
# check tax calculation
|
||||
expected_values = {
|
||||
@ -178,8 +178,8 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
for i, k in enumerate(expected_values["keys"]):
|
||||
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_export, 1500)
|
||||
|
||||
def test_discount_amount_gl_entry(self):
|
||||
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])
|
||||
|
||||
# check net total
|
||||
self.assertEquals(si.net_total, 1249.98)
|
||||
self.assertEquals(si.net_total_export, 1578.3)
|
||||
self.assertEquals(si.base_net_total, 1249.98)
|
||||
self.assertEquals(si.net_total, 1578.3)
|
||||
|
||||
# check tax calculation
|
||||
expected_values = {
|
||||
@ -288,8 +288,8 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
for i, k in enumerate(expected_values["keys"]):
|
||||
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_export, 1622.98)
|
||||
|
||||
def test_sales_invoice_calculation_export_currency_with_tax_inclusive_price(self):
|
||||
# prepare
|
||||
@ -320,8 +320,8 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
self.assertEquals(d.get(k), expected_values[d.item_code][i])
|
||||
|
||||
# check net total
|
||||
self.assertEquals(si.net_total, 49501.7)
|
||||
self.assertEquals(si.net_total_export, 1250)
|
||||
self.assertEquals(si.base_net_total, 49501.7)
|
||||
self.assertEquals(si.net_total, 1250)
|
||||
|
||||
# check tax calculation
|
||||
expected_values = {
|
||||
@ -340,12 +340,12 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
for i, k in enumerate(expected_values["keys"]):
|
||||
self.assertEquals(d.get(k), expected_values[d.account_head][i])
|
||||
|
||||
self.assertEquals(si.grand_total, 65205.16)
|
||||
self.assertEquals(si.grand_total_export, 1304.1)
|
||||
self.assertEquals(si.base_grand_total, 65205.16)
|
||||
self.assertEquals(si.grand_total, 1304.1)
|
||||
|
||||
def test_outstanding(self):
|
||||
w = self.make()
|
||||
self.assertEquals(w.outstanding_amount, w.grand_total)
|
||||
self.assertEquals(w.outstanding_amount, w.base_grand_total)
|
||||
|
||||
def test_payment(self):
|
||||
frappe.db.sql("""delete from `tabGL Entry`""")
|
||||
|
@ -13,7 +13,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
}
|
||||
|
||||
// For customizing print
|
||||
cur_frm.pformat.net_total_export = function(doc) {
|
||||
cur_frm.pformat.net_total = function(doc) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@ -21,15 +21,15 @@ cur_frm.pformat.discount_amount = function(doc) {
|
||||
return '';
|
||||
}
|
||||
|
||||
cur_frm.pformat.grand_total_export = function(doc) {
|
||||
cur_frm.pformat.grand_total = function(doc) {
|
||||
return '';
|
||||
}
|
||||
|
||||
cur_frm.pformat.rounded_total_export = function(doc) {
|
||||
cur_frm.pformat.rounded_total = function(doc) {
|
||||
return '';
|
||||
}
|
||||
|
||||
cur_frm.pformat.in_words_export = function(doc) {
|
||||
cur_frm.pformat.in_words = function(doc) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@ -63,8 +63,8 @@ cur_frm.pformat.taxes= function(doc){
|
||||
|
||||
out +='<table class="noborder" style="width:100%">';
|
||||
|
||||
if(!print_hide('net_total_export')) {
|
||||
out += make_row('Net Total', doc.net_total_export, 1);
|
||||
if(!print_hide('net_total')) {
|
||||
out += make_row('Net Total', doc.net_total, 1);
|
||||
}
|
||||
|
||||
// add rows
|
||||
@ -80,17 +80,17 @@ cur_frm.pformat.taxes= function(doc){
|
||||
out += make_row('Discount Amount', doc.discount_amount, 0);
|
||||
|
||||
// grand total
|
||||
if(!print_hide('grand_total_export'))
|
||||
out += make_row('Grand Total', doc.grand_total_export, 1);
|
||||
if(!print_hide('grand_total'))
|
||||
out += make_row('Grand Total', doc.grand_total, 1);
|
||||
|
||||
if(!print_hide('rounded_total_export'))
|
||||
out += make_row('Rounded Total', doc.rounded_total_export, 1);
|
||||
if(!print_hide('rounded_total'))
|
||||
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 += '<tr><td colspan = "2">';
|
||||
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>';
|
||||
}
|
||||
|
@ -3,9 +3,9 @@
|
||||
"doc_type": "Sales Invoice",
|
||||
"docstatus": 0,
|
||||
"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,
|
||||
"modified": "2014-12-26 02:08:26.603223",
|
||||
"modified": "2015-02-12 02:08:26.603223",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "POS Invoice",
|
||||
|
@ -68,7 +68,7 @@ def get_items(filters):
|
||||
match_conditions = frappe.build_match_conditions("Purchase Invoice")
|
||||
|
||||
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.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
|
||||
@ -107,7 +107,7 @@ def get_tax_accounts(item_list, columns):
|
||||
elif charge_type == "Actual" and tax_amount:
|
||||
for d in invoice_wise_items.get(parent, []):
|
||||
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()
|
||||
columns += [account_head + ":Currency:80" for account_head in tax_accounts]
|
||||
|
@ -67,7 +67,7 @@ def get_conditions(filters):
|
||||
def get_items(filters):
|
||||
conditions = get_conditions(filters)
|
||||
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.qty, si_item.base_rate, si_item.base_amount, si.customer_name,
|
||||
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:
|
||||
for d in invoice_wise_items.get(parent, []):
|
||||
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()
|
||||
columns += [account_head + ":Currency:80" for account_head in tax_accounts]
|
||||
|
@ -35,14 +35,14 @@ def execute(filters=None):
|
||||
", ".join(purchase_order), ", ".join(purchase_receipt)]
|
||||
|
||||
# map expense values
|
||||
net_total = 0
|
||||
base_net_total = 0
|
||||
for expense_acc in expense_accounts:
|
||||
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)
|
||||
|
||||
# net total
|
||||
row.append(net_total or inv.net_total)
|
||||
row.append(base_net_total or inv.base_net_total)
|
||||
|
||||
# tax account
|
||||
total_tax = 0
|
||||
@ -53,7 +53,7 @@ def execute(filters=None):
|
||||
row.append(tax_amount)
|
||||
|
||||
# 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)
|
||||
# raise Exception
|
||||
|
||||
@ -108,7 +108,7 @@ def get_conditions(filters):
|
||||
def get_invoices(filters):
|
||||
conditions = get_conditions(filters)
|
||||
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
|
||||
order by posting_date desc, name desc""" % conditions, filters, as_dict=1)
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
{
|
||||
"apply_user_permissions": 1,
|
||||
"creation": "2013-05-06 12:28:23",
|
||||
"docstatus": 0,
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2014-06-03 07:18:17.302063",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Partners Commission",
|
||||
"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\"",
|
||||
"ref_doctype": "Sales Invoice",
|
||||
"report_name": "Sales Partners Commission",
|
||||
"apply_user_permissions": 1,
|
||||
"creation": "2013-05-06 12:28:23",
|
||||
"docstatus": 0,
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2015-02-12 07:18:17.302063",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Partners Commission",
|
||||
"owner": "Administrator",
|
||||
"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",
|
||||
"report_name": "Sales Partners Commission",
|
||||
"report_type": "Query Report"
|
||||
}
|
||||
}
|
||||
|
@ -34,14 +34,14 @@ def execute(filters=None):
|
||||
inv.debit_to, inv.project_name, inv.remarks, ", ".join(sales_order), ", ".join(delivery_note)]
|
||||
|
||||
# map income values
|
||||
net_total = 0
|
||||
base_net_total = 0
|
||||
for income_acc in income_accounts:
|
||||
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)
|
||||
|
||||
# net total
|
||||
row.append(net_total or inv.net_total)
|
||||
row.append(base_net_total or inv.base_net_total)
|
||||
|
||||
# tax account
|
||||
total_tax = 0
|
||||
@ -52,7 +52,7 @@ def execute(filters=None):
|
||||
row.append(tax_amount)
|
||||
|
||||
# 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)
|
||||
|
||||
@ -107,7 +107,7 @@ def get_conditions(filters):
|
||||
def get_invoices(filters):
|
||||
conditions = get_conditions(filters)
|
||||
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`
|
||||
where docstatus = 1 %s order by posting_date desc, name desc""" %
|
||||
conditions, filters, as_dict=1)
|
||||
|
@ -175,65 +175,65 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||
calculate_net_total: function() {
|
||||
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) {
|
||||
me.frm.doc.net_total += item.base_amount;
|
||||
me.frm.doc.net_total_import += item.amount;
|
||||
me.frm.doc.base_net_total += item.base_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() {
|
||||
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
|
||||
if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total", this.frm.doc.name)) {
|
||||
this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total);
|
||||
if(frappe.meta.get_docfield(this.frm.doc.doctype, "base_rounded_total", this.frm.doc.name)) {
|
||||
this.frm.doc.base_rounded_total = Math.round(this.frm.doc.base_grand_total);
|
||||
}
|
||||
|
||||
// other charges added/deducted
|
||||
this.frm.doc.other_charges_added = 0.0
|
||||
this.frm.doc.other_charges_deducted = 0.0
|
||||
this.frm.doc.base_taxes_and_charges_added = 0.0
|
||||
this.frm.doc.base_taxes_and_charges_deducted = 0.0
|
||||
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"
|
||||
&& in_list(["Valuation and Total", "Total"], tax.category)) ?
|
||||
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"
|
||||
&& in_list(["Valuation and Total", "Total"], tax.category)) ?
|
||||
tax.tax_amount : 0.0; }));
|
||||
|
||||
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) ?
|
||||
flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total_import);
|
||||
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.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)) {
|
||||
this.frm.doc.rounded_total_import = Math.round(this.frm.doc.grand_total_import);
|
||||
if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total", this.frm.doc.name)) {
|
||||
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.conversion_rate, precision("other_charges_added_import"));
|
||||
this.frm.doc.other_charges_deducted_import = flt(this.frm.doc.other_charges_deducted /
|
||||
this.frm.doc.conversion_rate, precision("other_charges_deducted_import"));
|
||||
this.frm.doc.taxes_and_charges_added = flt(this.frm.doc.base_taxes_and_charges_added /
|
||||
this.frm.doc.conversion_rate, precision("taxes_and_charges_added"));
|
||||
this.frm.doc.taxes_and_charges_deducted = flt(this.frm.doc.base_taxes_and_charges_deducted /
|
||||
this.frm.doc.conversion_rate, precision("taxes_and_charges_deducted"));
|
||||
},
|
||||
|
||||
calculate_outstanding_amount: function() {
|
||||
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"]);
|
||||
this.frm.doc.total_amount_to_pay = flt(this.frm.doc.grand_total - this.frm.doc.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.base_grand_total - this.frm.doc.write_off_amount,
|
||||
precision("total_amount_to_pay"));
|
||||
this.frm.doc.outstanding_amount = flt(this.frm.doc.total_amount_to_pay - this.frm.doc.total_advance,
|
||||
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",
|
||||
"other_charges_added", "other_charges_deducted",
|
||||
"outstanding_amount", "total_advance", "total_amount_to_pay", "rounded_total"],
|
||||
setup_field_label_map(["base_net_total", "base_total_taxes_and_charges", "base_grand_total", "base_in_words",
|
||||
"base_taxes_and_charges_added", "base_taxes_and_charges_deducted",
|
||||
"outstanding_amount", "total_advance", "total_amount_to_pay", "base_rounded_total"],
|
||||
company_currency);
|
||||
|
||||
setup_field_label_map(["net_total_import", "grand_total_import", "in_words_import",
|
||||
"other_charges_added_import", "other_charges_deducted_import"], this.frm.doc.currency);
|
||||
setup_field_label_map(["net_total", "grand_total", "in_words",
|
||||
"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
|
||||
+ " = [?] " + company_currency);
|
||||
@ -284,8 +284,8 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||
}
|
||||
|
||||
// toggle fields
|
||||
this.frm.toggle_display(["conversion_rate", "net_total", "grand_total",
|
||||
"in_words", "other_charges_added", "other_charges_deducted"],
|
||||
this.frm.toggle_display(["conversion_rate", "base_net_total", "base_grand_total",
|
||||
"base_in_words", "base_taxes_and_charges_added", "base_taxes_and_charges_deducted"],
|
||||
this.frm.doc.currency !== company_currency);
|
||||
|
||||
this.frm.toggle_display(["plc_conversion_rate", "price_list_currency"],
|
||||
|
@ -854,7 +854,7 @@
|
||||
}
|
||||
],
|
||||
"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_order": "DESC",
|
||||
"title_field": "supplier_name"
|
||||
|
@ -183,7 +183,7 @@ class PurchaseOrder(BuyingController):
|
||||
self.update_ordered_qty()
|
||||
|
||||
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)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
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"],
|
||||
get_indicator: function(doc) {
|
||||
if(doc.status==="Stopped") {
|
||||
|
@ -7,11 +7,11 @@
|
||||
"currency": "INR",
|
||||
"doctype": "Purchase Order",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"base_grand_total": 5000.0,
|
||||
"grand_total": 5000.0,
|
||||
"grand_total_import": 5000.0,
|
||||
"is_subcontracted": "Yes",
|
||||
"naming_series": "_T-Purchase Order-",
|
||||
"net_total": 5000.0,
|
||||
"base_net_total": 5000.0,
|
||||
"items": [
|
||||
{
|
||||
"base_amount": 5000.0,
|
||||
@ -41,11 +41,11 @@
|
||||
"currency": "INR",
|
||||
"doctype": "Purchase Order",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"base_grand_total": 5000.0,
|
||||
"grand_total": 5000.0,
|
||||
"grand_total_import": 5000.0,
|
||||
"is_subcontracted": "No",
|
||||
"naming_series": "_T-Purchase Order-",
|
||||
"net_total": 5000.0,
|
||||
"base_net_total": 5000.0,
|
||||
"items": [
|
||||
{
|
||||
"base_amount": 5000.0,
|
||||
|
@ -89,7 +89,7 @@ def get_dashboard_info(supplier):
|
||||
out[doctype] = frappe.db.get_value(doctype,
|
||||
{"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`
|
||||
where supplier=%s
|
||||
and docstatus = 1
|
||||
|
@ -673,7 +673,7 @@
|
||||
}
|
||||
],
|
||||
"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_order": "DESC",
|
||||
"title_field": "supplier_name"
|
||||
|
@ -1,5 +1,5 @@
|
||||
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) {
|
||||
if(doc.status==="Ordered") {
|
||||
return [__("Ordered"), "green", "status,=,Ordered"];
|
||||
|
@ -6,11 +6,11 @@
|
||||
"currency": "INR",
|
||||
"doctype": "Supplier Quotation",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"base_grand_total": 5000.0,
|
||||
"grand_total": 5000.0,
|
||||
"grand_total_import": 5000.0,
|
||||
"is_subcontracted": "No",
|
||||
"naming_series": "_T-Supplier Quotation-",
|
||||
"net_total": 5000.0,
|
||||
"base_net_total": 5000.0,
|
||||
"items": [
|
||||
{
|
||||
"base_amount": 5000.0,
|
||||
|
@ -18,7 +18,7 @@ class AccountsController(TransactionBase):
|
||||
self.validate_date_with_fiscal_year()
|
||||
if self.meta.get_field("currency"):
|
||||
self.calculate_taxes_and_totals()
|
||||
self.validate_value("grand_total", ">=", 0)
|
||||
self.validate_value("base_grand_total", ">=", 0)
|
||||
self.set_total_in_words()
|
||||
|
||||
self.validate_due_date()
|
||||
@ -291,7 +291,7 @@ class AccountsController(TransactionBase):
|
||||
self.precision("tax_amount", 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 +
|
||||
discount_amount_loss, self.precision("tax_amount", 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":
|
||||
# distribute the tax amount proportionally to each item row
|
||||
actual = flt(tax.rate, self.precision("tax_amount", tax))
|
||||
current_tax_amount = (self.net_total
|
||||
and ((item.base_amount / self.net_total) * actual)
|
||||
current_tax_amount = (self.base_net_total
|
||||
and ((item.base_amount / self.base_net_total) * actual)
|
||||
or 0)
|
||||
elif tax.charge_type == "On Net Total":
|
||||
current_tax_amount = (tax_rate / 100.0) * item.base_amount
|
||||
@ -510,12 +510,12 @@ class AccountsController(TransactionBase):
|
||||
|
||||
if 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)
|
||||
else:
|
||||
frappe.throw(_("Total advance ({0}) against Order {1} cannot be greater \
|
||||
than the Grand Total ({2})")
|
||||
.format(advance_paid, self.name, self.grand_total))
|
||||
.format(advance_paid, self.name, self.base_grand_total))
|
||||
|
||||
@property
|
||||
def company_abbr(self):
|
||||
|
@ -21,7 +21,7 @@ class BuyingController(StockController):
|
||||
|
||||
def get_feed(self):
|
||||
return _("From {0} | {1} {2}").format(self.supplier_name, self.currency,
|
||||
self.grand_total_import)
|
||||
self.grand_total)
|
||||
|
||||
def validate(self):
|
||||
super(BuyingController, self).validate()
|
||||
@ -74,10 +74,10 @@ class BuyingController(StockController):
|
||||
def set_total_in_words(self):
|
||||
from frappe.utils import money_in_words
|
||||
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"):
|
||||
self.in_words = money_in_words(self.grand_total, company_currency)
|
||||
if self.meta.get_field("in_words_import"):
|
||||
self.in_words_import = money_in_words(self.grand_total_import,
|
||||
self.in_words = money_in_words(self.grand_total,
|
||||
self.currency)
|
||||
|
||||
def calculate_taxes_and_totals(self):
|
||||
@ -103,55 +103,55 @@ class BuyingController(StockController):
|
||||
|
||||
|
||||
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"):
|
||||
self.net_total += item.base_amount
|
||||
self.net_total_import += item.amount
|
||||
self.base_net_total += item.base_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):
|
||||
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"))
|
||||
|
||||
if self.meta.get_field("rounded_total"):
|
||||
self.rounded_total = rounded(self.grand_total)
|
||||
|
||||
if self.meta.get_field("other_charges_added"):
|
||||
self.other_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("other_charges_added"))
|
||||
if self.meta.get_field("taxes_and_charges_added"):
|
||||
self.taxes_and_charges_added = flt(self.base_taxes_and_charges_added /
|
||||
self.conversion_rate, self.precision("taxes_and_charges_added"))
|
||||
|
||||
if self.meta.get_field("other_charges_deducted"):
|
||||
self.other_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("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"))
|
||||
if self.meta.get_field("taxes_and_charges_deducted"):
|
||||
self.taxes_and_charges_deducted = flt(self.base_taxes_and_charges_deducted /
|
||||
self.conversion_rate, self.precision("taxes_and_charges_deducted"))
|
||||
|
||||
def calculate_outstanding_amount(self):
|
||||
if self.doctype == "Purchase Invoice" and self.docstatus == 0:
|
||||
self.total_advance = flt(self.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.outstanding_amount = flt(self.total_amount_to_pay - self.total_advance,
|
||||
self.precision("outstanding_amount"))
|
||||
|
@ -19,7 +19,7 @@ class SellingController(StockController):
|
||||
|
||||
def get_feed(self):
|
||||
return _("To {0} | {1} {2}").format(self.customer_name, self.currency,
|
||||
self.grand_total_export)
|
||||
self.grand_total)
|
||||
|
||||
def onload(self):
|
||||
if self.doctype in ("Sales Order", "Delivery Note", "Sales Invoice"):
|
||||
@ -65,7 +65,7 @@ class SellingController(StockController):
|
||||
def apply_shipping_rule(self):
|
||||
if self.shipping_rule:
|
||||
shipping_rule = frappe.get_doc("Shipping Rule", self.shipping_rule)
|
||||
value = self.net_total
|
||||
value = self.base_net_total
|
||||
|
||||
# TODO
|
||||
# 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"))
|
||||
|
||||
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"):
|
||||
self.in_words = money_in_words(disable_rounded_total and
|
||||
self.grand_total or self.rounded_total, company_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)
|
||||
self.grand_total or self.rounded_total, self.currency)
|
||||
|
||||
def calculate_taxes_and_totals(self):
|
||||
super(SellingController, self).calculate_taxes_and_totals()
|
||||
@ -204,30 +204,30 @@ class SellingController(StockController):
|
||||
self._set_in_company_currency(item, "amount", "base_amount")
|
||||
|
||||
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"):
|
||||
self.net_total += item.base_amount
|
||||
self.net_total_export += item.amount
|
||||
self.base_net_total += item.base_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):
|
||||
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) \
|
||||
if (self.other_charges_total or self.discount_amount) else self.net_total_export
|
||||
self.grand_total = flt(self.base_grand_total / self.conversion_rate) \
|
||||
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 +
|
||||
flt(self.discount_amount), self.precision("other_charges_total_export"))
|
||||
self.total_taxes_and_charges = flt(self.grand_total - self.net_total +
|
||||
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_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_export = rounded(self.grand_total_export)
|
||||
|
||||
def apply_discount_amount(self):
|
||||
if self.discount_amount:
|
||||
@ -257,8 +257,8 @@ class SellingController(StockController):
|
||||
flt(tax.rate) / 100
|
||||
actual_taxes_dict.setdefault(tax.idx, actual_tax_amount)
|
||||
|
||||
grand_total_for_discount_amount = flt(self.grand_total - sum(actual_taxes_dict.values()),
|
||||
self.precision("grand_total"))
|
||||
grand_total_for_discount_amount = flt(self.base_grand_total - sum(actual_taxes_dict.values()),
|
||||
self.precision("base_grand_total"))
|
||||
return grand_total_for_discount_amount
|
||||
|
||||
def calculate_outstanding_amount(self):
|
||||
@ -266,19 +266,19 @@ class SellingController(StockController):
|
||||
# write_off_amount is only for POS Invoice
|
||||
# total_advance is only for non POS Invoice
|
||||
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"])
|
||||
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.paid_amount, self.precision("outstanding_amount"))
|
||||
|
||||
def calculate_commission(self):
|
||||
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:
|
||||
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"))
|
||||
|
||||
def calculate_contribution(self):
|
||||
@ -291,7 +291,7 @@ class SellingController(StockController):
|
||||
self.round_floats_in(sales_person)
|
||||
|
||||
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))
|
||||
|
||||
total += sales_person.allocated_percentage
|
||||
|
@ -196,7 +196,7 @@ class StatusUpdater(Document):
|
||||
ref_fieldname = ref_dt.lower().replace(" ", "_")
|
||||
zero_amount_refdoc = []
|
||||
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"):
|
||||
if item.get(ref_fieldname) \
|
||||
|
@ -16,12 +16,12 @@ class ProductionPlanningTool(Document):
|
||||
|
||||
def get_so_details(self, 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)
|
||||
ret = {
|
||||
'sales_order_date': so and so[0]['transaction_date'] or '',
|
||||
'customer' : so[0]['customer'] or '',
|
||||
'grand_total': so[0]['grand_total']
|
||||
'grand_total': so[0]['base_grand_total']
|
||||
}
|
||||
return ret
|
||||
|
||||
@ -61,7 +61,7 @@ class ProductionPlanningTool(Document):
|
||||
item_filter += ' and item.name = "' + self.fg_item + '"'
|
||||
|
||||
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
|
||||
where so_item.parent = so.name
|
||||
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_date = cstr(r['transaction_date'])
|
||||
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):
|
||||
""" Pull items from Sales Order, only proction item
|
||||
|
@ -227,8 +227,8 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({
|
||||
if(tax.charge_type == "Actual") {
|
||||
// distribute the tax amount proportionally to each item row
|
||||
var actual = flt(tax.rate, precision("tax_amount", tax));
|
||||
current_tax_amount = this.frm.doc.net_total ?
|
||||
((item.base_amount / this.frm.doc.net_total) * actual) : 0.0;
|
||||
current_tax_amount = this.frm.doc.base_net_total ?
|
||||
((item.base_amount / this.frm.doc.base_net_total) * actual) : 0.0;
|
||||
|
||||
} else if(tax.charge_type == "On Net Total") {
|
||||
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) {
|
||||
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 +
|
||||
discount_amount_loss, precision("tax_amount", 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() {
|
||||
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(!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;
|
||||
});
|
||||
|
||||
grand_total_for_discount_amount = flt(this.frm.doc.grand_total - total_actual_tax,
|
||||
precision("grand_total"));
|
||||
grand_total_for_discount_amount = flt(this.frm.doc.base_grand_total - total_actual_tax,
|
||||
precision("base_grand_total"));
|
||||
return grand_total_for_discount_amount;
|
||||
},
|
||||
|
||||
|
@ -111,30 +111,30 @@ erpnext.feature_setup.feature_dict = {
|
||||
'Sales Order': {'items':['page_break']}
|
||||
},
|
||||
'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']},
|
||||
'Quotation': {'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','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','base_grand_total','base_in_words','base_rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']},
|
||||
'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': {
|
||||
'Purchase Invoice': {
|
||||
'fields': ['conversion_rate', 'currency', 'grand_total',
|
||||
'in_words', 'net_total', 'other_charges_added',
|
||||
'other_charges_deducted'],
|
||||
'fields': ['conversion_rate', 'currency', 'base_grand_total',
|
||||
'base_in_words', 'base_net_total', 'base_taxes_and_charges_added',
|
||||
'base_taxes_and_charges_deducted'],
|
||||
'items': ['base_price_list_rate', 'base_amount','base_rate']
|
||||
},
|
||||
'Purchase Order': {
|
||||
'fields': ['conversion_rate','currency', 'grand_total',
|
||||
'in_words', 'net_total', 'other_charges_added',
|
||||
'other_charges_deducted'],
|
||||
'fields': ['conversion_rate','currency', 'base_grand_total',
|
||||
'base_in_words', 'base_net_total', 'base_taxes_and_charges_added',
|
||||
'base_taxes_and_charges_deducted'],
|
||||
'items': ['base_price_list_rate', 'base_amount','base_rate']
|
||||
},
|
||||
'Purchase Receipt': {
|
||||
'fields': ['conversion_rate', 'currency','grand_total', 'in_words',
|
||||
'net_total', 'other_charges_added', 'other_charges_deducted'],
|
||||
'fields': ['conversion_rate', 'currency','base_grand_total', 'base_in_words',
|
||||
'base_net_total', 'base_taxes_and_charges_added', 'base_taxes_and_charges_deducted'],
|
||||
'items': ['base_price_list_rate','base_amount','base_rate']
|
||||
},
|
||||
'Supplier Quotation': {
|
||||
|
@ -26,23 +26,19 @@ erpnext.pos.PointOfSale = Class.extend({
|
||||
|
||||
// Check whether the transaction is "Sales" or "Purchase"
|
||||
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")) {
|
||||
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;
|
||||
this.party = party;
|
||||
this.price_list = (party == "Customer" ?
|
||||
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.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() {
|
||||
this.make_party();
|
||||
@ -282,10 +278,8 @@ erpnext.pos.PointOfSale = Class.extend({
|
||||
},
|
||||
set_totals: function() {
|
||||
var me = this;
|
||||
this.wrapper.find(".net-total").text(format_currency(this.frm.doc[this.net_total],
|
||||
me.frm.doc.currency));
|
||||
this.wrapper.find(".grand-total").text(format_currency(this.frm.doc[this.grand_total],
|
||||
me.frm.doc.currency));
|
||||
this.wrapper.find(".net-total").text(format_currency(me.frm.doc["net_total"], me.frm.doc.currency));
|
||||
this.wrapper.find(".grand-total").text(format_currency(me.frm.doc.grand_total, me.frm.doc.currency));
|
||||
},
|
||||
call_when_local: function() {
|
||||
var me = this;
|
||||
@ -414,12 +408,12 @@ erpnext.pos.PointOfSale = Class.extend({
|
||||
title: 'Payment',
|
||||
fields: [
|
||||
{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'),
|
||||
options:modes_of_payment.join('\n'), reqd: 1, default: default_mode},
|
||||
{fieldtype:'Currency', fieldname:'paid_amount', label:__('Amount Paid'), reqd:1,
|
||||
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",
|
||||
default: 0.0, hidden: 1},
|
||||
{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);
|
||||
|
||||
// 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.savesubmit(this);
|
||||
|
@ -123,7 +123,7 @@ def get_dashboard_info(customer):
|
||||
out[doctype] = frappe.db.get_value(doctype,
|
||||
{"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`
|
||||
where customer=%s
|
||||
and docstatus = 1
|
||||
@ -174,7 +174,7 @@ def get_customer_outstanding(customer, company):
|
||||
|
||||
# Outstanding based on Sales Order
|
||||
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`
|
||||
where customer=%s and docstatus = 1 and company=%s
|
||||
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))
|
||||
from `tabSales Invoice Item`
|
||||
where ifnull(dn_detail, '') = dn_item.name and docstatus = 1), 0)
|
||||
)/dn.net_total
|
||||
)*dn.grand_total
|
||||
)/dn.base_net_total
|
||||
)*dn.base_grand_total
|
||||
)
|
||||
from `tabDelivery Note` dn, `tabDelivery Note Item` dn_item
|
||||
where
|
||||
|
@ -79,7 +79,7 @@ class Quotation(SellingController):
|
||||
self.check_item_table()
|
||||
|
||||
# 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
|
||||
self.update_opportunity()
|
||||
|
@ -1,5 +1,5 @@
|
||||
frappe.listview_settings['Quotation'] = {
|
||||
add_fields: ["customer_name", "grand_total", "status",
|
||||
add_fields: ["customer_name", "base_grand_total", "status",
|
||||
"company", "currency"],
|
||||
get_indicator: function(doc) {
|
||||
if(doc.status==="Ordered") {
|
||||
|
@ -8,8 +8,8 @@
|
||||
"customer_name": "_Test Customer",
|
||||
"doctype": "Quotation",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"base_grand_total": 1000.0,
|
||||
"grand_total": 1000.0,
|
||||
"grand_total_export": 1000.0,
|
||||
"order_type": "Sales",
|
||||
"plc_conversion_rate": 1.0,
|
||||
"price_list_currency": "INR",
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -142,7 +142,7 @@ class SalesOrder(SellingController):
|
||||
self.check_credit_limit()
|
||||
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')
|
||||
frappe.db.set(self, 'status', 'Submitted')
|
||||
|
@ -1,5 +1,5 @@
|
||||
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"],
|
||||
get_indicator: function(doc) {
|
||||
if(doc.status==="Stopped") {
|
||||
|
@ -10,8 +10,8 @@
|
||||
"delivery_date": "2013-02-23",
|
||||
"doctype": "Sales Order",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"base_grand_total": 1000.0,
|
||||
"grand_total": 1000.0,
|
||||
"grand_total_export": 1000.0,
|
||||
"naming_series": "_T-Sales Order-",
|
||||
"order_type": "Sales",
|
||||
"plc_conversion_rate": 1.0,
|
||||
|
@ -17,7 +17,7 @@ def execute(filters=None):
|
||||
if filters.get("company"):
|
||||
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
|
||||
{company_condition} order by posting_date""".format(company_condition=company_condition),
|
||||
filters, as_dict=1):
|
||||
@ -26,12 +26,12 @@ def execute(filters=None):
|
||||
if not si.customer in customers:
|
||||
new_customers_in.setdefault(key, [0, 0.0])
|
||||
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)
|
||||
else:
|
||||
repeat_customers_in.setdefault(key, [0, 0.0])
|
||||
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
|
||||
from_year, from_month, temp = filters.get("from_date").split("-")
|
||||
|
@ -30,10 +30,10 @@ def get_so_details():
|
||||
cust.territory,
|
||||
cust.customer_group,
|
||||
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",
|
||||
so.net_total * so.per_delivered/100,
|
||||
so.net_total)) as 'total_order_considered',
|
||||
so.base_net_total * so.per_delivered/100,
|
||||
so.base_net_total)) as 'total_order_considered',
|
||||
max(so.transaction_date) as 'last_sales_order_date',
|
||||
DATEDIFF(CURDATE(), max(so.transaction_date)) as 'days_since_last_order'
|
||||
from `tabCustomer` cust, `tabSales Order` so
|
||||
@ -42,7 +42,7 @@ def get_so_details():
|
||||
order by 'days_since_last_order' desc """,as_list=1)
|
||||
|
||||
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
|
||||
limit 1""" % {'customer':customer})
|
||||
|
||||
|
@ -178,20 +178,20 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
},
|
||||
|
||||
total_commission: function() {
|
||||
if(this.frm.doc.net_total) {
|
||||
frappe.model.round_floats_in(this.frm.doc, ["net_total", "total_commission"]);
|
||||
if(this.frm.doc.base_net_total) {
|
||||
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]") + " " +
|
||||
__(frappe.meta.get_label(this.frm.doc.doctype, "total_commission",
|
||||
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);
|
||||
throw msg;
|
||||
}
|
||||
|
||||
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) {
|
||||
sales_person.allocated_percentage = flt(sales_person.allocated_percentage,
|
||||
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,
|
||||
precision("allocated_amount", sales_person));
|
||||
|
||||
@ -235,37 +235,37 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
|
||||
calculate_net_total: function() {
|
||||
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) {
|
||||
me.frm.doc.net_total += item.base_amount;
|
||||
me.frm.doc.net_total_export += item.amount;
|
||||
me.frm.doc.base_net_total += item.base_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() {
|
||||
var me = this;
|
||||
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,
|
||||
precision("other_charges_total"));
|
||||
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_export = (this.frm.doc.other_charges_total || this.frm.doc.discount_amount) ?
|
||||
flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total_export;
|
||||
this.frm.doc.grand_total = (this.frm.doc.base_total_taxes_and_charges || this.frm.doc.discount_amount) ?
|
||||
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.net_total_export + flt(this.frm.doc.discount_amount),
|
||||
precision("other_charges_total_export"));
|
||||
this.frm.doc.total_taxes_and_charges = flt(this.frm.doc.grand_total -
|
||||
this.frm.doc.net_total + flt(this.frm.doc.discount_amount),
|
||||
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_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_export = Math.round(this.frm.doc.grand_total_export);
|
||||
},
|
||||
|
||||
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
|
||||
// total_advance is only for non POS Invoice
|
||||
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"]);
|
||||
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;
|
||||
if(this.frm.doc.is_pos) {
|
||||
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;
|
||||
}
|
||||
|
||||
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"));
|
||||
}
|
||||
},
|
||||
@ -312,7 +312,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
frappe.model.round_floats_in(sales_person);
|
||||
if(sales_person.allocated_percentage) {
|
||||
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));
|
||||
}
|
||||
});
|
||||
@ -371,13 +371,13 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
}
|
||||
});
|
||||
};
|
||||
setup_field_label_map(["net_total", "other_charges_total", "base_discount_amount", "grand_total",
|
||||
"rounded_total", "in_words",
|
||||
setup_field_label_map(["base_net_total", "base_total_taxes_and_charges", "base_discount_amount", "base_grand_total",
|
||||
"base_rounded_total", "base_in_words",
|
||||
"outstanding_amount", "total_advance", "paid_amount", "write_off_amount"],
|
||||
company_currency);
|
||||
|
||||
setup_field_label_map(["net_total_export", "other_charges_total_export", "discount_amount", "grand_total_export",
|
||||
"rounded_total_export", "in_words_export"], this.frm.doc.currency);
|
||||
setup_field_label_map(["net_total", "total_taxes_and_charges", "discount_amount", "grand_total",
|
||||
"rounded_total", "in_words"], this.frm.doc.currency);
|
||||
|
||||
cur_frm.set_df_property("conversion_rate", "description", "1 " + this.frm.doc.currency
|
||||
+ " = [?] " + company_currency)
|
||||
@ -388,8 +388,8 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
}
|
||||
|
||||
// toggle fields
|
||||
this.frm.toggle_display(["conversion_rate", "net_total", "other_charges_total",
|
||||
"grand_total", "rounded_total", "in_words", "base_discount_amount"],
|
||||
this.frm.toggle_display(["conversion_rate", "base_net_total", "base_total_taxes_and_charges",
|
||||
"base_grand_total", "base_rounded_total", "base_in_words", "base_discount_amount"],
|
||||
this.frm.doc.currency != company_currency);
|
||||
|
||||
this.frm.toggle_display(["plc_conversion_rate", "price_list_currency"],
|
||||
|
@ -246,15 +246,15 @@ class EmailDigest(Document):
|
||||
date_field="transaction_date")
|
||||
|
||||
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")
|
||||
|
||||
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")
|
||||
|
||||
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")
|
||||
|
||||
def get_new_purchase_requests(self):
|
||||
@ -263,15 +263,15 @@ class EmailDigest(Document):
|
||||
|
||||
def get_new_supplier_quotations(self):
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
return self.get_new_sum("Stock Entry", self.meta.get_label("new_stock_entries"), "total_amount",
|
||||
|
@ -57,8 +57,8 @@ class GlobalDefaults(Document):
|
||||
|
||||
# Make property setters to hide rounded total fields
|
||||
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, "rounded_total", "print_hide", 1, "Check")
|
||||
make_property_setter(doctype, "base_rounded_total", "hidden", self.disable_rounded_total, "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_export", "print_hide", self.disable_rounded_total, "Check")
|
||||
make_property_setter(doctype, "rounded_total", "hidden", self.disable_rounded_total, "Check")
|
||||
make_property_setter(doctype, "rounded_total", "print_hide", self.disable_rounded_total, "Check")
|
||||
|
@ -144,7 +144,7 @@ def decorate_quotation_doc(quotation_doc):
|
||||
d["formatted_tax_amount"] = fmt_money(flt(d.get("tax_amount")) / doc.conversion_rate,
|
||||
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)
|
||||
|
||||
return doc
|
||||
|
@ -84,7 +84,7 @@ class TestShoppingCart(unittest.TestCase):
|
||||
self.assertEquals(quotation.get("items")[0].item_code, "_Test Item")
|
||||
self.assertEquals(quotation.get("items")[0].qty, 5)
|
||||
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)
|
||||
|
||||
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].qty, 1)
|
||||
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)
|
||||
|
||||
# remove second item
|
||||
set_item_in_cart("_Test Item 2", 0)
|
||||
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)
|
||||
|
||||
def test_set_billing_address(self):
|
||||
|
@ -1110,7 +1110,7 @@
|
||||
}
|
||||
],
|
||||
"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_order": "DESC",
|
||||
"title_field": "customer_name"
|
||||
|
@ -67,7 +67,7 @@ class DeliveryNote(SellingController):
|
||||
|
||||
item_meta = frappe.get_meta("Delivery Note Item")
|
||||
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"]
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ class DeliveryNote(SellingController):
|
||||
self.validate_packed_qty()
|
||||
|
||||
# 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
|
||||
self.update_prevdoc_status()
|
||||
|
@ -1,4 +1,4 @@
|
||||
frappe.listview_settings['Delivery Note'] = {
|
||||
add_fields: ["customer", "customer_name", "grand_total", "per_installed",
|
||||
"transporter_name", "grand_total_export"]
|
||||
add_fields: ["customer", "customer_name", "base_grand_total", "per_installed",
|
||||
"transporter_name", "grand_total"]
|
||||
};
|
||||
|
@ -24,10 +24,10 @@
|
||||
],
|
||||
"doctype": "Delivery Note",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"base_grand_total": 500.0,
|
||||
"grand_total": 500.0,
|
||||
"grand_total_export": 500.0,
|
||||
"naming_series": "_T-Delivery Note-",
|
||||
"net_total": 500.0,
|
||||
"base_net_total": 500.0,
|
||||
"plc_conversion_rate": 1.0,
|
||||
"posting_date": "2013-02-21",
|
||||
"posting_time": "9:00:00",
|
||||
|
@ -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", "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");
|
||||
|
||||
},
|
||||
|
||||
|
@ -80,7 +80,7 @@ class TestLandedCostVoucher(unittest.TestCase):
|
||||
"purchase_receipt": pr.name,
|
||||
"supplier": pr.supplier,
|
||||
"posting_date": pr.posting_date,
|
||||
"grand_total": pr.grand_total
|
||||
"grand_total": pr.base_grand_total
|
||||
}])
|
||||
lcv.set("taxes", [{
|
||||
"description": "Insurance Charges",
|
||||
|
@ -212,7 +212,7 @@ class PurchaseReceipt(BuyingController):
|
||||
purchase_controller = frappe.get_doc("Purchase Common")
|
||||
|
||||
# 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
|
||||
frappe.db.set(self, 'status', 'Submitted')
|
||||
|
@ -1,4 +1,4 @@
|
||||
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"]
|
||||
};
|
||||
|
@ -6,9 +6,9 @@
|
||||
"currency": "INR",
|
||||
"doctype": "Purchase Receipt",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"grand_total": 720.0,
|
||||
"base_grand_total": 720.0,
|
||||
"naming_series": "_T-Purchase Receipt-",
|
||||
"net_total": 500.0,
|
||||
"base_net_total": 500.0,
|
||||
"taxes": [
|
||||
{
|
||||
"account_head": "_Test Account Shipping Charges - _TC",
|
||||
@ -94,9 +94,9 @@
|
||||
"currency": "INR",
|
||||
"doctype": "Purchase Receipt",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"grand_total": 5000.0,
|
||||
"base_grand_total": 5000.0,
|
||||
"is_subcontracted": "Yes",
|
||||
"net_total": 5000.0,
|
||||
"base_net_total": 5000.0,
|
||||
"posting_date": "2013-02-12",
|
||||
"posting_time": "15:33:30",
|
||||
"items": [
|
||||
|
@ -55,7 +55,7 @@
|
||||
<tr>
|
||||
<td>Net Total</td>
|
||||
<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>
|
||||
</tr>
|
||||
{%- for charge in doc.get({"doctype":"Sales Taxes and Charges"}) -%}
|
||||
@ -68,11 +68,11 @@
|
||||
{%- endfor -%}
|
||||
<tr>
|
||||
<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 style='font-weight: bold'>
|
||||
<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>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -10,7 +10,7 @@ $(document).ready(function() {
|
||||
|
||||
<script>
|
||||
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 = "";
|
||||
|
||||
$(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">%(status)s</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>\
|
||||
</a>', doc)).appendTo($list);
|
||||
|
@ -33,7 +33,7 @@ def get_transaction_list(doctype, start, additional_fields=None):
|
||||
else:
|
||||
additional_fields = ""
|
||||
|
||||
transactions = frappe.db.sql("""select name, creation, currency, grand_total_export
|
||||
transactions = frappe.db.sql("""select name, creation, currency, grand_total
|
||||
%s
|
||||
from `tab%s` where customer=%s and docstatus=1
|
||||
order by creation desc
|
||||
|
Loading…
x
Reference in New Issue
Block a user