- fix: Schedule write journal entries after item compute cost.

- fix: active vouchers query.
- fix: remove babel loader in server-side.
This commit is contained in:
Ahmed Bouhuolia
2020-08-29 22:11:42 +02:00
parent e4270dc039
commit 74321a2886
12 changed files with 217 additions and 104 deletions

View File

@@ -84,8 +84,7 @@ export default class InventoryCostLotTracker extends InventoryCostMethod impleme
*/
private async fetchInvINTransactions() {
const commonBuilder = (builder: any) => {
builder.where('direction', 'IN');
builder.orderBy('date', 'ASC');
builder.orderBy('date', (this.costMethod === 'LIFO') ? 'DESC': 'ASC');
builder.where('item_id', this.itemId);
};
const afterInvTransactions: IInventoryTransaction[] =
@@ -93,8 +92,8 @@ export default class InventoryCostLotTracker extends InventoryCostMethod impleme
.query()
.modify('filterDateRange', this.startingDate)
.orderByRaw("FIELD(direction, 'IN', 'OUT')")
.orderBy('lot_number', (this.costMethod === 'LIFO') ? 'DESC' : 'ASC')
.onBuild(commonBuilder)
.orderBy('lot_number', (this.costMethod === 'LIFO') ? 'DESC' : 'ASC')
.withGraphFetched('item');
const availiableINLots: IInventoryLotCost[] =
@@ -102,7 +101,8 @@ export default class InventoryCostLotTracker extends InventoryCostMethod impleme
.query()
.modify('filterDateRange', null, this.startingDate)
.orderBy('date', 'ASC')
.orderBy('lot_number', 'ASC')
.where('direction', 'IN')
.orderBy('lot_number', 'ASC')
.onBuild(commonBuilder)
.whereNot('remaining', 0);