pos view showing inclusive taxes

This commit is contained in:
Akhilesh Darjee
2014-01-10 15:05:44 +05:30
parent 701cddfb15
commit 371663169c

View File

@@ -60,10 +60,16 @@ erpnext.POS = Class.extend({
</div>\ </div>\
</div>\ </div>\
<br><br>\ <br><br>\
<button class="btn btn-success btn-lg make-payment">\ <div class="row">\
<i class="icon-money"></i> Make Payment</button>\ <div class="col-sm-9">\
<button class="btn btn-default btn-lg delete-items pull-right" style="display: none;">\ <button class="btn btn-success btn-lg make-payment">\
<i class="icon-trash"></i> Del</button>\ <i class="icon-money"></i> Make Payment</button>\
</div>\
<div class="col-sm-3">\
<button class="btn btn-default btn-lg remove-items" style="display: none;">\
<i class="icon-trash"></i> Del</button>\
</div>\
</div>\
<br><br>\ <br><br>\
</div>\ </div>\
<div class="col-sm-6">\ <div class="col-sm-6">\
@@ -82,7 +88,7 @@ erpnext.POS = Class.extend({
me.refresh(); me.refresh();
}); });
this.call_function("delete-items", function() {me.remove_selected_item();}); this.call_function("remove-items", function() {me.remove_selected_items();});
this.call_function("make-payment", function() {me.make_payment();}); this.call_function("make-payment", function() {me.make_payment();});
}, },
check_transaction_type: function() { check_transaction_type: function() {
@@ -333,7 +339,7 @@ erpnext.POS = Class.extend({
} }
this.disable_text_box_and_button(); this.disable_text_box_and_button();
this.make_payment_button(); this.hide_payment_button();
// If quotation to is not Customer then remove party // If quotation to is not Customer then remove party
if (this.frm.doctype == "Quotation") { if (this.frm.doctype == "Quotation") {
@@ -370,21 +376,21 @@ erpnext.POS = Class.extend({
var taxes = wn.model.get_children(this.sales_or_purchase + " Taxes and Charges", var taxes = wn.model.get_children(this.sales_or_purchase + " Taxes and Charges",
this.frm.doc.name, this.frm.cscript.other_fname, this.frm.doctype); this.frm.doc.name, this.frm.cscript.other_fname, this.frm.doctype);
$(this.wrapper).find(".tax-table") $(this.wrapper).find(".tax-table")
.toggle((taxes && taxes.length && .toggle((taxes && taxes.length) ? true : false)
flt(me.frm.doc.other_charges_total_export ||
me.frm.doc.other_charges_added_import) != 0.0) ? true : false)
.find("tbody").empty(); .find("tbody").empty();
$.each(taxes, function(i, d) { $.each(taxes, function(i, d) {
$(repl('<tr>\ if (d.tax_amount) {
<td>%(description)s %(rate)s</td>\ $(repl('<tr>\
<td style="text-align: right;">%(tax_amount)s</td>\ <td>%(description)s %(rate)s</td>\
<tr>', { <td style="text-align: right;">%(tax_amount)s</td>\
description: d.description, <tr>', {
rate: ((d.charge_type == "Actual") ? '' : ("(" + d.rate + "%)")), description: d.description,
tax_amount: format_currency(flt(d.tax_amount)/flt(me.frm.doc.conversion_rate), rate: ((d.charge_type == "Actual") ? '' : ("(" + d.rate + "%)")),
me.frm.doc.currency) tax_amount: format_currency(flt(d.tax_amount)/flt(me.frm.doc.conversion_rate),
})).appendTo(".tax-table tbody"); me.frm.doc.currency)
})).appendTo(".tax-table tbody");
}
}); });
}, },
set_totals: function() { set_totals: function() {
@@ -427,7 +433,7 @@ erpnext.POS = Class.extend({
$(this.wrapper).find('input, button').each(function () { $(this.wrapper).find('input, button').each(function () {
$(this).prop('disabled', true); $(this).prop('disabled', true);
}); });
$(this.wrapper).find(".delete-items").hide(); $(this.wrapper).find(".remove-items").hide();
$(this.wrapper).find(".make-payment").hide(); $(this.wrapper).find(".make-payment").hide();
} }
else { else {
@@ -437,14 +443,14 @@ erpnext.POS = Class.extend({
$(this.wrapper).find(".make-payment").show(); $(this.wrapper).find(".make-payment").show();
} }
}, },
make_payment_button: function() { hide_payment_button: function() {
var me = this; var me = this;
// Show Make Payment button only in Sales Invoice // Show Make Payment button only in Sales Invoice
if (this.frm.doctype != "Sales Invoice") if (this.frm.doctype != "Sales Invoice")
$(this.wrapper).find(".make-payment").hide(); $(this.wrapper).find(".make-payment").hide();
}, },
refresh_delete_btn: function() { refresh_delete_btn: function() {
$(this.wrapper).find(".delete-items").toggle($(".item-cart .warning").length ? true : false); $(this.wrapper).find(".remove-items").toggle($(".item-cart .warning").length ? true : false);
}, },
add_item_thru_barcode: function() { add_item_thru_barcode: function() {
var me = this; var me = this;
@@ -466,7 +472,7 @@ erpnext.POS = Class.extend({
} }
}); });
}, },
remove_selected_item: function() { remove_selected_items: function() {
var me = this; var me = this;
var selected_items = []; var selected_items = [];
var no_of_items = $(this.wrapper).find("#cart tbody tr").length; var no_of_items = $(this.wrapper).find("#cart tbody tr").length;
@@ -487,6 +493,7 @@ erpnext.POS = Class.extend({
} }
} }
}); });
this.refresh_grid(); this.refresh_grid();
}, },
refresh_grid: function() { refresh_grid: function() {