feat: refs #7731 modificar columnas
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Robert Ferrús 2024-10-17 11:08:54 +02:00
parent 5a2058865d
commit f7ff78ed96
5 changed files with 98 additions and 4 deletions

View File

@ -58,7 +58,7 @@ BEGIN
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.isVies, 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.isVies, 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, ''),
@ -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, ''),

View File

@ -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 THEN
'CEE' 'CEE'
WHEN a.isEqualizated AND cClient.code = 'ES' THEN WHEN a.isEqualizated AND cClient.code = 'ES' THEN
'EQU' 'EQU'

View File

@ -0,0 +1,88 @@
use vn;
ALTER TABLE vn.client
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';

View File

@ -103,6 +103,10 @@ module.exports = Self => {
{ {
arg: 'hasDailyInvoice', arg: 'hasDailyInvoice',
type: 'boolean' type: 'boolean'
},
{
arg: 'viesCode',
type: 'any'
} }
], ],
returns: { returns: {

View File

@ -147,8 +147,10 @@
}, },
"hasDailyInvoice": { "hasDailyInvoice": {
"type": "boolean" "type": "boolean"
},
"viesCode": {
"type": "string"
} }
}, },
"relations": { "relations": {
"account": { "account": {