Compare commits

...

68 Commits

Author SHA1 Message Date
Robert Ferrús 46e31b2658 Merge branch 'dev' into 7709-supplierPackaging_ReportSource_2
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-11-11 07:02:36 +00:00
Guillermo Bonet a254cb19cd feat: refs #4948 Added ticket_selfConsumptionPackaging
gitea/salix/pipeline/head This commit looks good Details
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-11-11 07:40:17 +01:00
Javi Gallego dd7c967624 Merge branch 'test' into dev
gitea/salix/pipeline/head This commit looks good Details
2024-11-07 14:49:26 +01:00
Javi Gallego d95e455ccf fix: refs #7935 sin modificar autonomy
gitea/salix/pipeline/head This commit looks good Details
2024-11-07 14:48:31 +01:00
Sergio De la torre cab2b7c93c Merge pull request 'feat: refs #6845 userInterface' (!3161) from 6845-UserInterface into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3161
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-11-06 14:56:13 +00:00
Sergio De la torre 3b87cf0c69 Merge pull request 'feat: refs #7266 buyFkForPrint' (!3159) from 7266-ItemShelvingBuy into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3159
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-11-06 14:55:55 +00:00
Sergio De la torre c113d83797 feat: refs #6845 userInterface
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-11-05 16:42:51 +01:00
Alex Moreno c899727bfc Merge pull request 'refactor: refs #6920 add correct role' (!3160) from 6920-dms_invoiceIn into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3160
Reviewed-by: Jorge Penadés <jorgep@verdnatura.es>
2024-11-05 09:57:15 +00:00
Alex Moreno 85ded59cb3 refactor: refs #6920 add correct role
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-11-04 13:46:54 +01:00
Sergio De la torre 37548e5e64 feat: refs #7266 buyFkForPrint
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-11-04 08:59:10 +01:00
Sergio De la torre 4c0dec19d4 feat: refs #7266 buyFkForPrint
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-11-04 07:48:28 +01:00
Guillermo Bonet 6c40934f74 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/pipeline/head This commit looks good Details
2024-10-29 09:57:06 +01:00
Guillermo Bonet 17412c5b84 feat: refs #7266 Version 2024-10-29 09:57:04 +01:00
Robert Ferrús 5a9d254396 Merge pull request 'feat: refs #8071 travel_weeklyClone' (!3058) from 8071-travelWeeklyClone into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3058
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-10-29 06:48:05 +00:00
Robert Ferrús f699f64caa Merge branch 'dev' into 8071-travelWeeklyClone
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-29 06:45:57 +00:00
Sergio De la torre 6bf186ca66 Merge pull request 'feat: refs #7922 refs #792 scanOrder' (!3157) from 7922-scanOrder into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3157
Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-10-29 06:45:11 +00:00
Sergio De la torre a8cc417fb4 Merge branch 'dev' into 7922-scanOrder
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-29 06:32:32 +00:00
Robert Ferrús 8ab6bc39cc Merge branch 'dev' into 8071-travelWeeklyClone
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-29 06:31:21 +00:00
Guillermo Bonet 2f0fa56040 feat: refs #7266 Version
gitea/salix/pipeline/head This commit looks good Details
2024-10-29 07:19:51 +01:00
Guillermo Bonet 6afb8fbeb5 Merge pull request 'feat: refs #7266 Added details and improvements in item label reports' (!3154) from 7266-itemQrBarcodeLabel into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3154
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-10-29 06:04:15 +00:00
Carlos Andrés 66a5708efb Merge pull request 'feat: refs #8087 Traspasar redadas a travels' (!3147) from 8087-nuevoCampoTravel into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3147
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-10-28 14:41:01 +00:00
Guillermo Bonet bfc446ab79 feat: refs #7266 Requested changes and improvements
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-28 14:56:01 +01:00
Guillermo Bonet c8662a5051 Merge branch '7266-itemQrBarcodeLabel' of https://gitea.verdnatura.es/verdnatura/salix into 7266-itemQrBarcodeLabel
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-10-28 14:51:21 +01:00
Guillermo Bonet a37b7b71a8 feat: refs #7266 Requested changes and improvements 2024-10-28 14:51:19 +01:00
Robert Ferrús f05b6a46b0 feat: refs #8071 quitar esquema
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-28 14:36:10 +01:00
Robert Ferrús 994b562823 Merge branch 'dev' into 8071-travelWeeklyClone
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-28 13:34:54 +00:00
Carlos Andrés bffb13f94a feat: refs #8087 Traspasar redadas a travels
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-28 14:24:44 +01:00
Carlos Andrés 511c848342 feat: refs #8087 Traspasar redadas a travels
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-28 14:22:08 +01:00
Carlos Andrés 61026d2d34 feat: refs #8087 Traspasar redadas a travels
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-28 14:02:27 +01:00
Carlos Satorres b41e703a1b Merge pull request 'fix: refs #7283 item filters' (!3156) from 7283-fixItemFilters into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3156
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-10-28 12:27:59 +00:00
Carlos Satorres 385279b39d fix: refs #7283 tback
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-28 13:15:40 +01:00
Carlos Satorres 0180998683 fix: refs #7283 item filters
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-10-28 13:08:27 +01:00
Jon Elias 21ddd3fcd0 Merge pull request '#7193 Added scope in parking model' (!3153) from 7193-ParkingCreateScope into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3153
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-10-28 10:48:09 +00:00
Guillermo Bonet b899a7967f Merge branch 'dev' into 7266-itemQrBarcodeLabel
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-28 10:38:17 +00:00
Guillermo Bonet c43bdb5021 feat: refs #7266 Added details and improvements in item label reports
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-28 11:29:15 +01:00
Jon Elias b27aa1bd94 Merge branch 'dev' into 7193-ParkingCreateScope
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-28 09:52:17 +00:00
Sergio De la torre 3f04f3f24b Merge pull request 'feat: refs #7921 refs#7921 sendLostExpedition' (!3149) from 7921-sendExpeditionLost into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3149
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-10-28 09:42:21 +00:00
Jon Elias eb5f57285a feat: refs #7193 added scope in parking model
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-28 10:40:43 +01:00
Sergio De la torre 93feb74949 Merge branch 'dev' of https: refs #7921//gitea.verdnatura.es/verdnatura/salix into 7921-sendExpeditionLost
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-28 10:22:23 +01:00
Jorge Penadés 78edda56c7 Merge pull request 'feat: refs #7524 restrict fields' (!3151) from 7524-fixE2e into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3151
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-10-28 08:47:45 +00:00
Jorge Penadés b20ca1d8d7 Merge branch 'dev' into 7524-fixE2e
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-28 08:43:45 +00:00
Sergio De la torre 6efc2c340c feat: refs #7921 refs#7921 sendLostExpedition
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-10-28 08:57:22 +01:00
Carlos Satorres 2bd3f4514b Merge pull request 'fix: refs #6644 email and translations' (!3152) from 6644-modEmail into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3152
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-10-28 07:07:17 +00:00
Carlos Satorres c8101375a2 Merge branch 'dev' into 6644-modEmail
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-28 07:04:17 +00:00
Carlos Satorres 869c7ab598 fix: refs #6644 email and translations
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-28 07:37:42 +01:00
Guillermo Bonet 8c4d3bac0d Merge branch 'test' into dev
gitea/salix/pipeline/head This commit looks good Details
2024-10-28 07:11:38 +01:00
Guillermo Bonet 765d125219 Merge branch 'master' into test
gitea/salix/pipeline/head This commit looks good Details
2024-10-28 07:11:21 +01:00
Guillermo Bonet a707f9cbff Merge pull request 'fix: refs #235425 sale priceFixed update' (!3146) from hotfix235425-updatePrice into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3146
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-10-28 06:06:56 +00:00
Jorge Penadés d8e241740f feat: refs #7524 restrict fields
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-27 13:47:52 +01:00
Carlos Andrés fb0764bc1f feat: refs #8087 Traspasar redadas a travels
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-25 14:34:51 +02:00
Guillermo Bonet 76a9db29c2 Merge pull request 'feat: refs #7006 itemTypeLog created' (!3093) from 7006-itemTypeLog into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3093
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-10-25 12:32:20 +00:00
Guillermo Bonet 14d6eb722e feat: refs #7006 Requested changes
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-25 14:24:26 +02:00
Guillermo Bonet 80764b6495 feat: refs #7006 itemTypeLog
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-25 14:17:57 +02:00
Sergio De la torre e775e56120 feat: refs #7921 refs#7921 sendLostExpedition
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-25 13:48:27 +02:00
Guillermo Bonet 956e89475e Merge branch 'dev' into 7006-itemTypeLog
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-25 11:06:55 +00:00
Jorge Penadés ab145be1aa Merge pull request 'feat: refs #7943 return only the required content' (!3148) from 7943-fixWorker into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3148
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-10-25 09:50:57 +00:00
Jorge Penadés 8f10260795 feat: refs #7943 return just the required content
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-25 11:37:45 +02:00
Guillermo Bonet 69e1df2504 fix: refs #235425 Requested changes
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-25 08:47:43 +02:00
Guillermo Bonet 111480f7b7 fix: refs #235425 Requested changes
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-25 07:22:36 +02:00
Sergio De la torre 11e13fdb20 feat: refs #7922 refs #792 scanOrder
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-25 06:40:06 +02:00
Carlos Andrés 4d3bc2c837 feat: refs #8087 Traspasar redadas a travels
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-10-24 19:32:02 +02:00
Carlos Andrés 1bf900f81b feat: refs #8087 Traspasar redadas a travels
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-10-24 12:33:47 +02:00
Guillermo Bonet 4da11c65bb fix: refs #235425 sale priceFixed update
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-24 12:26:03 +02:00
Javier Segarra 70b1628649 Merge pull request 'HOTFIX: RecalculatePrice not working with all ids' (!3144) from hotfix_recalculatePrice_list_ids into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3144
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-10-24 08:36:34 +00:00
Javier Segarra 070a5640df fix: recalculatePrice not working with all ids
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-24 08:16:04 +00:00
Guillermo Bonet 6c62172633 feat: refs #7006 itemTypeLog created
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-14 09:31:35 +02:00
Guillermo Bonet 78a9b788bf feat: refs #7006 itemTypeLog created
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-14 08:42:54 +02:00
Robert Ferrús 06296e7bd5 feat: refs #8071 travel_weeklyClone
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-02 13:39:10 +02:00
108 changed files with 925 additions and 675 deletions

View File

