WIP: feat: refs #7731 modificar columnas #3126
|
@ -58,7 +58,7 @@ BEGIN
|
|||
IFNULL(c.street, ''),
|
||||
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)),
|
||||
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.city, ''),
|
||||
IFNULL(pr.CodigoProvincia, ''),
|
||||
|
@ -95,7 +95,7 @@ BEGIN
|
|||
IFNULL(s.street, ''),
|
||||
s.account,
|
||||
@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.city, ''),
|
||||
IFNULL(pr.CodigoProvincia, ''),
|
||||
|
|
|
@ -17,7 +17,7 @@ BEGIN
|
|||
WHEN (NOT IFNULL(auClient.isUeeMember, cClient.isUeeMember) OR NOT cSupplier.isUeeMember)
|
||||
AND NOT (auSupplier.id <=> auClient.id) THEN
|
||||
'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'
|
||||
WHEN a.isEqualizated AND cClient.code = 'ES' THEN
|
||||
'EQU'
|
||||
|
|
|
@ -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';
|
|
@ -103,6 +103,10 @@ module.exports = Self => {
|
|||
{
|
||||
arg: 'hasDailyInvoice',
|
||||
type: 'boolean'
|
||||
},
|
||||
{
|
||||
arg: 'viesCode',
|
||||
type: 'any'
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
|
|
|
@ -147,8 +147,10 @@
|
|||
},
|
||||
"hasDailyInvoice": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"viesCode": {
|
||||
"type": "string"
|
||||
}
|
||||
|
||||
},
|
||||
"relations": {
|
||||
"account": {
|
||||
|
|
Loading…
Reference in New Issue