feat: refs #7731 modificar columna
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
1def362a8f
commit
7b1362a9d5
|
@ -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
|
||||||
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;
|
||||||
|
|
|
@ -2,6 +2,9 @@ use vn;
|
||||||
ALTER TABLE vn.client
|
ALTER TABLE vn.client
|
||||||
ADD COLUMN IF NOT EXISTS viesCode varchar(2) DEFAULT NULL;
|
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
|
UPDATE vn.client c
|
||||||
JOIN country c2 ON c2.id = c.countryFk
|
JOIN country c2 ON c2.id = c.countryFk
|
||||||
SET c.viesCode = 'ES'
|
SET c.viesCode = 'ES'
|
||||||
|
@ -86,3 +89,123 @@ UPDATE client c
|
||||||
JOIN country c2 ON c2.id = c.countryFk
|
JOIN country c2 ON c2.id = c.countryFk
|
||||||
SET c.viesCode = 'HU'
|
SET c.viesCode = 'HU'
|
||||||
WHERE c2.name = 'Hungria';
|
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,
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,9 @@ module.exports = Self => {
|
||||||
}, {
|
}, {
|
||||||
arg: 'isTrucker',
|
arg: 'isTrucker',
|
||||||
type: 'boolean'
|
type: 'boolean'
|
||||||
|
}, {
|
||||||
|
arg: 'viesCode',
|
||||||
|
type: 'any'
|
||||||
}],
|
}],
|
||||||
returns: {
|
returns: {
|
||||||
arg: 'res',
|
arg: 'res',
|
||||||
|
@ -68,7 +71,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, isVies, isTrucker, viesCode, options) => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const {args} = ctx;
|
const {args} = ctx;
|
||||||
const myOptions = {};
|
const myOptions = {};
|
||||||
|
@ -103,7 +106,8 @@ module.exports = Self => {
|
||||||
supplierActivityFk,
|
supplierActivityFk,
|
||||||
healthRegister,
|
healthRegister,
|
||||||
isVies,
|
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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,10 @@
|
||||||
},
|
},
|
||||||
"isVies": {
|
"isVies": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
}
|
},
|
||||||
|
"viesCode": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
"payMethod": {
|
"payMethod": {
|
||||||
|
|
|
@ -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
|
||||||
`,
|
`,
|
||||||
[ticket.clientFk],
|
[ticket.clientFk],
|
||||||
myOptions);
|
myOptions);
|
||||||
|
|
Loading…
Reference in New Issue