@ -1505,32 +1505,32 @@ INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk
(9, '99610289193', 302, 2972, util.VN_CURDATE(), 3871, 442, 1), (9, '99610289193', 302, 2972, util.VN_CURDATE(), 3871, 442, 1),
(10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1); (10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1);
INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyModeFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`, `awbFK`) INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyModeFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`, `awbFK`, `daysInForward`)
VALUES (1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000, 'first travel', 1, 1, 1), VALUES (1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000, 'first travel', 1, 1, 1, NULL),
(2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150.00, 2000, 'second travel', 2, 2, 2), (2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150.00, 2000, 'second travel', 2, 2, 2, NULL),
(3, util.VN_CURDATE(), util.VN_CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1, 1, 3), (3, util.VN_CURDATE(), util.VN_CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1, 1, 3, NULL),
(4, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 3, 1, 50.00, 500, 'fourth travel', 0, 2, 4), (4, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 3, 1, 50.00, 500, 'fourth travel', 0, 2, 4, NULL),
(5, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1, 5), (5, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1, 5, NULL),
(6, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2, 6), (6, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2, 6, NULL),
(7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1, 7), (7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1, 7, 2),
(8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2, 10), (8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2, 10, NULL),
(10, DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), 5, 1, 1, 50.00, 500, 'nineth travel', 1, 2, 10), (10, DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), 5, 1, 1, 50.00, 500, 'nineth travel', 1, 2, 10, 2),
(11, util.VN_CURDATE() - INTERVAL 1 DAY , util.VN_CURDATE(), 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4), (11, util.VN_CURDATE() - INTERVAL 1 DAY , util.VN_CURDATE(), 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4, NULL),
(12, util.VN_CURDATE() , util.VN_CURDATE() + INTERVAL 1 DAY, 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4); (12, util.VN_CURDATE() , util.VN_CURDATE() + INTERVAL 1 DAY, 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4, NULL);
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `evaNotes`) INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `evaNotes`)
VALUES VALUES
(1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, 0, ''), (1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, ''),
(2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 0, 'observation two'), (2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 'observation two'),
(3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 0, 'observation three'), (3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 'observation three'),
(4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 0, 'observation four'), (4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 'observation four'),
(5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 0, 'observation five'), (5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 'observation five'),
(6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 0, 'observation six'), (6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 'observation six'),
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 0, 'observation seven'), (7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 'observation seven'),
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, 1, ''), (8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1,''),
(9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, 1, ''), (9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, ''),
(10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 10', 1, 1, ''), (10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 10', 1, ''),
(99, 69, '2000-12-01 00:00:00.000', 11, 0, 442, 'IN2009', 'Movement 99', 0, 0, ''); (99, 69, '2000-12-01 00:00:00.000', 11, 0, 442, 'IN2009', 'Movement 99', 0, '');
INSERT INTO `vn`.`entryConfig` (`defaultEntry`, `inventorySupplierFk`, `defaultSupplierFk`) INSERT INTO `vn`.`entryConfig` (`defaultEntry`, `inventorySupplierFk`, `defaultSupplierFk`)
VALUES (2, 4, 1); VALUES (2, 4, 1);
@ -2454,7 +2454,7 @@ INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `manual`, `direction`, `
INSERT INTO `vn`.`dmsType` INSERT INTO `vn`.`dmsType`
(`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`) (`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`)
VALUES VALUES
(1, 'Facturas Recibidas', NULL, NULL, 'invoiceIn'), (1, 'Facturas Recibidas', 1, 1, 'invoiceIn'),
(2, 'Doc oficial', NULL, NULL, 'officialDoc'), (2, 'Doc oficial', NULL, NULL, 'officialDoc'),
(3, 'Laboral', 37, 37, 'hhrrData'), (3, 'Laboral', 37, 37, 'hhrrData'),
(4, 'Albaranes recibidos', NULL, NULL, 'deliveryNote'), (4, 'Albaranes recibidos', NULL, NULL, 'deliveryNote'),

View File

@ -53,7 +53,7 @@ proc: BEGIN
WHERE t.landed BETWEEN vInventoryDate AND vStartDate WHERE t.landed BETWEEN vInventoryDate AND vStartDate
AND t.warehouseInFk = vWarehouse AND t.warehouseInFk = vWarehouse
AND s.name != 'INVENTARIO' AND s.name != 'INVENTARIO'
AND NOT e.isRaid AND NOT t.daysInForward
GROUP BY b.itemFk GROUP BY b.itemFk
) c ) c
JOIN vn.item i ON i.id = c.itemFk JOIN vn.item i ON i.id = c.itemFk

View File

@ -6,16 +6,16 @@ BEGIN
UPDATE vn.buy b UPDATE vn.buy b
JOIN vn.entry e ON e.id = b.entryFk JOIN vn.entry e ON e.id = b.entryFk
JOIN vn.travel tr ON tr.id = e.travelFk JOIN vn.travel tr ON tr.id = e.travelFk
JOIN vn.agencyMode am ON am.id = tr.agencyModeFk JOIN vn.agencyMode am ON am.id = tr.agencyModeFk
JOIN vn.item i ON i.id = b.itemFk JOIN vn.item i ON i.id = b.itemFk
JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID JOIN edi.supplyResponse sr ON i.supplyResponseFk = sr.ID
SET b.quantity = NEW.NumberOfItemsPerCask * NEW.NumberOfUnits, SET b.quantity = NEW.NumberOfItemsPerCask * NEW.NumberOfUnits,
b.stickers = NEW.NumberOfUnits b.stickers = NEW.NumberOfUnits
WHERE i.supplyResponseFk = NEW.ID WHERE i.supplyResponseFk = NEW.ID
AND am.name = 'LOGIFLORA' AND am.name = 'LOGIFLORA'
AND e.isRaid AND tr.daysInForward
AND tr.landed >= util.VN_CURDATE(); AND tr.landed >= util.VN_CURDATE();
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -59,7 +59,7 @@ BEGIN
JOIN vn.travel t ON t.id = e.travelFk JOIN vn.travel t ON t.id = e.travelFk
WHERE t.landed BETWEEN vDateInv AND vDate WHERE t.landed BETWEEN vDateInv AND vDate
AND t.warehouseInFk = vWarehouse AND t.warehouseInFk = vWarehouse
AND NOT e.isRaid AND NOT t.daysInForward
UNION ALL UNION ALL
SELECT b.itemFk, -b.quantity SELECT b.itemFk, -b.quantity
FROM vn.buy b FROM vn.buy b
@ -67,7 +67,7 @@ BEGIN
JOIN vn.travel t ON t.id = e.travelFk JOIN vn.travel t ON t.id = e.travelFk
WHERE t.shipped BETWEEN vDateInv AND util.VN_CURDATE() WHERE t.shipped BETWEEN vDateInv AND util.VN_CURDATE()
AND t.warehouseOutFk = vWarehouse AND t.warehouseOutFk = vWarehouse
AND NOT e.isRaid AND NOT t.daysInForward
AND t.isDelivered AND t.isDelivered
UNION ALL UNION ALL
SELECT m.itemFk, -m.quantity SELECT m.itemFk, -m.quantity

View File

@ -11,7 +11,7 @@ BEGIN
e.id entryFk, e.id entryFk,
t.id travelFk, t.id travelFk,
b.itemFk, b.itemFk,
e.isRaid, t.daysInForward,
ADDTIME(t.shipped, ADDTIME(t.shipped,
IFNULL(t.shipmentHour, '00:00:00')) shipped, IFNULL(t.shipmentHour, '00:00:00')) shipped,
t.warehouseOutFk, t.warehouseOutFk,
@ -50,7 +50,7 @@ BEGIN
itemFk, itemFk,
TIMESTAMPADD(DAY, life, @dated), TIMESTAMPADD(DAY, life, @dated),
quantity, quantity,
IF(isIn, isReceived, isDelivered) AND !isRaid IF(isIn, isReceived, isDelivered) AND NOT daysInForward
FROM tValues FROM tValues
WHERE isIn OR !lessThanInventory; WHERE isIn OR !lessThanInventory;
@ -65,7 +65,7 @@ BEGIN
itemFk, itemFk,
created, created,
quantity, quantity,
IF(isIn, isDelivered, isReceived) AND !isRaid IF(isIn, isDelivered, isReceived) AND NOT daysInForward
FROM tValues FROM tValues
WHERE !isIn OR !lessThanInventory; WHERE !isIn OR !lessThanInventory;

View File

@ -1,8 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`raidUpdate`
ON SCHEDULE EVERY 1 DAY
STARTS '2017-12-29 00:05:00.000'
ON COMPLETION PRESERVE
ENABLE
DO CALL raidUpdate$$
DELIMITER ;

View File

@ -39,7 +39,7 @@ BEGIN
AND vWarehouseFk IN (tr.warehouseInFk, 0) AND vWarehouseFk IN (tr.warehouseInFk, 0)
AND b.itemFk = vItemFk AND b.itemFk = vItemFk
AND NOT e.isExcludedFromAvailable AND NOT e.isExcludedFromAvailable
AND NOT e.isRaid AND NOT tr.daysInForward
UNION ALL UNION ALL
SELECT tr.shipped, SELECT tr.shipped,
NULL, NULL,
@ -58,7 +58,7 @@ BEGIN
AND s.id <> (SELECT supplierFk FROM inventoryConfig) AND s.id <> (SELECT supplierFk FROM inventoryConfig)
AND b.itemFk = vItemFk AND b.itemFk = vItemFk
AND NOT e.isExcludedFromAvailable AND NOT e.isExcludedFromAvailable
AND NOT e.isRaid AND NOT tr.daysInForward
UNION ALL UNION ALL
SELECT t.shipped, SELECT t.shipped,
NULL, NULL,
@ -81,7 +81,7 @@ BEGIN
FROM tHistoricalPast FROM tHistoricalPast
WHERE `date` < vDate; WHERE `date` < vDate;
SELECT p1.*, NULL v_virtual SELECT p1.*, NULL v_virtual
FROM ( FROM (
SELECT vDate `date`, SELECT vDate `date`,
vCalculatedInventory input, vCalculatedInventory input,
@ -96,7 +96,7 @@ BEGIN
FROM tHistoricalPast FROM tHistoricalPast
WHERE `date` >= vDate WHERE `date` >= vDate
) p1; ) p1;
DROP TEMPORARY TABLE tHistoricalPast; DROP TEMPORARY TABLE tHistoricalPast;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`available_traslate`(
vWarehouseShipment INT) vWarehouseShipment INT)
proc: BEGIN proc: BEGIN
/** /**
* Calcular la disponibilidad dependiendo del almacen * Calcular la disponibilidad dependiendo del almacen
* de origen y destino según la fecha. * de origen y destino según la fecha.
* *
* @param vWarehouseLanding Almacén de llegada * @param vWarehouseLanding Almacén de llegada
@ -42,10 +42,10 @@ proc: BEGIN
WHERE t.landed BETWEEN vDatedInventory AND vDatedFrom WHERE t.landed BETWEEN vDatedInventory AND vDatedFrom
AND t.warehouseInFk = vWarehouseLanding AND t.warehouseInFk = vWarehouseLanding
AND NOT e.isExcludedFromAvailable AND NOT e.isExcludedFromAvailable
AND NOT e.isRaid AND NOT t.daysInForward
GROUP BY c.itemFk; GROUP BY c.itemFk;
-- Tabla con el ultimo dia de last_buy para cada producto -- Tabla con el ultimo dia de last_buy para cada producto
-- que hace un replace de la anterior. -- que hace un replace de la anterior.
CALL buy_getUltimate (NULL, vWarehouseShipment, util.VN_CURDATE()); CALL buy_getUltimate (NULL, vWarehouseShipment, util.VN_CURDATE());
@ -57,7 +57,7 @@ proc: BEGIN
JOIN travel tr ON tr.id = e.travelFk JOIN travel tr ON tr.id = e.travelFk
LEFT JOIN tItemRange i ON t.itemFk = i.itemFk LEFT JOIN tItemRange i ON t.itemFk = i.itemFk
WHERE t.warehouseFk = vWarehouseShipment WHERE t.warehouseFk = vWarehouseShipment
AND NOT e.isRaid AND NOT tr.daysInForward
ON DUPLICATE KEY UPDATE tItemRange.dated = GREATEST(tItemRange.dated, ON DUPLICATE KEY UPDATE tItemRange.dated = GREATEST(tItemRange.dated,
tr.landed); tr.landed);
@ -94,7 +94,7 @@ proc: BEGIN
JOIN tItemRangeLive ir ON ir.itemFk = b.itemFk JOIN tItemRangeLive ir ON ir.itemFk = b.itemFk
WHERE NOT e.isExcludedFromAvailable WHERE NOT e.isExcludedFromAvailable
AND b.quantity <> 0 AND b.quantity <> 0
AND NOT e.isRaid AND NOT t.daysInForward
AND t.warehouseInFk = vWarehouseLanding AND t.warehouseInFk = vWarehouseLanding
AND t.landed >= vDatedFrom AND t.landed >= vDatedFrom
AND (ir.dated IS NULL OR t.landed <= ir.dated) AND (ir.dated IS NULL OR t.landed <= ir.dated)
@ -135,4 +135,4 @@ proc: BEGIN
DROP TEMPORARY TABLE tmp.itemList, tItemRange, tItemRangeLive; DROP TEMPORARY TABLE tmp.itemList, tItemRange, tItemRangeLive;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -28,7 +28,7 @@ BEGIN
JOIN agencyMode am ON am.id = tr.agencyModeFk JOIN agencyMode am ON am.id = tr.agencyModeFk
WHERE NOT b.quantity WHERE NOT b.quantity
AND am.code = 'logiflora' AND am.code = 'logiflora'
AND e.isRaid; AND tr.daysInForward;
START TRANSACTION; START TRANSACTION;

View File

@ -30,7 +30,9 @@ BEGIN
t.warehouseFk, t.warehouseFk,
w.id salesPersonFk, w.id salesPersonFk,
IFNULL(ob.description,'') observaciones, IFNULL(ob.description,'') observaciones,
cc.rgb cc.rgb,
p.code parkingCode,
IF (ps.ticketFk, TRUE, FALSE) isAdvanced
FROM vn.ticket t FROM vn.ticket t
LEFT JOIN vn.ticketCollection tc ON t.id = tc.ticketFk LEFT JOIN vn.ticketCollection tc ON t.id = tc.ticketFk
LEFT JOIN vn.collection c2 ON c2.id = tc.collectionFk LEFT JOIN vn.collection c2 ON c2.id = tc.collectionFk
@ -42,7 +44,10 @@ BEGIN
LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk
LEFT JOIN vn.client c ON c.id = t.clientFk LEFT JOIN vn.client c ON c.id = t.clientFk
LEFT JOIN vn.worker w ON w.id = c.salesPersonFk LEFT JOIN vn.worker w ON w.id = c.salesPersonFk
LEFT JOIN observation ob ON ob.ticketFk = t.id LEFT JOIN observation ob ON ob.ticketFk = t.id
LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id
LEFT JOIN vn.parking p ON tp.parkingFk = p.id
LEFT JOIN vn.packingSiteAdvanced ps ON ps.ticketFk = t.id
WHERE t.id = vParamFk WHERE t.id = vParamFk
AND t.shipped >= vYesterday AND t.shipped >= vYesterday
UNION UNION
@ -52,7 +57,9 @@ BEGIN
t.warehouseFk, t.warehouseFk,
w.id salesPersonFk, w.id salesPersonFk,
ob.description, ob.description,
IF(NOT (vItemPackingTypeFk <=> 'V'), cc.rgb, NULL) `rgb` IF(NOT (vItemPackingTypeFk <=> 'V'), cc.rgb, NULL) `rgb`,
p.code parkingCode,
IF (ps.ticketFk, TRUE, FALSE) isAdvanced
FROM vn.ticket t FROM vn.ticket t
JOIN vn.ticketCollection tc ON t.id = tc.ticketFk JOIN vn.ticketCollection tc ON t.id = tc.ticketFk
LEFT JOIN vn.collection c2 ON c2.id = tc.collectionFk LEFT JOIN vn.collection c2 ON c2.id = tc.collectionFk
@ -64,7 +71,10 @@ BEGIN
LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk
LEFT JOIN vn.client c ON c.id = t.clientFk LEFT JOIN vn.client c ON c.id = t.clientFk
LEFT JOIN vn.worker w ON w.id = c.salesPersonFk LEFT JOIN vn.worker w ON w.id = c.salesPersonFk
LEFT JOIN observation ob ON ob.ticketFk = t.id LEFT JOIN observation ob ON ob.ticketFk = t.id
LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id
LEFT JOIN vn.parking p ON tp.parkingFk = p.id
LEFT JOIN vn.packingSiteAdvanced ps ON ps.ticketFk = t.id
WHERE tc.collectionFk = vParamFk WHERE tc.collectionFk = vParamFk
UNION UNION
SELECT sg.ticketFk, SELECT sg.ticketFk,
@ -73,7 +83,9 @@ BEGIN
t.warehouseFk, t.warehouseFk,
c.salesPersonFk, c.salesPersonFk,
ob.description, ob.description,
NULL `rgb` NULL `rgb`,
p.code parkingCode,
IF (ps.ticketFk, TRUE, FALSE) isAdvanced
FROM vn.sectorCollection sc FROM vn.sectorCollection sc
JOIN vn.sectorCollectionSaleGroup ss ON ss.sectorCollectionFk = sc.id JOIN vn.sectorCollectionSaleGroup ss ON ss.sectorCollectionFk = sc.id
JOIN vn.saleGroup sg ON sg.id = ss.saleGroupFk JOIN vn.saleGroup sg ON sg.id = ss.saleGroupFk
@ -81,7 +93,10 @@ BEGIN
LEFT JOIN vn.zone z ON z.id = t.zoneFk LEFT JOIN vn.zone z ON z.id = t.zoneFk
LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk
LEFT JOIN observation ob ON ob.ticketFk = t.id LEFT JOIN observation ob ON ob.ticketFk = t.id
LEFT JOIN vn.client c ON c.id = t.clientFk LEFT JOIN vn.client c ON c.id = t.clientFk
LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id
LEFT JOIN vn.parking p ON tp.parkingFk = p.id
LEFT JOIN vn.packingSiteAdvanced ps ON ps.ticketFk = t.id
WHERE sc.id = vParamFk WHERE sc.id = vParamFk
AND t.shipped >= vYesterday AND t.shipped >= vYesterday
GROUP BY ticketFk; GROUP BY ticketFk;

View File

@ -17,7 +17,6 @@ BEGIN
supplierFk, supplierFk,
dated, dated,
isExcludedFromAvailable, isExcludedFromAvailable,
isRaid,
commission, commission,
currencyFk, currencyFk,
companyFk, companyFk,
@ -28,7 +27,6 @@ BEGIN
supplierFk, supplierFk,
dated, dated,
isExcludedFromAvailable, isExcludedFromAvailable,
isRaid,
commission, commission,
currencyFk, currencyFk,
companyFk, companyFk,

View File

@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_getTransfer`(
BEGIN BEGIN
/** /**
* Retorna los artículos trasladables a partir de una entrada. * Retorna los artículos trasladables a partir de una entrada.
* *
* @param vSelf Id de entrada * @param vSelf Id de entrada
*/ */
DECLARE vDateShipped DATE; DECLARE vDateShipped DATE;
@ -166,7 +166,7 @@ BEGIN
LEFT JOIN tmp.buyUltimateFromInterval bufi ON bufi.itemFk = i.id LEFT JOIN tmp.buyUltimateFromInterval bufi ON bufi.itemFk = i.id
LEFT JOIN buy b3 ON b3.id = bufi.buyFk LEFT JOIN buy b3 ON b3.id = bufi.buyFk
WHERE ic.display WHERE ic.display
AND NOT e.isRaid AND NOT tr.daysInForward
AND (ti.visible OR ti.available) AND (ti.visible OR ti.available)
ORDER BY i.typeFk, i.name, i.id, i.size, i.category, o.name; ORDER BY i.typeFk, i.name, i.id, i.size, i.category, o.name;

View File

@ -16,7 +16,8 @@ BEGIN
a.nickname, a.nickname,
sub2.itemPackingTypeConcat, sub2.itemPackingTypeConcat,
est.code, est.code,
es.isScanned es2.isScanned,
es2.scanOrder
FROM expedition e FROM expedition e
JOIN ticket t ON t.id = e.ticketFk JOIN ticket t ON t.id = e.ticketFk
JOIN ticketState ts ON ts.ticketFk = e.ticketFk JOIN ticketState ts ON ts.ticketFk = e.ticketFk
@ -38,6 +39,7 @@ BEGIN
SELECT MAX(id) SELECT MAX(id)
FROM expeditionState es FROM expeditionState es
WHERE expeditionFk = e.id) WHERE expeditionFk = e.id)
LEFT JOIN expeditionState es2 ON es2.id = es.id
WHERE t.routeFk = vRouteFk AND e.freightItemFk <> FALSE WHERE t.routeFk = vRouteFk AND e.freightItemFk <> FALSE
ORDER BY r.created, t.priority DESC; ORDER BY r.created, t.priority DESC;
END$$ END$$

View File

