Merge branch 'dev' into 7758-Add_code_mandateType_accountDetailType
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Ivan Mas 2024-08-21 14:49:05 +00:00
commit 150c60c894
38 changed files with 247 additions and 84 deletions

View File

@ -0,0 +1,12 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `srt`.`buffer_afterDelete`
AFTER DELETE ON `buffer`
FOR EACH ROW
BEGIN
INSERT INTO buffer
SET `action` = 'delete',
`changedModel` = 'Buffer',
`changedModelId` = OLD.id,
`userFk` = account.myUser_getId();
END$$
DELIMITER ;

View File

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

View File

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

View File

@ -0,0 +1,12 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `srt`.`config_afterDelete`
AFTER DELETE ON `config`
FOR EACH ROW
BEGIN
INSERT INTO config
SET `action` = 'delete',
`changedModel` = 'Config',
`changedModelId` = OLD.id,
`userFk` = account.myUser_getId();
END$$
DELIMITER ;

View File

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

View File

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

View File

@ -9,10 +9,11 @@ BEGIN
DECLARE vWarehouseFk INT; DECLARE vWarehouseFk INT;
DECLARE vWagons INT; DECLARE vWagons INT;
DECLARE vTrainFk INT; DECLARE vTrainFk INT;
DECLARE vLinesLimit INT DEFAULT NULL; DECLARE vLinesLimit INT;
DECLARE vTicketLines INT; DECLARE vTicketLines INT;
DECLARE vVolumeLimit DECIMAL DEFAULT NULL; DECLARE vVolumeLimit DECIMAL;
DECLARE vTicketVolume DECIMAL; DECLARE vTicketVolume DECIMAL;
DECLARE vSizeLimit INT;
DECLARE vMaxTickets INT; DECLARE vMaxTickets INT;
DECLARE vStateFk VARCHAR(45); DECLARE vStateFk VARCHAR(45);
DECLARE vFirstTicketFk INT; DECLARE vFirstTicketFk INT;
@ -77,6 +78,7 @@ BEGIN
o.trainFk, o.trainFk,
o.linesLimit, o.linesLimit,
o.volumeLimit, o.volumeLimit,
o.sizeLimit,
pc.collection_new_lockname pc.collection_new_lockname
INTO vMaxTickets, INTO vMaxTickets,
vHasUniqueCollectionTime, vHasUniqueCollectionTime,
@ -88,6 +90,7 @@ BEGIN
vTrainFk, vTrainFk,
vLinesLimit, vLinesLimit,
vVolumeLimit, vVolumeLimit,
vSizeLimit,
vLockName vLockName
FROM productionConfig pc FROM productionConfig pc
JOIN worker w ON w.id = vUserFk JOIN worker w ON w.id = vUserFk
@ -172,6 +175,14 @@ BEGIN
JOIN state s ON s.id = pb.state JOIN state s ON s.id = pb.state
JOIN agencyMode am ON am.id = pb.agencyModeFk JOIN agencyMode am ON am.id = pb.agencyModeFk
JOIN agency a ON a.id = am.agencyFk JOIN agency a ON a.id = am.agencyFk
LEFT JOIN (
SELECT pb.ticketFk, MAX(i.`size`) maxSize
FROM tmp.productionBuffer pb
JOIN ticket t ON t.id = pb.ticketfk
JOIN sale s ON s.ticketFk = t.id
JOIN item i ON i.id = s.itemFk
GROUP BY pb.ticketFk
) sub ON sub.ticketFk = pb.ticketFk
JOIN productionConfig pc JOIN productionConfig pc
WHERE pb.shipped <> util.VN_CURDATE() WHERE pb.shipped <> util.VN_CURDATE()
OR (pb.ubicacion IS NULL AND a.isOwn) OR (pb.ubicacion IS NULL AND a.isOwn)
@ -183,8 +194,9 @@ BEGIN
OR (NOT pb.V AND vItemPackingTypeFk = 'V') OR (NOT pb.V AND vItemPackingTypeFk = 'V')
OR (pc.isPreviousPreparationRequired AND pb.previousWithoutParking) OR (pc.isPreviousPreparationRequired AND pb.previousWithoutParking)
OR LENGTH(pb.problem) > 0 OR LENGTH(pb.problem) > 0
OR (pb.lines >= vLinesLimit AND vLinesLimit IS NOT NULL) OR (pb.lines > vLinesLimit AND vLinesLimit IS NOT NULL)
OR (pb.m3 >= vVolumeLimit AND vVolumeLimit IS NOT NULL); OR (pb.m3 > vVolumeLimit AND vVolumeLimit IS NOT NULL)
OR ((sub.maxSize > vSizeLimit OR sub.maxSize IS NOT NULL) AND vSizeLimit IS NOT NULL);
END IF; END IF;
-- Es importante que el primer ticket se coja en todos los casos -- Es importante que el primer ticket se coja en todos los casos

