8032-devToTest_2440 #3009

Merged
alexm merged 262 commits from 8032-devToTest_2440 into test 2024-09-24 09:34:49 +00:00
19 changed files with 298 additions and 92 deletions
Showing only changes of commit c8315714d4 - Show all commits

View File

@ -1,3 +1,89 @@
# Version 24.38 - 2024-09-17
### Added 🆕
- chore: refs #7323 filter data by:jorgep
- chore: refs #7323 fix test by:jorgep
- chore: refs #7323 worker changes by:jorgep
- chore: refs #7323 worker changes wip by:jorgep
- chore: refs #7524 add select limit by:jorgep
- feat(AccessToken&ACL): refs #7547 upgrade security by:alexm
- feat: deleted code and redirect to Lilium by:Jon
- feat: refs #4515 New throw buy_checkItem by:guillermo
- feat: refs #6650 Added saleGroupLog by:guillermo
- feat: refs #6650 new itemShelvingLog by:guillermo
- feat: refs #6760 refs #actualiza campo nickname by:jgallego
- feat: refs #7277 fdescribe by:jgallego
- feat: refs #7277 fit by:jgallego
- feat: refs #7277 refundInvoices by:jgallego
- feat: refs #7277 test with warehouse by:jgallego
- feat: refs #7277 traducciones by:jgallego
- feat: refs #7277 transfer addressFk by:jgallego
- feat: refs #7532 Requested changes by:guillermo
- feat: refs #7564 Added proc by:guillermo
- feat: refs #7564 Added ticket_setVolumeItemCost by:guillermo
- feat: refs #7564 Added volume column by:guillermo
- feat: refs #7564 Fix version by:guillermo
- feat: refs #7564 Requested changes by:guillermo
- feat: refs #7615 setDeleted by:robert
- feat: refs #7650 Added no transfer lines to inventory entry and fixtures by:guillermo
- feat: refs #7650 Fix tests by:guillermo
- feat: refs #7747 Delete buyUltimate and buyUltimateFromInterval by:ivanm
- feat: refs #7759 Changed defined only of vn objects by:guillermo
- feat: refs #7759 Changed definer root to vn-admin by:guillermo
- feat: refs #7759 Changed name by:guillermo
- feat: refs #7759 Deleted version 11163-maroonEucalyptus by:guillermo
- feat: refs #7759 Revoke routine grants vn by:guillermo
- feat: refs #7811 Added comment by:guillermo
- feat: refs #7811 Added new params in datasources.json by:guillermo
- feat: refs #7898 Add column "floor" in vn.parking by:ivanm
- feat: refs #7898 Modify default by:ivanm
- feat: refs #7905 Added new method getBuysCsv by:guillermo
- feat: refs #7905 Added param toCsv by:guillermo
- feat: refs #7938 remove unnecessary insert in clientLog by:alexm
- feat: refs #7953 pullinfo (7953-devToTest_2438) by:alexm
- feat(salix): #7671 define isDestiny field in model by:Javier Segarra
- feat(salix): refs #7896 update version and changelog (origin/7896_down_devToTest_2436) by:Javier Segarra
- feat(salix): refs #7905 #7905 use getBuys toCSV flattened by:Javier Segarra
- feat(ssalix): refs #7671 #7671 checkDates by:Javier Segarra
- feat(ssalix): refs #7671 #7671 checkDates to present by:Javier Segarra
- feat: ticket 215005 Changed acl show transferClient by:guillermo
### Changed 📦
- perf: refs #7671 improve showBadDates by:Javier Segarra
- perf(salix): refs #7671 #7671 imrpove and revert where changes by:Javier Segarra
- refactor: deleted e2e & added back descriptor and summary by:Jon
### Fixed 🛠️
- chore: refs #7323 fix test by:jorgep
- feat: refs #7650 Added no transfer lines to inventory entry and fixtures by:guillermo
- fix by:guillermo
- fixes: refs #7760 collection problems by:Carlos Andrés
- fix merge dev (7407-workerMedical) by:alexm
- fix: refs #6727 No delete log tables data in clean procedures by:guillermo
- fix: refs #6897 back and tests by:carlossa
- fix: refs #6897 back by:carlossa
- fix: refs #6897 fix filter by:carlossa
- fix: refs #6897 fix json by:carlossa
- fix: refs #6897 travel filter by:carlossa
- fix: refs #6897 error test by:jgallego
- fix: refs #7323 fetch from right source by:jorgep
- fix: refs #7564 Deleted query by:guillermo
- fix: refs #7759 Added user 'vn'@'localhost' & grants by:guillermo
- fix: refs #7760 collection problems by:Carlos Andrés
- fix: refs #7760 tmp.ticketIPT by:Carlos Andrés
- fix: refs #7905 added comments to flatten.js by:guillermo
- fix: refs ##7905 Handle error by:guillermo
- fix(salix): refs #7905 #7905 use right fn to flatten data by:Javier Segarra
- perf(salix): refs #7671 #7671 imrpove and revert where changes by:Javier Segarra
- refs #6898 fix supplier remove by:carlossa
- refs #7407 fix acls fixtures by:carlossa
- test: fix connections e2e (7547-accessToken-security) by:alexm
- test: refs #7277 fix test proposal by:Javier Segarra
- test(salix): refs #7671 #7671 improve and revert where changes by:Javier Segarra
# Version 24.36 - 2024-09-03 # Version 24.36 - 2024-09-03
### Added 🆕 ### Added 🆕