@ -0,0 +1,93 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expedition_selfConsumptionPackaging`(
vSelf INT,
vAction ENUM('add', 'remove')
)
BEGIN
/**
* Maneja el consumo de cajas para autoconsumo, permitiendo
* añadir o quitar cajas utilizadas según la acción indicada.
*
* @param vSelf Id de expedición
*/
DECLARE vClientFk INT;
DECLARE vAddressFk INT;
DECLARE vItemFk INT;
DECLARE vItemName VARCHAR(50);
DECLARE vWarehouseFk INT;
DECLARE vCreated DATE;
DECLARE vTicketFk INT;
DECLARE vSaleFk INT;
DECLARE vQuantity INT;
IF vAction NOT IN ('add', 'remove') THEN
CALL util.throw('Action not supported');
END IF;
SELECT pc.clientSelfConsumptionFk,
pc.addressSelfConsumptionFk,
i.id,
i.name,
t.warehouseFk,
e.created
INTO vClientFk,
vAddressFk,
vItemFk,
vItemName,
vWarehouseFk,
vCreated
FROM expedition e
JOIN packaging p ON p.id = e.packagingFk
JOIN item i ON i.id = p.itemFk
JOIN ticket t ON t.id = e.ticketFk
JOIN productionConfig pc
WHERE e.id = vSelf;
IF vClientFk IS NULL OR vAddressFk IS NULL THEN
CALL util.throw('Some config parameters are not set');
END IF;
SET vCreated = DATE(vCreated);
SELECT id INTO vTicketFk
FROM ticket
WHERE shipped BETWEEN vCreated AND util.dayEnd(vCreated)
AND clientFk = vClientFk
AND addressFk = vAddressFk
AND warehouseFk = vWarehouseFk;
IF vTicketFk IS NULL AND vAction = 'add' THEN
INSERT INTO ticket(clientFk, warehouseFk, shipped, nickname, addressFk)
VALUES (vClientFk, vWarehouseFk, vCreated, 'CAJAS AUTOCONSUMO', vAddressFk);
SET vTicketFk = LAST_INSERT_ID();
END IF;
SELECT id, quantity INTO vSaleFk, vQuantity
FROM sale
WHERE itemFk = vItemFk
AND ticketFk = vTicketFk
LIMIT 1;
IF vAction = 'add' THEN
IF vSaleFk IS NOT NULL THEN
UPDATE sale
SET quantity = quantity + 1
WHERE id = vSaleFk;
ELSE
INSERT INTO sale(itemFk, ticketFk, concept, quantity)
VALUES (vItemFk, vTicketFk, vItemName, 1);
END IF;
ELSE
IF vSaleFk IS NOT NULL THEN
IF vQuantity > 1 THEN
UPDATE sale
SET quantity = quantity - 1
WHERE id = vSaleFk;
ELSE
DELETE FROM sale WHERE id = vSaleFk;
END IF;
END IF;
END IF;
END$$
DELIMITER ;

View File

@ -137,7 +137,7 @@ BEGIN
JOIN travel tr ON tr.id = e.travelFk JOIN travel tr ON tr.id = e.travelFk
WHERE tr.warehouseInFk = vWarehouseFk WHERE tr.warehouseInFk = vWarehouseFk
AND tr.landed BETWEEN vDateLastInventory AND vDateYesterday AND tr.landed BETWEEN vDateLastInventory AND vDateYesterday
AND NOT isRaid AND NOT tr.daysInForward
GROUP BY b.itemFk; GROUP BY b.itemFk;
-- Transfers -- Transfers
@ -150,7 +150,7 @@ BEGIN
JOIN travel tr ON tr.id = e.travelFk JOIN travel tr ON tr.id = e.travelFk
WHERE tr.warehouseOutFk = vWarehouseFk WHERE tr.warehouseOutFk = vWarehouseFk
AND tr.shipped BETWEEN vDateLastInventory AND vDateYesterday AND tr.shipped BETWEEN vDateLastInventory AND vDateYesterday
AND NOT isRaid AND NOT tr.daysInForward
GROUP BY b.itemFk GROUP BY b.itemFk
) sub ) sub
ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity, 0) + sub.quantityOut; ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity, 0) + sub.quantityOut;

View File

@ -7,9 +7,10 @@ BEGIN
* @param vSelf matrícula del carro * @param vSelf matrícula del carro
**/ **/
SELECT ish.itemFk item, SELECT ish.itemFk item,
IFNULL(i.longName, CONCAT(i.name, ' ', i.size)) description, i.name,
i.longName,
i.size,
ish.visible, ish.visible,
CEIL(ish.visible/ish.packing) stickers,
ish.packing, ish.packing,
ish.grouping, ish.grouping,
p.code, p.code,
@ -17,7 +18,8 @@ BEGIN
s.priority, s.priority,
ish.isChecked, ish.isChecked,
ic.url, ic.url,
ish.available ish.available,
ish.buyFk
FROM itemShelving ish FROM itemShelving ish
JOIN item i ON i.id = ish.itemFk JOIN item i ON i.id = ish.itemFk
JOIN shelving s ON vSelf = s.code COLLATE utf8_unicode_ci JOIN shelving s ON vSelf = s.code COLLATE utf8_unicode_ci

View File

@ -50,16 +50,16 @@ BEGIN
JOIN vn.entry e ON e.id = b.entryFk JOIN vn.entry e ON e.id = b.entryFk
JOIN vn.travel tr ON tr.id = e.travelFk JOIN vn.travel tr ON tr.id = e.travelFk
JOIN vn.supplier s ON s.id = e.supplierFk JOIN vn.supplier s ON s.id = e.supplierFk
JOIN vn.state st ON st.`code` = IF(tr.landed < util.VN_CURDATE() JOIN vn.state st ON st.`code` = IF(tr.landed < util.VN_CURDATE()
OR (util.VN_CURDATE() AND tr.isReceived), OR (util.VN_CURDATE() AND tr.isReceived),
'DELIVERED', 'DELIVERED',
'FREE') 'FREE')
WHERE tr.landed >= vDateInventory WHERE tr.landed >= vDateInventory
AND tr.warehouseInFk = vWarehouseFk AND tr.warehouseInFk = vWarehouseFk
AND (s.id <> vSupplierInventoryFk OR vDated IS NULL) AND (s.id <> vSupplierInventoryFk OR vDated IS NULL)
AND b.itemFk = vItemFk AND b.itemFk = vItemFk
AND NOT e.isExcludedFromAvailable AND NOT e.isExcludedFromAvailable
AND NOT e.isRaid AND NOT tr.daysInForward
), ),
entriesOut AS ( entriesOut AS (
SELECT 'entry', SELECT 'entry',
@ -95,7 +95,7 @@ BEGIN
AND b.itemFk = vItemFk AND b.itemFk = vItemFk
AND NOT e.isExcludedFromAvailable AND NOT e.isExcludedFromAvailable
AND NOT w.isFeedStock AND NOT w.isFeedStock
AND NOT e.isRaid AND NOT tr.daysInForward
), ),
sales AS ( sales AS (
WITH itemSales AS ( WITH itemSales AS (
@ -147,10 +147,10 @@ BEGIN
NULL NULL
FROM itemSales s FROM itemSales s
LEFT JOIN vn.state stPrep ON stPrep.`code` = 'PREPARED' LEFT JOIN vn.state stPrep ON stPrep.`code` = 'PREPARED'
LEFT JOIN vn.saleTracking stk ON stk.saleFk = s.saleFk LEFT JOIN vn.saleTracking stk ON stk.saleFk = s.saleFk
AND stk.stateFk = stPrep.id AND stk.stateFk = stPrep.id
GROUP BY s.saleFk GROUP BY s.saleFk
), ),
orders AS ( orders AS (
SELECT 'order' originType, SELECT 'order' originType,
o.id originId, o.id originId,
@ -215,9 +215,9 @@ BEGIN
t.`in` invalue, t.`in` invalue,
t.`out`, t.`out`,
@a := @a + IFNULL(t.`in`, 0) - IFNULL(t.`out`, 0) balance, @a := @a + IFNULL(t.`in`, 0) - IFNULL(t.`out`, 0) balance,
@currentLineFk := IF (@shipped < util.VN_CURDATE() @currentLineFk := IF (@shipped < util.VN_CURDATE()
OR (@shipped = util.VN_CURDATE() AND (t.isPicked OR a.`code` >= 'ON_PREPARATION')), OR (@shipped = util.VN_CURDATE() AND (t.isPicked OR a.`code` >= 'ON_PREPARATION')),
t.lineFk, t.lineFk,
@currentLineFk) lastPreparedLineFk, @currentLineFk) lastPreparedLineFk,
t.isTicket, t.isTicket,
t.lineFk, t.lineFk,
@ -254,21 +254,21 @@ BEGIN
UNION ALL UNION ALL
SELECT originType, SELECT originType,
originId, originId,
shipped, shipped,
alertlevel, alertlevel,
stateName, stateName,
reference, reference,
entityType, entityType,
entityId, entityId,
entityName, entityName,
`in`, `in`,
`out`, `out`,
@a := @a + IFNULL(`in`, 0) - IFNULL(`out`, 0), @a := @a + IFNULL(`in`, 0) - IFNULL(`out`, 0),
0, 0,
isTicket, isTicket,
lineFk, lineFk,
isPicked, isPicked,
clientType, clientType,
claimFk, claimFk,
`order` `order`
FROM tItemDiary FROM tItemDiary

View File

@ -63,7 +63,7 @@ BEGIN
AND NOT e.isExcludedFromAvailable AND NOT e.isExcludedFromAvailable
AND b.quantity <> 0 AND b.quantity <> 0
AND (vItemFk IS NULL OR b.itemFk = vItemFk) AND (vItemFk IS NULL OR b.itemFk = vItemFk)
AND NOT e.isRaid AND NOT t.daysInForward
UNION ALL UNION ALL
SELECT r.itemFk, SELECT r.itemFk,
r.shipment, r.shipment,

View File

@ -17,22 +17,22 @@ BEGIN
ALTER TABLE tmp.itemInventory ALTER TABLE tmp.itemInventory
ADD `buy_date` datetime NOT NULL; ADD `buy_date` datetime NOT NULL;
CREATE OR REPLACE TEMPORARY TABLE lastBuyScope CREATE OR REPLACE TEMPORARY TABLE lastBuyScope
SELECT i.id, MAX(t.landed) lastLanded SELECT i.id, MAX(t.landed) lastLanded
FROM item i FROM item i
JOIN buy b ON b.itemFk = i.id JOIN buy b ON b.itemFk = i.id
JOIN entry e ON e.id = b.entryFk JOIN entry e ON e.id = b.entryFk
JOIN travel t ON t.id = e.travelFk JOIN travel t ON t.id = e.travelFk
JOIN supplier s ON s.id = e.supplierFk JOIN supplier s ON s.id = e.supplierFk
JOIN warehouse w ON w.id = t.warehouseInFk JOIN warehouse w ON w.id = t.warehouseInFk
WHERE t.landed BETWEEN (vDated + INTERVAL - vLastBuyScope DAY) AND vDated WHERE t.landed BETWEEN (vDated + INTERVAL - vLastBuyScope DAY) AND vDated
AND NOT s.name = 'INVENTARIO' AND NOT s.name = 'INVENTARIO'
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
AND w.isComparative AND w.isComparative
AND NOT e.isRaid AND NOT t.daysInForward
GROUP BY i.id; GROUP BY i.id;
UPDATE tmp.itemInventory y UPDATE tmp.itemInventory y
JOIN lastBuyScope lbs ON lbs.id = y.id JOIN lastBuyScope lbs ON lbs.id = y.id
SET y.buy_date = lbs.lastLanded; SET y.buy_date = lbs.lastLanded;

View File

@ -25,7 +25,7 @@ BEGIN
LIMIT 1; LIMIT 1;
SET vHasNotInventory = (vInventoried IS NULL); SET vHasNotInventory = (vInventoried IS NULL);
IF vHasNotInventory THEN IF vHasNotInventory THEN
SELECT landed INTO vInventoryClone SELECT landed INTO vInventoryClone
FROM travel tr FROM travel tr
@ -50,7 +50,7 @@ BEGIN
PRIMARY KEY (warehouseInventory, itemFk) USING HASH PRIMARY KEY (warehouseInventory, itemFk) USING HASH
) )
ENGINE = MEMORY; ENGINE = MEMORY;
-- Inventario inicial -- Inventario inicial
IF vHasNotInventory THEN IF vHasNotInventory THEN
INSERT INTO tInventory(warehouseFk, itemFk, quantity, warehouseInventory) INSERT INTO tInventory(warehouseFk, itemFk, quantity, warehouseInventory)
@ -109,7 +109,7 @@ BEGIN
JOIN warehouse w ON w.id = tr.warehouseInFk JOIN warehouse w ON w.id = tr.warehouseInFk
WHERE tr.landed BETWEEN vInventoried AND vDateDayEnd WHERE tr.landed BETWEEN vInventoried AND vDateDayEnd
AND IF(tr.landed = util.VN_CURDATE(), tr.isReceived, TRUE) AND IF(tr.landed = util.VN_CURDATE(), tr.isReceived, TRUE)
AND NOT e.isRaid AND NOT tr.daysInForward
AND w.valuatedInventory AND w.valuatedInventory
AND t.isInventory AND t.isInventory
AND e.supplierFk <> vInventorySupplierFk AND e.supplierFk <> vInventorySupplierFk
@ -131,7 +131,7 @@ BEGIN
JOIN itemCategory ic ON ic.id = t.categoryFk JOIN itemCategory ic ON ic.id = t.categoryFk
JOIN warehouse w ON w.id = tr.warehouseOutFk JOIN warehouse w ON w.id = tr.warehouseOutFk
WHERE tr.shipped BETWEEN vInventoried AND vDateDayEnd WHERE tr.shipped BETWEEN vInventoried AND vDateDayEnd
AND NOT e.isRaid AND NOT tr.daysInForward
AND w.valuatedInventory AND w.valuatedInventory
AND t.isInventory AND t.isInventory
AND (t.id = vItemTypeFk OR vItemTypeFk IS NULL) AND (t.id = vItemTypeFk OR vItemTypeFk IS NULL)
@ -159,7 +159,7 @@ BEGIN
ON DUPLICATE KEY UPDATE tInventory.quantity = tInventory.quantity + s.quantity * IF(vHasNotInventory, 1, -1); ON DUPLICATE KEY UPDATE tInventory.quantity = tInventory.quantity + s.quantity * IF(vHasNotInventory, 1, -1);
-- Volver a poner lo que esta aun en las estanterias -- Volver a poner lo que esta aun en las estanterias
IF vDated = util.VN_CURDATE() THEN IF vDated = util.VN_CURDATE() THEN
INSERT INTO tInventory(warehouseFk, itemFk, quantity, warehouseInventory) INSERT INTO tInventory(warehouseFk, itemFk, quantity, warehouseInventory)
SELECT w.id, SELECT w.id,
s.itemFk, s.itemFk,
@ -196,14 +196,14 @@ BEGIN
JOIN warehouse wIn ON wIn.id = tr.warehouseInFk JOIN warehouse wIn ON wIn.id = tr.warehouseInFk
JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk
WHERE vDated >= tr.shipped AND vDated < tr.landed WHERE vDated >= tr.shipped AND vDated < tr.landed
AND NOT isRaid AND NOT tr.daysInForward
AND wIn.valuatedInventory AND wIn.valuatedInventory
AND t.isInventory AND t.isInventory
AND e.isConfirmed AND e.isConfirmed
AND (t.id = vItemTypeFk OR vItemTypeFk IS NULL) AND (t.id = vItemTypeFk OR vItemTypeFk IS NULL)
AND (ic.id = vItemCategoryFk OR vItemCategoryFk IS NULL) AND (ic.id = vItemCategoryFk OR vItemCategoryFk IS NULL)
ON DUPLICATE KEY UPDATE tInventory.quantity = tInventory.quantity + (b.quantity); ON DUPLICATE KEY UPDATE tInventory.quantity = tInventory.quantity + (b.quantity);
CALL buy_getUltimate (NULL, NULL, vDateDayEnd); CALL buy_getUltimate (NULL, NULL, vDateDayEnd);
DELETE FROM tInventory WHERE quantity IS NULL OR NOT quantity; DELETE FROM tInventory WHERE quantity IS NULL OR NOT quantity;
@ -233,7 +233,7 @@ BEGIN
JOIN warehouse w ON w.id = warehouseFk JOIN warehouse w ON w.id = warehouseFk
JOIN item i ON i.id = ti.itemFk JOIN item i ON i.id = ti.itemFk
JOIN itemType tp ON tp.id = i.typeFk JOIN itemType tp ON tp.id = i.typeFk
JOIN itemCategory ic ON ic.id = tp.categoryFk JOIN itemCategory ic ON ic.id = tp.categoryFk
WHERE w.valuatedInventory WHERE w.valuatedInventory
AND ti.total > 0; AND ti.total > 0;

View File

@ -1,173 +1,173 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`multipleInventory`( CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`multipleInventory`(
vDate DATE, vDate DATE,
vWarehouseFk TINYINT, vWarehouseFk TINYINT,
vMaxDays TINYINT vMaxDays TINYINT
) )
proc: BEGIN proc: BEGIN
DECLARE vDateTomorrow DATE DEFAULT vDate + INTERVAL 1 DAY; DECLARE vDateTomorrow DATE DEFAULT vDate + INTERVAL 1 DAY;
DECLARE vDateFrom DATE DEFAULT vDate; DECLARE vDateFrom DATE DEFAULT vDate;
DECLARE vDateTo DATETIME; DECLARE vDateTo DATETIME;
DECLARE vDateToTomorrow DATETIME; DECLARE vDateToTomorrow DATETIME;
DECLARE vDefaultDayRange INT; DECLARE vDefaultDayRange INT;
DECLARE vCalcFk INT; DECLARE vCalcFk INT;
IF vDate < util.VN_CURDATE() THEN IF vDate < util.VN_CURDATE() THEN
LEAVE proc; LEAVE proc;
END IF; END IF;
IF vDate = util.VN_CURDATE() THEN IF vDate = util.VN_CURDATE() THEN
SELECT inventoried INTO vDateFrom SELECT inventoried INTO vDateFrom
FROM config; FROM config;
END IF; END IF;
SELECT defaultDayRange INTO vDefaultDayRange SELECT defaultDayRange INTO vDefaultDayRange
FROM comparativeConfig; FROM comparativeConfig;
SET vDateTo = vDate + INTERVAL IFNULL(vMaxDays, vDefaultDayRange) DAY; SET vDateTo = vDate + INTERVAL IFNULL(vMaxDays, vDefaultDayRange) DAY;
SET vDateToTomorrow = vDateTo + INTERVAL 1 DAY; SET vDateToTomorrow = vDateTo + INTERVAL 1 DAY;
ALTER TABLE tmp.itemInventory ALTER TABLE tmp.itemInventory
ADD `avalaible` INT NOT NULL, ADD `avalaible` INT NOT NULL,
ADD `sd` INT NOT NULL, ADD `sd` INT NOT NULL,
ADD `rest` INT NOT NULL, ADD `rest` INT NOT NULL,
ADD `expected` INT NOT NULL, ADD `expected` INT NOT NULL,
ADD `inventory` INT NOT NULL, ADD `inventory` INT NOT NULL,
ADD `visible` INT NOT NULL, ADD `visible` INT NOT NULL,
ADD `life` TINYINT NOT NULL DEFAULT '0'; ADD `life` TINYINT NOT NULL DEFAULT '0';
-- Calculo del inventario -- Calculo del inventario
CREATE OR REPLACE TEMPORARY TABLE tItemInventoryCalc CREATE OR REPLACE TEMPORARY TABLE tItemInventoryCalc
(PRIMARY KEY (itemFk)) (PRIMARY KEY (itemFk))
ENGINE = MEMORY ENGINE = MEMORY
SELECT itemFk, SELECT itemFk,
SUM(quantity) quantity SUM(quantity) quantity
FROM ( FROM (
SELECT s.itemFk, - s.quantity quantity SELECT s.itemFk, - s.quantity quantity
FROM sale s FROM sale s
JOIN ticket t ON t.id = s.ticketFk JOIN ticket t ON t.id = s.ticketFk
JOIN warehouse w ON w.id = t.warehouseFk JOIN warehouse w ON w.id = t.warehouseFk
WHERE t.shipped BETWEEN vDateFrom AND util.dayEnd(vDate) WHERE t.shipped BETWEEN vDateFrom AND util.dayEnd(vDate)
AND IFNULL(vWarehouseFk, t.warehouseFk) = t.warehouseFk AND IFNULL(vWarehouseFk, t.warehouseFk) = t.warehouseFk
AND w.isComparative AND w.isComparative
UNION ALL UNION ALL
SELECT b.itemFk, b.quantity SELECT b.itemFk, b.quantity
FROM buy b FROM buy b
JOIN entry e ON e.id = b.entryFk JOIN entry e ON e.id = b.entryFk
JOIN travel t ON t.id = e.travelFk JOIN travel t ON t.id = e.travelFk
JOIN warehouse w ON w.id = t.warehouseInFk JOIN warehouse w ON w.id = t.warehouseInFk
WHERE t.landed BETWEEN vDateFrom AND util.dayEnd(vDate) WHERE t.landed BETWEEN vDateFrom AND util.dayEnd(vDate)
AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk
AND w.isComparative AND w.isComparative
AND NOT e.isExcludedFromAvailable AND NOT e.isExcludedFromAvailable
AND NOT e.isRaid AND NOT t.daysInForward
UNION ALL UNION ALL
SELECT b.itemFk, - b.quantity SELECT b.itemFk, - b.quantity
FROM buy b FROM buy b
JOIN entry e ON e.id = b.entryFk JOIN entry e ON e.id = b.entryFk
JOIN travel t ON t.id = e.travelFk JOIN travel t ON t.id = e.travelFk
JOIN warehouse w ON w.id = t.warehouseOutFk JOIN warehouse w ON w.id = t.warehouseOutFk
WHERE t.shipped BETWEEN vDateFrom AND util.dayEnd(vDate) WHERE t.shipped BETWEEN vDateFrom AND util.dayEnd(vDate)
AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
AND w.isComparative AND w.isComparative
AND NOT e.isExcludedFromAvailable AND NOT e.isExcludedFromAvailable
AND NOT e.isRaid AND NOT t.daysInForward
) sub ) sub
GROUP BY itemFk; GROUP BY itemFk;
-- Cálculo del visible -- Cálculo del visible
CALL cache.visible_refresh(vCalcFk, FALSE, vWarehouseFk); CALL cache.visible_refresh(vCalcFk, FALSE, vWarehouseFk);
CREATE OR REPLACE TEMPORARY TABLE tItemVisibleCalc CREATE OR REPLACE TEMPORARY TABLE tItemVisibleCalc
(PRIMARY KEY (item_id)) (PRIMARY KEY (item_id))
ENGINE = MEMORY ENGINE = MEMORY
SELECT item_id, visible SELECT item_id, visible
FROM cache.visible FROM cache.visible
WHERE calc_id = vCalcFk; WHERE calc_id = vCalcFk;
UPDATE tmp.itemInventory it UPDATE tmp.itemInventory it
LEFT JOIN tItemInventoryCalc iic ON iic.itemFk = it.id LEFT JOIN tItemInventoryCalc iic ON iic.itemFk = it.id
LEFT JOIN tItemVisibleCalc ivc ON ivc.item_id = it.id LEFT JOIN tItemVisibleCalc ivc ON ivc.item_id = it.id
SET it.inventory = iic.quantity, SET it.inventory = iic.quantity,
it.visible = ivc.visible, it.visible = ivc.visible,
it.avalaible = iic.quantity, it.avalaible = iic.quantity,
it.sd = iic.quantity; it.sd = iic.quantity;
-- Calculo del disponible -- Calculo del disponible
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
(INDEX (itemFk, warehouseFk)) (INDEX (itemFk, warehouseFk))
ENGINE = MEMORY ENGINE = MEMORY
SELECT sub.itemFk, SELECT sub.itemFk,
vWarehouseFk warehouseFk, vWarehouseFk warehouseFk,
sub.dated, sub.dated,
SUM(sub.quantity) quantity SUM(sub.quantity) quantity
FROM ( FROM (
SELECT s.itemFk, SELECT s.itemFk,
DATE(t.shipped) dated, DATE(t.shipped) dated,
- s.quantity quantity - s.quantity quantity
FROM sale s FROM sale s
JOIN ticket t ON t.id = s.ticketFk JOIN ticket t ON t.id = s.ticketFk
JOIN warehouse w ON w.id = t.warehouseFk JOIN warehouse w ON w.id = t.warehouseFk
WHERE t.shipped BETWEEN vDateTomorrow AND vDateTo WHERE t.shipped BETWEEN vDateTomorrow AND vDateTo
AND IFNULL(vWarehouseFk, t.warehouseFk) = t.warehouseFk AND IFNULL(vWarehouseFk, t.warehouseFk) = t.warehouseFk
AND w.isComparative AND w.isComparative
UNION ALL UNION ALL
SELECT b.itemFk, t.landed, b.quantity SELECT b.itemFk, t.landed, b.quantity
FROM buy b FROM buy b
JOIN entry e ON e.id = b.entryFk JOIN entry e ON e.id = b.entryFk
JOIN travel t ON t.id = e.travelFk JOIN travel t ON t.id = e.travelFk
JOIN warehouse w ON w.id = t.warehouseInFk JOIN warehouse w ON w.id = t.warehouseInFk
WHERE t.landed BETWEEN vDateTomorrow AND vDateTo WHERE t.landed BETWEEN vDateTomorrow AND vDateTo
AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk
AND w.isComparative AND w.isComparative
AND NOT e.isExcludedFromAvailable AND NOT e.isExcludedFromAvailable
AND NOT e.isRaid AND NOT t.daysInForward
UNION ALL UNION ALL
SELECT b.itemFk, t.shipped, - b.quantity SELECT b.itemFk, t.shipped, - b.quantity
FROM buy b FROM buy b
JOIN entry e ON e.id = b.entryFk JOIN entry e ON e.id = b.entryFk
JOIN travel t ON t.id = e.travelFk JOIN travel t ON t.id = e.travelFk
JOIN warehouse w ON w.id = t.warehouseOutFk JOIN warehouse w ON w.id = t.warehouseOutFk
WHERE t.shipped BETWEEN vDateTomorrow AND vDateTo WHERE t.shipped BETWEEN vDateTomorrow AND vDateTo
AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
AND w.isComparative AND w.isComparative
AND NOT e.isExcludedFromAvailable AND NOT e.isExcludedFromAvailable
AND NOT e.isRaid AND NOT t.daysInForward
) sub ) sub
GROUP BY sub.itemFk, sub.dated; GROUP BY sub.itemFk, sub.dated;
CALL item_getAtp(vDate); CALL item_getAtp(vDate);
CALL travel_upcomingArrivals(vWarehouseFk, vDate); CALL travel_upcomingArrivals(vWarehouseFk, vDate);
CREATE OR REPLACE TEMPORARY TABLE tItemAvailableCalc CREATE OR REPLACE TEMPORARY TABLE tItemAvailableCalc
(PRIMARY KEY (itemFk)) (PRIMARY KEY (itemFk))
ENGINE = MEMORY ENGINE = MEMORY
SELECT it.itemFk, SELECT it.itemFk,
SUM(it.quantity) quantity, SUM(it.quantity) quantity,
im.quantity minQuantity im.quantity minQuantity
FROM tmp.itemCalc it FROM tmp.itemCalc it
JOIN tmp.itemAtp im ON im.itemFk = it.itemFk JOIN tmp.itemAtp im ON im.itemFk = it.itemFk
JOIN item i ON i.id = it.itemFk JOIN item i ON i.id = it.itemFk
LEFT JOIN origin o ON o.id = i.originFk LEFT JOIN origin o ON o.id = i.originFk
LEFT JOIN tmp.itemTravel t ON t.wh = o.warehouseFk LEFT JOIN tmp.itemTravel t ON t.wh = o.warehouseFk
WHERE it.dated < IF(vMaxDays < 0 AND t.landing IS NOT NULL, WHERE it.dated < IF(vMaxDays < 0 AND t.landing IS NOT NULL,
t.landing, t.landing,
vDateToTomorrow) vDateToTomorrow)
GROUP BY it.itemFk; GROUP BY it.itemFk;
UPDATE tmp.itemInventory it UPDATE tmp.itemInventory it
JOIN tItemAvailableCalc iac ON iac.itemFk = it.id JOIN tItemAvailableCalc iac ON iac.itemFk = it.id
SET it.avalaible = IF(iac.minQuantity > 0, SET it.avalaible = IF(iac.minQuantity > 0,
it.avalaible, it.avalaible,
it.avalaible + iac.minQuantity), it.avalaible + iac.minQuantity),
it.sd = it.inventory + iac.quantity; it.sd = it.inventory + iac.quantity;
DROP TEMPORARY TABLE DROP TEMPORARY TABLE
tmp.itemTravel, tmp.itemTravel,
tmp.itemCalc, tmp.itemCalc,
tmp.itemAtp, tmp.itemAtp,
tItemInventoryCalc, tItemInventoryCalc,
tItemVisibleCalc, tItemVisibleCalc,
tItemAvailableCalc; tItemAvailableCalc;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -1,31 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`raidUpdate`()
BEGIN
/**
* Actualiza el travel de las entradas de redadas
*/
UPDATE entry e
JOIN entryVirtual ev ON ev.entryFk = e.id
JOIN travel t ON t.id = e.travelFk
JOIN (
SELECT *
FROM (
SELECT t.id, t.landed, tt.warehouseInFk, tt.warehouseOutFk
FROM travel t
JOIN (
SELECT t.warehouseInFk, t.warehouseOutFk
FROM entryVirtual ev
JOIN entry e ON e.id = ev.entryFk
JOIN travel t ON t.id = e.travelFk
GROUP BY t.warehouseInFk, t.warehouseOutFk
) tt ON t.warehouseInFk = tt.warehouseInFk AND t.warehouseOutFk = tt.warehouseOutFk
WHERE shipped > util.VN_CURDATE() AND NOT isDelivered
ORDER BY t.landed
LIMIT 10000000000000000000
) t
GROUP BY t.warehouseInFk, t.warehouseOutFk
) tt ON t.warehouseInFk = tt.warehouseInFk AND t.warehouseOutFk = tt.warehouseOutFk
SET e.travelFk = t.id;
END$$
DELIMITER ;

View File

@ -10,7 +10,7 @@ BEGIN
JOIN vn.entry e ON e.travelFk = tr.id JOIN vn.entry e ON e.travelFk = tr.id
JOIN vn.buy b ON b.entryFk = e.id JOIN vn.buy b ON b.entryFk = e.id
WHERE tr.landed BETWEEN vFromDated AND vToDated WHERE tr.landed BETWEEN vFromDated AND vToDated
AND e.isRaid = FALSE AND NOT tr.daysInForward
AND tr.warehouseInFk = vWarehouseFk AND tr.warehouseInFk = vWarehouseFk
GROUP BY tr.landed , a.name ; GROUP BY tr.landed , a.name ;
END$$ END$$

View File

@ -62,7 +62,7 @@ BEGIN
END IF; END IF;
CALL entry_cloneHeader(vAuxEntryFk, vNewEntryFk, vNewTravelFk); CALL entry_cloneHeader(vAuxEntryFk, vNewEntryFk, vNewTravelFk);
CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk); CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk);
SELECT evaNotes INTO vEvaNotes SELECT evaNotes INTO vEvaNotes
FROM entry FROM entry
@ -71,6 +71,8 @@ BEGIN
UPDATE entry UPDATE entry
SET evaNotes = vEvaNotes SET evaNotes = vEvaNotes
WHERE id = vNewEntryFk; WHERE id = vNewEntryFk;
CALL buy_recalcPricesByEntry(vNewEntryFk);
END LOOP; END LOOP;
SET @isModeInventory = FALSE; SET @isModeInventory = FALSE;

View File

@ -1,72 +1,68 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_moveRaids`() CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_moveRaids`()
BEGIN BEGIN
/**
/* * Desplaza los travels en el futuro y avisa a los compradores
* Desplaza al dia siguiente los travels que contengan redadas y avisa a los compradores
* *
*/ */
DECLARE vDone BOOL DEFAULT FALSE; DECLARE vDone BOOL DEFAULT FALSE;
DECLARE vWorkerName VARCHAR(50); DECLARE vBuyerEmail VARCHAR(40);
DECLARE vRaid TEXT; DECLARE vTravelLink TEXT;
DECLARE vWorker VARCHAR(50) DEFAULT '';
DECLARE vMailBody TEXT DEFAULT ''; DECLARE vMailBody TEXT DEFAULT '';
DECLARE vCur CURSOR FOR DECLARE vCur CURSOR FOR
SELECT GROUP_CONCAT( DISTINCT CONCAT('https://salix.verdnatura.es/#!/travel/', ttr.id, '/summary ') ORDER BY ttr.id SEPARATOR '\n\r'), SELECT GROUP_CONCAT(DISTINCT
u.name CONCAT('https://salix.verdnatura.es/#!/travel/',
FROM tmp.travel ttr ttm.travelFk,
JOIN entry e ON e.travelFk = ttr.id '/summary ')
ORDER BY ttm.travelFk SEPARATOR '\n\r') travelLink,
CONCAT(u.name, '@verdnatura.es') buyerEmail
FROM tTravelToMove ttm
JOIN entry e ON e.travelFk = ttm.travelFk
JOIN buy b ON b.entryFk = e.id JOIN buy b ON b.entryFk = e.id
JOIN item i ON i.id = b.itemFk JOIN item i ON i.id = b.itemFk
JOIN itemType it ON it.id = i.typeFk JOIN itemType it ON it.id = i.typeFk
JOIN account.user u ON u.id = it.workerFk JOIN account.user u ON u.id = it.workerFk
GROUP BY u.name; GROUP BY u.name;
DECLARE CONTINUE HANDLER FOR NOT FOUND DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
SET vDone = TRUE;
DECLARE EXIT HANDLER FOR SQLEXCEPTION DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN BEGIN
ROLLBACK; ROLLBACK;
RESIGNAL; RESIGNAL;
END; END;
DROP TEMPORARY TABLE IF EXISTS tmp.travel; CREATE OR REPLACE TEMPORARY TABLE tTravelToMove
CREATE TEMPORARY TABLE tmp.travel SELECT id travelFk,
SELECT tr.id,tr.landed util.VN_CURDATE() + INTERVAL daysInForward DAY newLanded
FROM travel tr FROM travel
JOIN entry e ON e.travelFk = tr.id WHERE daysInForward;
WHERE tr.landed = util.tomorrow()
AND e.isRaid
GROUP BY tr.id;
START TRANSACTION; START TRANSACTION;
UPDATE travel tr UPDATE travel tr
JOIN tmp.travel ttr ON ttr.id = tr.id JOIN tTravelToMove ttm ON ttm.travelFk = tr.id
SET tr.landed = TIMESTAMPADD(DAY, 1, tr.landed); SET tr.landed = ttm.newLanded;
OPEN vCur; OPEN vCur;
l: LOOP l: LOOP
SET vDone = FALSE; SET vDone = FALSE;
FETCH vCur INTO vRaid, vWorkerName; FETCH vCur INTO vTravelLink, vBuyerEmail;
IF vDone THEN IF vDone THEN
LEAVE l; LEAVE l;
END IF; END IF;
CALL `vn`.`mail_insert`(CONCAT(vWorkerName, '@verdnatura.es'), CALL `vn`.`mail_insert`(
'noreply@verdnatura.es', vBuyerEmail,
'Cambio de fecha en Redadas', 'noreply@verdnatura.es',
CONCAT('Se ha movido las siguientes redadas: \n\r ', vRaid) 'Cambio de fecha en Redadas',
); CONCAT('Se ha movido los siguientes travels: \n\r ', vTravelLink));
END LOOP; END LOOP;
CLOSE vCur; CLOSE vCur;
COMMIT; COMMIT;
DROP TEMPORARY TABLE tmp.travel; DROP TEMPORARY TABLE tTravelToMove;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`entry_beforeUpdate`
BEFORE UPDATE ON `entry` BEFORE UPDATE ON `entry`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
DECLARE vIsVirtual BOOL; DECLARE vDaysInForward INT;
DECLARE vPrintedCount INT; DECLARE vPrintedCount INT;
DECLARE vHasDistinctWarehouses BOOL; DECLARE vHasDistinctWarehouses BOOL;
DECLARE vTotalBuy INT; DECLARE vTotalBuy INT;
@ -37,18 +37,20 @@ BEGIN
IF NEW.travelFk IS NOT NULL THEN IF NEW.travelFk IS NOT NULL THEN
CALL travel_throwAwb(NEW.travelFk); CALL travel_throwAwb(NEW.travelFk);
END IF; END IF;
SELECT COUNT(*) > 0 INTO vIsVirtual SELECT daysInForward INTO vDaysInForward
FROM entryVirtual WHERE entryFk = NEW.id; FROM travel t
JOIN entry e ON e.travelFk = t.id
WHERE entryFk = NEW.id;
SELECT NOT (o.warehouseInFk <=> n.warehouseInFk) SELECT NOT (o.warehouseInFk <=> n.warehouseInFk)
OR NOT (o.warehouseOutFk <=> n.warehouseOutFk) OR NOT (o.warehouseOutFk <=> n.warehouseOutFk)
INTO vHasDistinctWarehouses INTO vHasDistinctWarehouses
FROM travel o, travel n FROM travel o, travel n
WHERE o.id = OLD.travelFk WHERE o.id = OLD.travelFk
AND n.id = NEW.travelFk; AND n.id = NEW.travelFk;
IF vIsVirtual AND vHasDistinctWarehouses THEN IF vDaysInForward AND vHasDistinctWarehouses THEN
SIGNAL SQLSTATE '45000' SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'A cloned entry cannot be moved to a travel with different warehouses'; SET MESSAGE_TEXT = 'A cloned entry cannot be moved to a travel with different warehouses';
END IF; END IF;
@ -71,7 +73,7 @@ BEGIN
SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk); SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk);
END IF; END IF;
IF NOT (NEW.travelFk <=> OLD.travelFk) IF NOT (NEW.travelFk <=> OLD.travelFk)
OR NOT (NEW.currencyFk <=> OLD.currencyFk) OR NOT (NEW.currencyFk <=> OLD.currencyFk)
OR NOT (NEW.supplierFk <=> OLD.supplierFk) THEN OR NOT (NEW.supplierFk <=> OLD.supplierFk) THEN

View File

@ -8,5 +8,7 @@ BEGIN
`changedModel` = 'Expedition', `changedModel` = 'Expedition',
`changedModelId` = OLD.id, `changedModelId` = OLD.id,
`userFk` = account.myUser_getId(); `userFk` = account.myUser_getId();
CALL expedition_selfConsumptionPackaging(OLD.id, 'remove');
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -0,0 +1,12 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemType_afterDelete`
AFTER DELETE ON `itemType`
FOR EACH ROW
BEGIN
INSERT INTO itemTypeLog
SET `action` = 'delete',
`changedModel` = 'ItemType',
`changedModelId` = OLD.id,
`userFk` = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemType_beforeInsert`
BEFORE INSERT ON `itemType`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -3,6 +3,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemType_beforeUpdate`
BEFORE UPDATE ON `itemType` BEFORE UPDATE ON `itemType`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
SET NEW.editorFk = account.myUser_getId();
IF NEW.itemPackingTypeFk = '' THEN IF NEW.itemPackingTypeFk = '' THEN
SET NEW.itemPackingTypeFk = NULL; SET NEW.itemPackingTypeFk = NULL;

