diff --git a/models/baseModels/InvoiceItem/InvoiceItem.ts b/models/baseModels/InvoiceItem/InvoiceItem.ts index 137c467d..28e9a9cb 100644 --- a/models/baseModels/InvoiceItem/InvoiceItem.ts +++ b/models/baseModels/InvoiceItem/InvoiceItem.ts @@ -36,6 +36,7 @@ export abstract class InvoiceItem extends Doc { transferUnit?: string; quantity?: number; transferQuantity?: number; + quantities?: number; unitConversionFactor?: number; batch?: string; @@ -231,13 +232,28 @@ export abstract class InvoiceItem extends Doc { }, transferQuantity: { formula: (fieldname) => { + if (fieldname === 'quantities') { + return this.quantities + } if (fieldname === 'quantity' || this.unit === this.transferUnit) { return this.quantity; } return this.transferQuantity; }, - dependsOn: ['item', 'quantity'], + dependsOn: ['item', 'quantity', 'quantities'], + }, + quantities: { + formula: (fieldname) => { + if (fieldname === 'transferQuantity') { + return this.transferQuantity + } + if (fieldname === 'quantity' || this.unit === this.transferUnit) { + return this.quantity; + } + return this.transferQuantity; + }, + dependsOn: ['transferQuantity', 'quantity'], }, quantity: { formula: async (fieldname) => { @@ -250,7 +266,7 @@ export abstract class InvoiceItem extends Doc { this.item ); const unitDoc = itemDoc.getLink('uom'); - + let quantity: number = this.quantity ?? 1; if (this.isReturn && quantity > 0) { diff --git a/schemas/app/InvoiceItem.json b/schemas/app/InvoiceItem.json index 9ce000a4..1fc93792 100644 --- a/schemas/app/InvoiceItem.json +++ b/schemas/app/InvoiceItem.json @@ -44,6 +44,13 @@ "default": 1, "required": true }, + { + "fieldname": "quantities", + "label": "Qty", + "fieldtype": "Float", + "default": 1, + "computed": true + }, { "fieldname": "unit", "label": "Stock Unit", @@ -140,7 +147,7 @@ "readOnly": true } ], - "tableFields": ["item", "tax", "quantity", "rate", "amount"], + "tableFields": ["item", "tax", "quantities", "rate", "amount"], "keywordFields": ["item", "tax"], "quickEditFields": [ "item", diff --git a/templates/Basic.template.html b/templates/Basic.template.html index c6e7d16b..5184d22a 100644 --- a/templates/Basic.template.html +++ b/templates/Basic.template.html @@ -60,12 +60,12 @@
-
{{ t`Item` }}
-
{{ t`Description` }}
-
+
{{ t`Item` }}
+
{{ t`Description` }}
+
{{ t`HSN/SAC` }}
-
{{ t`Quantity` }}
+
{{ t`Qty` }}
{{ t`Rate` }}
{{ t`Amount` }}
@@ -76,19 +76,21 @@ v-for="row in doc.items" :key="row.name" > -
{{ row.item }}
-
+
{{ row.item }}
+
{{ row.description }}
-
+
{{ row.hsnCode }}
-
-
{{ row.quantity }}
+
+
{{ row.quantities }}
- ({{row.transferQuantity}} of {{ row.transferUnit }}) + ({{ row.quantity}} of {{ row.transferUnit }}) +
+
+ ({{ row.quantity }} of {{ row.unit }})
-
({{row.quantity}} of {{ row.unit }})
{{ row.rate }}
{{ row.amount }}
diff --git a/templates/Business-POS.template.html b/templates/Business-POS.template.html index a15cf906..357ebe7b 100644 --- a/templates/Business-POS.template.html +++ b/templates/Business-POS.template.html @@ -56,13 +56,7 @@ >
{{ index + 1 }}
{{ row.item }}
-
-
{{ row.quantity }}
-
- ({{row.transferQuantity}} of {{ row.transferUnit }}) -
-
({{row.quantity}} of {{ row.unit }})
-
+
{{ row.quantity }}
{{ row.rate }}
{{ row.amount }}
diff --git a/templates/Business.template.html b/templates/Business.template.html index e29ca665..d581f8ed 100644 --- a/templates/Business.template.html +++ b/templates/Business.template.html @@ -60,10 +60,10 @@
-
{{ t`Item` }}
-
{{ t`Description` }}
-
{{ t`HSN/SAC` }}
-
{{ t`Quantity` }}
+
{{ t`Item` }}
+
{{ t`Description` }}
+
{{ t`HSN/SAC` }}
+
{{ t`Qty` }}
{{ t`Rate` }}
{{ t`Amount` }}
@@ -74,15 +74,17 @@ v-for="row in doc.items" :key="row.name" > -
{{ row.item }}
-
{{ row.description }}
-
{{ row.hsnCode }}
-
-
{{ row.quantity }}
+
{{ row.item }}
+
{{ row.description }}
+
{{ row.hsnCode }}
+
+
{{ row.quantities }}
- ({{row.transferQuantity}} of {{ row.transferUnit }}) + ({{ row.quantity }} of {{ row.transferUnit }}) +
+
+ ({{ row.quantity }} of {{ row.unit }})
-
({{row.quantity}} of {{ row.unit }})
{{ row.rate }}
{{ row.amount }}
diff --git a/templates/Minimal.template.html b/templates/Minimal.template.html index 4804e4f5..8e2f6524 100644 --- a/templates/Minimal.template.html +++ b/templates/Minimal.template.html @@ -98,29 +98,31 @@ text-gray-800 " > -
{{ t`Item` }}
-
+
{{ t`Item` }}
+
{{ t`Description` }}
-
{{ t`HSN/SAC` }}
-
{{ t`Quantity` }}
+
{{ t`HSN/SAC` }}
+
{{ t`Qty` }}
{{ t`Rate` }}
{{ t`Amount`}}
-
{{ row.item }}
-
+
{{ row.item }}
+
{{ row.description }}
-
{{ row.hsnCode }}
-
-
{{ row.quantity }}
+
{{ row.hsnCode }}
+
+
{{ row.quantities }}
- ({{row.transferQuantity}} of {{ row.transferUnit }}) + ({{ row.quantity }} of {{ row.transferUnit }}) +
+
+ ({{ row.quantity }} of {{ row.unit }})
-
({{row.quantity}} of {{ row.unit }})
{{ row.rate }}
{{ row.amount }}