Merge pull request '4849-supplier-isVies' (!1329) from 4849-supplier-isVies into dev
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
Reviewed-on: #1329 Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
This commit is contained in:
commit
01519ec0fb
|
@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
## [2308.01] - 2023-03-09
|
||||
|
||||
### Added
|
||||
- (Proveedores -> Datos fiscales) Añadido checkbox 'Vies'
|
||||
- (Client -> Descriptor) Nuevo icono $ con barrotes para los clientes con impago
|
||||
- (Trabajador -> Datos Básicos) Añadido nuevo campo Taquilla
|
||||
- (Trabajador -> PDA) Nueva sección
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
ALTER TABLE `vn`.`supplier` ADD `isVies` tinyint(4) DEFAULT 0 NOT NULL;
|
||||
|
||||
UPDATE `vn`.`supplier` s
|
||||
JOIN vn.country c ON c.id = s.countryFk
|
||||
SET s.nif = MID(s.nif, 3, LENGTH(s.nif)-1), s.isVies = TRUE
|
||||
WHERE s.nif <> TRIM(IF(c.code = LEFT(s.nif, 2), MID(s.nif, 3, LENGTH(s.nif)-1), s.nif));
|
||||
|
||||
INSERT IGNORE INTO `vn`.`chat`
|
||||
(senderFk, recipient, checkUserStatus, message, status, attempts)
|
||||
VALUES(19263, '#informatica-cau', 0, '
|
||||
```
|
||||
UPDATE `vn`.`supplier` s
|
||||
JOIN vn.country c ON c.id = s.countryFk
|
||||
SET s.nif = MID(s.nif, 3, LENGTH(s.nif)-1), s.isVies = TRUE
|
||||
WHERE s.nif <> TRIM(IF(c.code = LEFT(s.nif, 2), MID(s.nif, 3, LENGTH(s.nif)-1), s.nif));
|
||||
```', 0, 0);
|
|
@ -0,0 +1,127 @@
|
|||
DROP PROCEDURE IF EXISTS `sage`.`clientSupplier_add`;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
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(c.isVies, CONCAT(cu.code,c.fi), 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(s.isVies, CONCAT(co.code,s.nif), 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.country IN ('España', 'España exento'), 1,IF(co.isUeeMember = 1, 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$$
|
||||
DELIMITER ;
|
|
@ -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": {
|
||||
|
|
|
@ -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-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>
|
||||
|
|
Loading…
Reference in New Issue