View File

@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`productionConfig_afterD
AFTER DELETE ON `productionConfig` AFTER DELETE ON `productionConfig`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
INSERT INTO productionConfig INSERT INTO productionConfigLog
SET `action` = 'delete', SET `action` = 'delete',
`changedModel` = 'ProductionConfig', `changedModel` = 'ProductionConfig',
`changedModelId` = OLD.id, `changedModelId` = OLD.id,

View File

@ -6,7 +6,7 @@ AS SELECT `t`.`warehouseInFk` AS `warehouseInFk`,
`b`.`itemFk` AS `itemFk`, `b`.`itemFk` AS `itemFk`,
`b`.`quantity` AS `quantity`, `b`.`quantity` AS `quantity`,
`t`.`isReceived` AS `isReceived`, `t`.`isReceived` AS `isReceived`,
`e`.`isRaid` AS `isVirtualStock`, `t`.`daysInForward` AS `isVirtualStock`,
`e`.`id` AS `entryFk` `e`.`id` AS `entryFk`
FROM ( FROM (
( (

View File

@ -15,5 +15,5 @@ FROM (
JOIN `vn`.`travel` `t` ON(`e`.`travelFk` = `t`.`id`) JOIN `vn`.`travel` `t` ON(`e`.`travelFk` = `t`.`id`)
) )
WHERE `e`.`isExcludedFromAvailable` = 0 WHERE `e`.`isExcludedFromAvailable` = 0
AND `e`.`isRaid` = 0 AND NOT `t`.`daysInForward`
AND `b`.`quantity` <> 0 AND `b`.`quantity` <> 0

View File

@ -31,5 +31,5 @@ FROM (
LEFT JOIN `edi`.`ekt` `ek` ON(`ek`.`id` = `b`.`ektFk`) LEFT JOIN `edi`.`ekt` `ek` ON(`ek`.`id` = `b`.`ektFk`)
) )
WHERE `tr`.`landed` BETWEEN `util`.`yesterday`() AND `util`.`tomorrow`() WHERE `tr`.`landed` BETWEEN `util`.`yesterday`() AND `util`.`tomorrow`()
AND `e`.`isRaid` = 0 AND NOT `tr`.`daysInForward`
AND `b`.`stickers` > 0 AND `b`.`stickers` > 0

View File

@ -8,7 +8,6 @@ AS SELECT `e`.`id` AS `Id_Entrada`,
`e`.`isExcludedFromAvailable` AS `Inventario`, `e`.`isExcludedFromAvailable` AS `Inventario`,
`e`.`isConfirmed` AS `Confirmada`, `e`.`isConfirmed` AS `Confirmada`,
`e`.`isOrdered` AS `Pedida`, `e`.`isOrdered` AS `Pedida`,
`e`.`isRaid` AS `Redada`,
`e`.`commission` AS `comision`, `e`.`commission` AS `comision`,
`e`.`created` AS `odbc_date`, `e`.`created` AS `odbc_date`,
`e`.`evaNotes` AS `Notas_Eva`, `e`.`evaNotes` AS `Notas_Eva`,

View File

@ -1,5 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`Entradas_Auto`
AS SELECT `ev`.`entryFk` AS `Id_Entrada`
FROM `vn`.`entryVirtual` `ev`

View File

@ -8,7 +8,7 @@ AS SELECT `e`.`gestDocFk` AS `gestdoc_id`,
`e`.`isExcludedFromAvailable` AS `Inventario`, `e`.`isExcludedFromAvailable` AS `Inventario`,
`e`.`isConfirmed` AS `Confirmada`, `e`.`isConfirmed` AS `Confirmada`,
`e`.`isOrdered` AS `Pedida`, `e`.`isOrdered` AS `Pedida`,
`e`.`isRaid` AS `Redada`, `tr`.`daysInForward` AS `daysInForward`,
`e`.`evaNotes` AS `notas`, `e`.`evaNotes` AS `notas`,
`e`.`supplierFk` AS `Id_Proveedor`, `e`.`supplierFk` AS `Id_Proveedor`,
`tr`.`shipped` AS `shipment`, `tr`.`shipped` AS `shipment`,

View File

@ -17,5 +17,6 @@ AS SELECT `t`.`id` AS `id`,
`t`.`cargoSupplierFk` AS `cargoSupplierFk`, `t`.`cargoSupplierFk` AS `cargoSupplierFk`,
`t`.`totalEntries` AS `totalEntries`, `t`.`totalEntries` AS `totalEntries`,
`t`.`appointment` AS `appointment`, `t`.`appointment` AS `appointment`,
`t`.`awbFk` AS `awbFk` `t`.`awbFk` AS `awbFk`,
`t`.`daysInForward` AS `daysInForward`
FROM `vn`.`travel` `t` FROM `vn`.`travel` `t`

View File

@ -28,7 +28,6 @@ AS SELECT `TP`.`Id_Tipo` AS `Familia`,
`E`.`Id_Proveedor` AS `Id_Proveedor`, `E`.`Id_Proveedor` AS `Id_Proveedor`,
`E`.`Fecha` AS `Fecha`, `E`.`Fecha` AS `Fecha`,
`E`.`Confirmada` AS `Confirmada`, `E`.`Confirmada` AS `Confirmada`,
`E`.`Redada` AS `Redada`,
`E`.`empresa_id` AS `empresa_id`, `E`.`empresa_id` AS `empresa_id`,
`E`.`travel_id` AS `travel_id`, `E`.`travel_id` AS `travel_id`,
`E`.`Pedida` AS `Pedida`, `E`.`Pedida` AS `Pedida`,
@ -85,6 +84,6 @@ FROM (
) )
JOIN `vn2008`.`Cubos` `cb` ON(`cb`.`Id_Cubo` = `C`.`Id_Cubo`) JOIN `vn2008`.`Cubos` `cb` ON(`cb`.`Id_Cubo` = `C`.`Id_Cubo`)
) )
WHERE `W_IN`.`isFeedStock` = 0 WHERE NOT `W_IN`.`isFeedStock`
AND `E`.`Inventario` = 0 AND NOT `E`.`Inventario`
AND `E`.`Redada` = 0 AND NOT `TR`.`daysInForward`

View File

@ -1 +0,0 @@
ALTER TABLE vn.autonomy MODIFY COLUMN isUeeMember tinyint(1) DEFAULT FALSE NOT NULL;

View File

@ -0,0 +1,27 @@
ALTER TABLE vn.itemType
ADD editorFk int(10) unsigned DEFAULT NULL NULL,
ADD CONSTRAINT itemType_user_FK FOREIGN KEY (editorFk) REFERENCES account.`user`(id);
CREATE TABLE `vn`.`itemTypeLog` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`originFk` int(11) DEFAULT NULL,
`userFk` int(10) unsigned DEFAULT NULL,
`action` set('insert','update','delete') NOT NULL,
`creationDate` timestamp NULL DEFAULT current_timestamp(),
`description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`changedModel` enum('ItemType') NOT NULL DEFAULT 'ItemType',
`oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)),
`newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)),
`changedModelId` int(11) NOT NULL,
`changedModelValue` varchar(45) DEFAULT NULL,
`summaryId` varchar(30) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `itemTypeLogUserFk_idx` (`userFk`),
KEY `itemTypeLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
KEY `itemTypeLog_originFk` (`originFk`,`creationDate`),
KEY `itemTypeLog_creationDate_IDX` (`creationDate` DESC) USING BTREE,
CONSTRAINT `itemTypeLogUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1;
INSERT IGNORE INTO salix.ACL (model,property,principalId)
VALUES ('ItemTypeLog','find','employee');

View File

@ -0,0 +1,3 @@
ALTER TABLE vn.itemType
ADD CONSTRAINT itemType_itemPackingType_FK FOREIGN KEY (itemPackingTypeFk)
REFERENCES vn.itemPackingType(code) ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -0,0 +1,7 @@
ALTER TABLE vn.travel ADD IF NOT EXISTS daysInForward INT UNSIGNED DEFAULT 0 NOT NULL
COMMENT 'Indica que sus entradas son redadas: 0 significa que no es un travel de redadas, y un valor distinto a 0 indica el número de días para el landed respecto a hoy';
ALTER TABLE vn.entry CHANGE isRaid isRaid_ tinyint(1) DEFAULT 0 NOT NULL COMMENT '@deprecated 2024-11-05';
RENAME TABLE vn.entryVirtual TO vn.entryVirtual__;
ALTER TABLE vn.entryVirtual__ COMMENT='@deprecated 2024-11-05';

View File

@ -0,0 +1,3 @@
USE vn;
ALTER TABLE vn.expeditionState ADD scanOrder int(11) DEFAULT NULL NULL COMMENT 'Indica la posición al cargar la furgoneta';

View File

@ -0,0 +1,7 @@
UPDATE salix.ACL
SET property='buyLabelSupplier'
WHERE property = 'buyLabel'
AND model = 'Entry';
INSERT IGNORE INTO salix.ACL (model,property,principalId)
VALUES ('Entry','buyLabel','employee');

