WIP: feat: refs #7731 modificar columnas #3126
|
@ -388,20 +388,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, 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, 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, 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, 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'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, 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'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1
|
||||||
|
|
|
@ -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 := IF(cu.code = LEFT(TRIM(c.fi), 2) AND c.viesCode IS NOT NULL, MID(TRIM(c.fi), 3, LENGTH(TRIM(c.fi))-1), TRIM(c.fi)),
|
||||||
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)),
|
||||||
|
@ -95,7 +95,7 @@ BEGIN
|
||||||
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 := IF(co.code = LEFT(TRIM(s.nif), 2), MID(TRIM(s.nif), 3, LENGTH(TRIM(s.nif))-1), TRIM(s.nif)),
|
||||||
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,
|
||||||
|
@ -281,7 +281,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.PorcentajeIva, tii.expenseFk;
|
GROUP BY tii.PorcentajeIva, tii.expenseFk;
|
||||||
|
|
|
@ -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,211 @@
|
||||||
|
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) DEFAULT NULL;
|
||||||
|
|
||||||
|
UPDATE vn.client c
|
||||||
|
JOIN country c2 ON c2.id = c.countryFk
|
||||||
|
SET c.viesCode = 'ES'
|
||||||
|
WHERE c2.name= 'España';
|
||||||
|
|
||||||
|
UPDATE vn.client c
|
||||||
|
JOIN country c2 ON c2.id = c.countryFk
|
||||||
|
SET c.viesCode = 'IT'
|
||||||
|
WHERE c2.name= 'Italia';
|
||||||
|
|
||||||
|
UPDATE vn.client c
|
||||||
|
JOIN country c2 ON c2.id = c.countryFk
|
||||||
|
SET c.viesCode = 'DE'
|
||||||
|
WHERE c2.name= 'Alemania';
|
||||||
|
|
||||||
|
UPDATE vn.client c
|
||||||
|
JOIN country c2 ON c2.id = c.countryFk
|
||||||
|
SET c.viesCode = 'RO'
|
||||||
|
WHERE c2.name= 'Rumania';
|
||||||
|
|
||||||
|
UPDATE vn.client c
|
||||||
|
JOIN country c2 ON c2.id = c.countryFk
|
||||||
|
SET c.viesCode = 'IT'
|
||||||
|
WHERE c2.name= 'Italia';
|
||||||
|
|
||||||
|
UPDATE client c
|
||||||
|
JOIN country c2 ON c2.id = c.countryFk
|
||||||
|
SET c.viesCode = 'NL'
|
||||||
|
WHERE c2.name= 'Holanda';
|
||||||
|
|
||||||
|
UPDATE vn.client c
|
||||||
|
JOIN country c2 ON c2.id = c.countryFk
|
||||||
|
SET c.viesCode = 'BE'
|
||||||
|
WHERE c2.name= 'Bélgica';
|
||||||
|
|
||||||
|
UPDATE vn.client c
|
||||||
|
JOIN country c2 ON c2.id = c.countryFk
|
||||||
|
SET c.viesCode = 'PT'
|
||||||
|
WHERE c2.name= 'Portugal';
|
||||||
|
|
||||||
|
UPDATE vn.client c
|
||||||
|
JOIN country c2 ON c2.id = c.countryFk
|
||||||
|
SET c.viesCode = 'FR'
|
||||||
|
WHERE c2.name= 'Francia';
|
||||||
|
|
||||||
|
UPDATE vn.client c
|
||||||
|
JOIN country c2 ON c2.id = c.countryFk
|
||||||
|
SET c.viesCode = 'PL'
|
||||||
|
WHERE c2.name = 'Polonia';
|
||||||
|
|
||||||
|
UPDATE client c
|
||||||
|
JOIN country c2 ON c2.id = c.countryFk
|
||||||
|
SET c.viesCode = 'AD'
|
||||||
|
WHERE c2.name = 'Andorra';
|
||||||
|
|
||||||
|
UPDATE client c
|
||||||
|
JOIN country c2 ON c2.id = c.countryFk
|
||||||
|
SET c.viesCode = 'LU'
|
||||||
|
WHERE c2.name = 'Luxemburgo';
|
||||||
|
|
||||||
|
UPDATE client c
|
||||||
|
JOIN country c2 ON c2.id = c.countryFk
|
||||||
|
SET c.viesCode = 'DK'
|
||||||
|
WHERE c2.name = 'Dinamarca';
|
||||||
|
|
||||||
|
UPDATE client c
|
||||||
|
JOIN country c2 ON c2.id = c.countryFk
|
||||||
|
SET c.viesCode = 'MN'
|
||||||
|
WHERE c2.name = 'Mongolia';
|
||||||
|
|
||||||
|
UPDATE client c
|
||||||
|
JOIN country c2 ON c2.id = c.countryFk
|
||||||
|
SET c.viesCode = 'SK'
|
||||||
|
WHERE c2.name = 'Eslovaquia';
|
||||||
|
|
||||||
|
UPDATE client c
|
||||||
|
JOIN country c2 ON c2.id = c.countryFk
|
||||||
|
SET c.viesCode = 'FR'
|
||||||
|
WHERE c2.name = 'Mónaco';
|
||||||
|
|
||||||
|
UPDATE client c
|
||||||
|
JOIN country c2 ON c2.id = c.countryFk
|
||||||
|
SET c.viesCode = 'HU'
|
||||||
|
WHERE c2.name = 'Hungria';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'DE'
|
||||||
|
WHERE c.name = 'Alemania';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'AT'
|
||||||
|
WHERE c.name = 'Austria';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'BE'
|
||||||
|
WHERE c.name = 'Belgica';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'BG'
|
||||||
|
WHERE c.name = 'Bulgaria';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'CZ'
|
||||||
|
WHERE c.name = 'Chequia';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'CY'
|
||||||
|
WHERE c.name = 'Chipre';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'DK'
|
||||||
|
WHERE c.name = 'Dinamarca';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'SK'
|
||||||
|
WHERE c.name = 'Eslovaquia';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'SI'
|
||||||
|
WHERE c.name = 'Eslovenia';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'ES'
|
||||||
|
WHERE c.name = 'España';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'FI'
|
||||||
|
WHERE c.name = 'Finlandia';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'FR'
|
||||||
|
WHERE c.name = 'Francia';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'GB'
|
||||||
|
WHERE c.name = 'Gran Bretaña';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'NL'
|
||||||
|
WHERE c.name = 'Holanda';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'IE'
|
||||||
|
WHERE c.name = 'Irlanda';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'IT'
|
||||||
|
WHERE c.name = 'Italia';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'LV'
|
||||||
|
WHERE c.name = 'Letonia';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'LT'
|
||||||
|
WHERE c.name = 'Lituania';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'LU'
|
||||||
|
WHERE c.name = 'Luxemburgo';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'NO'
|
||||||
|
WHERE c.name = 'Noruega';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'PL'
|
||||||
|
WHERE c.name = 'Polonia';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'PT'
|
||||||
|
WHERE c.name = 'Portugal';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'SE'
|
||||||
|
WHERE c.name = 'Suecia';
|
||||||
|
|
||||||
|
UPDATE supplier s
|
||||||
|
JOIN country c ON c.id = s.countryFk
|
||||||
|
SET c.viesCode = 'CH'
|
||||||
|
WHERE c.name = 'Suiza';
|
|
@ -112,7 +112,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,
|
||||||
|
|
|
@ -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": {
|
||||||
|
|
|
@ -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);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -73,7 +73,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"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
|
@ -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