fix: update available refresh procedure to correctly handle date comparisons #3477
|
@ -1130,7 +1130,7 @@ INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `pric
|
|||
(40, 2, 34, 'Melee weapon combat fist 15cm', 10.00, 3.91, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack,hasItemLost'),
|
||||
(41, 2, 35, 'Melee weapon combat fist 15cm', 8.00, 3.01, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack,hasRounding,hasItemLost'),
|
||||
(42, 2, 36, 'Melee weapon combat fist 15cm', 6.00, 2.50, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack,hasRounding,hasItemLost'),
|
||||
(43, 88, 1000000, 'Chest medical box 2', 15.00, 10.00, 0, 0, 0, CURDATE(), '');
|
||||
(43, 88, 1000000, 'Chest medical box 2', 20, 10.00, 0, 0, 0, CURDATE(), '');
|
||||
|
||||
INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
|
||||
VALUES
|
||||
|
|
|
@ -92,12 +92,9 @@ proc: BEGIN
|
|||
SELECT i.itemFk, IFNULL(i.availabled, i.landed), i.quantity
|
||||
FROM vn.itemEntryIn i
|
||||
JOIN itemRange ir ON ir.itemFk = i.itemFk
|
||||
LEFT JOIN edi.warehouseFloramondo wf ON wf.entryFk = i.entryFk
|
||||
WHERE IFNULL(i.availabled, i.landed) >= vStartDate
|
||||
AND IFNULL(i.availabled, i.landed) <= vAvailabled
|
||||
WHERE IFNULL(i.availabled, CAST(i.landed AS DATETIME)) >= vAvailabled
|
||||
AND (ir.ended IS NULL OR IFNULL(i.availabled, i.landed) <= ir.ended)
|
||||
AND i.warehouseInFk = vWarehouse
|
||||
AND wf.entryFk IS NULL
|
||||
UNION ALL
|
||||
SELECT i.itemFk, i.shipped, i.quantity
|
||||
FROM vn.itemEntryOut i
|
||||
|
|
|
@ -17,8 +17,8 @@ describe('Sale - replaceItem function', () => {
|
|||
|
||||
it('should replace full item in sale and send notification', async() => {
|
||||
const saleFk = 43;
|
||||
const substitutionFk = 3;
|
||||
const quantity = 15;
|
||||
const substitutionFk = 4;
|
||||
const quantity = 20;
|
||||
const ticketFk = 1000000;
|
||||
|
||||
const salesBefore = await models.Sale.find({where: {ticketFk}}, options);
|
||||
|
@ -39,7 +39,7 @@ describe('Sale - replaceItem function', () => {
|
|||
|
||||
it('should replace half item in sale and send notification', async() => {
|
||||
const saleFk = 43;
|
||||
const substitutionFk = 3;
|
||||
const substitutionFk = 4;
|
||||
const quantity = 10;
|
||||
const ticketFk = 1000000;
|
||||
|
||||
|
@ -55,7 +55,7 @@ describe('Sale - replaceItem function', () => {
|
|||
expect(salesAfter[0].id).toEqual(saleFk);
|
||||
expect(salesAfter[salesLength].itemFk).toEqual(substitutionFk);
|
||||
expect(salesAfter[salesLength].quantity).toEqual(quantity);
|
||||
expect(salesAfter[0].quantity).toEqual(5);
|
||||
expect(salesAfter[0].quantity).toEqual(10);
|
||||
expect(salesAfter[salesLength].concept).toMatch(/^\+/);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -100,7 +100,6 @@ module.exports = Self => {
|
|||
const daysIndex = filterKeyOrder.indexOf('days');
|
||||
if (!procedureParams[daysIndex])procedureParams[daysIndex] = 2;
|
||||
const procedureArgs = Array(procedureParams.length).fill('?').join(', ');
|
||||
|
||||
let query = `CALL vn.item_getLack(${procedureArgs})`;
|
||||
|
||||
const result = await Self.rawSql(query, procedureParams, myOptions);
|
||||
|
|
|
@ -70,7 +70,7 @@ describe('Item Lack', () => {
|
|||
|
||||
it('should return data with filter.lack', async() => {
|
||||
const filter = {
|
||||
lack: '-15'
|
||||
lack: '-20'
|
||||
};
|
||||
|
||||
const result = await models.Ticket.itemLack(ctx, filter, options);
|
||||
|
|
Loading…
Reference in New Issue