7152-devToTest_2414 #2228
|
@ -235,6 +235,7 @@ pipeline {
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
message = message.substring(0, index)
|
message = message.substring(0, index)
|
||||||
|
|
||||||
|
setEnv()
|
||||||
rocketSend(
|
rocketSend(
|
||||||
channel: 'vn-database',
|
channel: 'vn-database',
|
||||||
message: "*DB version uploaded:* ${message}"
|
message: "*DB version uploaded:* ${message}"
|
||||||
|
|
|
@ -88,7 +88,7 @@ module.exports = Self => {
|
||||||
warehouseFk: args.warehouseId,
|
warehouseFk: args.warehouseId,
|
||||||
reference: args.reference,
|
reference: args.reference,
|
||||||
description: args.description,
|
description: args.description,
|
||||||
contentType: args.contentType,
|
contentType: uploadedFile.type,
|
||||||
hasFile: args.hasFile
|
hasFile: args.hasFile
|
||||||
};
|
};
|
||||||
const extension = await models.DmsContainer.getFileExtension(uploadedFile.name);
|
const extension = await models.DmsContainer.getFileExtension(uploadedFile.name);
|
||||||
|
|
|
@ -22,7 +22,7 @@ module.exports = Self => {
|
||||||
const {url} = await Self.app.models.Url.findOne({
|
const {url} = await Self.app.models.Url.findOne({
|
||||||
where: {
|
where: {
|
||||||
appName,
|
appName,
|
||||||
enviroment: process.env.NODE_ENV || 'development'
|
environment: process.env.NODE_ENV || 'development'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return url;
|
return url;
|
||||||
|
|
|
@ -137,9 +137,6 @@ INSERT INTO vn.ticket (clientFk, warehouseFk, shipped, nickname, refFk, addressF
|
||||||
INSERT INTO vn.sale (itemFk, ticketFk, concept, quantity, originalQuantity, price, discount, priceFixed, reserved, isPicked, isPriceFixed, created, isAdded)
|
INSERT INTO vn.sale (itemFk, ticketFk, concept, quantity, originalQuantity, price, discount, priceFixed, reserved, isPicked, isPriceFixed, created, isAdded)
|
||||||
VALUES (1, 24, 'Ranged weapon longbow 2m', 1.00, NULL, 8.07, 0, 0.00, 0, 0, 0, '2022-07-06 00:00:00', 0);
|
VALUES (1, 24, 'Ranged weapon longbow 2m', 1.00, NULL, 8.07, 0, 0.00, 0, 0, 0, '2022-07-06 00:00:00', 0);
|
||||||
*/
|
*/
|
||||||
INSERT INTO vn2008.zones (zone_id,name,printingOrder)
|
|
||||||
VALUES (1,'zone Test',1);
|
|
||||||
|
|
||||||
-- XXX: lab
|
-- XXX: lab
|
||||||
|
|
||||||
INSERT INTO `vn`.`businessReasonEnd` (`id`, `reason`)
|
INSERT INTO `vn`.`businessReasonEnd` (`id`, `reason`)
|
||||||
|
|
|
@ -352,12 +352,12 @@ INSERT INTO `vn`.`postCode`(`code`, `townFk`, `geoFk`)
|
||||||
('46600', 4, 7),
|
('46600', 4, 7),
|
||||||
('EC170150', 5, 8);
|
('EC170150', 5, 8);
|
||||||
|
|
||||||
INSERT INTO `vn`.`clientType`(`id`, `code`, `type`)
|
INSERT INTO `vn`.`clientType`(`code`, `type`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'normal', 'Normal'),
|
('normal', 'Normal'),
|
||||||
(2, 'internalUse', 'Autoconsumo'),
|
('internalUse', 'Autoconsumo'),
|
||||||
(3, 'handMaking', 'Confección'),
|
('handMaking', 'Confección'),
|
||||||
(4, 'loses', 'Mermas');
|
('loses', 'Mermas');
|
||||||
|
|
||||||
INSERT INTO `vn`.`cplusTerIdNif`(`id`, `description`)
|
INSERT INTO `vn`.`cplusTerIdNif`(`id`, `description`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -371,20 +371,20 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`)
|
||||||
(4, 'GCN Channel'),
|
(4, 'GCN Channel'),
|
||||||
(5, 'The Newspaper');
|
(5, 'The Newspaper');
|
||||||
|
|
||||||
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`,`typeFk`)
|
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`,`typeFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
(1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
||||||
(1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
(1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
||||||
(1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
(1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
||||||
(1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
(1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
||||||
(1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
(1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
||||||
(1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
|
(1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
|
||||||
(1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
|
(1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
|
||||||
(1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
|
(1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
|
||||||
(1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist','normal'),
|
(1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist','normal'),
|
||||||
(1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist','normal'),
|
(1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist','normal'),
|
||||||
(1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses'),
|
(1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses'),
|
||||||
(1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses');
|
(1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses');
|
||||||
|
|
||||||
INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`)
|
INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`)
|
||||||
SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1
|
SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1
|
||||||
|
@ -3070,6 +3070,9 @@ INSERT INTO `vn`.`cmr` (id,truckPlate,observations,senderInstruccions,paymentIns
|
||||||
(2,'123456N','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',69,3,4,2,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet'),
|
(2,'123456N','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',69,3,4,2,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet'),
|
||||||
(3,'123456B','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',567,5,6,69,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet');
|
(3,'123456B','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',567,5,6,69,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet');
|
||||||
|
|
||||||
|
UPDATE vn.department
|
||||||
|
SET workerFk = null;
|
||||||
|
|
||||||
-- NEW WAREHOUSE
|
-- NEW WAREHOUSE
|
||||||
|
|
||||||
INSERT INTO vn.packaging
|
INSERT INTO vn.packaging
|
||||||
|
|
|
@ -19,7 +19,7 @@ BEGIN
|
||||||
itemFk,
|
itemFk,
|
||||||
itemTypeFk,
|
itemTypeFk,
|
||||||
floor(sum(value)) as total,
|
floor(sum(value)) as total,
|
||||||
floor(sum(IF(clientTypeFk = 'loses', value, 0))) as mermas
|
floor(sum(IF(typeFk = 'loses', value, 0))) as mermas
|
||||||
FROM vn.saleValue
|
FROM vn.saleValue
|
||||||
where year = vYear and week = vWeek
|
where year = vYear and week = vWeek
|
||||||
|
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`isPalletHomogeneus`(vExpedition INT)
|
|
||||||
RETURNS tinyint(1)
|
|
||||||
NOT DETERMINISTIC
|
|
||||||
READS SQL DATA
|
|
||||||
BEGIN
|
|
||||||
DECLARE vScanId INT;
|
|
||||||
DECLARE vDistinctRoutesInThePallet INT;
|
|
||||||
|
|
||||||
SELECT scan_id INTO vScanId
|
|
||||||
FROM vn2008.scan_line
|
|
||||||
WHERE code = vExpedition
|
|
||||||
LIMIT 1;
|
|
||||||
|
|
||||||
SELECT COUNT(*) INTO vDistinctRoutesInThePallet
|
|
||||||
FROM (
|
|
||||||
SELECT DISTINCT t.Id_Ruta
|
|
||||||
FROM vn2008.scan_line sl
|
|
||||||
JOIN expedition e ON e.id = sl.code
|
|
||||||
JOIN vn2008.Tickets t ON t.Id_Ticket = e.ticketFk
|
|
||||||
WHERE sl.scan_id = vScanId
|
|
||||||
AND t.Id_Ruta
|
|
||||||
) t1;
|
|
||||||
|
|
||||||
RETURN vDistinctRoutesInThePallet = 1;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -16,7 +16,7 @@ BEGIN
|
||||||
LEFT JOIN vn.supplier s
|
LEFT JOIN vn.supplier s
|
||||||
ON s.id = bp.supplierFk
|
ON s.id = bp.supplierFk
|
||||||
LEFT JOIN vn.bank b
|
LEFT JOIN vn.bank b
|
||||||
ON b.id = bp.bankFk
|
ON b.id = bp.accountingFk
|
||||||
WHERE bp.insuranceExpired = util.VN_CURDATE();
|
WHERE bp.insuranceExpired = util.VN_CURDATE();
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -22,6 +22,7 @@ BEGIN
|
||||||
SET v2Years = util.VN_CURDATE() - INTERVAL 2 YEAR;
|
SET v2Years = util.VN_CURDATE() - INTERVAL 2 YEAR;
|
||||||
SET v5Years = util.VN_CURDATE() - INTERVAL 5 YEAR;
|
SET v5Years = util.VN_CURDATE() - INTERVAL 5 YEAR;
|
||||||
|
|
||||||
|
DELETE FROM workerActivity WHERE created < v2Years;
|
||||||
DELETE FROM ticketParking WHERE created < vDateShort;
|
DELETE FROM ticketParking WHERE created < vDateShort;
|
||||||
DELETE FROM routesMonitor WHERE dated < vDateShort;
|
DELETE FROM routesMonitor WHERE dated < vDateShort;
|
||||||
DELETE FROM workerTimeControlLog WHERE created < vDateShort;
|
DELETE FROM workerTimeControlLog WHERE created < vDateShort;
|
||||||
|
|
|
@ -47,12 +47,11 @@ BEGIN
|
||||||
JOIN itemCategory ic ON ic.id = tp.categoryFk
|
JOIN itemCategory ic ON ic.id = tp.categoryFk
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
JOIN ticket t ON t.id = s.ticketFk
|
||||||
JOIN client c ON c.id = t.clientFk
|
JOIN client c ON c.id = t.clientFk
|
||||||
JOIN clientType ct ON ct.id = c.clientTypeFk
|
|
||||||
JOIN warehouse w ON w.id = t.warehouseFk
|
JOIN warehouse w ON w.id = t.warehouseFk
|
||||||
JOIN address ad ON ad.id = t.addressFk
|
JOIN address ad ON ad.id = t.addressFk
|
||||||
LEFT JOIN province p ON p.id = ad.provinceFk
|
LEFT JOIN province p ON p.id = ad.provinceFk
|
||||||
WHERE tm.period BETWEEN vMaxPeriod AND vPeriod
|
WHERE tm.period BETWEEN vMaxPeriod AND vPeriod
|
||||||
AND ct.code <> 'loses'
|
AND c.typeFk <> 'loses'
|
||||||
AND NOT w.code = 'inv'
|
AND NOT w.code = 'inv'
|
||||||
GROUP BY p.countryFk, s.itemFk, tm.period, t.warehouseFk;
|
GROUP BY p.countryFk, s.itemFk, tm.period, t.warehouseFk;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
|
@ -48,7 +48,7 @@ BEGIN
|
||||||
|
|
||||||
IF vCounter > 0 OR vASIEN > 0 THEN
|
IF vCounter > 0 OR vASIEN > 0 THEN
|
||||||
|
|
||||||
UPDATE vn2008.XDiario x
|
UPDATE XDiario x
|
||||||
JOIN ledgerConfig lc ON lc.lastBookEntry = x.ASIEN
|
JOIN ledgerConfig lc ON lc.lastBookEntry = x.ASIEN
|
||||||
SET x.ASIEN = vASIEN;
|
SET x.ASIEN = vASIEN;
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ BEGIN
|
||||||
*/
|
*/
|
||||||
DECLARE vTaxRowLimit INT;
|
DECLARE vTaxRowLimit INT;
|
||||||
DECLARE vLines INT;
|
DECLARE vLines INT;
|
||||||
|
DECLARE vHasDistinctTransactions INT;
|
||||||
|
|
||||||
SELECT taxRowLimit INTO vTaxRowLimit FROM invoiceInConfig;
|
SELECT taxRowLimit INTO vTaxRowLimit FROM invoiceInConfig;
|
||||||
|
|
||||||
|
@ -19,5 +20,17 @@ BEGIN
|
||||||
IF vLines >= vTaxRowLimit THEN
|
IF vLines >= vTaxRowLimit THEN
|
||||||
CALL util.throw (CONCAT('The maximum number of lines is ', vTaxRowLimit));
|
CALL util.throw (CONCAT('The maximum number of lines is ', vTaxRowLimit));
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
SELECT COUNT(DISTINCT transactionTypeSageFk) INTO vHasDistinctTransactions
|
||||||
|
FROM invoiceIn ii
|
||||||
|
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
|
||||||
|
JOIN invoiceInSerial iis ON iis.code = ii.serial
|
||||||
|
WHERE ii.id = vInvoiceInFk
|
||||||
|
AND iis.taxAreaFk = 'CEE'
|
||||||
|
AND transactionTypeSageFk;
|
||||||
|
|
||||||
|
IF vHasDistinctTransactions > 1 THEN
|
||||||
|
CALL util.throw ('This invoice does not allow different types of transactions');
|
||||||
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -44,10 +44,9 @@ proc:BEGIN
|
||||||
LEFT JOIN saleTracking st ON st.saleFk = s.id
|
LEFT JOIN saleTracking st ON st.saleFk = s.id
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
JOIN ticket t ON t.id = s.ticketFk
|
||||||
JOIN client c on c.id = t.clientFk
|
JOIN client c on c.id = t.clientFk
|
||||||
JOIN clientType ct ON ct.id = c.clientTypeFk
|
|
||||||
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
|
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
|
||||||
AND st.saleFk IS NULL
|
AND st.saleFk IS NULL
|
||||||
AND ct.code IN ('normal', 'trust')
|
AND c.typeFk IN ('normal', 'trust')
|
||||||
GROUP BY s.itemFk
|
GROUP BY s.itemFk
|
||||||
) sub2 ON sub2.itemFk = sub.itemFk
|
) sub2 ON sub2.itemFk = sub.itemFk
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
@ -70,10 +69,9 @@ proc:BEGIN
|
||||||
LEFT JOIN saleTracking st ON st.saleFk = s.id
|
LEFT JOIN saleTracking st ON st.saleFk = s.id
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
JOIN ticket t ON t.id = s.ticketFk
|
||||||
JOIN client c on c.id = t.clientFk
|
JOIN client c on c.id = t.clientFk
|
||||||
JOIN clientType ct ON ct.id = c.clientTypeFk
|
|
||||||
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
|
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
|
||||||
AND st.saleFk IS NULL
|
AND st.saleFk IS NULL
|
||||||
AND ct.code IN ('normal', 'trust')
|
AND c.typeFk IN ('normal', 'trust')
|
||||||
GROUP BY s.itemFk
|
GROUP BY s.itemFk
|
||||||
) sub5 ON sub5.itemFk = v.item_id
|
) sub5 ON sub5.itemFk = v.item_id
|
||||||
WHERE v.calc_id = vCalcVisibleFk
|
WHERE v.calc_id = vCalcVisibleFk
|
||||||
|
|
|
@ -120,7 +120,7 @@ BEGIN
|
||||||
TRUE,
|
TRUE,
|
||||||
s.id,
|
s.id,
|
||||||
st.`order`,
|
st.`order`,
|
||||||
ct.`code`,
|
c.typeFk,
|
||||||
cb.claimFk,
|
cb.claimFk,
|
||||||
NULL
|
NULL
|
||||||
FROM sale s
|
FROM sale s
|
||||||
|
@ -128,7 +128,6 @@ BEGIN
|
||||||
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
||||||
LEFT JOIN state st ON st.`code` = ts.`code`
|
LEFT JOIN state st ON st.`code` = ts.`code`
|
||||||
JOIN client c ON c.id = t.clientFk
|
JOIN client c ON c.id = t.clientFk
|
||||||
JOIN clientType ct ON ct.id = c.clientTypeFk
|
|
||||||
JOIN state st2 ON st2.`code` = IF(t.shipped < util.VN_CURDATE(),
|
JOIN state st2 ON st2.`code` = IF(t.shipped < util.VN_CURDATE(),
|
||||||
'DELIVERED',
|
'DELIVERED',
|
||||||
IF (t.shipped > util.dayEnd(util.VN_CURDATE()),
|
IF (t.shipped > util.dayEnd(util.VN_CURDATE()),
|
||||||
|
|
|
@ -8,6 +8,25 @@ BEGIN
|
||||||
* @param vSaleGroupFk Identificador de vn.saleGroup
|
* @param vSaleGroupFk Identificador de vn.saleGroup
|
||||||
* @param vSectorCollectionFk Identificador de vn.sectorCollection
|
* @param vSectorCollectionFk Identificador de vn.sectorCollection
|
||||||
*/
|
*/
|
||||||
|
DECLARE vHasSaleGroup INT;
|
||||||
|
DECLARE vHasSectorCollection INT;
|
||||||
|
|
||||||
|
SELECT COUNT(id) INTO vHasSaleGroup
|
||||||
|
FROM saleGroup
|
||||||
|
WHERE id = vSaleGroupFk;
|
||||||
|
|
||||||
|
IF !vHasSaleGroup THEN
|
||||||
|
CALL util.throw ("invalid saleGroup");
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
SELECT COUNT(id) INTO vHasSectorCollection
|
||||||
|
FROM sectorCollection
|
||||||
|
WHERE id = vSectorCollectionFk;
|
||||||
|
|
||||||
|
IF !vHasSectorCollection THEN
|
||||||
|
CALL util.throw ("invalid sectorCollection");
|
||||||
|
END IF;
|
||||||
|
|
||||||
REPLACE sectorCollectionSaleGroup
|
REPLACE sectorCollectionSaleGroup
|
||||||
SET sectorCollectionFk = vSectorCollectionFk,
|
SET sectorCollectionFk = vSectorCollectionFk,
|
||||||
saleGroupFk = vSaleGroupFk;
|
saleGroupFk = vSaleGroupFk;
|
||||||
|
|
|
@ -75,7 +75,7 @@ BEGIN
|
||||||
|
|
||||||
SET vDated = DATE(vTimed);
|
SET vDated = DATE(vTimed);
|
||||||
|
|
||||||
SELECT IF(pc.name = 'Conductor +3500kg',
|
SELECT IF(pc.code = 'driveCE',
|
||||||
wc.dayBreakDriver,
|
wc.dayBreakDriver,
|
||||||
wc.dayBreak),
|
wc.dayBreak),
|
||||||
wc.shortWeekBreak,
|
wc.shortWeekBreak,
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleLabel_afterUpdate`
|
||||||
|
AFTER UPDATE ON `vn`.`saleLabel`
|
||||||
|
FOR EACH ROW
|
||||||
|
IF NEW.stem >= (SELECT s.quantity FROM sale s WHERE s.id = NEW.saleFk) THEN
|
||||||
|
UPDATE sale s SET s.isPicked = TRUE WHERE s.id = NEW.saleFk;
|
||||||
|
END IF$$
|
||||||
|
DELIMITER ;
|
|
@ -1,14 +0,0 @@
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
||||||
SQL SECURITY DEFINER
|
|
||||||
VIEW `vn`.`doc`
|
|
||||||
AS SELECT `g`.`id` AS `id`,
|
|
||||||
`g`.`sref` AS `sref`,
|
|
||||||
`g`.`brief` AS `brief`,
|
|
||||||
`g`.`emp_id` AS `companyFk`,
|
|
||||||
`g`.`orden` AS `order`,
|
|
||||||
`g`.`file` AS `file`,
|
|
||||||
`g`.`original` AS `original`,
|
|
||||||
`g`.`trabajador_id` AS `workerFk`,
|
|
||||||
`g`.`odbc_date` AS `created`,
|
|
||||||
`g`.`warehouse_id` AS `warehouseFk`
|
|
||||||
FROM `vn2008`.`gestdoc` `g`
|
|
|
@ -1,9 +0,0 @@
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
||||||
SQL SECURITY DEFINER
|
|
||||||
VIEW `vn`.`exchangeInsuranceInPrevious`
|
|
||||||
AS SELECT `ei`.`finished` AS `dated`,
|
|
||||||
`ei`.`amount` AS `amount`,
|
|
||||||
`ei`.`rate` AS `rate`
|
|
||||||
FROM `vn`.`exchangeInsurance` `ei`
|
|
||||||
WHERE `ei`.`amount` <> 0
|
|
||||||
AND `ei`.`financialProductTypefk` = 'SC'
|
|
|
@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
VIEW `vn`.`saleValue`
|
VIEW `vn`.`saleValue`
|
||||||
AS SELECT `wh`.`name` AS `warehouse`,
|
AS SELECT `wh`.`name` AS `warehouse`,
|
||||||
`c`.`name` AS `client`,
|
`c`.`name` AS `client`,
|
||||||
`c`.`typeFk` AS `clientTypeFk`,
|
`c`.`typeFk` AS `typeFk`,
|
||||||
`u`.`name` AS `buyer`,
|
`u`.`name` AS `buyer`,
|
||||||
`it`.`id` AS `itemTypeFk`,
|
`it`.`id` AS `itemTypeFk`,
|
||||||
`it`.`name` AS `family`,
|
`it`.`name` AS `family`,
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
||||||
SQL SECURITY DEFINER
|
|
||||||
VIEW `vn`.`unaryScanLineBuy`
|
|
||||||
AS SELECT `u`.`scan_line_id` AS `unaryScanLineFk`,
|
|
||||||
`u`.`Id_Article` AS `itemFk`
|
|
||||||
FROM `vn2008`.`unary_scan_line_buy` `u`
|
|
|
@ -1,6 +0,0 @@
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
||||||
SQL SECURITY DEFINER
|
|
||||||
VIEW `vn`.`unaryScanLineExpedition`
|
|
||||||
AS SELECT `u`.`scan_line_id` AS `unaryScanLineFk`,
|
|
||||||
`u`.`expedition_id` AS `expeditionFk`
|
|
||||||
FROM `vn2008`.`unary_scan_line_expedition` `u`
|
|
|
@ -45,7 +45,6 @@ proc: BEGIN
|
||||||
DELETE FROM cl_main WHERE Fecha < vDate18;
|
DELETE FROM cl_main WHERE Fecha < vDate18;
|
||||||
DELETE FROM hedera.`order` WHERE date_send < vDate18;
|
DELETE FROM hedera.`order` WHERE date_send < vDate18;
|
||||||
DELETE FROM vn.message WHERE sendDate < vDate;
|
DELETE FROM vn.message WHERE sendDate < vDate;
|
||||||
DELETE FROM travel_reserve WHERE odbc_date < vDate;
|
|
||||||
|
|
||||||
DELETE FROM cache.departure_limit WHERE Fecha < util.VN_CURDATE() - INTERVAL 1 MONTH;
|
DELETE FROM cache.departure_limit WHERE Fecha < util.VN_CURDATE() - INTERVAL 1 MONTH;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn2008`.`movement_label_afterUpdate`
|
|
||||||
AFTER UPDATE ON `movement_label`
|
|
||||||
FOR EACH ROW
|
|
||||||
IF NEW.stem >= (SELECT Cantidad FROM Movimientos WHERE Id_Movimiento = NEW.Id_Movimiento) THEN
|
|
||||||
UPDATE Movimientos SET OK = 1 WHERE Id_Movimiento = NEW.Id_Movimiento;
|
|
||||||
END IF$$
|
|
||||||
DELIMITER ;
|
|
|
@ -34,7 +34,6 @@ AS SELECT `c`.`id` AS `id_cliente`,
|
||||||
`c`.`hasLcr` AS `hasLcr`,
|
`c`.`hasLcr` AS `hasLcr`,
|
||||||
`c`.`defaultAddressFk` AS `default_address`,
|
`c`.`defaultAddressFk` AS `default_address`,
|
||||||
`c`.`riskCalculated` AS `risk_calculated`,
|
`c`.`riskCalculated` AS `risk_calculated`,
|
||||||
`c`.`clientTypeFk` AS `clientes_tipo_id`,
|
|
||||||
`c`.`hasToInvoiceByAddress` AS `invoiceByAddress`,
|
`c`.`hasToInvoiceByAddress` AS `invoiceByAddress`,
|
||||||
`c`.`isTaxDataChecked` AS `contabilizado`,
|
`c`.`isTaxDataChecked` AS `contabilizado`,
|
||||||
`c`.`isFreezed` AS `congelado`,
|
`c`.`isFreezed` AS `congelado`,
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
SQL SECURITY DEFINER
|
SQL SECURITY DEFINER
|
||||||
VIEW `vn2008`.`credit`
|
VIEW `vn2008`.`credit`
|
||||||
AS SELECT `c`.`id` AS `id`,
|
AS SELECT
|
||||||
|
`c`.`id` AS `id`,
|
||||||
`c`.`clientFk` AS `Id_Cliente`,
|
`c`.`clientFk` AS `Id_Cliente`,
|
||||||
`c`.`workerFk` AS `Id_Trabajador`,
|
`c`.`workerFk` AS `Id_Trabajador`,
|
||||||
`c`.`amount` AS `amount`,
|
`c`.`amount` AS `amount`,
|
||||||
`c`.`created` AS `odbc_date`
|
`c`.`created` AS `odbc_date`
|
||||||
FROM `vn`.`clientCredit` `c`
|
FROM
|
||||||
|
`vn`.`clientCredit` `c`
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `vn2008`.`financialProductType`AS
|
||||||
|
SELECT * FROM vn.financialProductType;
|
|
@ -0,0 +1,13 @@
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `vn2008`.`flight`
|
||||||
|
AS SELECT
|
||||||
|
`f`.`id` AS `flight_id`,
|
||||||
|
`f`.`duration` AS `duration`,
|
||||||
|
`f`.`flightPath` AS `route`,
|
||||||
|
`f`.`days` AS `days`,
|
||||||
|
`f`.`airlineFk` AS `airline_id`,
|
||||||
|
`f`.`airportArrivalFk` AS `airport_out`,
|
||||||
|
`f`.`airportDepartureFk` AS `airport_in`
|
||||||
|
FROM
|
||||||
|
`vn`.`flight` `f`;
|
|
@ -0,0 +1,11 @@
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `vn2008`.`gastos_resumen`
|
||||||
|
AS SELECT
|
||||||
|
`es`.`expenseFk` AS `Id_Gasto`,
|
||||||
|
`es`.`year` AS `year`,
|
||||||
|
`es`.`month` AS `month`,
|
||||||
|
`es`.`amount` AS `importe`,
|
||||||
|
`es`.`companyFk` AS `empresa_id`
|
||||||
|
FROM
|
||||||
|
`vn`.`expenseManual` `es`;
|
|
@ -0,0 +1,9 @@
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `vn2008`.`integra2`
|
||||||
|
AS SELECT
|
||||||
|
`i2`.`postCode` AS `postal_code`,
|
||||||
|
`i2`.`frequency` AS `frequency`,
|
||||||
|
`i2`.`warehouseFk` AS `warehouse_id`
|
||||||
|
FROM
|
||||||
|
`vn`.`integra2` `i2`;
|
|
@ -0,0 +1,8 @@
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `vn2008`.`integra2_province`
|
||||||
|
AS SELECT
|
||||||
|
`ip`.`provinceFk` AS `province_id`,
|
||||||
|
`ip`.`franchise` AS `franquicia`
|
||||||
|
FROM
|
||||||
|
`vn`.`integra2Province` `ip`;
|
|
@ -0,0 +1,16 @@
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `vn2008`.`pago_sdc`
|
||||||
|
AS SELECT `ei`.`id` AS `pago_sdc_id`,
|
||||||
|
`ei`.`amount` AS `importe`,
|
||||||
|
`ei`.`dated` AS `fecha`,
|
||||||
|
`ei`.`dueDated` AS `vencimiento`,
|
||||||
|
`ei`.`entityFk` AS `entity_id`,
|
||||||
|
`ei`.`ref` AS `ref`,
|
||||||
|
`ei`.`rate` AS `rate`,
|
||||||
|
`ei`.`companyFk` AS `empresa_id`,
|
||||||
|
`ei`.`financialProductTypefk` AS `financialProductTypefk`,
|
||||||
|
`ei`.`upperBarrier` AS `upperBarrier`,
|
||||||
|
`ei`.`lowerBarrier` AS `lowerBarrier`,
|
||||||
|
`ei`.`strike` AS `strike`
|
||||||
|
FROM `vn`.`exchangeInsurance` `ei`
|
|
@ -0,0 +1,8 @@
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `vn2008`.`versiones`
|
||||||
|
AS SELECT `m`.`app` AS `programa`,
|
||||||
|
`m`.`version` AS `version`,
|
||||||
|
0 AS `critical`
|
||||||
|
FROM `vn`.`mdbVersion` `m`
|
||||||
|
WHERE `m`.`branchFk` = 'master'
|
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `vn2008`.`warehouse_pickup`
|
||||||
|
AS SELECT
|
||||||
|
`wp`.`warehouseFk` AS `warehouse_id`,
|
||||||
|
`wp`.`agencyModeFk` AS `agency_id`
|
||||||
|
FROM
|
||||||
|
`vn`.`warehousePickup` `wp`;
|
|
@ -81,10 +81,6 @@ ALTER TABLE IF EXISTS vn2008.MovimienRENAMEs_avisar__ COMMENT='refs #6371 deprec
|
||||||
ALTER TABLE IF EXISTS vn2008.MovimienRENAMEs_revisar RENAME vn2008.MovimienRENAMEs_revisar__;
|
ALTER TABLE IF EXISTS vn2008.MovimienRENAMEs_revisar RENAME vn2008.MovimienRENAMEs_revisar__;
|
||||||
ALTER TABLE IF EXISTS vn2008.MovimienRENAMEs_revisar__ COMMENT='refs #6371 deprecated 2024-01-11';
|
ALTER TABLE IF EXISTS vn2008.MovimienRENAMEs_revisar__ COMMENT='refs #6371 deprecated 2024-01-11';
|
||||||
|
|
||||||
-- Para la tabla Proveedores_cargueras
|
|
||||||
ALTER TABLE IF EXISTS vn2008.Proveedores_cargueras RENAME vn2008.Proveedores_cargueras__;
|
|
||||||
ALTER TABLE IF EXISTS vn2008.Proveedores_cargueras__ COMMENT='refs #6371 deprecated 2024-01-11';
|
|
||||||
|
|
||||||
-- Para la tabla Proveedores_comunicados
|
-- Para la tabla Proveedores_comunicados
|
||||||
ALTER TABLE IF EXISTS vn2008.Proveedores_comunicados RENAME vn2008.Proveedores_comunicados__;
|
ALTER TABLE IF EXISTS vn2008.Proveedores_comunicados RENAME vn2008.Proveedores_comunicados__;
|
||||||
ALTER TABLE IF EXISTS vn2008.Proveedores_comunicados__ COMMENT='refs #6371 deprecated 2024-01-11';
|
ALTER TABLE IF EXISTS vn2008.Proveedores_comunicados__ COMMENT='refs #6371 deprecated 2024-01-11';
|
||||||
|
@ -101,10 +97,6 @@ ALTER TABLE IF EXISTS vn2008.Tickets_stack__ COMMENT='refs #6371 deprecated 2024
|
||||||
ALTER TABLE IF EXISTS vn2008.Tipos_f11 RENAME vn2008.Tipos_f11__;
|
ALTER TABLE IF EXISTS vn2008.Tipos_f11 RENAME vn2008.Tipos_f11__;
|
||||||
ALTER TABLE IF EXISTS vn2008.Tipos_f11__ COMMENT='refs #6371 deprecated 2024-01-11';
|
ALTER TABLE IF EXISTS vn2008.Tipos_f11__ COMMENT='refs #6371 deprecated 2024-01-11';
|
||||||
|
|
||||||
-- Para la tabla Tramos
|
|
||||||
ALTER TABLE IF EXISTS vn2008.Tramos RENAME vn2008.Tramos__;
|
|
||||||
ALTER TABLE IF EXISTS vn2008.Tramos__ COMMENT='refs #6371 deprecated 2024-01-11';
|
|
||||||
|
|
||||||
-- Para la tabla accion_dits
|
-- Para la tabla accion_dits
|
||||||
ALTER TABLE IF EXISTS vn2008.accion_dits RENAME vn2008.accion_dits__;
|
ALTER TABLE IF EXISTS vn2008.accion_dits RENAME vn2008.accion_dits__;
|
||||||
ALTER TABLE IF EXISTS vn2008.accion_dits__ COMMENT='refs #6371 deprecated 2024-01-11';
|
ALTER TABLE IF EXISTS vn2008.accion_dits__ COMMENT='refs #6371 deprecated 2024-01-11';
|
||||||
|
@ -165,10 +157,6 @@ ALTER TABLE IF EXISTS vn2008.cyc__ COMMENT='refs #6371 deprecated 2024-01-11';
|
||||||
ALTER TABLE IF EXISTS vn2008.cyc_declaration RENAME vn2008.cyc_declaration__;
|
ALTER TABLE IF EXISTS vn2008.cyc_declaration RENAME vn2008.cyc_declaration__;
|
||||||
ALTER TABLE IF EXISTS vn2008.cyc_declaration__ COMMENT='refs #6371 deprecated 2024-01-11';
|
ALTER TABLE IF EXISTS vn2008.cyc_declaration__ COMMENT='refs #6371 deprecated 2024-01-11';
|
||||||
|
|
||||||
-- Para la tabla dock
|
|
||||||
ALTER TABLE IF EXISTS vn2008.dock RENAME vn2008.dock__;
|
|
||||||
ALTER TABLE IF EXISTS vn2008.dock__ COMMENT='refs #6371 deprecated 2024-01-11';
|
|
||||||
|
|
||||||
-- Para la tabla edi_testigos
|
-- Para la tabla edi_testigos
|
||||||
ALTER TABLE IF EXISTS vn2008.edi_testigos RENAME vn2008.edi_testigos__;
|
ALTER TABLE IF EXISTS vn2008.edi_testigos RENAME vn2008.edi_testigos__;
|
||||||
ALTER TABLE IF EXISTS vn2008.edi_testigos__ COMMENT='refs #6371 deprecated 2024-01-11';
|
ALTER TABLE IF EXISTS vn2008.edi_testigos__ COMMENT='refs #6371 deprecated 2024-01-11';
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `vn2008`.`credit`AS
|
||||||
|
SELECT 1;
|
||||||
|
|
||||||
|
GRANT SELECT ON TABLE vn2008.credit TO financialBoss;
|
|
@ -0,0 +1,6 @@
|
||||||
|
ALTER TABLE vn.client DROP FOREIGN KEY tipos_de_cliente;
|
||||||
|
ALTER TABLE vn.client CHANGE COLUMN clientTypeFk clientTypeFk__ INT NOT NULL DEFAULT 1 COMMENT '@deprecated 2024-02-20 refs #6784';
|
||||||
|
ALTER TABLE vn.clientType CHANGE COLUMN id id__ INT NOT NULL COMMENT '@deprecated 2024-02-20 refs #6784';
|
||||||
|
ALTER TABLE vn.clientType DROP PRIMARY KEY;
|
||||||
|
ALTER TABLE vn.clientType ADD PRIMARY KEY (code);
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE IF EXISTS `vn2008`.`financialProductType` RENAME `vn`.`financialProductType`;
|
|
@ -0,0 +1,8 @@
|
||||||
|
ALTER TABLE IF EXISTS `vn2008`.`flight` RENAME `vn`.`flight`;
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS `vn`.`flight`
|
||||||
|
CHANGE COLUMN IF EXISTS `flight_id` `id` varchar(10) NOT NULL,
|
||||||
|
CHANGE COLUMN IF EXISTS `airline_id` `airlineFk` smallint(2) unsigned DEFAULT NULL,
|
||||||
|
CHANGE COLUMN IF EXISTS `route` `flightPath` varchar(20) DEFAULT NULL,
|
||||||
|
CHANGE COLUMN IF EXISTS `airport_out` `airportArrivalFk` varchar(3) NOT NULL,
|
||||||
|
CHANGE COLUMN IF EXISTS `airport_in` `airportDepartureFk` varchar(3) NOT NULL;
|
|
@ -0,0 +1,33 @@
|
||||||
|
ALTER TABLE IF EXISTS vn2008.gastos_resumen DROP FOREIGN KEY IF EXISTS gastos_resumen_expense_FK;
|
||||||
|
ALTER TABLE IF EXISTS `vn2008`.`gastos_resumen` RENAME `vn`.`expenseManual`;
|
||||||
|
|
||||||
|
ALTER TABLE `vn`.`expenseManual`
|
||||||
|
CHANGE COLUMN IF EXISTS `Id_Gasto` `expenseFk` varchar(10) NOT NULL,
|
||||||
|
CHANGE COLUMN IF EXISTS `importe` `amount` decimal(10,2) DEFAULT NULL,
|
||||||
|
CHANGE COLUMN IF EXISTS `empresa_id` `companyFk` int(11) NOT NULL;
|
||||||
|
|
||||||
|
ALTER TABLE vn.expenseManual COLLATE=utf8mb3_general_ci;
|
||||||
|
|
||||||
|
ALTER TABLE vn.expenseManual MODIFY COLUMN IF EXISTS expenseFk varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL;
|
||||||
|
|
||||||
|
ALTER TABLE vn.expenseManual DROP PRIMARY KEY;
|
||||||
|
|
||||||
|
ALTER TABLE vn.expenseManual MODIFY COLUMN companyFk int(10) unsigned NULL;
|
||||||
|
|
||||||
|
ALTER TABLE vn.expenseManual ADD CONSTRAINT expenseManual_expense_FK FOREIGN KEY IF NOT EXISTS (expenseFk) REFERENCES vn.expense(id) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
ALTER TABLE vn.expenseManual ADD CONSTRAINT expenseManual_company_FK FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company(id) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
ALTER TABLE vn.expenseManual ADD IF NOT EXISTS id INT unsigned NOT NULL FIRST;
|
||||||
|
|
||||||
|
ALTER TABLE vn.expenseManual ADD CONSTRAINT expenseManual_pk PRIMARY KEY IF NOT EXISTS (id);
|
||||||
|
|
||||||
|
ALTER TABLE vn.expenseManual ADD CONSTRAINT expenseManual_unique UNIQUE KEY IF NOT EXISTS (expenseFk,`year`,`month`,companyFk);
|
||||||
|
|
||||||
|
ALTER TABLE vn.expenseManual MODIFY COLUMN IF EXISTS companyFk int(10) unsigned NOT NULL;
|
||||||
|
|
||||||
|
UPDATE vn.expenseManual
|
||||||
|
SET companyFK= NULL
|
||||||
|
WHERE companyFk= 0;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
ALTER TABLE IF EXISTS `vn2008`.`integra2` RENAME `vn`.`integra2`;
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS `vn`.`integra2`
|
||||||
|
CHANGE COLUMN IF EXISTS `postal_code` `postCode` varchar(10) NOT NULL,
|
||||||
|
CHANGE COLUMN IF EXISTS `frequency` `frequency` decimal(10,2) DEFAULT NULL,
|
||||||
|
CHANGE COLUMN IF EXISTS `warehouse_id` `warehouseFk` smallint(6) unsigned NOT NULL;
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn.integra2 ADD CONSTRAINT integra2_warehouse_FK
|
||||||
|
FOREIGN KEY (warehouseFk) REFERENCES vn.warehouse(id) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
ALTER TABLE IF EXISTS `vn2008`.`integra2_province` RENAME `vn`.`integra2Province`;
|
||||||
|
ALTER TABLE IF EXISTS `vn`.`integra2Province`
|
||||||
|
CHANGE COLUMN IF EXISTS `franquicia` `franchise` varchar(65) NOT NULL,
|
||||||
|
CHANGE COLUMN IF EXISTS `province_id` `provinceFk` smallint(6) unsigned NOT NULL;
|
|
@ -0,0 +1 @@
|
||||||
|
DROP TABLE IF EXISTS vn2008.intervalos__;
|
|
@ -0,0 +1 @@
|
||||||
|
DROP TABLE IF EXISTS vn2008.mail_templates__;
|
|
@ -0,0 +1 @@
|
||||||
|
DROP TABLE IF EXISTS vn2008.ticket_location__;
|
|
@ -0,0 +1 @@
|
||||||
|
DROP TABLE IF EXISTS vn2008.turn__;
|
|
@ -0,0 +1,8 @@
|
||||||
|
DROP TRIGGER IF EXISTS `vn2008`.`movement_label_afterUpdate`;
|
||||||
|
|
||||||
|
DROP VIEW IF EXISTS `vn`.`saleLabel`;
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS `vn2008`.`movement_label` RENAME `vn`.`saleLabel`;
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS `vn`.`saleLabel`
|
||||||
|
CHANGE COLUMN IF EXISTS `Id_movimiento` `saleFk` int(11) NOT NULL;
|
|
@ -0,0 +1,11 @@
|
||||||
|
DROP VIEW IF EXISTS `vn`.`exchangeInsurance`;
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS `vn2008`.`pago_sdc` RENAME `vn`.`exchangeInsurance`;
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS `vn`.`exchangeInsurance`
|
||||||
|
CHANGE COLUMN IF EXISTS `pago_sdc_id` `id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
CHANGE COLUMN IF EXISTS `importe` `amount` decimal(10,2) NOT NULL,
|
||||||
|
CHANGE COLUMN IF EXISTS `fecha` `dated` date NOT NULL,
|
||||||
|
CHANGE COLUMN IF EXISTS `vencimiento` `dueDated` date NOT NULL,
|
||||||
|
CHANGE COLUMN IF EXISTS `entity_id` `entityFk` int(10) unsigned NOT NULL,
|
||||||
|
CHANGE COLUMN IF EXISTS `empresa_id` `companyFk`int(10) unsigned NOT NULL DEFAULT 442;
|
|
@ -0,0 +1,7 @@
|
||||||
|
ALTER TABLE IF EXISTS `vn2008`.`warehouse_pickup` RENAME `vn`.`warehousePickup`;
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS `vn`.`warehousePickup`
|
||||||
|
CHANGE COLUMN IF EXISTS `warehouse_id` `warehouseFk` smallint(5) unsigned NOT NULL,
|
||||||
|
CHANGE COLUMN IF EXISTS `agency_id` `agencyModeFk` int(11) DEFAULT NULL;
|
||||||
|
|
||||||
|
ALTER TABLE `vn`.`warehousePickup` COMMENT='Agencia de recogida para cada almacén';
|
|
@ -0,0 +1,155 @@
|
||||||
|
ALTER TABLE IF EXISTS vn2008.template_bionic_component RENAME vn2008.template_bionic_component__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.template_bionic_component__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.template_bionic_lot RENAME vn2008.template_bionic_lot__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.template_bionic_lot__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.template_bionic_price RENAME vn2008.template_bionic_price__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.template_bionic_price__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.tmpNEWTARIFAS RENAME vn2008.tmpNEWTARIFAS__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.tmpNEWTARIFAS__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.unaryScanFilter RENAME vn2008.unaryScanFilter__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.unaryScanFilter__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.unary_source RENAME vn2008.unary_source__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.unary_source__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.viaxpress RENAME vn2008.viaxpress__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.viaxpress__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.warehouse_filtro RENAME vn2008.warehouse_filtro__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.warehouse_filtro__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.warehouse_group RENAME vn2008.warehouse_group__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.warehouse_group__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.warehouse_joined RENAME vn2008.warehouse_joined__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.warehouse_joined__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.warehouse_lc RENAME vn2008.warehouse_lc__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.warehouse_lc__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.wh_selection RENAME vn2008.wh_selection__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.wh_selection__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.trolley RENAME vn2008.trolley__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.trolley__ COMMENT='refs #6372 @deprecated 2023-12-13;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.zones RENAME vn2008.zones__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.zones__ COMMENT='refs #6372 @deprecated 2023-12-13;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.tblIVA RENAME vn2008.tblIVA__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.tblIVA__ COMMENT='refs #6372 @deprecated 2023-12-13;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.filtros RENAME vn2008.filtros__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.filtros__ COMMENT='refs #6372 @deprecated 2023-11-21;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.form_query RENAME vn2008.form_query__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.form_query__ COMMENT='refs #6372 @deprecated 2023-11-21;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.guillen RENAME vn2008.guillen__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.guillen__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.guillen_carry RENAME vn2008.guillen_carry__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.guillen_carry__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.integra2_escala RENAME vn2008.integra2_escala__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.integra2_escala__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.invoice_observation RENAME vn2008.invoice_observation__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.invoice_observation__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.nichos RENAME vn2008.nichos__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.nichos__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.payroll_bonificaciones RENAME vn2008.payroll_bonificaciones__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.payroll_bonificaciones__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.payroll_datos RENAME vn2008.payroll_datos__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.payroll_datos__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.payroll_embargos RENAME vn2008.payroll_embargos__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.payroll_embargos__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.payroll_tipobasess RENAME vn2008.payroll_tipobasess__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.payroll_tipobasess__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.preparation_exception RENAME vn2008.preparation_exception__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.preparation_exception__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.payrroll_apEmpresarial RENAME vn2008.payrroll_apEmpresarial__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.payrroll_apEmpresarial__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.rec_translator RENAME vn2008.rec_translator__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.rec_translator__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.recibida_agricola RENAME vn2008.recibida_agricola__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.recibida_agricola__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.rounding RENAME vn2008.rounding__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.rounding__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.scanTree RENAME vn2008.scanTree__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.scanTree__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.sort_merge_results_ernesto RENAME vn2008.sort_merge_results_ernesto__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.sort_merge_results_ernesto__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.route RENAME vn2008.route__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.route__ COMMENT='refs #6372 @deprecated 2023-11-28;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.travel_reserve RENAME vn2008.travel_reserve__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.travel_reserve__ COMMENT='refs #6372 @deprecated 2023-12-13;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.wks RENAME vn2008.wks__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.wks__ COMMENT='refs #6372 @deprecated 2023-12-13;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.unary RENAME vn2008.unary__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.unary__ COMMENT='refs #6372 @deprecated 2023-12-13;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.unary_scan RENAME vn2008.unary_scan__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.unary_scan__ COMMENT='refs #6372 @deprecated 2023-12-13;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.unary_scan_line RENAME vn2008.unary_scan_line__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.unary_scan_line__ COMMENT='refs #6372 @deprecated 2023-12-13;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.unary_scan_line_buy RENAME vn2008.unary_scan_line_buy__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.unary_scan_line_buy__ COMMENT='refs #6372 @deprecated 2023-12-13;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.unary_scan_line_expedition RENAME vn2008.unary_scan_line_expedition__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.unary_scan_line_expedition__ COMMENT='refs #6372 @deprecated 2023-12-13;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.widget RENAME vn2008.widget__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.widget__ COMMENT='refs #6372 @deprecated 2023-12-13;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.scan RENAME vn2008.scan__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.scan__ COMMENT='refs #6372 @deprecated 2023-12-13;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.scan_line RENAME vn2008.scan_line__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.scan_line__ COMMENT='refs #6372 @deprecated 2023-12-13;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.tipsa RENAME vn2008.tipsa__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.tipsa__ COMMENT='refs #6372 @deprecated 2023-12-13;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.payroll_basess RENAME vn2008.payroll_basess__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.payroll_basess__ COMMENT='refs #6372 @deprecated 2023-12-13;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.pago_sdc RENAME vn2008.pago_sdc__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.pago_sdc__ COMMENT='refs #6372 @deprecated 2023-12-13;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.transport RENAME vn2008.transport__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.transport__ COMMENT='refs #6372 @deprecated 2023-12-13;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.travel_pattern RENAME vn2008.travel_pattern__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.travel_pattern__ COMMENT='refs #6372 @deprecated 2023-12-13;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.jerarquia RENAME vn2008.jerarquia__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.jerarquia__ COMMENT='refs #6372 @deprecated 2023-12-13;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.language RENAME vn2008.language__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.language__ COMMENT='refs #6372 @deprecated 2023-12-13;';
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS vn2008.link RENAME vn2008.link__;
|
||||||
|
ALTER TABLE IF EXISTS vn2008.link__ COMMENT='refs #6372 @deprecated 2023-12-13;';
|
|
@ -0,0 +1,32 @@
|
||||||
|
-- flight
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `vn2008`.`flight` AS
|
||||||
|
SELECT 1;
|
||||||
|
GRANT SELECT, INSERT, UPDATE ON TABLE vn2008.flight TO `logistic`;
|
||||||
|
GRANT SELECT, INSERT, UPDATE ON TABLE vn.flight TO `logistic`;
|
||||||
|
-- integra2_province
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `vn2008`.`integra2_province` AS
|
||||||
|
SELECT 1;
|
||||||
|
GRANT SELECT ON TABLE vn2008.integra2_province TO `employee`;
|
||||||
|
GRANT SELECT ON TABLE vn.integra2Province TO `employee`;
|
||||||
|
-- link
|
||||||
|
|
||||||
|
GRANT SELECT ON TABLE vn.company TO `administrative`;
|
||||||
|
GRANT SELECT ON TABLE vn.company TO `hr`;
|
||||||
|
|
||||||
|
-- warehouse_pickup
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `vn2008`.`warehouse_pickup` AS
|
||||||
|
SELECT 1;
|
||||||
|
GRANT SELECT ON TABLE vn2008.warehouse_pickup TO `logistic`;
|
||||||
|
GRANT SELECT ON TABLE vn.warehousePickup TO `logistic`;
|
||||||
|
GRANT SELECT ON TABLE vn2008.warehouse_pickup TO `claimManager`;
|
||||||
|
GRANT SELECT ON TABLE vn.warehousePickup TO `claimManager`;
|
||||||
|
GRANT SELECT ON TABLE vn2008.warehouse_pickup TO `employee`;
|
||||||
|
GRANT SELECT ON TABLE vn.warehousePickup TO `employee`;
|
||||||
|
GRANT SELECT ON TABLE vn2008.warehouse_pickup TO `deliveryAssistant`;
|
||||||
|
GRANT SELECT ON TABLE vn.warehousePickup TO `deliveryAssistant`;
|
|
@ -0,0 +1,13 @@
|
||||||
|
-- Place your SQL code here
|
||||||
|
CREATE TABLE vn.workerActivity (
|
||||||
|
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
model ENUM('COM', 'ENT', 'TPV', 'ENC', 'LAB', 'ETI') NOT NULL,
|
||||||
|
workerFk INT(10) UNSIGNED NOT NULL,
|
||||||
|
event ENUM('open', 'close', 'insert', 'delete', 'update', 'refresh') NOT NULL,
|
||||||
|
description VARCHAR(255) DEFAULT NULL,
|
||||||
|
CONSTRAINT fk_workerActivity_worker FOREIGN KEY (workerFk)
|
||||||
|
REFERENCES vn.worker (id)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
);
|
|
@ -0,0 +1,6 @@
|
||||||
|
ALTER TABLE vn.professionalCategory DROP COLUMN IF EXISTS code;
|
||||||
|
ALTER TABLE IF EXISTS vn.professionalCategory ADD COLUMN code VARCHAR(25) DEFAULT NULL;
|
||||||
|
|
||||||
|
UPDATE vn.professionalCategory
|
||||||
|
SET code = 'driverCE'
|
||||||
|
WHERE name = 'Conductor C + E';
|
|
@ -28,7 +28,6 @@ module.exports = Self => {
|
||||||
Self.setRating = async function(ctx, id, rating, recommendedCredit, options) {
|
Self.setRating = async function(ctx, id, rating, recommendedCredit, options) {
|
||||||
let tx;
|
let tx;
|
||||||
const myOptions = {};
|
const myOptions = {};
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
@ -42,6 +41,7 @@ module.exports = Self => {
|
||||||
const clientUpdated = await client.updateAttributes({
|
const clientUpdated = await client.updateAttributes({
|
||||||
rating: rating,
|
rating: rating,
|
||||||
recommendedCredit: recommendedCredit
|
recommendedCredit: recommendedCredit
|
||||||
|
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
|
|
|
@ -40,4 +40,26 @@ describe('Client setRating()', () => {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should change rating and recommendedCredit to 0', async() => {
|
||||||
|
const tx = await models.Ticket.beginTransaction({});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
const clientId = 1101;
|
||||||
|
const newRating = 0;
|
||||||
|
const newRecommendedCredit = 0;
|
||||||
|
|
||||||
|
const updatedClient = await models.Client.setRating(ctx, clientId, newRating, newRecommendedCredit, options);
|
||||||
|
|
||||||
|
expect(updatedClient.rating).toEqual(newRating);
|
||||||
|
expect(updatedClient.recommendedCredit).toEqual(newRecommendedCredit);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,12 +7,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
|
||||||
"type": "number",
|
|
||||||
"id": true
|
|
||||||
},
|
|
||||||
"code": {
|
"code": {
|
||||||
"type": "string"
|
"type": "string",
|
||||||
|
"id": true
|
||||||
},
|
},
|
||||||
"type": {
|
"type": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
|
|
@ -319,7 +319,8 @@ module.exports = Self => {
|
||||||
await Self.changeCredit(ctx, finalState, changes);
|
await Self.changeCredit(ctx, finalState, changes);
|
||||||
|
|
||||||
// Credit management changes
|
// Credit management changes
|
||||||
if (changes?.rating || changes?.recommendedCredit)
|
|
||||||
|
if (changes?.rating >= 0 || changes?.recommendedCredit >= 0)
|
||||||
await Self.changeCreditManagement(ctx, finalState, changes);
|
await Self.changeCreditManagement(ctx, finalState, changes);
|
||||||
|
|
||||||
const oldInstance = {};
|
const oldInstance = {};
|
||||||
|
|
|
@ -197,7 +197,7 @@
|
||||||
"type": {
|
"type": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "ClientType",
|
"model": "ClientType",
|
||||||
"foreignKey": "clientTypeFk"
|
"foreignKey": "typeFk"
|
||||||
},
|
},
|
||||||
"businessType": {
|
"businessType": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
|
|
|
@ -29,17 +29,11 @@ module.exports = Self => {
|
||||||
where: {id: orderId},
|
where: {id: orderId},
|
||||||
fields: ['isConfirmed', 'clientFk'],
|
fields: ['isConfirmed', 'clientFk'],
|
||||||
include: [
|
include: [
|
||||||
{relation: 'client',
|
{relation: 'client'}
|
||||||
scope: {
|
|
||||||
include: {
|
|
||||||
relation: 'type'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
if (exists && exists.client().type().code !== 'normal')
|
if (exists && exists.client().typeFk !== 'normal')
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!exists || exists.isConfirmed === 1)
|
if (!exists || exists.isConfirmed === 1)
|
||||||
|
|
|
@ -49,17 +49,12 @@ module.exports = Self => {
|
||||||
where: {id: addressId},
|
where: {id: addressId},
|
||||||
fields: ['clientFk'],
|
fields: ['clientFk'],
|
||||||
include: [
|
include: [
|
||||||
{relation: 'client',
|
{relation: 'client'
|
||||||
scope: {
|
|
||||||
include: {
|
|
||||||
relation: 'type'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
if (address.client().type().code === 'normal') {
|
if (address.client().typeFk === 'normal') {
|
||||||
if (!address.client().isActive)
|
if (!address.client().isActive)
|
||||||
throw new UserError(`You can't create an order for an inactive client`);
|
throw new UserError(`You can't create an order for an inactive client`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('sale usesMana()', () => {
|
describe('sale usesMana()', () => {
|
||||||
const ctx = {
|
const ctx = {req: { accessToken: {userId: 18}}};
|
||||||
req: {
|
|
||||||
accessToken: {userId: 18}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
it('should return that the worker uses mana', async() => {
|
it('should return that the worker uses mana', async() => {
|
||||||
const tx = await models.Sale.beginTransaction({});
|
const tx = await models.Sale.beginTransaction({});
|
||||||
|
@ -45,4 +41,27 @@ describe('sale usesMana()', () => {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return that the worker does not use mana because it is excluded', async() => {
|
||||||
|
const tx = await models.Sale.beginTransaction({});
|
||||||
|
const buyerId = 35;
|
||||||
|
const franceDepartmentId = 133;
|
||||||
|
const buyerCtx = {req: {accessToken: {userId: buyerId}}};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx}
|
||||||
|
|
||||||
|
await models.WorkerManaExcluded.create({workerFk: buyerId}, options);
|
||||||
|
await models.Business.updateAll({workerFk: buyerId}, {departmentFk: franceDepartmentId}, options);
|
||||||
|
|
||||||
|
const usesMana = await models.Sale.usesMana(buyerCtx, options);
|
||||||
|
|
||||||
|
expect(usesMana).toBe(false);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,6 +21,9 @@ module.exports = Self => {
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
const isManaExcluded = await models.WorkerManaExcluded.findById(userId, null, myOptions);
|
||||||
|
if (isManaExcluded) return false;
|
||||||
|
|
||||||
const salesDepartment = await models.Department.findOne({where: {code: 'VT'}, fields: 'id'}, myOptions);
|
const salesDepartment = await models.Department.findOne({where: {code: 'VT'}, fields: 'id'}, myOptions);
|
||||||
const departments = await models.Department.getLeaves(ctx, salesDepartment.id, null, myOptions);
|
const departments = await models.Department.getLeaves(ctx, salesDepartment.id, null, myOptions);
|
||||||
const workerDepartment = await models.WorkerDepartment.findById(userId, null, myOptions);
|
const workerDepartment = await models.WorkerDepartment.findById(userId, null, myOptions);
|
||||||
|
|
|
@ -17,21 +17,16 @@ module.exports = Self => {
|
||||||
const alertLevel = state ? state.alertLevel : null;
|
const alertLevel = state ? state.alertLevel : null;
|
||||||
const ticket = await models.Ticket.findById(id, {
|
const ticket = await models.Ticket.findById(id, {
|
||||||
fields: ['clientFk'],
|
fields: ['clientFk'],
|
||||||
include: [{
|
|
||||||
relation: 'client',
|
|
||||||
scope: {
|
|
||||||
include: {
|
include: {
|
||||||
relation: 'type'
|
relation: 'client'
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}]
|
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
const isLocked = await models.Ticket.isLocked(id, myOptions);
|
const isLocked = await models.Ticket.isLocked(id, myOptions);
|
||||||
const isWeekly = await models.TicketWeekly.findOne({where: {ticketFk: id}}, myOptions);
|
const isWeekly = await models.TicketWeekly.findOne({where: {ticketFk: id}}, myOptions);
|
||||||
|
|
||||||
const alertLevelGreaterThanZero = (alertLevel && alertLevel > 0);
|
const alertLevelGreaterThanZero = (alertLevel && alertLevel > 0);
|
||||||
const isNormalClient = ticket && ticket.client().type().code == 'normal';
|
const isNormalClient = ticket && ticket.client().typeFk == 'normal';
|
||||||
const isEditable = !(alertLevelGreaterThanZero && isNormalClient);
|
const isEditable = !(alertLevelGreaterThanZero && isNormalClient);
|
||||||
|
|
||||||
if (!ticket)
|
if (!ticket)
|
||||||
|
|
|
@ -77,12 +77,7 @@ module.exports = Self => {
|
||||||
where: {id: args.addressId},
|
where: {id: args.addressId},
|
||||||
fields: ['id', 'clientFk'],
|
fields: ['id', 'clientFk'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'client',
|
relation: 'client'
|
||||||
scope: {
|
|
||||||
include: {
|
|
||||||
relation: 'type'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
|
@ -93,7 +88,7 @@ module.exports = Self => {
|
||||||
if (args.agencyModeId)
|
if (args.agencyModeId)
|
||||||
agencyMode = await models.AgencyMode.findById(args.agencyModeId, null, myOptions);
|
agencyMode = await models.AgencyMode.findById(args.agencyModeId, null, myOptions);
|
||||||
|
|
||||||
if (address.client().type().code === 'normal' && (!agencyMode || agencyMode.code != 'refund')) {
|
if (address.client().typeFk === 'normal' && (!agencyMode || agencyMode.code != 'refund')) {
|
||||||
const canCreateTicket = await models.Client.canCreateTicket(args.clientId, myOptions);
|
const canCreateTicket = await models.Client.canCreateTicket(args.clientId, myOptions);
|
||||||
if (!canCreateTicket)
|
if (!canCreateTicket)
|
||||||
throw new UserError(`You can't create a ticket for an inactive client`);
|
throw new UserError(`You can't create a ticket for an inactive client`);
|
||||||
|
|
|
@ -33,8 +33,8 @@ module.exports = Self => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const myOptions = {userId: ctx.req.accessToken.userId};
|
const myOptions = {userId: ctx.req.accessToken.userId};
|
||||||
let tx;
|
let tx;
|
||||||
let ticket;
|
let dms;
|
||||||
let externalTickets = [];
|
let gestDocCreated = false;
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
@ -44,11 +44,6 @@ module.exports = Self => {
|
||||||
myOptions.transaction = tx;
|
myOptions.transaction = tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
const dmsTypeTicket = await models.DmsType.findOne({
|
|
||||||
where: {code: 'ticket'},
|
|
||||||
fields: ['id']
|
|
||||||
}, myOptions);
|
|
||||||
|
|
||||||
async function setLocation(ticketId) {
|
async function setLocation(ticketId) {
|
||||||
await models.Delivery.create({
|
await models.Delivery.create({
|
||||||
ticketFk: ticketId,
|
ticketFk: ticketId,
|
||||||
|
@ -58,106 +53,102 @@ module.exports = Self => {
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function hasSignDms(ticketId) {
|
async function gestDocExists(ticketId) {
|
||||||
const ticketDms = await models.TicketDms.findOne({
|
const ticketDms = await models.TicketDms.findOne({
|
||||||
where: {ticketFk: ticketId},
|
where: {ticketFk: ticketId},
|
||||||
|
fields: ['dmsFk']
|
||||||
|
}, myOptions);
|
||||||
|
|
||||||
|
if (!ticketDms) return false;
|
||||||
|
|
||||||
|
const ticket = await models.Ticket.findById(ticketId, {fields: ['isSigned']}, myOptions);
|
||||||
|
if (ticket.isSigned == true)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
await models.Dms.destroyAll({where: {reference: ticketId}}, myOptions);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createGestDoc(id) {
|
||||||
|
const ticket = await models.Ticket.findById(id,
|
||||||
|
{
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
relation: 'dms',
|
relation: 'warehouse',
|
||||||
fields: ['id'],
|
|
||||||
scope: {
|
scope: {
|
||||||
where: {dmsTypeFk: dmsTypeTicket.id}
|
fields: ['id']
|
||||||
}
|
}
|
||||||
}
|
}, {
|
||||||
]
|
relation: 'client',
|
||||||
}, myOptions);
|
|
||||||
if (ticketDms?.dms()?.id) return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function createGestDoc() {
|
|
||||||
const ctxUploadFile = Object.assign({}, ctx);
|
|
||||||
ctxUploadFile.args = {
|
|
||||||
warehouseId: ticket.warehouseFk,
|
|
||||||
companyId: ticket.companyFk,
|
|
||||||
dmsTypeId: dmsTypeTicket.id,
|
|
||||||
reference: ticket.id,
|
|
||||||
description: `Firma del cliente - Ruta ${ticket.route().id}`,
|
|
||||||
contentType: 'image/png',
|
|
||||||
hasFile: true
|
|
||||||
};
|
|
||||||
const dms = await models.Dms.uploadFile(ctxUploadFile, myOptions);
|
|
||||||
await models.TicketDms.create({ticketFk: ticket.id, dmsFk: dms[0].id}, myOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
for (const ticketId of tickets) {
|
|
||||||
ticket = await models.Ticket.findById(ticketId, {
|
|
||||||
include: [{
|
|
||||||
relation: 'address',
|
|
||||||
scope: {
|
scope: {
|
||||||
include: {
|
fields: ['name']
|
||||||
relation: 'province',
|
|
||||||
scope: {
|
|
||||||
include: {
|
|
||||||
relation: 'country',
|
|
||||||
scope: {
|
|
||||||
fields: ['code']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
relation: 'route',
|
relation: 'route',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id']
|
fields: ['id']
|
||||||
}
|
}
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
const dmsType = await models.DmsType.findOne({where: {code: 'Ticket'}, fields: ['id']}, myOptions);
|
||||||
|
const ctxUploadFile = Object.assign({}, ctx);
|
||||||
|
if (ticket.route() === null)
|
||||||
|
throw new UserError('Ticket without route');
|
||||||
|
ctxUploadFile.args = {
|
||||||
|
warehouseId: ticket.warehouseFk,
|
||||||
|
companyId: ticket.companyFk,
|
||||||
|
dmsTypeId: dmsType.id,
|
||||||
|
reference: '',
|
||||||
|
description: `Firma del cliente - Ruta ${ticket.route().id}`,
|
||||||
|
hasFile: false
|
||||||
|
};
|
||||||
|
dms = await models.Dms.uploadFile(ctxUploadFile, myOptions);
|
||||||
|
gestDocCreated = true;
|
||||||
|
}
|
||||||
|
|
||||||
const ticketState = await models.TicketState.findOne({
|
try {
|
||||||
where: {ticketFk: ticketId},
|
for (const ticketId of tickets) {
|
||||||
|
const ticketState = await models.TicketState.findOne(
|
||||||
|
{where: {ticketFk: ticketId},
|
||||||
fields: ['alertLevel']
|
fields: ['alertLevel']
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
const packedAlertLevel = await models.AlertLevel.findOne({
|
const packedAlertLevel = await models.AlertLevel.findOne({where: {code: 'PACKED'},
|
||||||
where: {code: 'PACKED'},
|
|
||||||
fields: ['id']
|
fields: ['id']
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
if (!ticketState)
|
if (!ticketState)
|
||||||
throw new UserError('Ticket does not exist');
|
throw new UserError('Ticket does not exist');
|
||||||
if (!ticket.route())
|
|
||||||
throw new UserError('Ticket without route');
|
|
||||||
if (ticketState.alertLevel < packedAlertLevel.id)
|
if (ticketState.alertLevel < packedAlertLevel.id)
|
||||||
throw new UserError('This ticket cannot be signed because it has not been boxed');
|
throw new UserError('This ticket cannot be signed because it has not been boxed');
|
||||||
if (await ticket.isSigned)
|
if (await gestDocExists(ticketId))
|
||||||
throw new UserError('Ticket is already signed');
|
throw new UserError('Ticket is already signed');
|
||||||
|
|
||||||
if (location) await setLocation(ticketId);
|
if (location) await setLocation(ticketId);
|
||||||
if (!await hasSignDms(ticketId))
|
if (!gestDocCreated) await createGestDoc(ticketId);
|
||||||
await createGestDoc(ticketId);
|
await models.TicketDms.create({ticketFk: ticketId, dmsFk: dms[0].id}, myOptions);
|
||||||
|
const ticket = await models.Ticket.findById(ticketId, null, myOptions);
|
||||||
await ticket.updateAttribute('isSigned', true, myOptions);
|
await ticket.updateAttribute('isSigned', true, myOptions);
|
||||||
|
|
||||||
const deliveryState = await models.State.findOne({
|
const deliveryState = await models.State.findOne({
|
||||||
where: {code: 'DELIVERED'}
|
where: {
|
||||||
|
code: 'DELIVERED'
|
||||||
|
}
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
await models.Ticket.state(ctx, {
|
await models.Ticket.state(ctx, {
|
||||||
ticketFk: ticketId,
|
ticketFk: ticketId,
|
||||||
stateFk: deliveryState.id
|
stateFk: deliveryState.id
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
}
|
||||||
|
|
||||||
if (ticket?.address()?.province()?.country()?.code != 'ES') {
|
|
||||||
await models.Ticket.saveCmr(ctx, [ticketId], myOptions);
|
|
||||||
externalTickets.push(ticketId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
|
return;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (tx) await tx.rollback();
|
if (tx) await tx.rollback();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
await models.Route.cmrEmail(ctx, externalTickets);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,7 +42,7 @@ module.exports = Self => {
|
||||||
include: {
|
include: {
|
||||||
relation: 'client',
|
relation: 'client',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id', 'clientTypeFk'],
|
fields: ['id', 'typeFk'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'type',
|
relation: 'type',
|
||||||
scope: {
|
scope: {
|
||||||
|
@ -53,7 +53,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ctx.options);
|
ctx.options);
|
||||||
if (ticket?.client()?.type()?.code === 'loses') return;
|
if (ticket?.client()?.typeFk === 'loses') return;
|
||||||
|
|
||||||
const isRefund = await models.TicketRefund.findOne({
|
const isRefund = await models.TicketRefund.findOne({
|
||||||
fields: ['id'],
|
fields: ['id'],
|
||||||
|
|
|
@ -137,7 +137,8 @@ module.exports = Self => {
|
||||||
tb.type,
|
tb.type,
|
||||||
tb.businessFk,
|
tb.businessFk,
|
||||||
tb.permissionRate,
|
tb.permissionRate,
|
||||||
d.isTeleworking
|
d.isTeleworking,
|
||||||
|
d.hasToRefill
|
||||||
FROM tmp.timeBusinessCalculate tb
|
FROM tmp.timeBusinessCalculate tb
|
||||||
JOIN account.user u ON u.id = tb.userFk
|
JOIN account.user u ON u.id = tb.userFk
|
||||||
JOIN department d ON d.id = tb.departmentFk
|
JOIN department d ON d.id = tb.departmentFk
|
||||||
|
@ -174,7 +175,7 @@ module.exports = Self => {
|
||||||
myOptions.transaction = tx;
|
myOptions.transaction = tx;
|
||||||
try {
|
try {
|
||||||
workerFk = day.workerFk;
|
workerFk = day.workerFk;
|
||||||
if (day.timeWorkDecimal > 0 && day.timeWorkedDecimal == null
|
if (day.hasToRefill && day.timeWorkDecimal > 0 && day.timeWorkedDecimal == null
|
||||||
&& (day.permissionRate == null ? true : day.permissionRate)) {
|
&& (day.permissionRate == null ? true : day.permissionRate)) {
|
||||||
if (day.timeTable == null) {
|
if (day.timeTable == null) {
|
||||||
const timed = new Date(day.dated);
|
const timed = new Date(day.dated);
|
||||||
|
|
|
@ -46,6 +46,31 @@ describe('workerTimeControl clockIn()', () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should throw an error trying to change a middle hour to out not resting 12h', async() => {
|
||||||
|
activeCtx.accessToken.userId = HHRRId;
|
||||||
|
const workerId = teamBossId;
|
||||||
|
|
||||||
|
const tx = await models.WorkerTimeControl.beginTransaction({});
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
const entryTime = "2000-12-25T11:00:00.000Z";
|
||||||
|
ctx.args = {timed: entryTime, direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
const middleTime ="2000-12-26T11:00:00.000Z";
|
||||||
|
ctx.args = {timed: middleTime, direction: 'middle'};
|
||||||
|
const middleEntryTime = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
const direction = 'out';
|
||||||
|
await models.WorkerTimeControl.updateTimeEntry(ctx, middleEntryTime.id, direction, options);
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
expect(e.message).toBe('Superado el tiempo máximo entre entrada y salida');
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
describe('as Role errors', () => {
|
describe('as Role errors', () => {
|
||||||
it('should add if the current user is team boss and the target user is himself', async() => {
|
it('should add if the current user is team boss and the target user is himself', async() => {
|
||||||
activeCtx.accessToken.userId = teamBossId;
|
activeCtx.accessToken.userId = teamBossId;
|
||||||
|
@ -110,16 +135,22 @@ describe('workerTimeControl clockIn()', () => {
|
||||||
todayAtOne.setHours(1, 0, 0, 0);
|
todayAtOne.setHours(1, 0, 0, 0);
|
||||||
|
|
||||||
ctx.args = {timed: todayAtOne, direction: 'in'};
|
ctx.args = {timed: todayAtOne, direction: 'in'};
|
||||||
const createdTimeEntry = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
const entryTime = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
expect(entryTime.id).toBeDefined();
|
||||||
|
const todayAtTwo = Date.vnNew();
|
||||||
|
|
||||||
expect(createdTimeEntry.id).toBeDefined();
|
todayAtTwo.setHours(2, 0, 0, 0);
|
||||||
|
ctx.args = {timed: todayAtTwo, direction: 'middle'};
|
||||||
|
const middleTime = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
ctx.args = {direction: 'out'};
|
const direction = 'out';
|
||||||
const updatedTimeEntry = await models.WorkerTimeControl.updateTimeEntry(
|
const {id:outTimeEntryId} = await models.WorkerTimeControl.updateTimeEntry(
|
||||||
ctx, createdTimeEntry.id, options
|
ctx, middleTime.id, direction, options
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(updatedTimeEntry.direction).toEqual('out');
|
const {direction: updatedDirection} = await models.WorkerTimeControl.findById(outTimeEntryId,{fields:['direction']},options);
|
||||||
|
expect(updatedDirection).toEqual('out');
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
|
|
|
@ -26,32 +26,39 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.updateTimeEntry = async(ctx, id, options) => {
|
Self.updateTimeEntry = async(ctx, timeEntryId, direction, options) => {
|
||||||
const currentUserId = ctx.req.accessToken.userId;
|
const currentUserId = ctx.req.accessToken.userId;
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const args = ctx.args;
|
|
||||||
|
|
||||||
const myOptions = {};
|
const myOptions = {};
|
||||||
|
let tx;
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
const targetTimeEntry = await Self.findById(id, null, myOptions);
|
if (!myOptions.transaction) {
|
||||||
const isSubordinate = await models.Worker.isSubordinate(ctx, targetTimeEntry.userFk, myOptions);
|
tx = await Self.beginTransaction({});
|
||||||
|
myOptions.transaction = tx;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const {id, userFk, timed} = await Self.findById(timeEntryId, null, myOptions);
|
||||||
|
const isSubordinate = await models.Worker.isSubordinate(ctx, userFk, myOptions);
|
||||||
const isTeamBoss = await models.ACL.checkAccessAcl(ctx, 'Worker', 'isTeamBoss', 'WRITE');
|
const isTeamBoss = await models.ACL.checkAccessAcl(ctx, 'Worker', 'isTeamBoss', 'WRITE');
|
||||||
const isHimself = currentUserId == targetTimeEntry.userFk;
|
const isHimself = currentUserId == userFk;
|
||||||
|
|
||||||
const notAllowed = isSubordinate === false || (isSubordinate && isHimself && !isTeamBoss);
|
const notAllowed = isSubordinate === false || (isSubordinate && isHimself && !isTeamBoss);
|
||||||
|
if (notAllowed) throw new UserError(`You don't have enough privileges`);
|
||||||
|
|
||||||
if (notAllowed)
|
await models.WorkerTimeControl.deleteById(id, myOptions);
|
||||||
throw new UserError(`You don't have enough privileges`);
|
const timeEntryUpdatedId = await Self.clockIn(userFk, timed, direction, null, myOptions);
|
||||||
|
|
||||||
const timeEntryUpdated = await targetTimeEntry.updateAttributes({
|
await models.WorkerTimeControl.resendWeeklyHourEmail(ctx, userFk, timed, myOptions);
|
||||||
direction: args.direction
|
|
||||||
}, myOptions);
|
|
||||||
|
|
||||||
await models.WorkerTimeControl.resendWeeklyHourEmail(ctx, targetTimeEntry.userFk, targetTimeEntry.timed, myOptions);
|
if (tx) await tx.commit();
|
||||||
|
return timeEntryUpdatedId;
|
||||||
return timeEntryUpdated;
|
} catch (e) {
|
||||||
|
if (tx) await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,6 +36,7 @@ describe('Worker new', () => {
|
||||||
payMethodFk: 1,
|
payMethodFk: 1,
|
||||||
roleFk: 1
|
roleFk: 1
|
||||||
};
|
};
|
||||||
|
|
||||||
const req = {accessToken: {userId: 9}};
|
const req = {accessToken: {userId: 9}};
|
||||||
|
|
||||||
it('should return error if personal mail already exists', async() => {
|
it('should return error if personal mail already exists', async() => {
|
||||||
|
@ -138,17 +139,29 @@ describe('Worker new', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create a new worker', async() => {
|
it('should create a new worker', async() => {
|
||||||
const newWorker = await models.Worker.new({args: defaultWorker, req});
|
let newWorker;
|
||||||
|
try {
|
||||||
await models.Worker.destroyById(newWorker.id);
|
newWorker = await models.Worker.new({args: defaultWorker, req});
|
||||||
await models.Address.destroyAll({clientFk: newWorker.id});
|
} finally {
|
||||||
await models.Mandate.destroyAll({clientFk: newWorker.id});
|
await removeWorker(newWorker.id);
|
||||||
await models.Client.destroyById(newWorker.id);
|
}
|
||||||
await models.VnUser.destroyById(newWorker.id);
|
|
||||||
|
|
||||||
expect(newWorker.id).toBeDefined();
|
expect(newWorker.id).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should create a new client', async() => {
|
||||||
|
let newWorker;
|
||||||
|
let client;
|
||||||
|
try {
|
||||||
|
newWorker = await models.Worker.new({args: defaultWorker, req});
|
||||||
|
client = await models.Client.findById(newWorker.id);
|
||||||
|
} finally {
|
||||||
|
await removeWorker(newWorker.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(client).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
it('should create a new worker in client', async() => {
|
it('should create a new worker in client', async() => {
|
||||||
const bruceWayneId = 1101;
|
const bruceWayneId = 1101;
|
||||||
const client = await models.Client.findById(bruceWayneId, {fields: ['fi', 'email']});
|
const client = await models.Client.findById(bruceWayneId, {fields: ['fi', 'email']});
|
||||||
|
@ -163,10 +176,21 @@ describe('Worker new', () => {
|
||||||
}),
|
}),
|
||||||
req
|
req
|
||||||
};
|
};
|
||||||
const newWorker = await models.Worker.new(newWorkerData);
|
let newWorker;
|
||||||
|
try {
|
||||||
|
newWorker = await models.Worker.new(newWorkerData);
|
||||||
|
} finally {
|
||||||
await models.Worker.destroyById(newWorker.id);
|
await models.Worker.destroyById(newWorker.id);
|
||||||
|
}
|
||||||
|
|
||||||
expect(newWorker.id).toEqual(bruceWayneId);
|
expect(newWorker.id).toEqual(bruceWayneId);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function removeWorker(id) {
|
||||||
|
await models.Worker.destroyById(id);
|
||||||
|
await models.Address.destroyAll({clientFk: id});
|
||||||
|
await models.Mandate.destroyAll({clientFk: id});
|
||||||
|
await models.Client.destroyById(id);
|
||||||
|
await models.VnUser.destroyById(id);
|
||||||
|
}
|
||||||
|
|
|
@ -89,6 +89,9 @@
|
||||||
"WorkerMana": {
|
"WorkerMana": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"WorkerManaExcluded": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"WorkerMistake": {
|
"WorkerMistake": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"name": "WorkerManaExcluded",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "workerManaExcluded"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"workerFk": {
|
||||||
|
"id": true,
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"worker": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Worker",
|
||||||
|
"foreignKey": "workerFk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -415,11 +415,13 @@ class Controller extends Section {
|
||||||
throw new Error(`The entry type can't be empty`);
|
throw new Error(`The entry type can't be empty`);
|
||||||
|
|
||||||
const query = `WorkerTimeControls/${entry.id}/updateTimeEntry`;
|
const query = `WorkerTimeControls/${entry.id}/updateTimeEntry`;
|
||||||
|
if (entry.direction !== entry.$orgRow.direction) {
|
||||||
this.$http.post(query, {direction: entry.direction})
|
this.$http.post(query, {direction: entry.direction})
|
||||||
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')))
|
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')))
|
||||||
.then(() => this.$.editEntry.hide())
|
.then(() => this.$.editEntry.hide())
|
||||||
.then(() => this.fetchHours())
|
.then(() => this.fetchHours())
|
||||||
.then(() => this.getMailStates(this.date));
|
.then(() => this.getMailStates(this.date));
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.vnApp.showError(this.$t(e.message));
|
this.vnApp.showError(this.$t(e.message));
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ describe('Component vnWorkerTimeControl', () => {
|
||||||
controller.$.model = {applyFilter: jest.fn().mockReturnValue(Promise.resolve())};
|
controller.$.model = {applyFilter: jest.fn().mockReturnValue(Promise.resolve())};
|
||||||
controller.date = today;
|
controller.date = today;
|
||||||
controller.fetchHours = jest.fn();
|
controller.fetchHours = jest.fn();
|
||||||
controller.selectedRow = {id: 1, timed: Date.vnNew(), direction: 'in'};
|
controller.selectedRow = {id: 1, timed: Date.vnNew(), direction: 'in', $orgRow: {direction: null}};
|
||||||
controller.$.editEntry = {
|
controller.$.editEntry = {
|
||||||
hide: () => {}
|
hide: () => {}
|
||||||
};
|
};
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
|
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
|
||||||
"@babel/preset-env": "^7.11.0",
|
"@babel/preset-env": "^7.11.0",
|
||||||
"@babel/register": "^7.7.7",
|
"@babel/register": "^7.7.7",
|
||||||
"@verdnatura/myt": "^1.6.7",
|
"@verdnatura/myt": "^1.6.8",
|
||||||
"angular-mocks": "^1.7.9",
|
"angular-mocks": "^1.7.9",
|
||||||
"babel-jest": "^26.0.1",
|
"babel-jest": "^26.0.1",
|
||||||
"babel-loader": "^8.2.4",
|
"babel-loader": "^8.2.4",
|
||||||
|
|
|
@ -131,8 +131,8 @@ devDependencies:
|
||||||
specifier: ^7.7.7
|
specifier: ^7.7.7
|
||||||
version: 7.23.7(@babel/core@7.23.9)
|
version: 7.23.7(@babel/core@7.23.9)
|
||||||
'@verdnatura/myt':
|
'@verdnatura/myt':
|
||||||
specifier: ^1.6.7
|
specifier: ^1.6.8
|
||||||
version: 1.6.7
|
version: 1.6.8
|
||||||
angular-mocks:
|
angular-mocks:
|
||||||
specifier: ^1.7.9
|
specifier: ^1.7.9
|
||||||
version: 1.8.3
|
version: 1.8.3
|
||||||
|
@ -2633,8 +2633,8 @@ packages:
|
||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/@verdnatura/myt@1.6.7:
|
/@verdnatura/myt@1.6.8:
|
||||||
resolution: {integrity: sha512-t/Q1T3QzHpZFdxwIyQL/CV5g+HJvWE6Q65VeA9k0svZdX/vezgnQ21nkI+wuvIurIl6BXqq2Arx7EWYkAhGNNA==}
|
resolution: {integrity: sha512-jpadr6yAR9TQXPv+has5yOYAolR/YEzsxbLgMR7BoDrpLyVFLHJEy4Dfe+Hy11r3AmxCB/8lWM+La1YGvXMWOA==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
dependencies:
|
dependencies:
|
||||||
'@sqltools/formatter': 1.2.5
|
'@sqltools/formatter': 1.2.5
|
||||||
|
|
|
@ -7,7 +7,8 @@ SELECT
|
||||||
s.discount,
|
s.discount,
|
||||||
s.itemFk,
|
s.itemFk,
|
||||||
s.concept,
|
s.concept,
|
||||||
tc.code vatType
|
tc.code vatType,
|
||||||
|
it.isPackaging
|
||||||
FROM vn.invoiceOut io
|
FROM vn.invoiceOut io
|
||||||
JOIN vn.ticket t ON t.refFk = io.ref
|
JOIN vn.ticket t ON t.refFk = io.ref
|
||||||
JOIN vn.supplier su ON su.id = io.companyFk
|
JOIN vn.supplier su ON su.id = io.companyFk
|
||||||
|
@ -34,9 +35,10 @@ SELECT
|
||||||
ts.quantity,
|
ts.quantity,
|
||||||
ts.price,
|
ts.price,
|
||||||
0 discount,
|
0 discount,
|
||||||
'',
|
NULL,
|
||||||
ts.description concept,
|
ts.description,
|
||||||
tc.code vatType
|
tc.code,
|
||||||
|
NULL
|
||||||
FROM vn.invoiceOut io
|
FROM vn.invoiceOut io
|
||||||
JOIN vn.ticket t ON t.refFk = io.ref
|
JOIN vn.ticket t ON t.refFk = io.ref
|
||||||
JOIN vn.ticketService ts ON ts.ticketFk = t.id
|
JOIN vn.ticketService ts ON ts.ticketFk = t.id
|
||||||
|
@ -46,3 +48,4 @@ SELECT
|
||||||
JOIN vn.supplierAccount sa ON sa.id = co.supplierAccountFk
|
JOIN vn.supplierAccount sa ON sa.id = co.supplierAccountFk
|
||||||
JOIN vn.taxClass tc ON tc.id = ts.taxClassFk
|
JOIN vn.taxClass tc ON tc.id = ts.taxClassFk
|
||||||
WHERE t.refFk = ?
|
WHERE t.refFk = ?
|
||||||
|
ORDER BY (isPackaging), concept, itemFk
|
||||||
|
|
Loading…
Reference in New Issue