mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
Fixed merge conflict
This commit is contained in:
@@ -61,7 +61,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
|
||||
},
|
||||
|
||||
validate_conversion_rate: function() {
|
||||
this.frm.doc.conversion_rate = flt(this.frm.doc.conversion_rate, precision("conversion_rate"));
|
||||
this.frm.doc.conversion_rate = flt(this.frm.doc.conversion_rate, (cur_frm) ? precision("conversion_rate") : 9);
|
||||
var conversion_rate_label = frappe.meta.get_label(this.frm.doc.doctype, "conversion_rate",
|
||||
this.frm.doc.name);
|
||||
var company_currency = this.frm.doc.currency || this.get_company_currency();
|
||||
@@ -561,8 +561,11 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
|
||||
var paid_amount = (this.frm.doc.party_account_currency == this.frm.doc.currency) ?
|
||||
this.frm.doc.paid_amount : this.frm.doc.base_paid_amount;
|
||||
|
||||
this.frm.doc.outstanding_amount = flt(total_amount_to_pay - flt(paid_amount) +
|
||||
flt(this.frm.doc.change_amount), precision("outstanding_amount"));
|
||||
var change_amount = (this.frm.doc.party_account_currency == this.frm.doc.currency) ?
|
||||
this.frm.doc.change_amount : this.frm.doc.base_change_amount;
|
||||
|
||||
this.frm.doc.outstanding_amount = flt(total_amount_to_pay - flt(paid_amount) +
|
||||
flt(this.frm.doc.change_amount * this.frm.doc.conversion_rate), precision("outstanding_amount"));
|
||||
|
||||
} else if(this.frm.doc.doctype == "Purchase Invoice") {
|
||||
this.frm.doc.outstanding_amount = flt(total_amount_to_pay, precision("outstanding_amount"));
|
||||
@@ -574,7 +577,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
|
||||
payment_status = true;
|
||||
if(this.frm.doc.is_pos && (update_paid_amount===undefined || update_paid_amount)){
|
||||
$.each(this.frm.doc['payments'] || [], function(index, data){
|
||||
if(data.type == "Cash" && payment_status) {
|
||||
if(data.type == "Cash" && payment_status && total_amount_to_pay > 0) {
|
||||
data.base_amount = flt(total_amount_to_pay, precision("base_amount"));
|
||||
data.amount = flt(total_amount_to_pay / me.frm.doc.conversion_rate, precision("amount"));
|
||||
payment_status = false;
|
||||
@@ -601,12 +604,11 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
|
||||
calculate_change_amount: function(){
|
||||
this.frm.doc.change_amount = 0.0;
|
||||
if(this.frm.doc.paid_amount > this.frm.doc.grand_total && !this.frm.doc.is_return){
|
||||
this.frm.doc.change_amount = flt(this.frm.doc.paid_amount - this.frm.doc.grand_total +
|
||||
this.frm.doc.change_amount = flt(this.frm.doc.paid_amount - this.frm.doc.grand_total +
|
||||
this.frm.doc.write_off_amount, precision("change_amount"));
|
||||
this.frm.doc.base_change_amount = flt(this.frm.doc.base_paid_amount - this.frm.doc.base_grand_total +
|
||||
this.frm.doc.base_write_off_amount, precision("base_change_amount"));
|
||||
}
|
||||
|
||||
this.frm.doc.base_change_amount = flt(this.frm.doc.change_amount * this.frm.doc.conversion_rate,
|
||||
precision("base_change_amount"));
|
||||
},
|
||||
|
||||
calculate_write_off_amount: function(){
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="col-xs-6" style="padding:20px">{{mode_of_payment}}</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="input-group">
|
||||
<input disabled class="form-control text-right amount" idx="{{idx}}" type="text" value="{{format_number(amount, 2)}}">
|
||||
<input disabled class="form-control text-right amount" idx="{{idx}}" type="text" value="{%= format_currency(amount, currency) %}">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-default clr" idx="{{idx}}" style="border:1px solid #d1d8dd">C</button>
|
||||
</span>
|
||||
|
||||
@@ -84,8 +84,8 @@ erpnext.payments = erpnext.stock.StockController.extend({
|
||||
this.payment_val = 0.0
|
||||
if(this.frm.doc.outstanding_amount > 0 && flt(this.selected_mode.val()) == 0.0){
|
||||
//When user first time click on row
|
||||
this.payment_val = flt(this.frm.doc.outstanding_amount)
|
||||
this.selected_mode.val(format_number(this.payment_val, 2));
|
||||
this.payment_val = flt(this.frm.doc.outstanding_amount / this.frm.doc.conversion_rate, precision("outstanding_amount"))
|
||||
this.selected_mode.val(format_currency(this.payment_val, this.frm.doc.currency));
|
||||
this.update_payment_amount()
|
||||
}else if(flt(this.selected_mode.val()) > 0){
|
||||
//If user click on existing row which has value
|
||||
@@ -137,14 +137,14 @@ erpnext.payments = erpnext.stock.StockController.extend({
|
||||
var me = this;
|
||||
$(this.$body).find('.pos-keyboard-key').click(function(){
|
||||
me.payment_val += $(this).text();
|
||||
me.selected_mode.val(format_number(me.payment_val, 2))
|
||||
me.selected_mode.val(format_currency(me.payment_val, me.frm.doc.currency))
|
||||
me.idx = me.selected_mode.attr("idx")
|
||||
me.update_paid_amount()
|
||||
})
|
||||
|
||||
$(this.$body).find('.delete-btn').click(function(){
|
||||
me.payment_val = cstr(flt(me.selected_mode.val())).slice(0, -1);
|
||||
me.selected_mode.val(format_number(me.payment_val, 2));
|
||||
me.selected_mode.val(format_currency(me.payment_val, me.frm.doc.currency));
|
||||
me.idx = me.selected_mode.attr("idx")
|
||||
me.update_paid_amount();
|
||||
})
|
||||
@@ -155,7 +155,7 @@ erpnext.payments = erpnext.stock.StockController.extend({
|
||||
var me = this;
|
||||
this.selected_mode.change(function(){
|
||||
me.payment_val = flt($(this).val()) || 0.0;
|
||||
me.selected_mode.val(format_number(me.payment_val, 2))
|
||||
me.selected_mode.val(format_currency(me.payment_val, me.frm.doc.currency))
|
||||
me.idx = me.selected_mode.attr("idx")
|
||||
me.update_payment_amount()
|
||||
})
|
||||
@@ -199,8 +199,8 @@ erpnext.payments = erpnext.stock.StockController.extend({
|
||||
if(me.idx == 'change_amount'){
|
||||
me.change_amount(value)
|
||||
} else{
|
||||
if(value == 0 && update_write_off) {
|
||||
value = me.frm.doc.outstanding_amount;
|
||||
if(flt(value) == 0 && update_write_off && me.frm.doc.outstanding_amount > 0) {
|
||||
value = flt(me.frm.doc.outstanding_amount / me.frm.doc.conversion_rate, precision(me.idx));
|
||||
}
|
||||
me.write_off_amount(value)
|
||||
}
|
||||
@@ -224,10 +224,10 @@ erpnext.payments = erpnext.stock.StockController.extend({
|
||||
|
||||
show_amounts: function(){
|
||||
var me = this;
|
||||
$(this.$body).find(".write_off_amount").val(format_number(this.frm.doc.write_off_amount, precision("write_off_amount")));
|
||||
$(this.$body).find(".write_off_amount").val(format_currency(this.frm.doc.write_off_amount, this.frm.doc.currency));
|
||||
$(this.$body).find('.paid_amount').text(format_currency(this.frm.doc.paid_amount, this.frm.doc.currency));
|
||||
$(this.$body).find('.change_amount').val(format_number(this.frm.doc.change_amount, precision("change_amount")))
|
||||
$(this.$body).find('.outstanding_amount').text(format_currency(this.frm.doc.outstanding_amount, this.frm.doc.currency))
|
||||
$(this.$body).find('.change_amount').val(format_currency(this.frm.doc.change_amount, this.frm.doc.currency))
|
||||
$(this.$body).find('.outstanding_amount').text(format_currency(this.frm.doc.outstanding_amount, frappe.get_doc(":Company", this.frm.doc.company).default_currency))
|
||||
this.update_invoice();
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user