View File

@ -14,16 +14,28 @@ BEGIN
DECLARE vTicketFk INT; DECLARE vTicketFk INT;
DECLARE cTickets CURSOR FOR DECLARE cTickets CURSOR FOR
SELECT id FROM ticket SELECT DISTINCT t.id
WHERE refFk IS NULL FROM ticket t
AND ((vScope = 'client' AND clientFk = vId) LEFT JOIN tItems ti ON ti.id = t.id
OR (vScope = 'address' AND addressFk = vId)); WHERE t.refFk IS NULL
AND ((vScope = 'client' AND t.clientFk = vId)
OR (vScope = 'address' AND t.addressFk = vId)
OR (vScope = 'item' AND ti.id)
);
DECLARE CONTINUE HANDLER FOR NOT FOUND DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
SET vDone = TRUE;
CREATE OR REPLACE TEMPORARY TABLE tItems
(PRIMARY KEY (id))
ENGINE = MEMORY
SELECT DISTINCT t.id
FROM ticket t
JOIN sale s ON s.ticketFk = t.id
JOIN itemTaxCountry itc ON itc.itemFk = s.itemFk
WHERE t.refFk IS NULL
AND (vScope = 'item' AND itc.itemFk = vId);
OPEN cTickets; OPEN cTickets;
myLoop: LOOP myLoop: LOOP
SET vDone = FALSE; SET vDone = FALSE;
FETCH cTickets INTO vTicketFk; FETCH cTickets INTO vTicketFk;
@ -34,7 +46,8 @@ BEGIN
CALL ticket_recalc(vTicketFk, NULL); CALL ticket_recalc(vTicketFk, NULL);
END LOOP; END LOOP;
CLOSE cTickets; CLOSE cTickets;
DROP TEMPORARY TABLE tItems;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -0,0 +1,3 @@
ALTER TABLE vn.operator
ADD COLUMN sizeLimit int(10) unsigned DEFAULT 90 NULL COMMENT 'Límite de altura en una colección para la asignación de pedidos' AFTER volumeLimit,
MODIFY COLUMN linesLimit int(10) unsigned DEFAULT 20 NULL COMMENT 'Límite de lineas en una colección para la asignación de pedidos';

View File

@ -0,0 +1 @@
ALTER TABLE vn.ticket DROP FOREIGN KEY ticket_FK;

View File

@ -0,0 +1 @@
ALTER TABLE vn.invoiceOut DROP KEY Id_Factura;

View File

@ -0,0 +1 @@
ALTER TABLE vn.invoiceOut MODIFY COLUMN id int(10) unsigned NOT NULL;

View File

@ -0,0 +1 @@
ALTER TABLE vn.invoiceCorrection DROP FOREIGN KEY corrected_fk;

View File

@ -0,0 +1 @@
ALTER TABLE vn.invoiceCorrection DROP FOREIGN KEY correcting_fk;

View File

@ -0,0 +1 @@
ALTER TABLE vn.invoiceOutExpense DROP FOREIGN KEY invoiceOutExpence_FK_1;

View File

@ -0,0 +1 @@
ALTER TABLE vn.invoiceOutTax DROP FOREIGN KEY invoiceOutFk;

