feat: add supplier.isVies funcionality
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
d7729654ee
commit
ef6af87d89
|
@ -0,0 +1,3 @@
|
|||
ALTER TABLE `vn`.`supplier` ADD `isVies` tinyint(4) DEFAULT 0 NOT NULL;
|
||||
|
||||
/*FALTA HACER EL UPDATE MASIVO SOBRE SUPPLIER */
|
|
@ -0,0 +1,124 @@
|
|||
CREATE DEFINER=`root`@`localhost` PROCEDURE `sage`.`clientSupplier_add`(vCompanyFk INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Prepara los datos de clientes y proveedores para exportarlos a Sage
|
||||
* @vCompanyFk Empresa dela que se quiere trasladar datos
|
||||
*/
|
||||
DECLARE vCountryCeutaMelillaFk INT;
|
||||
DECLARE vCountryCanariasCode, vCountryCeutaMelillaCode VARCHAR(2);
|
||||
|
||||
SELECT SiglaNacion INTO vCountryCanariasCode
|
||||
FROM Naciones
|
||||
WHERE Nacion ='ISLAS CANARIAS';
|
||||
|
||||
SELECT CodigoNacion, SiglaNacion INTO vCountryCeutaMelillaFk, vCountryCeutaMelillaCode
|
||||
FROM Naciones
|
||||
WHERE Nacion ='CEUTA Y MELILLA';
|
||||
|
||||
TRUNCATE TABLE clientesProveedores;
|
||||
|
||||
INSERT INTO clientesProveedores
|
||||
(CodigoEmpresa,
|
||||
ClienteOProveedor,
|
||||
CodigoClienteProveedor,
|
||||
RazonSocial,
|
||||
Nombre,
|
||||
Domicilio,
|
||||
CodigoCuenta,
|
||||
CifDni,
|
||||
CifEuropeo,
|
||||
CodigoPostal,
|
||||
Municipio,
|
||||
CodigoProvincia,
|
||||
Provincia,
|
||||
CodigoNacion,
|
||||
SiglaNacion,
|
||||
PersonaFisicaJuridica,
|
||||
TipoDocumentoPersona,
|
||||
CodigoIva,
|
||||
Nacion,
|
||||
Telefono,
|
||||
Telefono2,
|
||||
CodigoTransaccion,
|
||||
CodigoRetencion,
|
||||
Email1,
|
||||
iban)
|
||||
SELECT
|
||||
company_getCode(vCompanyFk),
|
||||
'C',
|
||||
c.id,
|
||||
c.socialName,
|
||||
c.socialName,
|
||||
IFNULL(c.street, ''),
|
||||
c.accountingAccount,
|
||||
TRIM(IF(cu.code = LEFT(c.fi, 2), MID(c.fi, 3, LENGTH(c.fi)-1), c.fi)),
|
||||
IF(n.NacionCEE,TRIM(IF(cu.code = LEFT(c.fi, 2), c.fi, CONCAT(cu.code,c.fi))) , ''),
|
||||
IFNULL(c.postcode, ''),
|
||||
IFNULL(c.city, ''),
|
||||
IFNULL(pr.CodigoProvincia, ''),
|
||||
IFNULL(p.name, ''),
|
||||
IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8mb3_unicode_ci, IF(@isCeutaMelilla := IF(pr.Provincia IN ('CEUTA', 'MELILLA'), TRUE, FALSE), vCountryCeutaMelillaFk, IF (@isCanarias, vCountryCanariasCode, n.CodigoNacion)), n.CodigoNacion),
|
||||
IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8mb3_unicode_ci, IF(@isCeutaMelilla, vCountryCeutaMelillaCode, IF (@isCanarias, vCountryCanariasCode, n.SiglaNacion)), n.SiglaNacion),
|
||||
IF((c.fi REGEXP '^([[:blank:]]|[[:digit:]])'), 'J','F'),
|
||||
IF(cu.code IN('ES','EX'),
|
||||
1,
|
||||
IF((cu.isUeeMember AND c.isVies), 2, 4)),
|
||||
IFNULL(c.taxTypeSageFk,0),
|
||||
IF(n.SiglaNacion = vCountryCanariasCode COLLATE utf8mb3_unicode_ci,
|
||||
IF(@isCeutaMelilla, 'CEUTA Y MELILLA', IF (@isCanarias, 'ISLAS CANARIAS', n.Nacion)),
|
||||
n.Nacion),
|
||||
IFNULL(c.phone, ''),
|
||||
IFNULL(c.mobile, ''),
|
||||
IFNULL(c.transactionTypeSageFk, 0),
|
||||
'0',
|
||||
IFNULL(SUBSTR(c.email, 1, LOCATE(',', CONCAT(c.email, ','))-1), ''),
|
||||
IFNULL(c.iban, '')
|
||||
FROM vn.`client` c
|
||||
JOIN clientLastTwoMonths clm ON clm.clientFk = c.id
|
||||
LEFT JOIN vn.country cu ON cu.id = c.countryFk
|
||||
LEFT JOIN Naciones n ON n.countryFk = cu.id
|
||||
LEFT JOIN vn.province p ON p.id = c.provinceFk
|
||||
LEFT JOIN Provincias pr ON pr.provinceFk = p.id
|
||||
WHERE c.isRelevant
|
||||
AND clm.companyFk = vCompanyFk
|
||||
UNION ALL
|
||||
SELECT company_getCode(vCompanyFk),
|
||||
'P',
|
||||
s.id,
|
||||
s.name,
|
||||
s.name,
|
||||
IFNULL(s.street, ''),
|
||||
s.account,
|
||||
TRIM(IF(co.code = LEFT(s.nif, 2), MID(s.nif, 3, LENGTH(s.nif) - 1), s.nif)),
|
||||
IF(n.NacionCEE, TRIM(CONCAT(co.code, IF(co.code = LEFT(s.nif, 2), MID(s.nif, 3, LENGTH(s.nif) - 1), s.nif))), ''),
|
||||
IFNULL(s.postCode,''),
|
||||
IFNULL(s.city, ''),
|
||||
IFNULL(pr.CodigoProvincia, ''),
|
||||
IFNULL(p.name, ''),
|
||||
n.CodigoNacion,
|
||||
n.SiglaNacion COLLATE utf8mb3_unicode_ci,
|
||||
IF((s.nif REGEXP '^([[:blank:]]|[[:digit:]])'),'J','F'),
|
||||
IF(co.code IN('ES','EX'),
|
||||
1,
|
||||
IF((co.isUeeMember AND s.isVies), 2, 4)),
|
||||
IFNULL(s.taxTypeSageFk, 0),
|
||||
n.Nacion,
|
||||
IFNULL(sc.phone, ''),
|
||||
IFNULL(sc.mobile, ''),
|
||||
IFNULL(s.transactionTypeSageFk, 0),
|
||||
IFNULL(s.withholdingSageFk, '0'),
|
||||
IFNULL(SUBSTR(sc.email, 1, (COALESCE(NULLIF(LOCATE(',', sc.email), 0), 99) - 1)), ''),
|
||||
IFNULL(iban, '')
|
||||
FROM vn.supplier s
|
||||
JOIN supplierLastThreeMonths pl ON pl.supplierFk = s.id
|
||||
LEFT JOIN vn.country co ON co.id = s.countryFk
|
||||
LEFT JOIN Naciones n ON n.countryFk = co.id
|
||||
LEFT JOIN vn.province p ON p.id = s.provinceFk
|
||||
LEFT JOIN Provincias pr ON pr.provinceFk = p.id
|
||||
LEFT JOIN vn.supplierContact sc ON sc.supplierFk = s.id
|
||||
LEFT JOIN vn.supplierAccount sa ON sa.supplierFk = s.id
|
||||
WHERE pl.companyFk = vCompanyFk AND
|
||||
s.isActive AND
|
||||
s.nif <> ''
|
||||
GROUP BY pl.supplierFk, pl.companyFk;
|
||||
END
|
|
@ -64,7 +64,12 @@ module.exports = Self => {
|
|||
{
|
||||
arg: 'healthRegister',
|
||||
type: 'string'
|
||||
}],
|
||||
},
|
||||
{
|
||||
arg: 'isVies',
|
||||
type: 'boolean'
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
arg: 'res',
|
||||
type: 'string',
|
||||
|
|
|
@ -110,6 +110,9 @@
|
|||
},
|
||||
"healthRegister": {
|
||||
"type": "string"
|
||||
},
|
||||
"isVies": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
@ -175,4 +178,4 @@
|
|||
"foreignKey": "supplierActivityFk"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
show-field="code"
|
||||
rule>
|
||||
<tpl-item>
|
||||
{{code}} - {{town.name}} ({{town.province.name}},
|
||||
{{code}} - {{town.name}} ({{town.province.name}},
|
||||
{{town.province.country.country}})
|
||||
</tpl-item>
|
||||
<append>
|
||||
|
@ -144,7 +144,7 @@
|
|||
</vn-datalist>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-datalist vn-id="town" vn-one
|
||||
<vn-datalist vn-id="town" vn-one
|
||||
label="City"
|
||||
ng-model="$ctrl.supplier.city"
|
||||
selection="$ctrl.town"
|
||||
|
@ -172,7 +172,7 @@
|
|||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete vn-id="country" vn-one
|
||||
<vn-autocomplete vn-id="country" vn-two
|
||||
ng-model="$ctrl.supplier.countryFk"
|
||||
data="countries"
|
||||
show-field="country"
|
||||
|
@ -180,10 +180,17 @@
|
|||
label="Country"
|
||||
rule>
|
||||
</vn-autocomplete>
|
||||
<vn-check
|
||||
label="Trucker"
|
||||
ng-model="$ctrl.supplier.isTrucker">
|
||||
</vn-check>
|
||||
<vn-two class="vn-pl-xs">
|
||||
<vn-check
|
||||
label="Trucker"
|
||||
ng-model="$ctrl.supplier.isTrucker">
|
||||
</vn-check>
|
||||
<vn-check
|
||||
class="vn-ml-lg"
|
||||
label="Vies"
|
||||
ng-model="$ctrl.supplier.isVies">
|
||||
</vn-check>
|
||||
</vn-two>
|
||||
</vn-horizontal>
|
||||
</vn-card>
|
||||
<vn-button-bar>
|
||||
|
@ -203,4 +210,4 @@
|
|||
<vn-geo-postcode
|
||||
vn-id="postcode"
|
||||
on-response="$ctrl.onResponse($response)">
|
||||
</vn-geo-postcode>
|
||||
</vn-geo-postcode>
|
||||
|
|
Loading…
Reference in New Issue