7404-stockBuyed #2836

Merged
pablone merged 19 commits from 7404-stockBuyed into dev 2024-09-17 11:59:49 +00:00
2 changed files with 8 additions and 6 deletions
Showing only changes of commit 8607a60ca7 - Show all commits

View File

@ -3,9 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`stockBought_calcula
BEGIN
/**
* Inserts the purchase volume per buyer
* into stockBought according to the date.
*
* @param vDated Purchase date
* into stockBought according to the current date.
*/
DECLARE vDated DATE;
SET vDated = util.VN_CURDATE();

View File

@ -23,7 +23,11 @@ module.exports = Self => {
}
});
Self.getStockBoughtDetail = async(workerFk, dated = Date.vnNew()) => {
Self.getStockBoughtDetail = async(workerFk, dated) => {
if (!dated) {
dated = Date.vnNew();
dated.setHours(0, 0, 0, 0);
}
return Self.rawSql(
`SELECT e.id entryFk,
i.id itemFk,
@ -47,8 +51,8 @@ module.exports = Self => {
JOIN volumeConfig vc
WHERE t.warehouseInFk = ac.warehouseFk
AND it.workerFk = ?
AND t.shipped = ?`,
[workerFk, new Date(dated)]
AND t.shipped = util.VN_CURDATE()`,
[workerFk]
);
};
};