View File

@ -0,0 +1 @@
ALTER TABLE vn.invoiceOut DROP PRIMARY KEY;

View File

@ -0,0 +1 @@
ALTER TABLE vn.invoiceOut ADD CONSTRAINT invoiceOut_pk PRIMARY KEY (id);

View File

@ -0,0 +1 @@
ALTER TABLE vn.invoiceOut ADD CONSTRAINT invoiceOut_unique UNIQUE KEY (`ref`);

View File

@ -0,0 +1 @@
ALTER TABLE vn.invoiceOut MODIFY COLUMN id int(10) unsigned auto_increment NOT NULL;

View File

@ -0,0 +1,2 @@
ALTER TABLE vn.ticket ADD CONSTRAINT ticket_invoiceOut_FK
FOREIGN KEY (refFk) REFERENCES vn.invoiceOut(`ref`) ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -0,0 +1,2 @@
ALTER TABLE vn.invoiceCorrection ADD CONSTRAINT invoiceCorrection_invoiceOut_FK
FOREIGN KEY (correctingFk) REFERENCES vn.invoiceOut(id) ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -0,0 +1,2 @@
ALTER TABLE vn.invoiceCorrection ADD CONSTRAINT invoiceCorrection_invoiceOut_FK_1
FOREIGN KEY (correctedFk) REFERENCES vn.invoiceOut(id) ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -0,0 +1,2 @@
ALTER TABLE vn.invoiceOutExpense ADD CONSTRAINT invoiceOutExpense_invoiceOut_FK
FOREIGN KEY (invoiceOutFk) REFERENCES vn.invoiceOut(id) ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -0,0 +1,2 @@
ALTER TABLE vn.invoiceOutTax ADD CONSTRAINT invoiceOutTax_invoiceOut_FK
FOREIGN KEY (invoiceOutFk) REFERENCES vn.invoiceOut(id) ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -0,0 +1,3 @@
ALTER TABLE hedera.tpvMerchantEnable
MODIFY COLUMN companyFk int(10) unsigned NOT NULL,
ADD CONSTRAINT tpvMerchantEnable_company_FK FOREIGN KEY (companyFk) REFERENCES vn.company(id) ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -0,0 +1,19 @@
CREATE OR REPLACE TABLE `srt`.`bufferLog` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`originFk` int(11) 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('Buffer', 'Config') NOT NULL DEFAULT 'Buffer',
`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,
`summaryId` varchar(30) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `logBufferUserFk` (`userFk`),
KEY `bufferLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
KEY `bufferLog_originFk` (`originFk`,`creationDate`),
CONSTRAINT `bufferUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

View File

@ -0,0 +1 @@
ALTER TABLE srt.buffer ADD editorFk int(10) unsigned DEFAULT NULL NULL;

View File

@ -0,0 +1 @@
ALTER TABLE srt.config ADD editorFk int(10) unsigned DEFAULT NULL NULL;

View File

@ -0,0 +1,9 @@
CREATE TABLE vn.quadMindsApiConfig (
id int(10) unsigned NULL PRIMARY KEY,
`url` varchar(255) DEFAULT NULL NULL,
`key` varchar(255) DEFAULT NULL NULL,
CONSTRAINT quadMindsConfig_check CHECK (id = 1)
)
ENGINE=InnoDB
DEFAULT CHARSET=utf8mb3
COLLATE=utf8mb3_unicode_ci;

View File

@ -22,7 +22,7 @@ labels AS (
b.id, b.id,
b.itemFk, b.itemFk,
p.name producer, p.name producer,
IF(i2.id, i2.comment, i.comment) comment IFNULL(i2.comment, i.comment) comment
FROM buy b FROM buy b
JOIN item i ON i.id = b.itemFk JOIN item i ON i.id = b.itemFk
LEFT JOIN producer p ON p.id = i.producerFk LEFT JOIN producer p ON p.id = i.producerFk

View File

@ -1,14 +1,20 @@
h3 { h3 {
font-weight: 100; font-weight: 100;
color: #555 color: #555
} }
.report-info { .report-info {
font-size: 20px font-size: 20px
} }
.description strong { .description strong {
text-transform: uppercase; text-transform: uppercase;
} }
.nowrap {
white-space: nowrap;
}
.padding {
padding: 16px;
}
.tags {
font-size: 10px;
margin: 0;
}

View File

@ -4,23 +4,23 @@
</template> </template>
<div class="grid-row"> <div class="grid-row">
<div class="grid-block"> <div class="grid-block">
<div class="columns"> <h1 class="title uppercase">{{$t('title')}}</h1>
<div class="columns header-tables">
<div class="size50"> <div class="size50">
<div class="body"> <div class="body">
<h1 class="title uppercase">{{$t('title')}}</h1>
<table class="row-oriented report-info"> <table class="row-oriented report-info">
<tbody> <tbody>
<tr> <tr>
<td class="font gray uppercase">{{$t('entryId')}}</td> <td class="font gray uppercase padding nowrap">{{$t('entryId')}}</td>
<th>{{entry.id}}</th> <th>{{entry.id}}</th>
</tr> </tr>
<tr> <tr>
<td class="font gray uppercase">{{$t('date')}}</td> <td class="font gray uppercase padding nowrap">{{$t('date')}}</td>
<th>{{formatDate(entry.landed,'%d-%m-%Y')}}</th> <th>{{formatDate(entry.landed,'%d-%m-%Y')}}</th>
</tr> </tr>
<tr> <tr>
<td class="font gray uppercase">{{$t('ref')}}</td> <td class="font gray uppercase padding nowrap">{{$t('ref')}}</td>
<th>{{entry.invoiceNumber}}</th> <th>{{entry.invoiceNumber | dashIfEmpty}}</th>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -38,42 +38,56 @@
</div> </div>
</div> </div>
</div> </div>
<table class="column-oriented vn-mt-ml"> <table class="column-oriented vn-mt-ml border-collapse">
<thead> <thead>
<tr> <tr>
<th class="number">{{$t('boxes')}}</th> <th class="number">{{$t('boxes')}}</th>
<th width="5%" class="number"></th>
<th class="number">{{$t('packing')}}</th> <th class="number">{{$t('packing')}}</th>
<th width="50%">{{$t('concept')}}</th> <th width="40%">{{$t('concept')}}</th>
<th width="10%">{{$t('reference')}}</th>
<th width="10%">{{$t('tags')}}</th>
<th width="10%" class="number">{{$t('quantity')}}</th> <th width="10%" class="number">{{$t('quantity')}}</th>
<th width="5%" class="number"></th>
<th width="15%" class="number">{{$t('price')}}</th> <th width="15%" class="number">{{$t('price')}}</th>
<th width="5%" class="number"></th>
<th width="15%" class="number">{{$t('amount')}}</th> <th width="15%" class="number">{{$t('amount')}}</th>
</tr> </tr>
</thead> </thead>
<tbody v-for="buy in buys"> <tbody v-for="buy in buys">
<tr> <tr>
<td class="number">{{buy.box}}</td> <td class="number">{{buy.stickers}}</td>
<td width="5%" class="number">x</td>
<td class="number">{{buy.packing}}</td> <td class="number">{{buy.packing}}</td>
<td width="50%">{{buy.itemName}}</td> <td width="40%" class="nowrap">{{buy.name}}</td>
<td width="10%">{{buy.comment}}</td>
<td width="10%" class="font light-gray tags">
<span v-if="buy.value5" class="nowrap"><strong>{{buy.tag5}} → </strong>{{buy.value5}} </span>
<span v-if="buy.value6" class="nowrap"><strong>{{buy.tag6}} → </strong>{{buy.value6}} </span>
<span v-if="buy.value7" class="nowrap"><strong>{{buy.tag7}} → </strong>{{buy.value7}} </span>
</td>
<td width="10%" class="number">{{buy.quantity | number($i18n.locale)}}</td> <td width="10%" class="number">{{buy.quantity | number($i18n.locale)}}</td>
<td width="5%" class="number">x</td>
<td width="15%" class="number">{{buy.buyingValue | currency('EUR', $i18n.locale)}}</td> <td width="15%" class="number">{{buy.buyingValue | currency('EUR', $i18n.locale)}}</td>
<td width="5%" class="number">=</td>
<td width="15%" class="number"> <td width="15%" class="number">
{{buy.buyingValue * buy.quantity | currency('EUR', $i18n.locale)}} {{buy.buyingValue * buy.quantity | currency('EUR', $i18n.locale)}}
</td> </td>
</tr> </tr>
<tr class="description font light-gray">
<td colspan="7">
<span v-if="buy.value5"> <strong>{{buy.tag5}}</strong> {{buy.value5}} </span>
<span v-if="buy.value6"> <strong>{{buy.tag6}}</strong> {{buy.value6}} </span>
<span v-if="buy.value7"> <strong>{{buy.tag7}}</strong> {{buy.value7}} </span>
</td>
</tr>
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr class="font bold">
<td colspan="5" class="font bold"> <td class="number">{{getTotalBy('stickers')}}</td>
<span class="pull-right">{{$t('total')}}</span> <td></td>
</td> <td></td>
<td class="number">{{getTotal() | currency('EUR', $i18n.locale)}}</td> <td></td>
<td></td>
<td></td>
<td class="number">{{getTotalBy('quantity') | number($i18n.locale)}}</td>
<td></td>
<td></td>
<td></td>
<td class="number">{{getTotalBy('amount') | currency('EUR', $i18n.locale)}}</td>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>

View File

@ -13,13 +13,17 @@ module.exports = {
return {totalBalance: 0.00}; return {totalBalance: 0.00};
}, },
methods: { methods: {
getTotal() { getTotalBy(property) {
let total = 0.00; return this.buys.reduce((total, buy) => {
this.buys.forEach(buy => { switch (property) {
total += buy.quantity * buy.buyingValue; case 'amount':
}); return total + buy.quantity * buy.buyingValue;
case 'quantity':
return total; return total + buy.quantity;
case 'stickers':
return total + buy.stickers;
}
}, 0);
} }
}, },
props: { props: {

View File

@ -2,7 +2,7 @@ reportName: pedido-de-entrada
title: Pedido title: Pedido
supplierName: Proveedor supplierName: Proveedor
supplierStreet: Dirección supplierStreet: Dirección
entryId: Referencia interna entryId: Nº Entrada
date: Fecha date: Fecha
ref: Nº Factura ref: Nº Factura
boxes: Cajas boxes: Cajas
@ -15,3 +15,5 @@ total: Total
entry: Entrada {0} entry: Entrada {0}
supplierData: Datos del proveedor supplierData: Datos del proveedor
notes: Notas notes: Notas
reference: Referencia
tags: Tags

View File

@ -1,10 +1,10 @@
SELECT SELECT b.itemFk,
b.itemFk,
b.quantity, b.quantity,
b.buyingValue, b.buyingValue,
b.stickers box, b.stickers,
b.packing, b.packing,
i.name itemName, i.name,
IFNULL(i2.comment, i.comment) comment,
i.tag5, i.tag5,
i.value5, i.value5,
i.tag6, i.tag6,
@ -13,4 +13,5 @@ SELECT
i.value7 i.value7
FROM buy b FROM buy b
JOIN item i ON i.id = b.itemFk JOIN item i ON i.id = b.itemFk
LEFT JOIN item i2 ON i2.id = b.itemOriginalFk
WHERE b.entryFk = ? WHERE b.entryFk = ?

View File

@ -1,5 +1,4 @@
SELECT SELECT e.id,
e.id,
e.invoiceNumber, e.invoiceNumber,
c.code companyCode, c.code companyCode,
t.landed t.landed

View File

@ -1,5 +1,4 @@
SELECT SELECT s.name,
s.name,
s.street, s.street,
s.nif, s.nif,
s.postCode, s.postCode,