8032-devToTest_2440 #3009

Merged
alexm merged 262 commits from 8032-devToTest_2440 into test 2024-09-24 09:34:49 +00:00
3 changed files with 32 additions and 22 deletions
Showing only changes of commit cc1cd0563f - Show all commits

View File

@ -183,7 +183,7 @@ INSERT INTO `vn`.`warehouse`(`id`, `name`, `code`, `isComparative`, `isInventory
(3, 'Warehouse Three', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0), (3, 'Warehouse Three', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0),
(4, 'Warehouse Four', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1), (4, 'Warehouse Four', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1),
(5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0), (5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0),
(6, 'Warehouse six', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0), (6, 'Warehouse six', 'VNH', 1, 1, 1, 1, 0, 0, 1, 1, 0, 0),
(13, 'Inventory', 'inv', 1, 1, 1, 0, 0, 0, 1, 0, 0, 0), (13, 'Inventory', 'inv', 1, 1, 1, 0, 0, 0, 1, 0, 0, 0),
(60, 'Algemesi', NULL, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0); (60, 'Algemesi', NULL, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0);

View File

@ -235,5 +235,6 @@
"Cannot add holidays on this day": "Cannot add holidays on this day", "Cannot add holidays on this day": "Cannot add holidays on this day",
"Cannot send mail": "Cannot send mail", "Cannot send mail": "Cannot send mail",
"CONSTRAINT `chkParkingCodeFormat` failed for `vn`.`parking`": "CONSTRAINT `chkParkingCodeFormat` failed for `vn`.`parking`", "CONSTRAINT `chkParkingCodeFormat` failed for `vn`.`parking`": "CONSTRAINT `chkParkingCodeFormat` failed for `vn`.`parking`",
"This postcode already exists": "This postcode already exists" "This postcode already exists": "This postcode already exists",
"This buyer has already made a reservation for this date": "This buyer has already made a reservation for this date"
} }

View File

@ -3,6 +3,11 @@ module.exports = Self => {
description: 'Returns the stock bought for a given date', description: 'Returns the stock bought for a given date',
accessType: 'READ', accessType: 'READ',
accepts: [{ accepts: [{
arg: 'workerFk',
type: 'number',
description: 'The id for a buyer',
},
{
arg: 'dated', arg: 'dated',
type: 'date', type: 'date',
description: 'The date to filter', description: 'The date to filter',
@ -18,7 +23,7 @@ module.exports = Self => {
} }
}); });
Self.getStockBought = async(dated = Date.vnNew()) => { Self.getStockBought = async(workerFk, dated = Date.vnNew()) => {
const models = Self.app.models; const models = Self.app.models;
const today = Date.vnNew(); const today = Date.vnNew();
dated.setHours(0, 0, 0, 0); dated.setHours(0, 0, 0, 0);
@ -27,8 +32,7 @@ module.exports = Self => {
if (dated.getTime() === today.getTime()) if (dated.getTime() === today.getTime())
await models.StockBought.rawSql(`CALL vn.stockBought_calculate()`); await models.StockBought.rawSql(`CALL vn.stockBought_calculate()`);
return models.StockBought.find( const filter = {
{
where: { where: {
dated: dated dated: dated
}, },
@ -47,6 +51,11 @@ module.exports = Self => {
} }
} }
] ]
}); };
if (workerFk) filter.where.workerFk = workerFk;
console.log('workerFk: ', workerFk);
return models.StockBought.find(filter);
}; };
}; };