Merge branch 'master' into test
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Guillermo Bonet 2024-07-05 13:50:43 +02:00
commit 5712fbd782
6 changed files with 72 additions and 12 deletions

View File

@ -3913,3 +3913,18 @@ INSERT INTO dipole.expedition_PrintOut (expeditionFk, ticketFk, addressFk, stree
truckName, clientFk, phone, province, agency, m3, workerCode, itemFk, quantity, longName, shelvingFk, comments) truckName, clientFk, phone, province, agency, m3, workerCode, itemFk, quantity, longName, shelvingFk, comments)
VALUES(1, 1, 0, ' ', ' ', ' ', ' ', 0, '2001-01-01 00:00:00', 1, 0, ' ', ' ', 0, NULL, '', NULL, 0.000, NULL, 10, NULL, NULL, 'NCC', NULL); VALUES(1, 1, 0, ' ', ' ', ' ', ' ', 0, '2001-01-01 00:00:00', 1, 0, ' ', ' ', 0, NULL, '', NULL, 0.000, NULL, 10, NULL, NULL, 'NCC', NULL);
INSERT INTO vn.accountDetail
(id, value, accountDetailTypeFk, supplierAccountFk)
VALUES
(21, 'ES12345B12345678', 3, 241),
(35, 'ES12346B12345679', 3, 241);
INSERT INTO vn.accountDetailType
(id, description)
VALUES
(1, 'IBAN'),
(2, 'SWIFT'),
(3, 'Referencia Remesas'),
(4, 'Referencia Transferencias'),
(5, 'Referencia Nominas'),
(6, 'ABA');

View File

@ -11,11 +11,9 @@ BEGIN
IF NEW.isBooked = OLD.isBooked AND ( IF NEW.isBooked = OLD.isBooked AND (
NOT (NEW.supplierFk <=> OLD.supplierFk) OR NOT (NEW.supplierFk <=> OLD.supplierFk) OR
NOT (NEW.dated <=> OLD.dated) OR NOT (NEW.dated <=> OLD.dated) OR
NOT (NEW.invoiceNumber <=> OLD.invoiceNumber) OR
NOT (NEW.travelFk <=> OLD.travelFk) OR NOT (NEW.travelFk <=> OLD.travelFk) OR
NOT (NEW.companyFk <=> OLD.companyFk) OR NOT (NEW.companyFk <=> OLD.companyFk) OR
NOT (NEW.invoiceInFk <=> OLD.invoiceInFk) OR NOT (NEW.invoiceInFk <=> OLD.invoiceInFk) OR
NOT (NEW.invoiceAmount <=> OLD.invoiceAmount) OR
NOT (NEW.typeFk <=> OLD.typeFk) NOT (NEW.typeFk <=> OLD.typeFk)
) THEN ) THEN

View File

