feat: batch transactions

This commit is contained in:
akshayitzme
2023-01-13 18:46:52 +05:30
parent 665e341450
commit 08e46592a9
15 changed files with 46 additions and 3 deletions
+2
View File
@@ -18,6 +18,8 @@ export class Item extends Doc {
trackItem?: boolean;
itemType?: 'Product' | 'Service';
for?: 'Purchases' | 'Sales' | 'Both';
hasBatchNumber?: boolean;
batchNumber?:string;
formulas: FormulaMap = {
incomeAccount: {
+1
View File
@@ -11,6 +11,7 @@ export class PurchaseReceipt extends StockTransfer {
formRoute: ({ name }) => `/edit/PurchaseReceipt/${name}`,
columns: [
'name',
'batchNumber',
getTransactionStatusColumn(),
'party',
'date',
+1
View File
@@ -10,4 +10,5 @@ export class StockLedgerEntry extends Doc {
location?: string;
referenceName?: string;
referenceType?: string;
batchNumber?: string;
}
+3
View File
@@ -204,6 +204,7 @@ class StockManagerItem {
referenceType: string;
fromLocation?: string;
toLocation?: string;
batchNumber?: string;
stockLedgerEntries?: StockLedgerEntry[];
@@ -218,6 +219,7 @@ class StockManagerItem {
this.toLocation = details.toLocation;
this.referenceName = details.referenceName;
this.referenceType = details.referenceType;
this.batchNumber = details.batchNumber;
this.fyo = fyo;
}
@@ -270,6 +272,7 @@ class StockManagerItem {
date: this.date,
item: this.item,
rate: this.rate,
batchNumber: this.batchNumber,
quantity,
location,
referenceName: this.referenceName,
+1
View File
@@ -84,6 +84,7 @@ export class StockMovement extends Transfer {
item: row.item!,
rate: row.rate!,
quantity: row.quantity!,
batchNumber: row.batchNumber!,
fromLocation: row.fromLocation,
toLocation: row.toLocation,
}));
+1
View File
@@ -19,6 +19,7 @@ export class StockMovementItem extends Doc {
rate?: Money;
amount?: Money;
parentdoc?: StockMovement;
batchNumber? : string;
get isIssue() {
return this.parentdoc?.movementType === MovementType.MaterialIssue;
+1
View File
@@ -68,6 +68,7 @@ export abstract class StockTransfer extends Transfer {
item: row.item!,
rate: row.rate!,
quantity: row.quantity!,
batchNumber: row.batchNumber!,
fromLocation,
toLocation,
};
+1
View File
@@ -12,6 +12,7 @@ export class StockTransferItem extends Doc {
unit?: string;
description?: string;
hsnCode?: number;
batchNumber?: string
formulas: FormulaMap = {
description: {
+1
View File
@@ -21,6 +21,7 @@ export interface SMTransferDetails {
item: string;
rate: Money;
quantity: number;
batchNumber?: string;
fromLocation?: string;
toLocation?: string;
}
+3 -1
View File
@@ -17,6 +17,7 @@ export async function getRawStockLedgerEntries(fyo: Fyo) {
'name',
'date',
'item',
"batchNumber",
'rate',
'quantity',
'location',
@@ -42,7 +43,7 @@ export function getStockLedgerEntries(
const name = safeParseInt(sle.name);
const date = new Date(sle.date);
const rate = safeParseFloat(sle.rate);
const { item, location, quantity, referenceName, referenceType } = sle;
const { item, location, batchNumber, quantity, referenceName, referenceType } = sle;
if (quantity === 0) {
continue;
@@ -81,6 +82,7 @@ export function getStockLedgerEntries(
item,
location,
batchNumber,
quantity,
balanceQuantity,
+2
View File
@@ -5,6 +5,7 @@ export interface RawStockLedgerEntry {
date: string;
item: string;
rate: string;
batchNumber: string;
quantity: number;
location: string;
referenceName: string;
@@ -20,6 +21,7 @@ export interface ComputedStockLedgerEntry{
item: string;
location:string;
batchNumber: string;
quantity: number;
balanceQuantity: number;
+10 -2
View File
@@ -93,9 +93,16 @@
"label": "Stock Not Transferred",
"fieldtype": "Float",
"readOnly": true
},
{
"fieldname": "batchNumber",
"label": "Batch No",
"fieldtype": "Data",
"create": true,
"placeholder": "Batch No"
}
],
"tableFields": ["item", "tax", "quantity", "rate", "amount"],
"tableFields": ["item", "tax", "quantity", "rate", "amount", "batchNumber"],
"keywordFields": ["item", "tax"],
"quickEditFields": [
"item",
@@ -110,6 +117,7 @@
"itemDiscountAmount",
"itemDiscountPercent",
"itemDiscountedTotal",
"itemTaxedTotal"
"itemTaxedTotal",
"batchNumber"
]
}
+7
View File
@@ -31,6 +31,12 @@
"default": "Unit",
"placeholder": "Unit Type"
},
{
"fieldname": "hasBatchNumber",
"label": "Has Batch No",
"fieldtype": "Check",
"default": false
},
{
"fieldname": "itemType",
"label": "Type",
@@ -116,6 +122,7 @@
"quickEditFields": [
"rate",
"unit",
"hasBatchNumber",
"itemType",
"for",
"tax",
@@ -49,6 +49,13 @@
"label": "Ref. Type",
"fieldtype": "Data",
"readOnly": true
},
{
"fieldname": "batchNumber",
"label": "Batch No",
"fieldtype": "Data",
"create": true,
"placeholder": "Batch No"
}
]
}
@@ -17,6 +17,11 @@
"target": "Location",
"required": true
},
{
"fieldname": "batchNumber",
"label": "Batch No",
"fieldtype": "Data"
},
{
"fieldname": "quantity",
"label": "Quantity",