7336_devToTest #2414

Merged
alexm merged 220 commits from 7336_devToTest into test 2024-05-07 06:26:53 +00:00
155 changed files with 1683 additions and 2063 deletions
Showing only changes of commit 633a3c481c - Show all commits

View File

@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [24.20.01] - 2024-05-14
### Fixed
- (Worker -> time-control) Corrección de errores
- (InvoiceOut -> Crear factura) Cuando falla al crear una factura, se devuelve un error
- (Worker -> Ver albarán) Ya no aparece la página en blanco
## [24.18.01] - 2024-05-07
## [24.16.01] - 2024-04-18

View File

@ -124,6 +124,9 @@
"Postcode": {
"dataSource": "vn"
},
"ReferenceRate": {
"dataSource": "vn"
},
"SageWithholding": {
"dataSource": "vn"
},
@ -177,5 +180,11 @@
},
"ProductionConfig": {
"dataSource": "vn"
},
"AgencyLog": {
"dataSource": "vn"
},
"AgencyWorkCenter": {
"dataSource": "vn"
}
}

View File

@ -0,0 +1,9 @@
{
"name": "AgencyLog",
"base": "Log",
"options": {
"mysql": {
"table": "agencyLog"
}
}
}

View File

@ -0,0 +1,8 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.rewriteDbError(function(err) {
if (err.code === 'ER_DUP_ENTRY')
return new UserError(`This workCenter is already assigned to this agency`);
return err;
});
};

View File

@ -0,0 +1,41 @@
{
"name": "AgencyWorkCenter",
"base": "VnModel",
"options": {
"mysql": {
"table": "agencyWorkCenter"
}
},
"properties": {
"id": {
"id": true,
"type": "number",
"forceId": false
},
"agencyFk": {
"type": "number",
"required": false
},
"workCenterFk": {
"type": "number",
"required": false
}
},
"relations": {
"agency": {
"type": "belongsTo",
"model": "WorkCenter",
"foreignKey": "agencyFk"
},
"workCenter": {
"type": "belongsTo",
"model": "WorkCenter",
"foreignKey": "workCenterFk"
}
},
"scope": {
"include":{
"relation": "workCenter"
}
}
}

View File

@ -1,6 +1,11 @@
{
"name": "Collection",
"base": "VnModel",
"options": {
"mysql": {
"table": "collection"
}
},
"acls": [{
"property": "validations",
"accessType": "EXECUTE",
@ -9,4 +14,3 @@
"permission": "ALLOW"
}]
}

View File

@ -0,0 +1,36 @@
{
"name": "ReferenceRate",
"base": "PersistedModel",
"options": {
"mysql": {
"table": "referenceRate"
}
},
"properties": {
"id": {
"type": "number",
"id": true,
"description": "Identifier"
},
"currencyFk": {
"type": "number",
"required": true
},
"dated": {
"type": "date",
"required": true
},
"value": {
"type": "number",
"required": true
}
},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}

View File

@ -146,7 +146,7 @@ INSERT INTO `vn`.`businessReasonEnd` (`id`, `reason`)
('2', 'No supera PP empresa'),
('3', 'Despido');
INSERT INTO `vn2008`.`payroll_categorias` (`codcategoria`, `descripcion`, `Tarifa`)
INSERT INTO `vn`.`payrollCategories` (`id`, `description`, `rate`)
VALUES
('11', 'INFORMATICA', '2'),
('12', 'AUX INFORMATICA', '7');

View File