View File

@ -4,7 +4,9 @@ GRANT SELECT,
INSERT, INSERT,
UPDATE, UPDATE,
DELETE, DELETE,
DROP,
CREATE TEMPORARY TABLES, CREATE TEMPORARY TABLES,
EXECUTE, EXECUTE,
EVENT,
TRIGGER TRIGGER
ON *.* TO 'vn'@'localhost'; ON *.* TO 'vn'@'localhost';

View File

@ -1521,23 +1521,23 @@ INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed
INSERT INTO `vn`.`entryConfig` (`defaultEntry`, `inventorySupplierFk`, `defaultSupplierFk`) INSERT INTO `vn`.`entryConfig` (`defaultEntry`, `inventorySupplierFk`, `defaultSupplierFk`)
VALUES (2, 4, 1); VALUES (2, 4, 1);
INSERT INTO `bs`.`waste`(`buyerFk`, `year`, `week`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWasteQuantity`, `saleInternalWaste`, `saleExternalWaste`) INSERT INTO `bs`.`waste`(`buyerFk`, `year`, `week`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWasteQuantity`, `saleExternalWaste`, `saleFaultWaste`, `saleContainerWaste`, `saleBreakWaste`, `saleOtherWaste`)
VALUES VALUES
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 1, 1, '1062', '51', '56.20', '56.20'), ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 1, 1, '1062', '51', '56.20', '56.20', '56.20', '56.20', '56.20'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '35074', '687', '53.12', '89.69'), ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '35074', '687', '53.12', '89.69', '56.20', '56.20', '56.20'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '1777', '13', '12.02', '53.12'), ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '1777', '13', '12.02', '53.12', '56.20', '56.20', '56.20'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '3182', '59', '51', '56.20'), ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '3182', '59', '51', '56.20', '56.20', '56.20', '56.20'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '1747', '13', '53.12', '53.12'), ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '1747', '13', '53.12', '53.12', '56.20', '56.20', '56.20'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '7182', '59', '51', '53.12'), ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '7182', '59', '51', '53.12', '56.20', '56.20', '56.20'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '1777', '13', '89.69', '89.69'), ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '1777', '13', '89.69', '89.69', '56.20', '56.20', '56.20'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 8, 1, '4181', '59', '53.12', '53.12'), ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 8, 1, '4181', '59', '53.12', '53.12', '56.20', '56.20', '56.20'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 9, 1, '7268', '59', '12.02', '56.20'), ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 9, 1, '7268', '59', '12.02', '56.20', '56.20', '56.20', '56.20'),
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '-74', '0', '51', '89.69'), ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '-74', '0', '51', '89.69', '56.20', '56.20', '56.20'),
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '-7', '0', '12.02', '53.12'), ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '-7', '0', '12.02', '53.12', '56.20', '56.20', '56.20'),
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '1100', '0', '51', '56.20'), ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '1100', '0', '51', '56.20', '56.20', '56.20', '56.20'),
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '848', '-187', '12.02', '89.69'), ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '848', '-187', '12.02', '89.69', '56.20', '56.20', '56.20'),
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '186', '0', '51', '53.12'), ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '186', '0', '51', '53.12', '56.20', '56.20', '56.20'),
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '277', '0', '53.12', '56.20'); ('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '277', '0', '53.12', '56.20', '56.20', '56.20', '56.20');
INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`packagingFk`,`stickers`,`freightValue`,`packageValue`,`comissionValue`,`packing`,`grouping`,`groupingMode`,`location`,`price1`,`price2`,`price3`, `printedStickers`,`isChecked`,`isIgnored`,`weight`, `created`) INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`packagingFk`,`stickers`,`freightValue`,`packageValue`,`comissionValue`,`packing`,`grouping`,`groupingMode`,`location`,`price1`,`price2`,`price3`, `printedStickers`,`isChecked`,`isIgnored`,`weight`, `created`)
VALUES VALUES

