8032-devToTest_2440 #3009
|
@ -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),
|
||||
(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),
|
||||
(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),
|
||||
(60, 'Algemesi', NULL, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0);
|
||||
|
||||
|
|
|
@ -235,5 +235,6 @@
|
|||
"Cannot add holidays on this day": "Cannot add holidays on this day",
|
||||
"Cannot send mail": "Cannot send mail",
|
||||
"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"
|
||||
}
|
|
@ -3,6 +3,11 @@ module.exports = Self => {
|
|||
description: 'Returns the stock bought for a given date',
|
||||
accessType: 'READ',
|
||||
accepts: [{
|
||||
arg: 'workerFk',
|
||||
type: 'number',
|
||||
description: 'The id for a buyer',
|
||||
},
|
||||
{
|
||||
arg: 'dated',
|
||||
type: 'date',
|
||||
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 today = Date.vnNew();
|
||||
dated.setHours(0, 0, 0, 0);
|
||||
|
@ -27,8 +32,7 @@ module.exports = Self => {
|
|||
if (dated.getTime() === today.getTime())
|
||||
await models.StockBought.rawSql(`CALL vn.stockBought_calculate()`);
|
||||
|
||||
return models.StockBought.find(
|
||||
{
|
||||
const filter = {
|
||||
where: {
|
||||
dated: dated
|
||||
},
|
||||
|
@ -47,6 +51,11 @@ module.exports = Self => {
|
|||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
};
|
||||
|
||||
if (workerFk) filter.where.workerFk = workerFk;
|
||||
console.log('workerFk: ', workerFk);
|
||||
|
||||
return models.StockBought.find(filter);
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue