This commit is contained in:
Gadha2311
2026-01-12 10:24:53 +05:30
parent 5c7c4dbdf9
commit f7887d1401
6 changed files with 66 additions and 43 deletions
+18 -2
View File
@@ -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) {
+8 -1
View File
@@ -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",
+13 -11
View File
@@ -60,12 +60,12 @@
<section class="mt-8 text-base">
<!-- Heading Row -->
<section class="text-gray-600 w-full flex border-b">
<div class="py-4 w-5/12">{{ t`Item` }}</div>
<div class="py-4 w-5/12" v-if="doc.description">{{ t`Description` }}</div>
<div class="py-4 text-right w-2/12" v-if="doc.showHSN">
<div class="py-4 w-4/12">{{ t`Item` }}</div>
<div class="py-4 w-4/12" v-if="doc.description">{{ t`Description` }}</div>
<div class="py-4 text-right w-3/12" v-if="doc.showHSN">
{{ t`HSN/SAC` }}
</div>
<div class="py-4 text-right w-1/12">{{ t`Quantity` }}</div>
<div class="py-4 text-right w-3/12">{{ t`Qty` }}</div>
<div class="py-4 text-right w-3/12">{{ t`Rate` }}</div>
<div class="py-4 text-right w-3/12">{{ t`Amount` }}</div>
</section>
@@ -76,19 +76,21 @@
v-for="row in doc.items"
:key="row.name"
>
<div class="w-5/12 py-4">{{ row.item }}</div>
<div class="w-5/12 py-4" v-if="doc.description">
<div class="w-4/12 py-4">{{ row.item }}</div>
<div class="w-4/12 py-4" v-if="doc.description">
{{ row.description }}
</div>
<div class="w-2/12 text-right py-4" v-if="doc.showHSN">
<div class="w-3/12 text-right py-4" v-if="doc.showHSN">
{{ row.hsnCode }}
</div>
<div class="w-1/12 text-right py-4">
<div>{{ row.quantity }}</div>
<div class="w-3/12 text-right py-4">
<div>{{ row.quantities }}</div>
<div v-if="row.transferUnit">
({{row.transferQuantity}} of {{ row.transferUnit }})
({{ row.quantity}} of {{ row.transferUnit }})
</div>
<div v-else-if="row.unit">
({{ row.quantity }} of {{ row.unit }})
</div>
<div v-else-if="row.unit">({{row.quantity}} of {{ row.unit }})</div>
</div>
<div class="w-3/12 text-right py-4">{{ row.rate }}</div>
<div class="w-3/12 text-right py-4">{{ row.amount }}</div>
+1 -7
View File
@@ -56,13 +56,7 @@
>
<div class="w-4 py-1">{{ index + 1 }}</div>
<div class="w-2/5 py-1">{{ row.item }}</div>
<div class="w-1/12 py-1 text-left">
<div>{{ row.quantity }}</div>
<div v-if="row.transferUnit">
({{row.transferQuantity}} of {{ row.transferUnit }})
</div>
<div v-else-if="row.unit">({{row.quantity}} of {{ row.unit }})</div>
</div>
<div class="w-1/12 py-1 text-left">{{ row.quantity }}</div>
<div class="w-3/12 text-right py-1">{{ row.rate }}</div>
<div class="w-3/12 text-right py-1">{{ row.amount }}</div>
</section>
+13 -11
View File
@@ -60,10 +60,10 @@
<section class="px-12 pt-12 text-lg">
<!-- Heading Row -->
<section class="mb-4 flex font-semibold">
<div class="w-4/12">{{ t`Item` }}</div>
<div class="w-4/12" v-if="doc.description">{{ t`Description` }}</div>
<div class="w-2/12 text-right" v-if="doc.showHSN">{{ t`HSN/SAC` }}</div>
<div class="w-2/12 text-right">{{ t`Quantity` }}</div>
<div class="w-3/12">{{ t`Item` }}</div>
<div class="w-3/12" v-if="doc.description">{{ t`Description` }}</div>
<div class="w-3/12 text-right" v-if="doc.showHSN">{{ t`HSN/SAC` }}</div>
<div class="w-3/12 text-right">{{ t`Qty` }}</div>
<div class="w-3/12 text-right">{{ t`Rate` }}</div>
<div class="w-3/12 text-right">{{ t`Amount` }}</div>
</section>
@@ -74,15 +74,17 @@
v-for="row in doc.items"
:key="row.name"
>
<div class="w-4/12">{{ row.item }}</div>
<div class="w-4/12" v-if="doc.description">{{ row.description }}</div>
<div class="w-2/12 text-right" v-if="doc.showHSN">{{ row.hsnCode }}</div>
<div class="w-2/12 text-right">
<div>{{ row.quantity }}</div>
<div class="w-3/12">{{ row.item }}</div>
<div class="w-3/12" v-if="doc.description">{{ row.description }}</div>
<div class="w-3/12 text-right" v-if="doc.showHSN">{{ row.hsnCode }}</div>
<div class="w-3/12 text-right">
<div>{{ row.quantities }}</div>
<div v-if="row.transferUnit">
({{row.transferQuantity}} of {{ row.transferUnit }})
({{ row.quantity }} of {{ row.transferUnit }})
</div>
<div v-else-if="row.unit">
({{ row.quantity }} of {{ row.unit }})
</div>
<div v-else-if="row.unit">({{row.quantity}} of {{ row.unit }})</div>
</div>
<div class="w-3/12 text-right">{{ row.rate }}</div>
<div class="w-3/12 text-right">{{ row.amount }}</div>
+13 -11
View File
@@ -98,29 +98,31 @@
text-gray-800
"
>
<div class="w-4/12 text-left">{{ t`Item` }}</div>
<div class="w-4/12 text-left" v-if="doc.description">
<div class="w-3/12 text-left">{{ t`Item` }}</div>
<div class="w-3/12 text-left" v-if="doc.description">
{{ t`Description` }}
</div>
<div class="w-2/12 text-right" v-if="doc.showHSN">{{ t`HSN/SAC` }}</div>
<div class="w-2/12 text-right">{{ t`Quantity` }}</div>
<div class="w-3/12 text-right" v-if="doc.showHSN">{{ t`HSN/SAC` }}</div>
<div class="w-3/12 text-right">{{ t`Qty` }}</div>
<div class="w-3/12 text-right">{{ t`Rate` }}</div>
<div class="w-3/12 text-right">{{ t`Amount`}}</div>
</section>
<!-- Body Rows -->
<section class="flex py-1 text-lg" v-for="row in doc.items" :key="row.name">
<div class="w-4/12 text-left">{{ row.item }}</div>
<div class="w-4/12 text-left" v-if="doc.description">
<div class="w-3/12 text-left">{{ row.item }}</div>
<div class="w-3/12 text-left" v-if="doc.description">
{{ row.description }}
</div>
<div class="w-2/12 text-right" v-if="doc.showHSN">{{ row.hsnCode }}</div>
<div class="w-2/12 text-right">
<div>{{ row.quantity }}</div>
<div class="w-3/12 text-right" v-if="doc.showHSN">{{ row.hsnCode }}</div>
<div class="w-3/12 text-right">
<div>{{ row.quantities }}</div>
<div v-if="row.transferUnit">
({{row.transferQuantity}} of {{ row.transferUnit }})
({{ row.quantity }} of {{ row.transferUnit }})
</div>
<div v-else-if="row.unit">
({{ row.quantity }} of {{ row.unit }})
</div>
<div v-else-if="row.unit">({{row.quantity}} of {{ row.unit }})</div>
</div>
<div class="w-3/12 text-right">{{ row.rate }}</div>
<div class="w-3/12 text-right">{{ row.amount }}</div>