View File

@ -0,0 +1,7 @@
DELETE FROM vn.report
WHERE `name` = 'LabelItemQr';
UPDATE vn.report
SET `method` = 'Entries/{id}/{labelType}/buy-label',
`name` = 'LabelBuy'
WHERE `name` = 'LabelItemBarcode';

View File

@ -240,6 +240,10 @@
"There is already a tray with the same height": "There is already a tray with the same height", "There is already a tray with the same height": "There is already a tray with the same height",
"The height must be greater than 50cm": "The height must be greater than 50cm", "The height must be greater than 50cm": "The height must be greater than 50cm",
"The maximum height of the wagon is 200cm": "The maximum height of the wagon is 200cm", "The maximum height of the wagon is 200cm": "The maximum height of the wagon is 200cm",
"The quantity claimed cannot be greater than the quantity of the line": "The quantity claimed cannot be greater than the quantity of the line", "The quantity claimed cannot be greater than the quantity of the line": "The quantity claimed cannot be greater than the quantity of the line",
"There are tickets for this area, delete them first": "There are tickets for this area, delete them first" "There are tickets for this area, delete them first": "There are tickets for this area, delete them first",
} "ticketLostExpedition": "The ticket [{{ticketId}}]({{{ticketUrl}}}) has the following lost expedition:{{ expeditionId }}",
"null": "null",
"Invalid or expired verification code": "Invalid or expired verification code",
"Payment method is required": "Payment method is required"
}

View File

@ -385,5 +385,7 @@
"The quantity claimed cannot be greater than the quantity of the line": "La cantidad reclamada no puede ser mayor que la cantidad de la línea", "The quantity claimed cannot be greater than the quantity of the line": "La cantidad reclamada no puede ser mayor que la cantidad de la línea",
"type cannot be blank": "Se debe rellenar el tipo", "type cannot be blank": "Se debe rellenar el tipo",
"There are tickets for this area, delete them first": "Hay tickets para esta sección, borralos primero", "There are tickets for this area, delete them first": "Hay tickets para esta sección, borralos primero",
"There is no company associated with that warehouse": "No hay ninguna empresa asociada a ese almacén" "There is no company associated with that warehouse": "No hay ninguna empresa asociada a ese almacén",
"ticketLostExpedition": "El ticket [{{ticketId}}]({{{ticketUrl}}}) tiene la siguiente expedición perdida:{{ expeditionId }}",
"The web user's email already exists": "El correo del usuario web ya existe"
} }

View File

@ -123,8 +123,8 @@
"Added sale to ticket": "J'ai ajouté la ligne suivante au ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}", "Added sale to ticket": "J'ai ajouté la ligne suivante au ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}",
"Changed sale discount": "J'ai changé le rabais des lignes suivantes du ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", "Changed sale discount": "J'ai changé le rabais des lignes suivantes du ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
"Created claim": "J'ai créé la réclamation [{{claimId}}]({{{claimUrl}}}) des lignes suivantes du ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", "Created claim": "J'ai créé la réclamation [{{claimId}}]({{{claimUrl}}}) des lignes suivantes du ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
"Changed sale price": " le prix de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* du ticket [{{ticketId}}]({{{ticketUrl}}})",, "Changed sale price": " le prix de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* du ticket [{{ticketId}}]({{{ticketUrl}}})",
"Changed sale quantity": "J'ai changé {{changes}} du ticket [{{ticketId}}]({{{ticketUrl}}})", "Changed sale quantity": "J'ai changé {{changes}} du ticket [{{ticketId}}]({{{ticketUrl}}})",
"Changes in sales": "la quantité de {{itemId}} {{concept}} de {{oldQuantity}} ➔ {{newQuantity}}", "Changes in sales": "la quantité de {{itemId}} {{concept}} de {{oldQuantity}} ➔ {{newQuantity}}",
"State": "État", "State": "État",
"regular": "normal", "regular": "normal",
@ -362,6 +362,8 @@
"The invoices have been created but the PDFs could not be generated": "La facture a été émise mais le PDF n'a pas pu être généré", "The invoices have been created but the PDFs could not be generated": "La facture a été émise mais le PDF n'a pas pu être généré",
"It has been invoiced but the PDF of refund not be generated": "Il a été facturé mais le PDF de remboursement n'a pas été généré", "It has been invoiced but the PDF of refund not be generated": "Il a été facturé mais le PDF de remboursement n'a pas été généré",
"Cannot send mail": "Impossible d'envoyer le mail", "Cannot send mail": "Impossible d'envoyer le mail",
"Original invoice not found": "Facture originale introuvable", "Original invoice not found": "Facture originale introuvable",
"The quantity claimed cannot be greater than the quantity of the line": "Le montant réclamé ne peut pas être supérieur au montant de la ligne" "The quantity claimed cannot be greater than the quantity of the line": "Le montant réclamé ne peut pas être supérieur au montant de la ligne",
} "ticketLostExpedition": "Le ticket [{{ticketId}}]({{{ticketUrl}}}) a l'expédition perdue suivante : {{expeditionId}}",
"The web user's email already exists": "L'email de l'internaute existe déjà"
}

View File

@ -124,7 +124,7 @@
"Changed sale discount": "Desconto da venda alterado no ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", "Changed sale discount": "Desconto da venda alterado no ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
"Created claim": "Reclamação criada [{{claimId}}]({{{claimUrl}}}) no ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", "Created claim": "Reclamação criada [{{claimId}}]({{{claimUrl}}}) no ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
"Changed sale price": "Preço da venda alterado para [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* no ticket [{{ticketId}}]({{{ticketUrl}}})", "Changed sale price": "Preço da venda alterado para [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* no ticket [{{ticketId}}]({{{ticketUrl}}})",
"Changed sale quantity": "Quantidade da venda alterada para {{changes}} no ticket [{{ticketId}}]({{{ticketUrl}}})", "Changed sale quantity": "Quantidade da venda alterada para {{changes}} no ticket [{{ticketId}}]({{{ticketUrl}}})",
"Changes in sales": " [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}* ", "Changes in sales": " [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}* ",
"State": "Estado", "State": "Estado",
"regular": "normal", "regular": "normal",
@ -361,7 +361,9 @@
"It was not able to create the invoice": "Não foi possível criar a fatura", "It was not able to create the invoice": "Não foi possível criar a fatura",
"The invoices have been created but the PDFs could not be generated": "Foi faturado, mas o PDF não pôde ser gerado", "The invoices have been created but the PDFs could not be generated": "Foi faturado, mas o PDF não pôde ser gerado",
"It has been invoiced but the PDF of refund not be generated": "Foi faturado mas não foi gerado o PDF do reembolso", "It has been invoiced but the PDF of refund not be generated": "Foi faturado mas não foi gerado o PDF do reembolso",
"Original invoice not found": "Fatura original não encontrada", "Original invoice not found": "Fatura original não encontrada",
"Cannot send mail": "Não é possível enviar o email", "Cannot send mail": "Não é possível enviar o email",
"The quantity claimed cannot be greater than the quantity of the line": "O valor reclamado não pode ser superior ao valor da linha" "The quantity claimed cannot be greater than the quantity of the line": "O valor reclamado não pode ser superior ao valor da linha",
} "ticketLostExpedition": "O ticket [{{ticketId}}]({{{ticketUrl}}}) tem a seguinte expedição perdida: {{expeditionId}}",
"The web user's email already exists": "O e-mail do utilizador da web já existe."
}

View File

@ -1,3 +1,4 @@
/* eslint max-len: ["error", { "code": 150 }]*/
const UserError = require('vn-loopback/util/user-error'); const UserError = require('vn-loopback/util/user-error');
module.exports = function(Self) { module.exports = function(Self) {
@ -98,6 +99,8 @@ module.exports = function(Self) {
return client; return client;
} catch (e) { } catch (e) {
if (tx) await tx.rollback(); if (tx) await tx.rollback();
if (e.message && e.message.includes(`Email already exists`)) throw new UserError(`The web user's email already exists`);
throw e; throw e;
} }
}; };

View File

@ -9,7 +9,6 @@ columns:
notes: notes notes: notes
isConfirmed: confirmed isConfirmed: confirmed
isVirtual: virtual isVirtual: virtual
isRaid: raid
commission: commission commission: commission
isOrdered: price3 isOrdered: price3
created: created created: created

View File

@ -9,7 +9,6 @@ columns:
notes: notas notes: notas
isConfirmed: confirmado isConfirmed: confirmado
isVirtual: virtual isVirtual: virtual
isRaid: redada
commission: comisión commission: comisión
isOrdered: pedida isOrdered: pedida
created: creado created: creado

View File

@ -1,14 +1,28 @@
module.exports = Self => { module.exports = Self => {
Self.remoteMethodCtx('buyLabel', { Self.remoteMethodCtx('buyLabel', {
description: 'Returns the entry buy labels', description: 'Returns the buy label',
accessType: 'READ', accessType: 'READ',
accepts: [ accepts: [
{ {
arg: 'id', arg: 'id',
type: 'number', type: 'number',
required: true, required: true,
description: 'The entry id', description: 'The buy id',
http: {source: 'path'} http: {source: 'path'}
}, {
arg: 'labelType',
type: 'string',
required: true,
description: 'The label type',
http: {source: 'path'}
}, {
arg: 'packing',
type: 'number',
required: false
}, {
arg: 'copies',
type: 'number',
required: false
} }
], ],
returns: [ returns: [
@ -27,11 +41,16 @@ module.exports = Self => {
} }
], ],
http: { http: {
path: '/:id/buy-label', path: '/:id/:labelType/buy-label',
verb: 'GET' verb: 'GET'
}, },
accessScopes: ['DEFAULT', 'read:multimedia'] accessScopes: ['DEFAULT', 'read:multimedia']
}); });
Self.buyLabel = (ctx, id) => Self.printReport(ctx, id, 'buy-label'); Self.buyLabel = (ctx, id, labelType) => {
if (labelType == 'qr')
return Self.printReport(ctx, id, 'buy-label-qr');
else
return Self.printReport(ctx, id, 'buy-label-barcode');
};
}; };

View File

@ -0,0 +1,37 @@
module.exports = Self => {
Self.remoteMethodCtx('buyLabelSupplier', {
description: 'Returns the entry buy labels',
accessType: 'READ',
accepts: [
{
arg: 'id',
type: 'number',
required: true,
description: 'The entry id',
http: {source: 'path'}
}
],
returns: [
{
arg: 'body',
type: 'file',
root: true
}, {
arg: 'Content-Type',
type: 'String',
http: {target: 'header'}
}, {
arg: 'Content-Disposition',
type: 'String',
http: {target: 'header'}
}
],
http: {
path: '/:id/buy-label-supplier',
verb: 'GET'
},
accessScopes: ['DEFAULT', 'read:multimedia']
});
Self.buyLabelSupplier = (ctx, id) => Self.printReport(ctx, id, 'buy-label-supplier');
};

View File

@ -194,7 +194,7 @@ module.exports = Self => {
e.evaNotes observation, e.evaNotes observation,
e.isConfirmed, e.isConfirmed,
e.isOrdered, e.isOrdered,
e.isRaid, t.daysInForward,
e.commission, e.commission,
e.created, e.created,
e.travelFk, e.travelFk,

View File

@ -48,7 +48,9 @@ module.exports = Self => {
'warehouseInFk', 'warehouseInFk',
'isReceived', 'isReceived',
'isDelivered', 'isDelivered',
'ref'], 'ref',
'daysInForward',
],
include: [ include: [
{ {
relation: 'agency', relation: 'agency',
@ -85,7 +87,6 @@ module.exports = Self => {
} }
], ],
}; };
return models.Entry.findOne(filter, myOptions); return models.Entry.findOne(filter, myOptions);
}; };
}; };

View File

@ -2,4 +2,5 @@ module.exports = Self => {
require('../methods/entry/editLatestBuys')(Self); require('../methods/entry/editLatestBuys')(Self);
require('../methods/entry/latestBuysFilter')(Self); require('../methods/entry/latestBuysFilter')(Self);
require('../methods/entry/deleteBuys')(Self); require('../methods/entry/deleteBuys')(Self);
require('../methods/entry/buyLabel')(Self);
}; };

View File

