From b8a4861f01cc8d1e9ca4b735c51d961e4fd76a6e Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Fri, 14 Jun 2019 12:27:41 +0200 Subject: [PATCH] #1526 refactor fixtures --- db/dump/fixtures.sql | 533 ++++++++++++------ e2e/helpers/selectors.js | 4 +- e2e/paths/05-ticket-module/03_sale.spec.js | 6 +- .../06-claim-module/04_claim_action.spec.js | 15 +- .../01_edit_basic_data.spec.js | 29 +- e2e/paths/07-order-module/03_lines.spec.js | 2 +- .../back/methods/client/specs/getCard.spec.js | 4 +- .../back/methods/client/specs/getDebt.spec.js | 2 +- .../back/methods/client/specs/getMana.spec.js | 2 +- .../back/methods/client/specs/summary.spec.js | 4 +- .../back/methods/item/specs/getDiary.spec.js | 4 +- .../order-row/specs/addToOrder.spec.js | 13 +- .../methods/order/specs/catalogFilter.spec.js | 4 +- .../back/methods/order/specs/filter.spec.js | 6 +- .../back/methods/order/specs/getVAT.spec.js | 9 +- .../order/specs/updateBasicData.spec.js | 6 +- .../back/methods/route/specs/filter.spec.js | 2 +- .../methods/route/specs/getTickets.spec.js | 2 +- .../back/methods/route/specs/summary.spec.js | 4 +- .../methods/route/specs/updateVolume.spec.js | 13 +- .../methods/sale/specs/moveToTicket.spec.js | 14 +- .../sale/specs/priceDifference.spec.js | 2 +- .../methods/sale/specs/updatePrice.spec.js | 4 +- .../back/methods/ticket/getSalesPersonMana.js | 11 +- .../back/methods/ticket/specs/filter.spec.js | 6 +- .../ticket/specs/getSalespersonMana.spec.js | 6 +- .../methods/ticket/specs/getTotal.spec.js | 2 +- .../back/methods/ticket/specs/getVAT.spec.js | 9 +- .../methods/ticket/specs/subtotal.spec.js | 4 +- .../back/methods/ticket/specs/summary.spec.js | 2 +- .../ticket/specs/threeLastActive.spec.js | 2 +- .../ticket/specs/updateDiscount.spec.js | 12 +- .../specs/getCurrentWorkerMana.spec.js | 2 +- 33 files changed, 448 insertions(+), 292 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 78d592c12..f8d680b50 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -338,13 +338,13 @@ INSERT INTO `vn`.`creditInsurance`(`id`, `creditClassification`, `credit`, `crea INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`) VALUES - (1, '1899-12-30 12:15:00', 56, CURDATE(), 1, 1, 'first route', 0.2, 10, CURDATE(), CURDATE()), - (2, '1899-12-30 13:20:00', 56, CURDATE(), 1, 1, 'second route', null, 20, CURDATE(), CURDATE()), - (3, '1899-12-30 14:30:00', 56, CURDATE(), 2, 7, 'third route', null, 30, CURDATE(), CURDATE()), - (4, '1899-12-30 15:45:00', 56, CURDATE(), 3, 7, 'fourth route', 0.1, 40, CURDATE(), CURDATE()), - (5, '1899-12-30 16:00:00', 56, CURDATE(), 4, 8, 'fifth route', null, 50, CURDATE(), CURDATE()), - (6, null, 57, CURDATE(), 5, 8, 'sixth route', null, 60, CURDATE(), CURDATE()), - (7, null, 57, CURDATE(), 6, null, 'seventh route', null, 70, CURDATE(), CURDATE()); + (1, '1899-12-30 12:15:00', 56, CURDATE(), 1, 1, 'first route', 0.1, 10, CURDATE(), CURDATE()), + (2, '1899-12-30 13:20:00', 56, CURDATE(), 1, 1, 'second route', 0.1, 20, CURDATE(), CURDATE()), + (3, '1899-12-30 14:30:00', 56, CURDATE(), 2, 7, 'third route', 0.1, 30, CURDATE(), CURDATE()), + (4, '1899-12-30 15:45:00', 56, CURDATE(), 3, 7, 'fourth route', 0.1, 40, CURDATE(), CURDATE()), + (5, '1899-12-30 16:00:00', 56, CURDATE(), 4, 8, 'fifth route', NULL, 50, CURDATE(), CURDATE()), + (6, NULL, 57, CURDATE(), 5, 8, 'sixth route', NULL, 60, CURDATE(), CURDATE()), + (7, NULL, 57, CURDATE(), 6, NULL, 'seventh route', NULL, 70, CURDATE(), CURDATE()); INSERT INTO `vn2008`.`empresa_grupo`(`empresa_grupo_id`, `grupo`) VALUES @@ -371,9 +371,9 @@ INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `cr VALUES (1, 'T', 156.09, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 101, CURDATE(), 442, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), CURDATE(), 1, 1), (2, 'T', 208.35, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 102, CURDATE(), 442, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), CURDATE(), 1, 1), - (3, 'T', 20.02, CURDATE(), 103, CURDATE(), 442, CURDATE(), null, 1, 1), - (4, 'T', 20.02, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 103, CURDATE(), 442, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), null, 1, 1), - (5, 'A', 20.22, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 103, CURDATE(), 442, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), null, 1, 1); + (3, 'T', 20.02, CURDATE(), 103, CURDATE(), 442, CURDATE(), NULL, 1, 1), + (4, 'T', 20.02, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 103, CURDATE(), 442, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), NULL, 1, 1), + (5, 'A', 20.22, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 103, CURDATE(), 442, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), NULL, 1, 1); UPDATE `vn`.`invoiceOut` SET ref = 'T1111111' WHERE id = 1; UPDATE `vn`.`invoiceOut` SET ref = 'T2222222' WHERE id = 2; @@ -407,34 +407,34 @@ INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaF ('T', 'EspaƱola rapida', 1, 'NATIONAL', 0), ('V', 'Intracomunitaria global', 0, 'CEE', 1); -INSERT INTO `vn`.`ticket`(`id`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `created`) +INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `created`) VALUES - (1 , 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY) , DATE_ADD(CURDATE(), INTERVAL -15 DAY) , 101, 'address 21', 121, 'T1111111', 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY) ), - (2 , 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -10 DAY) , DATE_ADD(CURDATE(), INTERVAL -10 DAY) , 101, 'address 21', 121, 'T2222222', 0, DATE_ADD(CURDATE(), INTERVAL -10 DAY) ), - (3 , 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL -5 DAY) , DATE_ADD(CURDATE(), INTERVAL -5 DAY) , 102, 'address 22', 122, 'T2222222', 0, DATE_ADD(CURDATE(), INTERVAL -5 DAY) ), - (4 , 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL -4 DAY) , DATE_ADD(CURDATE(), INTERVAL -4 DAY) , 102, 'address 22', 122, 'T3333333', 0, DATE_ADD(CURDATE(), INTERVAL -4 DAY) ), - (5 , 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL -3 DAY) , DATE_ADD(CURDATE(), INTERVAL -3 DAY) , 103, 'address 23', 123, 'T3333333', 0, DATE_ADD(CURDATE(), INTERVAL -3 DAY) ), - (6 , 3, 3, 4, DATE_ADD(CURDATE(), INTERVAL -2 DAY) , DATE_ADD(CURDATE(), INTERVAL -2 DAY) , 103, 'address 23', 123, 'T4444444', 0, DATE_ADD(CURDATE(), INTERVAL -2 DAY) ), - (7 , 4, 4, 4, DATE_ADD(CURDATE(), INTERVAL -1 DAY) , DATE_ADD(CURDATE(), INTERVAL -1 DAY) , 104, 'address 24', 124, 'T4444444', 0, DATE_ADD(CURDATE(), INTERVAL -1 DAY) ), - (8 , 1, 1, 4, CURDATE(), CURDATE(), 104, 'address 24', 124, NULL, 0, CURDATE()), - (9 , 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 105, 'address 25', 125, 'A1111111', 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH) ), - (10, 6, 5, 5, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 105, 'address 25', 125, 'A1111111', 0, DATE_ADD(CURDATE(), INTERVAL -3 MONTH) ), - (11, 7, 1, 1, CURDATE() , DATE_ADD(CURDATE(), INTERVAL +1 DAY) , 101, 'address 21', 121, NULL, 0, CURDATE() ), - (12, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH) ), - (13, 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +2 MONTH) ), - (14, 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL +3 MONTH), DATE_ADD(CURDATE(), INTERVAL +3 MONTH), 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +3 MONTH) ), - (15, 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL +4 MONTH), DATE_ADD(CURDATE(), INTERVAL +4 MONTH), 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +4 MONTH) ), - (16, 1, 1, 1, CURDATE(), CURDATE(), 101, 'address 21', 121, NULL, 0, CURDATE() ), - (17, 4, 4, 4, CURDATE(), CURDATE(), 106, 'address 26', 126, NULL, 0, CURDATE() ), - (18, 4, 4, 4, CURDATE(), CURDATE(), 107, 'address 27', 127, NULL, 0, CURDATE() ), - (19, 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL +1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY), 108, 'address 28', 128, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY) ), - (20, 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL +1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY), 108, 'address 28', 128, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY) ), - (21, 5, 5, 4, CURDATE(), CURDATE(), 110, 'address 29', 129, NULL, 1, CURDATE() ), - (22, 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL +1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY), 108, 'address 28', 128, NULL, 1, DATE_ADD(CURDATE(), INTERVAL +1 DAY) ); + (1 , 3, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 'Bat cave', 121, 'T1111111', 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), + (2 , 1, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T2222222', 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), + (3 , 1, 2, 2, 1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T2222222', 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)), + (4 , 3, 2, 2, 1, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T3333333', 0, DATE_ADD(CURDATE(), INTERVAL -3 MONTH)), + (5 , 3, 3, 3, 1, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T3333333', 0, DATE_ADD(CURDATE(), INTERVAL -4 MONTH)), + (6 , 1, 3, 3, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 'Mountain Drive Gotham', 1, 'T4444444', 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), + (7 , NULL, 4, 4, 2, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 'Mountain Drive Gotham', 1, 'T4444444', 0, CURDATE()), + (8 , NULL, 1, 1, 2, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 'Bat cave', 121, NULL, 0, CURDATE()), + (9 , NULL, 1, 5, 2, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 'Stark tower', 124, 'A1111111', 0, CURDATE()), + (10, 1, 1, 5, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 'Ingram Street', 2, 'A1111111', 0, CURDATE()), + (11, 1, 7, 1, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 'NY roofs', 122, NULL, 0, CURDATE()), + (12, 1, 1, 1, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Clinton Street', 3, NULL, 0, CURDATE()), + (13, 1, 2, 2, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, CURDATE()), + (14, 1, 2, 2, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 'Malibu Point', 4, NULL, 0, CURDATE()), + (15, 1, 3, 3, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 'Plastic Cell', 125, NULL, 0, CURDATE()), + (16, 1, 7, 1, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, CURDATE()), + (17, 1, 4, 4, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 107, 'Your pocket', 127, NULL, 0, CURDATE()), + (18, 1, 4, 4, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 108, 'Cerebro', 128, NULL, 0, CURDATE()), + (19, 1, 5, 5, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 'Luke Cage Bar', 129, NULL, 0, CURDATE()), + (20, 1, 5, 5, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 'Somewhere Thailand', 101, NULL, 0, CURDATE()), + (21, NULL, 5, 5, NULL, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere Holland', 102, NULL, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), + (22, NULL, 5, 5, NULL, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere Japan', 103, NULL, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)); INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`) VALUES - (1, 1, 1, 'ready' ), + (1, 1, 1, 'ready'), (2, 2, 2, 'do it fast please'), (3, 3, 3, 'Faster faster fasteeeeeer!!!'), (4, 4, 3, 'Deliver before 8am'), @@ -443,28 +443,28 @@ INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `des INSERT INTO `vn`.`ticketTracking`(`id`, `ticketFk`, `stateFk`, `workerFk`, `created`) VALUES - (1, 1, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -15 DAY)), - (2, 2, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -10 DAY)), - (3, 3, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -5 DAY)), - (4, 4, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -4 DAY)), - (5, 5, 16, 18, DATE_ADD(CURDATE(), INTERVAL -3 DAY)), - (6, 6, 16, 18, DATE_ADD(CURDATE(), INTERVAL -2 DAY)), - (7, 7, 16, 18, DATE_ADD(CURDATE(), INTERVAL -1 DAY)), - (8, 8, 3, 19, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (9, 9, 16, 19, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)), - (10, 10, 16, 19, DATE_ADD(CURDATE(), INTERVAL -3 MONTH)), + (1, 1, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), + (2, 2, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), + (3, 3, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -2 MONTH)), + (4, 4, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -3 MONTH)), + (5, 5, 16, 18, DATE_ADD(CURDATE(), INTERVAL -4 MONTH)), + (6, 6, 16, 18, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), + (7, 7, 10, 18, CURDATE()), + (8, 8, 5, 19, CURDATE()), + (9, 9, 5, 19, CURDATE()), + (10, 10, 5, 19, CURDATE()), (11, 11, 3, 19, CURDATE()), (12, 12, 3, 19, CURDATE()), (13, 13, 3, 19, CURDATE()), (14, 14, 3, 19, CURDATE()), (15, 15, 3, 19, CURDATE()), - (16, 16, 1, 19, CURDATE()), - (17, 17, 1, 19, CURDATE()), - (18, 18, 1, 19, CURDATE()), - (19, 19, 13, 19, CURDATE()), - (20, 20, 13, 19, CURDATE()), - (21, 21, 3, 19, CURDATE()), - (23, 21, 13, 19, CURDATE()); + (16, 16, 3, 19, CURDATE()), + (17, 17, 3, 19, CURDATE()), + (18, 18, 3, 19, CURDATE()), + (19, 19, 3, 19, CURDATE()), + (20, 20, 3, 19, CURDATE()), + (21, 21, 1, 19, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), + (22, 22, 17, 19, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)); INSERT INTO `vn`.`stowaway`(`id`, `shipFk`, `created`) VALUES @@ -494,18 +494,18 @@ INSERT INTO `vn`.`greugeType`(`id`, `name`) INSERT INTO `vn`.`greuge`(`id`, `clientFk`, `description`, `amount`, `shipped`, `created`, `greugeTypeFk`, `ticketFk`) VALUES - (1, 101, 'some diff charges', -19.99, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 1, 1), - (2, 101, 'more diff charges', 60, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 2, 1), - (3, 101, 'even more! diff charges', -9.99, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 3, 1), - (4, 101, 'insane diff charges', 60, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 4, 1), - (5, 101, 'gargantuous diff charges', -9.99, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 5, 1), - (6, 101, 'diff charges', 88.30, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 6, 1), - (7, 101, 'unaffordable diff charges', -39.12, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 1, 1), - (8, 101, 'some recovery charges', 29.35, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 2, 1), - (9, 101, 'some manna charges', -9.99, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 3, 1), - (10, 101, 'some claim charges', 13.13, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 4, 1), - (11, 101, 'some heritage charges', -15.99, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 5, 1), - (12, 101, 'some miscellaneous charges', 58.00, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 6, 1); + (1, 101, 'some diff charges', -19.99, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 1, 1), + (2, 101, 'more diff charges', 60, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 2, 1), + (3, 101, 'even more! diff charges', -9.99, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 3, 1), + (4, 101, 'insane diff charges', 60, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 4, 1), + (5, 101, 'gargantuous diff charges', -9.99, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 5, 1), + (6, 101, 'diff charges', 88.30, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 6, 1), + (7, 101, 'unaffordable diff charges', -39.12, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 1, 1), + (8, 101, 'some recovery charges', 29.35, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 2, 1), + (9, 101, 'some manna charges', -9.99, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 3, 1), + (10, 101, 'some claim charges', 13.13, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 4, 1), + (11, 101, 'some heritage charges', -15.99, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 5, 1), + (12, 101, 'some miscellaneous charges', 58.00, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 6, 1); INSERT INTO `vn`.`mandateType`(`id`, `name`) VALUES @@ -615,30 +615,36 @@ INSERT INTO `vn`.`ticketPackaging`(`id`, `ticketFk`, `packagingFk`, `quantity`, INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `price`, `discount`, `reserved`, `isPicked`, `created`) VALUES - (1, 1, 1, 'Ranged weapon longbow 2m', 5, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), - (2, 2, 1, 'Melee weapon combat fist 15cm', 10, 1.07, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), - (3, 1, 1, 'Ranged weapon longbow 2m', 2, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), - (4, 4, 1, 'Melee weapon heavy shield 1x0.5m', 20, 3.06, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), - (5, 1, 2, 'Ranged weapon longbow 2m', 10, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -10 DAY)), - (6, 1, 3, 'Ranged weapon longbow 2m', 15, 6.50, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -5 DAY)), - (7, 2, 11, 'Melee weapon combat fist 15cm', 15, 1.02, 0, 0, 0, CURDATE()), - (8, 4, 11, 'Melee weapon heavy shield 1x0.5m', 10, 3.01, 0, 0, 0, CURDATE()), + (1, 1, 1, 'Ranged weapon longbow 2m', 5, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), + (2, 2, 1, 'Melee weapon combat fist 15cm', 10, 1.07, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), + (3, 1, 1, 'Ranged weapon longbow 2m', 2, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), + (4, 4, 1, 'Melee weapon heavy shield 1x0.5m', 20, 3.06, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), + (5, 1, 2, 'Ranged weapon longbow 2m', 10, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), + (6, 1, 3, 'Ranged weapon longbow 2m', 15, 6.50, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)), + (7, 2, 11, 'Melee weapon combat fist 15cm', 15, 1.07, 0, 0, 0, CURDATE()), + (8, 4, 11, 'Melee weapon heavy shield 1x0.5m', 10, 3.06, 0, 0, 0, CURDATE()), (9, 1, 16, 'Ranged weapon longbow 2m', 5, 9.10, 0, 0, 0, CURDATE()), (10, 2, 16, 'Melee weapon combat fist 15cm', 10, 1.07, 0, 0, 0, CURDATE()), (11, 1, 16, 'Ranged weapon longbow 2m', 2, 9.10, 0, 0, 0, CURDATE()), (12, 4, 16, 'Melee weapon heavy shield 1x0.5m', 20, 3.06, 0, 0, 0, CURDATE()), - (13, 2, 8, 'Melee weapon combat fist 15cm', 15, 1.30, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), - (14, 1, 8, 'Ranged weapon longbow 2m', 10, 9.28, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), - (15, 1, 19, 'Ranged weapon longbow 2m', 10, 1.50, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY)), - (16, 2, 20, 'Melee weapon combat fist 15cm', 15, 1.30, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY)), - (17, 2, 22, 'Melee weapon combat fist 15cm', 30, 2.30, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY)), - (18, 4, 22, 'Melee weapon heavy shield 1x0.5m', 20, 3.00, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY)), - (19, 1, 4, 'Ranged weapon longbow 2m', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -4 DAY)), - (20, 1, 5, 'Ranged weapon longbow 2m', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -3 DAY)), - (21, 1, 6, 'Ranged weapon longbow 2m', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -2 DAY)), - (22, 1, 7, 'Ranged weapon longbow 2m', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 DAY)), - (23, 1, 9, 'Ranged weapon longbow 2m', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)), - (24, 1, 10, 'Ranged weapon longbow 2m', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -3 MONTH)); + (13, 2, 8, 'Melee weapon combat fist 15cm', 15, 1.30, 0, 0, 0, CURDATE()), + (14, 1, 8, 'Ranged weapon longbow 2m', 10, 9.28, 0, 0, 0, CURDATE()), + (15, 1, 19, 'Ranged weapon longbow 2m', 10, 1.50, 0, 0, 0, CURDATE()), + (16, 2, 20, 'Melee weapon combat fist 15cm', 15, 1.30, 0, 0, 0, CURDATE()), + (17, 2, 22, 'Melee weapon combat fist 15cm', 30, 2.30, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), + (18, 4, 22, 'Melee weapon heavy shield 1x0.5m', 20, 3.00, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), + (19, 1, 4, 'Ranged weapon longbow 2m', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -3 MONTH)), + (20, 1, 5, 'Ranged weapon longbow 2m', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -4 MONTH)), + (21, 1, 6, 'Ranged weapon longbow 2m', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), + (22, 1, 7, 'Ranged weapon longbow 2m', 1, 9.10, 0, 0, 0, CURDATE()), + (23, 1, 9, 'Ranged weapon longbow 2m', 1, 9.10, 0, 0, 0, CURDATE()), + (24, 1, 10, 'Ranged weapon longbow 2m', 1, 9.10, 0, 0, 0, CURDATE()), + (25, 4, 12, 'Melee weapon heavy shield 1x0.5m', 20, 3.00, 0, 0, 0, CURDATE()), + (26, 4, 13, 'Melee weapon heavy shield 1x0.5m', 20, 3.00, 0, 0, 0, CURDATE()), + (27, 4, 14, 'Melee weapon heavy shield 1x0.5m', 20, 3.00, 0, 0, 0, CURDATE()), + (28, 4, 15, 'Melee weapon heavy shield 1x0.5m', 20, 3.00, 0, 0, 0, CURDATE()), + (29, 4, 17, 'Melee weapon heavy shield 1x0.5m', 20, 3.00, 0, 0, 0, CURDATE()), + (30, 4, 18, 'Melee weapon heavy shield 1x0.5m', 20, 3.00, 0, 0, 0, CURDATE()); INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`) VALUES @@ -674,15 +680,19 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`) (5, 29, -18.72), (5, 39, 0.02), (6, 23, 6.5), - (7, 15, 0.0114), + (7, 15, 0.011), + (7, 17, 0.05), (7, 28, 5.6), (7, 29, -4.6), (7, 39, 0.01), - (8, 15, 0.0016), + (7, 21, -0.001), + (8, 15, 0.002), + (8, 17, 0.05), (8, 28, 20.72), (8, 29, -19.72), (8, 37, 2), (8, 39, 0.01), + (8, 21, -0.002), (9, 15, 0.58), (9, 23, 6.5), (9, 28, 20.72), @@ -763,7 +773,43 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`) (24, 23, 6.5), (24, 28, 20.72), (24, 29, -18.72), - (24, 39, 0.02); + (24, 39, 0.02), + (25, 15, 0.051), + (25, 22, -0.001), + (25, 28, 20.72), + (25, 29, -19.72), + (25, 37, 2), + (25, 39, 0.01), + (26, 15, 0.051), + (26, 22, -0.001), + (26, 28, 20.72), + (26, 29, -19.72), + (26, 37, 2), + (26, 39, 0.01), + (27, 15, 0.051), + (27, 22, -0.001), + (27, 28, 20.72), + (27, 29, -19.72), + (27, 37, 2), + (27, 39, 0.01), + (28, 15, 0.051), + (28, 22, -0.001), + (28, 28, 20.72), + (28, 29, -19.72), + (28, 37, 2), + (28, 39, 0.01), + (29, 15, 0.051), + (29, 22, -0.001), + (29, 28, 20.72), + (29, 29, -19.72), + (29, 37, 2), + (29, 39, 0.01), + (30, 15, 0.051), + (30, 22, -0.001), + (30, 28, 20.72), + (30, 29, -19.72), + (30, 37, 2), + (30, 39, 0.01); INSERT INTO `vn`.`saleTracking`(`saleFk`, `isChecked`, `created`, `originalQuantity`, `workerFk`, `actionFk`, `id`, `stateFk`) VALUES @@ -1016,109 +1062,217 @@ INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`) INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`, `date_make`, `first_row_stamp`, `confirm_date`) VALUES - (1 , DATE_ADD(CURDATE(), INTERVAL -15 DAY), 101, 1, 1, 121, 442, NULL, 'TPV', 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY), DATE_ADD(CURDATE(), INTERVAL -15 DAY), DATE_ADD(CURDATE(), INTERVAL -15 DAY)), - (2 , DATE_ADD(CURDATE(), INTERVAL -10 DAY), 101, 2, 1, 121, 442, NULL, 'WEB', 1, DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL -10 DAY)), - (3 , DATE_ADD(CURDATE(), INTERVAL -5 DAY), 102, 3, 2, 122, 442, NULL, 'ANDROID', 1, DATE_ADD(CURDATE(), INTERVAL -5 DAY), DATE_ADD(CURDATE(), INTERVAL -5 DAY), DATE_ADD(CURDATE(), INTERVAL -5 DAY)), - (4 , DATE_ADD(CURDATE(), INTERVAL -4 DAY), 102, 1, 2, 122, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -4 DAY), DATE_ADD(CURDATE(), INTERVAL -4 DAY), DATE_ADD(CURDATE(), INTERVAL -4 DAY)), - (5 , DATE_ADD(CURDATE(), INTERVAL -3 DAY), 103, 2, 3, 123, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -3 DAY), DATE_ADD(CURDATE(), INTERVAL -3 DAY), DATE_ADD(CURDATE(), INTERVAL -3 DAY)), - (6 , DATE_ADD(CURDATE(), INTERVAL -2 DAY), 103, 3, 3, 123, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -2 DAY), DATE_ADD(CURDATE(), INTERVAL -2 DAY), DATE_ADD(CURDATE(), INTERVAL -2 DAY)), - (7 , DATE_ADD(CURDATE(), INTERVAL -1 DAY), 104, 1, 4, 124, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -1 DAY), DATE_ADD(CURDATE(), INTERVAL -1 DAY), DATE_ADD(CURDATE(), INTERVAL -1 DAY)), - (8 , DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 104, 2, 4, 124, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (9 , DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 105, 3, 5, 125, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH)), - (10, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 105, 1, 6, 125, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH)), - (11, CURDATE(), 101, 2, 7, 121, 442, NULL, 'SALIX', 1, CURDATE(), CURDATE(), CURDATE()), - (12, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 101, 3, 1, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), - (13, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 101, 1, 2, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), DATE_ADD(CURDATE(), INTERVAL +2 MONTH), DATE_ADD(CURDATE(), INTERVAL +2 MONTH)), - (14, DATE_ADD(CURDATE(), INTERVAL +3 MONTH), 101, 2, 2, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +3 MONTH), DATE_ADD(CURDATE(), INTERVAL +3 MONTH), DATE_ADD(CURDATE(), INTERVAL +3 MONTH)), - (15, DATE_ADD(CURDATE(), INTERVAL +4 MONTH), 101, 3, 3, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +4 MONTH), DATE_ADD(CURDATE(), INTERVAL +4 MONTH), DATE_ADD(CURDATE(), INTERVAL +4 MONTH)), - (16, DATE_ADD(CURDATE(), INTERVAL +2 DAY), 101, 1, 7, 121, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()), - (17, CURDATE(), 106, 2, 4, 126, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()), - (18, CURDATE(), 107, 3, 4, 127, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()), - (19, CURDATE(), 108, 1, 5, 128, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()), - (20, CURDATE(), 109, 2, 1, 119, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()), - (21, CURDATE(), 110, 3, 5, 129, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()); + (1, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 3, 1, 121, 442, NULL, 'TPV', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), + (2, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 104, 3, 1, 124, 442, NULL, 'WEB', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), + (3, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 104, 1, 2, 124, 442, NULL, 'ANDROID', 1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH)), + (4, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 104, 1, 2, 124, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH)), + (5, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 104, 1, 3, 124, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(CURDATE(), INTERVAL -4 MONTH)), + (6, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 1, 3, 1, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), + (7, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 1, 4, 1, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()), + (8, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 3, 1, 121, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()), + (9, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 3, 1, 124, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()), + (10, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 3, 1, 2, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()), + (11, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 2, 7, 122, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()), + (12, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 3, 1, 3, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()), + (13, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 1, 2, 123, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()), + (14, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 1, 2, 4, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()), + (15, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 1, 3, 125, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()), + (16, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 2, 7, 126, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()), + (17, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 107, 1, 4, 127, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()), + (18, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 108, 1, 4, 128, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()), + (19, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 1, 5, 129, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()), + (20, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 1, 5, 101, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()), + (21, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 102, 442, NULL, 'SALIX', 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), + (22, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 103, 442, NULL, 'SALIX', 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)); INSERT INTO `hedera`.`orderRow`(`id`, `orderFk`, `itemFk`, `warehouseFk`, `shipment`, `amount`, `price`, `rate`, `created`, `saleFk`) VALUES - (1, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 5, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 1), - (2, 1, 2, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 10, 1.07, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 2), - (3, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 2, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 3), - (4, 1, 4, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 20, 3.06, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 4), - (5, 2, 1, 1, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 10, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 5), - (6, 3, 1, 2, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 15, 6.50, 0, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 6), - (7, 11, 2, 1, CURDATE(), 15, 1.30, 0, CURDATE(), 7), - (8, 11, 4, 1, CURDATE(), 10, 3.26, 0, CURDATE(), 8), - (9, 16, 1, 1, CURDATE(), 5, 9.10, 0, CURDATE(), 9), - (10, 16, 2, 1, CURDATE(), 10, 1.07, 0, CURDATE(), 10), - (11, 16, 1, 1, CURDATE(), 2, 9.10, 0, CURDATE(), 11), - (12, 16, 4, 1, CURDATE(), 20, 3.06, 0, CURDATE(), 12), - (13, 20, 1, 1, CURDATE(), 2, 9.10, 0, CURDATE(), NULL); + (1, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1), + (2, 1, 2, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 10, 1.07, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2), + (3, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 3), + (4, 1, 4, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 20, 3.06, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 4), + (5, 2, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 10, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5), + (6, 3, 1, 2, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 15, 6.50, 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 6), + (7, 11, 2, 1, CURDATE(), 15, 1.30, 0, CURDATE(), 7), + (8, 11, 4, 1, CURDATE(), 10, 3.26, 0, CURDATE(), 8), + (9, 16, 1, 1, CURDATE(), 5, 9.10, 0, CURDATE(), 9), + (10, 16, 2, 1, CURDATE(), 10, 1.07, 0, CURDATE(), 10), + (11, 16, 1, 1, CURDATE(), 2, 9.10, 0, CURDATE(), 11), + (12, 16, 4, 1, CURDATE(), 20, 3.06, 0, CURDATE(), 12), + (13, 8, 2, 1, CURDATE(), 15, 1.30, 0, CURDATE(), 13), + (14, 8, 1, 1, CURDATE(), 10, 9.28, 0, CURDATE(), 14), + (15, 19, 1, 1, CURDATE(), 10, 1.50, 0, CURDATE(), 15), + (16, 20, 2, 1, CURDATE(), 15, 1.30, 0, CURDATE(), 16), + (17, 22, 2, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 30, 2.30, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 17), + (18, 22, 4, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 20, 3.00, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 18), + (19, 4, 1, 1, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 1, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 19), + (20, 5, 1, 1, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), 1, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), 20), + (21, 6, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 21), + (22, 7, 1, 1, CURDATE(), 1, 9.10, 0, CURDATE(), 22), + (23, 9, 1, 1, CURDATE(), 1, 9.10, 0, CURDATE(), 23), + (24, 10, 1, 1, CURDATE(), 1, 9.10, 0, CURDATE(), 24), + (25, 12, 4, 1, CURDATE(), 20, 3.00, 0, CURDATE(), 25), + (26, 13, 4, 1, CURDATE(), 20, 3.00, 0, CURDATE(), 26), + (27, 14, 4, 1, CURDATE(), 20, 3.00, 0, CURDATE(), 27), + (28, 15, 4, 1, CURDATE(), 20, 3.00, 0, CURDATE(), 28), + (29, 17, 4, 1, CURDATE(), 20, 3.00, 0, CURDATE(), 29), + (30, 18, 4, 1, CURDATE(), 20, 3.00, 0, CURDATE(), 30); INSERT INTO `hedera`.`orderRowComponent`(`rowFk`, `componentFk`, `price`) VALUES - (1, 15, 0.58), - (1, 23, 6.5), - (1, 28, 20.72), - (1, 29, -18.72), - (1, 39, 0.02), - (2, 15, 0.058), - (2, 21, 0.002), - (2, 28, 5.6), - (2, 29, -4.6), - (2, 39, 0.01), - (3, 15, 0.58), - (3, 23, 6.5), - (3, 28, 20.72), - (3, 29, -18.72), - (3, 39, 0.02), - (4, 15, 0.051), - (4, 21, -0.001), - (4, 28, 20.72), - (4, 29, -19.72), - (4, 37, 2), - (4, 39, 0.01), - (5, 15, 0.58), - (5, 23, 6.5), - (5, 28, 20.72), - (5, 29, -18.72), - (5, 39, 0.02), - (6, 23, 6.5), - (7, 15, 0.2899), - (7, 28, 5.6), - (7, 29, -4.6), - (7, 39, 0.01), - (8, 15, 0.254), - (8, 21, -0.004), - (8, 28, 20.72), - (8, 29, -19.72), - (8, 37, 2), - (8, 39, 0.01), - (9, 15, 0.58), - (9, 23, 6.5), - (9, 28, 20.72), - (9, 29, -18.72), - (9, 39, 0.02), - (10, 15, 0.058), - (10, 21, 0.002), - (10, 28, 5.6), - (10, 29, -4.6), - (10, 39, 0.01), - (11, 15, 0.58), - (11, 23, 6.5), - (11, 28, 20.72), - (11, 29, -18.72), - (11, 39, 0.02), - (12, 15, 0.051), - (12, 22, -0.001), - (12, 28, 20.72), - (12, 29, -19.72), - (12, 37, 2), - (12, 39, 0.01), - (13, 15, 0.58), - (13, 23, 6.5), - (13, 28, 20.72), - (13, 29, -18.72), - (13, 39, 0.02); + (1, 15, 0.58), + (1, 23, 6.5), + (1, 28, 20.72), + (1, 29, -18.72), + (1, 39, 0.02), + (2, 15, 0.058), + (2, 21, 0.002), + (2, 28, 5.6), + (2, 29, -4.6), + (2, 39, 0.01), + (3, 15, 0.58), + (3, 23, 6.5), + (3, 28, 20.72), + (3, 29, -18.72), + (3, 39, 0.02), + (4, 15, 0.051), + (4, 21, -0.001), + (4, 28, 20.72), + (4, 29, -19.72), + (4, 37, 2), + (4, 39, 0.01), + (5, 15, 0.58), + (5, 23, 6.5), + (5, 28, 20.72), + (5, 29, -18.72), + (5, 39, 0.02), + (6, 23, 6.5), + (7, 15, 0.0114), + (7, 28, 5.6), + (7, 29, -4.6), + (7, 39, 0.01), + (8, 15, 0.0016), + (8, 28, 20.72), + (8, 29, -19.72), + (8, 37, 2), + (8, 39, 0.01), + (9, 15, 0.58), + (9, 23, 6.5), + (9, 28, 20.72), + (9, 29, -18.72), + (9, 39, 0.02), + (10, 15, 0.058), + (10, 21, 0.002), + (10, 28, 5.6), + (10, 29, -4.6), + (10, 39, 0.01), + (11, 15, 0.58), + (11, 23, 6.5), + (11, 28, 20.72), + (11, 29, -18.72), + (11, 39, 0.02), + (12, 15, 0.051), + (12, 22, -0.001), + (12, 28, 20.72), + (12, 29, -19.72), + (12, 37, 2), + (12, 39, 0.01), + (13, 15, 0.2899), + (13, 28, 5.6), + (13, 29, -4.6), + (13, 39, 0.01), + (14, 15, 0.58), + (14, 23, 6.5), + (14, 28, 20.72), + (14, 29, -18.72), + (14, 39, 0.02), + (15, 15, 0.58), + (15, 23, 6.5), + (15, 28, 20.72), + (15, 29, -18.72), + (15, 39, 0.02), + (16, 15, 0.058), + (16, 21, 0.002), + (16, 28, 5.6), + (16, 29, -4.6), + (16, 39, 0.01), + (17, 15, 0.058), + (17, 21, 0.002), + (17, 28, 5.6), + (17, 29, -4.6), + (17, 39, 0.01), + (18, 15, 0.051), + (18, 22, -0.001), + (18, 28, 20.72), + (18, 29, -19.72), + (18, 37, 2), + (18, 39, 0.01), + (19, 15, 0.58), + (19, 23, 6.5), + (19, 28, 20.72), + (19, 29, -18.72), + (19, 39, 0.02), + (20, 15, 0.58), + (20, 23, 6.5), + (20, 28, 20.72), + (20, 29, -18.72), + (20, 39, 0.02), + (21, 15, 0.58), + (21, 23, 6.5), + (21, 28, 20.72), + (21, 29, -18.72), + (21, 39, 0.02), + (22, 15, 0.58), + (22, 23, 6.5), + (22, 28, 20.72), + (22, 29, -18.72), + (22, 39, 0.02), + (23, 15, 0.58), + (23, 23, 6.5), + (23, 28, 20.72), + (23, 29, -18.72), + (23, 39, 0.02), + (24, 15, 0.58), + (24, 23, 6.5), + (24, 28, 20.72), + (24, 29, -18.72), + (24, 39, 0.02), + (25, 15, 0.051), + (25, 22, -0.001), + (25, 28, 20.72), + (25, 29, -19.72), + (25, 37, 2), + (25, 39, 0.01), + (26, 15, 0.051), + (26, 22, -0.001), + (26, 28, 20.72), + (26, 29, -19.72), + (26, 37, 2), + (26, 39, 0.01), + (27, 15, 0.051), + (27, 22, -0.001), + (27, 28, 20.72), + (27, 29, -19.72), + (27, 37, 2), + (27, 39, 0.01), + (28, 15, 0.051), + (28, 22, -0.001), + (28, 28, 20.72), + (28, 29, -19.72), + (28, 37, 2), + (28, 39, 0.01), + (29, 15, 0.051), + (29, 22, -0.001), + (29, 28, 20.72), + (29, 29, -19.72), + (29, 37, 2), + (29, 39, 0.01), + (30, 15, 0.051), + (30, 22, -0.001), + (30, 28, 20.72), + (30, 29, -19.72), + (30, 37, 2), + (30, 39, 0.01); INSERT INTO `vn`.`clientContact`(`id`, `clientFk`, `name`, `phone`) VALUES @@ -1170,9 +1324,9 @@ INSERT INTO `vn`.`claimBeginning`(`id`, `claimFk`, `saleFk`, `quantity`) INSERT INTO `vn`.`claimDestination`(`id`, `description`, `addressFk`) VALUES - (1, 'Bueno', null), + (1, 'Bueno', NULL), (2, 'Basura/Perd.', 12), - (3, 'Confeccion', null), + (3, 'Confeccion', NULL), (4, 'Reclam.PRAG', 12), (5, 'Corregido', 11); @@ -1214,7 +1368,14 @@ INSERT INTO `vn`.`orderTicket`(`orderFk`, `ticketFk`) (12, 12), (13, 13), (14, 14), - (15, 15); + (15, 15), + (16, 16), + (17, 17), + (18, 18), + (19, 19), + (20, 20), + (21, 21), + (22, 22); INSERT INTO `vn`.`userConfig` (`userFk`, `warehouseFk`, `companyFk`) VALUES diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 908c22d68..cffe03e75 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -510,10 +510,8 @@ export default { importTicketButton: 'vn-claim-action vn-button[label="Import ticket"]', secondImportableTicket: 'vn-claim-action > vn-vertical > vn-popover > div > div.content > div > vn-table > div > vn-tbody > vn-tr:nth-child(2)', firstLineDestination: 'vn-claim-action vn-tr:nth-child(1) vn-autocomplete[field="saleClaimed.claimDestinationFk"]', - thirdLineDestination: 'vn-claim-action vn-tr:nth-child(3) vn-autocomplete[field="saleClaimed.claimDestinationFk"]', + secondLineDestination: 'vn-claim-action vn-tr:nth-child(2) vn-autocomplete[field="saleClaimed.claimDestinationFk"]', firstDeleteLine: 'vn-claim-action vn-tr:nth-child(1) vn-icon-button[icon="delete"]', - secondDeleteLine: 'vn-claim-action vn-tr:nth-child(2) vn-icon-button[icon="delete"]', - thirdDeleteLine: 'vn-claim-action vn-tr:nth-child(3) vn-icon-button[icon="delete"]', isPaidWithManaCheckbox: 'vn-check[field="$ctrl.claim.isChargedToMana"] md-checkbox' }, ordersIndex: { diff --git a/e2e/paths/05-ticket-module/03_sale.spec.js b/e2e/paths/05-ticket-module/03_sale.spec.js index b261cc612..8cf591d75 100644 --- a/e2e/paths/05-ticket-module/03_sale.spec.js +++ b/e2e/paths/05-ticket-module/03_sale.spec.js @@ -1,13 +1,13 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; -describe('Ticket List sale path', () => { +fdescribe('Ticket List sale path', () => { const nightmare = createNightmare(); beforeAll(() => { return nightmare .loginAndModule('employee', 'ticket') - .accessToSearchResult('id:8') + .accessToSearchResult(8) .accessToSection('ticket.card.sale'); }); @@ -22,7 +22,7 @@ describe('Ticket List sale path', () => { const value = await nightmare .waitToGetProperty(selectors.ticketSales.firstSaleText, 'innerText'); - expect(value).toContain('5'); + expect(value).toContain('1'); }); it('should confirm the first ticket sale contains the price', async() => { diff --git a/e2e/paths/06-claim-module/04_claim_action.spec.js b/e2e/paths/06-claim-module/04_claim_action.spec.js index a06edaa50..de998a0f2 100644 --- a/e2e/paths/06-claim-module/04_claim_action.spec.js +++ b/e2e/paths/06-claim-module/04_claim_action.spec.js @@ -7,7 +7,7 @@ describe('Claim action path', () => { beforeAll(() => { nightmare .loginAndModule('administrative', 'claim') - .accessToSearchResult('4') + .accessToSearchResult(4) .accessToSection('claim.card.action'); }); @@ -19,7 +19,7 @@ describe('Claim action path', () => { expect(result).toEqual('Data saved!'); }); - it('should import the eighth ticket', async() => { + it('should import the second importable ticket', async() => { const result = await nightmare .waitToClick(selectors.claimAction.importTicketButton) .waitToClick(selectors.claimAction.secondImportableTicket) @@ -28,17 +28,16 @@ describe('Claim action path', () => { expect(result).toEqual('Data saved!'); }); - it('should edit the fourth line destination field', async() => { + it('should edit the second line destination field', async() => { const result = await nightmare - .autocompleteSearch(selectors.claimAction.thirdLineDestination, 'Bueno') + .autocompleteSearch(selectors.claimAction.secondLineDestination, 'Bueno') .waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); - it('should delete two first lines', async() => { + it('should delete the first line', async() => { const result = await nightmare - .waitToClick(selectors.claimAction.secondDeleteLine) .waitToClick(selectors.claimAction.firstDeleteLine) .waitForLastSnackbar(); @@ -61,7 +60,7 @@ describe('Claim action path', () => { expect(result).toEqual('Data saved!'); }); - it('should check the Is paid with mana checkbox', async() => { + it('should check the "is paid with mana" checkbox', async() => { const result = await nightmare .waitToClick(selectors.claimAction.isPaidWithManaCheckbox) .waitForSnackbar(); @@ -69,7 +68,7 @@ describe('Claim action path', () => { expect(result).toEqual(jasmine.arrayContaining(['Data saved!'])); }); - it('should confirm the Is paid with mana checkbox is checked', async() => { + it('should confirm the "is paid with mana" checkbox is checked', async() => { const result = await nightmare .reloadSection('claim.card.action') .checkboxState(selectors.claimAction.isPaidWithManaCheckbox); diff --git a/e2e/paths/07-order-module/01_edit_basic_data.spec.js b/e2e/paths/07-order-module/01_edit_basic_data.spec.js index e48573b2a..8925d5cc7 100644 --- a/e2e/paths/07-order-module/01_edit_basic_data.spec.js +++ b/e2e/paths/07-order-module/01_edit_basic_data.spec.js @@ -7,7 +7,7 @@ describe('Order edit basic data path', () => { beforeAll(() => { nightmare .loginAndModule('employee', 'order') - .accessToSearchResult('1') + .accessToSearchResult(1) .accessToSection('order.card.basicData'); }); @@ -24,19 +24,20 @@ describe('Order edit basic data path', () => { describe('when order with rows', () => { it('should now navigate to order index', async() => { + const orderId = 16; const url = await nightmare .waitToClick(selectors.globalItems.returnToModuleIndexButton) .waitToClick(selectors.globalItems.acceptVnConfirm) .wait(selectors.ordersIndex.createOrderButton) - .accessToSearchResult('16') + .accessToSearchResult(orderId) .accessToSection('order.card.basicData') .wait(selectors.orderBasicData.observationInput) .parsedUrl(); - expect(url.hash).toEqual('#!/order/16/basic-data'); + expect(url.hash).toEqual(`#!/order/${orderId}/basic-data`); }); - it('should not be able to change the company', async() => { + it('should not be able to change anything', async() => { const result = await nightmare .write(selectors.orderBasicData.observationInput, 'observation') .waitToClick(selectors.orderBasicData.saveButton) @@ -47,17 +48,29 @@ describe('Order edit basic data path', () => { }); describe('when new order', () => { - it('should once more navigate to order index', async() => { + const today = new Date().getDate(); + it('should navigate to order index and create a new one', async() => { const url = await nightmare .waitToClick(selectors.globalItems.returnToModuleIndexButton) .waitToClick(selectors.globalItems.acceptVnConfirm) - .wait(selectors.ordersIndex.createOrderButton) - .accessToSearchResult('18') + .waitToClick(selectors.ordersIndex.createOrderButton) + .autocompleteSearch(selectors.createOrderView.clientAutocomplete, 'Bruce Wayne') + .datePicker(selectors.createOrderView.landedDatePicker, 0, today) + .autocompleteSearch(selectors.createOrderView.agencyAutocomplete, 'inhouse pickup') + .waitToClick(selectors.createOrderView.createButton) + .waitForURL('/catalog') + .parsedUrl(); + + expect(url.hash).toContain('/catalog'); + }); + + it('should navigate to the basic data section of the new order', async() => { + const url = await nightmare .accessToSection('order.card.basicData') .wait(selectors.orderBasicData.observationInput) .parsedUrl(); - expect(url.hash).toEqual('#!/order/18/basic-data'); + expect(url.hash).toContain('/basic-data'); }); it('should be able to modify all the properties', async() => { diff --git a/e2e/paths/07-order-module/03_lines.spec.js b/e2e/paths/07-order-module/03_lines.spec.js index b7d28d2f4..8128fdc07 100644 --- a/e2e/paths/07-order-module/03_lines.spec.js +++ b/e2e/paths/07-order-module/03_lines.spec.js @@ -6,7 +6,7 @@ describe('Order lines', () => { beforeAll(() => { nightmare .loginAndModule('employee', 'order') - .accessToSearchResult('16') + .accessToSearchResult(16) .accessToSection('order.card.line'); }); diff --git a/modules/client/back/methods/client/specs/getCard.spec.js b/modules/client/back/methods/client/specs/getCard.spec.js index 7776719b5..9b3ddcf96 100644 --- a/modules/client/back/methods/client/specs/getCard.spec.js +++ b/modules/client/back/methods/client/specs/getCard.spec.js @@ -1,12 +1,12 @@ const app = require('vn-loopback/server/server'); describe('Client get', () => { - it('should call the card() method to receive a formated card of Bruce Wayne', async() => { + it('should receive a formated card of Bruce Wayne', async() => { let id = 101; let result = await app.models.Client.getCard(id); expect(result.id).toEqual(101); expect(result.name).toEqual('Bruce Wayne'); - expect(result.debt).toEqual(-22.4); + expect(result.debt).toEqual(-111.86); }); }); diff --git a/modules/client/back/methods/client/specs/getDebt.spec.js b/modules/client/back/methods/client/specs/getDebt.spec.js index 8178bd6ec..a50422c8f 100644 --- a/modules/client/back/methods/client/specs/getDebt.spec.js +++ b/modules/client/back/methods/client/specs/getDebt.spec.js @@ -4,7 +4,7 @@ describe('client getDebt()', () => { it('should return the client debt', async() => { let result = await app.models.Client.getDebt(101); - expect(result.debt).toEqual(-22.4); + expect(result.debt).toEqual(-111.86); }); }); diff --git a/modules/client/back/methods/client/specs/getMana.spec.js b/modules/client/back/methods/client/specs/getMana.spec.js index 4ac200a72..5b85dd733 100644 --- a/modules/client/back/methods/client/specs/getMana.spec.js +++ b/modules/client/back/methods/client/specs/getMana.spec.js @@ -4,6 +4,6 @@ describe('client getMana()', () => { it('should call the getMana method', async() => { let result = await app.models.Client.getMana(101); - expect(result.mana).toEqual(151.33); + expect(result.mana).toEqual(50.37); }); }); diff --git a/modules/client/back/methods/client/specs/summary.spec.js b/modules/client/back/methods/client/specs/summary.spec.js index 385b9e90b..67fe35e4c 100644 --- a/modules/client/back/methods/client/specs/summary.spec.js +++ b/modules/client/back/methods/client/specs/summary.spec.js @@ -11,13 +11,13 @@ describe('client summary()', () => { it('should return a summary object containing mana', async() => { let result = await app.models.Client.summary(101); - expect(result.mana.mana).toEqual(151.33); + expect(result.mana.mana).toEqual(50.37); }); it('should return a summary object containing debt', async() => { let result = await app.models.Client.summary(101); - expect(result.debt.debt).toEqual(-22.4); + expect(result.debt.debt).toEqual(-111.86); }); it('should return a summary object containing averageInvoiced', async() => { diff --git a/modules/item/back/methods/item/specs/getDiary.spec.js b/modules/item/back/methods/item/specs/getDiary.spec.js index dc678fb09..4800fa3a9 100644 --- a/modules/item/back/methods/item/specs/getDiary.spec.js +++ b/modules/item/back/methods/item/specs/getDiary.spec.js @@ -1,11 +1,11 @@ const app = require('vn-loopback/server/server'); describe('item getDiary()', () => { - it('should return 3 entries, the first one with the property balance -100', async() => { + it('should return 2 entries, the first one with the property balance -100', async() => { let params = {where: {itemFk: 1, warehouseFk: 2}}; let result = await app.models.Item.getDiary(params); - expect(result.length).toBe(4); + expect(result.length).toBe(2); expect(result[0].balance).toBe(-100); }); }); diff --git a/modules/order/back/methods/order-row/specs/addToOrder.spec.js b/modules/order/back/methods/order-row/specs/addToOrder.spec.js index c38cb2a8c..3b832dee2 100644 --- a/modules/order/back/methods/order-row/specs/addToOrder.spec.js +++ b/modules/order/back/methods/order-row/specs/addToOrder.spec.js @@ -1,20 +1,21 @@ const app = require('vn-loopback/server/server'); describe('order addToOrder()', () => { + const orderId = 8; let rowToDelete; afterAll(async done => { - await app.models.OrderRow.removes({rows: [rowToDelete], actualOrderId: 20}); + await app.models.OrderRow.removes({rows: [rowToDelete], actualOrderId: orderId}); done(); }); it('should add a row to a given order', async() => { - let unmodifiedRows = await app.models.OrderRow.find({where: {orderFk: 20}}); + let unmodifiedRows = await app.models.OrderRow.find({where: {orderFk: orderId}}); - expect(unmodifiedRows.length).toBe(1); + expect(unmodifiedRows.length).toBe(2); let params = { - orderFk: 20, + orderFk: orderId, items: [{ itemFk: 1, quantity: 10, @@ -24,10 +25,10 @@ describe('order addToOrder()', () => { await app.models.OrderRow.addToOrder(params); - let modifiedRows = await app.models.OrderRow.find({where: {orderFk: 20}}); + let modifiedRows = await app.models.OrderRow.find({where: {orderFk: orderId}}); rowToDelete = modifiedRows[modifiedRows.length - 1].id; - expect(modifiedRows.length).toBe(2); + expect(modifiedRows.length).toBe(3); }); }); diff --git a/modules/order/back/methods/order/specs/catalogFilter.spec.js b/modules/order/back/methods/order/specs/catalogFilter.spec.js index e800e14ff..ac779493e 100644 --- a/modules/order/back/methods/order/specs/catalogFilter.spec.js +++ b/modules/order/back/methods/order/specs/catalogFilter.spec.js @@ -8,7 +8,7 @@ describe('order catalogFilter()', () => { } }; let tags = []; - let orderFk = 20; + let orderFk = 11; let orderBy = {field: 'relevancy DESC, name', way: 'DESC'}; let result = await app.models.Order.catalogFilter(orderFk, orderBy, filter, tags); let firstItemId = result[0].id; @@ -26,7 +26,7 @@ describe('order catalogFilter()', () => { }; let tags = [{tagFk: 56, value: 'Melee Reinforced weapon'}]; - let orderFk = 20; + let orderFk = 11; let orderBy = {field: 'relevancy DESC, name', way: 'DESC'}; let result = await app.models.Order.catalogFilter(orderFk, orderBy, filter, tags); diff --git a/modules/order/back/methods/order/specs/filter.spec.js b/modules/order/back/methods/order/specs/filter.spec.js index a64ecb17f..cf9df347f 100644 --- a/modules/order/back/methods/order/specs/filter.spec.js +++ b/modules/order/back/methods/order/specs/filter.spec.js @@ -17,16 +17,16 @@ describe('order filter()', () => { let filter = {where: {'o.confirmed': false}}; let result = await app.models.Order.filter(ctx, filter); - expect(result.length).toEqual(6); + expect(result.length).toEqual(16); }); it('should call the filter method with a complex advanced search', async() => { let ctx = {params: {}}; - let filter = {where: {'o.confirmed': false, 'c.salesPersonFk': 18}}; + let filter = {where: {'o.confirmed': false, 'c.salesPersonFk': 19}}; let result = await app.models.Order.filter(ctx, filter); - expect(result.length).toEqual(1); + expect(result.length).toEqual(7); expect(result[0].id).toEqual(16); }); }); diff --git a/modules/order/back/methods/order/specs/getVAT.spec.js b/modules/order/back/methods/order/specs/getVAT.spec.js index bc0abd9af..5306535d2 100644 --- a/modules/order/back/methods/order/specs/getVAT.spec.js +++ b/modules/order/back/methods/order/specs/getVAT.spec.js @@ -1,16 +1,9 @@ const app = require('vn-loopback/server/server'); describe('order getVAT()', () => { - it('should call the getVAT method and return the response', async() => { + it('should return the order VAT', async() => { const result = await app.models.Order.getVAT(1); expect(result).toEqual(20.29); }); - - it(`should call the getVAT method and return zero if doesn't have lines`, async() => { - await app.models.Order.getVAT(13) - .then(response => { - expect(response).toEqual(0); - }); - }); }); diff --git a/modules/order/back/methods/order/specs/updateBasicData.spec.js b/modules/order/back/methods/order/specs/updateBasicData.spec.js index dc9e6b7e6..9b92e69ca 100644 --- a/modules/order/back/methods/order/specs/updateBasicData.spec.js +++ b/modules/order/back/methods/order/specs/updateBasicData.spec.js @@ -1,9 +1,9 @@ const app = require('vn-loopback/server/server'); describe('Order updateBasicData', () => { + const orderId = 21; afterAll(async done => { let validparams = {note: null}; - let orderId = 21; await app.models.Order.updateBasicData(validparams, orderId); @@ -38,11 +38,10 @@ describe('Order updateBasicData', () => { expect(error.toString()).toContain(`You can't make changes on the basic data of an confirmed order or with rows`); }); - it('should return an error if the user is administrative and the isTaxDataChecked value is true BUT the params aint valid', async() => { + it('should return an error if the current user is administrative and the isTaxDataChecked value is true BUT the params aint valid', async() => { let error; let invalidparams = {invalid: 'param for update'}; - let orderId = 21; await app.models.Order.updateBasicData(invalidparams, orderId) .catch(e => { @@ -54,7 +53,6 @@ describe('Order updateBasicData', () => { it('should update the client fiscal data and return the count if changes made', async() => { let validparams = {note: 'test note'}; - let orderId = 21; let order = await app.models.Order.findById(orderId); diff --git a/modules/route/back/methods/route/specs/filter.spec.js b/modules/route/back/methods/route/specs/filter.spec.js index 1bf215138..a1ccfb86e 100644 --- a/modules/route/back/methods/route/specs/filter.spec.js +++ b/modules/route/back/methods/route/specs/filter.spec.js @@ -51,7 +51,7 @@ describe('Route filter()', () => { let result = await app.models.Route.filter(ctx); - expect(result.length).toEqual(1); + expect(result.length).toEqual(2); }); it('should return the routes matching "description"', async() => { diff --git a/modules/route/back/methods/route/specs/getTickets.spec.js b/modules/route/back/methods/route/specs/getTickets.spec.js index 3888156b6..41825025e 100644 --- a/modules/route/back/methods/route/specs/getTickets.spec.js +++ b/modules/route/back/methods/route/specs/getTickets.spec.js @@ -4,6 +4,6 @@ describe('route getTickets()', () => { it('should return the tickets for a given route', async() => { let result = await app.models.Route.getTickets(2); - expect(result.length).toEqual(4); + expect(result.length).toEqual(3); }); }); diff --git a/modules/route/back/methods/route/specs/summary.spec.js b/modules/route/back/methods/route/specs/summary.spec.js index 06972c7ba..16d9fa60f 100644 --- a/modules/route/back/methods/route/specs/summary.spec.js +++ b/modules/route/back/methods/route/specs/summary.spec.js @@ -28,9 +28,9 @@ describe('route summary()', () => { expect(worker.nickname).toEqual('deliveryNick'); }); - it(`should return a summary object containing data from it's tickets`, async() => { + it(`should return a summary object containing data from the tickets`, async() => { const result = await app.models.Route.summary(2); - expect(result.tickets.length).toEqual(4); + expect(result.tickets.length).toEqual(3); }); }); diff --git a/modules/route/back/methods/route/specs/updateVolume.spec.js b/modules/route/back/methods/route/specs/updateVolume.spec.js index 046240555..f56f0dde8 100644 --- a/modules/route/back/methods/route/specs/updateVolume.spec.js +++ b/modules/route/back/methods/route/specs/updateVolume.spec.js @@ -5,13 +5,13 @@ describe('route updateVolume()', () => { const workerFk = 9; const ctx = {req: {accessToken: {userId: workerFk}}}; let originalRoute; - let ticketRestore; + let ticketToRestore; let logIdToDestroy; afterAll(async done => { - await originalRoute.updateAttributes({m3: 0.2}); - await ticketRestore.updateAttributes({routeFk: 4}); + await originalRoute.updateAttributes({m3: 0.1}); + await ticketToRestore.updateAttributes({routeFk: 4}); await app.models.RouteLog.destroyById(logIdToDestroy); done(); }); @@ -19,11 +19,11 @@ describe('route updateVolume()', () => { it('should confirm the original volume of the route is the expected', async() => { originalRoute = await app.models.Route.findById(routeId); - expect(originalRoute.m3).toEqual(0.2); + expect(originalRoute.m3).toEqual(0.1); }); it('should confirm the route volume is updated when a ticket is added', async() => { - ticketRestore = await app.models.Ticket.findById(8); + ticketToRestore = await app.models.Ticket.findById(8); let updatedTicket = await app.models.Ticket.findById(8); await updatedTicket.updateAttributes({routeFk: routeId}); @@ -35,10 +35,9 @@ describe('route updateVolume()', () => { }); it('should confirm the change is logged', async() => { - let instanceValue = {m3: 0.3}; let logs = await app.models.RouteLog.find({fields: ['id', 'newInstance']}); let m3Log = logs.filter(log => { - return log.newInstance.m3 === instanceValue.m3; + return log.newInstance.m3 === 0.2; }); logIdToDestroy = m3Log[0].id; diff --git a/modules/ticket/back/methods/sale/specs/moveToTicket.spec.js b/modules/ticket/back/methods/sale/specs/moveToTicket.spec.js index 4f771ee3f..cbf35d09c 100644 --- a/modules/ticket/back/methods/sale/specs/moveToTicket.spec.js +++ b/modules/ticket/back/methods/sale/specs/moveToTicket.spec.js @@ -40,7 +40,7 @@ describe('sale moveToTicket()', () => { it('should transfer the sales from one ticket to a new one', async() => { const ctx = {req: {accessToken: {userId: 101}}}; - let currentTicket = await app.models.Ticket.findById(8); + let currentTicket = await app.models.Ticket.findById(11); currentTicket.currentTicketId = currentTicket.id; currentTicket.id = undefined; @@ -52,8 +52,8 @@ describe('sale moveToTicket()', () => { currentTicket: currentTicket, receiverTicket: {id: undefined}, sales: [ - {id: 13}, - {id: 14} + {id: currentTicketSales[0].id}, + {id: currentTicketSales[1].id} ] }; @@ -67,9 +67,9 @@ describe('sale moveToTicket()', () => { expect(receiverTicketSales.length).toEqual(2); }); - it('should transfers back the sales and set the created ticket as deleted', async() => { + it('should transfer back the sales and set the created ticket as deleted', async() => { const ctx = {req: {accessToken: {userId: 101}}}; - let receiverTicketId = 8; + let receiverTicketId = 11; let currentTicket = await app.models.Ticket.findById(createdTicketId); currentTicket.currentTicketId = createdTicketId; currentTicket.id = undefined; @@ -87,8 +87,8 @@ describe('sale moveToTicket()', () => { currentTicket: currentTicket, receiverTicket: {id: receiverTicketId}, sales: [ - {id: 13}, - {id: 14} + {id: createdTicketSales[0].id}, + {id: createdTicketSales[1].id} ] }; diff --git a/modules/ticket/back/methods/sale/specs/priceDifference.spec.js b/modules/ticket/back/methods/sale/specs/priceDifference.spec.js index 164e05d17..165b8858c 100644 --- a/modules/ticket/back/methods/sale/specs/priceDifference.spec.js +++ b/modules/ticket/back/methods/sale/specs/priceDifference.spec.js @@ -14,7 +14,7 @@ describe('sale priceDifference()', () => { let result = await app.models.Sale.priceDifference(11, data); expect(result.totalUnitPrice).toEqual(4.03); - expect(result.totalNewPrice).toEqual(4.03); + expect(result.totalNewPrice).toEqual(4.13); expect(result.totalDifference).toEqual(0); }); diff --git a/modules/ticket/back/methods/sale/specs/updatePrice.spec.js b/modules/ticket/back/methods/sale/specs/updatePrice.spec.js index f14e285b0..d8b5dbfc5 100644 --- a/modules/ticket/back/methods/sale/specs/updatePrice.spec.js +++ b/modules/ticket/back/methods/sale/specs/updatePrice.spec.js @@ -4,7 +4,7 @@ describe('sale updatePrice()', () => { let originalSale; let originalSalesPersonMana; let createdSaleComponent; - let saleId = 13; + let saleId = 7; afterAll(async done => { await originalSale.save(); @@ -61,7 +61,7 @@ describe('sale updatePrice()', () => { createdSaleComponent = await app.models.SaleComponent.findOne({where: {saleFk: saleId, componentFk: manaComponentId}}); expect(saleUpdated.price).toEqual(5.5); - expect(createdSaleComponent.value).toEqual(4.200); + expect(createdSaleComponent.value).toEqual(4.48); }); it('should check that the mana of salesPerson changed', async() => { diff --git a/modules/ticket/back/methods/ticket/getSalesPersonMana.js b/modules/ticket/back/methods/ticket/getSalesPersonMana.js index 1289374cd..8ac1d7a38 100644 --- a/modules/ticket/back/methods/ticket/getSalesPersonMana.js +++ b/modules/ticket/back/methods/ticket/getSalesPersonMana.js @@ -19,10 +19,7 @@ module.exports = Self => { }); Self.getSalesPersonMana = async ticketFk => { - let ticket = await Self.app.models.Ticket.find({ - where: { - id: ticketFk - }, + let ticket = await Self.app.models.Ticket.findById(ticketFk, { include: [{ relation: 'client', scope: { @@ -31,7 +28,11 @@ module.exports = Self => { }], fields: ['id', 'clientFk'] }); - let mana = await Self.app.models.WorkerMana.findOne({where: {workerFk: ticket[0].client().salesPersonFk}, fields: 'amount'}); + + if (!ticket) + return 0; + + let mana = await Self.app.models.WorkerMana.findOne({where: {workerFk: ticket.client().salesPersonFk}, fields: 'amount'}); return mana ? mana.amount : 0; }; diff --git a/modules/ticket/back/methods/ticket/specs/filter.spec.js b/modules/ticket/back/methods/ticket/specs/filter.spec.js index 648cfe3ba..eb00cd742 100644 --- a/modules/ticket/back/methods/ticket/specs/filter.spec.js +++ b/modules/ticket/back/methods/ticket/specs/filter.spec.js @@ -1,13 +1,13 @@ const app = require('vn-loopback/server/server'); describe('ticket filter()', () => { - it('should call the filter method', async() => { + it('should return the tickets matching the filter', async() => { let ctx = {req: {accessToken: {userId: 9}}, args: {}}; - let filter = {order: 'shipped DESC'}; + let filter = {order: 'id DESC'}; let result = await app.models.Ticket.filter(ctx, filter); let ticketId = result[0].id; - expect(ticketId).toEqual(15); + expect(ticketId).toEqual(22); }); }); diff --git a/modules/ticket/back/methods/ticket/specs/getSalespersonMana.spec.js b/modules/ticket/back/methods/ticket/specs/getSalespersonMana.spec.js index b08220d15..868366787 100644 --- a/modules/ticket/back/methods/ticket/specs/getSalespersonMana.spec.js +++ b/modules/ticket/back/methods/ticket/specs/getSalespersonMana.spec.js @@ -4,11 +4,11 @@ describe('ticket getSalesPersonMana()', () => { it('should get the mana of a salesperson of a given ticket', async() => { let mana = await app.models.Ticket.getSalesPersonMana(1); - expect(mana).toEqual(222); + expect(mana).toEqual(261); }); - it('should return 0 if the given ticket does not exists', async() => { - let mana = await app.models.Ticket.getSalesPersonMana(20); + it('should return 0 if the given ticket does not exist', async() => { + let mana = await app.models.Ticket.getSalesPersonMana(99); expect(mana).toEqual(0); }); diff --git a/modules/ticket/back/methods/ticket/specs/getTotal.spec.js b/modules/ticket/back/methods/ticket/specs/getTotal.spec.js index bcdcd4889..9b0246740 100644 --- a/modules/ticket/back/methods/ticket/specs/getTotal.spec.js +++ b/modules/ticket/back/methods/ticket/specs/getTotal.spec.js @@ -8,7 +8,7 @@ describe('ticket getTotal()', () => { }); it(`should return zero if the ticket doesn't have lines`, async() => { - let result = await app.models.Ticket.getTotal(13); + let result = await app.models.Ticket.getTotal(21); expect(result).toEqual(0); }); diff --git a/modules/ticket/back/methods/ticket/specs/getVAT.spec.js b/modules/ticket/back/methods/ticket/specs/getVAT.spec.js index 70fa0fa39..27f0b0f3c 100644 --- a/modules/ticket/back/methods/ticket/specs/getVAT.spec.js +++ b/modules/ticket/back/methods/ticket/specs/getVAT.spec.js @@ -1,17 +1,10 @@ const app = require('vn-loopback/server/server'); describe('ticket getVAT()', () => { - it('should call the getVAT method and return the response', async() => { + it('should return the ticket VAT', async() => { await app.models.Ticket.getVAT(1) .then(response => { expect(response).toEqual(20.49); }); }); - - it(`should call the getVAT method and return zero if doesn't have lines`, async() => { - await app.models.Ticket.getVAT(13) - .then(response => { - expect(response).toEqual(0); - }); - }); }); diff --git a/modules/ticket/back/methods/ticket/specs/subtotal.spec.js b/modules/ticket/back/methods/ticket/specs/subtotal.spec.js index c204f806a..d94c2910d 100644 --- a/modules/ticket/back/methods/ticket/specs/subtotal.spec.js +++ b/modules/ticket/back/methods/ticket/specs/subtotal.spec.js @@ -7,8 +7,8 @@ describe('ticket subtotal()', () => { expect(result).toEqual(137.60); }); - it(`should return zero if the ticket doesn't have lines`, async() => { - let result = await app.models.Ticket.subtotal(13); + it(`should return 0 if the ticket doesn't have lines`, async() => { + let result = await app.models.Ticket.subtotal(21); expect(result).toEqual(0.00); }); diff --git a/modules/ticket/back/methods/ticket/specs/summary.spec.js b/modules/ticket/back/methods/ticket/specs/summary.spec.js index 2041555ba..69309a2c8 100644 --- a/modules/ticket/back/methods/ticket/specs/summary.spec.js +++ b/modules/ticket/back/methods/ticket/specs/summary.spec.js @@ -5,7 +5,7 @@ describe('ticket summary()', () => { let result = await app.models.Ticket.summary(1); expect(result.id).toEqual(1); - expect(result.nickname).toEqual('address 21'); + expect(result.nickname).toEqual('Bat cave'); }); it('should return a summary object containing sales from 1 ticket', async() => { diff --git a/modules/ticket/back/methods/ticket/specs/threeLastActive.spec.js b/modules/ticket/back/methods/ticket/specs/threeLastActive.spec.js index 6e6416d78..d3cd9ba93 100644 --- a/modules/ticket/back/methods/ticket/specs/threeLastActive.spec.js +++ b/modules/ticket/back/methods/ticket/specs/threeLastActive.spec.js @@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server'); describe('ticket threeLastActive()', () => { it('should return the last three active tickets', async() => { - let params = {clientFk: 101, ticketFk: 1}; + let params = {clientFk: 109, ticketFk: 19}; let result = await app.models.Ticket.threeLastActive(params); expect(result.length).toEqual(3); diff --git a/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js b/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js index 2e0f1e918..30216c199 100644 --- a/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js +++ b/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js @@ -1,7 +1,7 @@ const app = require('vn-loopback/server/server'); describe('sale updateDiscount()', () => { - const originalSaleId = 14; + const originalSaleId = 8; let componentId; let originalSale; let salesPersonMana; @@ -29,7 +29,7 @@ describe('sale updateDiscount()', () => { it('should throw an error if no sales were selected', async() => { let error; - const ticketId = 8; + const ticketId = 11; const sales = []; const newDiscount = 10; @@ -44,7 +44,7 @@ describe('sale updateDiscount()', () => { it('should throw an error if no sales belong to different tickets', async() => { let error; - const ticketId = 8; + const ticketId = 11; const sales = [1, 14]; const newDiscount = 10; @@ -59,8 +59,8 @@ describe('sale updateDiscount()', () => { it('should throw an error if the ticket is invoiced already', async() => { let error; - const ticketId = 7; - const sales = [22]; + const ticketId = 1; + const sales = [1]; const newDiscount = 100; try { @@ -73,7 +73,7 @@ describe('sale updateDiscount()', () => { }); it('should update the discount if the salesPerson has mana', async() => { - const ticketId = 8; + const ticketId = 11; const sales = [originalSaleId]; const newDiscount = 100; diff --git a/modules/worker/back/methods/worker-mana/specs/getCurrentWorkerMana.spec.js b/modules/worker/back/methods/worker-mana/specs/getCurrentWorkerMana.spec.js index fe0b119f3..d897f464c 100644 --- a/modules/worker/back/methods/worker-mana/specs/getCurrentWorkerMana.spec.js +++ b/modules/worker/back/methods/worker-mana/specs/getCurrentWorkerMana.spec.js @@ -4,7 +4,7 @@ describe('workerMana getCurrentWorkerMana()', () => { it('should get the mana of the logged worker', async() => { let mana = await app.models.WorkerMana.getCurrentWorkerMana({req: {accessToken: {userId: 18}}}); - expect(mana).toEqual(222); + expect(mana).toEqual(261); }); it('should return 0 if the user doesnt uses mana', async() => {