Compare commits
118 Commits
510fffb61a
...
80851e094d
Author | SHA1 | Date |
---|---|---|
Javi Gallego | 80851e094d | |
Ivan Mas | fee9bbe387 | |
Ivan Mas | b2fa7e7caf | |
Jon Elias | 9cd16981e6 | |
Alex Moreno | 0ac46882be | |
Alex Moreno | f5b16ca36d | |
Carlos Satorres | 2098ea7163 | |
Ivan Mas | 0274c01c14 | |
Ivan Mas | 830573e229 | |
Carlos Satorres | 82f4815282 | |
Guillermo Bonet | 69bdf8efb2 | |
Sergio De la torre | a8dea64bc1 | |
Sergio De la torre | 9fbffe8a6b | |
Carlos Satorres | d46683cd31 | |
Carlos Satorres | 7ab1b7d171 | |
Carlos Satorres | df249b05d3 | |
Pablo Natek | cde3c8c50a | |
Guillermo Bonet | 42a27f3407 | |
Guillermo Bonet | d302a9c3ba | |
Guillermo Bonet | 917e3128a9 | |
Guillermo Bonet | 22ce7a4dd4 | |
Guillermo Bonet | a4b568e9b8 | |
Carlos Satorres | 91164624bc | |
Carlos Satorres | be311c0557 | |
Jorge Penadés | e4317a385c | |
Jorge Penadés | 3cce342d9d | |
Pablo Natek | 5e52b3b596 | |
Carlos Andrés | ad345a0b91 | |
Ivan Mas | 715cea0670 | |
Ivan Mas | a9d45bde4c | |
Alex Moreno | 46148d7ba3 | |
Alex Moreno | 033e269a5d | |
Carlos Andrés | 63c0747304 | |
Carlos Andrés | 953bc84a58 | |
Jon Elias | 492c79de46 | |
Jon Elias | 149524f4fd | |
Jon Elias | f145649fc7 | |
Carlos Andrés | 6a43d3c752 | |
Jorge Penadés | 2335b57e05 | |
Jorge Penadés | c31fa7e9cf | |
Alex Moreno | 60734136c3 | |
Sergio De la torre | f192b92c6a | |
Robert Ferrús | b29053e850 | |
Jorge Penadés | f89080d373 | |
Sergio De la torre | feb11c123e | |
Sergio De la torre | d21b42a567 | |
Robert Ferrús | 7b5e474d24 | |
Alex Moreno | 6a65ab42ce | |
Alex Moreno | 562d3b0f70 | |
Pablo Natek | a3f92a284f | |
Pablo Natek | 2f93da199a | |
Alex Moreno | 413e9e1e9f | |
Alex Moreno | 7f39edf014 | |
Pablo Natek | 0d205eb6ce | |
Sergio De la torre | f3e5806990 | |
Sergio De la torre | 6a94848007 | |
Sergio De la torre | 38f2421de0 | |
Sergio De la torre | 8840d57041 | |
Sergio De la torre | 2335ef754a | |
Javi Gallego | 7a9bcf11e2 | |
Pablo Natek | b70b69557e | |
Pablo Natek | 4e7a96442a | |
Pablo Natek | 33d9ba9b44 | |
Pablo Natek | 056b5adddc | |
Alex Moreno | 28ee32a411 | |
Carlos Satorres | 6b0d7762b4 | |
Carlos Satorres | 2790e92741 | |
Carlos Satorres | 6619ec451c | |
Pablo Natek | d2b545aaae | |
Ivan Mas | 2a1c0ef2af | |
Ivan Mas | 6a11416838 | |
Jon Elias | d2ea0a4bbd | |
Jon Elias | 7d7c66de89 | |
Jon Elias | 4783cc23ac | |
Jon Elias | af781d4c1a | |
Jon Elias | 6ed521ae5e | |
Pablo Natek | 60f989b566 | |
Pablo Natek | d8e728e823 | |
Pablo Natek | 9ac54f463a | |
Jon Elias | 66149a69a7 | |
Jon Elias | 7be1bc385f | |
Jon Elias | dcae6dfbb4 | |
Jon Elias | ea4adbea85 | |
Jon Elias | 0f913d8975 | |
Ivan Mas | 870882cdc1 | |
Ivan Mas | 20bd426704 | |
Carlos Andrés | b8f2e0b906 | |
Carlos Andrés | 358ed2513d | |
Carlos Andrés | 69d6e4a104 | |
Sergio De la torre | 3a8c37aef8 | |
Carlos Andrés | cf102699d5 | |
Jon Elias | bb7cecdcff | |
Jon Elias | 1e8a7eff60 | |
Jon Elias | 25891e0bad | |
Pablo Natek | 0c20aea45f | |
Pablo Natek | 39f7391abf | |
Pablo Natek | fc61f7e4ab | |
Carlos Satorres | 73efb8f1a8 | |
Carlos Satorres | fa108e2af0 | |
Carlos Satorres | c5afde3334 | |
Carlos Satorres | e0e487859f | |
Carlos Satorres | ca6d8a67cb | |
Carlos Satorres | 6b10f60933 | |
Carlos Satorres | 55a409c680 | |
Carlos Satorres | 248ae64872 | |
Pablo Natek | 838dd9e1b4 | |
Carlos Satorres | 903d85a243 | |
Carlos Satorres | 0a726a8fe7 | |
Sergio De la torre | 989b68c33a | |
Pablo Natek | 78ee7e141d | |
Pablo Natek | a35c10adab | |
Pablo Natek | 3ce8d21ed3 | |
Carlos Satorres | 60375d153f | |
Carlos Satorres | 355ce46393 | |
Carlos Satorres | 5da6c09f68 | |
Carlos Satorres | c0ee82fd4f | |
Carlos Satorres | 1a01b3e587 | |
Guillermo Bonet | 33f1ed360b |
|
@ -29,10 +29,8 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.getSales = async(ctx, collectionOrTicketFk, print, source, options) => {
|
Self.getSales = async(ctx, collectionOrTicketFk, print, source, options) => {
|
||||||
const models = Self.app.models;
|
|
||||||
const userId = ctx.req.accessToken.userId;
|
const userId = ctx.req.accessToken.userId;
|
||||||
const myOptions = {userId};
|
const myOptions = {userId};
|
||||||
const $t = ctx.req.__;
|
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
@ -59,22 +57,6 @@ module.exports = Self => {
|
||||||
|
|
||||||
if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions);
|
if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions);
|
||||||
|
|
||||||
for (let ticket of tickets) {
|
|
||||||
if (ticket.observaciones) {
|
|
||||||
let observations = ticket.observaciones.split(' ');
|
|
||||||
|
|
||||||
for (let observation of observations) {
|
|
||||||
const salesPerson = ticket.salesPersonFk;
|
|
||||||
if (observation.startsWith('#') || observation.startsWith('@')) {
|
|
||||||
await models.Chat.send(ctx,
|
|
||||||
observation,
|
|
||||||
$t('ticketCommercial', {ticket: ticket.ticketFk, salesPerson})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return getCollection(id, tickets, sales, placements, myOptions);
|
return getCollection(id, tickets, sales, placements, myOptions);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -57,10 +57,10 @@ module.exports = Self => {
|
||||||
ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY pickingOrder) currentItemShelving,
|
ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY pickingOrder) currentItemShelving,
|
||||||
COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) totalItemShelving,
|
COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) totalItemShelving,
|
||||||
sh.code,
|
sh.code,
|
||||||
p2.code parkingCode,
|
p2.code parkingCodePrevia,
|
||||||
p2.pickingOrder pickingOrder,
|
p2.pickingOrder pickingOrderPrevia,
|
||||||
p.code parkingCodePrevia,
|
p.code parkingCode,
|
||||||
p.pickingOrder pickingOrderPrevia,
|
p.pickingOrder pickingOrder,
|
||||||
iss.id itemShelvingSaleFk,
|
iss.id itemShelvingSaleFk,
|
||||||
iss.isPicked,
|
iss.isPicked,
|
||||||
iss.itemShelvingFk
|
iss.itemShelvingFk
|
||||||
|
|
|
@ -31,7 +31,7 @@ module.exports = Self => {
|
||||||
return await Self.rawSql(`
|
return await Self.rawSql(`
|
||||||
INSERT INTO workerActivity (workerFk, workerActivityTypeFk, model)
|
INSERT INTO workerActivity (workerFk, workerActivityTypeFk, model)
|
||||||
SELECT ?, ?, ?
|
SELECT ?, ?, ?
|
||||||
FROM workerTimeControlParams wtcp
|
FROM workerTimeControlConfig wtcc
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT wa.workerFk,
|
SELECT wa.workerFk,
|
||||||
wa.created,
|
wa.created,
|
||||||
|
@ -44,7 +44,7 @@ module.exports = Self => {
|
||||||
) sub ON TRUE
|
) sub ON TRUE
|
||||||
WHERE sub.workerFk IS NULL
|
WHERE sub.workerFk IS NULL
|
||||||
OR sub.code <> ?
|
OR sub.code <> ?
|
||||||
OR TIMESTAMPDIFF(SECOND, sub.created, util.VN_NOW()) > wtcp.dayBreak;`
|
OR TIMESTAMPDIFF(SECOND, sub.created, util.VN_NOW()) > wtcc.dayBreak;`
|
||||||
, [userId, code, model, userId, code], myOptions);
|
, [userId, code, model, userId, code], myOptions);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1506,18 +1506,18 @@ INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk
|
||||||
(10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1);
|
(10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `evaNotes`, `typeFk`)
|
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `evaNotes`, `typeFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, '', 'packaging'),
|
(1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, '', 'packaging'),
|
||||||
(2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 'observation two', 'product'),
|
(2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 'observation two', 'product'),
|
||||||
(3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 'observation three', 'product'),
|
(3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 'observation three', 'product'),
|
||||||
(4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 'observation four', 'product'),
|
(4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 'observation four', 'product'),
|
||||||
(5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 'observation five', 'product'),
|
(5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 'observation five', 'product'),
|
||||||
(6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 'observation six', 'product'),
|
(6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 'observation six', 'product'),
|
||||||
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 'observation seven', 'product'),
|
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 'observation seven', 'product'),
|
||||||
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, '', 'product'),
|
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, '', 'product'),
|
||||||
(9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, '', 'product'),
|
(9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, '', 'product'),
|
||||||
(10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 10', 1, '', 'product'),
|
(10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 10', 1, '', 'product'),
|
||||||
(99, 69, util.VN_CURDATE() - INTERVAL 1 MONTH, 11, 0, 442, 'IN2009', 'Movement 99', 0, '', 'product');
|
(99, 69, util.VN_CURDATE() - INTERVAL 1 MONTH, 11, 0, 442, 'IN2009', 'Movement 99', 0, '', 'product');
|
||||||
|
|
||||||
INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyModeFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`, `awbFK`, `daysInForward`)
|
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, NULL),
|
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),
|
||||||
|
@ -2521,10 +2521,6 @@ INSERT INTO `vn`.`queuePriority`(`id`, `priority`, `code`)
|
||||||
(2, 'Normal', 'normal'),
|
(2, 'Normal', 'normal'),
|
||||||
(3, 'Baja', 'low');
|
(3, 'Baja', 'low');
|
||||||
|
|
||||||
INSERT INTO `vn`.`workerTimeControlParams` (`id`, `dayBreak`, `weekBreak`, `weekScope`, `dayWorkMax`, `dayStayMax`, `weekMaxBreak`, `weekMaxScope`, `askInOut`)
|
|
||||||
VALUES
|
|
||||||
(1, 43200, 129600, 734400, 43200, 50400, 259200, 1296000, 36000);
|
|
||||||
|
|
||||||
INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11');
|
INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11');
|
||||||
|
|
||||||
INSERT INTO `vn`.`thermograph`(`id`, `model`)
|
INSERT INTO `vn`.`thermograph`(`id`, `model`)
|
||||||
|
@ -4008,6 +4004,13 @@ INSERT IGNORE INTO pbx.queueMember
|
||||||
UPDATE vn.department SET pbxQueue = '1000' WHERE name = "CAMARA";
|
UPDATE vn.department SET pbxQueue = '1000' WHERE name = "CAMARA";
|
||||||
UPDATE vn.department SET pbxQueue = '2000' WHERE name = "VENTAS";
|
UPDATE vn.department SET pbxQueue = '2000' WHERE name = "VENTAS";
|
||||||
|
|
||||||
|
INSERT INTO vn.workerRelatives (workerFk, isDescendant, disabilityGradeFk, birthed, adoptionYear, isDependend, isJointCustody, updated)
|
||||||
|
VALUES
|
||||||
|
(1106, 1, NULL, 0, NULL, 0, 0, '2024-10-29 08:42:44.000');
|
||||||
|
INSERT INTO vn.routeAction (id, name, price, isMainlineDelivered) VALUES(1, 'Pintar traje', 50.00, 0);
|
||||||
|
INSERT INTO vn.routeComplement (id, dated, workerFk, price, routeActionFk) VALUES(1, util.VN_CURDATE(), 9, 50.00, 1);
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO srt.buffer (id, x, y, `size`, `length`, stateFk, typeFk, isActive, code, stratus, hasWorkerWaiting, reserve, routeFk, dayMinute, lastUnloaded, hasStrapper, typeDefaultFk, motors, editorFk)
|
INSERT INTO srt.buffer (id, x, y, `size`, `length`, stateFk, typeFk, isActive, code, stratus, hasWorkerWaiting, reserve, routeFk, dayMinute, lastUnloaded, hasStrapper, typeDefaultFk, motors, editorFk)
|
||||||
VALUES (0, 0, 0, 0, NULL, 3, 1, 0, 'ENT', 0, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
|
VALUES (0, 0, 0, 0, NULL, 3, 1, 0, 'ENT', 0, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
|
||||||
(1, 0, 9900, 0, NULL, 1, 0, 0, 'NOK', 0, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
|
(1, 0, 9900, 0, NULL, 1, 0, 0, 'NOK', 0, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
|
||||||
|
@ -4027,4 +4030,6 @@ INSERT IGNORE INTO vn.saySimpleCountry (countryFk, channel)
|
||||||
(8, '1183');
|
(8, '1183');
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.saySimpleConfig (url, defaultChannel)
|
INSERT IGNORE INTO vn.saySimpleConfig (url, defaultChannel)
|
||||||
VALUES ('saysimle-url-mock', 1320);
|
VALUES ('saysimle-url-mock', 1320);INSERT INTO vn.workerIrpf (workerFk,spouseNif,geographicMobilityDate)
|
||||||
|
VALUES
|
||||||
|
(1106,'26493101E','2019-09-20');
|
||||||
|
|
|
@ -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 t.daysInForward
|
AND NOT t.isRaid
|
||||||
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
|
||||||
|
|
|
@ -14,7 +14,7 @@ BEGIN
|
||||||
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 tr.daysInForward
|
AND tr.isRaid
|
||||||
AND tr.landed >= util.VN_CURDATE();
|
AND tr.landed >= util.VN_CURDATE();
|
||||||
|
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -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 t.daysInForward
|
AND NOT t.isRaid
|
||||||
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 t.daysInForward
|
AND NOT t.isRaid
|
||||||
AND t.isDelivered
|
AND t.isDelivered
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT m.itemFk, -m.quantity
|
SELECT m.itemFk, -m.quantity
|
||||||
|
|
|
@ -6,12 +6,11 @@ BEGIN
|
||||||
DROP TEMPORARY TABLE IF EXISTS tValues;
|
DROP TEMPORARY TABLE IF EXISTS tValues;
|
||||||
CREATE TEMPORARY TABLE tValues
|
CREATE TEMPORARY TABLE tValues
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT
|
SELECT b.id buyFk,
|
||||||
b.id buyFk,
|
|
||||||
e.id entryFk,
|
e.id entryFk,
|
||||||
t.id travelFk,
|
t.id travelFk,
|
||||||
b.itemFk,
|
b.itemFk,
|
||||||
t.daysInForward,
|
t.isRaid,
|
||||||
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 +49,7 @@ BEGIN
|
||||||
itemFk,
|
itemFk,
|
||||||
TIMESTAMPADD(DAY, life, @dated),
|
TIMESTAMPADD(DAY, life, @dated),
|
||||||
quantity,
|
quantity,
|
||||||
IF(isIn, isReceived, isDelivered) AND NOT daysInForward
|
IF(isIn, isReceived, isDelivered) AND NOT isRaid
|
||||||
FROM tValues
|
FROM tValues
|
||||||
WHERE isIn OR !lessThanInventory;
|
WHERE isIn OR !lessThanInventory;
|
||||||
|
|
||||||
|
@ -65,7 +64,7 @@ BEGIN
|
||||||
itemFk,
|
itemFk,
|
||||||
created,
|
created,
|
||||||
quantity,
|
quantity,
|
||||||
IF(isIn, isDelivered, isReceived) AND NOT daysInForward
|
IF(isIn, isDelivered, isReceived) AND NOT isRaid
|
||||||
FROM tValues
|
FROM tValues
|
||||||
WHERE !isIn OR !lessThanInventory;
|
WHERE !isIn OR !lessThanInventory;
|
||||||
|
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`timeWorkerControl_getDirection`(vUserFk INT, vTimed DATETIME)
|
|
||||||
RETURNS varchar(6) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
|
|
||||||
NOT DETERMINISTIC
|
|
||||||
READS SQL DATA
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Verifica la dirección de la fichada
|
|
||||||
* @param vUserFk Identificador del trabajador
|
|
||||||
* @param vTimed Hora de la fichada
|
|
||||||
* @return Retorna sentido de la fichada 'in, out, middle'
|
|
||||||
*/
|
|
||||||
|
|
||||||
DECLARE vPrevious DATETIME ;
|
|
||||||
DECLARE vNext DATETIME ;
|
|
||||||
DECLARE vPreviousDirection VARCHAR(3) ;
|
|
||||||
DECLARE vNextDirection VARCHAR(3) ;
|
|
||||||
DECLARE vDayStayMax INT;
|
|
||||||
DECLARE vTimedSeconds INT;
|
|
||||||
DECLARE vLastTimeIn INT;
|
|
||||||
|
|
||||||
SELECT UNIX_TIMESTAMP(vTimed) INTO vTimedSeconds;
|
|
||||||
|
|
||||||
SELECT dayStayMax INTO vDayStayMax
|
|
||||||
FROM vn.workerTimeControlParams;
|
|
||||||
|
|
||||||
SELECT timed, direction INTO vNext,vNextDirection
|
|
||||||
FROM vn.workerTimeControl
|
|
||||||
WHERE userFk = vUserFk
|
|
||||||
AND direction IN ('in','out')
|
|
||||||
AND timed > vTimed
|
|
||||||
ORDER BY timed ASC
|
|
||||||
LIMIT 1;
|
|
||||||
|
|
||||||
SELECT timed, direction INTO vPrevious, vPreviousDirection
|
|
||||||
FROM vn.workerTimeControl
|
|
||||||
WHERE userFk = vUserFk
|
|
||||||
AND direction IN ('in','out')
|
|
||||||
AND timed < vTimed
|
|
||||||
ORDER BY timed DESC
|
|
||||||
LIMIT 1;
|
|
||||||
|
|
||||||
IF (vTimedSeconds - UNIX_TIMESTAMP(vPrevious) + UNIX_TIMESTAMP(vNext) - vTimedSeconds)<= vDayStayMax AND vPreviousDirection = 'in' AND vNextDirection = 'out' THEN
|
|
||||||
RETURN 'middle';
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
|
|
||||||
IF (vTimedSeconds> UNIX_TIMESTAMP(vPrevious)) THEN
|
|
||||||
IF vPreviousDirection = 'in' THEN
|
|
||||||
RETURN 'out';
|
|
||||||
ELSE
|
|
||||||
SELECT UNIX_TIMESTAMP(MAX(timed)) INTO vLastTimeIn
|
|
||||||
FROM vn.workerTimeControl
|
|
||||||
WHERE userFk = vUserFk
|
|
||||||
AND direction ='in'
|
|
||||||
AND timed < vPrevious;
|
|
||||||
IF vTimedSeconds - vLastTimeIn <= vDayStayMax THEN
|
|
||||||
RETURN 'out';
|
|
||||||
END IF;
|
|
||||||
END IF;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
RETURN 'in';
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -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 tr.daysInForward
|
AND NOT tr.isRaid
|
||||||
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 tr.daysInForward
|
AND NOT tr.isRaid
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT t.shipped,
|
SELECT t.shipped,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -42,7 +42,7 @@ 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 t.daysInForward
|
AND NOT t.isRaid
|
||||||
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
|
||||||
|
@ -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 tr.daysInForward
|
AND NOT tr.isRaid
|
||||||
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 t.daysInForward
|
AND NOT t.isRaid
|
||||||
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)
|
||||||
|
|
|
@ -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 tr.daysInForward
|
AND NOT tr.isRaid
|
||||||
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;
|
||||||
|
|
||||||
|
|
|
@ -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 tr.daysInForward
|
AND NOT tr.isRaid
|
||||||
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 tr.daysInForward
|
AND NOT tr.isRaid
|
||||||
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;
|
||||||
|
|
|
@ -3,7 +3,8 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingSale_setQ
|
||||||
vItemShelvingSaleFk INT(10),
|
vItemShelvingSaleFk INT(10),
|
||||||
vQuantity DECIMAL(10,0),
|
vQuantity DECIMAL(10,0),
|
||||||
vIsItemShelvingSaleEmpty BOOLEAN,
|
vIsItemShelvingSaleEmpty BOOLEAN,
|
||||||
vSectorFk INT
|
vSectorFk INT,
|
||||||
|
vShelvingFk VARCHAR(10)
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
|
@ -24,6 +25,7 @@ BEGIN
|
||||||
DECLARE vItemFk INT;
|
DECLARE vItemFk INT;
|
||||||
DECLARE vTotalQuantity INT;
|
DECLARE vTotalQuantity INT;
|
||||||
DECLARE vStateCode VARCHAR(45);
|
DECLARE vStateCode VARCHAR(45);
|
||||||
|
DECLARE vCurrentShelvingFk VARCHAR(10);
|
||||||
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -45,18 +47,26 @@ BEGIN
|
||||||
iss.saleFk,
|
iss.saleFk,
|
||||||
iss.itemShelvingFk,
|
iss.itemShelvingFk,
|
||||||
SUM(IFNULL(iss.quantity,0)),
|
SUM(IFNULL(iss.quantity,0)),
|
||||||
IF(sgd.id, 'PREVIOUS_PREPARATION', 'PREPARED')
|
IF(sgd.id, 'PREVIOUS_PREPARATION', 'PREPARED'),
|
||||||
|
sh.code
|
||||||
INTO vItemFk,
|
INTO vItemFk,
|
||||||
vSaleFk,
|
vSaleFk,
|
||||||
vItemShelvingFk,
|
vItemShelvingFk,
|
||||||
vReservedQuantity,
|
vReservedQuantity,
|
||||||
vStateCode
|
vStateCode,
|
||||||
|
vCurrentShelvingFk
|
||||||
FROM itemShelvingSale iss
|
FROM itemShelvingSale iss
|
||||||
JOIN sale s ON s.id = iss.saleFk
|
JOIN sale s ON s.id = iss.saleFk
|
||||||
LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = iss.saleFk
|
JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
||||||
|
LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = iss.saleFk
|
||||||
|
LEFT JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||||
WHERE iss.id = vItemShelvingSaleFk
|
WHERE iss.id = vItemShelvingSaleFk
|
||||||
AND NOT iss.isPicked;
|
AND NOT iss.isPicked;
|
||||||
|
|
||||||
|
IF NOT (vCurrentShelvingFk <=> vShelvingFk) THEN
|
||||||
|
CALL util.throw('The shelving can not be different from the shelving reserved');
|
||||||
|
END IF;
|
||||||
|
|
||||||
IF vQuantity > vReservedQuantity
|
IF vQuantity > vReservedQuantity
|
||||||
OR (vQuantity < vReservedQuantity AND NOT vIsItemShelvingSaleEmpty)
|
OR (vQuantity < vReservedQuantity AND NOT vIsItemShelvingSaleEmpty)
|
||||||
OR (vQuantity = vReservedQuantity AND vIsItemShelvingSaleEmpty) THEN
|
OR (vQuantity = vReservedQuantity AND vIsItemShelvingSaleEmpty) THEN
|
||||||
|
|
|
@ -21,7 +21,8 @@ BEGIN
|
||||||
ish.isChecked,
|
ish.isChecked,
|
||||||
ic.url,
|
ic.url,
|
||||||
ish.available,
|
ish.available,
|
||||||
ish.buyFk
|
ish.buyFk,
|
||||||
|
sh.shelvingFk
|
||||||
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 s.id = ish.shelvingFk
|
JOIN shelving s ON s.id = ish.shelvingFk
|
||||||
|
|
|
@ -59,7 +59,7 @@ BEGIN
|
||||||
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 tr.daysInForward
|
AND NOT tr.isRaid
|
||||||
),
|
),
|
||||||
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 tr.daysInForward
|
AND NOT tr.isRaid
|
||||||
),
|
),
|
||||||
sales AS (
|
sales AS (
|
||||||
WITH itemSales AS (
|
WITH itemSales AS (
|
||||||
|
|
|
@ -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 t.daysInForward
|
AND NOT t.isRaid
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT r.itemFk,
|
SELECT r.itemFk,
|
||||||
r.shipment,
|
r.shipment,
|
||||||
|
|
|
@ -30,7 +30,7 @@ BEGIN
|
||||||
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 t.daysInForward
|
AND NOT t.isRaid
|
||||||
GROUP BY i.id;
|
GROUP BY i.id;
|
||||||
|
|
||||||
UPDATE tmp.itemInventory y
|
UPDATE tmp.itemInventory y
|
||||||
|
|
|
@ -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 tr.daysInForward
|
AND NOT tr.isRaid
|
||||||
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 tr.daysInForward
|
AND NOT tr.isRaid
|
||||||
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)
|
||||||
|
@ -196,7 +196,7 @@ 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 tr.daysInForward
|
AND NOT tr.isRaid
|
||||||
AND wIn.valuatedInventory
|
AND wIn.valuatedInventory
|
||||||
AND t.isInventory
|
AND t.isInventory
|
||||||
AND e.isConfirmed
|
AND e.isConfirmed
|
||||||
|
|
|
@ -60,7 +60,7 @@ proc: BEGIN
|
||||||
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 t.daysInForward
|
AND NOT t.isRaid
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT b.itemFk, - b.quantity
|
SELECT b.itemFk, - b.quantity
|
||||||
FROM buy b
|
FROM buy b
|
||||||
|
@ -71,7 +71,7 @@ proc: BEGIN
|
||||||
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 t.daysInForward
|
AND NOT t.isRaid
|
||||||
) sub
|
) sub
|
||||||
GROUP BY itemFk;
|
GROUP BY itemFk;
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ proc: BEGIN
|
||||||
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 t.daysInForward
|
AND NOT t.isRaid
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT b.itemFk, t.shipped, - b.quantity
|
SELECT b.itemFk, t.shipped, - b.quantity
|
||||||
FROM buy b
|
FROM buy b
|
||||||
|
@ -132,7 +132,7 @@ proc: BEGIN
|
||||||
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 t.daysInForward
|
AND NOT t.isRaid
|
||||||
) sub
|
) sub
|
||||||
GROUP BY sub.itemFk, sub.dated;
|
GROUP BY sub.itemFk, sub.dated;
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ proc: BEGIN
|
||||||
|
|
||||||
UPDATE stockBought s
|
UPDATE stockBought s
|
||||||
JOIN tStockSold ts ON ts.workerFk = s.workerFk
|
JOIN tStockSold ts ON ts.workerFk = s.workerFk
|
||||||
SET s.bought = IF(s.bought < ts.sold, ROUND(s.bought - ts.sold, 1), 0)
|
SET s.bought = IF(s.bought < ABS(ts.sold), 0, ROUND(s.bought - ABS(ts.sold), 1))
|
||||||
WHERE s.dated = vDated;
|
WHERE s.dated = vDated;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tCurrentData, tmp.item, tmp.buyUltimate, tStockSold;
|
DROP TEMPORARY TABLE tCurrentData, tmp.item, tmp.buyUltimate, tStockSold;
|
||||||
|
|
|
@ -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 NOT tr.daysInForward
|
AND NOT tr.isRaid
|
||||||
AND tr.warehouseInFk = vWarehouseFk
|
AND tr.warehouseInFk = vWarehouseFk
|
||||||
GROUP BY tr.landed , a.name ;
|
GROUP BY tr.landed , a.name ;
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_checkRaid`(
|
||||||
|
vIsRaid BOOL,
|
||||||
|
vDaysInForward INT
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Check if the values of isRaid and daysInforward are correct
|
||||||
|
*
|
||||||
|
* @param vIsRaid idRaid value
|
||||||
|
* @param vDaysInForward daysInForward value
|
||||||
|
*/
|
||||||
|
IF (NOT vIsRaid AND vDaysInForward IS NOT NULL) OR (vIsRaid AND vDaysInForward IS NULL) THEN
|
||||||
|
CALL util.throw('The raid information is not correct');
|
||||||
|
END IF;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -37,7 +37,8 @@ BEGIN
|
||||||
SELECT id travelFk,
|
SELECT id travelFk,
|
||||||
util.VN_CURDATE() + INTERVAL daysInForward DAY newLanded
|
util.VN_CURDATE() + INTERVAL daysInForward DAY newLanded
|
||||||
FROM travel
|
FROM travel
|
||||||
WHERE daysInForward;
|
WHERE isRaid
|
||||||
|
AND daysInForward;
|
||||||
|
|
||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
|
|
||||||
|
|
|
@ -1,168 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerTimeControl_check`(vUserFk INT, vDated DATE,vTabletFk VARCHAR(100))
|
|
||||||
proc: BEGIN
|
|
||||||
/**
|
|
||||||
* Verifica si el empleado puede fichar en el momento actual, si puede fichar llama a workerTimeControlAdd
|
|
||||||
*
|
|
||||||
* @param vUserFk Identificador del trabajador
|
|
||||||
* @return Retorna si encuentra un problema 'odd','maxTimeWork','breakDay','breakWeek' ;
|
|
||||||
* En caso de tener algun problema retorna el primero que encuentra
|
|
||||||
*/
|
|
||||||
DECLARE vLastIn DATETIME ;
|
|
||||||
DECLARE vLastOut DATETIME ;
|
|
||||||
DECLARE vDayWorkMax INT;
|
|
||||||
DECLARE vDayBreak INT;
|
|
||||||
DECLARE vWeekBreak INT ;
|
|
||||||
DECLARE vWeekScope INT;
|
|
||||||
DECLARE vDayStayMax INT;
|
|
||||||
DECLARE vProblem VARCHAR(20) DEFAULT NULL;
|
|
||||||
DECLARE vTimedWorked INT;
|
|
||||||
DECLARE vCalendarStateType VARCHAR(20) DEFAULT NULL;
|
|
||||||
DECLARE vDepartmentFk INT;
|
|
||||||
DECLARE vTo VARCHAR(50) DEFAULT NULL;
|
|
||||||
DECLARE vUserName VARCHAR(50) DEFAULT NULL;
|
|
||||||
DECLARE vBody VARCHAR(255) DEFAULT NULL;
|
|
||||||
|
|
||||||
SELECT dayBreak, weekBreak, weekScope, dayWorkMax, dayStayMax
|
|
||||||
INTO vDayBreak, vWeekBreak, vWeekScope, vDayWorkMax, vDayStayMax
|
|
||||||
FROM workerTimeControlParams;
|
|
||||||
|
|
||||||
SELECT MAX(timed) INTO vLastIn
|
|
||||||
FROM workerTimeControl
|
|
||||||
WHERE userFk = vUserFk
|
|
||||||
AND direction = 'in';
|
|
||||||
|
|
||||||
SELECT MAX(timed) INTO vLastOut
|
|
||||||
FROM workerTimeControl
|
|
||||||
WHERE userFk = vUserFk
|
|
||||||
AND direction = 'out';
|
|
||||||
|
|
||||||
SELECT CONCAT(u.name,'@verdnatura.es') INTO vTo
|
|
||||||
FROM account.user u
|
|
||||||
WHERE u.id = (SELECT bossFk FROM worker WHERE id = vUserFk);
|
|
||||||
|
|
||||||
SELECT CONCAT(firstName,' ',lastName) INTO vUserName
|
|
||||||
FROM worker w
|
|
||||||
WHERE w.id = vUserFk;
|
|
||||||
|
|
||||||
|
|
||||||
IF UNIX_TIMESTAMP(util.VN_NOW()) - UNIX_TIMESTAMP(vLastIn) > vDayStayMax THEN -- NUEVA JORNADA
|
|
||||||
|
|
||||||
-- VERIFICAR DESCANSO DIARIO
|
|
||||||
IF UNIX_TIMESTAMP(util.VN_NOW()) - UNIX_TIMESTAMP(vLastOut) < vDayBreak THEN
|
|
||||||
SELECT "Descansos 12 h" AS problem;
|
|
||||||
-- ENVIAMOS CORREO AL BOSSFK
|
|
||||||
SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Descansos 12 h") INTO vBody;
|
|
||||||
CALL mail_insert(vTo,vTo,'error al fichar',vBody);
|
|
||||||
LEAVE proc;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- VERIFICAR FICHADAS IMPARES DEL ÚLTIMO DÍA QUE SE FICHÓ
|
|
||||||
IF (SELECT MOD(COUNT(*),2) -- <>0
|
|
||||||
FROM workerTimeControl
|
|
||||||
WHERE userFk = vUserFk
|
|
||||||
AND timed >= vLastIn
|
|
||||||
) THEN
|
|
||||||
SELECT "Dias con fichadas impares" AS problem;
|
|
||||||
-- ENVIAMOS CORREO AL BOSSFK
|
|
||||||
SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Dias con fichadas impares") INTO vBody;
|
|
||||||
CALL mail_insert(vTo,vTo,'error al fichar',vBody);
|
|
||||||
LEAVE proc;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- VERIFICAR VACACIONES
|
|
||||||
SELECT at2.name INTO vCalendarStateType
|
|
||||||
FROM calendar c
|
|
||||||
JOIN business b ON b.id = c.businessFk
|
|
||||||
JOIN absenceType at2 ON at2.id = c.dayOffTypeFk
|
|
||||||
WHERE c.dated = util.VN_CURDATE()
|
|
||||||
AND at2.isAllowedToWork = FALSE
|
|
||||||
AND b.workerFk = vUserFk
|
|
||||||
LIMIT 1;
|
|
||||||
|
|
||||||
IF(LENGTH(vCalendarStateType)) THEN
|
|
||||||
SELECT vCalendarStateType AS problem;
|
|
||||||
-- ENVIAMOS CORREO AL BOSSFK
|
|
||||||
SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Vacaciones") INTO vBody;
|
|
||||||
CALL mail_insert(vTo,vTo,'error al fichar',vBody);
|
|
||||||
LEAVE proc;
|
|
||||||
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- VERIFICAR CONTRATO EN VIGOR
|
|
||||||
IF (SELECT COUNT(*)
|
|
||||||
FROM business b
|
|
||||||
WHERE b.workerFk = vUserFk
|
|
||||||
AND b.started <= vDated
|
|
||||||
AND IFNULL(b.ended, vDated) >= vDated
|
|
||||||
) = 0 THEN
|
|
||||||
SELECT "No hay un contrato en vigor" AS problem;
|
|
||||||
-- ENVIAMOS CORREO AL BOSSFK
|
|
||||||
SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"No hay un contrato en vigor") INTO vBody;
|
|
||||||
CALL mail_insert(vTo,vTo,'error al fichar',vBody);
|
|
||||||
LEAVE proc;
|
|
||||||
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- VERIFICAR DESCANSO SEMANAL
|
|
||||||
SET @vHasBreakWeek:= FALSE;
|
|
||||||
SET @vLastTimed:= UNIX_TIMESTAMP((util.VN_NOW() - INTERVAL vWeekScope SECOND));
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.trash;
|
|
||||||
CREATE TEMPORARY TABLE tmp.trash
|
|
||||||
SELECT IF(vWeekBreak-(UNIX_TIMESTAMP(timed)-@vLastTimed) <= 0, @vHasBreakWeek:=TRUE, TRUE) alias,
|
|
||||||
@vLastTimed:= UNIX_TIMESTAMP(timed)
|
|
||||||
FROM workerTimeControl
|
|
||||||
WHERE timed>= (util.VN_NOW() - INTERVAL vWeekScope SECOND)
|
|
||||||
AND userFk= vUserFk
|
|
||||||
AND direction IN ('in','out')
|
|
||||||
ORDER BY timed ASC;
|
|
||||||
|
|
||||||
IF UNIX_TIMESTAMP(util.VN_NOW()) - UNIX_TIMESTAMP(vLastOut) < vWeekBreak AND @vHasBreakWeek = FALSE THEN -- REVISA SI EL DESCANSO SE HA REALIZADO DESPUÉS DE LA ÚLTIMA FICHADA
|
|
||||||
SELECT "Descansos 36 h" AS problem;
|
|
||||||
-- ENVIAMOS CORREO AL BOSSFK
|
|
||||||
SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Descansos 36 h") INTO vBody;
|
|
||||||
CALL mail_insert(vTo,vTo,'error al fichar',vBody);
|
|
||||||
LEAVE proc;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.trash;
|
|
||||||
|
|
||||||
ELSE -- DIA ACTUAL
|
|
||||||
|
|
||||||
-- VERIFICA QUE EL TIEMPO EFECTIVO NO SUPERE EL MÁXIMO
|
|
||||||
SELECT IFNULL(SUM(if( mod(wtc.order,2)=1, -UNIX_TIMESTAMP(timed), UNIX_TIMESTAMP(timed))),0) - IF( MOD(COUNT(*),2), UNIX_TIMESTAMP(util.VN_NOW()), 0) INTO vTimedWorked
|
|
||||||
FROM workerTimeControl wtc
|
|
||||||
WHERE userFk = vUserFk
|
|
||||||
AND timed >= vLastIn
|
|
||||||
ORDER BY timed;
|
|
||||||
|
|
||||||
IF vTimedWorked > vDayWorkMax THEN
|
|
||||||
SELECT "Jornadas" AS problem;
|
|
||||||
-- ENVIAMOS CORREO AL BOSSFK
|
|
||||||
SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Jornadas") INTO vBody;
|
|
||||||
CALL mail_insert(vTo,vTo,'error al fichar',vBody);
|
|
||||||
LEAVE proc;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- VERIFICAR DEPARTAMENTO
|
|
||||||
/* IF vTabletFk IS NOT NULL THEN
|
|
||||||
SELECT wtcu.departmentFk INTO vDepartmentFk
|
|
||||||
FROM workerTimeControlUserInfo wtcu
|
|
||||||
WHERE wtcu.userFk = vUserFk;
|
|
||||||
IF (SELECT COUNT(td.tabletFk)
|
|
||||||
FROM tabletDepartment td
|
|
||||||
WHERE td.tabletFk = vTabletFk AND td.departmentFk = vDepartmentFk
|
|
||||||
) = 0 THEN
|
|
||||||
SELECT "No perteneces a este departamento." AS problem;
|
|
||||||
-- ENVIAMOS CORREO AL BOSSFK
|
|
||||||
SELECT CONCAT(vUserName,' No a podido fichar por el siguiente problema: ',"No perteneces a este departamento.") INTO vBody;
|
|
||||||
CALL mail_insert(vTo,vTo,'error al fichar',vBody);
|
|
||||||
LEAVE proc;
|
|
||||||
END IF;
|
|
||||||
END IF;*/
|
|
||||||
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -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 vDaysInForward INT;
|
DECLARE vIsRaid BOOL;
|
||||||
DECLARE vPrintedCount INT;
|
DECLARE vPrintedCount INT;
|
||||||
DECLARE vHasDistinctWarehouses BOOL;
|
DECLARE vHasDistinctWarehouses BOOL;
|
||||||
DECLARE vTotalBuy INT;
|
DECLARE vTotalBuy INT;
|
||||||
|
@ -38,7 +38,7 @@ BEGIN
|
||||||
CALL travel_throwAwb(NEW.travelFk);
|
CALL travel_throwAwb(NEW.travelFk);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SELECT daysInForward INTO vDaysInForward
|
SELECT isRaid INTO vIsRaid
|
||||||
FROM travel t
|
FROM travel t
|
||||||
JOIN entry e ON e.travelFk = t.id
|
JOIN entry e ON e.travelFk = t.id
|
||||||
WHERE entryFk = NEW.id;
|
WHERE entryFk = NEW.id;
|
||||||
|
@ -50,7 +50,7 @@ BEGIN
|
||||||
WHERE o.id = OLD.travelFk
|
WHERE o.id = OLD.travelFk
|
||||||
AND n.id = NEW.travelFk;
|
AND n.id = NEW.travelFk;
|
||||||
|
|
||||||
IF vDaysInForward AND vHasDistinctWarehouses THEN
|
IF vIsRaid 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;
|
||||||
|
|
|
@ -21,7 +21,8 @@ BEGIN
|
||||||
OR !(NEW.kmEnd <=> OLD.kmEnd)
|
OR !(NEW.kmEnd <=> OLD.kmEnd)
|
||||||
OR !(NEW.workerFk <=> OLD.workerFk)
|
OR !(NEW.workerFk <=> OLD.workerFk)
|
||||||
OR !(NEW.m3 <=> OLD.m3)
|
OR !(NEW.m3 <=> OLD.m3)
|
||||||
OR !(NEW.agencyModeFk <=> OLD.agencyModeFk)THEN
|
OR !(NEW.agencyModeFk <=> OLD.agencyModeFk)
|
||||||
|
OR !(NEW.vehicleFk <=> OLD.vehicleFk)THEN
|
||||||
CALL route_calcCommission(NEW.id);
|
CALL route_calcCommission(NEW.id);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`town_beforeUpdate`
|
|
||||||
BEFORE UPDATE ON `town`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
-- IF !(OLD.geoFk <=> NEW.geoFk) THEN
|
|
||||||
-- CALL zoneGeo_throwNotEditable;
|
|
||||||
-- END IF;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -9,6 +9,10 @@ BEGIN
|
||||||
|
|
||||||
CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk);
|
CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk);
|
||||||
|
|
||||||
|
IF NEW.isRaid IS NOT NULL OR NEW.daysInForward IS NOT NULL THEN
|
||||||
|
CALL travel_checkRaid(NEW.isRaid, NEW.daysInForward);
|
||||||
|
END IF;
|
||||||
|
|
||||||
IF NEW.awbFk IS NOT NULL THEN
|
IF NEW.awbFk IS NOT NULL THEN
|
||||||
CALL travel_throwAwb(NEW.id);
|
CALL travel_throwAwb(NEW.id);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
|
@ -20,6 +20,10 @@ BEGIN
|
||||||
CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk);
|
CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
IF NOT (NEW.isRaid <=> OLD.isRaid) OR NOT (NEW.daysInForward <=> OLD.daysInForward) THEN
|
||||||
|
CALL travel_checkRaid(NEW.isRaid, NEW.daysInForward);
|
||||||
|
END IF;
|
||||||
|
|
||||||
IF NOT (NEW.awbFk <=> OLD.awbFk)THEN
|
IF NOT (NEW.awbFk <=> OLD.awbFk)THEN
|
||||||
SELECT COUNT(*) INTO vHasAnyInvoiceBooked
|
SELECT COUNT(*) INTO vHasAnyInvoiceBooked
|
||||||
FROM travel t
|
FROM travel t
|
||||||
|
|
|
@ -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`,
|
||||||
`t`.`daysInForward` AS `isVirtualStock`,
|
`t`.`isRaid` AS `isVirtualStock`,
|
||||||
`e`.`id` AS `entryFk`
|
`e`.`id` AS `entryFk`
|
||||||
FROM (
|
FROM (
|
||||||
(
|
(
|
||||||
|
|
|
@ -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 NOT `t`.`daysInForward`
|
AND NOT `t`.`isRaid`
|
||||||
AND `b`.`quantity` <> 0
|
AND `b`.`quantity` <> 0
|
||||||
|
|
|
@ -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 NOT `tr`.`daysInForward`
|
AND NOT `tr`.`isRaid`
|
||||||
AND `b`.`stickers` > 0
|
AND `b`.`stickers` > 0
|
||||||
|
|
|
@ -8,6 +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`,
|
||||||
|
`tr`.`isRaid` AS `isRaid`,
|
||||||
`tr`.`daysInForward` AS `daysInForward`,
|
`tr`.`daysInForward` AS `daysInForward`,
|
||||||
`e`.`evaNotes` AS `notas`,
|
`e`.`evaNotes` AS `notas`,
|
||||||
`e`.`supplierFk` AS `Id_Proveedor`,
|
`e`.`supplierFk` AS `Id_Proveedor`,
|
||||||
|
|
|
@ -18,5 +18,6 @@ AS SELECT `t`.`id` AS `id`,
|
||||||
`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`.`isRaid` AS `isRaid`,
|
||||||
`t`.`daysInForward` AS `daysInForward`
|
`t`.`daysInForward` AS `daysInForward`
|
||||||
FROM `vn`.`travel` `t`
|
FROM `vn`.`travel` `t`
|
||||||
|
|
|
@ -86,4 +86,4 @@ FROM (
|
||||||
)
|
)
|
||||||
WHERE NOT `W_IN`.`isFeedStock`
|
WHERE NOT `W_IN`.`isFeedStock`
|
||||||
AND NOT `E`.`Inventario`
|
AND NOT `E`.`Inventario`
|
||||||
AND NOT `TR`.`daysInForward`
|
AND NOT `TR`.`isRaid`
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
ALTER TABLE vn.workerRelatives DROP FOREIGN KEY workerRelatives_disabilityGradeFk;
|
||||||
|
ALTER TABLE vn.workerRelatives DROP FOREIGN KEY workerRelatives_workerFk;
|
||||||
|
|
||||||
|
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES
|
||||||
|
('WorkerRelative','updateAttributes','*','ALLOW','ROLE','hr'),
|
||||||
|
('WorkerRelative','crud','WRITE','ALLOW','ROLE','hr'),
|
||||||
|
('WorkerRelative','findById','*','ALLOW','ROLE','hr'),
|
||||||
|
('WorkerRelative','find','*','ALLOW','ROLE','hr'),
|
||||||
|
('WorkerRelative','upsert','*','ALLOW','ROLE','hr'),
|
||||||
|
('WorkerRelative','filter','*','ALLOW','ROLE','hr'),
|
||||||
|
('WorkerIrpf','updateAttributes','*','ALLOW','ROLE','hr'),
|
||||||
|
('WorkerIrpf','crud','*','ALLOW','ROLE','hr'),
|
||||||
|
('WorkerIrpf','findById','*','ALLOW','ROLE','hr'),
|
||||||
|
('WorkerIrpf','find','*','ALLOW','ROLE','hr'),
|
||||||
|
('WorkerIrpf','upsert','*','ALLOW','ROLE','hr'),
|
||||||
|
('WorkerIrpf','filter','*','ALLOW','ROLE','hr'),
|
||||||
|
('DisabilityGrade','updateAttributes','*','ALLOW','ROLE','hr'),
|
||||||
|
('DisabilityGrade','crud','*','ALLOW','ROLE','hr'),
|
||||||
|
('DisabilityGrade','findById','*','ALLOW','ROLE','hr'),
|
||||||
|
('DisabilityGrade','find','*','ALLOW','ROLE','hr'),
|
||||||
|
('DisabilityGrade','upsert','*','ALLOW','ROLE','hr');
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
ALTER TABLE vn.travel ADD isRaid tinyint(1) DEFAULT 0 NOT NULL COMMENT 'Redada';
|
||||||
|
|
||||||
|
ALTER TABLE vn.travel MODIFY COLUMN daysInForward int(10) unsigned DEFAULT NULL
|
||||||
|
COMMENT 'Cuando es una redada, indica el número de días que se añadirán a la fecha de hoy para establecer el landed. NULL si no es una redada';
|
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
ALTER TABLE vn.travel ADD IF NOT EXISTS isRaid tinyint(1) DEFAULT 0 NOT NULL COMMENT 'Redada';
|
||||||
|
|
||||||
|
ALTER TABLE vn.travel MODIFY COLUMN daysInForward int(10) unsigned DEFAULT NULL
|
||||||
|
COMMENT 'Cuando es una redada, indica el número de días que se añadirán a la fecha de hoy para establecer el landed. NULL si no es una redada';
|
|
@ -0,0 +1,15 @@
|
||||||
|
|
||||||
|
|
||||||
|
USE vn;
|
||||||
|
|
||||||
|
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
|
||||||
|
VALUES('RouteAction', 'find', 'READ', 'ALLOW', 'ROLE', 'delivery');
|
||||||
|
|
||||||
|
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
|
||||||
|
VALUES('RouteComplement', 'find', 'READ', 'ALLOW', 'ROLE', 'delivery');
|
||||||
|
|
||||||
|
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
|
||||||
|
VALUES('RouteComplement', 'create', 'WRITE', 'ALLOW', 'ROLE', 'delivery');
|
||||||
|
|
||||||
|
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
|
||||||
|
VALUES('RouteComplement', 'deleteById', 'WRITE', 'ALLOW', 'ROLE', 'delivery');
|
|
@ -0,0 +1,2 @@
|
||||||
|
RENAME TABLE vn.workerTimeControlParams TO vn.workerTimeControlParams__;
|
||||||
|
ALTER TABLE vn.workerTimeControlParams__ COMMENT='@deprecated 2024-11-19';
|
|
@ -0,0 +1,3 @@
|
||||||
|
-- Place your SQL code here
|
||||||
|
INSERT IGNORE INTO vn.saySimpleConfig (url, defaultChannel)
|
||||||
|
VALUES ('https://verdnatura.saysimple.io/start-conversation', 1320);
|
|
@ -223,7 +223,6 @@
|
||||||
"Shelving not valid": "Shelving not valid",
|
"Shelving not valid": "Shelving not valid",
|
||||||
"printerNotExists": "The printer does not exist",
|
"printerNotExists": "The printer does not exist",
|
||||||
"There are not picking tickets": "There are not picking tickets",
|
"There are not picking tickets": "There are not picking tickets",
|
||||||
"ticketCommercial": "The ticket {{ ticket }} for the salesperson {{ salesMan }} is in preparation. (automatically generated message)",
|
|
||||||
"This password can only be changed by the user themselves": "This password can only be changed by the user themselves",
|
"This password can only be changed by the user themselves": "This password can only be changed by the user themselves",
|
||||||
"They're not your subordinate": "They're not your subordinate",
|
"They're not your subordinate": "They're not your subordinate",
|
||||||
"InvoiceIn is already booked": "InvoiceIn is already booked",
|
"InvoiceIn is already booked": "InvoiceIn is already booked",
|
||||||
|
@ -246,5 +245,6 @@
|
||||||
"You do not have permission to modify the booked field": "You do not have permission to modify the booked field",
|
"You do not have permission to modify the booked field": "You do not have permission to modify the booked field",
|
||||||
"Invalid or expired verification code": "Invalid or expired verification code",
|
"Invalid or expired verification code": "Invalid or expired verification code",
|
||||||
"ticketLostExpedition": "The ticket [{{ticketId}}]({{{ticketUrl}}}) has the following lost expedition:{{ expeditionId }}",
|
"ticketLostExpedition": "The ticket [{{ticketId}}]({{{ticketUrl}}}) has the following lost expedition:{{ expeditionId }}",
|
||||||
|
"The raid information is not correct": "The raid information is not correct",
|
||||||
"Sales already moved": "Sales already moved"
|
"Sales already moved": "Sales already moved"
|
||||||
}
|
}
|
||||||
|
|
|
@ -359,7 +359,6 @@
|
||||||
"This workCenter is already assigned to this agency": "Este centro de trabajo ya está asignado a esta agencia",
|
"This workCenter is already assigned to this agency": "Este centro de trabajo ya está asignado a esta agencia",
|
||||||
"Select ticket or client": "Elija un ticket o un client",
|
"Select ticket or client": "Elija un ticket o un client",
|
||||||
"It was not able to create the invoice": "No se pudo crear la factura",
|
"It was not able to create the invoice": "No se pudo crear la factura",
|
||||||
"ticketCommercial": "El ticket {{ ticket }} para el vendedor {{ salesMan }} está en preparación. (mensaje generado automáticamente)",
|
|
||||||
"Incoterms and Customs agent are required for a non UEE member": "Se requieren Incoterms y agente de aduanas para un no miembro de la UEE",
|
"Incoterms and Customs agent are required for a non UEE member": "Se requieren Incoterms y agente de aduanas para un no miembro de la UEE",
|
||||||
"You can not use the same password": "No puedes usar la misma contraseña",
|
"You can not use the same password": "No puedes usar la misma contraseña",
|
||||||
"This PDA is already assigned to another user": "Este PDA ya está asignado a otro usuario",
|
"This PDA is already assigned to another user": "Este PDA ya está asignado a otro usuario",
|
||||||
|
@ -389,5 +388,7 @@
|
||||||
"You do not have permission to modify the booked field": "No tienes permisos para modificar el campo contabilizada",
|
"You do not have permission to modify the booked field": "No tienes permisos para modificar el campo contabilizada",
|
||||||
"ticketLostExpedition": "El ticket [{{ticketId}}]({{{ticketUrl}}}) tiene la siguiente expedición perdida:{{ expeditionId }}",
|
"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",
|
"The web user's email already exists": "El correo del usuario web ya existe",
|
||||||
"Sales already moved": "Ya han sido transferidas"
|
"Sales already moved": "Ya han sido transferidas",
|
||||||
|
"The raid information is not correct": "La información de la redada no es correcta"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ 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
|
||||||
|
|
|
@ -9,6 +9,7 @@ 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
|
||||||
|
|
|
@ -194,6 +194,7 @@ module.exports = Self => {
|
||||||
e.evaNotes observation,
|
e.evaNotes observation,
|
||||||
e.isConfirmed,
|
e.isConfirmed,
|
||||||
e.isOrdered,
|
e.isOrdered,
|
||||||
|
t.isRaid,
|
||||||
t.daysInForward,
|
t.daysInForward,
|
||||||
e.commission,
|
e.commission,
|
||||||
e.created,
|
e.created,
|
||||||
|
|
|
@ -49,8 +49,8 @@ module.exports = Self => {
|
||||||
'isReceived',
|
'isReceived',
|
||||||
'isDelivered',
|
'isDelivered',
|
||||||
'ref',
|
'ref',
|
||||||
'daysInForward',
|
'isRaid',
|
||||||
],
|
'daysInForward'],
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
relation: 'agency',
|
relation: 'agency',
|
||||||
|
|
|
@ -50,8 +50,11 @@ module.exports = Self => {
|
||||||
i.id itemFk,
|
i.id itemFk,
|
||||||
i.name itemName,
|
i.name itemName,
|
||||||
ti.quantity,
|
ti.quantity,
|
||||||
ROUND((ac.conversionCoefficient * (ti.quantity / b.packing) * buy_getVolume(b.id))
|
ROUND((ac.conversionCoefficient *
|
||||||
/ (vc.trolleyM3 * 1000000),1) volume,
|
(ti.quantity / b.packing) *
|
||||||
|
buy_getVolume(b.id)
|
||||||
|
) / (vc.trolleyM3 * 1000000),
|
||||||
|
2) volume,
|
||||||
b.packagingFk packagingFk,
|
b.packagingFk packagingFk,
|
||||||
b.packing
|
b.packing
|
||||||
FROM tmp.item ti
|
FROM tmp.item ti
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<vn-icon
|
<vn-icon
|
||||||
vn-tooltip="Is virtual entry"
|
vn-tooltip="Is virtual entry"
|
||||||
icon="icon-net"
|
icon="icon-net"
|
||||||
ng-if="$ctrl.entryData.travel.daysInForward">
|
ng-if="$ctrl.entryData.travel.isRaid">
|
||||||
</vn-icon>
|
</vn-icon>
|
||||||
</div>
|
</div>
|
||||||
<div class="quicklinks">
|
<div class="quicklinks">
|
||||||
|
|
|
@ -86,7 +86,7 @@ auto-load="true">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
<vn-check
|
<vn-check
|
||||||
label="Raid"
|
label="Raid"
|
||||||
ng-model="$ctrl.entryData.travel.daysInForward"
|
ng-model="$ctrl.entryData.travel.isRaid"
|
||||||
disabled="true">
|
disabled="true">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
<vn-check
|
<vn-check
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
export * from './module';
|
export * from './module';
|
||||||
|
|
||||||
import './main';
|
import './main';
|
||||||
import './summary';
|
|
||||||
import './descriptor';
|
import './descriptor';
|
||||||
import './descriptor-popover';
|
import './descriptor-popover';
|
||||||
import './descriptor-menu';
|
import './descriptor-menu';
|
||||||
|
import './summary';
|
||||||
|
|
|
@ -34,6 +34,12 @@
|
||||||
"params": {
|
"params": {
|
||||||
"invoice-out": "$ctrl.invoiceOut"
|
"invoice-out": "$ctrl.invoiceOut"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "/:id",
|
||||||
|
"state": "invoiceOut.card",
|
||||||
|
"abstract": true,
|
||||||
|
"component": "vn-invoice-out-card"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ module.exports = Self => {
|
||||||
}, {
|
}, {
|
||||||
arg: 'from',
|
arg: 'from',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
description: 'The from date'
|
description: 'The from date',
|
||||||
}, {
|
}, {
|
||||||
arg: 'to',
|
arg: 'to',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
|
@ -84,7 +84,6 @@ module.exports = Self => {
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
const args = ctx.args;
|
const args = ctx.args;
|
||||||
|
|
||||||
// Apply filter by team
|
// Apply filter by team
|
||||||
const teamMembersId = [];
|
const teamMembersId = [];
|
||||||
if (args.myTeam != null) {
|
if (args.myTeam != null) {
|
||||||
|
@ -101,9 +100,12 @@ module.exports = Self => {
|
||||||
teamMembersId.push(userId);
|
teamMembersId.push(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args && args.myTeam)
|
if (args?.myTeam)
|
||||||
args.teamIds = teamIds;
|
args.teamIds = teamIds;
|
||||||
|
|
||||||
|
if (args?.to)
|
||||||
|
args.to.setHours(23, 59, 0, 0);
|
||||||
|
|
||||||
const where = buildFilter(args, (param, value) => {
|
const where = buildFilter(args, (param, value) => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 'search':
|
case 'search':
|
||||||
|
@ -151,7 +153,12 @@ module.exports = Self => {
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.filter
|
CREATE OR REPLACE TEMPORARY TABLE tmp.filter
|
||||||
(INDEX (id))
|
(INDEX (id))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT o.id,
|
WITH wOrderTicket AS(
|
||||||
|
SELECT orderFk,
|
||||||
|
ticketFk
|
||||||
|
FROM orderTicket
|
||||||
|
GROUP BY orderFk
|
||||||
|
)SELECT o.id,
|
||||||
o.total,
|
o.total,
|
||||||
o.date_send landed,
|
o.date_send landed,
|
||||||
o.date_make created,
|
o.date_make created,
|
||||||
|
@ -199,7 +206,6 @@ module.exports = Self => {
|
||||||
`);
|
`);
|
||||||
|
|
||||||
stmt.merge(conn.makeWhere(filter.where));
|
stmt.merge(conn.makeWhere(filter.where));
|
||||||
stmt.merge(`GROUP BY id`);
|
|
||||||
stmt.merge(conn.makePagination(filter));
|
stmt.merge(conn.makePagination(filter));
|
||||||
stmts.push(stmt);
|
stmts.push(stmt);
|
||||||
stmts.push(`SET SESSION optimizer_search_depth = @_optimizer_search_depth`);
|
stmts.push(`SET SESSION optimizer_search_depth = @_optimizer_search_depth`);
|
||||||
|
@ -212,7 +218,6 @@ module.exports = Self => {
|
||||||
|
|
||||||
const sql = ParameterizedSQL.join(stmts, ';');
|
const sql = ParameterizedSQL.join(stmts, ';');
|
||||||
const result = await conn.executeStmt(sql, myOptions);
|
const result = await conn.executeStmt(sql, myOptions);
|
||||||
|
|
||||||
return result[ordersIndex];
|
return result[ordersIndex];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,6 +23,12 @@
|
||||||
"Route": {
|
"Route": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"RouteAction": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"RouteComplement": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"RouteLog": {
|
"RouteLog": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"name": "RouteAction",
|
||||||
|
"base": "VnModel",
|
||||||
|
"mixins": {
|
||||||
|
"Loggable": true
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "routeAction"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"price": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"isMainlineDelivered": {
|
||||||
|
"type": "boolean",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
{
|
||||||
|
"name": "RouteComplement",
|
||||||
|
"base": "VnModel",
|
||||||
|
"mixins": {
|
||||||
|
"Loggable": true
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "routeComplement"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"dated": {
|
||||||
|
"type": "date"
|
||||||
|
},
|
||||||
|
"price": {
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"worker": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Worker",
|
||||||
|
"foreignKey": "workerFk"
|
||||||
|
},
|
||||||
|
"routeAction": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "RouteAction",
|
||||||
|
"foreignKey": "routeActionFk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -265,7 +265,8 @@ module.exports = Self => {
|
||||||
FROM sale s2
|
FROM sale s2
|
||||||
JOIN item i2 ON i2.id = s2.itemFk
|
JOIN item i2 ON i2.id = s2.itemFk
|
||||||
WHERE s2.ticketFk = t.id
|
WHERE s2.ticketFk = t.id
|
||||||
) AS packing
|
) AS packing,
|
||||||
|
c.credit
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
LEFT JOIN invoiceOut io ON t.refFk = io.ref
|
LEFT JOIN invoiceOut io ON t.refFk = io.ref
|
||||||
LEFT JOIN zone z ON z.id = t.zoneFk
|
LEFT JOIN zone z ON z.id = t.zoneFk
|
||||||
|
|
|
@ -37,6 +37,7 @@ module.exports = Self => {
|
||||||
'name',
|
'name',
|
||||||
'subName',
|
'subName',
|
||||||
'itemPackingTypeFk',
|
'itemPackingTypeFk',
|
||||||
|
'size',
|
||||||
'tag5',
|
'tag5',
|
||||||
'value5',
|
'value5',
|
||||||
'tag6',
|
'tag6',
|
||||||
|
|
|
@ -154,6 +154,7 @@ module.exports = Self => {
|
||||||
t.landingHour,
|
t.landingHour,
|
||||||
t.cargoSupplierFk,
|
t.cargoSupplierFk,
|
||||||
t.totalEntries,
|
t.totalEntries,
|
||||||
|
t.isRaid,
|
||||||
t.daysInForward,
|
t.daysInForward,
|
||||||
am.name agencyModeName,
|
am.name agencyModeName,
|
||||||
win.name warehouseInName,
|
win.name warehouseInName,
|
||||||
|
|
|
@ -51,6 +51,9 @@
|
||||||
"landingHour": {
|
"landingHour": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"isRaid": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"daysInForward": {
|
"daysInForward": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.checkInbox = async() => {
|
Self.checkInbox = async() => {
|
||||||
let imapConfig = await Self.app.models.WorkerTimeControlParams.findOne();
|
let imapConfig = await Self.app.models.WorkerTimeControlConfig.findOne();
|
||||||
let imap = new Imap({
|
let imap = new Imap({
|
||||||
user: imapConfig.mailUser,
|
user: imapConfig.mailUser,
|
||||||
password: imapConfig.mailPass,
|
password: imapConfig.mailPass,
|
||||||
|
|
|
@ -58,9 +58,8 @@ module.exports = Self => {
|
||||||
if (!isSubordinate || (isSubordinate && userId == id && !isTeamBoss))
|
if (!isSubordinate || (isSubordinate && userId == id && !isTeamBoss))
|
||||||
throw new UserError(`You don't have enough privileges`);
|
throw new UserError(`You don't have enough privileges`);
|
||||||
|
|
||||||
const labour = await models.WorkerLabour.findById(args.businessFk, {
|
const labour = await models.WorkerLabour.findById(args.businessFk,
|
||||||
include: {relation: 'department'}
|
{fields: ['started', 'ended', 'businessFk']}, myOptions);
|
||||||
}, myOptions);
|
|
||||||
|
|
||||||
if (args.dated < labour.started || (labour.ended != null && args.dated > labour.ended))
|
if (args.dated < labour.started || (labour.ended != null && args.dated > labour.ended))
|
||||||
throw new UserError(`The contract was not active during the selected date`);
|
throw new UserError(`The contract was not active during the selected date`);
|
||||||
|
@ -87,7 +86,8 @@ module.exports = Self => {
|
||||||
`SELECT COUNT(*) halfHolidayCounter
|
`SELECT COUNT(*) halfHolidayCounter
|
||||||
FROM vn.calendar c
|
FROM vn.calendar c
|
||||||
JOIN vn.business b ON b.id = c.businessFk
|
JOIN vn.business b ON b.id = c.businessFk
|
||||||
WHERE c.dayOffTypeFk = 6
|
JOIN vn.absenceType at ON at.id = c.dayOffTypeFk
|
||||||
|
WHERE at.code = 'halfHoliday'
|
||||||
AND b.workerFk = ?
|
AND b.workerFk = ?
|
||||||
AND c.dated BETWEEN util.firstDayOfYear(?)
|
AND c.dated BETWEEN util.firstDayOfYear(?)
|
||||||
AND LAST_DAY(DATE_ADD(?, INTERVAL 12 - MONTH(?) MONTH))`, [id, date, now, now]);
|
AND LAST_DAY(DATE_ADD(?, INTERVAL 12 - MONTH(?) MONTH))`, [id, date, now, now]);
|
||||||
|
@ -119,25 +119,23 @@ module.exports = Self => {
|
||||||
dated: args.dated
|
dated: args.dated
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
const department = labour.department();
|
const account = await models.VnUser.findById(userId, null, myOptions);
|
||||||
if (department && department.notificationEmail) {
|
const subordinated = await models.VnUser.findById(id, null, myOptions);
|
||||||
const absenceType = await models.AbsenceType.findById(args.absenceTypeId, null, myOptions);
|
const worker = await models.Worker.findById(subordinated.id, null, myOptions);
|
||||||
const account = await models.VnUser.findById(userId, null, myOptions);
|
const departmentBoss = await models.VnUser.findById(worker.bossFk, null, myOptions);
|
||||||
const subordinated = await models.VnUser.findById(id, null, myOptions);
|
const url = await Self.app.models.Url.getUrl();
|
||||||
const url = await Self.app.models.Url.getUrl();
|
const body = $t('Created absence', {
|
||||||
const body = $t('Created absence', {
|
author: account.nickname,
|
||||||
author: account.nickname,
|
employee: subordinated.nickname,
|
||||||
employee: subordinated.nickname,
|
absenceType: absenceType.name,
|
||||||
absenceType: absenceType.name,
|
dated: formatDate(args.dated),
|
||||||
dated: formatDate(args.dated),
|
workerUrl: `${url}worker/${id}/calendar`
|
||||||
workerUrl: `${url}worker/${id}/calendar`
|
});
|
||||||
});
|
await models.Mail.create({
|
||||||
await models.Mail.create({
|
subject: $t('Absence change notification on the labour calendar'),
|
||||||
subject: $t('Absence change notification on the labour calendar'),
|
body: body,
|
||||||
body: body,
|
receiver: departmentBoss.email
|
||||||
receiver: department.notificationEmail
|
}, myOptions);
|
||||||
}, myOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
|
|
||||||
|
|
|
@ -113,9 +113,6 @@
|
||||||
"WorkerTimeControlConfig": {
|
"WorkerTimeControlConfig": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"WorkerTimeControlParams": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"WorkerTimeControlMail": {
|
"WorkerTimeControlMail": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
@ -125,6 +122,15 @@
|
||||||
"Locker": {
|
"Locker": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"WorkerIrpf": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"DisabilityGrade": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"WorkerRelative": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"MedicalReview": {
|
"MedicalReview": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"name": "DisabilityGrade",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "disabilityGrade"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"id": true,
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
{
|
||||||
|
"name": "WorkerIrpf",
|
||||||
|
"description": "Model 145 IRPF",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "workerIrpf"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"workerFk": {
|
||||||
|
"type": "number",
|
||||||
|
"id": 1,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"spouseNif": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"geographicMobilityDate": {
|
||||||
|
"type": "date"
|
||||||
|
},
|
||||||
|
"disabilityGradeFk": {
|
||||||
|
"type" : "number"
|
||||||
|
},
|
||||||
|
"isDependend": {
|
||||||
|
"type" : "number"
|
||||||
|
},
|
||||||
|
"familySituation": {
|
||||||
|
"type" : "number"
|
||||||
|
},
|
||||||
|
"spousePension": {
|
||||||
|
"type" : "number"
|
||||||
|
},
|
||||||
|
"childPension": {
|
||||||
|
"type" : "number"
|
||||||
|
},
|
||||||
|
"hasHousingPaymentBefore": {
|
||||||
|
"type" : "number"
|
||||||
|
},
|
||||||
|
"hasHousingPaymentAfter": {
|
||||||
|
"type" : "number"
|
||||||
|
},
|
||||||
|
"updated": {
|
||||||
|
"type" : "date"
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"disabilityGrade": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "disabilityGrade",
|
||||||
|
"foreignKey": "disabilityGradeFk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
{
|
||||||
|
"name": "WorkerRelative",
|
||||||
|
"description": "Model 145 IRPF",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "workerRelatives"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"workerFk": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"isDescendant": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"disabilityGradeFk": {
|
||||||
|
"type" : "number"
|
||||||
|
},
|
||||||
|
"birthed": {
|
||||||
|
"type" : "number"
|
||||||
|
},
|
||||||
|
"adoptionYear": {
|
||||||
|
"type" : "number"
|
||||||
|
},
|
||||||
|
"isDependend": {
|
||||||
|
"type" : "boolean"
|
||||||
|
},
|
||||||
|
"isJointCustody": {
|
||||||
|
"type" : "boolean"
|
||||||
|
},
|
||||||
|
"updated": {
|
||||||
|
"type" : "date"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"disabilityGrade": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "disabilityGrade",
|
||||||
|
"foreignKey": "disabilityGradeFk"
|
||||||
|
},
|
||||||
|
"worker": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "VnUser",
|
||||||
|
"foreignKey": "workerFK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,6 +11,15 @@
|
||||||
"id": true,
|
"id": true,
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
|
"mailPass": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"mailHost": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"mailUser": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"breakTime": {
|
"breakTime": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
|
@ -23,5 +32,13 @@
|
||||||
"teleworkingStartBreakTime": {
|
"teleworkingStartBreakTime": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"acls": [
|
||||||
|
{
|
||||||
|
"accessType": "READ",
|
||||||
|
"principalType": "ROLE",
|
||||||
|
"principalId": "$everyone",
|
||||||
|
"permission": "ALLOW"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
{
|
|
||||||
"name": "WorkerTimeControlParams",
|
|
||||||
"description": "imap config",
|
|
||||||
"base": "VnModel",
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "workerTimeControlParams"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"mailHost": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"mailUser": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"mailPass": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"mailSuccessFolder": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"mailErrorFolder": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"acls": [
|
|
||||||
{
|
|
||||||
"accessType": "READ",
|
|
||||||
"principalType": "ROLE",
|
|
||||||
"principalId": "$everyone",
|
|
||||||
"permission": "ALLOW"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -132,6 +132,16 @@
|
||||||
"type": "hasMany",
|
"type": "hasMany",
|
||||||
"model": "WorkerTimeControlMail",
|
"model": "WorkerTimeControlMail",
|
||||||
"foreignKey": "workerFk"
|
"foreignKey": "workerFk"
|
||||||
|
},
|
||||||
|
"irpf": {
|
||||||
|
"type": "hasMany",
|
||||||
|
"model": "WorkerIrpf",
|
||||||
|
"foreignKey": "workerFk"
|
||||||
|
},
|
||||||
|
"workerRelative": {
|
||||||
|
"type": "hasMany",
|
||||||
|
"model": "WorkerRelative",
|
||||||
|
"foreignKey": "workerFK"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"acls": [
|
"acls": [
|
||||||
|
@ -301,7 +311,19 @@
|
||||||
"birth",
|
"birth",
|
||||||
"educationLevelFk",
|
"educationLevelFk",
|
||||||
"originCountryFk",
|
"originCountryFk",
|
||||||
"maritalStatus"
|
"maritalStatus",
|
||||||
|
"SSN"
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
{
|
||||||
|
"relation": "client",
|
||||||
|
"scope": {
|
||||||
|
"fields": [
|
||||||
|
"id",
|
||||||
|
"phone"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,7 @@ module.exports = Self => {
|
||||||
try {
|
try {
|
||||||
const filter = {
|
const filter = {
|
||||||
where: {
|
where: {
|
||||||
zoneFk: id,
|
zoneFk: id
|
||||||
shipped: {gte: today}
|
|
||||||
},
|
},
|
||||||
include: {
|
include: {
|
||||||
relation: 'ticketState',
|
relation: 'ticketState',
|
||||||
|
|
|
@ -385,7 +385,6 @@ localFixtures:
|
||||||
- workerTimeControl
|
- workerTimeControl
|
||||||
- workerTimeControlConfig
|
- workerTimeControlConfig
|
||||||
- workerTimeControlMail
|
- workerTimeControlMail
|
||||||
- workerTimeControlParams
|
|
||||||
- zone
|
- zone
|
||||||
- zoneAgencyMode
|
- zoneAgencyMode
|
||||||
- zoneClosure
|
- zoneClosure
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "salix-back",
|
"name": "salix-back",
|
||||||
"version": "24.44.0",
|
"version": "24.50.0",
|
||||||
"author": "Verdnatura Levante SL",
|
"author": "Verdnatura Levante SL",
|
||||||
"description": "Salix backend",
|
"description": "Salix backend",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
|
|
Loading…
Reference in New Issue