Skip to content

Commit

Permalink
fix: include HSN code when adding an item in POS
Browse files Browse the repository at this point in the history
  • Loading branch information
AbleKSaju committed Jan 29, 2025
1 parent 7d808c2 commit ca1ba58
Showing 1 changed file with 27 additions and 20 deletions.
47 changes: 27 additions & 20 deletions src/pages/POS/POS.vue
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,12 @@ export default defineComponent({
invoiceItem.item === item.name && !invoiceItem.isFreeItem
) ?? [];
const itemsHsncode = (await this.fyo.getValue(
'Item',
item?.name as string,
'hsnCode'
)) as number;
if (item.hasBatch) {
for (const invItem of existingItems) {
const itemQty = invItem.quantity ?? 0;
Expand Down Expand Up @@ -557,6 +563,7 @@ export default defineComponent({
await this.sinvDoc.append('items', {
rate: item.rate as Money,
item: item.name,
hsnCode: itemsHsncode,
});
return;
Expand Down Expand Up @@ -584,32 +591,32 @@ export default defineComponent({
return;
}
await this.sinvDoc.append('items', {
rate: item.rate as Money,
item: item.name,
quantity: quantity ? quantity : 1,
hsnCode: itemsHsncode,
});
if (this.sinvDoc.priceList) {
let itemData = this.sinvDoc.items?.filter(
(val) => val.item == item.name
) as SalesInvoiceItem[];
itemData[0].rate = await getItemRateFromPriceList(
itemData[0],
this.sinvDoc.priceList
);
}
await this.applyPricingRule();
await this.sinvDoc.runFormulas();
} catch (error) {
return showToast({
type: 'error',
message: t`${error as string}`,
});
}
await this.sinvDoc.append('items', {
rate: item.rate as Money,
item: item.name,
quantity: quantity ? quantity : 1,
});
if (this.sinvDoc.priceList) {
let itemData = this.sinvDoc.items?.filter(
(val) => val.item == item.name
) as SalesInvoiceItem[];
itemData[0].rate = await getItemRateFromPriceList(
itemData[0],
this.sinvDoc.priceList
);
}
await this.applyPricingRule();
await this.sinvDoc.runFormulas();
},
async createTransaction(shouldPrint = false, isPay = false) {
try {
Expand Down

0 comments on commit ca1ba58

Please sign in to comment.