mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-24 23:49:19 +00:00
Rounding based on smallest circulating currency fraction value
This commit is contained in:
@@ -392,10 +392,15 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({
|
||||
|
||||
// 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);
|
||||
this.frm.doc.rounded_total = round_based_on_smallest_currency_fraction(this.frm.doc.grand_total,
|
||||
this.frm.doc.currency, precision("rounded_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);
|
||||
var company_currency = this.get_company_currency();
|
||||
|
||||
this.frm.doc.base_rounded_total =
|
||||
round_based_on_smallest_currency_fraction(this.frm.doc.base_grand_total,
|
||||
company_currency, precision("base_rounded_total"));
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -416,9 +416,6 @@ erpnext.pos.PointOfSale = Class.extend({
|
||||
var default_mode = me.frm.doc.mode_of_payment ? me.frm.doc.mode_of_payment :
|
||||
me.modes_of_payment.indexOf(__("Cash"))!==-1 ? __("Cash") : undefined;
|
||||
|
||||
var smallest_currency_fraction_value = flt(frappe.model.get_value(":Currency",
|
||||
me.frm.doc.currency, "smallest_currency_fraction_value"))
|
||||
|
||||
// show payment wizard
|
||||
var dialog = new frappe.ui.Dialog({
|
||||
width: 400,
|
||||
@@ -439,8 +436,9 @@ erpnext.pos.PointOfSale = Class.extend({
|
||||
precision("paid_amount"));
|
||||
|
||||
if (actual_change > 0) {
|
||||
var rounded_change = actual_change - remainder(actual_change,
|
||||
smallest_currency_fraction_value, precision("paid_amount"));
|
||||
var rounded_change =
|
||||
round_based_on_smallest_currency_fraction(actual_change,
|
||||
me.frm.doc.currency, precision("paid_amount"));
|
||||
} else {
|
||||
var rounded_change = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user