Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 1 | // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors |
| 2 | // License: GNU General Public License v3. See license.txt |
| 3 | |
| 4 | erpnext.payments = erpnext.stock.StockController.extend({ |
| 5 | make_payment: function() { |
| 6 | var me = this; |
| 7 | |
| 8 | this.dialog = new frappe.ui.Dialog({ |
| 9 | title: 'Payment' |
| 10 | }); |
Deepesh Garg | c26de28 | 2020-11-02 19:57:27 +0530 | [diff] [blame] | 11 | |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 12 | this.dialog.show(); |
| 13 | this.$body = this.dialog.body; |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 14 | this.set_payment_primary_action(); |
| 15 | this.make_keyboard(); |
Deepesh Garg | e2f83ff | 2021-05-16 17:46:07 +0530 | [diff] [blame] | 16 | this.select_text(); |
Rohit Waghchaure | baef262 | 2016-08-05 15:41:36 +0530 | [diff] [blame] | 17 | }, |
| 18 | |
Deepesh Garg | b07f7d1 | 2021-05-20 17:08:57 +0530 | [diff] [blame] | 19 | select_text() { |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 20 | $(this.$body).find('.form-control').click(function() { |
Rohit Waghchaure | baef262 | 2016-08-05 15:41:36 +0530 | [diff] [blame] | 21 | $(this).select(); |
Deepesh Garg | b07f7d1 | 2021-05-20 17:08:57 +0530 | [diff] [blame] | 22 | }); |
Deepesh Garg | 36d47f9 | 2021-05-21 11:16:26 +0530 | [diff] [blame] | 23 | }, |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 24 | |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 25 | set_payment_primary_action: function() { |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 26 | var me = this; |
Deepesh Garg | c26de28 | 2020-11-02 19:57:27 +0530 | [diff] [blame] | 27 | |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 28 | this.dialog.set_primary_action(__("Submit"), function() { |
Cesar | d8b1927 | 2018-01-29 15:39:52 +0100 | [diff] [blame] | 29 | // Allow no ZERO payment |
Helkyd | 3264c13 | 2017-11-22 16:06:22 +0100 | [diff] [blame] | 30 | $.each(me.frm.doc.payments, function (index, data) { |
| 31 | if (data.amount != 0) { |
| 32 | me.dialog.hide(); |
| 33 | me.submit_invoice(); |
| 34 | return; |
| 35 | } |
Cesar | d8b1927 | 2018-01-29 15:39:52 +0100 | [diff] [blame] | 36 | }); |
Helkyd | 6e3f789 | 2017-11-22 16:12:27 +0100 | [diff] [blame] | 37 | }) |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 38 | }, |
| 39 | |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 40 | make_keyboard: function() { |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 41 | var me = this; |
| 42 | $(this.$body).empty(); |
| 43 | $(this.$body).html(frappe.render_template('pos_payment', this.frm.doc)) |
| 44 | this.show_payment_details(); |
Deepesh Garg | e2f83ff | 2021-05-16 17:46:07 +0530 | [diff] [blame] | 45 | this.bind_keyboard_event(); |
| 46 | this.clear_amount(); |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 47 | }, |
| 48 | |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 49 | make_multimode_payment: function() { |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 50 | var me = this; |
| 51 | |
Deepesh Garg | e2f83ff | 2021-05-16 17:46:07 +0530 | [diff] [blame] | 52 | if (this.frm.doc.change_amount > 0) { |
| 53 | me.payment_val = me.doc.outstanding_amount; |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | this.payments = frappe.model.add_child(this.frm.doc, 'Multi Mode Payment', "payments"); |
| 57 | this.payments.mode_of_payment = this.dialog.fields_dict.mode_of_payment.get_value(); |
| 58 | this.payments.amount = flt(this.payment_val); |
| 59 | }, |
| 60 | |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 61 | show_payment_details: function() { |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 62 | var me = this; |
Faris Ansari | ab74ca7 | 2017-05-30 12:54:42 +0530 | [diff] [blame] | 63 | var multimode_payments = $(this.$body).find('.multimode-payments').empty(); |
Deepesh Garg | b07f7d1 | 2021-05-20 17:08:57 +0530 | [diff] [blame] | 64 | if (this.frm.doc.payments.length) { |
| 65 | $.each(this.frm.doc.payments, function(index, data) { |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 66 | $(frappe.render_template('payment_details', { |
| 67 | mode_of_payment: data.mode_of_payment, |
| 68 | amount: data.amount, |
| 69 | idx: data.idx, |
| 70 | currency: me.frm.doc.currency, |
| 71 | type: data.type |
| 72 | })).appendTo(multimode_payments) |
Rohit Waghchaure | a88dec8 | 2016-07-30 16:49:48 +0530 | [diff] [blame] | 73 | |
| 74 | if (data.type == 'Cash' && data.amount == me.frm.doc.paid_amount) { |
| 75 | me.idx = data.idx; |
| 76 | me.selected_mode = $(me.$body).find(repl("input[idx='%(idx)s']",{'idx': me.idx})); |
| 77 | me.highlight_selected_row(); |
| 78 | me.bind_amount_change_event(); |
| 79 | } |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 80 | }) |
| 81 | }else{ |
| 82 | $("<p>No payment mode selected in pos profile</p>").appendTo(multimode_payments) |
| 83 | } |
| 84 | }, |
Rohit Waghchaure | 9fe40d5 | 2016-06-13 21:37:10 +0530 | [diff] [blame] | 85 | |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 86 | set_outstanding_amount: function() { |
Rohit Waghchaure | 9fe40d5 | 2016-06-13 21:37:10 +0530 | [diff] [blame] | 87 | this.selected_mode = $(this.$body).find(repl("input[idx='%(idx)s']",{'idx': this.idx})); |
Deepesh Garg | 36d47f9 | 2021-05-21 11:16:26 +0530 | [diff] [blame] | 88 | this.highlight_selected_row(); |
| 89 | this.payment_val = 0.0; |
Deepesh Garg | b07f7d1 | 2021-05-20 17:08:57 +0530 | [diff] [blame] | 90 | if (this.frm.doc.outstanding_amount > 0 && flt(this.selected_mode.val()) == 0.0) { |
Rohit Waghchaure | 88514a2 | 2016-07-19 20:04:44 +0530 | [diff] [blame] | 91 | //When user first time click on row |
Rohit Waghchaure | a57bf5e | 2016-08-30 00:41:33 +0530 | [diff] [blame] | 92 | this.payment_val = flt(this.frm.doc.outstanding_amount / this.frm.doc.conversion_rate, precision("outstanding_amount")) |
Rohit Waghchaure | 609e2b4 | 2016-08-31 02:04:37 +0530 | [diff] [blame] | 93 | this.selected_mode.val(format_currency(this.payment_val, this.frm.doc.currency)); |
Deepesh Garg | b07f7d1 | 2021-05-20 17:08:57 +0530 | [diff] [blame] | 94 | this.update_payment_amount(); |
| 95 | } else if (flt(this.selected_mode.val()) > 0) { |
Rohit Waghchaure | 9fe40d5 | 2016-06-13 21:37:10 +0530 | [diff] [blame] | 96 | //If user click on existing row which has value |
| 97 | this.payment_val = flt(this.selected_mode.val()); |
| 98 | } |
| 99 | this.selected_mode.select() |
| 100 | this.bind_amount_change_event(); |
| 101 | }, |
Deepesh Garg | c26de28 | 2020-11-02 19:57:27 +0530 | [diff] [blame] | 102 | |
Deepesh Garg | b07f7d1 | 2021-05-20 17:08:57 +0530 | [diff] [blame] | 103 | bind_keyboard_event() { |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 104 | this.payment_val = ''; |
Rohit Waghchaure | baef262 | 2016-08-05 15:41:36 +0530 | [diff] [blame] | 105 | this.bind_form_control_event(); |
| 106 | this.bind_numeric_keys_event(); |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 107 | }, |
Rohit Waghchaure | 9fe40d5 | 2016-06-13 21:37:10 +0530 | [diff] [blame] | 108 | |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 109 | bind_form_control_event: function() { |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 110 | var me = this; |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 111 | $(this.$body).find('.pos-payment-row').click(function() { |
Rohit Waghchaure | baef262 | 2016-08-05 15:41:36 +0530 | [diff] [blame] | 112 | me.idx = $(this).attr("idx"); |
Deepesh Garg | e2f83ff | 2021-05-16 17:46:07 +0530 | [diff] [blame] | 113 | me.set_outstanding_amount(); |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 114 | }); |
Deepesh Garg | c26de28 | 2020-11-02 19:57:27 +0530 | [diff] [blame] | 115 | |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 116 | $(this.$body).find('.form-control').click(function() { |
Rohit Waghchaure | baef262 | 2016-08-05 15:41:36 +0530 | [diff] [blame] | 117 | me.idx = $(this).attr("idx"); |
| 118 | me.set_outstanding_amount(); |
Rohit Waghchaure | ea6d7e9 | 2016-08-22 19:49:17 +0530 | [diff] [blame] | 119 | me.update_paid_amount(true); |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 120 | }); |
Deepesh Garg | c26de28 | 2020-11-02 19:57:27 +0530 | [diff] [blame] | 121 | |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 122 | $(this.$body).find('.write_off_amount').change(function() { |
Rohit Waghchaure | ea6d7e9 | 2016-08-22 19:49:17 +0530 | [diff] [blame] | 123 | me.write_off_amount(flt($(this).val()), precision("write_off_amount")); |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 124 | }); |
Deepesh Garg | c26de28 | 2020-11-02 19:57:27 +0530 | [diff] [blame] | 125 | |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 126 | $(this.$body).find('.change_amount').change(function() { |
Rohit Waghchaure | ea6d7e9 | 2016-08-22 19:49:17 +0530 | [diff] [blame] | 127 | me.change_amount(flt($(this).val()), precision("change_amount")); |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 128 | }); |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 129 | }, |
Rohit Waghchaure | 9fe40d5 | 2016-06-13 21:37:10 +0530 | [diff] [blame] | 130 | |
Deepesh Garg | b07f7d1 | 2021-05-20 17:08:57 +0530 | [diff] [blame] | 131 | highlight_selected_row() { |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 132 | var selected_row = $(this.$body).find(repl(".pos-payment-row[idx='%(idx)s']", {'idx': this.idx})); |
Deepesh Garg | e2f83ff | 2021-05-16 17:46:07 +0530 | [diff] [blame] | 133 | $(this.$body).find('.pos-payment-row').removeClass('selected-payment-mode'); |
| 134 | selected_row.addClass('selected-payment-mode'); |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 135 | $(this.$body).find('.amount').attr('disabled', true); |
| 136 | this.selected_mode.attr('disabled', false); |
| 137 | }, |
Deepesh Garg | c26de28 | 2020-11-02 19:57:27 +0530 | [diff] [blame] | 138 | |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 139 | bind_numeric_keys_event: function() { |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 140 | var me = this; |
| 141 | $(this.$body).find('.pos-keyboard-key').click(function(){ |
| 142 | me.payment_val += $(this).text(); |
Deepesh Garg | e2f83ff | 2021-05-16 17:46:07 +0530 | [diff] [blame] | 143 | me.selected_mode.val(format_currency(me.payment_val, me.frm.doc.currency)); |
| 144 | me.idx = me.selected_mode.attr("idx"); |
| 145 | me.update_paid_amount(); |
| 146 | }); |
Deepesh Garg | c26de28 | 2020-11-02 19:57:27 +0530 | [diff] [blame] | 147 | |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 148 | $(this.$body).find('.delete-btn').click(function() { |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 149 | me.payment_val = cstr(flt(me.selected_mode.val())).slice(0, -1); |
Rohit Waghchaure | 609e2b4 | 2016-08-31 02:04:37 +0530 | [diff] [blame] | 150 | me.selected_mode.val(format_currency(me.payment_val, me.frm.doc.currency)); |
Deepesh Garg | e2f83ff | 2021-05-16 17:46:07 +0530 | [diff] [blame] | 151 | me.idx = me.selected_mode.attr("idx"); |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 152 | me.update_paid_amount(); |
| 153 | }) |
| 154 | |
| 155 | }, |
Deepesh Garg | c26de28 | 2020-11-02 19:57:27 +0530 | [diff] [blame] | 156 | |
Deepesh Garg | b07f7d1 | 2021-05-20 17:08:57 +0530 | [diff] [blame] | 157 | bind_amount_change_event() { |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 158 | var me = this; |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 159 | this.selected_mode.change(function() { |
Rohit Waghchaure | 53bea82 | 2016-07-06 16:09:26 +0530 | [diff] [blame] | 160 | me.payment_val = flt($(this).val()) || 0.0; |
Deepesh Garg | e2f83ff | 2021-05-16 17:46:07 +0530 | [diff] [blame] | 161 | me.selected_mode.val(format_currency(me.payment_val, me.frm.doc.currency)); |
| 162 | me.idx = me.selected_mode.attr("idx"); |
| 163 | me.update_payment_amount(); |
| 164 | }); |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 165 | }, |
Rohit Waghchaure | 9fe40d5 | 2016-06-13 21:37:10 +0530 | [diff] [blame] | 166 | |
Rohit Waghchaure | baef262 | 2016-08-05 15:41:36 +0530 | [diff] [blame] | 167 | clear_amount: function() { |
Rohit Waghchaure | 9fe40d5 | 2016-06-13 21:37:10 +0530 | [diff] [blame] | 168 | var me = this; |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 169 | $(this.$body).find('.clr').click(function(e) { |
Rohit Waghchaure | 9fe40d5 | 2016-06-13 21:37:10 +0530 | [diff] [blame] | 170 | e.stopPropagation(); |
| 171 | me.idx = $(this).attr("idx"); |
| 172 | me.selected_mode = $(me.$body).find(repl("input[idx='%(idx)s']",{'idx': me.idx})); |
| 173 | me.payment_val = 0.0; |
| 174 | me.selected_mode.val(0.0); |
Rohit Waghchaure | a88dec8 | 2016-07-30 16:49:48 +0530 | [diff] [blame] | 175 | me.highlight_selected_row(); |
Rohit Waghchaure | baef262 | 2016-08-05 15:41:36 +0530 | [diff] [blame] | 176 | me.update_payment_amount(); |
Deepesh Garg | e2f83ff | 2021-05-16 17:46:07 +0530 | [diff] [blame] | 177 | }); |
Rohit Waghchaure | 9fe40d5 | 2016-06-13 21:37:10 +0530 | [diff] [blame] | 178 | }, |
| 179 | |
Deepesh Garg | b07f7d1 | 2021-05-20 17:08:57 +0530 | [diff] [blame] | 180 | write_off_amount(write_off_amount) { |
Rohit Waghchaure | 713e2b7 | 2016-08-19 15:11:36 +0530 | [diff] [blame] | 181 | this.frm.doc.write_off_amount = flt(write_off_amount, precision("write_off_amount")); |
| 182 | this.frm.doc.base_write_off_amount = flt(this.frm.doc.write_off_amount * this.frm.doc.conversion_rate, |
| 183 | precision("base_write_off_amount")); |
Deepesh Garg | e2f83ff | 2021-05-16 17:46:07 +0530 | [diff] [blame] | 184 | this.calculate_outstanding_amount(false); |
| 185 | this.show_amounts(); |
Rohit Waghchaure | baef262 | 2016-08-05 15:41:36 +0530 | [diff] [blame] | 186 | }, |
| 187 | |
| 188 | change_amount: function(change_amount) { |
| 189 | var me = this; |
| 190 | |
Rohit Waghchaure | 713e2b7 | 2016-08-19 15:11:36 +0530 | [diff] [blame] | 191 | this.frm.doc.change_amount = flt(change_amount, precision("change_amount")); |
Deepesh Garg | e2f83ff | 2021-05-16 17:46:07 +0530 | [diff] [blame] | 192 | this.calculate_write_off_amount(); |
| 193 | this.show_amounts(); |
Rohit Waghchaure | baef262 | 2016-08-05 15:41:36 +0530 | [diff] [blame] | 194 | }, |
| 195 | |
Rohit Waghchaure | ea6d7e9 | 2016-08-22 19:49:17 +0530 | [diff] [blame] | 196 | update_paid_amount: function(update_write_off) { |
Rohit Waghchaure | baef262 | 2016-08-05 15:41:36 +0530 | [diff] [blame] | 197 | var me = this; |
Deepesh Garg | e2f83ff | 2021-05-16 17:46:07 +0530 | [diff] [blame] | 198 | if (in_list(['change_amount', 'write_off_amount'], this.idx)) { |
Faris Ansari | ab74ca7 | 2017-05-30 12:54:42 +0530 | [diff] [blame] | 199 | var value = me.selected_mode.val(); |
Deepesh Garg | e2f83ff | 2021-05-16 17:46:07 +0530 | [diff] [blame] | 200 | if (me.idx == 'change_amount') { |
| 201 | me.change_amount(value); |
Deepesh Garg | b07f7d1 | 2021-05-20 17:08:57 +0530 | [diff] [blame] | 202 | } else { |
Rohit Waghchaure | d39f533 | 2016-08-31 02:09:15 +0530 | [diff] [blame] | 203 | if(flt(value) == 0 && update_write_off && me.frm.doc.outstanding_amount > 0) { |
Rohit Waghchaure | a57bf5e | 2016-08-30 00:41:33 +0530 | [diff] [blame] | 204 | value = flt(me.frm.doc.outstanding_amount / me.frm.doc.conversion_rate, precision(me.idx)); |
Rohit Waghchaure | baef262 | 2016-08-05 15:41:36 +0530 | [diff] [blame] | 205 | } |
Deepesh Garg | e2f83ff | 2021-05-16 17:46:07 +0530 | [diff] [blame] | 206 | me.write_off_amount(value); |
Rohit Waghchaure | baef262 | 2016-08-05 15:41:36 +0530 | [diff] [blame] | 207 | } |
Deepesh Garg | e2f83ff | 2021-05-16 17:46:07 +0530 | [diff] [blame] | 208 | } else { |
| 209 | this.update_payment_amount(); |
Rohit Waghchaure | baef262 | 2016-08-05 15:41:36 +0530 | [diff] [blame] | 210 | } |
| 211 | }, |
| 212 | |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 213 | update_payment_amount: function() { |
Rohit Waghchaure | baef262 | 2016-08-05 15:41:36 +0530 | [diff] [blame] | 214 | var me = this; |
| 215 | |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 216 | $.each(this.frm.doc.payments, function(index, data) { |
Deepesh Garg | b07f7d1 | 2021-05-20 17:08:57 +0530 | [diff] [blame] | 217 | if (cint(me.idx) == cint(data.idx)) { |
Deepesh Garg | e2f83ff | 2021-05-16 17:46:07 +0530 | [diff] [blame] | 218 | data.amount = flt(me.selected_mode.val(), 2); |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 219 | } |
| 220 | }) |
Rohit Waghchaure | baef262 | 2016-08-05 15:41:36 +0530 | [diff] [blame] | 221 | |
Rohit Waghchaure | 61b4a43 | 2016-07-20 11:21:51 +0530 | [diff] [blame] | 222 | this.calculate_outstanding_amount(false); |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 223 | this.show_amounts(); |
| 224 | }, |
Rohit Waghchaure | baef262 | 2016-08-05 15:41:36 +0530 | [diff] [blame] | 225 | |
Deepesh Garg | fd380d3 | 2021-05-13 14:04:51 +0530 | [diff] [blame] | 226 | show_amounts: function() { |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 227 | var me = this; |
Rohit Waghchaure | 609e2b4 | 2016-08-31 02:04:37 +0530 | [diff] [blame] | 228 | $(this.$body).find(".write_off_amount").val(format_currency(this.frm.doc.write_off_amount, this.frm.doc.currency)); |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 229 | $(this.$body).find('.paid_amount').text(format_currency(this.frm.doc.paid_amount, this.frm.doc.currency)); |
Deepesh Garg | e2f83ff | 2021-05-16 17:46:07 +0530 | [diff] [blame] | 230 | $(this.$body).find('.change_amount').val(format_currency(this.frm.doc.change_amount, this.frm.doc.currency)); |
| 231 | $(this.$body).find('.outstanding_amount').text(format_currency(this.frm.doc.outstanding_amount, frappe.get_doc(":Company", this.frm.doc.company).default_currency)); |
Rohit Waghchaure | 6087fe1 | 2016-04-09 14:31:09 +0530 | [diff] [blame] | 232 | this.update_invoice(); |
| 233 | } |
| 234 | }) |