Skip to content

Commit

Permalink
feat(pos): Total item qty field to POS screen (frappe#28331)
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesis189 authored and conncampbell committed Jan 9, 2022
1 parent af3aaf1 commit 5d475f4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions erpnext/public/scss/point-of-sale.scss
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,11 @@
font-size: var(--text-md);
}

> .item-qty-total-container {
@extend .net-total-container;
padding: 5px 0px 0px 0px;
}

> .taxes-container {
display: none;
flex-direction: column;
Expand Down
21 changes: 21 additions & 0 deletions erpnext/selling/page/point_of_sale/pos_item_cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ erpnext.PointOfSale.ItemCart = class {
`<div class="add-discount-wrapper">
${this.get_discount_icon()} ${__('Add Discount')}
</div>
<div class="item-qty-total-container">
<div class="item-qty-total-label">${__('Total Items')}</div>
<div class="item-qty-total-value">0.00</div>
</div>
<div class="net-total-container">
<div class="net-total-label">${__("Net Total")}</div>
<div class="net-total-value">0.00</div>
Expand Down Expand Up @@ -142,6 +146,7 @@ erpnext.PointOfSale.ItemCart = class {

this.$numpad_section.prepend(
`<div class="numpad-totals">
<span class="numpad-item-qty-total"></span>
<span class="numpad-net-total"></span>
<span class="numpad-grand-total"></span>
</div>`
Expand Down Expand Up @@ -470,6 +475,7 @@ erpnext.PointOfSale.ItemCart = class {
if (!frm) frm = this.events.get_frm();

this.render_net_total(frm.doc.net_total);
this.render_total_item_qty(frm.doc.items);
const grand_total = cint(frappe.sys_defaults.disable_rounded_total) ? frm.doc.grand_total : frm.doc.rounded_total;
this.render_grand_total(grand_total);

Expand All @@ -487,6 +493,21 @@ erpnext.PointOfSale.ItemCart = class {
);
}

render_total_item_qty(items) {
var total_item_qty = 0;
items.map((item) => {
total_item_qty = total_item_qty + item.qty;
});

this.$totals_section.find('.item-qty-total-container').html(
`<div>${__('Total Quantity')}</div><div>${total_item_qty}</div>`
);

this.$numpad_section.find('.numpad-item-qty-total').html(
`<div>${__('Total Quantity')}: <span>${total_item_qty}</span></div>`
);
}

render_grand_total(value) {
const currency = this.events.get_frm().doc.currency;
this.$totals_section.find('.grand-total-container').html(
Expand Down

0 comments on commit 5d475f4

Please sign in to comment.