@ -33,15 +33,6 @@
"isConfirmed": { "isConfirmed": {
"type": "boolean" "type": "boolean"
}, },
"isVirtual": {
"type": "boolean",
"mysql": {
"columnName": "isRaid"
}
},
"isRaid": {
"type": "boolean"
},
"commission": { "commission": {
"type": "number" "type": "number"
}, },
@ -88,7 +79,8 @@
"travel": { "travel": {
"type": "belongsTo", "type": "belongsTo",
"model": "Travel", "model": "Travel",
"foreignKey": "travelFk" "foreignKey": "travelFk",
"daysInForward": "daysInForward"
}, },
"company": { "company": {
"type": "belongsTo", "type": "belongsTo",

View File

@ -1,65 +1,65 @@
<vn-descriptor-content <vn-descriptor-content
module="entry" module="entry"
description="$ctrl.entry.supplier.nickname" description="$ctrl.entry.supplier.nickname"
summary="$ctrl.$.summary"> summary="$ctrl.$.summary">
<slot-menu> <slot-menu>
<vn-item <vn-item
ng-click="$ctrl.showEntryReport()" ng-click="$ctrl.showEntryReport()"
translate> translate>
Show entry report Show entry report
</vn-item> </vn-item>
</slot-menu> </slot-menu>
<slot-body> <slot-body>
<div class="attributes"> <div class="attributes">
<vn-label-value label="Agency " <vn-label-value label="Agency "
value="{{$ctrl.entry.travel.agency.name}}"> value="{{$ctrl.entry.travel.agency.name}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Landed" <vn-label-value label="Landed"
value="{{$ctrl.entry.travel.landed | date: 'dd/MM/yyyy'}}"> value="{{$ctrl.entry.travel.landed | date: 'dd/MM/yyyy'}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Warehouse Out" <vn-label-value label="Warehouse Out"
value="{{$ctrl.entry.travel.warehouseOut.name}}"> value="{{$ctrl.entry.travel.warehouseOut.name}}">
</vn-label-value> </vn-label-value>
</div> </div>
<div class="icons"> <div class="icons">
<vn-icon <vn-icon
vn-tooltip="Is inventory entry" vn-tooltip="It is a raid {{$ctrl.entryData.travel.daysInForward}} days forward"
icon="icon-inventory" icon="icon-inventory"
ng-if="$ctrl.entry.isExcludedFromAvailable"> ng-if="$ctrl.entry.isExcludedFromAvailable">
</vn-icon> </vn-icon>
<vn-icon <vn-icon
vn-tooltip="Is virtual entry" vn-tooltip="Is virtual entry"
icon="icon-net" icon="icon-net"
ng-if="$ctrl.entry.isRaid"> ng-if="$ctrl.entryData.travel.daysInForward">
</vn-icon> </vn-icon>
</div> </div>
<div class="quicklinks"> <div class="quicklinks">
<div ng-transclude="btnOne"> <div ng-transclude="btnOne">
<vn-quick-link <vn-quick-link
tooltip="Supplier card" tooltip="Supplier card"
state="['supplier.index', {q: $ctrl.entry.supplier.id }]" state="['supplier.index', {q: $ctrl.entry.supplier.id }]"
icon="icon-supplier"> icon="icon-supplier">
</vn-quick-link> </vn-quick-link>
</div> </div>
<div ng-transclude="btnTwo"> <div ng-transclude="btnTwo">
<vn-quick-link <vn-quick-link
tooltip="All travels with current agency" tooltip="All travels with current agency"
state="['travel.index', {q: $ctrl.travelFilter}]" state="['travel.index', {q: $ctrl.travelFilter}]"
icon="local_airport"> icon="local_airport">
</vn-quick-link> </vn-quick-link>
</div> </div>
<div ng-transclude="btnThree"> <div ng-transclude="btnThree">
<vn-quick-link <vn-quick-link
tooltip="All entries with current supplier" tooltip="All entries with current supplier"
state="['entry.index', {q: $ctrl.entryFilter}]" state="['entry.index', {q: $ctrl.entryFilter}]"
icon="icon-entry"> icon="icon-entry">
</vn-quick-link> </vn-quick-link>
</div> </div>
<div ng-transclude="btnThree"> <div ng-transclude="btnThree">
</div> </div>
</div> </div>
</slot-body> </slot-body>
</vn-descriptor-content> </vn-descriptor-content>
<vn-popup vn-id="summary"> <vn-popup vn-id="summary">
<vn-entry-summary entry="$ctrl.entry"></vn-entry-summary> <vn-entry-summary entry="$ctrl.entry"></vn-entry-summary>
</vn-popup> </vn-popup>

View File

@ -86,7 +86,7 @@ auto-load="true">
</vn-check> </vn-check>
<vn-check <vn-check
label="Raid" label="Raid"
ng-model="$ctrl.entryData.isRaid" ng-model="$ctrl.entryData.travel.daysInForward"
disabled="true"> disabled="true">
</vn-check> </vn-check>
<vn-check <vn-check

View File

@ -38,13 +38,23 @@ module.exports = Self => {
type: 'integer', type: 'integer',
description: 'Type id', description: 'Type id',
}, },
{
arg: 'producerFk',
type: 'integer',
description: 'Producer id',
},
{
arg: 'instrastatFk',
type: 'string',
description: 'intrastat id',
},
{ {
arg: 'isActive', arg: 'isActive',
type: 'boolean', type: 'boolean',
description: 'Whether the item is or not active', description: 'Whether the item is or not active',
}, },
{ {
arg: 'buyerFk', arg: 'workerFk',
type: 'integer', type: 'integer',
description: 'The buyer of the item', description: 'The buyer of the item',
}, },
@ -126,14 +136,16 @@ module.exports = Self => {
return {'i.stemMultiplier': value}; return {'i.stemMultiplier': value};
case 'categoryFk': case 'categoryFk':
return {'ic.id': value}; return {'ic.id': value};
case 'buyerFk': case 'workerFk':
return {'it.workerFk': value}; return {'it.workerFk': value};
case 'producerFk':
return {'pr.id': value};
case 'supplierFk': case 'supplierFk':
return {'s.id': value}; return {'s.id': value};
case 'origin': case 'origin':
return {'ori.code': value}; return {'ori.code': value};
case 'intrastat': case 'intrastatFk':
return {'intr.description': value}; return {'i.intrastatFk': value};
case 'landed': case 'landed':
return {'lb.landed': value}; return {'lb.landed': value};
} }
@ -172,6 +184,7 @@ module.exports = Self => {
u.name AS userName, u.name AS userName,
ori.code AS origin, ori.code AS origin,
ic.name AS category, ic.name AS category,
i.intrastatFk,
intr.description AS intrastat, intr.description AS intrastat,
b.grouping, b.grouping,
b.packing, b.packing,

View File

@ -1,55 +0,0 @@
module.exports = Self => {
Self.remoteMethodCtx('labelBarcodePdf', {
description: 'Returns the item label pdf with barcode',
accessType: 'READ',
accepts: [
{
arg: 'id',
type: 'number',
required: true,
description: 'The item id',
http: {source: 'path'}
}, {
arg: 'warehouseId',
type: 'number',
required: true
}, {
arg: 'packing',
type: 'number',
required: false
}, {
arg: 'copies',
type: 'number',
required: false
}, {
arg: 'userId',
type: 'number',
description: 'The user id from accessToken',
http: ctx => ctx.req.accessToken.userId,
required: true
}
],
returns: [
{
arg: 'body',
type: 'file',
root: true
}, {
arg: 'Content-Type',
type: 'String',
http: {target: 'header'}
}, {
arg: 'Content-Disposition',
type: 'String',
http: {target: 'header'}
}
],
http: {
path: '/:id/label-barcode-pdf',
verb: 'GET'
},
accessScopes: ['DEFAULT', 'read:multimedia']
});
Self.labelBarcodePdf = (ctx, id) => Self.printReport(ctx, id, 'item-label-barcode');
};

View File

@ -1,55 +0,0 @@
module.exports = Self => {
Self.remoteMethodCtx('labelQrPdf', {
description: 'Returns the item label pdf with qr',
accessType: 'READ',
accepts: [
{
arg: 'id',
type: 'number',
required: true,
description: 'The item id',
http: {source: 'path'}
}, {
arg: 'warehouseId',
type: 'number',
required: true
}, {
arg: 'packing',
type: 'number',
required: false
}, {
arg: 'copies',
type: 'number',
required: false
}, {
arg: 'userId',
type: 'number',
description: 'The user id from accessToken',
http: ctx => ctx.req.accessToken.userId,
required: true
}
],
returns: [
{
arg: 'body',
type: 'file',
root: true
}, {
arg: 'Content-Type',
type: 'String',
http: {target: 'header'}
}, {
arg: 'Content-Disposition',
type: 'String',
http: {target: 'header'}
}
],
http: {
path: '/:id/label-qr-pdf',
verb: 'GET'
},
accessScopes: ['DEFAULT', 'read:multimedia']
});
Self.labelQrPdf = (ctx, id) => Self.printReport(ctx, id, 'item-label-qr');
};

View File

@ -86,7 +86,7 @@ describe('item filter()', () => {
try { try {
const filter = {}; const filter = {};
const ctx = {args: {filter: filter, buyerFk: 16}, req: {accessToken: {userId: 1}}}; const ctx = {args: {filter: filter, workerFk: 16}, req: {accessToken: {userId: 1}}};
const result = await models.Item.filter(ctx, filter, options); const result = await models.Item.filter(ctx, filter, options);
expect(result.length).toEqual(2); expect(result.length).toEqual(2);

View File

@ -47,6 +47,9 @@
"ItemType": { "ItemType": {
"dataSource": "vn" "dataSource": "vn"
}, },
"ItemTypeLog": {
"dataSource": "vn"
},
"ItemTypeTag": { "ItemTypeTag": {
"dataSource": "vn" "dataSource": "vn"
}, },

View File

@ -0,0 +1,9 @@
{
"name": "ItemTypeLog",
"base": "Log",
"options": {
"mysql": {
"table": "itemTypeLog"
}
}
}

View File

@ -29,6 +29,12 @@
}, },
"isLaid": { "isLaid": {
"type": "boolean" "type": "boolean"
},
"maxRefs": {
"type": "string"
},
"isFragile": {
"type": "boolean"
} }
}, },
"relations": { "relations": {

View File

@ -15,8 +15,6 @@ module.exports = Self => {
require('../methods/item/getWasteByItem')(Self); require('../methods/item/getWasteByItem')(Self);
require('../methods/item/createIntrastat')(Self); require('../methods/item/createIntrastat')(Self);
require('../methods/item/buyerWasteEmail')(Self); require('../methods/item/buyerWasteEmail')(Self);
require('../methods/item/labelBarcodePdf')(Self);
require('../methods/item/labelQrPdf')(Self);
require('../methods/item/setVisibleDiscard')(Self); require('../methods/item/setVisibleDiscard')(Self);
require('../methods/item/get')(Self); require('../methods/item/get')(Self);

View File

@ -38,5 +38,13 @@
"model": "Sector", "model": "Sector",
"foreignKey": "sectorFk" "foreignKey": "sectorFk"
} }
},
"scope": {
"include": {
"relation": "sector",
"scope": {
"fields": ["id", "description"]
}
}
} }
} }

View File

@ -44,6 +44,7 @@ module.exports = Self => {
const typeFk = expeditionStateType.id; const typeFk = expeditionStateType.id;
expeditionId = expedition.expeditionFk; expeditionId = expedition.expeditionFk;
expeditionPosition = expedition?.scanOrder ?? null;
const isScannedExpedition = expedition.isScanned ?? false; const isScannedExpedition = expedition.isScanned ?? false;
await models.ExpeditionState.create({ await models.ExpeditionState.create({
@ -51,6 +52,7 @@ module.exports = Self => {
typeFk, typeFk,
userFk: userId, userFk: userId,
isScanned: isScannedExpedition, isScanned: isScannedExpedition,
scanOrder: expeditionPosition
}, myOptions); }, myOptions);
} }

View File

@ -2,6 +2,7 @@ const models = require('vn-loopback/server/server').models;
describe('expeditionState addExpeditionState()', () => { describe('expeditionState addExpeditionState()', () => {
const ctx = beforeAll.getCtx(); const ctx = beforeAll.getCtx();
beforeAll.mockLoopBackContext();
it('should update the expedition states', async() => { it('should update the expedition states', async() => {
const tx = await models.ExpeditionState.beginTransaction({}); const tx = await models.ExpeditionState.beginTransaction({});
try { try {

View File

@ -48,7 +48,7 @@ module.exports = Self => {
CALL vn.sale_recalcComponent(null); CALL vn.sale_recalcComponent(null);
DROP TEMPORARY TABLE tmp.recalculateSales;`; DROP TEMPORARY TABLE tmp.recalculateSales;`;
const recalculation = await Self.rawSql(query, salesIds, myOptions); const recalculation = await Self.rawSql(query, [salesIds], myOptions);
if (tx) await tx.commit(); if (tx) await tx.commit();

View File

@ -85,6 +85,25 @@ describe('sale updatePrice()', () => {
} }
}); });
it('should check if priceFixed has changed', async() => {
const tx = await models.Sale.beginTransaction({});
try {
const options = {transaction: tx};
const price = 3;
const beforeUpdate = await models.Sale.findById(saleId, null, options);
await models.Sale.updatePrice(ctx, saleId, price, options);
const afterUpdate = await models.Sale.findById(saleId, null, options);
expect(beforeUpdate.priceFixed).not.toEqual(afterUpdate.priceFixed);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
it('should set price as a decimal number and check the sale has the mana component changing the salesPersonMana', async() => { it('should set price as a decimal number and check the sale has the mana component changing the salesPersonMana', async() => {
const tx = await models.Sale.beginTransaction({}); const tx = await models.Sale.beginTransaction({});

View File

@ -91,7 +91,21 @@ module.exports = Self => {
value: componentValue value: componentValue
}, myOptions); }, myOptions);
} }
await sale.updateAttributes({price: newPrice}, myOptions);
const [priceFixed] = await Self.rawSql(`
SELECT SUM(value) value
FROM sale s
JOIN saleComponent sc ON sc.saleFk = s.id
JOIN component c ON c.id = sc.componentFk
JOIN componentType ct ON ct.id = c.typeFk
WHERE ct.isBase
AND s.id = ?
`, [id], myOptions);
await sale.updateAttributes({
price: newPrice,
priceFixed: priceFixed.value
}, myOptions);
await Self.rawSql('CALL vn.manaSpellersRequery(?)', [userId], myOptions); await Self.rawSql('CALL vn.manaSpellersRequery(?)', [userId], myOptions);
await Self.rawSql('CALL vn.ticket_recalc(?, NULL)', [sale.ticketFk], myOptions); await Self.rawSql('CALL vn.ticket_recalc(?, NULL)', [sale.ticketFk], myOptions);

View File

@ -1,4 +1,66 @@
const LoopBackContext = require('loopback-context');
module.exports = function(Self) { module.exports = function(Self) {
require('../methods/expedition-state/filter')(Self); require('../methods/expedition-state/filter')(Self);
require('../methods/expedition-state/addExpeditionState')(Self); require('../methods/expedition-state/addExpeditionState')(Self);
Self.observe('before save', async ctx => {
const models = Self.app.models;
const changes = ctx.data || ctx.instance;
const instance = ctx.currentInstance;
const loopBackContext = LoopBackContext.getCurrentContext();
const httpCtx = {req: loopBackContext.active};
const httpRequest = httpCtx.req.http.req;
const $t = httpRequest.__;
const myOptions = {};
if (ctx.options && ctx.options.transaction)
myOptions.transaction = ctx.options.transaction;
const newStateType = changes?.typeFk;
if (newStateType == null) return;
const expeditionId = changes?.expeditionFk || instance?.expeditionFk;
const {code} = await models.ExpeditionStateType.findById(
newStateType,
{
fields: ['code']
},
myOptions);
if (code !== 'LOST') return;
const dataExpedition = await models.Expedition.findById(
expeditionId, {
fields: ['ticketFk'],
include: [{
relation: 'ticket',
scope: {
fields: ['clientFk'],
include: [{
relation: 'client',
scope: {
fields: ['name', 'salesPersonFk']
}
}]
}
}],
}, myOptions);
const salesPersonFk = dataExpedition.ticket()?.client()?.salesPersonFk;
if (salesPersonFk) {
const url = await Self.app.models.Url.getUrl();
const fullUrl = `${url}ticket/${dataExpedition.ticketFk}/expedition`;
const message = $t('ticketLostExpedition', {
ticketId: dataExpedition.ticketFk,
expeditionId: expeditionId,
url: fullUrl
});
await models.Chat.sendCheckingPresence(httpCtx, salesPersonFk, message);
}
});
}; };

View File

@ -19,13 +19,17 @@
"type": "number" "type": "number"
}, },
"typeFk": { "typeFk": {
"type": "number" "type": "number",
"required": true
}, },
"userFk": { "userFk": {
"type": "number" "type": "number"
}, },
"isScanned": { "isScanned": {
"type": "boolean" "type": "boolean"
},
"scanOrder": {
"type": "number"
} }
}, },
"relations": { "relations": {

View File

@ -28,6 +28,9 @@
"discount": { "discount": {
"type": "number" "type": "number"
}, },
"priceFixed": {
"type": "number"
},
"reserved": { "reserved": {
"type": "boolean" "type": "boolean"
}, },

View File

@ -155,6 +155,7 @@ module.exports = Self => {
t.landingHour, t.landingHour,
t.cargoSupplierFk, t.cargoSupplierFk,
t.totalEntries, t.totalEntries,
t.daysInForward,
am.name agencyModeName, am.name agencyModeName,
win.name warehouseInName, win.name warehouseInName,
wout.name warehouseOutName, wout.name warehouseOutName,

View File

@ -44,7 +44,6 @@ module.exports = Self => {
], ],
}; };
let travel = await Self.app.models.Travel.findOne(filter); return Self.app.models.Travel.findOne(filter);
return travel;
}; };
}; };

View File

@ -50,6 +50,9 @@
}, },
"landingHour": { "landingHour": {
"type": "string" "type": "string"
},
"daysInForward": {
"type": "number"
} }
}, },
"relations": { "relations": {

View File

@ -204,6 +204,15 @@
] ]
}, },
"summary": { "summary": {
"fields": [
"id",
"firstName",
"lastName",
"bossFk",
"sex",
"phone",
"mobileExtension"
],
"include": [ "include": [
{ {
"relation": "user", "relation": "user",
@ -247,10 +256,21 @@
} }
}, },
{ {
"relation": "boss" "relation": "boss",
"scope": {
"fields": [
"id",
"name"
]
}
}, },
{ {
"relation": "client" "relation": "client",
"scope": {
"fields": [
"id"
]
}
}, },
{ {
"relation": "sip", "relation": "sip",
@ -272,14 +292,16 @@
"fields": [ "fields": [
"id", "id",
"fiDueDate", "fiDueDate",
"sex",
"seniority", "seniority",
"fi", "fi",
"isFreelance", "isFreelance",
"isSsDiscounted", "isSsDiscounted",
"hasMachineryAuthorized", "hasMachineryAuthorized",
"isDisable", "isDisable",
"birth" "birth",
"educationLevelFk",
"originCountryFk",
"maritalStatus"
] ]
} }
} }

