Additional Discount amount based on percentage
diff --git a/erpnext/public/js/pos/pos.html b/erpnext/public/js/pos/pos.html
index 1c337f4..d12b9b2 100644
--- a/erpnext/public/js/pos/pos.html
+++ b/erpnext/public/js/pos/pos.html
@@ -25,17 +25,25 @@
</div>
</div>
<div class="row pos-bill-row discount-amount-area">
- <div class="col-xs-6"><h6 class="text-muted">{%= __("Discount Amount") %}</h6></div>
- <div class="col-xs-6"><input type="text" class="form-control discount-amount text-right"></div>
+ <div class="col-xs-6"><h6 class="text-muted">{%= __("Discount") %}</h6></div>
+ <div class="col-xs-3 discount-field-col">
+ <div class="input-group input-group-sm">
+ <span class="input-group-addon">%</span>
+ <input type="text" class="form-control discount-percentage text-right">
+ </div>
+ </div>
+ <div class="col-xs-3 discount-field-col">
+ <div class="input-group input-group-sm">
+ <span class="input-group-addon">{%= get_currency_symbol(currency) %}</span>
+ <input type="text" class="form-control discount-amount text-right"
+ placeholder="{%= 0.00 %}">
+ </div>
+ </div>
</div>
<div class="row pos-bill-row grand-total-area">
<div class="col-xs-6"><h6>{%= __("Grand Total") %}</h6></div>
<div class="col-xs-6"><h6 class="grand-total text-right"></h6></div>
</div>
- <!-- <div class="row pos-bill-row paid-amount-area">
- <div class="col-xs-6"><h6 class="text-muted">{%= __("Amount Paid") %}</h6></div>
- <div class="col-xs-6"><input type="text" class="form-control paid-amount text-right"></div>
- </div> -->
</div>
</div>
</div>
diff --git a/erpnext/public/js/pos/pos.js b/erpnext/public/js/pos/pos.js
index 02eeab0..a348138 100644
--- a/erpnext/public/js/pos/pos.js
+++ b/erpnext/public/js/pos/pos.js
@@ -7,7 +7,7 @@
init: function(wrapper, frm) {
this.wrapper = wrapper;
this.frm = frm;
- this.wrapper.html(frappe.render_template("pos", {}));
+ this.wrapper.html(frappe.render_template("pos", {currency: this.frm.currency}));
this.check_transaction_type();
this.make();
@@ -16,6 +16,11 @@
$(this.frm.wrapper).on("refresh-fields", function() {
me.refresh();
});
+
+ this.wrapper.find('input.discount-percentage').on("change", function() {
+ frappe.model.set_value(me.frm.doctype, me.frm.docname,
+ "additional_discount_percentage", flt(this.value));
+ });
this.wrapper.find('input.discount-amount').on("change", function() {
frappe.model.set_value(me.frm.doctype, me.frm.docname, "discount_amount", flt(this.value));
@@ -230,6 +235,7 @@
},
refresh_fields: function() {
this.party_field.set_input(this.frm.doc[this.party.toLowerCase()]);
+ this.wrapper.find('input.discount-percentage').val(this.frm.doc.additional_discount_percentage);
this.wrapper.find('input.discount-amount').val(this.frm.doc.discount_amount);
this.show_items_in_item_cart();