@ -0,0 +1,42 @@
USE `vn`;
CREATE TABLE IF NOT EXISTS vn.`tillSerial` (
`code` varchar(2) COLLATE utf8mb3_unicode_ci NOT NULL,
`description` varchar(30) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`account` varchar(10) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
PRIMARY KEY (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES(' S', 'Saldos final / inicial', NULL);
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('A', 'Factura cliente', NULL);
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('B', 'Factura cliente', NULL);
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('C', 'Facturas Contado', NULL);
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('CC', 'Cuadre caja', '6780000000');
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('CD', 'Cuenta Director Comercial', '5510000002');
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('CH', 'Cheques', NULL);
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('CM', 'Cambio', NULL);
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('CR', 'Ingreso/Reintegro Caja Rural', NULL);
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('CT', 'Correos y telégrafos', '6290000005');
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('DC', 'Dietas conductores', '6290000010');
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('DH', 'Deudas Holland', NULL);
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('DT', 'Dietas', '6290000011');
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('E', 'Entrada mercancia', NULL);
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('EN', 'Enric Martinez', NULL);
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('GC', 'Cuenta con dto. Comercial', '5510000003');
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('GP', 'Gastos de personal', NULL);
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('GR', 'Gastos RRPP dpto comercial', '6290001002');
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('GS', 'Gasoil', '6280000002');
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('GV', 'Gastos viaje', '6290001000');
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('JV', 'Juanvi', '6290000553');
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('MB', 'Movimiento bancario', NULL);
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('MP', 'Materias Primas', '6000000000');
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('OG', 'Otros gastos', '6290000000');
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('PM', 'Pequeño material', '6290000007');
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('R', 'Factura proveedor', NULL);
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('RC', 'Ingreso/Reintegro Ruralcaja', NULL);
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('RN', 'Reparación nave', '6220000004');
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('SS', 'Gastos Silla', NULL);
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('T', 'Ticket', NULL);
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('TA', 'Factura rapida', NULL);
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('TC', 'Ticket contado', NULL);
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('TR', 'Traspaso', NULL);

View File

@ -27,8 +27,7 @@
<tr> <tr>
<td>{{$t('supplier.identifier')}}</td> <td>{{$t('supplier.identifier')}}</td>
<th> <th>
<div>{{supplier.iban}}</div> <div>{{supplier.accountDetailValue.join(', ')}}</div>
<div>{{supplier.nif}}</div>
</th> </th>
</tr> </tr>
<tr> <tr>

View File

@ -7,7 +7,11 @@ module.exports = {
async serverPrefetch() { async serverPrefetch() {
this.client = await this.findOneFromDef('client', [this.companyId, this.companyId, this.id]); this.client = await this.findOneFromDef('client', [this.companyId, this.companyId, this.id]);
this.checkMainEntity(this.client); this.checkMainEntity(this.client);
this.supplier = await this.findOneFromDef('supplier', [this.companyId, this.companyId, this.id]); const suppliers = await this.rawSqlFromDef('supplier', [this.companyId, this.companyId, this.id]);
this.supplier = {
...suppliers[0],
accountDetailValue: suppliers.map(val => val?.accountDetailValue)
};
}, },
props: { props: {
id: { id: {
@ -23,11 +27,11 @@ module.exports = {
methods: { methods: {
getSupplierCif() { getSupplierCif() {
return db.findOne(` return db.findOne(`
SELECT sa.iban, s.nif SELECT DISTINCT ad.value
FROM supplierAccount sa FROM supplierAccount sa
JOIN company co ON co.supplierAccountFk = sa.id JOIN accountDetail ad ON ad.supplierAccountFk = sa.id
JOIN supplier s ON sa.supplierFk = s.id JOIN accountDetailType adt ON adt.id = ad.accountDetailTypeFk AND adt.id = 3
WHERE co.id = ?`) [this.companyId]; WHERE sa.supplierFk = ?`) [this.companyId];
} }
} }

View File

@ -9,7 +9,8 @@ SELECT
s.nif, s.nif,
sa.iban, sa.iban,
sa.supplierFk, sa.supplierFk,
be.name bankName be.name bankName,
ad.value accountDetailValue
FROM FROM
client c client c
LEFT JOIN mandate m ON m.clientFk = c.id AND m.companyFk = ? AND m.finished IS NULL LEFT JOIN mandate m ON m.clientFk = c.id AND m.companyFk = ? AND m.finished IS NULL
@ -19,9 +20,10 @@ FROM
LEFT JOIN province p ON p.id = c.provinceFk LEFT JOIN province p ON p.id = c.provinceFk
LEFT JOIN supplierAccount sa ON sa.supplierFk = s.id LEFT JOIN supplierAccount sa ON sa.supplierFk = s.id
LEFT JOIN bankEntity be ON sa.bankEntityFk = be.id LEFT JOIN bankEntity be ON sa.bankEntityFk = be.id
LEFT JOIN accountDetail ad ON ad.supplierAccountFk = sa.id
LEFT JOIN accountDetailType adt ON adt.id = ad.accountDetailTypeFk AND adt.id = 3
WHERE WHERE
(m.companyFk = ? OR m.companyFk IS NULL) (m.companyFk = ? OR m.companyFk IS NULL)
AND (c.id = ? OR (c.id IS NULL AND c.countryFk = sa.countryFk)) AND (c.id = ? OR (c.id IS NULL AND c.countryFk = sa.countryFk))
ORDER BY ORDER BY
m.created DESC m.created DESC;
LIMIT 1;