View File

@ -1,7 +1,7 @@
html { html {
font-family: "Roboto", "Helvetica", "Arial", sans-serif; font-family: "Roboto", "Helvetica", "Arial", sans-serif;
margin-top: -9px; margin-top: -9px;
margin-left: -6px; margin-left: -3px;
} }
table { table {
width: 100%; width: 100%;
@ -52,8 +52,8 @@ td {
max-height: 50px; max-height: 50px;
} }
.md-height { .md-height {
height: 75px; height: 70px;
max-height: 75px; max-height: 70px;
} }
.sm-width { .sm-width {
width: 60px; width: 60px;

View File

@ -1,16 +1,16 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<body table v-for="item in items" style="break-before: page"> <body table v-for="buy in buys" style="break-before: page">
<table> <table>
<tr> <tr>
<td class="md-txt bold center black-bg lg-width md-height"> <td class="md-txt bold center black-bg lg-width md-height">
<div class="overflow-multiline"> <div class="overflow-multiline">
{{item.item}} {{buy.item}}
</div> </div>
</td> </td>
<td colspan="2" class="xl-txt bold center black-bg md-height md-width"> <td colspan="2" class="xl-txt bold center black-bg md-height md-width">
<div class="overflow-line"> <div class="overflow-line">
{{item.size}} {{buy.size}}
</div> </div>
</td> </td>
</tr> </tr>
@ -18,61 +18,64 @@
<td class="right lg-width"> <td class="right lg-width">
<div class="overflow-line"> <div class="overflow-line">
{{ {{
(item.longName && item.size && item.subName) (buy.longName && buy.size && buy.subName)
? `${item.longName} ${item.size} ${item.subName}` ? `${buy.longName} ${buy.size} ${buy.subName}`
: item.comment : buy.comment
}} }}
</div> </div>
</td> </td>
<td class="center sm-width"> <td class="center sm-width">
<div class="overflow-line"> <div class="overflow-line">
{{item.producerName || item.producerFk}} {{buy.producerName || buy.producerFk}}
</div> </div>
</td> </td>
<td class="center sm-width"> <td class="center sm-width">
<div class="overflow-line"> <div class="overflow-line">
{{item.inkFk}} {{buy.inkFk}}
</div> </div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="md-txt xl-width bold center"> <td class="md-txt xl-width bold center">
<div class="overflow-line"> <div class="overflow-line">
{{item.itemFk}} {{buy.itemFk}}
</div> </div>
</td> </td>
<td colspan="2" class="md-txt md-width center"> <td colspan="2" class="md-txt md-width center">
<div class="overflow-line"> <div class="overflow-line">
{{`${(packing || item.packing)} x ${item.stems || ''}`}} {{`${(packing || buy.packing)} x ${buy.stems || ''}`}}
</div> </div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td rowspan="2" class="center"> <td rowspan="2" class="center">
<div v-html="getBarcode(item.buyFk)"></div> <div v-html="getBarcode(buy.buyFk)"></div>
</td> </td>
<td colspan="2" class="center md-width xs-height xs-txt"> <td colspan="2" class="center md-width xs-height xs-txt">
<div class="overflow-line"> <div v-if="buy.isLaid && typeId === 'buy'" class="overflow-line black-bg bold">
{{item.entryFk}} {{'LAID'}}
</div>
<div v-else class="overflow-line">
{{buy.entryFk}}
</div> </div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="center xs-txt sm-width"> <td class="center xs-txt sm-width">
<div class="overflow-line"> <div class="overflow-line">
{{item.buyerName}} {{buy.buyerName}}
</div> </div>
</td> </td>
<td class="center xs-txt sm-width"> <td class="center xs-txt sm-width">
<div class="overflow-line"> <div class="overflow-line">
{{item.origin}} {{buy.origin}}
</div> </div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="center xl-width"> <td class="center xl-width">
<div class="overflow-line"> <div class="overflow-line">
{{item.buyFk}} {{buy.buyFk}}
</div> </div>
</td> </td>
<td class="xs-txt sm-width center"> <td class="xs-txt sm-width center">
@ -82,7 +85,7 @@
</td> </td>
<td class="xs-txt sm-width cursive center bold"> <td class="xs-txt sm-width cursive center bold">
<div class="overflow-line"> <div class="overflow-line">
{{`${item.labelNum}/${item.quantity / (packing || item.packing)}`}} {{`${buy.labelNum}/${buy.quantity / (packing || buy.packing)}`}}
</div> </div>
</td> </td>
</tr> </tr>

View File

@ -4,20 +4,11 @@ const moment = require('moment');
const jsbarcode = require('jsbarcode'); const jsbarcode = require('jsbarcode');
module.exports = { module.exports = {
name: 'item-label-barcode', name: 'buy-label-barcode',
async serverPrefetch() { async serverPrefetch() {
this.company = await this.findOneFromDef('company', [this.warehouseId]);
if (!this.company)
throw new UserError(`There is no company associated with that warehouse`);
this.date = Date.vnNew(); this.date = Date.vnNew();
this.lastBuy = await this.findOneFromDef('lastBuy', [ this.buys = await this.rawSqlFromDef('buy', [this.copies || 1, this.id]);
this.id, if (!this.buys.length) throw new UserError(`Empty data source`);
this.warehouseId,
this.date
]);
this.items = await this.rawSqlFromDef('item', [this.copies || 1, this.lastBuy.id]);
if (!this.items.length) throw new UserError(`Empty data source`);
this.date = moment(this.date).format('WW/E'); this.date = moment(this.date).format('WW/E');
}, },
methods: { methods: {
@ -51,8 +42,8 @@ module.exports = {
copies: { copies: {
type: Number type: Number
}, },
userId: { typeId: {
type: Number type: String
} }
} }
}; };

View File

@ -3,7 +3,7 @@
"height": "4.9cm", "height": "4.9cm",
"margin": { "margin": {
"top": "0.17cm", "top": "0.17cm",
"right": "0.745cm", "right": "0.37cm",
"bottom": "0cm", "bottom": "0cm",
"left": "0cm" "left": "0cm"
}, },

View File

@ -22,7 +22,9 @@ SELECT ROW_NUMBER() OVER() labelNum,
ig.longName, ig.longName,
ig.subName, ig.subName,
i.comment, i.comment,
w.code buyerName w.code buyerName,
i.isLaid,
c.code company
FROM vn.buy b FROM vn.buy b
JOIN vn.item i ON i.id = b.itemFk JOIN vn.item i ON i.id = b.itemFk
LEFT JOIN vn.item ig ON ig.id = b.itemOriginalFk LEFT JOIN vn.item ig ON ig.id = b.itemOriginalFk
@ -30,5 +32,7 @@ SELECT ROW_NUMBER() OVER() labelNum,
LEFT JOIN vn.producer p ON p.id = i.producerFk LEFT JOIN vn.producer p ON p.id = i.producerFk
JOIN vn.itemType it ON it.id = i.typeFk JOIN vn.itemType it ON it.id = i.typeFk
JOIN vn.worker w ON w.id = it.workerFk JOIN vn.worker w ON w.id = it.workerFk
JOIN vn.entry e ON e.id = b.entryFk
JOIN vn.company c ON c.id = e.companyFk
JOIN numbers num JOIN numbers num
WHERE b.id = ? WHERE b.id = ?

View File

@ -1,7 +1,7 @@
html { html {
font-family: "Roboto", "Helvetica", "Arial", sans-serif; font-family: "Roboto", "Helvetica", "Arial", sans-serif;
margin-top: -7px; margin-top: -7px;
margin-left: -6px; margin-left: -3px;
} }
.leftTable { .leftTable {
width: 47%; width: 47%;

View File

@ -1,6 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<body v-for="item in items" style="break-before: page"> <body v-for="buy in buys" style="break-before: page">
<table class="leftTable"> <table class="leftTable">
<tr> <tr>
<td> <td>
@ -12,7 +12,7 @@
</tr> </tr>
<tr> <tr>
<td colspan="2"> <td colspan="2">
{{item.buyFk}} {{buy.buyFk}}
</td> </td>
</tr> </tr>
<tr> <tr>
@ -28,58 +28,65 @@
<tr> <tr>
<td colspan="3" class="lg-width black-bg center bold xl-txt padding"> <td colspan="3" class="lg-width black-bg center bold xl-txt padding">
<div class="overflow-line"> <div class="overflow-line">
{{item.itemFk}} {{buy.itemFk}}
</div> </div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="2" class="black-bg center bold md-txt md-width md-height"> <td colspan="2" class="black-bg center bold md-txt md-width md-height">
<div class="overflow-multiline"> <div class="overflow-multiline">
{{item.item}} {{buy.item}}
</div> </div>
</td> </td>
<td class="xs-width black-bg center bold xl-txt"> <td class="xs-width black-bg center bold xl-txt">
<div class="overflow-line"> <div class="overflow-line">
{{item.size}} {{buy.size}}
</div> </div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="sm-width"> <td class="sm-width">
<div class="overflow-line"> <div class="overflow-line">
<i>Color:</i> <b>{{item.inkFk}}</b> <i>Color:</i> <b>{{buy.inkFk}}</b>
</div> </div>
</td> </td>
<td rowspan="2" class="xs-width center md-txt"> <td rowspan="2" class="xs-width center md-txt">
<div class="overflow-line cell"> <div class="overflow-line cell">
{{packing || item.packing}} {{packing || buy.packing}}
</div> </div>
</td> </td>
<td rowspan="2" class="xs-width center md-txt"> <td rowspan="2" class="xs-width center md-txt">
<div class="overflow-line cell"> <div class="overflow-line cell">
{{item.stems}} {{buy.stems}}
</div> </div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="sm-width"> <td class="sm-width">
<div class="overflow-line"> <div class="overflow-line">
<i>Origen:</i> {{item.origin}} <i>Origen:</i> {{buy.origin}}
</div> </div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="2" class="md-width"> <td colspan="2" class="md-width">
<div class="overflow-line"> <div class="overflow-line">
<i>Productor:</i> {{item.producerName || item.producerFk}} <i>Productor:</i> {{buy.producerName || buy.producerFk}}
</div>
</td>
<td class="center xs-width xs-txt">
<div v-if="buy.isLaid && typeId === 'buy'" class="overflow-line black-bg bold">
{{'LAID'}}
</div>
<div v-else class="overflow-line">
{{buy.entryFk}}
</div> </div>
</td> </td>
<td></td>
</tr> </tr>
<tr> <tr>
<td class="sm-width"> <td class="sm-width">
<div class="overflow-line"> <div class="overflow-line">
<i>Comprador:</i> {{item.buyerName}} <i>Comprador:</i> {{buy.buyerName}}
</div> </div>
</td> </td>
<td rowspan="2" class="xs-width"> <td rowspan="2" class="xs-width">
@ -89,14 +96,14 @@
</td> </td>
<td rowspan="2" class="xs-width center cursive bold md-txt"> <td rowspan="2" class="xs-width center cursive bold md-txt">
<div class="overflow-line"> <div class="overflow-line">
{{`${item.labelNum}/${item.quantity / (packing || item.packing)}`}} {{`${buy.labelNum}/${buy.quantity / (packing || buy.packing)}`}}
</div> </div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="sm-width"> <td class="sm-width">
<div class="overflow-line"> <div class="overflow-line">
<i>Entrada:</i> {{item.entryFk}} <i>Entrada:</i> {{buy.entryFk}}
</div> </div>
</td> </td>
</tr> </tr>
@ -104,9 +111,9 @@
<td colspan="3" class="lg-width center cursive bold"> <td colspan="3" class="lg-width center cursive bold">
<div class="overflow-line"> <div class="overflow-line">
{{ {{
(item.longName && item.size && item.subName) (buy.longName && buy.size && buy.subName)
? `${item.longName} ${item.size} ${item.subName}` ? `${buy.longName} ${buy.size} ${buy.subName}`
: item.comment : buy.comment
}} }}
</div> </div>
</td> </td>

View File

@ -3,27 +3,18 @@ const moment = require('moment');
const qrcode = require('qrcode'); const qrcode = require('qrcode');
module.exports = { module.exports = {
name: 'item-label-qr', name: 'buy-label-qr',
async serverPrefetch() { async serverPrefetch() {
this.company = await this.findOneFromDef('company', [this.warehouseId]);
if (!this.company)
throw new UserError(`There is no company associated with that warehouse`);
this.date = Date.vnNew(); this.date = Date.vnNew();
this.lastBuy = await this.findOneFromDef('lastBuy', [ this.buys = await this.rawSqlFromDef('buy', [this.copies || 1, this.id]);
this.id, if (!this.buys.length) throw new UserError(`Empty data source`);
this.warehouseId, this.qr = await this.getQr(this.buys[0].buyFk);
this.date
]);
this.items = await this.rawSqlFromDef('item', [this.copies || 1, this.lastBuy.id]);
if (!this.items.length) throw new UserError(`Empty data source`);
this.qr = await this.getQr(this.items[0].buyFk);
this.date = moment(this.date).format('WW/E'); this.date = moment(this.date).format('WW/E');
}, },
methods: { methods: {
getQr(data) { getQr(data) {
data = { data = {
company: this.company, company: this.buys.company,
user: this.userId, user: this.userId,
created: this.date, created: this.date,
table: 'buy', table: 'buy',
@ -52,6 +43,9 @@ module.exports = {
}, },
userId: { userId: {
type: Number type: Number
},
typeId: {
type: String
} }
} }
}; };

View File

@ -3,7 +3,7 @@
"height": "4.9cm", "height": "4.9cm",
"margin": { "margin": {
"top": "0.17cm", "top": "0.17cm",
"right": "0.6cm", "right": "0.3cm",
"bottom": "0cm", "bottom": "0cm",
"left": "0cm" "left": "0cm"
}, },

View File

@ -22,7 +22,9 @@ SELECT ROW_NUMBER() OVER() labelNum,
ig.longName, ig.longName,
ig.subName, ig.subName,
i.comment, i.comment,
w.code buyerName w.code buyerName,
i.isLaid,
c.code company
FROM vn.buy b FROM vn.buy b
JOIN vn.item i ON i.id = b.itemFk JOIN vn.item i ON i.id = b.itemFk
LEFT JOIN vn.item ig ON ig.id = b.itemOriginalFk LEFT JOIN vn.item ig ON ig.id = b.itemOriginalFk
@ -30,5 +32,7 @@ SELECT ROW_NUMBER() OVER() labelNum,
LEFT JOIN vn.producer p ON p.id = i.producerFk LEFT JOIN vn.producer p ON p.id = i.producerFk
JOIN vn.itemType it ON it.id = i.typeFk JOIN vn.itemType it ON it.id = i.typeFk
JOIN vn.worker w ON w.id = it.workerFk JOIN vn.worker w ON w.id = it.workerFk
JOIN vn.entry e ON e.id = b.entryFk
JOIN vn.company c ON c.id = e.companyFk
JOIN numbers num JOIN numbers num
WHERE b.id = ? WHERE b.id = ?

View File

@ -5,7 +5,7 @@ const jsBarcode = require('jsbarcode');
const moment = require('moment'); const moment = require('moment');
module.exports = { module.exports = {
name: 'buy-label', name: 'buy-label-supplier',
mixins: [vnReport], mixins: [vnReport],
async serverPrefetch() { async serverPrefetch() {
const buy = await models.Buy.findById(this.id, null); const buy = await models.Buy.findById(this.id, null);

Some files were not shown because too many files have changed in this diff Show More