View File

@ -1,7 +1,7 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`() CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`()
BEGIN BEGIN
DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL WEEKDAY(util.VN_CURDATE()) DAY; DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL WEEKDAY(util.VN_CURDATE()) DAY;
DECLARE vDateTo DATE DEFAULT vDateFrom + INTERVAL 6 DAY; DECLARE vDateTo DATE DEFAULT vDateFrom + INTERVAL 6 DAY;
CALL cache.last_buy_refresh(FALSE); CALL cache.last_buy_refresh(FALSE);
@ -14,16 +14,32 @@ BEGIN
s.itemFk, s.itemFk,
SUM((b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity), SUM((b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity),
SUM(IF(aw.`type`, s.quantity, 0)), SUM(IF(aw.`type`, s.quantity, 0)),
SUM( SUM(IF(
IF( aw.`type` = 'external',
aw.`type` = 'internal',
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity, (b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
0 0
) )
), ),
SUM( SUM(IF(
IF( aw.`type` = 'fault',
aw.`type` = 'external', (b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
0
)
),
SUM(IF(
aw.`type` = 'container',
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
0
)
),
SUM(IF(
aw.`type` = 'break',
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
0
)
),
SUM(IF(
aw.`type` = 'other',
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity, (b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
0 0
) )

View File

@ -75,6 +75,9 @@ proc: BEGIN
WHERE saleFk = vSaleFk; WHERE saleFk = vSaleFk;
IF vTotalReservedQuantity <> vSaleQuantity THEN IF vTotalReservedQuantity <> vSaleQuantity THEN
CALL util.debugAdd('itemShelvingSale_addBySale',
CONCAT(vSaleFk, ' - ', vSaleQuantity,' - ', vTotalReservedQuantity,'-', vOutStanding,'-', account.myUser_getId()));
UPDATE sale UPDATE sale
SET quantity = vTotalReservedQuantity SET quantity = vTotalReservedQuantity
WHERE id = vSaleFk; WHERE id = vSaleFk;
@ -93,7 +96,8 @@ proc: BEGIN
SET vOutStanding = vOutStanding - vReservedQuantity; SET vOutStanding = vOutStanding - vReservedQuantity;
IF vReservedQuantity > 0 THEN IF vReservedQuantity > 0 THEN
CALL util.debugAdd('itemShelvingSale_addBySale_reservedQuantity',
CONCAT(vSaleFk, ' - ', vReservedQuantity, ' - ', vOutStanding, account.myUser_getId()));
INSERT INTO itemShelvingSale( INSERT INTO itemShelvingSale(
itemShelvingFk, itemShelvingFk,
saleFk, saleFk,

View File

@ -1,48 +1,64 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_getSimilar`( CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_getSimilar`(
vSelf INT, vSelf INT,
vWarehouseFk INT, vWarehouseFk INT,
vDated DATE, vDated DATE,
vShowType BOOL vShowType BOOL,
vDaysInForward INT
) )
BEGIN BEGIN
/** /**
* Propone articulos disponibles ordenados, con la cantidad * Propone articulos ordenados, con la cantidad
* de veces usado y segun sus caracteristicas. * de veces usado y segun sus caracteristicas.
* *
* @param vSelf Id de artículo * @param vSelf Id de artículo
* @param vWarehouseFk Id de almacen * @param vWarehouseFk Id de almacen
* @param vDated Fecha * @param vDated Fecha
* @param vShowType Mostrar tipos * @param vShowType Mostrar tipos
* @param vDaysInForward Días de alcance para las ventas
*/ */
DECLARE vAvailableCalcFk INT; DECLARE vAvailableCalcFk INT;
DECLARE vVisibleCalcFk INT; DECLARE vPriority INT DEFAULT 1;
DECLARE vTypeFk INT;
DECLARE vPriority INT DEFAULT 1;
CALL cache.available_refresh(vAvailableCalcFk, FALSE, vWarehouseFk, vDated); CALL cache.available_refresh(vAvailableCalcFk, FALSE, vWarehouseFk, vDated);
CALL cache.visible_refresh(vVisibleCalcFk, FALSE, vWarehouseFk);
WITH itemTags AS ( WITH itemTags AS (
SELECT i.id, SELECT i.id,
typeFk, typeFk,
tag5, tag5,
value5, value5,
tag6, tag6,
value6, value6,
tag7, tag7,
value7, value7,
tag8, tag8,
value8, value8,
t.name, t.name,
it.value it.value
FROM vn.item i FROM vn.item i
LEFT JOIN vn.itemTag it ON it.itemFk = i.id LEFT JOIN vn.itemTag it ON it.itemFk = i.id
AND it.priority = vPriority AND it.priority = vPriority
LEFT JOIN vn.tag t ON t.id = it.tagFk LEFT JOIN vn.tag t ON t.id = it.tagFk
WHERE i.id = vSelf WHERE i.id = vSelf
) ),
SELECT i.id itemFk, stock AS (
SELECT itemFk, SUM(visible) stock
FROM vn.itemShelvingStock
WHERE warehouseFk = vWarehouseFk
GROUP BY itemFk
),
sold AS (
SELECT SUM(s.quantity) quantity, s.itemFk
FROM vn.sale s
JOIN vn.ticket t ON t.id = s.ticketFk
LEFT JOIN vn.itemShelvingSale iss ON iss.saleFk = s.id
WHERE t.shipped BETWEEN CURDATE() AND CURDATE() + INTERVAL vDaysInForward DAY
AND iss.saleFk IS NULL
AND t.warehouseFk = vWarehouseFk
GROUP BY s.itemFk
)
SELECT i.id itemFk,
CAST(sd.quantity AS INT) advanceable,
i.longName, i.longName,
i.subName, i.subName,
i.tag5, i.tag5,
@ -64,13 +80,13 @@ BEGIN
WHEN b.groupingMode = 'packing' THEN b.packing WHEN b.groupingMode = 'packing' THEN b.packing
ELSE 1 ELSE 1
END minQuantity, END minQuantity,
v.visible located, sk.stock located,
b.price2 b.price2
FROM vn.item i FROM vn.item i
LEFT JOIN sold sd ON sd.itemFk = i.id
JOIN cache.available a ON a.item_id = i.id JOIN cache.available a ON a.item_id = i.id
AND a.calc_id = vAvailableCalcFk AND a.calc_id = vAvailableCalcFk
LEFT JOIN cache.visible v ON v.item_id = i.id LEFT JOIN stock sk ON sk.itemFk = i.id
AND v.calc_id = vVisibleCalcFk
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id LEFT JOIN cache.last_buy lb ON lb.item_id = i.id
AND lb.warehouse_id = vWarehouseFk AND lb.warehouse_id = vWarehouseFk
LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id
@ -80,20 +96,21 @@ BEGIN
LEFT JOIN vn.tag t ON t.id = it.tagFk LEFT JOIN vn.tag t ON t.id = it.tagFk
LEFT JOIN vn.buy b ON b.id = lb.buy_id LEFT JOIN vn.buy b ON b.id = lb.buy_id
JOIN itemTags its JOIN itemTags its
WHERE a.available > 0 WHERE (a.available > 0 OR sd.quantity < sk.stock)
AND (i.typeFk = its.typeFk OR NOT vShowType) AND (i.typeFk = its.typeFk OR NOT vShowType)
AND i.id <> vSelf AND i.id <> vSelf
ORDER BY `counter` DESC, ORDER BY (a.available > 0) DESC,
(t.name = its.name) DESC, `counter` DESC,
(it.value = its.value) DESC, (t.name = its.name) DESC,
(i.tag5 = its.tag5) DESC, (it.value = its.value) DESC,
match5 DESC, (i.tag5 = its.tag5) DESC,
(i.tag6 = its.tag6) DESC, match5 DESC,
match6 DESC, (i.tag6 = its.tag6) DESC,
(i.tag7 = its.tag7) DESC, match6 DESC,
match7 DESC, (i.tag7 = its.tag7) DESC,
(i.tag8 = its.tag8) DESC, match7 DESC,
match8 DESC (i.tag8 = its.tag8) DESC,
match8 DESC
LIMIT 100; LIMIT 100;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -276,7 +276,8 @@ proc: BEGIN
JOIN productionConfig pc JOIN productionConfig pc
SET hasPlantTray = TRUE SET hasPlantTray = TRUE
WHERE ic.code = 'plant' WHERE ic.code = 'plant'
AND p.`depth` >= pc.minPlantTrayLength; AND p.`depth` >= pc.minPlantTrayLength
AND pb.isOwn;
DROP TEMPORARY TABLE DROP TEMPORARY TABLE
tmp.productionTicket, tmp.productionTicket,

View File

@ -64,14 +64,14 @@ BEGIN
c.code, c.code,
'invoiceIn' statementType 'invoiceIn' statementType
FROM invoiceIn ii FROM invoiceIn ii
JOIN invoiceInDueDay iid ON iid.invoiceInFk = ii.id LEFT JOIN invoiceInDueDay iid ON iid.invoiceInFk = ii.id
JOIN currency c ON c.id = ii.currencyFk JOIN currency c ON c.id = ii.currencyFk
WHERE ii.issued >= vBalanceStartingDate WHERE ii.issued >= vBalanceStartingDate
AND ii.supplierFk = vSupplierFk AND ii.supplierFk = vSupplierFk
AND vCurrencyFk IN (ii.currencyFk, 0) AND vCurrencyFk IN (ii.currencyFk, 0)
AND vCompanyFk IN (ii.companyFk, 0) AND vCompanyFk IN (ii.companyFk, 0)
AND (vIsConciliated = ii.isBooked OR NOT vIsConciliated) AND (vIsConciliated = ii.isBooked OR NOT vIsConciliated)
GROUP BY iid.id GROUP BY iid.id, ii.id
UNION ALL UNION ALL
SELECT p.bankFk, SELECT p.bankFk,
p.companyFk, p.companyFk,

View File

@ -10,6 +10,7 @@ BEGIN
* *
* @param vSelf Id ticket * @param vSelf Id ticket
* @param vOriginalItemPackingTypeFk Tipo empaquetado al que se mantiene el ticket original * @param vOriginalItemPackingTypeFk Tipo empaquetado al que se mantiene el ticket original
* @return table tmp.ticketIPT(ticketFk, itemPackingTypeFk)
*/ */
DECLARE vDone INT DEFAULT FALSE; DECLARE vDone INT DEFAULT FALSE;
DECLARE vHasItemPackingType BOOL; DECLARE vHasItemPackingType BOOL;
@ -72,6 +73,16 @@ BEGIN
SET s.ticketFk = stm.ticketFk SET s.ticketFk = stm.ticketFk
WHERE stm.ticketFk; WHERE stm.ticketFk;
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketIPT(
ticketFk INT,
itemPackingTypeFk VARCHAR(1)
) ENGINE=MEMORY
SELECT ticketFk, itemPackingTypeFk
FROM tSalesToMove
GROUP BY ticketFk
UNION
SELECT vSelf, vOriginalItemPackingTypeFk;
DROP TEMPORARY TABLE tSalesToMove; DROP TEMPORARY TABLE tSalesToMove;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -0,0 +1,4 @@
-- Place your SQL code here
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
VALUES ('WorkerTimeControlMail', 'count', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Worker', '__get__mail', 'READ', 'ALLOW', 'ROLE', 'hr');

View File

@ -1,3 +1,2 @@
-- Place your SQL code here ALTER TABLE vn.productionConfig ADD IF NOT EXISTS minPlantTrayLength INT DEFAULT 53 NOT NULL
ALTER TABLE vn.productionConfig ADD minPlantTrayLength INT DEFAULT 53 NOT NULL
COMMENT 'minimum length for plant tray restriction. Avoid to make collection of the ticket with this kind of item'; COMMENT 'minimum length for plant tray restriction. Avoid to make collection of the ticket with this kind of item';

View File

@ -0,0 +1,13 @@
ALTER TABLE `vn`.`payrollWorkCenter` DROP PRIMARY KEY;
ALTER TABLE `vn`.`payrollWorkCenter` DROP COLUMN `empresa_id__`;
ALTER TABLE `vn`.`payrollWorkCenter` DROP COLUMN `Centro__`;
ALTER TABLE `vn`.`payrollWorkCenter` DROP COLUMN `nss_cotizacion__`;
ALTER TABLE `vn`.`payrollWorkCenter` DROP COLUMN `domicilio__`;
ALTER TABLE `vn`.`payrollWorkCenter` DROP COLUMN `poblacion__`;
ALTER TABLE `vn`.`payrollWorkCenter` DROP COLUMN `cp__`;
ALTER TABLE `vn`.`payrollWorker` DROP COLUMN `nss__`;
ALTER TABLE `vn`.`payrollWorker` DROP COLUMN `codpuesto__`;
ALTER TABLE `vn`.`payrollWorker` DROP COLUMN `codcontrato__`;
ALTER TABLE `vn`.`payrollWorker` DROP COLUMN `FAntiguedad__`;
ALTER TABLE `vn`.`payrollWorker` DROP COLUMN `codcategoria__`;
ALTER TABLE `vn`.`payrollWorker` DROP COLUMN `ContratoTemporal__`;

View File

@ -0,0 +1,19 @@
ALTER TABLE vn.addressWaste
MODIFY COLUMN `type` enum('external', 'fault', 'container', 'break', 'other')
CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL;
UPDATE vn.addressWaste
SET `type`='container'
WHERE addressFk=77;
UPDATE vn.addressWaste
SET `type`='fault'
WHERE addressFk=317;
UPDATE vn.addressWaste
SET `type`='break'
WHERE addressFk=57702;
UPDATE vn.addressWaste
SET `type`='other'
WHERE addressFk=43432;

View File

@ -0,0 +1,6 @@
ALTER TABLE bs.waste
DROP COLUMN saleInternalWaste,
ADD saleFaultWaste decimal(10,2) DEFAULT NULL NULL,
ADD saleContainerWaste decimal(10,2) DEFAULT NULL NULL,
ADD saleBreakWaste decimal(10,2) DEFAULT NULL NULL,
ADD saleOtherWaste decimal(10,2) DEFAULT NULL NULL;

View File

@ -52,7 +52,13 @@ module.exports = Self => {
it.name family, it.name family,
w.itemFk, w.itemFk,
SUM(w.saleTotal) total, SUM(w.saleTotal) total,
SUM(w.saleInternalWaste + w.saleExternalWaste) dwindle SUM(
w.saleExternalWaste +
w.saleFaultWaste +
w.saleContainerWaste +
w.saleBreakWaste +
w.saleOtherWaste
) dwindle
FROM bs.waste w FROM bs.waste w
JOIN account.user u ON u.id = w.buyerFk JOIN account.user u ON u.id = w.buyerFk
JOIN vn.itemType it ON it.id = w.itemTypeFk JOIN vn.itemType it ON it.id = w.itemTypeFk

View File

@ -28,7 +28,13 @@ module.exports = Self => {
it.name family, it.name family,
w.itemFk, w.itemFk,
SUM(w.saleTotal) total, SUM(w.saleTotal) total,
SUM(w.saleInternalWaste + w.saleExternalWaste) dwindle SUM(
w.saleExternalWaste +
w.saleFaultWaste +
w.saleContainerWaste +
w.saleBreakWaste +
w.saleOtherWaste
) dwindle
FROM bs.waste w FROM bs.waste w
JOIN account.user u ON u.id = w.buyerFk JOIN account.user u ON u.id = w.buyerFk
JOIN vn.itemType it ON it.id = w.itemTypeFk JOIN vn.itemType it ON it.id = w.itemTypeFk
@ -44,7 +50,13 @@ module.exports = Self => {
FROM ( FROM (
SELECT u.name buyer, SELECT u.name buyer,
SUM(w.saleTotal) total, SUM(w.saleTotal) total,
SUM(w.saleInternalWaste + w.saleExternalWaste) dwindle SUM(
w.saleExternalWaste +
w.saleFaultWaste +
w.saleContainerWaste +
w.saleBreakWaste +
w.saleOtherWaste
) dwindle
FROM bs.waste w FROM bs.waste w
JOIN account.user u ON u.id = w.buyerFk JOIN account.user u ON u.id = w.buyerFk
WHERE w.year = YEAR(TIMESTAMPADD(WEEK, -1, ?)) WHERE w.year = YEAR(TIMESTAMPADD(WEEK, -1, ?))

View File

@ -32,13 +32,5 @@
"sendedCounter": { "sendedCounter": {
"type": "number" "type": "number"
} }
}, }
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "employee",
"permission": "ALLOW"
}
]
} }

View File

@ -130,6 +130,11 @@
"type": "hasMany", "type": "hasMany",
"model": "TrainingCourse", "model": "TrainingCourse",
"foreignKey": "workerFk" "foreignKey": "workerFk"
},
"mail": {
"type": "hasMany",
"model": "WorkerTimeControlMail",
"foreignKey": "workerFk"
} }
}, },
"acls": [ "acls": [
@ -139,6 +144,13 @@
"permission": "ALLOW", "permission": "ALLOW",
"principalType": "ROLE", "principalType": "ROLE",
"principalId": "$owner" "principalId": "$owner"
},
{
"property": "__get__mail",
"accessType": "READ",
"permission": "ALLOW",
"principalType": "ROLE",
"principalId": "$owner"
} }
], ],
"scopes": { "scopes": {

View File

@ -1,8 +1,14 @@
SELECT *, 100 * dwindle / total `percentage` SELECT *, 100 * dwindle / total `percentage`
FROM ( FROM (
SELECT u.name buyer, SELECT u.name buyer,
SUM(saleTotal) total, SUM(w.saleTotal) total,
SUM(w.saleInternalWaste + w.saleExternalWaste) dwindle SUM(
w.saleExternalWaste +
w.saleFaultWaste +
w.saleContainerWaste +
w.saleBreakWaste +
w.saleOtherWaste
) dwindle
FROM bs.waste w FROM bs.waste w
JOIN account.user u ON u.id = w.buyerFk JOIN account.user u ON u.id = w.buyerFk
JOIN vn.itemType it ON it.id = w.itemTypeFk JOIN vn.itemType it ON it.id = w.itemTypeFk