feat: refs #7731 modificar columnas #3126
|
@ -393,20 +393,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`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`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`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`viesCode`,`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, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, '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, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, NULL, '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, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, '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, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, NULL, '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, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, '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, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, NULL, '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, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, '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, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, NULL, '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, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 18, 0, '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, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 18, NULL, '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, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 19, 0, '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, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 19, NULL, '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, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 19, 0, '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, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 19, NULL, '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, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 19, 0, '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, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 19, NULL, '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, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 9, 0, '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, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 9, NULL, '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, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, NULL, 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, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, NULL, 'ES', 'florist','normal'),
|
||||||
(1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 0, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, '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, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, NULL, 'others','loses'),
|
||||||
(1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 0, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, '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, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, NULL, '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`, `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`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`)
|
||||||
SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), UPPER(CONCAT(name, 'Social')), CONCAT(name, 'Contact'), UPPER(CONCAT(name, 'Street')), 'GOTHAM', 46460, 0, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1
|
SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), UPPER(CONCAT(name, 'Social')), CONCAT(name, 'Contact'), UPPER(CONCAT(name, 'Street')), 'GOTHAM', 46460, 0, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1
|
||||||
|
@ -587,16 +587,16 @@ INSERT INTO `vn`.`supplierActivity`(`code`, `name`)
|
||||||
('flowerPlants', 'Wholesale of flowers and plants'),
|
('flowerPlants', 'Wholesale of flowers and plants'),
|
||||||
('vegetablesFruits', 'Fruit and vegetable trade');
|
('vegetablesFruits', 'Fruit and vegetable trade');
|
||||||
|
|
||||||
INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`, `healthRegister`)
|
INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`, `healthRegister`, `viesCode`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'PLANTS SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'GOTHAM', 1, 46000, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
|
(1, 'PLANTS SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'GOTHAM', 1, 46000, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V','ES'),
|
||||||
(2, 'FARMER KING', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 46000, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
|
(2, 'FARMER KING', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 46000, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V',NULL),
|
||||||
(4, 'INVENTARIO', 'INVENTARIO', 4000000004, NULL, NULL, 0, util.VN_CURDATE(), 1, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL, NULL),
|
(4, 'INVENTARIO', 'INVENTARIO', 4000000004, NULL, NULL, 0, util.VN_CURDATE(), 1, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL, NULL,NULL),
|
||||||
(69, 'PACKAGING', 'Packaging nick', 4100000069, 1, '94935005K', 0, util.VN_CURDATE(), 1, 'supplier address 5', 'ASGARD', 3, 46600, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
|
(69, 'PACKAGING', 'Packaging nick', 4100000069, 1, '94935005K', 0, util.VN_CURDATE(), 1, 'supplier address 5', 'ASGARD', 3, 46600, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V', NULL),
|
||||||
(442, 'VERDNATURA LEVANTE SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 46000, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'),
|
(442, 'VERDNATURA LEVANTE SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 46000, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V', NULL),
|
||||||
(567, 'HOLLAND', 'Holland nick', 4000020567, 1, '14364089Z', 0, util.VN_CURDATE(), 1, 'supplier address 6', 'ASGARD', 3, 46600, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
|
(567, 'HOLLAND', 'Holland nick', 4000020567, 1, '14364089Z', 0, util.VN_CURDATE(), 1, 'supplier address 6', 'ASGARD', 3, 46600, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V', NULL),
|
||||||
(791, 'BROS SL', 'Bros nick', 5115000791, 1, '37718083S', 0, util.VN_CURDATE(), 1, 'supplier address 7', 'ASGARD', 3, 46600, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'),
|
(791, 'BROS SL', 'Bros nick', 5115000791, 1, '37718083S', 0, util.VN_CURDATE(), 1, 'supplier address 7', 'ASGARD', 3, 46600, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V', NULL),
|
||||||
(1381, 'ORNAMENTALES', 'Ornamentales', 7185001381, 1, '07972486L', 0, util.VN_CURDATE(), 1, 'supplier address 4', 'GOTHAM', 1, 46000, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V');
|
(1381, 'ORNAMENTALES', 'Ornamentales', 7185001381, 1, '07972486L', 0, util.VN_CURDATE(), 1, 'supplier address 4', 'GOTHAM', 1, 46000, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V', NULL);
|
||||||
|
|
||||||
INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `provinceFk`, `postalCode`, `city`, `phone`, `mobile`)
|
INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `provinceFk`, `postalCode`, `city`, `phone`, `mobile`)
|
||||||
VALUES
|
VALUES
|
||||||
|
|
|
@ -57,8 +57,8 @@ BEGIN
|
||||||
c.socialName,
|
c.socialName,
|
||||||
IFNULL(c.street, ''),
|
IFNULL(c.street, ''),
|
||||||
c.accountingAccount,
|
c.accountingAccount,
|
||||||
@fi := IF(cu.code = LEFT(TRIM(c.fi), 2) AND c.isVies, MID(TRIM(c.fi), 3, LENGTH(TRIM(c.fi))-1), TRIM(c.fi)),
|
@fi := REGEXP_REPLACE(TRIM(c.fi), c.viesCode, ''),
|
||||||
IF(c.isVies, CONCAT(IFNULL(cu.viesCode,cu.code), @fi ), TRIM(c.fi)),
|
IF(c.viesCode IS NOT NULL, CONCAT(cu.code, @fi ), TRIM(c.fi)),
|
||||||
IFNULL(c.postcode, ''),
|
IFNULL(c.postcode, ''),
|
||||||
IFNULL(c.city, ''),
|
IFNULL(c.city, ''),
|
||||||
IFNULL(pr.CodigoProvincia, ''),
|
IFNULL(pr.CodigoProvincia, ''),
|
||||||
|
@ -68,7 +68,7 @@ BEGIN
|
||||||
IF((c.fi REGEXP '^([[:blank:]]|[[:digit:]])'), 'J','F'),
|
IF((c.fi REGEXP '^([[:blank:]]|[[:digit:]])'), 'J','F'),
|
||||||
IF(cu.code = 'ES',
|
IF(cu.code = 'ES',
|
||||||
1,
|
1,
|
||||||
IF((cu.isUeeMember AND c.isVies), 2, 4)),
|
IF((cu.isUeeMember AND c.viesCode IS NOT NULL), 2, 4)),
|
||||||
IFNULL(c.taxTypeSageFk,0),
|
IFNULL(c.taxTypeSageFk,0),
|
||||||
IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8mb3_unicode_ci,
|
IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8mb3_unicode_ci,
|
||||||
IF(@isCeutaMelilla, 'CEUTA Y MELILLA', IF (@isCanarias, 'ISLAS CANARIAS', n.Nacion)),
|
IF(@isCeutaMelilla, 'CEUTA Y MELILLA', IF (@isCanarias, 'ISLAS CANARIAS', n.Nacion)),
|
||||||
|
@ -94,8 +94,8 @@ BEGIN
|
||||||
s.name,
|
s.name,
|
||||||
IFNULL(s.street, ''),
|
IFNULL(s.street, ''),
|
||||||
s.account,
|
s.account,
|
||||||
@nif := IF(co.code = LEFT(TRIM(s.nif), 2), MID(TRIM(s.nif), 3, LENGTH(TRIM(s.nif))-1), TRIM(s.nif)),
|
@nif := REGEXP_REPLACE(TRIM(s.nif), s.viesCode, ''),
|
||||||
IF(s.isVies, CONCAT(IFNULL(co.viesCode,co.code), @nif), TRIM(s.nif)),
|
TRIM(CONCAT(IFNULL(s.viesCode,''), @nif)),
|
||||||
IFNULL(s.postCode,''),
|
IFNULL(s.postCode,''),
|
||||||
IFNULL(s.city, ''),
|
IFNULL(s.city, ''),
|
||||||
IFNULL(pr.CodigoProvincia, ''),
|
IFNULL(pr.CodigoProvincia, ''),
|
||||||
|
|
|
@ -17,7 +17,7 @@ BEGIN
|
||||||
WHEN (NOT IFNULL(auClient.isUeeMember, cClient.isUeeMember) OR NOT cSupplier.isUeeMember)
|
WHEN (NOT IFNULL(auClient.isUeeMember, cClient.isUeeMember) OR NOT cSupplier.isUeeMember)
|
||||||
AND NOT (auSupplier.id <=> auClient.id) THEN
|
AND NOT (auSupplier.id <=> auClient.id) THEN
|
||||||
'WORLD'
|
'WORLD'
|
||||||
WHEN cClient.isUeeMember AND cSupplier.isUeeMember AND c.countryFk != s.countryFk AND c.isVies THEN
|
WHEN cClient.isUeeMember AND cSupplier.isUeeMember AND c.countryFk != s.countryFk AND c.viesCode IS NOT NULL THEN
|
||||||
'CEE'
|
'CEE'
|
||||||
WHEN a.isEqualizated AND cClient.code = 'ES' THEN
|
WHEN a.isEqualizated AND cClient.code = 'ES' THEN
|
||||||
'EQU'
|
'EQU'
|
||||||
|
|
|
@ -50,7 +50,7 @@ BEGIN
|
||||||
s.account supplierAccount,
|
s.account supplierAccount,
|
||||||
s.name supplierName,
|
s.name supplierName,
|
||||||
s.nif,
|
s.nif,
|
||||||
s.IsVies,
|
s.viesCode,
|
||||||
iit.taxTypeSageFk,
|
iit.taxTypeSageFk,
|
||||||
tt.code taxCode,
|
tt.code taxCode,
|
||||||
ti.Iva,
|
ti.Iva,
|
||||||
|
@ -282,7 +282,7 @@ BEGIN
|
||||||
JOIN sage.config c
|
JOIN sage.config c
|
||||||
WHERE tii.taxCode = 'ISP21' OR MID(tii.supplierAccount, 4, 1) = '1'
|
WHERE tii.taxCode = 'ISP21' OR MID(tii.supplierAccount, 4, 1) = '1'
|
||||||
AND tii.taxTypeSageFk IS NOT NULL
|
AND tii.taxTypeSageFk IS NOT NULL
|
||||||
AND NOT(tii.isVies
|
AND NOT(tii.viesCode IS NOT NULL
|
||||||
AND c.nontaxableTransactionTypeFk = tii.transactionTypeSageFk
|
AND c.nontaxableTransactionTypeFk = tii.transactionTypeSageFk
|
||||||
AND tii.taxCode = 'nonTaxable')
|
AND tii.taxCode = 'nonTaxable')
|
||||||
GROUP BY tii.CuentaIvaRepercutido;
|
GROUP BY tii.CuentaIvaRepercutido;
|
||||||
|
|
|
@ -16,7 +16,7 @@ BEGIN
|
||||||
OR NOT (NEW.socialName <=> OLD.socialName)
|
OR NOT (NEW.socialName <=> OLD.socialName)
|
||||||
OR NOT (NEW.street <=> OLD.street)
|
OR NOT (NEW.street <=> OLD.street)
|
||||||
OR NOT (NEW.accountingAccount <=> OLD.accountingAccount)
|
OR NOT (NEW.accountingAccount <=> OLD.accountingAccount)
|
||||||
OR NOT (NEW.isVies <=> OLD.isVies)
|
OR NOT (NEW.viesCode <=> OLD.viesCode)
|
||||||
OR NOT (NEW.fi <=> OLD.fi)
|
OR NOT (NEW.fi <=> OLD.fi)
|
||||||
OR NOT (NEW.postcode <=> OLD.postcode)
|
OR NOT (NEW.postcode <=> OLD.postcode)
|
||||||
OR NOT (NEW.city <=> OLD.city)
|
OR NOT (NEW.city <=> OLD.city)
|
||||||
|
|
|
@ -8,7 +8,7 @@ BEGIN
|
||||||
OR NOT (NEW.street <=> OLD.street)
|
OR NOT (NEW.street <=> OLD.street)
|
||||||
OR NOT (NEW.account <=> OLD.account)
|
OR NOT (NEW.account <=> OLD.account)
|
||||||
OR NOT (NEW.nif <=> OLD.nif)
|
OR NOT (NEW.nif <=> OLD.nif)
|
||||||
OR NOT (NEW.isVies <=> OLD.isVies)
|
OR NOT (NEW.viesCode <=> OLD.viesCode)
|
||||||
OR NOT (NEW.provinceFk <=> OLD.provinceFk)
|
OR NOT (NEW.provinceFk <=> OLD.provinceFk)
|
||||||
OR NOT (NEW.countryFk <=> OLD.countryFk)
|
OR NOT (NEW.countryFk <=> OLD.countryFk)
|
||||||
OR NOT (NEW.postCode <=> OLD.postCode)
|
OR NOT (NEW.postCode <=> OLD.postCode)
|
||||||
|
|
|
@ -40,7 +40,7 @@ AS SELECT `c`.`id` AS `id_cliente`,
|
||||||
`c`.`isCreatedAsServed` AS `isCreatedAsServed`,
|
`c`.`isCreatedAsServed` AS `isCreatedAsServed`,
|
||||||
`c`.`hasInvoiceSimplified` AS `hasInvoiceSimplified`,
|
`c`.`hasInvoiceSimplified` AS `hasInvoiceSimplified`,
|
||||||
`c`.`salesPersonFk` AS `Id_Trabajador`,
|
`c`.`salesPersonFk` AS `Id_Trabajador`,
|
||||||
`c`.`isVies` AS `vies`,
|
`c`.`viesCode` AS `vies`,
|
||||||
`c`.`bankEntityFk` AS `bankEntityFk`,
|
`c`.`bankEntityFk` AS `bankEntityFk`,
|
||||||
`c`.`typeFk` AS `typeFk`
|
`c`.`typeFk` AS `typeFk`
|
||||||
FROM `vn`.`client` `c`
|
FROM `vn`.`client` `c`
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
use vn;
|
||||||
|
ALTER TABLE vn.client
|
||||||
|
ADD COLUMN IF NOT EXISTS viesCode varchar(2) DEFAULT NULL;
|
||||||
|
|
||||||
|
ALTER TABLE vn.supplier
|
||||||
|
ADD COLUMN IF NOT EXISTS viesCode varchar(2) COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL;
|
||||||
|
|
||||||
|
-- client
|
||||||
|
UPDATE vn.client c
|
||||||
|
JOIN country c2 ON c2.id = c.countryFk
|
||||||
|
SET c.viesCode = c2.code
|
||||||
|
|||||||
|
WHERE c.isVies;
|
||||||
|
|
||||||
|
UPDATE client c
|
||||||
|
JOIN country c2 ON c2.id = c.countryFk
|
||||||
|
SET c.viesCode = 'FR'
|
||||||
|
WHERE c2.name = 'Mónaco' AND c.isVies;
|
||||||
|
|
||||||
|
-- supplier
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET s.viesCode = c.code
|
||||||
|
WHERE s.isVies;
|
||||||
|
|
||||||
|
ALTER TABLE vn.client
|
||||||
|
CHANGE IF EXISTS isVies isVies__ tinyint(4) NOT NULL DEFAULT 0 COMMENT'@deprecated 2025-01-24';
|
||||||
|
|
||||||
|
ALTER TABLE vn.supplier
|
||||||
|
CHANGE IF EXISTS isVies isVies__ tinyint(4) NOT NULL DEFAULT 0 COMMENT '@deprecated 2025-01-24';
|
|
@ -124,7 +124,7 @@ module.exports = Self => {
|
||||||
c.email,
|
c.email,
|
||||||
c.created,
|
c.created,
|
||||||
c.isActive,
|
c.isActive,
|
||||||
c.isVies,
|
c.viesCode,
|
||||||
c.isTaxDataChecked,
|
c.isTaxDataChecked,
|
||||||
c.isEqualizated,
|
c.isEqualizated,
|
||||||
c.isFreezed,
|
c.isFreezed,
|
||||||
|
|
|
@ -89,4 +89,27 @@ describe('Client updateFiscalData', () => {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should update the client fiscal data, set vies code that is not on the list', async() => {
|
||||||
|
const tx = await models.Client.beginTransaction({});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
const ctx = {req: {accessToken: {userId: administrativeId}}};
|
||||||
|
ctx.args = {viesCode: 'TT'};
|
||||||
|
|
||||||
|
const client = await models.Client.findById(clientId, null, options);
|
||||||
|
|
||||||
|
expect(client.viesCode).not.toEqual(ctx.args.viesCode);
|
||||||
|
|
||||||
|
const result = await models.Client.updateFiscalData(ctx, clientId, options);
|
||||||
|
|
||||||
|
expect(result.viesCode).toEqual(ctx.args.viesCode);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -73,8 +73,8 @@ module.exports = Self => {
|
||||||
type: 'boolean'
|
type: 'boolean'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'isVies',
|
arg: 'viesCode',
|
||||||
type: 'boolean'
|
type: 'any'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'isToBeMailed',
|
arg: 'isToBeMailed',
|
||||||
|
|
|
@ -121,7 +121,7 @@ module.exports = Self => {
|
||||||
const code = country ? country.code.toLowerCase() : null;
|
const code = country ? country.code.toLowerCase() : null;
|
||||||
const countryCode = this.fi?.toLowerCase().substring(0, 2);
|
const countryCode = this.fi?.toLowerCase().substring(0, 2);
|
||||||
|
|
||||||
if (!this.fi || !validateTin(this.fi, code) || (this.isVies && countryCode == code))
|
if (!this.fi || !validateTin(this.fi, code) || (this.viesCode && countryCode == code))
|
||||||
err();
|
err();
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,9 +103,6 @@
|
||||||
"quality": {
|
"quality": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
"isVies": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"isRelevant": {
|
"isRelevant": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
@ -147,8 +144,10 @@
|
||||||
},
|
},
|
||||||
"hasDailyInvoice": {
|
"hasDailyInvoice": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"viesCode": {
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
"account": {
|
"account": {
|
||||||
|
|
|
@ -116,7 +116,7 @@
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
vn-one
|
vn-two
|
||||||
vn-id="province"
|
vn-id="province"
|
||||||
label="Province"
|
label="Province"
|
||||||
ng-model="$ctrl.client.provinceFk"
|
ng-model="$ctrl.client.provinceFk"
|
||||||
|
@ -138,6 +138,17 @@
|
||||||
label="Country"
|
label="Country"
|
||||||
rule>
|
rule>
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
|
<vn-autocomplete
|
||||||
|
vn-one
|
||||||
|
vn-id="viesCode"
|
||||||
|
ng-model="$ctrl.client.viesCode"
|
||||||
|
data="countries"
|
||||||
|
show-field="code"
|
||||||
|
value-field="code"
|
||||||
|
label="viesCode"
|
||||||
|
info="To use vies that is not listed use Lilium"
|
||||||
|
rule>
|
||||||
|
</vn-autocomplete>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-check
|
<vn-check
|
||||||
|
@ -155,9 +166,8 @@
|
||||||
ng-model="$ctrl.client.hasToInvoice">
|
ng-model="$ctrl.client.hasToInvoice">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
<vn-check
|
<vn-check
|
||||||
label="Vies"
|
label="Invoice by address"
|
||||||
info="When activating it, do not enter the country code in the ID field."
|
ng-model="$ctrl.client.hasToInvoiceByAddress">
|
||||||
ng-model="$ctrl.client.isVies">
|
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
|
@ -166,8 +176,9 @@
|
||||||
ng-model="$ctrl.client.isToBeMailed">
|
ng-model="$ctrl.client.isToBeMailed">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
<vn-check
|
<vn-check
|
||||||
label="Invoice by address"
|
label="Verified data"
|
||||||
ng-model="$ctrl.client.hasToInvoiceByAddress">
|
ng-model="$ctrl.client.isTaxDataChecked"
|
||||||
|
vn-acl="salesAssistant">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
|
@ -177,13 +188,6 @@
|
||||||
info="In order to invoice, this field is not consulted, but the consignee's ET. When modifying this field if the invoice by address option is not checked, the change will be automatically propagated to all addresses, otherwise the user will be asked if he wants to propagate it or not."
|
info="In order to invoice, this field is not consulted, but the consignee's ET. When modifying this field if the invoice by address option is not checked, the change will be automatically propagated to all addresses, otherwise the user will be asked if he wants to propagate it or not."
|
||||||
on-change="$ctrl.onChangeEqualizated(value)">
|
on-change="$ctrl.onChangeEqualizated(value)">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
<vn-check
|
|
||||||
label="Verified data"
|
|
||||||
ng-model="$ctrl.client.isTaxDataChecked"
|
|
||||||
vn-acl="salesAssistant">
|
|
||||||
</vn-check>
|
|
||||||
</vn-horizontal>
|
|
||||||
<vn-horizontal>
|
|
||||||
<vn-check
|
<vn-check
|
||||||
label="Electronic invoice"
|
label="Electronic invoice"
|
||||||
ng-model="$ctrl.client.hasElectronicInvoice"
|
ng-model="$ctrl.client.hasElectronicInvoice"
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
Found a client with this phone or email: The client with id <a href="#!/client/{{clientId}}/summary" target="_blank">{{clientId}}</a> already has this phone or email. <br/> ¿Do you want to continue?
|
Found a client with this phone or email: The client with id <a href="#!/client/{{clientId}}/summary" target="_blank">{{clientId}}</a> already has this phone or email. <br/> ¿Do you want to continue?
|
||||||
|
viesCode: Vies
|
||||||
|
|
|
@ -14,3 +14,5 @@ Incoterms authorization: Autorización incoterms
|
||||||
Electronic invoice: Factura electrónica
|
Electronic invoice: Factura electrónica
|
||||||
When activating it, do not enter the country code in the IF.: Al activarlo, no informar el código del país en el campo IF
|
When activating it, do not enter the country code in the IF.: Al activarlo, no informar el código del país en el campo IF
|
||||||
The first two values are letters: Los dos primeros valores son letras
|
The first two values are letters: Los dos primeros valores son letras
|
||||||
|
viesCode: Vies
|
||||||
|
To use vies that is not listed use Lilium: Para usar un vies que no estan en la lista use Lilium
|
||||||
|
|
|
@ -19,6 +19,7 @@ describe('Supplier updateFiscalData()', () => {
|
||||||
const countryFk = 1;
|
const countryFk = 1;
|
||||||
const supplierActivityFk = 'animals';
|
const supplierActivityFk = 'animals';
|
||||||
const healthRegister = '400664487H';
|
const healthRegister = '400664487H';
|
||||||
|
const viesCode = 'ES';
|
||||||
|
|
||||||
let ctx;
|
let ctx;
|
||||||
let options;
|
let options;
|
||||||
|
@ -120,7 +121,7 @@ describe('Supplier updateFiscalData()', () => {
|
||||||
supplierActivityFk,
|
supplierActivityFk,
|
||||||
healthRegister,
|
healthRegister,
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
viesCode,
|
||||||
options);
|
options);
|
||||||
|
|
||||||
expect(supplier.name).toEqual(name);
|
expect(supplier.name).toEqual(name);
|
||||||
|
@ -137,5 +138,6 @@ describe('Supplier updateFiscalData()', () => {
|
||||||
expect(supplier.countryFk).toEqual(countryFk);
|
expect(supplier.countryFk).toEqual(countryFk);
|
||||||
expect(supplier.supplierActivityFk).toEqual(supplierActivityFk);
|
expect(supplier.supplierActivityFk).toEqual(supplierActivityFk);
|
||||||
expect(supplier.healthRegister).toEqual(healthRegister);
|
expect(supplier.healthRegister).toEqual(healthRegister);
|
||||||
|
expect(supplier.viesCode).toEqual(viesCode);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -50,12 +50,12 @@ module.exports = Self => {
|
||||||
}, {
|
}, {
|
||||||
arg: 'healthRegister',
|
arg: 'healthRegister',
|
||||||
type: 'any'
|
type: 'any'
|
||||||
}, {
|
|
||||||
arg: 'isVies',
|
|
||||||
type: 'boolean'
|
|
||||||
}, {
|
}, {
|
||||||
arg: 'isTrucker',
|
arg: 'isTrucker',
|
||||||
type: 'boolean'
|
type: 'boolean'
|
||||||
|
}, {
|
||||||
|
arg: 'viesCode',
|
||||||
|
type: 'any'
|
||||||
}],
|
}],
|
||||||
returns: {
|
returns: {
|
||||||
arg: 'res',
|
arg: 'res',
|
||||||
|
@ -68,7 +68,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.updateFiscalData = async(ctx, supplierId, name, nif, account, phone, sageTaxTypeFk, sageWithholdingFk, sageTransactionTypeFk, postCode, street, city, provinceFk, countryFk, supplierActivityFk, healthRegister, isVies, isTrucker, options) => {
|
Self.updateFiscalData = async(ctx, supplierId, name, nif, account, phone, sageTaxTypeFk, sageWithholdingFk, sageTransactionTypeFk, postCode, street, city, provinceFk, countryFk, supplierActivityFk, healthRegister, isTrucker, viesCode, options) => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const {args} = ctx;
|
const {args} = ctx;
|
||||||
const myOptions = {};
|
const myOptions = {};
|
||||||
|
@ -102,8 +102,8 @@ module.exports = Self => {
|
||||||
countryFk,
|
countryFk,
|
||||||
supplierActivityFk,
|
supplierActivityFk,
|
||||||
healthRegister,
|
healthRegister,
|
||||||
isVies,
|
isTrucker,
|
||||||
isTrucker
|
viesCode
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -74,7 +74,7 @@ module.exports = Self => {
|
||||||
const code = country ? country.code.toLowerCase() : null;
|
const code = country ? country.code.toLowerCase() : null;
|
||||||
const countryCode = this.nif?.toLowerCase().substring(0, 2);
|
const countryCode = this.nif?.toLowerCase().substring(0, 2);
|
||||||
|
|
||||||
if (!validateTin(this.nif, code) || (this.isVies && countryCode == code))
|
if (!validateTin(this.nif, code) || (this.viesCode && countryCode == code))
|
||||||
err();
|
err();
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,8 +111,8 @@
|
||||||
"healthRegister": {
|
"healthRegister": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"isVies": {
|
"viesCode": {
|
||||||
"type": "boolean"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"companySize": {
|
"companySize": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
|
|
@ -120,7 +120,7 @@ module.exports = async function(ctx, Self, tickets, options) {
|
||||||
JOIN client c ON c.id = t.clientFk
|
JOIN client c ON c.id = t.clientFk
|
||||||
WHERE t.clientFk = ?
|
WHERE t.clientFk = ?
|
||||||
AND NOT t.isDeleted
|
AND NOT t.isDeleted
|
||||||
AND c.isVies
|
AND c.viesCode IS NOT NULL
|
||||||
`,
|
`,
|
||||||
[ticket.clientFk],
|
[ticket.clientFk],
|
||||||
myOptions);
|
myOptions);
|
||||||
|
|
Loading…
Reference in New Issue
ací no falta el where?
No faria falta ya que volem modificar tot, la unica que no se vol es monaco que no te que ser la que esta en country sino 'FR' que es lo que fa el update de baix
actualemtn sols alguns europeus tenen el isVies activat, tal com ho plantejes s'activarà per a tots, inclus els extracomunitaris. Si tens dubtes ho parlem