[flat discount] added flat discount in pos

This commit is contained in:
Akhilesh Darjee
2013-12-26 20:31:42 +05:30
parent 3ab9f24a12
commit 2b1d8854d5
2 changed files with 67 additions and 44 deletions

View File

@@ -30,12 +30,14 @@ erpnext.POS = Class.extend({
</div>\ </div>\
<br>\ <br>\
<div class="totals-area" style="margin-left: 40%;">\ <div class="totals-area" style="margin-left: 40%;">\
<div class="net-total-area">\
<table class="table table-condensed">\ <table class="table table-condensed">\
<tr>\ <tr>\
<td><b>Net Total</b></td>\ <td><b>Net Total</b></td>\
<td style="text-align: right;" class="net-total"></td>\ <td style="text-align: right;" class="net-total"></td>\
</tr>\ </tr>\
</table>\ </table>\
</div>\
<div class="tax-table" style="display: none;">\ <div class="tax-table" style="display: none;">\
<table class="table table-condensed">\ <table class="table table-condensed">\
<thead>\ <thead>\
@@ -48,6 +50,17 @@ erpnext.POS = Class.extend({
</tbody>\ </tbody>\
</table>\ </table>\
</div>\ </div>\
<div class="flat-discount-area">\
<table class="table table-condensed">\
<tr>\
<td style="vertical-align: middle;"><b>Flat Discount</b></td>\
<td style="text-align: right;">\
<input type="text" class="form-control flat-discount" \
style="text-align: right;">\
</td>\
</tr>\
</table>\
</div>\
<div class="grand-total-area">\ <div class="grand-total-area">\
<table class="table table-condensed">\ <table class="table table-condensed">\
<tr>\ <tr>\
@@ -82,6 +95,10 @@ erpnext.POS = Class.extend({
me.refresh(); me.refresh();
}); });
this.wrapper.find('input.flat-discount').on("change", function() {
wn.model.set_value(me.frm.doctype, me.frm.docname, "flat_discount", this.value);
});
this.call_function("delete-items", function() {me.remove_selected_item();}); this.call_function("delete-items", function() {me.remove_selected_item();});
this.call_function("make-payment", function() {me.make_payment();}); this.call_function("make-payment", function() {me.make_payment();});
}, },
@@ -112,9 +129,9 @@ erpnext.POS = Class.extend({
}, },
make: function() { make: function() {
this.make_party(); this.make_party();
this.make_item_group();
this.make_search();
this.make_barcode(); this.make_barcode();
this.make_search();
this.make_item_group();
this.make_item_list(); this.make_item_list();
}, },
make_party: function() { make_party: function() {
@@ -137,23 +154,23 @@ erpnext.POS = Class.extend({
me.party.toLowerCase(), this.value); me.party.toLowerCase(), this.value);
}); });
}, },
make_item_group: function() { make_barcode: function() {
var me = this; var me = this;
this.item_group = wn.ui.form.make_control({ this.barcode = wn.ui.form.make_control({
df: { df: {
"fieldtype": "Link", "fieldtype": "Data",
"options": "Item Group", "label": "Barcode",
"label": "Item Group", "fieldname": "pos_barcode",
"fieldname": "pos_item_group", "placeholder": "Barcode / Serial No"
"placeholder": "Item Group"
}, },
parent: this.wrapper.find(".item-group-area"), parent: this.wrapper.find(".barcode-area"),
only_input: true, only_input: true,
}); });
this.item_group.make_input(); this.barcode.make_input();
this.item_group.$input.on("change", function() { this.barcode.$input.on("keypress", function() {
if(!me.item_group.autocomplete_open) if(me.barcode_timeout)
me.make_item_list(); clearTimeout(me.barcode_timeout);
me.barcode_timeout = setTimeout(function() { me.add_item_thru_barcode(); }, 1000);
}); });
}, },
make_search: function() { make_search: function() {
@@ -176,23 +193,23 @@ erpnext.POS = Class.extend({
me.item_timeout = setTimeout(function() { me.make_item_list(); }, 1000); me.item_timeout = setTimeout(function() { me.make_item_list(); }, 1000);
}); });
}, },
make_barcode: function() { make_item_group: function() {
var me = this; var me = this;
this.barcode = wn.ui.form.make_control({ this.item_group = wn.ui.form.make_control({
df: { df: {
"fieldtype": "Data", "fieldtype": "Link",
"label": "Barcode", "options": "Item Group",
"fieldname": "pos_barcode", "label": "Item Group",
"placeholder": "Barcode / Serial No" "fieldname": "pos_item_group",
"placeholder": "Item Group"
}, },
parent: this.wrapper.find(".barcode-area"), parent: this.wrapper.find(".item-group-area"),
only_input: true, only_input: true,
}); });
this.barcode.make_input(); this.item_group.make_input();
this.barcode.$input.on("keypress", function() { this.item_group.$input.on("change", function() {
if(me.barcode_timeout) if(!me.item_group.autocomplete_open)
clearTimeout(me.barcode_timeout); me.make_item_list();
me.barcode_timeout = setTimeout(function() { me.add_item_thru_barcode(); }, 1000);
}); });
}, },
make_item_list: function() { make_item_list: function() {
@@ -321,6 +338,7 @@ erpnext.POS = Class.extend({
refresh: function() { refresh: function() {
var me = this; var me = this;
this.party_field.set_input(this.frm.doc[this.party.toLowerCase()]); this.party_field.set_input(this.frm.doc[this.party.toLowerCase()]);
this.wrapper.find('input.flat-discount').val(this.frm.doc.flat_discount);
this.barcode.set_input(""); this.barcode.set_input("");
this.show_items_in_item_cart(); this.show_items_in_item_cart();

View File

@@ -173,18 +173,18 @@ patch_list = [
"patches.july_2013.p05_custom_doctypes_in_list_view", "patches.july_2013.p05_custom_doctypes_in_list_view",
"patches.july_2013.p06_same_sales_rate", "patches.july_2013.p06_same_sales_rate",
"patches.july_2013.p07_repost_billed_amt_in_sales_cycle", "patches.july_2013.p07_repost_billed_amt_in_sales_cycle",
"execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Classic') # 2013-07-22", "execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Classic') # 2013-12-26",
"execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Modern') # 2013-07-22", "execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Modern') # 2013-12-26",
"execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Spartan') # 2013-07-22", "execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Spartan') # 2013-12-26",
"execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Classic') # 2013-07-22", "execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Classic') # 2013-12-26",
"execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Modern') # 2013-07-22", "execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Modern') # 2013-12-26",
"execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Spartan') # 2013-07-22", "execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Spartan') # 2013-12-26",
"execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Classic') # 2013-07-22", "execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Classic') # 2013-12-26",
"execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Modern') # 2013-07-22", "execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Modern') # 2013-12-26",
"execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Spartan') # 2013-07-22", "execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Spartan') # 2013-12-26",
"execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Classic') # 2013-07-22", "execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Classic') # 2013-12-26",
"execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Modern') # 2013-07-22", "execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Modern') # 2013-12-26",
"execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Spartan') # 2013-07-22", "execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Spartan') # 2013-12-26",
"patches.july_2013.p08_custom_print_format_net_total_export", "patches.july_2013.p08_custom_print_format_net_total_export",
"patches.july_2013.p09_remove_website_pyc", "patches.july_2013.p09_remove_website_pyc",
"patches.july_2013.p10_change_partner_user_to_website_user", "patches.july_2013.p10_change_partner_user_to_website_user",
@@ -263,4 +263,9 @@ patch_list = [
"patches.1311.p08_email_digest_recipients", "patches.1311.p08_email_digest_recipients",
"execute:webnotes.delete_doc('DocType', 'Warehouse Type')", "execute:webnotes.delete_doc('DocType', 'Warehouse Type')",
"patches.1312.p02_update_item_details_in_item_price", "patches.1312.p02_update_item_details_in_item_price",
"execute:webnotes.reload_doc('accounts', 'Print Format', 'POS Invoice') # 2013-12-26",
"execute:webnotes.reload_doc('accounts', 'doctype', 'sales_invoice') # 2013-12-26",
"execute:webnotes.reload_doc('selling', 'doctype', 'sales_order') # 2013-12-26",
"execute:webnotes.reload_doc('selling', 'doctype', 'quotation') # 2013-12-26",
"execute:webnotes.reload_doc('stock', 'doctype', 'delivery_note') # 2013-12-26",
] ]