@ -11,7 +11,6 @@ CREATE ROLE 'salix';
GRANT 'salix' TO 'root'@'%';
SET DEFAULT ROLE 'salix' FOR 'root'@'%';
CREATE SCHEMA IF NOT EXISTS `vn2008`;
CREATE SCHEMA IF NOT EXISTS `tmp`;
UPDATE `util`.`config`
@ -160,7 +159,8 @@ INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`)
(1, 'EUR', 'Euro', 1),
(2, 'USD', 'Dollar USA', 1.4),
(3, 'GBP', 'Libra', 1),
(4, 'JPY', 'Yen Japones', 1);
(4, 'JPY', 'Yen Japones', 1),
(5, 'CNY', 'Yuan Chino', 1.2);
INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`, `continentFk`, `hasDailyInvoice`, `CEE`)
VALUES
@ -371,20 +371,20 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`)
(4, 'GCN Channel'),
(5, 'The Newspaper');
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`,`typeFk`)
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`businessTypeFk`,`typeFk`)
VALUES
(1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
(1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
(1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
(1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
(1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
(1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
(1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
(1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
(1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist','normal'),
(1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist','normal'),
(1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses'),
(1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses');
(1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
(1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
(1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
(1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
(1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 18, 0, 'florist','normal'),
(1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 19, 0, 'florist','normal'),
(1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 19, 0, 'florist','normal'),
(1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 19, 0, 'florist','normal'),
(1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 9, 0, 'florist','normal'),
(1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, NULL, 0, 'florist','normal'),
(1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses'),
(1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses');
INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`)
SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), UPPER(CONCAT(name, 'Social')), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1
@ -3787,3 +3787,6 @@ INSERT INTO `vn`.`accountReconciliationConfig`(currencyFk, warehouseFk)
INSERT INTO vn.workerTeam(id, team, workerFk)
VALUES
(8, 1, 19);
INSERT INTO vn.workCenter (id, name, payrollCenterFk, counter, warehouseFk, street, geoFk, deliveryManAdjustment)
VALUES(100, 'workCenterOne', 1, NULL, 1, 'gotham', NULL, NULL);

View File

@ -91,15 +91,15 @@ BEGIN
-- Recobro
UPDATE bi.Greuge_Evolution ge
JOIN (
SELECT cs.Id_Cliente, sum(Valor * Cantidad) as Importe
SELECT a.clientFk Id_Cliente, sum(sc.value * s.quantity) as Importe
FROM vn.ticket t
JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.addressFk
JOIN vn2008.Movimientos m on m.Id_Ticket = t.id
JOIN vn2008.Movimientos_componentes mc on mc.Id_Movimiento = m.Id_Movimiento
JOIN vn.address a on a.id = t.addressFk
JOIN vn.sale s on s.ticketFk = t.id
JOIN vn.saleComponent sc on sc.saleFk = s.id
WHERE t.shipped >= datFEC
AND t.shipped < datFEC_TOMORROW
AND mc.Id_Componente = 17 -- Recobro
GROUP BY cs.Id_Cliente
AND sc.componentFk = 17 -- Recobro
GROUP BY a.clientFk
) sub using(Id_Cliente)
SET Recobro = Importe
WHERE ge.Fecha = datFEC;

View File

@ -24,7 +24,7 @@ BEGIN
WHERE Periodo < vMaxPeriod;
SELECT MIN(period) INTO vCurrentPeriod
FROM vn2008.time
FROM vn.time
WHERE period > vPreviousPeriod;
SET vYear = FLOOR(vCurrentPeriod / 100);
@ -66,7 +66,7 @@ BEGIN
WHERE periodo < vMaxPeriod;
SELECT MIN(period) INTO vCurrentPeriod
FROM vn2008.time
FROM vn.time
WHERE period > vPreviousPeriod;
SET vYear = FLOOR(vCurrentPeriod / 100);
@ -108,7 +108,7 @@ BEGIN
WHERE periodo < vMaxPeriod;
SELECT MIN(period) INTO vCurrentPeriod
FROM vn2008.time
FROM vn.time
WHERE period > vPreviousPeriod;
SET vYear = FLOOR(vCurrentPeriod / 100);
@ -156,7 +156,7 @@ BEGIN
WHERE periodo < vMaxPeriod;
SELECT MIN(period) INTO vCurrentPeriod
FROM vn2008.time
FROM vn.time
WHERE period > vPreviousPeriod;
SET vYear = FLOOR(vCurrentPeriod / 100);
@ -198,7 +198,7 @@ BEGIN
WHERE periodo < vMaxPeriod;
SELECT MIN(period) INTO vCurrentPeriod
FROM vn2008.time
FROM vn.time
WHERE period > vPreviousPeriod;
SET vYear = FLOOR(vCurrentPeriod / 100);

View File

@ -23,31 +23,31 @@ BEGIN
Importe
)
SELECT
tp.Tipo AS Familia,
r.reino AS Reino,
tr.CodigoTrabajador AS Comercial,
tr2.CodigoTrabajador AS Comprador,
p.name AS Provincia,
w.name AS almacen,
tm.year AS Año,
tm.month AS Mes,
tm.week AS Semana,
dm.description AS Vista,
bt.importe AS Importe
it.name,
ic.name,
w.code,
w2.code,
p.name,
wa.name,
tm.year,
tm.month,
tm.week,
dm.description,
bt.importe
FROM bs.ventas bt
LEFT JOIN vn2008.Tipos tp ON tp.tipo_id = bt.tipo_id
LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id
LEFT JOIN vn2008.Clientes c on c.Id_Cliente = bt.Id_Cliente
LEFT JOIN vn2008.Trabajadores tr ON tr.Id_Trabajador = c.Id_Trabajador
LEFT JOIN vn2008.Trabajadores tr2 ON tr2.Id_Trabajador = tp.Id_Trabajador
JOIN vn2008.time tm ON tm.date = bt.fecha
JOIN vn2008.Movimientos m ON m.Id_Movimiento = bt.Id_Movimiento
LEFT JOIN vn.ticket t ON t.id = m.Id_Ticket
JOIN vn2008.Agencias a ON a.Id_Agencia = t.agencyModeFk
LEFT JOIN vn.deliveryMethod dm ON dm.id = a.Vista
LEFT JOIN vn2008.Consignatarios cs ON cs.Id_Consigna = t.addressFk
LEFT JOIN vn2008.province p ON p.province_id = cs.province_id
LEFT JOIN vn.warehouse w ON w.id = t.warehouseFk
WHERE bt.fecha >= vLastMonth AND r.mercancia;
LEFT JOIN vn.itemType it ON it.id = bt.tipo_id
LEFT JOIN vn.itemCategory ic ON ic.id = it.categoryFk
LEFT JOIN vn.client c on c.id = bt.Id_Cliente
LEFT JOIN vn.worker w ON w.id = c.salesPersonFk
LEFT JOIN vn.worker w2 ON w2.id = it.workerFk
JOIN vn.time tm ON tm.dated = bt.fecha
JOIN vn.sale s ON s.id = bt.Id_Movimiento
LEFT JOIN vn.ticket t ON t.id = s.ticketFk
JOIN vn.agencyMode am ON am.id = t.agencyModeFk
LEFT JOIN vn.deliveryMethod dm ON dm.id = am.deliveryMethodFk
LEFT JOIN vn.address a ON a.id = t.addressFk
LEFT JOIN vn.province p ON p.id = a.provinceFk
LEFT JOIN vn.warehouse wa ON wa.id = t.warehouseFk
WHERE bt.fecha >= vLastMonth AND ic.merchandise;
END$$
DELIMITER ;

View File

@ -13,46 +13,45 @@ BEGIN
INSERT INTO vn.greuge(shipped, clientFk, description,
amount, greugeTypeFk, ticketFk)
SELECT cm.Fecha
, cm.Id_Cliente
, concat('Claim ',cm.id,' : ', m.Concepte)
,round( -1 * ((sensib -1)/4) * Cantidad *
Preu * (100 - Descuento) / 100, 2) AS Reclamaciones
SELECT c.ticketCreated
, c.clientFk
, concat('Claim ', c.id,' : ', s.concept)
,round( -1 * ((c.responsibility -1)/4) * s.quantity *
s.price * (100 - s.discount) / 100, 2)
, 4
, m.Id_Ticket
FROM vn2008.Movimientos m
JOIN vn2008.cl_act ca USING(Id_Movimiento)
JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id
WHERE ca.cl_sol_id NOT IN (1,5)
AND ca.greuge = 0
AND cm.cl_est_id = 3;
, s.ticketFk
FROM vn.sale s
JOIN vn.claimEnd ce ON ce.saleFk = s.id
JOIN vn.claim c ON c.id = ce.claimFk
WHERE ce.claimDestinationFk NOT IN (1,5)
AND NOT ce.isGreuge
AND c.claimStateFk = 3;
-- Reclamaciones que pasan a Maná
INSERT INTO vn.greuge(shipped, clientFk, description,
amount, greugeTypeFk, ticketFk)
SELECT cm.Fecha
, cm.Id_Cliente
, concat('Claim_mana ',cm.id,' : ', m.Concepte)
,round( ((sensib -1)/4) * Cantidad * Preu * (100 - Descuento) / 100, 2)
AS Reclamaciones
SELECT c.ticketCreated
, c.clientFk
, concat('Claim_mana ',c.id,' : ', s.concept)
,round( ((c.responsibility -1)/4) * s.quantity * s.price * (100 - s.discount) / 100, 2)
,3
,m.Id_Ticket
FROM vn2008.Movimientos m
JOIN vn2008.cl_act ca USING(Id_Movimiento)
JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id
WHERE ca.cl_sol_id NOT IN (1,5)
AND ca.greuge = 0
AND cm.cl_est_id = 3
AND cm.mana;
,s.ticketFk
FROM vn.sale s
JOIN vn.claimEnd ce ON ce.saleFk = s.id
JOIN vn.claim c ON c.id = ce.claimFk
WHERE ce.claimDestinationFk NOT IN (1,5)
AND NOT ce.isGreuge
AND c.claimStateFk = 3
AND c.isChargedToMana;
-- Marcamos para no repetir
UPDATE vn2008.cl_act ca
JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id
SET greuge = 1
WHERE ca.cl_sol_id NOT IN (1,5)
AND ca.greuge = 0
AND cm.cl_est_id = 3;
UPDATE vn.claimEnd ce
JOIN vn.claim c ON c.id = ce.claimFk
SET c.isChargedToMana = TRUE
WHERE ce.claimDestinationFk NOT IN (1,5)
AND NOT ce.isGreuge
AND c.claimStateFk = 3;
-- Recobros
@ -60,17 +59,17 @@ BEGIN
CREATE TEMPORARY TABLE tmp.ticket_list
(PRIMARY KEY (Id_Ticket))
SELECT DISTINCT t.id Id_Ticket
FROM vn2008.Movimientos_componentes mc
JOIN vn2008.Movimientos m ON mc.Id_Movimiento = m.Id_Movimiento
JOIN vn.ticket t ON t.id = m.Id_Ticket
FROM vn.saleComponent sc
JOIN vn.sale s ON sc.saleFk = s.id
JOIN vn.ticket t ON t.id = s.ticketFk
JOIN vn.ticketLastState ts ON ts.ticketFk = t.id
JOIN vn.ticketTracking tt ON tt.id = ts.ticketTrackingFk
JOIN vn.state s ON s.id = tt.stateFk
WHERE mc.Id_Componente = 17
AND mc.greuge = 0
JOIN vn.state st ON st.id = tt.stateFk
WHERE sc.componentFk = 17
AND sc.isGreuge = 0
AND t.shipped >= '2016-10-01'
AND t.shipped < util.VN_CURDATE()
AND s.alertLevel >= 3;
AND st.alertLevel >= 3;
DELETE g.*
FROM vn.greuge g
@ -80,24 +79,24 @@ BEGIN
INSERT INTO vn.greuge(clientFk, description, amount,shipped,
greugeTypeFk, ticketFk)
SELECT t.clientFk
,concat('recobro ', m.Id_Ticket), - round(SUM(mc.Valor*Cantidad),2)
AS dif
,date(t.shipped)
,concat('recobro ', s.ticketFk), - round(SUM(sc.value*s.quantity),2)
AS dif,
date(t.shipped)
, 2
,tt.Id_Ticket
FROM vn2008.Movimientos m
JOIN vn.ticket t ON t.id = m.Id_Ticket
FROM vn.sale s
JOIN vn.ticket t ON t.id = s.ticketFk
JOIN tmp.ticket_list tt ON tt.Id_Ticket = t.id
JOIN vn2008.Movimientos_componentes mc
ON mc.Id_Movimiento = m.Id_Movimiento AND mc.Id_Componente = 17
JOIN vn.saleComponent sc
ON sc.saleFk = s.id AND sc.componentFk = 17
GROUP BY t.id
HAVING ABS(dif) > 1;
UPDATE vn2008.Movimientos_componentes mc
JOIN vn2008.Movimientos m ON m.Id_Movimiento = mc.Id_Movimiento
JOIN tmp.ticket_list tt ON tt.Id_Ticket = m.Id_Ticket
SET greuge = 1
WHERE Id_Componente = 17;
UPDATE vn.saleComponent sc
JOIN vn.sale s ON s.id = sc.saleFk
JOIN tmp.ticket_list tt ON tt.Id_Ticket = s.ticketFk
SET sc.isGreuge = 1
WHERE sc.componentFk = 17;
/*
* Recalculamos la ratio de las reclamaciones, que luego
@ -105,26 +104,25 @@ BEGIN
*/
REPLACE bi.claims_ratio(Id_Cliente, Consumo, Reclamaciones, Ratio, recobro)
SELECT Id_Cliente, 0,0,0,0
FROM vn2008.Clientes;
SELECT id, 0,0,0,0
FROM vn.client;
REPLACE bi.claims_ratio(Id_Cliente, Consumo, Reclamaciones, Ratio, recobro)
SELECT fm.Id_Cliente, 12 * fm.Consumo, Reclamaciones,
round(Reclamaciones / (12*fm.Consumo),4) AS Ratio, 0
round(Reclamaciones / (12*fm.Consumo),4), 0
FROM bi.facturacion_media_anual fm
LEFT JOIN(
SELECT cm.Id_Cliente, round(sum(-1 * ((sensib -1)/4) *
Cantidad * Preu * (100 - Descuento) / 100))
SELECT c.clientFk, round(sum(-1 * ((c.responsibility -1)/4) *
s.quantity * s.price * (100 - s.discount) / 100))
AS Reclamaciones
FROM vn2008.Movimientos m
JOIN vn2008.cl_act ca
ON ca.Id_Movimiento = m.Id_Movimiento
JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id
WHERE ca.cl_sol_id NOT IN (1,5)
AND cm.cl_est_id = 3
AND cm.Fecha >= TIMESTAMPADD(YEAR, -1, util.VN_CURDATE())
GROUP BY cm.Id_Cliente
) claims ON claims.Id_Cliente = fm.Id_Cliente;
FROM vn.sale s
JOIN vn.claimEnd ce ON ce.saleFk = s.id
JOIN vn.claim c ON c.id = ce.claimFk
WHERE ce.claimDestinationFk NOT IN (1,5)
AND c.claimStateFk = 3
AND c.ticketCreated >= TIMESTAMPADD(YEAR, -1, util.VN_CURDATE())
GROUP BY c.clientFk
) claims ON claims.clientFk = fm.Id_Cliente;
-- Calculamos el porcentaje del recobro para añadirlo al precio de venta

View File

@ -1,9 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`clean_launcher`()
BEGIN
/**
* Borra registros de las principales tablas (excepto de "ticket").
*/
CALL vn2008.clean(0);
END$$
DELIMITER ;

View File

@ -1,32 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`comparativa_add`()
BEGIN
DECLARE lastCOMP INT; # Se trata de una variable para almacenar el ultimo valor del Periodo
DECLARE vMaxPeriod INT;
DECLARE vMaxWeek INT;
SELECT t.period, t.`week` INTO vMaxPeriod, vMaxWeek
FROM vn.`time` t
WHERE t.dated = util.VN_CURDATE();
SELECT MAX(Periodo) INTO lastCOMP FROM vn2008.Comparativa;
-- Fijaremos las ventas con más de un mes de antiguedad en la tabla Comparativa
IF lastCOMP < vMaxPeriod - 3 AND vMaxWeek > 3 THEN
REPLACE vn2008.Comparativa(Periodo, Id_Article, warehouse_id, Cantidad,price)
SELECT tm.period as Periodo, m.Id_Article, t.warehouseFk, sum(m.Cantidad), sum(v.importe)
FROM bs.ventas v
JOIN vn2008.time tm ON tm.date = v.fecha
JOIN vn2008.Movimientos m ON m.Id_Movimiento = v.Id_Movimiento
JOIN vn2008.Tipos tp ON tp.tipo_id = v.tipo_id
JOIN vn2008.reinos r ON r.id = tp.reino_id
JOIN vn.ticket t ON t.id = m.Id_Ticket
WHERE tm.period BETWEEN lastCOMP AND vMaxPeriod - 3
AND t.clientFk NOT IN(400,200)
AND t.warehouseFk NOT IN (0,13)
GROUP BY m.Id_Article, Periodo, t.warehouseFk;
END IF;
END$$
DELIMITER ;

View File

@ -1,40 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`comparativa_add_manual`(IN vStarted DATE, IN vEnded DATE)
BEGIN
/**
* Recalcula la tabla Comparativa para dos valores dados
*
* @param vStarted fecha desde
* @param vEnded fecha hasta
*/
DECLARE periodStart INT;
DECLARE periodEnd INT;
-- Seleccionamos la fecha minima/maxima del periodo que vamos a consultar
SELECT t.period INTO periodStart
FROM vn.`time` t
WHERE t.dated = vStarted;
SELECT t.period INTO periodEnd
FROM vn.`time` t
WHERE t.dated = vEnded;
DELETE FROM vn2008.Comparativa
WHERE Periodo BETWEEN periodStart AND periodEnd;
INSERT INTO vn2008.Comparativa(Periodo, Id_Article, warehouse_id, Cantidad,price)
SELECT tm.period as Periodo, m.Id_Article, t.warehouseFk, sum(m.Cantidad), sum(v.importe)
FROM bs.ventas v
JOIN vn2008.time tm ON tm.date = v.fecha
JOIN vn2008.Movimientos m ON m.Id_Movimiento = v.Id_Movimiento
JOIN vn2008.Tipos tp ON tp.tipo_id = v.tipo_id
JOIN vn2008.reinos r ON r.id = tp.reino_id
JOIN vn.ticket t ON t.id = m.Id_Ticket
WHERE tm.period BETWEEN periodStart AND periodEnd
AND t.clientFk NOT IN(400,200)
AND t.warehouseFk NOT IN (0,13)
GROUP BY m.Id_Article, Periodo, t.warehouseFk;
END$$
DELIMITER ;

View File

@ -2,7 +2,7 @@ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`defaultersFromDate`(IN vDate DATE)
BEGIN
SELECT t1.*, c.Cliente, w.code AS workerCode, c.pay_met_id,c.Vencimiento
SELECT t1.*, c.name Cliente, w.code workerCode, c.payMethodFk pay_met_id, c.dueDay Vencimiento
FROM (
-- Filtramos aquellos clientes cuyo saldo se ha incrementado de ayer a hoy
select * from(
@ -18,7 +18,7 @@ BEGIN
having today.amount > 0 and difference <> 0
) newDefaulters
)t1 left join vn2008.Clientes c ON t1.client = c.Id_Cliente
left join vn.worker w ON w.id = c.Id_Trabajador;
)t1 left join vn.client c ON c.id = t1.client
left join vn.worker w ON w.id = c.salesPersonFk;
END$$
DELIMITER ;

View File

@ -8,9 +8,10 @@ BEGIN
DECLARE vAmountInvoice DECIMAL(10,2);
DECLARE vGraceDays INT;
DECLARE defaulters CURSOR FOR
SELECT client, amount, graceDays FROM bi.defaulters d
JOIN vn2008.Clientes c ON c.Id_Cliente = d.client
JOIN vn2008.pay_met pm ON pm.id = c.pay_met_id
SELECT d.client, d.amount, pm.graceDays
FROM bi.defaulters d
JOIN vn.client c ON c.id = d.client
JOIN vn.payMethod pm ON pm.id = c.payMethodFk
WHERE hasChanged AND date = vDate;
DECLARE invoices CURSOR FOR

View File

@ -1,19 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `bi`.`last_Id_Cubo`
AS SELECT `C`.`Id_Compra` AS `Id_Compra`,
`C`.`Id_Article` AS `Id_Article`,
`tr`.`warehouse_id` AS `warehouse_id`,
`C`.`Id_Cubo` AS `Id_Cubo`,
`C`.`Packing` AS `Packing`
FROM (
(
`vn2008`.`Compres` `C`
JOIN `vn2008`.`Entradas` `E` ON(`C`.`Id_Entrada` = `E`.`Id_Entrada`)
)
JOIN `vn2008`.`travel` `tr` ON(`E`.`travel_id` = `tr`.`id`)
)
WHERE `C`.`Id_Cubo` IS NOT NULL
AND `C`.`Id_Cubo` <> '--'
AND `tr`.`landing` > `util`.`VN_CURDATE`() - INTERVAL 18 MONTH
ORDER BY `C`.`Id_Compra` DESC

View File

@ -1,23 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `bi`.`v_ventas_contables`
AS SELECT `time`.`year` AS `year`,
`time`.`month` AS `month`,
cast(
sum(
`m`.`Cantidad` * `m`.`Preu` * (100 - `m`.`Descuento`) / 100
) AS decimal(10, 0)
) AS `importe`
FROM (
(
(
`vn`.`ticket` `t`
JOIN `bi`.`f_tvc` ON(`t`.`id` = `bi`.`f_tvc`.`Id_Ticket`)
)
JOIN `vn2008`.`Movimientos` `m` ON(`t`.`id` = `m`.`Id_Ticket`)
)
JOIN `vn2008`.`time` ON(`time`.`date` = cast(`t`.`shipped` AS date))
)
WHERE `t`.`shipped` >= '2014-01-01'
GROUP BY `time`.`year`,
`time`.`month`

View File

@ -1,112 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`bancos_evolution_add`(vStartingDate DATE)
BEGIN
/**
* Inserta en la tabla bancos_evolution los saldos acumulados de cada banco
*
* @param vStartingDate Fecha desde la cual se recalculan la tabla bs.bancos_evolution
*/
DECLARE vCurrentDate DATE;
DECLARE vMaxDate DATE DEFAULT TIMESTAMPADD(MONTH, 7, util.VN_CURDATE());
IF IFNULL(vStartingDate,0) < TIMESTAMPADD(YEAR, -5, util.VN_CURDATE()) THEN
CALL util.throw('invalid date');
END IF;
DELETE FROM bs.bancos_evolution WHERE Fecha >= vStartingDate;
SET vCurrentDate = vStartingDate;
INSERT INTO bs.bancos_evolution(Fecha, Id_Banco, saldo)
SELECT vCurrentDate, Id_Banco, deuda
FROM bs.bancos_evolution
WHERE Fecha = TIMESTAMPADD(DAY,-1,vCurrentDate);
WHILE vCurrentDate < vMaxDate DO
-- insertar solo el dia de ayer
INSERT INTO bs.bancos_evolution(Fecha ,Id_Banco, saldo)
SELECT vCurrentDate, Id_Banco, SUM(saldo)
FROM (
SELECT Id_Banco ,saldo
FROM bs.bancos_evolution
WHERE Fecha = TIMESTAMPADD(DAY,-1,vCurrentDate) -- los saldos acumulados del dia anterior
UNION ALL
SELECT c.Id_Banco, IFNULL(SUM(Entrada),0) - IFNULL(SUM(Salida),0) as saldo
FROM vn2008.Cajas c
JOIN vn2008.Bancos b using(Id_Banco) -- saldos de las cajas
JOIN vn.accountingType at2 ON at2.id = b.cash
WHERE at2.code IN ('wireTransfer','fundingLine')
AND Cajafecha = vCurrentDate
AND (Serie = 'MB' OR at2.code = 'fundingLine')
GROUP BY Id_Banco
)sub
GROUP BY Id_Banco
ON DUPLICATE KEY UPDATE saldo = saldo + VALUES(saldo);
SET vCurrentDate = TIMESTAMPADD(DAY,1,vCurrentDate);
END WHILE;
-- Ahora actualizamos la quilla
UPDATE bs.bancos_evolution be
JOIN
(
SELECT bp.Id_Banco, - sum(bp.importe) as quilla, t.dated
FROM vn.time t
JOIN vn2008.Bancos_poliza bp ON t.dated between apertura AND IFNULL(cierre, t.dated)
WHERE t.dated BETWEEN vStartingDate AND vMaxDate
GROUP BY Id_Banco, t.dated
) sub ON be.Id_Banco = sub.Id_Banco AND sub.dated = be.Fecha
SET be.quilla = sub.quilla;
-- pagos futuros no concilidados
INSERT INTO bs.bancos_evolution(Fecha, Id_Banco, saldo)
SELECT t.dated, p.id_banco, - importe
FROM vn.time t
join vn2008.pago p ON p.fecha <= t.dated
WHERE t.dated BETWEEN util.VN_CURDATE() AND vMaxDate
AND p.fecha BETWEEN util.VN_CURDATE() AND vMaxDate
AND NOT conciliado
ON DUPLICATE KEY UPDATE saldo = saldo + VALUES(saldo);
-- cobros futuros
INSERT INTO bs.bancos_evolution(Fecha, Id_Banco, saldo)
SELECT t.dated, r.Id_Banco, SUM(Entregado)
FROM vn.time t
JOIN vn2008.Recibos r ON r.Fechacobro <= t.dated
WHERE r.Fechacobro > util.VN_CURDATE() AND r.Fechacobro <= vMaxDate
AND t.dated BETWEEN util.VN_CURDATE() AND vMaxDate
GROUP BY t.dated, r.Id_Banco
ON DUPLICATE KEY UPDATE saldo = saldo + VALUES(saldo);
-- saldos de la tabla prevision
INSERT INTO bs.bancos_evolution(Fecha, Id_Banco, saldo)
SELECT t.dated, sp.Id_Banco, SUM(Importe)
FROM vn.time t
JOIN vn2008.Saldos_Prevision sp ON sp.Fecha <= t.dated
JOIN vn2008.Bancos b ON sp.Id_Banco = b.Id_Banco
JOIN vn.accountingType at2 ON at2.id = b.cash
WHERE at2.code IN ('wireTransfer','fundingLine')
AND t.dated BETWEEN vStartingDate AND vMaxDate
GROUP BY t.dated, sp.Id_Banco
ON DUPLICATE KEY UPDATE saldo = saldo + VALUES(saldo);
-- Utilizamos el saldo_auxiliar para calcular lo dispuesto en las polizas
UPDATE bs.bancos_evolution be
SET saldo_aux = saldo
WHERE Fecha >= vStartingDate;
-- Deuda
UPDATE bs.bancos_evolution be
JOIN vn2008.Bancos b using(Id_Banco)
JOIN vn.accountingType at2 ON at2.id = b.cash
SET be.deuda = IF(at2.code = 'fundingLine', be.saldo_aux, 0)
, be.saldo = IF(at2.code = 'fundingLine', 0, be.saldo_aux)
WHERE Fecha >= vStartingDate;
-- Liquidez
update bs.bancos_evolution set liquidez = saldo - quilla + deuda WHERE Fecha >= vStartingDate;
-- Disponibilidad
update bs.bancos_evolution set `disponibilidad ajena` = - quilla + deuda WHERE Fecha >= vStartingDate;
END$$
DELIMITER ;

View File

@ -1,111 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`comercialesCompleto`(IN vWorker INT, vDate DATE)
BEGIN
DECLARE vAYearAgoStarted DATE DEFAULT DATE_FORMAT(TIMESTAMPADD(YEAR, - 1, vDate), '%Y-%m-01');
DECLARE vAYearAgoEnded DATE DEFAULT TIMESTAMPADD(YEAR, - 1, LAST_DAY(vDate));
CALL vn.worker_GetHierarchy(vWorker);
INSERT IGNORE INTO tmp.workerHierarchyList (workerFk)
SELECT wd2.workerFk
FROM vn.workerDepartment wd2
WHERE wd2.workerFk = vWorker;
-- Falta que en algunos casos solo tenga en cuenta los tipos afectados.
SELECT
c.Id_Cliente id_cliente,
c.Cliente cliente,
cr.recobro * 100 tarifa,
c.Telefono telefono,
c.movil,
c.POBLACION poblacion,
p.`name` provincia,
ROUND(f.futur, 2) futur,
c.Credito credito,
pm.`name` forma_pago,
ROUND(c365 / 12, 2) consumo_medio365,
ROUND(c365, 2) consumo365,
ROUND(CmLy.peso, 2) peso_mes_año_pasado,
ROUND(CmLy.peso * 1.19, 2) objetivo,
tr.CodigoTrabajador,
ROUND(mes_actual.consumo, 2) consumoMes,
ROUND(IFNULL(mes_actual.consumo, 0) - IFNULL(CmLy.peso * 1.19, 0), 2) como_lo_llevo,
DATE(LastTicket) ultimo_ticket,
dead.muerto,
g.Greuge,
cr.recobro
FROM
vn2008.Clientes c
LEFT JOIN
(SELECT g.clientFk Id_Cliente, CAST( SUM(g.amount) as DECIMAL(12,2)) AS Greuge
FROM vn.greuge g
JOIN vn.`client` c ON c.id = g.clientFk
LEFT JOIN vn.worker w ON c.salesPersonFk = w.id
WHERE (c.salesPersonFk = vWorker OR w.bossFk = vWorker)
GROUP BY Id_Cliente
) g ON g.Id_Cliente = c.Id_Cliente
LEFT JOIN
vn2008.province p ON p.province_id = c.province_id
JOIN
vn2008.pay_met pm ON pm.id = c.pay_met_id
LEFT JOIN
vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador
LEFT JOIN
bi.claims_ratio cr on cr.Id_Cliente = c.Id_Cliente
LEFT JOIN
(SELECT v.Id_Cliente, SUM(importe) c365 -- optimizat de 6s /5.3s/ 4.7s a 0.3/0.4/0.3
FROM bs.ventas v
JOIN vn2008.Clientes c ON c.Id_Cliente = v.Id_Cliente
WHERE v.fecha BETWEEN TIMESTAMPADD(YEAR, - 1, vDate) AND vDate
GROUP BY v.Id_Cliente) c365 ON c365.Id_Cliente = c.Id_Cliente
LEFT JOIN
(SELECT
Id_Cliente, SUM(importe) consumo
FROM
bs.ventas v
INNER JOIN vn2008.Clientes c USING (Id_Cliente)
LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador
WHERE
(c.Id_Trabajador = vWorker OR tr.boss = vWorker)
AND (v.fecha BETWEEN TIMESTAMPADD(DAY, - DAY(vDate) + 1, vDate) AND TIMESTAMPADD(DAY, - 1, vDate))
GROUP BY Id_Cliente) mes_actual ON mes_actual.Id_Cliente = c.Id_Cliente
LEFT JOIN
(SELECT t.clientFk Id_Cliente, SUM(m.preu * m.Cantidad * (1 - m.Descuento / 100)) futur
FROM vn.ticket t
JOIN vn2008.Clientes c ON c.Id_Cliente = t.clientFk
JOIN vn2008.Movimientos m ON m.Id_Ticket = t.id
LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador
WHERE
(c.Id_Trabajador = vWorker OR tr.boss = vWorker)
AND t.shipped BETWEEN vDate AND util.dayEnd(LAST_DAY(vDate))
GROUP BY Id_Cliente) f ON c.Id_Cliente = f.Id_Cliente
LEFT JOIN
(SELECT MAX(t.shipped) LastTicket, c.Id_Cliente
FROM vn.ticket t
JOIN vn2008.Clientes c ON c.Id_cliente = t.clientFk
LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador
WHERE
(c.Id_Trabajador = vWorker OR tr.boss = vWorker)
GROUP BY t.clientFk) LastTicket ON LastTicket.Id_Cliente = c.Id_Cliente
LEFT JOIN
(
SELECT SUM(importe) peso, c.Id_Cliente
FROM bs.ventas v
JOIN vn2008.Clientes c ON c.Id_Cliente = v.Id_Cliente
LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador
WHERE fecha BETWEEN vAYearAgoStarted and vAYearAgoEnded
AND (c.Id_Trabajador = vWorker OR tr.boss = vWorker)
GROUP BY c.Id_Cliente) CmLy ON CmLy.Id_Cliente = c.Id_Cliente
LEFT JOIN
(SELECT c.Id_Cliente,
IF(MAX(io.issued) < DATE_FORMAT(TIMESTAMPADD(MONTH, - 1, vDate), '%Y- %m-01'), TRUE, FALSE) muerto
FROM vn.invoiceOut io
JOIN vn2008.Clientes c ON c.Id_cliente = io.clientFk
LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador
WHERE (c.Id_Trabajador = vWorker OR tr.boss = vWorker)
GROUP BY Id_Cliente) dead ON dead.Id_Cliente = c.Id_Cliente
JOIN tmp.workerHierarchyList s ON s.workerFk = c.Id_Trabajador;
DROP TEMPORARY TABLE tmp.workerHierarchyList;
END$$
DELIMITER ;

View File

@ -15,10 +15,10 @@ BEGIN
SET lastYearSales =
(SELECT SUM(importe + recargo)
FROM ventas v
JOIN vn2008.empresa e ON e.id = v.empresa_id
JOIN vn2008.empresa_grupo eg ON eg.empresa_grupo_id = e.empresa_grupo
JOIN vn.company c ON c.id = v.empresa_id
JOIN vn.companyGroup cg ON cg.id = c.companyGroupFk
WHERE fecha BETWEEN oneYearBefore AND vDated
AND eg.grupo = 'Verdnatura'
AND cg.code = 'Verdnatura'
)
WHERE updated = vDated;

View File

@ -67,20 +67,20 @@ BEGIN
vToDated
FROM
(
SELECT cs.Id_Cliente, Cantidad * Valor as mana
SELECT a.clientFk Id_Cliente, s.quantity * sc.value as mana
FROM vn.ticket t
JOIN vn2008.Consignatarios cs using(Id_Consigna)
JOIN vn2008.Movimientos m on m.Id_Ticket = t.id
JOIN vn2008.Movimientos_componentes mc on mc.Id_Movimiento = m.Id_Movimiento
WHERE Id_Componente IN (vManaAutoId, vManaId, vClaimManaId)
JOIN vn.address a ON a.id = t.addressFk
JOIN vn.sale s on s.ticketFk = t.id
JOIN vn.saleComponent sc on sc.saleFk = s.id
WHERE sc.componentFk IN (vManaAutoId, vManaId, vClaimManaId)
AND t.shipped > vFromDated
AND date(t.shipped) <= vToDated
UNION ALL
SELECT r.Id_Cliente, - Entregado
FROM vn2008.Recibos r
WHERE Id_Banco = vManaBankId
AND Fechacobro > vFromDated
AND Fechacobro <= vToDated
SELECT clientFk, - amountPaid
FROM vn.receipt
WHERE bankFk = vManaBankId
AND payed > vFromDated
AND payed <= vToDated
UNION ALL
SELECT clientFk, amount
FROM vn.greuge

View File

@ -0,0 +1,72 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`sale_add`(
IN vStarted DATE,
IN vEnded DATE)
BEGIN
/**
* Añade las ventas que se realizaron entre 2 fechas a la tabla bs.sale
*
* @param vStarted Fecha de inicio
* @param vEnded Fecha de fin
*
*/
DECLARE vLoopDate DATE;
DECLARE vLoopDateTime DATETIME;
IF vStarted < (util.VN_CURDATE() - INTERVAL 5 YEAR) OR vStarted > vEnded THEN
CALL util.throw('Wrong date');
END IF;
SET vLoopDate = vStarted;
DELETE FROM sale
WHERE dated BETWEEN vStarted AND vEnded;
WHILE vLoopDate <= vEnded DO
SET vLoopDateTime = util.dayEnd(vLoopDate);
REPLACE sale(
saleFk,
amount,
surcharge,
dated,
typeFk,
clientFk,
companyFk,
margin
)WITH calculatedSales AS(
SELECT s.id saleFk,
SUM(IF(ct.isBase, s.quantity * sc.value, 0)) amount,
SUM(IF(ct.isBase, 0, s.quantity * sc.value)) surcharge,
s.total pvp,
DATE(t.shipped) dated,
i.typeFk,
t.clientFk,
t.companyFk,
SUM(IF(ct.isMargin, s.quantity * sc.value, 0 )) marginComponents
FROM vn.ticket t
STRAIGHT_JOIN vn.sale s ON s.ticketFk = t.id
JOIN vn.item i ON i.id = s.itemFk
JOIN vn.itemType it ON it.id = i.typeFk
JOIN vn.itemCategory ic ON ic.id = it.categoryFk
JOIN vn.saleComponent sc ON sc.saleFk = s.id
JOIN vn.component c ON c.id = sc.componentFk
JOIN vn.componentType ct ON ct.id = c.typeFk
WHERE t.shipped BETWEEN vLoopDate AND vLoopDateTime
AND s.quantity <> 0
AND ic.merchandise
GROUP BY s.id
)SELECT saleFk,
amount,
surcharge,
dated,
typeFk,
clientFk,
companyFk,
marginComponents + amount + surcharge - pvp
FROM calculatedSales;
SET vLoopDate = vLoopDate + INTERVAL 1 DAY;
END WHILE;
END$$
DELIMITER ;

View File

@ -1,13 +1,12 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`ventas_add_launcher`()
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`sales_addLauncher`()
BEGIN
/**
* Añade las ventas a la tabla bs.sale que se realizaron desde hace un mes hasta hoy
*
*/
DECLARE vCurDate DATE DEFAULT util.VN_CURDATE();
CALL ventas_add(vCurDate - INTERVAL 1 MONTH, vCurDate);
CALL sale_add(vCurDate - INTERVAL 1 MONTH, vCurDate);
END$$
DELIMITER ;

View File

@ -1,78 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`ventas_add`(
IN vStarted DATETIME,
IN vEnded DATETIME)
BEGIN
/**
* Añade las ventas que se realizaron entre
* vStarted y vEnded
*
* @param vStarted Fecha de inicio
* @param vEnded Fecha de finalizacion
*
**/
DECLARE vStartingDate DATETIME;
DECLARE vEndingDate DATETIME;
IF vStarted < TIMESTAMPADD(YEAR,-5,util.VN_CURDATE())
OR vEnded < TIMESTAMPADD(YEAR,-5,util.VN_CURDATE()) THEN
CALL util.throw('fechaDemasiadoAntigua');
END IF;
SET vEnded = util.dayEnd(vEnded);
SET vStartingDate = vStarted ;
SET vEndingDate = util.dayEnd(vStartingDate);
DELETE
FROM sale
WHERE dated BETWEEN vStartingDate AND vEnded;
WHILE vEndingDate <= vEnded DO
REPLACE ventas(Id_Movimiento, importe, recargo, fecha, tipo_id, Id_Cliente, empresa_id)
SELECT saleFk,
SUM(IF(ct.isBase, s.quantity * sc.value, 0)) importe,
SUM(IF(ct.isBase, 0, s.quantity * sc.value)) recargo,
vStartingDate,
i.typeFk,
a.clientFk,
t.companyFk
FROM vn.saleComponent sc
JOIN vn.component c ON c.id = sc.componentFk
JOIN vn.componentType ct ON ct.id = c.typeFk
JOIN vn.sale s ON s.id = sc.saleFk
JOIN vn.item i ON i.id = s.itemFk
JOIN vn.itemType it ON it.id = i.typeFk
JOIN vn.itemCategory ic ON ic.id = it.categoryFk
JOIN vn.ticket t ON t.id = s.ticketFk
JOIN vn.address a ON a.id = t.addressFk
JOIN vn.client cl ON cl.id = a.clientFk
WHERE t.shipped BETWEEN vStartingDate AND vEndingDate
AND s.quantity <> 0
AND s.discount <> 100
AND ic.merchandise
GROUP BY sc.saleFk
HAVING IFNULL(importe,0) <> 0 OR IFNULL(recargo,0) <> 0;
UPDATE sale s
JOIN (
SELECT s.id,
SUM(s.quantity * sc.value ) margen,
s.quantity * s.price * (100 - s.discount ) / 100 pvp
FROM vn.sale s
JOIN vn.ticket t ON t.id = s.ticketFk
JOIN vn.saleComponent sc ON sc.saleFk = s.id
JOIN vn.component c ON c.id = sc.componentFk
JOIN vn.componentType ct ON ct.id = c.typeFk
WHERE t.shipped BETWEEN vStartingDate AND vEndingDate
AND ct.isMargin = TRUE
GROUP BY s.id) sub ON sub.id = s.saleFk
SET s.margin = sub.margen + s.amount + s.surcharge - sub.pvp;
SET vStartingDate = TIMESTAMPADD(DAY,1, vStartingDate);
SET vEndingDate = util.dayEnd(vStartingDate);
END WHILE;
END$$
DELIMITER ;

View File

@ -38,35 +38,35 @@ BEGIN
SELECT vYear
, vMonth
, round(sum(Cantidad * Preu * (100 - m.Descuento)/100))
, round(sum(s.quantity * s.price * (100 - s.discount)/100))
, IF(
e.empresa_grupo = e2.empresa_grupo
co.companyGroupFk = co2.companyGroupFk
,1
,IF(e2.empresa_grupo,2,0)
,IF(co2.companyGroupFk,2,0)
) as grupo
, tp.reino_id
, a.tipo_id
, it.categoryFk
, i.typeFk
, t.companyFk
, a.expenseFk
+ IF(e.empresa_grupo = e2.empresa_grupo
, i.expenseFk
+ IF(co.companyGroupFk = co2.companyGroupFk
,1
,IF(e2.empresa_grupo,2,0)
,IF(co2.companyGroupFk,2,0)
) * 100000
+ tp.reino_id * 1000 as Gasto
FROM vn2008.Movimientos m
JOIN vn.ticket t ON t.id = m.Id_Ticket
JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.addressFk
JOIN vn2008.Clientes c on c.Id_Cliente = cs.Id_Cliente
+ it.categoryFk * 1000 as Gasto
FROM vn.sale s
JOIN vn.ticket t ON t.id = s.ticketFk
JOIN vn.address a on a.id = t.addressFk
JOIN vn.client c on c.id = a.clientFk
JOIN tmp.ticket_list tt on tt.id = t.id
JOIN vn2008.Articles a on m.Id_Article = a.Id_Article
JOIN vn2008.empresa e on e.id = t.companyFk
LEFT JOIN vn2008.empresa e2 on e2.Id_Cliente = c.Id_Cliente
JOIN vn2008.Tipos tp on tp.tipo_id = a.tipo_id
WHERE Cantidad <> 0
AND Preu <> 0
AND m.Descuento <> 100
AND a.tipo_id != TIPO_PATRIMONIAL
GROUP BY grupo, reino_id, tipo_id, companyFk, Gasto;
JOIN vn.item i on s.itemFk = i.id
JOIN vn.company co on co.id = t.companyFk
LEFT JOIN vn.company co2 on co2.clientFk = c.id
JOIN vn.itemType it on it.id = i.typeFk
WHERE s.quantity <> 0
AND s.price <> 0
AND s.discount <> 100
AND i.typeFk <> TIPO_PATRIMONIAL
GROUP BY grupo, it.categoryFk, i.typeFk, t.companyFk, Gasto;
INSERT INTO bs.ventas_contables(year
, month

View File

@ -1,47 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`ventas_contables_por_cliente`(IN vYear INT, IN vMonth INT)
BEGIN
/**
* Muestra las ventas () de cada cliente
* dependiendo del año
*/
DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list;
CREATE TEMPORARY TABLE tmp.ticket_list
(PRIMARY KEY (id))
SELECT t.id
FROM vn.ticket t
JOIN vn.invoiceOut io ON io.id = t.refFk
WHERE year(io.issued) = vYear
AND month(io.issued) = vMonth;
SELECT vYear Año,
vMonth Mes,
t.clientFk Id_Cliente,
round(sum(Cantidad * Preu * (100 - m.Descuento)/100)) Venta,
IF(e.empresa_grupo = e2.empresa_grupo,
1,
IF(e2.empresa_grupo,2,0))
AS grupo,
t.companyFk empresa
FROM vn2008.Movimientos m
JOIN vn.ticket t ON t.id = m.Id_Ticket
JOIN vn2008.Consignatarios cs ON cs.Id_Consigna = t.addressFk
JOIN vn2008.Clientes c ON c.Id_Cliente = cs.Id_Cliente
JOIN tmp.ticket_list tt ON tt.id = t.id
JOIN vn2008.Articles a ON m.Id_Article = a.Id_Article
JOIN vn2008.empresa e ON e.id = t.companyFk
LEFT JOIN vn2008.empresa e2 ON e2.Id_Cliente = c.Id_Cliente
JOIN vn2008.Tipos tp ON tp.tipo_id = a.tipo_id
WHERE Cantidad <> 0
AND Preu <> 0
AND m.Descuento <> 100
AND a.tipo_id != 188
GROUP BY t.clientFk, grupo,t.companyFk;
DROP TEMPORARY TABLE tmp.ticket_list;
END$$
DELIMITER ;

View File

@ -1,63 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`vivosMuertos`()
BEGIN
/**
* Devuelve el número de clientes nuevos y muertos,
* dependiendo de la fecha actual.
*
* @param @datSTART Fecha de inicio a buscar
* @param @datEND Fecha de finalización a buscar
*/
SET @datSTART = TIMESTAMPADD(YEAR,-2,util.VN_CURDATE());
SET @datEND = TIMESTAMPADD(DAY,-DAY(util.VN_CURDATE()),util.VN_CURDATE());
DROP TEMPORARY TABLE IF EXISTS tmp.VivosMuertos;
CREATE TEMPORARY TABLE tmp.VivosMuertos
SELECT c.Id_Cliente, tm.yearMonth, f.Compra, 0 as Nuevo, 0 as Muerto
FROM vn2008.Clientes c
JOIN
(SELECT DISTINCT yearMonth
FROM vn2008.time
WHERE date BETWEEN @datSTART
AND @datEND ) tm
LEFT JOIN
(SELECT DISTINCT tm.yearMonth, io.clientFk Id_Cliente , 1 as Compra
FROM vn.invoiceOut io
JOIN vn2008.time tm ON tm.date = io.issued
WHERE io.issued BETWEEN @datSTART
AND @datEND) f ON f.yearMonth = tm.yearMonth
AND f.Id_Cliente = c.Id_Cliente;
UPDATE tmp.VivosMuertos vm
JOIN
(SELECT MIN(tm.yearMonth) firstMonth, io.clientFk Id_Cliente
FROM vn.invoiceOut io
JOIN vn2008.time tm ON tm.date = io.issued
WHERE io.issued BETWEEN @datSTART AND @datEND
GROUP BY io.clientFk) fm ON fm.firstMonth = vm.yearMonth
AND fm.Id_Cliente = vm.Id_Cliente
SET Nuevo = 1;
SELECT max(yearMonth) INTO @lastYearMonth FROM tmp.VivosMuertos;
UPDATE tmp.VivosMuertos vm
JOIN (
SELECT MAX(tm.yearMonth) firstMonth, io.clientFk Id_Cliente
FROM vn.invoiceOut io
JOIN vn2008.time tm ON tm.date = io.issued
WHERE io.issued BETWEEN @datSTART AND @datEND
GROUP BY io.clientFk) fm ON fm.firstMonth = vm.yearMonth
AND fm.Id_Cliente = vm.Id_Cliente
SET Muerto = 1
WHERE yearMonth < @lastYearMonth;
SELECT * FROM tmp.VivosMuertos;
END$$
DELIMITER ;

View File

@ -1,14 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `bs`.`VentasPorCliente`
AS SELECT `v`.`Id_Cliente` AS `Id_Cliente`,
round(sum(`v`.`importe`), 0) AS `VentaBasica`,
`t`.`year` AS `year`,
`t`.`month` AS `month`
FROM (
`vn2008`.`time` `t`
JOIN `bs`.`ventas` `v` ON(`v`.`fecha` = `t`.`date`)
)
GROUP BY `v`.`Id_Cliente`,
`t`.`year`,
`t`.`month`

View File

@ -1,31 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `bs`.`bajasLaborales`
AS SELECT `w`.`firstName` AS `firstname`,
`w`.`lastName` AS `name`,
`b`.`id` AS `businessFk`,
max(`c`.`dated`) AS `lastDate`,
max(IFNULL(`b`.`ended`, `util`.`VN_CURDATE`())) AS `endContract`,
`at`.`name` AS `type`,
cast(COUNT(0) AS decimal(10, 0)) AS `dias`,
`w`.`id` AS `userFk`
FROM (
(
(
`vn`.`calendar` `c`
JOIN `vn`.`business` `b` ON(`b`.`id` = `c`.`businessFk`)
)
JOIN `vn`.`worker` `w` ON(`w`.`id` = `b`.`workerFk`)
)
JOIN `vn`.`absenceType` `at` ON(`at`.`id` = `c`.`dayOffTypeFk`)
)
WHERE `c`.`dated` >= `util`.`VN_CURDATE`() + INTERVAL -1 year
AND `at`.`name` NOT IN (
'Vacaciones',
'Vacaciones 1/2 día',
'Compensar',
'Festivo'
)
GROUP BY `w`.`id`,
`at`.`id`
HAVING `endContract` >= `util`.`VN_CURDATE`()

View File

@ -1,27 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `bs`.`horasSilla`
AS SELECT `wj`.`dated` AS `Fecha`,
`d`.`name` AS `Departamento`,
cast(sum(`wj`.`total`) AS decimal(10, 2)) AS `Horas`,
cast(
sum(
(`wj`.`total` + `wj`.`lunch`) * `wj`.`priceOrdinaryHour`
) AS decimal(10, 2)
) AS `Salarios`
FROM (
(
`vn`.`workerJourney` `wj`
JOIN `vn`.`business` `b` ON(`b`.`id` = `wj`.`businessFk`)
)
JOIN `vn`.`department` `d` ON(`d`.`id` = `b`.`departmentFk`)
)
WHERE `d`.`name` IN (
'CAMARA',
'ENCAJADO',
'PALETIZADORES',
'PRODUCCION',
'SACADORES'
)
GROUP BY `wj`.`dated`,
`d`.`name`

View File

@ -1,19 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `bs`.`s1_ticketDetail`
AS SELECT `s`.`ticketFk` AS `ticketFk`,
cast(
sum(`s`.`price` * `s`.`quantity`) AS decimal(10, 2)
) AS `ticketAmount`,
COUNT(`s`.`id`) AS `ticketLines`,
cast(sum(`sv`.`volume`) AS decimal(10, 2)) AS `ticketM3`,
cast(`t`.`shipped` AS date) AS `shipped`
FROM (
(
`vn`.`ticket` `t`
JOIN `vn`.`sale` `s` ON(`s`.`ticketFk` = `t`.`id`)
)
JOIN `vn`.`saleVolume` `sv` ON(`sv`.`saleFk` = `s`.`id`)
)
WHERE `t`.`shipped` BETWEEN '2021-09-01' AND '2021-10-31 23:59'
GROUP BY `s`.`ticketFk`

View File

@ -1,42 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `bs`.`s21_saleDetail`
AS SELECT dayofmonth(`t`.`shipped`) AS `dia`,
year(`t`.`shipped`) AS `año`,
MONTH(`t`.`shipped`) AS `mes`,
`s`.`concept` AS `concepto`,
`s`.`quantity` AS `unidades`,
`s`.`price` AS `precio`,
`s`.`quantity` * `s`.`price` AS `venta`,
`it`.`name` AS `familia`,
`w`.`code` AS `comprador`,
`s`.`itemFk` AS `itemFk`,
`s`.`ticketFk` AS `ticketFk`,
`sv`.`volume` AS `volume`
FROM (
(
(
(
(
(
`vn`.`sale` `s`
JOIN `vn`.`item` `i` ON(`i`.`id` = `s`.`itemFk`)
)
JOIN `vn`.`itemType` `it` ON(`it`.`id` = `i`.`typeFk`)
)
JOIN `vn`.`worker` `w` ON(`w`.`id` = `it`.`workerFk`)
)
JOIN `vn`.`ticket` `t` ON(`t`.`id` = `s`.`ticketFk`)
)
JOIN `vn`.`client` `c` ON(`c`.`id` = `t`.`clientFk`)
)
JOIN `vn`.`saleVolume` `sv` ON(`sv`.`saleFk` = `s`.`id`)
)
WHERE (
`t`.`shipped` BETWEEN '2020-10-21' AND '2020-10-28'
OR `t`.`shipped` BETWEEN '2019-10-21' AND '2019-10-28'
OR `t`.`shipped` BETWEEN '2021-09-1' AND '2021-10-28'
)
AND `t`.`warehouseFk` IN (1, 60)
AND `c`.`isRelevant` <> 0
AND `s`.`quantity` > 0

View File

@ -1,36 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`prod_graphic_refresh`(v_refresh BOOL, wh_id INT)
proc: BEGIN
DECLARE datEQ DATETIME;
DECLARE timDIF TIME;
DECLARE v_calc INT;
CALL cache_calc_start (v_calc, v_refresh, 'prod_graphic', wh_id);
IF !v_refresh
THEN
LEAVE proc;
END IF;
CALL vn2008.production_control_source(wh_id, 0);
DELETE FROM prod_graphic_source;
INSERT INTO prod_graphic_source (warehouse_id, graphCategory, m3, hora, `order`, Agencia)
SELECT
wh_id,
st.graphCategory,
CAST(SUM(m3) AS DECIMAL(10,0)) as m3,
pb.Hora,
pb.state_order,
pb.Agencia
FROM tmp.production_buffer pb
JOIN vn.state st ON st.id = pb.state
WHERE Fecha = util.VN_CURDATE()
GROUP BY wh_id, graphCategory
;
CALL cache_calc_end (v_calc);
END$$
DELIMITER ;

View File

@ -70,16 +70,16 @@ proc:BEGIN
ELSE
INSERT IGNORE INTO vn2008.Cubos (Id_Cubo, X, Y, Z)
INSERT IGNORE INTO vn.packaging (id, width, depth, height)
SELECT bucket_id, ROUND(x_size/10), ROUND(y_size/10), ROUND(z_size/10)
FROM bucket WHERE bucket_id = vPackage;
IF ROW_COUNT() > 0
THEN
INSERT INTO vn2008.mail SET
INSERT INTO vn.mail SET
`subject` = 'Cubo añadido',
`text` = CONCAT('Se ha añadido el cubo: ', vPackage),
`to` = 'ekt@verdnatura.es';
`body` = CONCAT('Se ha añadido el cubo: ', vPackage),
`receiver` = 'ekt@verdnatura.es';
END IF;
END IF;

View File

@ -0,0 +1,13 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`connection_kill`(
vConnectionId BIGINT
)
BEGIN
/**
* Kill a connection
*
* @param vConnectionId
*/
KILL vConnectionId;
END$$
DELIMITER ;

View File

@ -1,40 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`getAlert3StateTest`(vTicket INT)
RETURNS varchar(45) CHARSET latin1 COLLATE latin1_swedish_ci
NOT DETERMINISTIC
READS SQL DATA
BEGIN
DECLARE vDeliveryType INTEGER DEFAULT 0;
DECLARE isWaitingForPickUp BOOLEAN DEFAULT FALSE;
DECLARE vCode VARCHAR(45);
SELECT
a.Vista
INTO vDeliveryType
FROM ticket t
JOIN vn2008.Agencias a ON a.Id_Agencia = t.agencyModeFk
WHERE t.id = vTicket;
CASE vDeliveryType
WHEN 1 THEN -- AGENCIAS
SET vCode = 'DELIVERED';
WHEN 2 THEN -- REPARTO
SET vCode = 'ON_DELIVERY';
ELSE -- MERCADO, OTROS
SELECT t.warehouseFk <> w.warehouse_id INTO isWaitingForPickUp
FROM ticket t
LEFT JOIN vn2008.warehouse_pickup w
ON w.agency_id = t.agencyModeFk AND w.warehouse_id = t.warehouseFk
WHERE t.id = vTicket;
IF isWaitingForPickUp THEN
SET vCode = 'WAITING_FOR_PICKUP';
ELSE
SET vCode = 'DELIVERED';
END IF;
END CASE;
RETURN vCode;
END$$
DELIMITER ;

View File

@ -26,11 +26,11 @@ SELECT t.routeFk, t.warehouseFk, IFNULL(ts.productionOrder,0)
LEFT JOIN ticketState ts on ts.ticketFk = t.id
WHERE t.id = vTicketId;
SELECT (ag.`name` = 'VN_VALENCIA')
SELECT (a.`name` = 'VN_VALENCIA')
INTO vIsValenciaPath
FROM `route` r
JOIN vn2008.Agencias a on a.Id_Agencia = r.agencyModeFk
JOIN vn2008.agency ag on ag.agency_id = a.agency_id
JOIN agencyMode am on am.id = r.agencyModeFk
JOIN agency a on a.id = am.agencyFk
WHERE r.id = vMyPath;
IF vIsValenciaPath THEN -- Rutas Valencia

View File

@ -9,9 +9,9 @@ BEGIN
SELECT CONCAT(printedStickers,'/',Total, IF(printedStickers = Total ,' LS','')) INTO vSplitCounter
FROM
(
SELECT count(l.Id_Movimiento) as printedStickers, COUNT(*) as Total
FROM vn.sale s
LEFT JOIN vn2008.movement_label l ON l.Id_Movimiento = s.id
SELECT count(sl.saleFk) as printedStickers, COUNT(*) as Total
FROM sale s
LEFT JOIN saleLabel sl ON sl.saleFk = s.id
WHERE ticketFk = vTicketFk
) sub;

View File

@ -30,10 +30,9 @@ BEGIN
-- Si hay colecciones sin terminar, sale del proceso
CALL collection_get(vUserFk);
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0
INTO vHasTooMuchCollections
FROM tCollection
JOIN productionConfig pc;
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0 INTO vHasTooMuchCollections
FROM productionConfig pc
LEFT JOIN tCollection ON TRUE;
DROP TEMPORARY TABLE tCollection;
@ -47,7 +46,7 @@ BEGIN
WHERE workerFk = vUserFk;
SET vLockName = CONCAT_WS('/',
'collection_assign',
vLockName,
vWarehouseFk,
vItemPackingTypeFk
);

View File

@ -63,7 +63,8 @@ BEGIN
o.numberOfWagons,
o.trainFk,
o.linesLimit,
o.volumeLimit
o.volumeLimit,
pc.collection_new_lockname
INTO vMaxTickets,
vHasUniqueCollectionTime,
vWorkerCode,
@ -73,14 +74,15 @@ BEGIN
vWagons,
vTrainFk,
vLinesLimit,
vVolumeLimit
vVolumeLimit,
vLockName
FROM productionConfig pc
JOIN worker w ON w.id = vUserFk
JOIN state st ON st.`code` = 'ON_PREPARATION'
JOIN operator o ON o.workerFk = vUserFk;
SET vLockName = CONCAT_WS('/',
'collection_new',
vLockName,
vWarehouseFk,
vItemPackingTypeFk
);

View File

@ -20,17 +20,17 @@ BEGIN
GREATEST(0,iss.visible - IFNULL(sub3.transit,0)) as Altillo,
s.id as saleFk,
IFNULL(sub3.transit,0) transit,
v.visible, s.isPicked, s.reserved, t.shipped, tst.productionOrder, mm.Id_Movimiento
FROM vn.ticket t
JOIN vn.ticketState tst ON tst.ticketFk = t.id
JOIN vn.sale s ON s.ticketFk = t.id
JOIN vn.item i ON i.id = s.itemFk
v.visible, s.isPicked, s.reserved, t.shipped, tst.productionOrder, st.saleFk
FROM ticket t
JOIN ticketState tst ON tst.ticketFk = t.id
JOIN sale s ON s.ticketFk = t.id
JOIN item i ON i.id = s.itemFk
JOIN cache.visible v ON s.itemFk = v.item_id AND v.calc_id = vVisibleCache
LEFT JOIN vn2008.Movimientos_mark mm ON mm.Id_Movimiento = s.id AND mm.stateFk = 26
JOIN vn.itemShelvingStock iss ON iss.itemFk = v.item_id
LEFT JOIN saleTracking st ON st.saleFk = s.id AND st.stateFk = 26
JOIN itemShelvingStock iss ON iss.itemFk = v.item_id
LEFT JOIN
(SELECT itemFk, sum(saldo) as transit
FROM vn.itemPlacementSupplyList
FROM itemPlacementSupplyList
WHERE saldo > 0
AND sectorFk = vSectorFk
GROUP BY itemFk) sub3 ON sub3.itemFk = i.id
@ -42,7 +42,7 @@ BEGIN
AND tst.isPreviousPreparable = TRUE
AND t.warehouseFk = vWarehouseFk
AND iss.sectorFk = vSectorFk
AND mm.Id_Movimiento IS NULL
AND st.saleFk IS NULL
ORDER BY itemFk;
END$$

View File

@ -101,9 +101,6 @@ BEGIN
DELETE FROM itemCost
WHERE itemFk = vItemOld;
DELETE FROM vn2008.rec_translator
WHERE Id_Article = vItemOld;
DELETE FROM bs.waste
WHERE itemFk = vItemOld;

View File

@ -179,7 +179,7 @@ BEGIN
LEFT JOIN alertLevel a ON a.id = t.alertLevel;
ELSE
SELECT SUM(`in`) - SUM(`out`) INTO @a
SELECT IFNULL(SUM(IFNULL(`in`, 0)) - SUM(IFNULL(`out`, 0)), 0) INTO @a
FROM tItemDiary
WHERE shipped < vDate;

View File

@ -1,13 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`packingListPrinted`(ticketFk INT)
BEGIN
UPDATE vn2008.Movimientos_mark mm
JOIN vn2008.Movimientos m ON m.Id_Movimiento = mm.Id_Movimiento
SET mm.valor = 2 -- Impreso
WHERE mm.valor = 1 -- Listo para imprimir
AND mm.stateFk = 9 -- Encajando
AND m.Id_Ticket = ticketFk;
END$$
DELIMITER ;

View File

@ -5,14 +5,14 @@ BEGIN
DECLARE valueFk INT;
DECLARE encajando INT DEFAULT 9;
SELECT valor INTO valueFk
FROM vn2008.Movimientos_mark
WHERE Id_Movimiento = saleFk
SELECT isChecked INTO valueFk
FROM saleTracking
WHERE saleFk = saleFk
AND stateFk = encajando;
SET valueFk = (IFNULL(valueFk,0) + 1) MOD 3;
REPLACE vn2008.Movimientos_mark(Id_Movimiento, valor, Id_Trabajador, stateFk)
REPLACE saleTracking(saleFk, isChecked, workerFk, stateFk)
VALUES(saleFk,valueFk,account.myUser_getId(),encajando);

View File

@ -79,6 +79,10 @@ BEGIN
ORDER BY (vQuantity % `grouping`) ASC
LIMIT 1;
IF vNewPrice IS NULL THEN
CALL util.throw('price retrieval failed');
END IF;
IF vNewPrice > vOldPrice THEN
SET vFinalPrice = vOldPrice;
SET vOption = 'substitution';
@ -90,7 +94,8 @@ BEGIN
START TRANSACTION;
UPDATE sale
SET quantity = quantity - vQuantity
SET originalQuantity = quantity - vQuantity,
quantity = quantity - vQuantity
WHERE id = vSaleFk;
INSERT INTO vn.sale(ticketFk,
@ -100,7 +105,8 @@ BEGIN
price)
SELECT vTicketFk,
vNewItemFk,
CEIL(vQuantity / vRoundQuantity) * vRoundQuantity, CONCAT('+ ', i.name),
CEIL(vQuantity / vRoundQuantity) * vRoundQuantity,
CONCAT('+ ', i.name),
vFinalPrice
FROM vn.item i
WHERE id = vNewItemFk;

View File

@ -29,7 +29,7 @@ BEGIN
FROM sale
WHERE ticketFk = vTicketNew AND price > 0;
CALL sale_recalcComponent('imbalance');
CALL sale_recalcComponent('buyerDiscount');
DROP TEMPORARY TABLE IF EXISTS tmp.recalculateSales;

View File

@ -1,19 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketRequest_Add`(vDescription VARCHAR(255), vQuantity INT, vPrice DOUBLE, vTicketFk INT, vBuyerCode VARCHAR(3))
BEGIN
INSERT INTO vn.ticketRequest(description,
quantity,
price,
ticketFk,
buyerCode,
requesterFk)
VALUES(vDescription,
vQuantity,
vPrice,
vTicketFk,
vBuyerCode,
vn.getUser());
END$$
DELIMITER ;

View File

@ -63,7 +63,7 @@ BEGIN
INSERT INTO ticketPackaging (ticketFk, packagingFk, quantity)
(SELECT vCurTicketFk, p.id, COUNT(*)
FROM expedition e
JOIN packaging p ON p.itemFk = e.freightItemFk
JOIN packaging p ON p.id = e.packagingFk
WHERE e.ticketFk = vCurTicketFk AND p.isPackageReturnable
AND vWithPackage
GROUP BY p.itemFk);

View File

@ -121,15 +121,17 @@ BEGIN
CALL util.throw(vErrorCode);
END IF;
-- DIRECCION CORRECTA
CALL workerTimeControl_direction(vWorkerFk, vTimed);
IF (SELECT
IF(IF(option1 IN ('inMiddle', 'outMiddle'),
IF((IF(option1 IN ('inMiddle', 'outMiddle'),
'middle',
option1) <> vDirection
AND IF(option2 IN ('inMiddle', 'outMiddle'),
'middle',
IFNULL(option2, '')) <> vDirection,
IFNULL(option2, '')) <> vDirection)
OR (option1 IS NULL AND option2 IS NULL),
TRUE ,
FALSE)
FROM tmp.workerTimeControlDirection
@ -137,12 +139,17 @@ BEGIN
SET vIsError = TRUE;
END IF;
DROP TEMPORARY TABLE tmp.workerTimeControlDirection;
IF vIsError THEN
SET vErrorCode = 'WRONG_DIRECTION';
IF(SELECT option1 IS NULL AND option2 IS NULL
FROM tmp.workerTimeControlDirection) THEN
SET vErrorCode = 'DAY_MAX_TIME';
END IF;
CALL util.throw(vErrorCode);
END IF;
DROP TEMPORARY TABLE tmp.workerTimeControlDirection;
-- FICHADAS IMPARES
SELECT timed INTO vLastIn
FROM workerTimeControl

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`agency_beforeInsert`
BEFORE INSERT ON `agency`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -6,9 +6,19 @@ BEGIN
DECLARE vIsVirtual BOOL;
DECLARE vPrintedCount INT;
DECLARE vHasDistinctWarehouses BOOL;
DECLARE vTotalBuy INT;
IF NEW.isBooked = OLD.isBooked THEN
CALL entry_checkBooked(OLD.id);
ELSE
IF NEW.isBooked THEN
SELECT COUNT(*) INTO vTotalBuy
FROM buy
WHERE entryFk = NEW.id;
IF NOT vTotalBuy THEN
CALL util.throw('Entry must have lines to be marked booked');
END IF;
END IF;
END IF;
SET NEW.editorFk = account.myUser_getId();

View File

@ -3,8 +3,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`solunionCAP_afterInse
AFTER INSERT ON `solunionCAP`
FOR EACH ROW
BEGIN
UPDATE vn2008.Clientes c
JOIN creditClassification cc ON c.Id_Cliente = cc.client
UPDATE client c
JOIN creditClassification cc ON cc.client = c.id
JOIN creditInsurance ci ON ci.creditClassification = cc.id
SET creditInsurance = ci.credit * 2 WHERE ci.id = NEW.creditInsurance;
END$$

View File

@ -4,13 +4,13 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`solunionCAP_afterUpda
FOR EACH ROW
BEGIN
IF NEW.dateLeaving IS NOT NULL THEN
UPDATE vn2008.Clientes c
JOIN creditClassification cc ON c.Id_Cliente = cc.client
UPDATE client c
JOIN creditClassification cc ON cc.client = c.id
JOIN creditInsurance ci ON ci.creditClassification = cc.id
SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance;
ELSE
UPDATE vn2008.Clientes c
JOIN creditClassification cc ON c.Id_Cliente = cc.client
UPDATE client c
JOIN creditClassification cc ON cc.client = c.id
JOIN creditInsurance ci ON ci.creditClassification = cc.id
SET creditInsurance = ci.credit * 2 WHERE ci.id = OLD.creditInsurance;
END IF;

View File

@ -3,8 +3,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`solunionCAP_beforeDel
BEFORE DELETE ON `solunionCAP`
FOR EACH ROW
BEGIN
UPDATE vn2008.Clientes c
JOIN creditClassification cc ON c.Id_Cliente = cc.client
UPDATE client c
JOIN creditClassification cc ON cc.client = c.id
JOIN creditInsurance ci ON ci.creditClassification = cc.id
SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance;
END$$

View File

@ -4,7 +4,5 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketPackaging_befor
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
SET NEW.workerFk = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -14,7 +14,7 @@ BEGIN
END IF;
IF NEW.attenderFk IS NULL THEN
SET NEW.attenderFk = (SELECT w.id FROM worker w WHERE w.code = NEW.buyerCode);
SET NEW.attenderFk = (SELECT defaultAttenderFk FROM ticketConfig LIMIT 1);
END IF;
END$$
DELIMITER ;

View File

@ -12,9 +12,5 @@ BEGIN
IF NEW.salesPersonCode <> OLD.salesPersonCode THEN
SET NEW.requesterFk = (SELECT w.id FROM worker w WHERE w.code = NEW.salesPersonCode);
END IF;
IF NEW.buyerCode <> OLD.buyerCode THEN
SET NEW.attenderFk = (SELECT w.id FROM worker w WHERE w.code = NEW.buyerCode);
END IF;
END$$
DELIMITER ;

View File

@ -1,8 +1,8 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`especialPrice`
AS SELECT `p`.`Id_PrecioEspecial` AS `id`,
`p`.`Id_Cliente` AS `clientFk`,
`p`.`Id_Article` AS `itemFk`,
`p`.`PrecioEspecial` AS `value`
FROM `vn2008`.`PreciosEspeciales` `p`
AS SELECT `sp`.`id` AS `id`,
`sp`.`clientFk` AS `clientFk`,
`sp`.`itemFk` AS `itemFk`,
`sp`.`value` AS `value`
FROM `vn`.`specialPrice` `sp`

View File

@ -1,16 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`exchangeInsurance`
AS SELECT `vn2008`.`pago_sdc`.`pago_sdc_id` AS `id`,
`vn2008`.`pago_sdc`.`importe` AS `amount`,
`vn2008`.`pago_sdc`.`fecha` AS `dated`,
`vn2008`.`pago_sdc`.`vencimiento` AS `finished`,
`vn2008`.`pago_sdc`.`entity_id` AS `entityFk`,
`vn2008`.`pago_sdc`.`ref` AS `ref`,
`vn2008`.`pago_sdc`.`rate` AS `rate`,
`vn2008`.`pago_sdc`.`empresa_id` AS `companyFk`,
`vn2008`.`pago_sdc`.`financialProductTypefk` AS `financialProductTypefk`,
`vn2008`.`pago_sdc`.`upperBarrier` AS `upperBarrier`,
`vn2008`.`pago_sdc`.`lowerBarrier` AS `lowerBarrier`,
`vn2008`.`pago_sdc`.`strike` AS `strike`
FROM `vn2008`.`pago_sdc`

View File

@ -1,16 +1,16 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`paymentExchangeInsurance`
AS SELECT `p`.`pago_sdc_id` AS `id`,
`p`.`importe` AS `amount`,
`p`.`fecha` AS `created`,
`p`.`vencimiento` AS `dueDay`,
`p`.`entity_id` AS `entityFk`,
`p`.`ref` AS `ref`,
`p`.`rate` AS `rate`,
`p`.`empresa_id` AS `companyFk`,
`p`.`financialProductTypefk` AS `financialProductTypefk`,
`p`.`upperBarrier` AS `upperBarrier`,
`p`.`lowerBarrier` AS `lowerBarrier`,
`p`.`strike` AS `strike`
FROM `vn2008`.`pago_sdc` `p`
AS SELECT `ei`.`id` AS `pago_sdc_id`,
`ei`.`amount` AS `importe`,
`ei`.`dated` AS `fecha`,
`ei`.`dueDated` AS `vencimiento`,
`ei`.`entityFk` AS `entity_id`,
`ei`.`ref` AS `ref`,
`ei`.`rate` AS `rate`,
`ei`.`companyFk` AS `empresa_id`,
`ei`.`financialProductTypefk` AS `financialProductTypefk`,
`ei`.`upperBarrier` AS `upperBarrier`,
`ei`.`lowerBarrier` AS `lowerBarrier`,
`ei`.`strike` AS `strike`
FROM `vn`.`exchangeInsurance` `ei`

View File

@ -1,7 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`promissoryNote`
AS SELECT `p`.`Id_Pagare` AS `id`,
`p`.`Concepto` AS `Concept`,
`p`.`pago_id` AS `paymentFk`
FROM `vn2008`.`Pagares` `p`

View File

@ -1,8 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`saleLabel`
AS SELECT `ml`.`Id_movimiento` AS `saleFk`,
`ml`.`label` AS `label`,
`ml`.`stem` AS `stem`,
`ml`.`created` AS `created`
FROM `vn2008`.`movement_label` `ml`

View File

@ -1,47 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`ticketMRW`
AS SELECT `ticket`.`agencyModeFk` AS `id_Agencia`,
`ticket`.`companyFk` AS `empresa_id`,
`Consignatarios`.`consignatario` AS `Consignatario`,
`Consignatarios`.`domicilio` AS `DOMICILIO`,
`Consignatarios`.`poblacion` AS `POBLACION`,
`Consignatarios`.`codPostal` AS `CODPOSTAL`,
`Consignatarios`.`telefono` AS `telefono`,
IFNULL(
IFNULL(
IFNULL(
IFNULL(`Consignatarios`.`movil`, `Clientes`.`movil`),
`Consignatarios`.`telefono`
),
`Clientes`.`telefono`
),
0
) AS `movil`,
`Clientes`.`if` AS `IF`,
`ticket`.`id` AS `Id_Ticket`,
`ticket`.`warehouseFk` AS `warehouse_id`,
`Consignatarios`.`id_consigna` AS `Id_Consigna`,
`Paises`.`Codigo` AS `CodigoPais`,
`ticket`.`shipped` AS `Fecha`,
`province`.`province_id` AS `province_id`,
`ticket`.`landed` AS `landing`
FROM (
(
(
(
`vn2008`.`Clientes`
JOIN `vn2008`.`Consignatarios` ON(
`Clientes`.`id_cliente` = `Consignatarios`.`Id_cliente`
)
)
JOIN `vn`.`ticket` ON(
`Consignatarios`.`id_consigna` = `ticket`.`addressFk`
)
)
JOIN `vn2008`.`province` ON(
`Consignatarios`.`province_id` = `province`.`province_id`
)
)
JOIN `vn2008`.`Paises` ON(`province`.`Paises_Id` = `Paises`.`Id`)
);

View File

@ -1,58 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`ticketToPrepare`
AS SELECT `m`.`Id_Ticket` AS `Id_Ticket`,
`mk`.`Id_Movimiento` AS `Id_Movimiento`,
`mk`.`Id_Movimiento_mark` AS `Id_Movimiento_mark`,
`mk`.`Id_Trabajador` AS `Id_Trabjador`,
`m`.`Id_Article` AS `Id_Article`,
`m`.`Concepte` AS `Concepte`,
`art`.`subName` AS `subName`,
`mk`.`original_quantity` - IFNULL(`is`.`quantity`, 0) AS `Cantidad`,
`mk`.`original_quantity` AS `original_quantity`,
IF(
HOUR(`t`.`shipped`),
HOUR(`t`.`shipped`),
HOUR(`z`.`hour`)
) AS `Hora`,
HOUR(`t`.`shipped`) AS `Departure`,
MINUTE(`t`.`shipped`) AS `Minuto`,
`am`.`agencyFk` AS `agency_id`,
`t`.`warehouseFk` AS `warehouse_id`,
`a`.`provinceFk` AS `province_id`,
`is`.`quantity` AS `picked`,
`t`.`zoneFk` AS `zoneFk`,
`p`.`sectorFk` AS `sectorFk`
FROM (
(
(
(
(
(
(
(
(
(
`vn2008`.`Movimientos_mark` `mk`
JOIN `vn2008`.`Movimientos` `m` ON(`m`.`Id_Movimiento` = `mk`.`Id_Movimiento`)
)
JOIN `vn`.`ticket` `t` ON(`m`.`Id_Ticket` = `t`.`id`)
)
JOIN `vn`.`agencyMode` `am` ON(`am`.`id` = `t`.`agencyModeFk`)
)
JOIN `vn`.`address` `a` ON(`a`.`id` = `t`.`addressFk`)
)
LEFT JOIN `vn`.`itemShelvingSale` `is` ON(`is`.`saleFk` = `mk`.`Id_Movimiento`)
)
LEFT JOIN `vn`.`itemShelving` `ish` ON(`ish`.`id` = `is`.`itemShelvingFk`)
)
LEFT JOIN `vn`.`shelving` `sh` ON(`sh`.`code` = `ish`.`shelvingFk`)
)
LEFT JOIN `vn`.`parking` `p` ON(`p`.`id` = `sh`.`parkingFk`)
)
LEFT JOIN `vn2008`.`Articles` `art` ON(`art`.`Id_Article` = `m`.`Id_Article`)
)
LEFT JOIN `vn`.`zone` `z` ON(`z`.`id` = `t`.`zoneFk`)
)
WHERE `mk`.`stateFk` = 26
AND `mk`.`valor` <> 1

View File

@ -1,47 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`ticketeToPreparePrepared`
AS SELECT `m`.`Id_Ticket` AS `Id_Ticket`,
`mk`.`Id_Movimiento` AS `Id_Movimiento`,
`mk`.`Id_Movimiento_mark` AS `Id_Movimiento_mark`,
`mk`.`Id_Trabajador` AS `Id_Trabjador`,
`m`.`Id_Article` AS `Id_Article`,
`m`.`Concepte` AS `Concepte`,
`art`.`subName` AS `subName`,
`mk`.`original_quantity` - IFNULL(`is`.`quantity`, 0) AS `Cantidad`,
`mk`.`original_quantity` AS `original_quantity`,
HOUR(`t`.`shipped`) AS `Hora`,
HOUR(`t`.`shipped`) AS `Departure`,
MINUTE(`t`.`shipped`) AS `Minuto`,
`am`.`agencyFk` AS `agency_id`,
`t`.`warehouseFk` AS `warehouse_id`,
`a`.`provinceFk` AS `province_id`,
`is`.`quantity` AS `picked`,
`t`.`CodigoTrabajador` AS `trabajador`,
`is`.`sectorFk` AS `sectorFk`
FROM (
(
(
(
(
(
(
(
`vn2008`.`Movimientos_mark` `mk`
JOIN `vn`.`state` `st` ON(`st`.`id` = `mk`.`stateFk`)
)
JOIN `vn2008`.`Movimientos` `m` ON(`m`.`Id_Movimiento` = `mk`.`Id_Movimiento`)
)
JOIN `vn`.`ticket` `t` ON(`m`.`Id_Ticket` = `t`.`id`)
)
JOIN `vn`.`agencyMode` `am` ON(`am`.`id` = `t`.`agencyModeFk`)
)
JOIN `vn`.`address` `a` ON(`a`.`id` = `t`.`addressFk`)
)
LEFT JOIN `vn`.`itemShelvingSaleSum` `is` ON(`is`.`saleFk` = `mk`.`Id_Movimiento`)
)
JOIN `vn2008`.`Articles` `art` ON(`art`.`Id_Article` = `m`.`Id_Article`)
)
LEFT JOIN `vn2008`.`Trabajadores` `t` ON(`t`.`Id_Trabajador` = `mk`.`Id_Trabajador`)
)
WHERE `st`.`code` LIKE 'PREVIOUS_PREPARATION'

View File

@ -42,7 +42,6 @@ AS SELECT `c`.`id` AS `id_cliente`,
`c`.`hasInvoiceSimplified` AS `hasInvoiceSimplified`,
`c`.`salesPersonFk` AS `Id_Trabajador`,
`c`.`isVies` AS `vies`,
`c`.`eypbc` AS `EYPBC`,
`c`.`bankEntityFk` AS `bankEntityFk`,
`c`.`typeFk` AS `typeFk`
FROM `vn`.`client` `c`

View File

@ -0,0 +1,2 @@
ALTER TABLE vn.productionConfig MODIFY COLUMN id INT(10) UNSIGNED FIRST;
ALTER TABLE vn.productionConfig ADD scannableCodeType enum('qr','barcode') DEFAULT 'barcode' NOT NULL;

View File

@ -0,0 +1,2 @@
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES ('InvoiceIn', 'exchangeRateUpdate', '*', 'ALLOW', 'ROLE', 'employee');

View File

@ -0,0 +1,4 @@
ALTER TABLE vn.referenceRate DROP INDEX `PRIMARY`;
ALTER TABLE vn.referenceRate ADD id INT auto_increment PRIMARY KEY;
ALTER TABLE vn.referenceRate CHANGE id id int(11) auto_increment NOT NULL FIRST;
CREATE UNIQUE INDEX referenceRate_currencyFk_IDX USING BTREE ON vn.referenceRate (currencyFk,dated);

View File

@ -0,0 +1,24 @@
-- vn.agencyLog definition
ALTER TABLE vn.agency ADD IF NOT EXISTS editorFk int(10) unsigned DEFAULT NULL NULL;
ALTER TABLE vn.agency ADD CONSTRAINT agency_user_FK FOREIGN KEY (editorFk) REFERENCES `account`.`user`(id);
CREATE TABLE IF NOT EXISTS `vn`.`agencyLog` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`originFk` smallint(5) unsigned DEFAULT NULL,
`userFk` int(10) unsigned DEFAULT NULL,
`action` set('insert','update','delete','select') NOT NULL,
`creationDate` timestamp NULL DEFAULT current_timestamp(),
`description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`changedModel` enum('agency','agencyMode') NOT NULL DEFAULT 'agency',
`oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)),
`newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)),
`changedModelId` int(11) NOT NULL,
`changedModelValue` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `logAgencyUserFk` (`userFk`),
KEY `agencyLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
KEY `agencyLog_originFk` (`originFk`,`creationDate`),
CONSTRAINT `agencyOriginFk` FOREIGN KEY (`originFk`) REFERENCES `agency` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `agencyUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

View File

@ -0,0 +1,18 @@
CREATE TABLE IF NOT EXISTS `vn`.`agencyWorkCenter` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`agencyFk` smallint(5) unsigned NOT NULL,
`workCenterFk` int(11) NOT NULL,
`editorFk` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `agencyWorkCenter_unique` (`agencyFk`,`workCenterFk`),
KEY `agencyWorkCenter_workCenter_FK` (`workCenterFk`),
KEY `agencyWorkCenter_user_FK` (`editorFk`),
CONSTRAINT `agencyWorkCenter_agency_FK` FOREIGN KEY (`agencyFk`) REFERENCES `agency` (`id`) ON DELETE CASCADE,
CONSTRAINT `agencyWorkCenter_user_FK` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `agencyWorkCenter_workCenter_FK` FOREIGN KEY (`workCenterFk`) REFERENCES `workCenter` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #4988';
INSERT INTO vn.agencyWorkCenter (agencyFk, workCenterFk)
SELECT id, workCenterFk
FROM vn.agency
WHERE workCenterFk IS NOT NULL;

View File

@ -0,0 +1,19 @@
-- Place your SQL code here
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('AgencyLog','*','READ','ALLOW','ROLE','employee');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('AgencyWorkCenter','*','READ','ALLOW','ROLE','employee');
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
VALUES('AgencyMode', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
VALUES('Agency', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('Agency','*','WRITE','ALLOW','ROLE','deliveryAssistant');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('AgencyWorkCenter','*','WRITE','ALLOW','ROLE','deliveryAssistant');

View File

@ -0,0 +1,7 @@
-- Place your SQL code here
ALTER TABLE `vn`.`ticketRequest`
CHANGE IF EXISTS `buyerCode` `buyerCode__` varchar(3) NOT NULL COMMENT '@deprecated 2024-04-23 refs #6731 field not used';
ALTER TABLE `vn`.`ticketConfig` ADD COLUMN IF NOT EXISTS `defaultAttenderFk` int unsigned;
ALTER TABLE vn.ticketConfig ADD CONSTRAINT ticketConfig_worker_FK FOREIGN KEY (defaultAttenderFk) REFERENCES vn.worker(id);

View File

@ -1,4 +1,3 @@
CREATE OR REPLACE TABLE `vn`.`farmingDeliveryNote` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`farmingFk` int(10) unsigned NOT NULL,
@ -10,3 +9,8 @@ CREATE OR REPLACE TABLE `vn`.`farmingDeliveryNote` (
CONSTRAINT `farmingDeliveryNoteFk_FK` FOREIGN KEY (`deliveryNoteFk`) REFERENCES `deliveryNote` (`id`),
CONSTRAINT `farmingDeliveryNoteFk_FK_1` FOREIGN KEY (`farmingFk`) REFERENCES `farming` (`id`)
);
INSERT IGNORE INTO `vn`.`farmingDeliveryNote` (farmingFk, deliveryNoteFk, amount)
SELECT farmingFk, id, amount
FROM vn.deliveryNote dn
WHERE farmingFk;

View File

@ -0,0 +1,5 @@
DROP TABLE cache.prod_graphic_source;
RENAME TABLE vn2008.unary TO vn2008.unary__;
ALTER TABLE vn2008.unary__ COMMENT='refs #7258 @deprecated 2023-12-13';
RENAME TABLE vn2008.jerarquia TO vn2008.jerarquia__;
ALTER TABLE vn2008.jerarquia__ COMMENT='refs #7258 @deprecated 2023-12-13';

View File

@ -0,0 +1,5 @@
-- Place your SQL code here
ALTER TABLE vn.productionConfig ADD collectionNewLockname varchar(100)
DEFAULT 'collection_new' NOT NULL COMMENT 'Lockname value for proc vn.collection_new';
ALTER TABLE vn.productionConfig ADD collectionAssignLockname varchar(100)
DEFAULT 'collection_assign' NULL COMMENT 'Lockname value for proc vn.collection_new';

View File

@ -0,0 +1,3 @@
-- Place your SQL code here
ALTER TABLE vn.productionConfig ADD collection_new_lockname varchar(100) DEFAULT 'collection_new' NOT NULL COMMENT 'Lockname value for proc vn.collection_new';
ALTER TABLE vn.productionConfig ADD collection_assign_lockname varchar(100) DEFAULT 'collection_assign' NULL COMMENT 'Lockname value for proc vn.collection_new';

View File

@ -0,0 +1,13 @@
ALTER TABLE vn.productionConfig
DROP COLUMN IF EXISTS collectionNewLockname,
DROP COLUMN IF EXISTS collectionAssignLockname;
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`connection_kill`()
BEGIN
END$$
DELIMITER ;
GRANT EXECUTE ON PROCEDURE util.connection_kill TO 'developer';

View File

@ -0,0 +1 @@
ALTER TABLE vn.entryType ADD isInformal TINYINT DEFAULT 0 NOT NULL;

View File

@ -0,0 +1,3 @@
UPDATE vn.entryType
SET description='Interna', code='internal'
WHERE code='supplies'

View File

@ -0,0 +1,3 @@
UPDATE vn.entryType
SET isInformal = TRUE
WHERE code IN ('inventory', 'life', 'regularization', 'internal')

View File

@ -0,0 +1,2 @@
-- Place your SQL code here
ALTER TABLE vn.productionConfig ADD defaultSectorFk INT UNSIGNED DEFAULT 37 NOT NULL COMMENT 'Default sector';

View File

@ -0,0 +1,4 @@
UPDATE bs.nightTask
SET `procedure` = 'sales_addLauncher'
WHERE `procedure` = 'ventas_add_launcher';

View File

@ -40,7 +40,7 @@ describe('InvoiceOut manual invoice path', () => {
await page.waitToClick(selectors.invoiceOutIndex.createInvoice);
await page.waitForSelector(selectors.invoiceOutIndex.manualInvoiceForm);
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceClient, 'Max Eisenhardt');
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceClient, 'Petter Parker');
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceSerial, 'Global nacional');
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTaxArea, 'national');
await page.waitToClick(selectors.invoiceOutIndex.saveInvoice);

View File

@ -277,7 +277,7 @@
"Collection does not exist": "La colección no existe",
"Cannot obtain exclusive lock": "No se puede obtener un bloqueo exclusivo",
"Insert a date range": "Inserte un rango de fechas",
"Added observation": "{{user}} añadió esta observacion: {{text}}",
"Added observation": "{{user}} añadió esta observacion: {{text}} {{defaulterId}} ({{{defaulterUrl}}})",
"Comment added to client": "Observación añadida al cliente {{clientFk}}",
"Invalid auth code": "Código de verificación incorrecto",
"Invalid or expired verification code": "Código de verificación incorrecto o expirado",
@ -353,5 +353,8 @@
"This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario",
"They're not your subordinate": "No es tu subordinado/a.",
"No results found": "No se han encontrado resultados",
"InvoiceIn is already booked": "La factura recibida está contabilizada"
"InvoiceIn is already booked": "La factura recibida está contabilizada",
"This workCenter is already assigned to this agency": "Este centro de trabajo ya está asignado a esta agencia",
"Select ticket or client": "Elija un ticket o un client",
"It was not able to create the invoice": "No se pudo crear la factura"
}

360
loopback/locale/fr.json Normal file
View File

@ -0,0 +1,360 @@
{
"Phone format is invalid": "O formato do telefone é inválido",
"You are not allowed to change the credit": "Você não tem permissão para alterar o crédito",
"Unable to mark the equivalence surcharge": "Não é possível marcar a sobretaxa de equivalência",
"The default consignee can not be unchecked": "Não é possível desmarcar o destinatário padrão",
"Unable to default a disabled consignee": "Não é possível definir um destinatário desativado como padrão",
"Can't be blank": "Não pode ficar em branco",
"Invalid TIN": "NIF/CIF inválido",
"TIN must be unique": "O NIF/CIF deve ser único",
"A client with that Web User name already exists": "Já existe um cliente com esse nome de usuário da web",
"Is invalid": "É inválido",
"Quantity cannot be zero": "A quantidade não pode ser zero",
"Enter an integer different to zero": "Digite um inteiro diferente de zero",
"Package cannot be blank": "A embalagem não pode ficar em branco",
"The company name must be unique": "O nome da empresa deve ser único",
"Invalid email": "E-mail inválido",
"The IBAN does not have the correct format": "O IBAN não tem o formato correto",
"That payment method requires an IBAN": "Este método de pagamento requer um IBAN",
"That payment method requires a BIC": "Este método de pagamento requer um BIC",
"State cannot be blank": "O estado não pode ficar em branco",
"Worker cannot be blank": "O trabalhador não pode ficar em branco",
"Cannot change the payment method if no salesperson": "Não é possível alterar o método de pagamento se não houver vendedor",
"can't be blank": "Não pode ficar em branco",
"Observation type must be unique": "O tipo de observação deve ser único",
"The credit must be an integer greater than or equal to zero": "O crédito deve ser um inteiro maior ou igual a zero",
"The grade must be similar to the last one": "A nota deve ser semelhante à última",
"Only manager can change the credit": "Apenas o gerente pode alterar o crédito deste cliente",
"Name cannot be blank": "O nome não pode ficar em branco",
"Phone cannot be blank": "O telefone não pode ficar em branco",
"Period cannot be blank": "O período não pode ficar em branco",
"Choose a company": "Escolha uma empresa",
"Se debe rellenar el campo de texto": "O campo de texto deve ser preenchido",
"Description should have maximum of 45 characters": "A descrição deve ter no máximo 45 caracteres",
"Cannot be blank": "Não pode ficar em branco",
"The grade must be an integer greater than or equal to zero": "A nota deve ser um inteiro maior ou igual a zero",
"Sample type cannot be blank": "O tipo de amostra não pode ficar em branco",
"Description cannot be blank": "A descrição não pode ficar em branco",
"The price of the item changed": "O preço do item mudou",
"The value should not be greater than 100%": "O valor não deve ser maior que 100%",
"The value should be a number": "O valor deve ser um número",
"This order is not editable": "Esta ordem não é editável",
"You can't create an order for a frozen client": "Você não pode criar uma ordem para um cliente congelado",
"You can't create an order for a client that has a debt": "Você não pode criar uma ordem para um cliente que tem uma dívida",
"is not a valid date": "não é uma data válida",
"Barcode must be unique": "O código de barras deve ser único",
"The warehouse can't be repeated": "O armazém não pode ser repetido",
"The tag or priority can't be repeated for an item": "A tag ou prioridade não podem ser repetidas para um item",
"The observation type can't be repeated": "O tipo de observação não pode ser repetido",
"A claim with that sale already exists": "Já existe uma reclamação com essa venda",
"You don't have enough privileges to change that field": "Você não tem privilégios suficientes para alterar esse campo",
"Warehouse cannot be blank": "O armazém não pode ficar em branco",
"Agency cannot be blank": "A agência não pode ficar em branco",
"Not enough privileges to edit a client with verified data": "Não há privilégios suficientes para editar um cliente com dados verificados",
"This address doesn't exist": "Este endereço não existe",
"You must delete the claim id %d first": "Você deve excluir primeiro a reclamação %d",
"You don't have enough privileges": "Você não tem privilégios suficientes",
"Cannot check Equalization Tax in this NIF/CIF": "Não é possível verificar o Imposto de Equalização neste NIF/CIF",
"You can't make changes on the basic data of an confirmed order or with rows": "Você não pode fazer alterações nos dados básicos de um pedido confirmado ou com linhas",
"INVALID_USER_NAME": "Le nom d'utilisateur ne doit contenir que des lettres minuscules ou, à partir du deuxième caractère, des chiffres ou des tirets bas, l'utilisation de la lettre ñ n'est pas autorisée",
"You can't create a ticket for a frozen client": "Vous ne pouvez pas créer un ticket pour un client gelé",
"You can't create a ticket for an inactive client": "Vous ne pouvez pas créer un ticket pour un client inactif",
"Tag value cannot be blank": "La valeur du tag ne peut pas être vide",
"ORDER_EMPTY": "Panier vide",
"You don't have enough privileges to do that": "Vous n'avez pas les privilèges nécessaires pour faire cela",
"NO SE PUEDE DESACTIVAR EL CONSIGNAT": "LE CONSIGNATAIRE NE PEUT PAS ÊTRE DÉSACTIVÉ",
"Error. El NIF/CIF está repetido": "Erreur. Le NIF/CIF est répété",
"Street cannot be empty": "L'adresse ne peut pas être vide",
"City cannot be empty": "La ville ne peut pas être vide",
"Code cannot be blank": "Le code ne peut pas être vide",
"You cannot remove this department": "Vous ne pouvez pas supprimer ce département",
"The extension must be unique": "L'extension doit être unique",
"The secret can't be blank": "Le mot de passe ne peut pas être vide",
"We weren't able to send this SMS": "Nous n'avons pas pu envoyer ce SMS",
"This client can't be invoiced": "Ce client ne peut pas être facturé",
"You must provide the correction information to generate a corrective invoice": "Vous devez fournir les informations de correction pour générer une facture corrective",
"This ticket can't be invoiced": "Ce ticket ne peut pas être facturé",
"You cannot add or modify services to an invoiced ticket": "Vous ne pouvez pas ajouter ou modifier des services à un ticket facturé",
"This ticket can not be modified": "Ce ticket ne peut pas être modifié",
"The introduced hour already exists": "Cette heure a déjà été introduite",
"INFINITE_LOOP": "Il existe une dépendance entre deux chefs",
"The sales of the receiver ticket can't be modified": "Les lignes du ticket auquel vous envoyez ne peuvent pas être modifiées",
"NO_AGENCY_AVAILABLE": "Il n'y a pas de zone de livraison disponible avec ces paramètres",
"ERROR_PAST_SHIPMENT": "Vous ne pouvez pas sélectionner une date d'envoi dans le passé",
"The current ticket can't be modified": "Le ticket actuel ne peut pas être modifié",
"The current claim can't be modified": "La réclamation actuelle ne peut pas être modifiée",
"The sales of this ticket can't be modified": "Les lignes de ce ticket ne peuvent pas être modifiées",
"The sales do not exists": "Les lignes sélectionnées n'existent pas",
"Please select at least one sale": "Veuillez sélectionner au moins une ligne",
"All sales must belong to the same ticket": "Toutes les lignes doivent appartenir au même ticket",
"NO_ZONE_FOR_THIS_PARAMETERS": "Il n'y a pas de zone configurée pour ce jour",
"This item doesn't exists": "Cet article n'existe pas",
"NOT_ZONE_WITH_THIS_PARAMETERS": "Il n'y a pas de zone configurée pour ce jour",
"Extension format is invalid": "Le format de l'extension est invalide",
"Invalid parameters to create a new ticket": "Paramètres invalides pour créer un nouveau ticket",
"This item is not available": "Cet article n'est pas disponible",
"This postcode already exists": "Ce code postal existe déjà",
"Concept cannot be blank": "Le concept ne peut pas être vide",
"File doesn't exists": "Le fichier n'existe pas",
"You don't have privileges to change the zone": "Vous n'avez pas les privilèges pour changer la zone ou pour ces paramètres, il y a plus d'une option de livraison, parlez avec les agences",
"This ticket is already on weekly tickets": "Ce ticket est déjà sur les tickets hebdomadaires",
"Ticket id cannot be blank": "L'id du ticket ne peut pas être vide",
"Weekday cannot be blank": "Le jour de la semaine ne peut pas être vide",
"You can't delete a confirmed order": "Vous ne pouvez pas supprimer une commande confirmée",
"The social name has an invalid format": "Le nom fiscal a un format incorrect",
"Invalid quantity": "Quantité invalide",
"This postal code is not valid": "Ce code postal n'est pas valide",
"is invalid": "est invalide",
"The postcode doesn't exist. Please enter a correct one": "Le code postal n'existe pas. Veuillez entrer un code correct",
"The department name can't be repeated": "Le nom du département ne peut pas être répété",
"This phone already exists": "Ce téléphone existe déjà",
"You cannot move a parent to its own sons": "Vous ne pouvez pas déplacer un élément parent à un de ses fils",
"You can't create a claim for a removed ticket": "Vous ne pouvez pas créer une réclamation pour un ticket supprimé",
"You cannot delete a ticket that part of it is being prepared": "Vous ne pouvez pas supprimer un ticket dont une partie est en préparation",
"You must delete all the buy requests first": "Vous devez supprimer toutes les demandes d'achat en premier",
"You should specify a date": "Vous devez spécifier une date",
"You should specify at least a start or end date": "Vous devez spécifier au moins une date de début ou de fin",
"Start date should be lower than end date": "La date de début doit être inférieure à la date de fin",
"You should mark at least one week day": "Vous devez marquer au moins un jour de la semaine",
"Swift / BIC can't be empty": "Swift / BIC ne peut pas être vide",
"Customs agent is required for a non UEE member": "Un agent des douanes est requis pour les clients non membres de l'UEE",
"Incoterms is required for a non UEE member": "Les incoterms sont requis pour les clients non membres de l'UEE",
"Deleted sales from ticket": "J'ai supprimé les lignes suivantes du ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}",
"Added sale to ticket": "J'ai ajouté la ligne suivante au ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}",
"Changed sale discount": "J'ai changé le rabais des lignes suivantes du ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
"Created claim": "J'ai créé la réclamation [{{claimId}}]({{{claimUrl}}}) des lignes suivantes du ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
"Changed sale price": "J'ai changé le prix de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* du ticket [{{ticketId}}]({{{ticketUrl}}})",
"Changed sale quantity": "J'ai changé la quantité de {{itemId}} {{concept}} de {{oldQuantity}} ➔ {{newQuantity}} du ticket [{{ticketId}}]({{{ticketUrl}}})",
"State": "État",
"regular": "normal",
"reserved": "réservé",
"Changed sale reserved state": "J'ai changé l'état réservé des lignes suivantes du ticket[{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
"Bought units from buy request": "{{quantity}} unités ont été achetées de [{{itemId}} {{concept}}]({{{urlItem}}}) pour le ticket id [{{ticketId}}]({{{url}}})",
"Deny buy request": "La demande d'achat pour le ticket id {{ticketId}} a été rejetée. Raison : {{observation}}",
"MESSAGE_INSURANCE_CHANGE": "J'ai changé le crédit assuré du client [{{clientName}} ({{clientId}})]({{{url}}}) a *{{credit}} €*",
"Changed client paymethod": "J'ai changé la méthode de paiement du client [{{clientName}} ({{clientId}})]({{{url}}})",
"Sent units from ticket": "Envoi *{{quantity}}* unités de [{{concept}} ({{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenant du ticket id [{{ticketId}}]({{{ticketUrl}}})",
"Change quantity": "{{concept}} change de {{oldQuantity}} à {{newQuantity}}",
"Claim will be picked": "Le produit de la réclamation [({{claimId}})]({{{claimUrl}}}) du client *{{clientName}}*, avec le type de ramassage *{{claimPickup}}* sera récupéré",
"Claim state has changed to": "L'état de la réclamation [({{claimId}})]({{{claimUrl}}}) du client *{{clientName}}* a été changé à *{{newState}}*",
"Client checked as validated despite of duplication": "Le client a été vérifié malgré l'existence du client id {{clientId}}",
"ORDER_ROW_UNAVAILABLE": "Il n'y a pas de disponibilité pour ce produit",
"Distance must be lesser than 4000": "La distance doit être inférieure à 4000",
"This ticket is deleted": "Ce ticket est supprimé",
"Unable to clone this travel": "Il n'a pas été possible de cloner ce voyage",
"This thermograph id already exists": "L'id du thermographe existe déjà",
"Choose a date range or days forward": "Sélectionnez une plage de dates ou des jours à venir",
"ORDER_ALREADY_CONFIRMED": "COMMANDE DÉJÀ CONFIRMÉE",
"Invalid password": "Mot de passe invalide",
"Password does not meet requirements": "Le mot de passe ne répond pas aux exigences",
"Role already assigned": "Rôle déjà attribué",
"Invalid role name": "Nom de rôle invalide",
"Role name must be written in camelCase": "Le nom du rôle doit être écrit en camelCase",
"Email already exists": "L'email existe déjà",
"User already exists": "L'utilisateur existe déjà",
"Absence change notification on the labour calendar": "Notification de changement d'absence sur le calendrier de travail",
"Record of hours week": "Enregistrement des heures semaine {{week}} année {{year}}",
"Created absence": "L'employé <strong>{{author}}</strong> a ajouté une absence de type '{{absenceType}}' à <a href='{{{workerUrl}}}'> <strong>{{employee}}</strong></a> pour le jour {{dated}}.",
"Deleted absence": "L'employé <strong>{{author}}</strong> a supprimé une absence de type '{{absenceType}}' à <a href='{{{workerUrl}}}'> <strong>{{employee}}</strong></a> du jour {{dated}}.",
"I have deleted the ticket id": "J'ai supprimé le ticket id [{{id}}]({{{url}}})",
"I have restored the ticket id": "J'ai restauré le ticket id [{{id}}]({{{url}}})",
"You can only restore a ticket within the first hour after deletion": "Vous pouvez uniquement restaurer un ticket dans la première heure après sa suppression",
"Changed this data from the ticket": "J'ai modifié ces données du ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
"agencyModeFk": "Agence",
"clientFk": "Client",
"zoneFk": "Zone",
"warehouseFk": "Entrepôt",
"shipped": "Date d'envoi",
"landed": "Date de livraison",
"addressFk": "Consignataire",
"companyFk": "Entreprise",
"agency": "Agence",
"delivery": "Livraison",
"The social name cannot be empty": "La raison sociale ne peut pas être vide",
"The nif cannot be empty": "Le NIF ne peut pas être vide",
"You need to fill sage information before you check verified data": "Vous devez remplir les informations de sage avant de vérifier les données",
"ASSIGN_ZONE_FIRST": "Assignez une zone d'abord",
"Amount cannot be zero": "Le montant ne peut pas être zéro",
"Company has to be official": "L'entreprise doit être officielle",
"You can not select this payment method without a registered bankery account": "Vous ne pouvez pas utiliser cette méthode de paiement sans avoir enregistré un compte bancaire",
"Action not allowed on the test environment": "Cette action n'est pas autorisée dans l'environnement de test",
"The selected ticket is not suitable for this route": "Le ticket sélectionné n'est pas adapté à cet itinéraire",
"New ticket request has been created with price": "Une nouvelle demande de ticket '{{description}}' a été créée pour le jour {{shipped}}, avec une quantité de {{quantity}} et un prix de {{price}} €",
"New ticket request has been created": "Une nouvelle demande de ticket '{{description}}' a été créée pour le jour {{shipped}}, avec une quantité de {{quantity}}",
"Swift / BIC cannot be empty": "Swift / BIC ne peut pas être vide",
"This BIC already exist.": "Ce BIC existe déjà.",
"That item doesn't exists": "Cet article n'existe pas",
"There's a new urgent ticket:": "Il y a un nouveau ticket urgent :",
"Invalid account": "Compte invalide",
"Compensation account is empty": "Le compte de compensation est vide",
"This genus already exist": "Ce genre existe déjà",
"This specie already exist": "Cette espèce existe déjà",
"Client assignment has changed": "J'ai changé le commercial ~*\"<{{previousWorkerName}}>\"*~ pour *\"<{{currentWorkerName}}>\"* du client [{{clientName}} ({{clientId}})]({{{url}}})",
"None": "Aucun",
"The contract was not active during the selected date": "Le contrat n'était pas actif pendant la date sélectionnée",
"Cannot add more than one '1/2 day vacation'": "Vous ne pouvez pas ajouter plus d'un 'Vacances 1/2 jour'",
"This document already exists on this ticket": "Ce document existe déjà dans ce ticket",
"Some of the selected tickets are not billable": "Certains des tickets sélectionnés ne sont pas facturables",
"You can't invoice tickets from multiple clients": "Vous ne pouvez pas facturer des tickets de plusieurs clients",
"nickname": "surnom",
"INACTIVE_PROVIDER": "Fournisseur inactif",
"This client is not invoiceable": "Ce client n'est pas facturable",
"serial non editable": "Cette série ne permet pas d'assigner la référence",
"Max shipped required": "La date limite est requise",
"Can't invoice to future": "Vous ne pouvez pas facturer pour l'avenir",
"Can't invoice to past": "Vous ne pouvez pas facturer pour le passé",
"This ticket is already invoiced": "Ce ticket est déjà facturé",
"A ticket with an amount of zero can't be invoiced": "Un ticket avec un montant de zéro ne peut pas être facturé",
"A ticket with a negative base can't be invoiced": "Un ticket avec une base négative ne peut pas être facturé",
"Global invoicing failed": "[Facturation globale] Certains clients n'ont pas pu être facturés",
"Wasn't able to invoice the following clients": "Les clients suivants n'ont pas pu être facturés",
"Can't verify data unless the client has a business type": "Vous ne pouvez pas vérifier les données d'un client qui n'a pas de type d'entreprise",
"You don't have enough privileges to set this credit amount": "Vous n'avez pas suffisamment de privilèges pour établir ce montant de crédit",
"You can't change the credit set to zero from a financialBoss": "Vous ne pouvez pas modifier le crédit établi à zéro par un chef financier",
"Amounts do not match": "Les montants ne correspondent pas",
"The PDF document does not exist": "Le document PDF n'existe pas. Essayez de le régénérer depuis l'option 'Regénérer PDF facture'",
"The type of business must be filled in basic data": "Le type d'entreprise doit être rempli dans les données de base",
"You can't create a claim from a ticket delivered more than seven days ago": "Vous ne pouvez pas créer une réclamation pour un ticket livré il y a plus de sept jours",
"The worker has hours recorded that day": "Le travailleur a des heures enregistrées ce jour-là",
"The worker has a marked absence that day": "Le travailleur a une absence marquée ce jour-là",
"You can not modify is pay method checked": "Vous ne pouvez pas modifier le champ méthode de paiement validé",
"The account size must be exactly 10 characters": "La taille du compte doit être exactement de 10 caractères",
"Can't transfer claimed sales": "Vous ne pouvez pas transférer des lignes réclamées",
"You don't have privileges to create refund": "Vous n'avez pas les privilèges pour créer un abonnement",
"The item is required": "L'article est requis",
"The agency is already assigned to another autonomous": "L'agence est déjà assignée à un autre autonome",
"date in the future": "Date dans le futur",
"reference duplicated": "Référence dupliquée",
"This ticket is already a refund": "Ce ticket est déjà un abonnement",
"isWithoutNegatives": "Sans négatifs",
"routeFk": "routeFk",
"Can't change the password of another worker": "Vous ne pouvez pas changer le mot de passe d'un autre travailleur",
"No hay un contrato en vigor": "Il n'y a pas de contrat en vigueur",
"No se permite fichar a futuro": "Il n'est pas permis de pointer pour l'avenir",
"No está permitido trabajar": "Il n'est pas permis de travailler",
"Fichadas impares": "Pointages impairs",
"Descanso diario 12h.": "Repos quotidien de 12h.",
"Descanso semanal 36h. / 72h.": "Repos hebdomadaire de 36h / 72h.",
"Dirección incorrecta": "Adresse incorrecte",
"Modifiable user details only by an administrator": "Détails de l'utilisateur modifiables uniquement par un administrateur",
"Modifiable password only via recovery or by an administrator": "Mot de passe modifiable uniquement via la récupération ou par un administrateur",
"Not enough privileges to edit a client": "Vous n'avez pas suffisamment de privilèges pour éditer un client",
"This route does not exists": "Cette route n'existe pas",
"Claim pickup order sent": "Ordre de ramassage de la réclamation envoyé [{{claimId}}]({{{claimUrl}}}) au client *{{clientName}}*",
"You don't have grant privilege": "Vous n'avez pas le privilège de donner des privilèges",
"You don't own the role and you can't assign it to another user": "Vous n'êtes pas le propriétaire du rôle et vous ne pouvez pas l'assigner à un autre utilisateur",
"Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) fusionné avec [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})",
"Already has this status": "A déjà cet état",
"There aren't records for this week": "Il n'y a pas d'enregistrements pour cette semaine",
"Empty data source": "Source de données vide",
"App locked": "Application verrouillée par l'utilisateur {{userId}}",
"Email verify": "Vérification de courriel",
"Landing cannot be lesser than shipment": "L'arrivée ne peut pas être inférieure à l'expédition",
"Receipt's bank was not found": "La banque du reçu n'a pas été trouvée",
"This receipt was not compensated": "Ce reçu n'a pas été compensé",
"Client's email was not found": "L'email du client n'a pas été trouvé",
"Negative basis": "Base négative",
"This worker code already exists": "Ce code de travailleur existe déjà",
"This personal mail already exists": "Ce courriel personnel existe déjà",
"This worker already exists": "Ce travailleur existe déjà",
"App name does not exist": "Le nom de l'application n'est pas valide",
"Try again": "Réessayez",
"Aplicación bloqueada por el usuario 9": "Application bloquée par l'utilisateur 9",
"Failed to upload delivery note": "Échec du téléchargement du bon de livraison {{id}}",
"The DOCUWARE PDF document does not exists": "Le document PDF Docuware n'existe pas",
"It is not possible to modify tracked sales": "Il n'est pas possible de modifier des lignes de commande qui ont commencé à être préparées",
"It is not possible to modify sales that their articles are from Floramondo": "Il n'est pas possible de modifier des lignes de commande dont les articles proviennent de Floramondo",
"It is not possible to modify cloned sales": "Il n'est pas possible de modifier des lignes de commande clonées",
"A supplier with the same name already exists. Change the country.": "Un fournisseur avec le même nom existe déjà. Changez le pays.",
"There is no assigned email for this client": "Il n'y a pas d'email assigné pour ce client",
"Exists an invoice with a future date": "Il existe une facture avec une date future",
"Invoice date can't be less than max date": "La date de la facture ne peut pas être inférieure à la date limite",
"Warehouse inventory not set": "L'inventaire de l'entrepôt n'est pas établi",
"This locker has already been assigned": "Ce casier a déjà été assigné",
"Tickets with associated refunds": "Vous ne pouvez pas supprimer des tickets avec des remboursements associés. Ce ticket est associé au remboursement Nº %d",
"Not exist this branch": "La branche n'existe pas",
"This ticket cannot be signed because it has not been boxed": "Ce ticket ne peut pas être signé car il n'a pas été emballé",
"Collection does not exist": "La collection n'existe pas",
"Cannot obtain exclusive lock": "Impossible d'obtenir un verrou exclusif",
"Insert a date range": "Insérez une plage de dates",
"Added observation": "{{user}} a ajouté cette observation : {{text}}",
"Comment added to client": "Observation ajoutée au client {{clientFk}}",
"Invalid auth code": "Code de vérification incorrect",
"Invalid or expired verification code": "Code de vérification incorrect ou expiré",
"Cannot create a new claimBeginning from a different ticket": "Vous ne pouvez pas créer une ligne de réclamation d'un ticket différent de l'origine",
"company": "Compagnie",
"country": "Pays",
"clientId": "Id client",
"clientSocialName": "Client",
"amount": "Montant",
"taxableBase": "Base",
"ticketFk": "Id ticket",
"isActive": "Actif",
"hasToInvoice": "Facturer",
"isTaxDataChecked": "Données vérifiées",
"comercialId": "Id commercial",
"comercialName": "Commercial",
"Pass expired": "Le mot de passe a expiré, changez-le depuis Salix",
"Invalid NIF for VIES": "NIF invalide pour VIES",
"Ticket does not exist": "Ce ticket n'existe pas",
"Ticket is already signed": "Ce ticket a déjà été signé",
"Authentication failed": "Échec de l'authentification",
"You can't use the same password": "Vous ne pouvez pas utiliser le même mot de passe",
"You can only add negative amounts in refund tickets": "Vous ne pouvez ajouter que des montants négatifs dans les tickets de remboursement",
"Fecha fuera de rango": "Date hors plage",
"Error while generating PDF": "Erreur lors de la génération du PDF",
"Error when sending mail to client": "Erreur lors de l'envoi du courrier au client",
"Mail not sent": "Une erreur est survenue lors de l'envoi de la facture au client [{{clientId}}]({{{clientUrl}}}), veuillez vérifier l'adresse électronique",
"The renew period has not been exceeded": "La période de renouvellement n'a pas été dépassée",
"Valid priorities": "Priorités valides : %d",
"hasAnyNegativeBase": "Base négative pour les tickets : {{ticketsIds}}",
"hasAnyPositiveBase": "Base positives pour les tickets : {{ticketsIds}}",
"You cannot assign an alias that you are not assigned to": "Vous ne pouvez pas attribuer un alias que vous n'avez pas reçu",
"This ticket cannot be left empty.": "Ce ticket ne peut pas être laissé vide. %s",
"The company has not informed the supplier account for bank transfers": "L'entreprise n'a pas informé le compte du fournisseur pour les transferts bancaires",
"You cannot assign/remove an alias that you are not assigned to": "Vous ne pouvez pas attribuer/supprimer un alias que vous n'avez pas reçu",
"This invoice has a linked vehicle.": "Cette facture a un véhicule lié",
"You don't have enough privileges.": "Vous n'avez pas suffisamment de privilèges.",
"This ticket is locked": "Ce ticket est bloqué.",
"This ticket is not editable.": "Ce ticket n'est pas modifiable.",
"The ticket doesn't exist.": "Le ticket n'existe pas.",
"Social name should be uppercase": "La raison sociale doit être en majuscules",
"Street should be uppercase": "L'adresse fiscale doit être en majuscules",
"Ticket without Route": "Ticket sans itinéraire",
"Select a different client": "Sélectionnez un client différent",
"Fill all the fields": "Remplissez tous les champs",
"The response is not a PDF": "La réponse n'est pas un PDF",
"Booking completed": "Réservation terminée",
"The ticket is in preparation": "Le ticket [{{ticketId}}]({{{ticketUrl}}}) du commercial {{salesPersonId}} est en préparation",
"The notification subscription of this worker cant be modified": "L'abonnement à la notification de ce travailleur ne peut pas être modifié",
"User disabled": "Utilisateur désactivé",
"The amount cannot be less than the minimum": "La quantité ne peut pas être inférieure à la quantité minimale",
"quantityLessThanMin": "La quantité ne peut pas être inférieure à la quantité minimale",
"Cannot past travels with entries": "Vous ne pouvez pas passer des envois avec des entrées",
"It was not able to remove the next expeditions:": "Il n'a pas été possible de supprimer les expéditions suivantes : {{expeditions}}",
"This claim has been updated": "La réclamation avec l'Id : {{claimId}}, a été mise à jour",
"This user does not have an assigned tablet": "Cet utilisateur n'a pas de tablette assignée",
"Field are invalid": "Le champ '{{tag}}' n'est pas valide",
"Incorrect pin": "Pin incorrect.",
"You already have the mailAlias": "Vous avez déjà cet alias de courrier",
"The alias cant be modified": "Cet alias de courrier ne peut pas être modifié",
"No tickets to invoice": "Pas de tickets à facturer",
"this warehouse has not dms": "L'entrepôt n'accepte pas les documents",
"This ticket already has a cmr saved": "Ce ticket a déjà un cmr enregistré",
"Name should be uppercase": "Le nom doit être en majuscules",
"Bank entity must be specified": "L'entité bancaire doit être spécifiée",
"An email is necessary": "Un email est nécessaire",
"You cannot update these fields": "Vous ne pouvez pas mettre à jour ces champs",
"CountryFK cannot be empty": "Le pays ne peut pas être vide",
"Cmr file does not exist": "Le fichier cmr n'existe pas",
"You are not allowed to modify the alias": "Vous n'êtes pas autorisé à modifier l'alias",
"The address of the customer must have information about Incoterms and Customs Agent": "L'adresse du client doit contenir des informations sur les Incoterms et l'agent des douanes",
"The line could not be marked": "La ligne ne peut pas être marquée",
"This password can only be changed by the user themselves": "Ce mot de passe ne peut être modifié que par l'utilisateur lui-même",
"They're not your subordinate": "Ce n'est pas votre subordonné.",
"No results found": "Aucun résultat trouvé",
"InvoiceIn is already booked": "La facture reçue est déjà comptabilisée",
"This workCenter is already assigned to this agency": "Ce centre de travail est déjà assigné à cette agence",
"Select ticket or client": "Choisissez un ticket ou un client",
"It was not able to create the invoice": "Il n'a pas été possible de créer la facture"
}

360
loopback/locale/pt.json Normal file
View File

@ -0,0 +1,360 @@
{
"Phone format is invalid": "O formato do telefone não é válido",
"You are not allowed to change the credit": "Você não tem permissão para alterar o crédito",
"Unable to mark the equivalence surcharge": "Não é possível marcar a sobretaxa de equivalência",
"The default consignee can not be unchecked": "Não é possível desmarcar o destinatário padrão",
"Unable to default a disabled consignee": "Não é possível definir como padrão um destinatário desativado",
"Can't be blank": "Não pode estar em branco",
"Invalid TIN": "NIF/CIF inválido",
"TIN must be unique": "O NIF/CIF deve ser único",
"A client with that Web User name already exists": "Já existe um cliente com esse nome de usuário da web",
"Is invalid": "É inválido",
"Quantity cannot be zero": "A quantidade não pode ser zero",
"Enter an integer different to zero": "Digite um inteiro diferente de zero",
"Package cannot be blank": "A embalagem não pode estar em branco",
"The company name must be unique": "O nome da empresa deve ser único",
"Invalid email": "Email inválido",
"The IBAN does not have the correct format": "O IBAN não tem o formato correto",
"That payment method requires an IBAN": "Esse método de pagamento requer um IBAN",
"That payment method requires a BIC": "Esse método de pagamento requer um BIC",
"State cannot be blank": "O estado não pode estar em branco",
"Worker cannot be blank": "O trabalhador não pode estar em branco",
"Cannot change the payment method if no salesperson": "Não é possível alterar o método de pagamento se não houver vendedor",
"can't be blank": "não pode estar em branco",
"Observation type must be unique": "O tipo de observação deve ser único",
"The credit must be an integer greater than or equal to zero": "O crédito deve ser um número inteiro maior ou igual a zero",
"The grade must be similar to the last one": "A nota deve ser semelhante à última",
"Only manager can change the credit": "Apenas o gerente pode alterar o crédito deste cliente",
"Name cannot be blank": "O nome não pode estar em branco",
"Phone cannot be blank": "O telefone não pode estar em branco",
"Period cannot be blank": "O período não pode estar em branco",
"Choose a company": "Escolha uma empresa",
"Se debe rellenar el campo de texto": "Você deve preencher o campo de texto",
"Description should have maximum of 45 characters": "A descrição deve ter no máximo 45 caracteres",
"Cannot be blank": "Não pode estar em branco",
"The grade must be an integer greater than or equal to zero": "A nota deve ser um número inteiro maior ou igual a zero",
"Sample type cannot be blank": "O tipo de amostra não pode estar em branco",
"Description cannot be blank": "A descrição não pode estar em branco",
"The price of the item changed": "O preço do item mudou",
"The value should not be greater than 100%": "O valor não deve ser maior que 100%",
"The value should be a number": "O valor deve ser um número",
"This order is not editable": "Esta ordem não é editável",
"You can't create an order for a frozen client": "Você não pode criar um pedido para um cliente congelado",
"You can't create an order for a client that has a debt": "Você não pode criar um pedido para um cliente com dívida",
"is not a valid date": "não é uma data válida",
"Barcode must be unique": "O código de barras deve ser único",
"The warehouse can't be repeated": "O armazém não pode ser repetido",
"The tag or priority can't be repeated for an item": "A tag ou prioridade não pode ser repetida para um item",
"The observation type can't be repeated": "O tipo de observação não pode ser repetido",
"A claim with that sale already exists": "Já existe uma reclamação com essa venda",
"You don't have enough privileges to change that field": "Você não tem privilégios suficientes para alterar esse campo",
"Warehouse cannot be blank": "O armazém não pode estar em branco",
"Agency cannot be blank": "A agência não pode estar em branco",
"Not enough privileges to edit a client with verified data": "Não há privilégios suficientes para editar um cliente com dados verificados",
"This address doesn't exist": "Este endereço não existe",
"You must delete the claim id %d first": "Você deve excluir a reclamação %d primeiro",
"You don't have enough privileges": "Você não tem privilégios suficientes",
"Cannot check Equalization Tax in this NIF/CIF": "Não é possível verificar o Imposto de Equalização neste NIF/CIF",
"You can't make changes on the basic data of an confirmed order or with rows": "Você não pode fazer alterações nos dados básicos de um pedido confirmado ou com linhas",
"INVALID_USER_NAME": "O nome de usuário só pode conter letras minúsculas ou, a partir do segundo caractere, números ou sublinhados, o uso da letra ñ não é permitido",
"You can't create a ticket for a frozen client": "Você não pode criar um ticket para um cliente congelado",
"You can't create a ticket for an inactive client": "Você não pode criar um ticket para um cliente inativo",
"Tag value cannot be blank": "O valor da tag não pode estar em branco",
"ORDER_EMPTY": "Cesta vazia",
"You don't have enough privileges to do that": "Você não tem privilégios suficientes para fazer isso",
"NO SE PUEDE DESACTIVAR EL CONSIGNAT": "NÃO É POSSÍVEL DESATIVAR O CONSIGNATÁRIO",
"Error. El NIF/CIF está repetido": "Erro. O NIF/CIF está repetido",
"Street cannot be empty": "A rua não pode estar vazia",
"City cannot be empty": "A cidade não pode estar vazia",
"Code cannot be blank": "O código não pode estar em branco",
"You cannot remove this department": "Você não pode remover este departamento",
"The extension must be unique": "A extensão deve ser única",
"The secret can't be blank": "O segredo não pode estar em branco",
"We weren't able to send this SMS": "Não conseguimos enviar este SMS",
"This client can't be invoiced": "Este cliente não pode ser faturado",
"You must provide the correction information to generate a corrective invoice": "Você deve fornecer as informações de correção para gerar uma fatura corretiva",
"This ticket can't be invoiced": "Este ticket não pode ser faturado",
"You cannot add or modify services to an invoiced ticket": "Você não pode adicionar ou modificar serviços a um ticket faturado",
"This ticket can not be modified": "Este ticket não pode ser modificado",
"The introduced hour already exists": "A hora introduzida já existe",
"INFINITE_LOOP": "Loop infinito",
"The sales of the receiver ticket can't be modified": "As vendas do ticket receptor não podem ser modificadas",
"NO_AGENCY_AVAILABLE": "Nenhuma agência disponível",
"ERROR_PAST_SHIPMENT": "Erro. Data de envio no passado",
"The current ticket can't be modified": "O ticket atual não pode ser modificado",
"The current claim can't be modified": "A reclamação atual não pode ser modificada",
"The sales of this ticket can't be modified": "As vendas deste ticket não podem ser modificadas",
"The sales do not exists": "As vendas não existem",
"Please select at least one sale": "Por favor, selecione pelo menos uma venda",
"All sales must belong to the same ticket": "Todas as vendas devem pertencer ao mesmo ticket",
"NO_ZONE_FOR_THIS_PARAMETERS": "Nenhuma zona para estes parâmetros",
"This item doesn't exists": "Este item não existe",
"NOT_ZONE_WITH_THIS_PARAMETERS": "Nenhuma zona para estes parâmetros",
"Extension format is invalid": "O formato da extensão é inválido",
"Invalid parameters to create a new ticket": "Parâmetros inválidos para criar um novo ticket",
"This item is not available": "Este item não está disponível",
"This postcode already exists": "Este código postal já existe",
"Concept cannot be blank": "O conceito não pode estar em branco",
"File doesn't exists": "O arquivo não existe",
"You don't have privileges to change the zone": "Você não tem privilégios para alterar a zona",
"This ticket is already on weekly tickets": "Este ticket já está em tickets semanais",
"Ticket id cannot be blank": "O id do ticket não pode ficar em branco",
"Weekday cannot be blank": "O dia da semana não pode ficar em branco",
"You can't delete a confirmed order": "Você não pode excluir um pedido confirmado",
"The social name has an invalid format": "O nome social tem um formato inválido",
"Invalid quantity": "Quantidade inválida",
"This postal code is not valid": "Este código postal não é válido",
"is invalid": "é inválido",
"The postcode doesn't exist. Please enter a correct one": "O código postal não existe. Por favor, insira um correto",
"The department name can't be repeated": "O nome do departamento não pode ser repetido",
"This phone already exists": "Este telefone já existe",
"You cannot move a parent to its own sons": "Você não pode mover um pai para seus próprios filhos",
"You can't create a claim for a removed ticket": "Você não pode criar uma reclamação para um ticket removido",
"You cannot delete a ticket that part of it is being prepared": "Você não pode excluir um ticket que parte dele está sendo preparada",
"You must delete all the buy requests first": "Você deve excluir todas as solicitações de compra primeiro",
"You should specify a date": "Você deve especificar uma data",
"You should specify at least a start or end date": "Você deve especificar pelo menos uma data de início ou fim",
"Start date should be lower than end date": "A data de início deve ser anterior à data de término",
"You should mark at least one week day": "Você deve marcar pelo menos um dia da semana",
"Swift / BIC can't be empty": "Swift / BIC não pode ficar vazio",
"Customs agent is required for a non UEE member": "O agente alfandegário é necessário para um cliente não UEE",
"Incoterms is required for a non UEE member": "Incoterms são necessários para um cliente não UEE",
"Deleted sales from ticket": "Vendas excluídas do ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}",
"Added sale to ticket": "Venda adicionada ao ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}",
"Changed sale discount": "Desconto da venda alterado no ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
"Created claim": "Reclamação criada [{{claimId}}]({{{claimUrl}}}) no ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
"Changed sale price": "Preço da venda alterado para [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* no ticket [{{ticketId}}]({{{ticketUrl}}})",
"Changed sale quantity": "Quantidade da venda alterada para [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}* no ticket [{{ticketId}}]({{{ticketUrl}}})",
"State": "Estado",
"regular": "normal",
"reserved": "reservado",
"Changed sale reserved state": "Estado de reserva da venda alterado no ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
"Bought units from buy request": "Unidades compradas da solicitação de compra [{{itemId}} {{concept}}]({{{urlItem}}}) para o ticket id [{{ticketId}}]({{{url}}})",
"Deny buy request": "Solicitação de compra negada para o ticket id [{{ticketId}}]({{{url}}}). Motivo: {{observation}}",
"MESSAGE_INSURANCE_CHANGE": "Crédito segurado do cliente [{{clientName}} ({{clientId}})]({{{url}}}) alterado para *{{credit}} €*",
"Changed client paymethod": "Forma de pagamento do cliente [{{clientName}} ({{clientId}}) alterada",
"Sent units from ticket": "*{{quantity}}* Unidades enviadas de [{{concept}} ({{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [{{ticketId}}]({{{ticketUrl}}})",
"Change quantity": "{{concept}} mudou de {{oldQuantity}} para {{newQuantity}}",
"Claim will be picked": "Reclamação será recolhida [({{claimId}})]({{{claimUrl}}}) do cliente *{{clientName}}*, com tipo de coleta *{{claimPickup}}*",
"Claim state has changed to": "Estado da reclamação alterado para {{newState}} ({{claimId}}) do cliente {{clientName}}",
"Client checked as validated despite of duplication": "Cliente verificado apesar da duplicação do id {{clientId}}",
"ORDER_ROW_UNAVAILABLE": "Esta linha de pedido não está disponível",
"Distance must be lesser than 4000": "A distância deve ser menor que 4000",
"This ticket is deleted": "Este ticket foi excluído",
"Unable to clone this travel": "Não foi possível clonar esta viagem",
"This thermograph id already exists": "Esta id de termógrafo já existe",
"Choose a date range or days forward": "Escolha um intervalo de datas ou dias adiante",
"ORDER_ALREADY_CONFIRMED": "PEDIDO JÁ CONFIRMADO",
"Invalid password": "Senha inválida",
"Password does not meet requirements": "Senha não atende aos requisitos",
"Role already assigned": "Função já atribuída",
"Invalid role name": "Nome da função inválido",
"Role name must be written in camelCase": "O nome da função deve ser escrito em camelCase",
"Email already exists": "O e-mail já existe",
"User already exists": "O usuário já existe",
"Absence change notification on the labour calendar": "Notificação de mudança de ausência no calendário trabalhista",
"Record of hours week": "Registro de horas semana {{week}} ano {{year}} ",
"Created absence": "O funcionário <strong>{{author}}</strong> adicionou uma ausência do tipo '{{absenceType}}' para <a href='{{{workerUrl}}}'><strong>{{employee}}</strong></a> no dia {{dated}}.",
"Deleted absence": "O funcionário <strong>{{author}}</strong> excluiu uma ausência do tipo '{{absenceType}}' de <a href='{{{workerUrl}}}'><strong>{{employee}}</strong></a> no dia {{dated}}.",
"I have deleted the ticket id": "Eu excluí o id do ticket [{{id}}]({{{url}}})",
"I have restored the ticket id": "Eu restaurei o id do ticket [{{id}}]({{{url}}})",
"You can only restore a ticket within the first hour after deletion": "Você só pode restaurar um ticket dentro da primeira hora após a exclusão",
"Changed this data from the ticket": "Estes dados do ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
"agencyModeFk": "Agência",
"clientFk": "Cliente",
"zoneFk": "Zona",
"warehouseFk": "Armazém",
"shipped": "Enviado",
"landed": "Entregue",
"addressFk": "Destinatário",
"companyFk": "Empresa",
"agency": "Agência",
"delivery": "Entrega",
"The social name cannot be empty": "O nome social não pode estar vazio",
"The nif cannot be empty": "O NIF não pode estar vazio",
"You need to fill sage information before you check verified data": "Você precisa preencher as informações do sage antes de verificar os dados verificados",
"ASSIGN_ZONE_FIRST": "Atribua uma zona primeiro",
"Amount cannot be zero": "O valor não pode ser zero",
"Company has to be official": "A empresa deve ser oficial",
"You can not select this payment method without a registered bankery account": "Você não pode selecionar este método de pagamento sem uma conta bancária registrada",
"Action not allowed on the test environment": "Ação não permitida no ambiente de teste",
"The selected ticket is not suitable for this route": "O ticket selecionado não é adequado para esta rota",
"New ticket request has been created with price": "Nova solicitação de ticket criada para o dia {{shipped}}, com uma quantidade de {{quantity}} e um preço de {{price}} €",
"New ticket request has been created": "Nova solicitação de ticket criada para o dia {{shipped}}, com uma quantidade de {{quantity}}",
"Swift / BIC cannot be empty": "Swift / BIC não pode ficar vazio",
"This BIC already exist.": "Este BIC já existe.",
"That item doesn't exists": "Esse item não existe",
"There's a new urgent ticket:": "Há um novo ticket urgente:",
"Invalid account": "Conta inválida",
"Compensation account is empty": "A conta de compensação está vazia",
"This genus already exist": "Este gênero já existe",
"This specie already exist": "Esta espécie já existe",
"Client assignment has changed": "A atribuição do cliente foi alterada de ~*\"<{{previousWorkerName}}>\"*~ por *\"<{{currentWorkerName}}>\"* del cliente [{{clientName}} ({{clientId}})]({{{url}}})",
"None": "Nenhum",
"The contract was not active during the selected date": "O contrato não estava ativo durante a data selecionada",
"Cannot add more than one '1/2 day vacation'": "Não é possível adicionar mais de um 'meio dia de férias'",
"This document already exists on this ticket": "Este documento já existe neste ticket",
"Some of the selected tickets are not billable": "Alguns dos tickets selecionados não são faturáveis",
"You can't invoice tickets from multiple clients": "Você não pode faturar tickets de múltiplos clientes",
"nickname": "apelido",
"INACTIVE_PROVIDER": "Fornecedor inativo",
"This client is not invoiceable": "Este cliente não é faturável",
"serial non editable": "Este série não é editável",
"Max shipped required": "A data limite é requerida",
"Can't invoice to future": "Não é possível faturar para o futuro",
"Can't invoice to past": "Não é possível faturar para o passado",
"This ticket is already invoiced": "Este ticket já está faturado",
"A ticket with an amount of zero can't be invoiced": "Um ticket com um valor zero não pode ser faturado",
"A ticket with a negative base can't be invoiced": "Um ticket com uma base negativa não pode ser faturado",
"Global invoicing failed": "[Faturamento global] Não foi possível faturar alguns clientes",
"Wasn't able to invoice the following clients": "Não foi possível faturar os seguintes clientes",
"Can't verify data unless the client has a business type": "Não é possível verificar os dados a menos que o cliente tenha um tipo de negócio",
"You don't have enough privileges to set this credit amount": "Você não tem privilégios suficientes para definir este valor de crédito",
"You can't change the credit set to zero from a financialBoss": "Você não pode alterar o crédito definido como zero de um financeiro chefe",
"Amounts do not match": "Os valores não correspondem",
"The PDF document does not exist": "O documento PDF não existe. Tente regenerá-lo na opção 'Regenerar PDF da fatura'",
"The type of business must be filled in basic data": "O tipo de negócio deve ser preenchido nos dados básicos",
"You can't create a claim from a ticket delivered more than seven days ago": "Você não pode criar uma reclamação de um ticket entregue há mais de sete dias",
"The worker has hours recorded that day": "O trabalhador tem horas registradas nesse dia",
"The worker has a marked absence that day": "O trabalhador tem uma ausência marcada nesse dia",
"You can not modify is pay method checked": "Você não pode modificar o método de pagamento verificado",
"The account size must be exactly 10 characters": "O tamanho da conta deve ser exatamente de 10 caracteres",
"Can't transfer claimed sales": "Não é possível transferir vendas reclamadas",
"You don't have privileges to create refund": "Você não tem privilégios para criar um reembolso",
"The item is required": "O item é necessário",
"The agency is already assigned to another autonomous": "A agência já está atribuída a outro autônomo",
"date in the future": "Data no futuro",
"reference duplicated": "Referência duplicada",
"This ticket is already a refund": "Este ticket já é um reembolso",
"isWithoutNegatives": "Sem negativos",
"routeFk": "routeFk",
"Can't change the password of another worker": "Não é possível alterar a senha de outro trabalhador",
"No hay un contrato en vigor": "Não há um contrato em vigor",
"No se permite fichar a futuro": "Não é permitido marcar o ponto no futuro",
"No está permitido trabajar": "Não está permitido trabalhar",
"Fichadas impares": "Fichadas ímpares",
"Descanso diario 12h.": "Descanso diário 12h.",
"Descanso semanal 36h. / 72h.": "Descanso semanal 36h. / 72h.",
"Dirección incorrecta": "Endereço incorreto",
"Modifiable user details only by an administrator": "Detalhes do usuário modificáveis apenas por um administrador",
"Modifiable password only via recovery or by an administrator": "Senha modificável apenas via recuperação ou por um administrador",
"Not enough privileges to edit a client": "Não há privilégios suficientes para editar um cliente",
"This route does not exists": "Esta rota não existe",
"Claim pickup order sent": "Ordem de retirada de reclamação enviada [{{claimId}}]({{{claimUrl}}}) o cliente *{{clientName}}*",
"You don't have grant privilege": "Você não tem privilégio de concessão",
"You don't own the role and you can't assign it to another user": "Você não é proprietário do papel e não pode atribuí-lo a outro usuário",
"Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) mesclado com [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})",
"Already has this status": "Já tem este status",
"There aren't records for this week": "Não há registros para esta semana",
"Empty data source": "Fonte de dados vazia",
"App locked": "Aplicativo bloqueado pelo usuário {{userId}}",
"Email verify": "Verificação de e-mail",
"Landing cannot be lesser than shipment": "O pouso não pode ser menor que o envio",
"Receipt's bank was not found": "Banco do recibo não encontrado",
"This receipt was not compensated": "Este recibo não foi compensado",
"Client's email was not found": "E-mail do cliente não encontrado",
"Negative basis": "Base negativa",
"This worker code already exists": "Este código de trabalhador já existe",
"This personal mail already exists": "Este e-mail pessoal já existe",
"This worker already exists": "Este trabalhador já existe",
"App name does not exist": "O nome do aplicativo não existe",
"Try again": "Tente novamente",
"Aplicación bloqueada por el usuario 9": "Aplicação bloqueada pelo usuário 9",
"Failed to upload delivery note": "Falha ao carregar nota de entrega {{id}}",
"The DOCUWARE PDF document does not exists": "O documento PDF DOCUWARE não existe",
"It is not possible to modify tracked sales": "Não é possível modificar vendas rastreadas",
"It is not possible to modify sales that their articles are from Floramondo": "Não é possível modificar vendas cujos artigos são da Floramondo",
"It is not possible to modify cloned sales": "Não é possível modificar vendas clonadas",
"A supplier with the same name already exists. Change the country.": "Já existe um fornecedor com o mesmo nome. Mude o país.",
"There is no assigned email for this client": "Não há e-mail atribuído para este cliente",
"Exists an invoice with a future date": "Existe uma fatura com data futura",
"Invoice date can't be less than max date": "A data da fatura não pode ser menor que a data máxima",
"Warehouse inventory not set": "Inventário do armazém não configurado",
"This locker has already been assigned": "Este armário já foi atribuído",
"Tickets with associated refunds": "Tickets com reembolsos associados",
"Not exist this branch": "Esta filial não existe",
"This ticket cannot be signed because it has not been boxed": "Este ticket não pode ser assinado porque não foi encaixotado",
"Collection does not exist": "Coleção não existe",
"Cannot obtain exclusive lock": "Não é possível obter um bloqueio exclusivo",
"Insert a date range": "Insira um intervalo de datas",
"Added observation": "{{user}} adicionou esta observação: {{text}}",
"Comment added to client": "Comentário adicionado ao cliente {{clientFk}}",
"Invalid auth code": "Código de autenticação inválido",
"Invalid or expired verification code": "Código de verificação inválido ou expirado",
"Cannot create a new claimBeginning from a different ticket": "Não é possível criar um novo reclamação a partir de um ticket diferente",
"company": "Empresa",
"country": "País",
"clientId": "Id do cliente",
"clientSocialName": "Cliente",
"amount": "Quantidade",
"taxableBase": "Base tributável",
"ticketFk": "Id do ticket",
"isActive": "Está ativo",
"hasToInvoice": "Tem que faturar",
"isTaxDataChecked": "Dados fiscais verificados",
"comercialId": "Id do comercial",
"comercialName": "Comercial",
"Pass expired": "A senha expirou, altere-a pelo Salix",
"Invalid NIF for VIES": "NIF inválido para VIES",
"Ticket does not exist": "Este ticket não existe",
"Ticket is already signed": "Este ticket já está assinado",
"Authentication failed": "Autenticação falhou",
"You can't use the same password": "Você não pode usar a mesma senha",
"You can only add negative amounts in refund tickets": "Você só pode adicionar quantidades negativas em tickets de reembolso",
"Fecha fuera de rango": "Data fora do intervalo",
"Error while generating PDF": "Erro ao gerar PDF",
"Error when sending mail to client": "Erro ao enviar e-mail para o cliente",
"Mail not sent": "E-mail não enviado cliente [{{clientId}}]({{{clientUrl}}})",
"The renew period has not been exceeded": "O período de renovação não foi excedido",
"Valid priorities": "Prioridades válidas",
"hasAnyNegativeBase": "Base negativa para os tickets",
"hasAnyPositiveBase": "Bases positivas para os tickets",
"You cannot assign an alias that you are not assigned to": "Você não pode atribuir um alias que não está atribuído a você",
"This ticket cannot be left empty.": "Este ticket não pode ficar vazio.",
"The company has not informed the supplier account for bank transfers": "A empresa não informou a conta do fornecedor para transferências bancárias",
"You cannot assign/remove an alias that you are not assigned to": "Você não pode atribuir/remover um alias que não está atribuído a você",
"This invoice has a linked vehicle.": "Esta fatura tem um veículo vinculado",
"You don't have enough privileges.": "Você não tem privilégios suficientes.",
"This ticket is locked": "Este ticket está bloqueado.",
"This ticket is not editable.": "Este ticket não é editável.",
"The ticket doesn't exist.": "O ticket não existe.",
"Social name should be uppercase": "O nome social deve estar em maiúsculas",
"Street should be uppercase": "A rua deve estar em maiúsculas",
"Ticket without Route": "Ticket sem rota",
"Select a different client": "Selecione um cliente diferente",
"Fill all the fields": "Preencha todos os campos",
"The response is not a PDF": "A resposta não é um PDF",
"Booking completed": "Reserva concluída",
"The ticket is in preparation": "O ticket está em preparação [{{ticketId}}]({{{ticketUrl}}}) comercial {{salesPersonId}}",
"The notification subscription of this worker cant be modified": "A inscrição de notificação deste trabalhador não pode ser modificada",
"User disabled": "Usuário desativado",
"The amount cannot be less than the minimum": "O valor não pode ser menor que o mínimo",
"quantityLessThanMin": "Quantidade menor que o mínimo",
"Cannot past travels with entries": "Não é possível passar viagens com entradas",
"It was not able to remove the next expeditions:": "Não foi possível remover as próximas expedições:",
"This claim has been updated": "Esta reclamação foi atualizada",
"This user does not have an assigned tablet": "Este usuário não tem um tablet atribuído",
"Field are invalid": "Campos inválidos",
"Incorrect pin": "PIN incorreto.",
"You already have the mailAlias": "Você já tem o alias de e-mail",
"The alias cant be modified": "O alias não pode ser modificado",
"No tickets to invoice": "Não há tickets para faturar",
"this warehouse has not dms": "Este armazém não tem DMS",
"This ticket already has a cmr saved": "Este ticket já tem um CMR salvo",
"Name should be uppercase": "O nome deve estar em maiúsculas",
"Bank entity must be specified": "A entidade bancária deve ser especificada",
"An email is necessary": "Um e-mail é necessário",
"You cannot update these fields": "Você não pode atualizar estes campos",
"CountryFK cannot be empty": "CountryFK não pode estar vazio",
"Cmr file does not exist": "O arquivo CMR não existe",
"You are not allowed to modify the alias": "Você não tem permissão para modificar o alias",
"The address of the customer must have information about Incoterms and Customs Agent": "O endereço do cliente deve ter informações sobre Incoterms e Agente Aduaneiro",
"The line could not be marked": "A linha não pôde ser marcada",
"This password can only be changed by the user themselves": "Esta senha só pode ser alterada pelo próprio usuário",
"They're not your subordinate": "Eles não são seus subordinados.",
"No results found": "Nenhum resultado encontrado",
"InvoiceIn is already booked": "InvoiceIn já está reservado",
"This workCenter is already assigned to this agency": "Este centro de trabalho já está atribuído a esta agência",
"Select ticket or client": "Selecione um ticket ou cliente",
"It was not able to create the invoice": "Não foi possível criar a fatura"
}

View File

@ -27,7 +27,6 @@ columns:
hasCoreVnh: core VNH
hasIncoterms: incoterms
isTaxDataChecked: tax data checked
eypbc: EYPBC
quality: quality
isVies: VIES
isRelevant: relevant

View File

@ -27,7 +27,6 @@ columns:
hasCoreVnh: centro VNH
hasIncoterms: incoterms
isTaxDataChecked: datos fiscales comprobados
eypbc: EYPBC
quality: calidad
isVies: VIES
isRelevant: importante

View File

@ -29,6 +29,7 @@ module.exports = Self => {
const $t = ctx.req.__; // $translate
const myOptions = {};
const userId = ctx.req.accessToken.userId;
const url = await Self.app.models.Url.getUrl();
if (typeof options == 'object')
Object.assign(myOptions, options);
@ -38,7 +39,9 @@ module.exports = Self => {
const body = $t('Added observation', {
user: user.name,
text: observation
text: observation,
defaulterId: defaulter.clientFk,
defaulterUrl: `${url}client/${defaulter.clientFk}/summary`
});
await models.Mail.create({

View File

@ -103,9 +103,6 @@
"isTaxDataChecked":{
"type": "boolean"
},
"eypbc": {
"type": "boolean"
},
"quality": {
"type": "number"
},

View File

@ -78,7 +78,6 @@
</vn-fetched-tags>
</vn-td>
<vn-td number>{{::sale.quantity | dashIfEmpty}}</vn-td>
</vn-tr>
</vn-tbody>
</vn-table>
</vn-card>

View File

@ -0,0 +1,64 @@
const axios = require('axios');
const {DOMParser} = require('xmldom');
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethod('exchangeRateUpdate', {
description: 'Updates the exchange rates from an XML feed',
accessType: 'WRITE',
accepts: [],
http: {
path: '/exchangeRateUpdate',
verb: 'post'
}
});
Self.exchangeRateUpdate = async() => {
const response = await axios.get('http://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist-90d.xml');
const xmlData = response.data;
const doc = new DOMParser({errorHandler: {warning: () => {}}})?.parseFromString(xmlData, 'text/xml');
const cubes = doc?.getElementsByTagName('Cube');
if (!cubes || cubes.length === 0)
throw new UserError('No cubes found. Exiting the method.');
const models = Self.app.models;
const maxDateRecord = await models.ReferenceRate.findOne({order: 'dated DESC'});
const maxDate = maxDateRecord?.dated ? new Date(maxDateRecord.dated) : null;
for (const cube of Array.from(cubes)) {
if (cube.nodeType === doc.ELEMENT_NODE && cube.attributes.getNamedItem('time')) {
const xmlDate = new Date(cube.getAttribute('time'));
const xmlDateWithoutTime = new Date(xmlDate.getFullYear(), xmlDate.getMonth(), xmlDate.getDate());
if (!maxDate || maxDate < xmlDateWithoutTime) {
for (const rateCube of Array.from(cube.childNodes)) {
if (rateCube.nodeType === doc.ELEMENT_NODE) {
const currencyCode = rateCube.getAttribute('currency');
const rate = rateCube.getAttribute('rate');
if (['USD', 'CNY', 'GBP'].includes(currencyCode)) {
const currency = await models.Currency.findOne({where: {code: currencyCode}});
if (!currency) throw new UserError(`Currency not found for code: ${currencyCode}`);
const existingRate = await models.ReferenceRate.findOne({
where: {currencyFk: currency.id, dated: xmlDate}
});
if (existingRate) {
if (existingRate.value !== rate)
await existingRate.updateAttributes({value: rate});
} else {
await models.ReferenceRate.create({
currencyFk: currency.id,
dated: xmlDate,
value: rate
});
}
}
}
}
}
}
}
};
};

View File

@ -0,0 +1,52 @@
describe('exchangeRateUpdate functionality', function() {
const axios = require('axios');
const models = require('vn-loopback/server/server').models;
beforeEach(function() {
spyOn(axios, 'get').and.returnValue(Promise.resolve({
data: `<Cube>
<Cube time='2024-04-12'>
<Cube currency='USD' rate='1.1'/>
<Cube currency='CNY' rate='1.2'/>
</Cube>
</Cube>`
}));
});
it('should process XML data and update or create rates in the database', async function() {
spyOn(models.ReferenceRate, 'findOne').and.returnValue(Promise.resolve(null));
spyOn(models.ReferenceRate, 'create').and.returnValue(Promise.resolve());
await models.InvoiceIn.exchangeRateUpdate();
expect(models.ReferenceRate.create).toHaveBeenCalledTimes(2);
});
it('should not create or update rates when no XML data is available', async function() {
axios.get.and.returnValue(Promise.resolve({}));
spyOn(models.ReferenceRate, 'create');
let thrownError = null;
try {
await models.InvoiceIn.exchangeRateUpdate();
} catch (error) {
thrownError = error;
}
expect(thrownError.message).toBe('No cubes found. Exiting the method.');
});
it('should handle errors gracefully', async function() {
axios.get.and.returnValue(Promise.reject(new Error('Network error')));
let error;
try {
await models.InvoiceIn.exchangeRateUpdate();
} catch (e) {
error = e;
}
expect(error).toBeDefined();
expect(error.message).toBe('Network error');
});
});

View File

@ -10,6 +10,7 @@ module.exports = Self => {
require('../methods/invoice-in/invoiceInEmail')(Self);
require('../methods/invoice-in/getSerial')(Self);
require('../methods/invoice-in/corrective')(Self);
require('../methods/invoice-in/exchangeRateUpdate')(Self);
Self.rewriteDbError(function(err) {
if (err.code === 'ER_ROW_IS_REFERENCED_2' && err.sqlMessage.includes('vehicleInvoiceIn'))

Some files were not shown because too many files have changed in this diff Show More