Merge pull request 'refs #6322 importe' (!1921) from 6322-futureTicketImporte into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #1921 Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
commit
b7a523074f
|
@ -0,0 +1,74 @@
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canbePostponed`(vOriginDated DATE, vFutureDated DATE, vWarehouseFk INT)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro
|
||||||
|
*
|
||||||
|
* @param vOriginDated Fecha en cuestión
|
||||||
|
* @param vFutureDated Fecha en el futuro a sondear
|
||||||
|
* @param vWarehouseFk Identificador de vn.warehouse
|
||||||
|
*/
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tmp.filter
|
||||||
|
(INDEX (id))
|
||||||
|
SELECT sv.ticketFk id,
|
||||||
|
sub2.id futureId,
|
||||||
|
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt,
|
||||||
|
CAST(sum(litros) AS DECIMAL(10,0)) liters,
|
||||||
|
CAST(count(*) AS DECIMAL(10,0)) `lines`,
|
||||||
|
st.name state,
|
||||||
|
sub2.iptd futureIpt,
|
||||||
|
sub2.state futureState,
|
||||||
|
t.clientFk,
|
||||||
|
t.warehouseFk,
|
||||||
|
ts.alertLevel,
|
||||||
|
t.shipped,
|
||||||
|
t.totalWithVat,
|
||||||
|
sub2.shipped futureShipped,
|
||||||
|
t.workerFk,
|
||||||
|
st.code stateCode,
|
||||||
|
sub2.code futureStateCode,
|
||||||
|
st.classColor,
|
||||||
|
sub2.classColor futureClassColor
|
||||||
|
FROM vn.saleVolume sv
|
||||||
|
JOIN vn.sale s ON s.id = sv.saleFk
|
||||||
|
JOIN vn.item i ON i.id = s.itemFk
|
||||||
|
JOIN vn.ticket t ON t.id = sv.ticketFk
|
||||||
|
JOIN vn.address a ON a.id = t.addressFk
|
||||||
|
JOIN vn.province p ON p.id = a.provinceFk
|
||||||
|
JOIN vn.country c ON c.id = p.countryFk
|
||||||
|
JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
||||||
|
JOIN vn.state st ON st.id = ts.stateFk
|
||||||
|
JOIN vn.alertLevel al ON al.id = ts.alertLevel
|
||||||
|
LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT *
|
||||||
|
FROM (
|
||||||
|
SELECT
|
||||||
|
t.addressFk,
|
||||||
|
t.id,
|
||||||
|
t.shipped,
|
||||||
|
st.name state,
|
||||||
|
st.code,
|
||||||
|
st.classColor,
|
||||||
|
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) iptd
|
||||||
|
FROM vn.ticket t
|
||||||
|
JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
||||||
|
JOIN vn.state st ON st.id = ts.stateFk
|
||||||
|
JOIN vn.sale s ON s.ticketFk = t.id
|
||||||
|
JOIN vn.item i ON i.id = s.itemFk
|
||||||
|
WHERE t.shipped BETWEEN vFutureDated
|
||||||
|
AND util.dayend(vFutureDated)
|
||||||
|
AND t.warehouseFk = vWarehouseFk
|
||||||
|
GROUP BY t.id
|
||||||
|
) sub
|
||||||
|
GROUP BY sub.addressFk
|
||||||
|
) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id
|
||||||
|
WHERE t.shipped BETWEEN vOriginDated AND util.dayend(vOriginDated)
|
||||||
|
AND t.warehouseFk = vWarehouseFk
|
||||||
|
AND al.code = 'FREE'
|
||||||
|
AND tp.ticketFk IS NULL
|
||||||
|
GROUP BY sv.ticketFk
|
||||||
|
HAVING futureId;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -84,7 +84,7 @@ module.exports = Self => {
|
||||||
arg: 'filter',
|
arg: 'filter',
|
||||||
type: 'object',
|
type: 'object',
|
||||||
description: `Filter defining where, order, offset, and limit - must be a JSON-encoded string`
|
description: `Filter defining where, order, offset, and limit - must be a JSON-encoded string`
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
returns: {
|
returns: {
|
||||||
type: ['object'],
|
type: ['object'],
|
||||||
|
|
|
@ -61,6 +61,9 @@
|
||||||
<th field="liters">
|
<th field="liters">
|
||||||
<span translate>Liters</span>
|
<span translate>Liters</span>
|
||||||
</th>
|
</th>
|
||||||
|
<th field="totalWithVat">
|
||||||
|
<span translate>Import</span>
|
||||||
|
</th>
|
||||||
<th shrink field="lines">
|
<th shrink field="lines">
|
||||||
<span translate>Available Lines</span>
|
<span translate>Available Lines</span>
|
||||||
</th>
|
</th>
|
||||||
|
@ -76,6 +79,7 @@
|
||||||
<th shrink field="futureState">
|
<th shrink field="futureState">
|
||||||
<span translate>State</span>
|
<span translate>State</span>
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -148,6 +152,13 @@
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>{{::ticket.liters}}</td>
|
<td>{{::ticket.liters}}</td>
|
||||||
|
<td>
|
||||||
|
<span
|
||||||
|
class="chip {{$ctrl.totalPriceColor(ticket.totalWithVat)}}"
|
||||||
|
title="{{$ctrl.totalPriceTitle(ticket.totalWithVat) | translate}}">
|
||||||
|
{{::(ticket.totalWithVat ? ticket.totalWithVat : 0) | currency: 'EUR': 2}}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
<td>{{::ticket.lines}}</td>
|
<td>{{::ticket.lines}}</td>
|
||||||
<td separator>
|
<td separator>
|
||||||
<span
|
<span
|
||||||
|
|
|
@ -21,6 +21,9 @@ export default class Controller extends Section {
|
||||||
{
|
{
|
||||||
field: 'futureShipped',
|
field: 'futureShipped',
|
||||||
searchable: false
|
searchable: false
|
||||||
|
}, {
|
||||||
|
field: 'totalWithVat',
|
||||||
|
searchable: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'state',
|
field: 'state',
|
||||||
|
@ -130,6 +133,17 @@ export default class Controller extends Section {
|
||||||
this.vnApp.showSuccess(this.$t('Success'));
|
this.vnApp.showSuccess(this.$t('Success'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
totalPriceColor(totalWithVat) {
|
||||||
|
return this.isLessThan50(totalWithVat) ? 'warning' : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
totalPriceTitle(totalWithVat) {
|
||||||
|
return this.isLessThan50(totalWithVat) ? 'Less than 50€' : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
isLessThan50(totalWithVat) {
|
||||||
|
return (parseInt(totalWithVat) > 0 && parseInt(totalWithVat) < 50);
|
||||||
|
}
|
||||||
|
|
||||||
exprBuilder(param, value) {
|
exprBuilder(param, value) {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
|
@ -145,6 +159,8 @@ export default class Controller extends Section {
|
||||||
return {'ipt': {like: `%${value}%`}};
|
return {'ipt': {like: `%${value}%`}};
|
||||||
case 'futureIpt':
|
case 'futureIpt':
|
||||||
return {'futureIpt': {like: `%${value}%`}};
|
return {'futureIpt': {like: `%${value}%`}};
|
||||||
|
case 'totalWithVat':
|
||||||
|
return {'totalWithVat': value};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue