refs #5599 procedure y colorClass
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Carlos Satorres 2023-05-10 14:43:08 +02:00
parent c59915f951
commit 9a813c075c
3 changed files with 12 additions and 16 deletions

View File

@ -45,7 +45,6 @@ BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.filter; DROP TEMPORARY TABLE IF EXISTS tmp.filter;
CREATE TEMPORARY TABLE tmp.filter CREATE TEMPORARY TABLE tmp.filter
(INDEX (id)) (INDEX (id))
SELECT SELECT
origin.ticketFk futureId, origin.ticketFk futureId,
dest.ticketFk id, dest.ticketFk id,
@ -65,7 +64,9 @@ BEGIN
dest.lines, dest.lines,
dest.liters, dest.liters,
origin.futureLines - origin.hasStock AS notMovableLines, origin.futureLines - origin.hasStock AS notMovableLines,
(origin.futureLines = origin.hasStock) AS isFullMovable (origin.futureLines = origin.hasStock) AS isFullMovable,
origin.classColor,
dest.classColor futureClassColor
FROM ( FROM (
SELECT SELECT
s.ticketFk, s.ticketFk,
@ -73,19 +74,19 @@ BEGIN
t.shipped, t.shipped,
t.totalWithVat, t.totalWithVat,
st.name futureState, st.name futureState,
st.classColor,
t.addressFk, t.addressFk,
am.name futureAgency, am.name futureAgency,
count(s.id) futureLines, count(s.id) futureLines,
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt, GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt,
CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters, CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters,
SUM((s.quantity <= IFNULL(st.amount,0))) hasStock SUM((s.quantity <= IFNULL(st.amount,0))) hasStock,
st.classColor
FROM ticket t FROM ticket t
JOIN sale s ON s.ticketFk = t.id JOIN sale s ON s.ticketFk = t.id
JOIN saleVolume sv ON sv.saleFk = s.id JOIN saleVolume sv ON sv.saleFk = s.id
JOIN item i ON i.id = s.itemFk JOIN item i ON i.id = s.itemFk
JOIN ticketState ts ON ts.ticketFk = t.id JOIN ticketState ts ON ts.ticketFk = t.id
LEFT JOIN state st ON st.classColor = t.id JOIN state st ON st.id = ts.stateFk
JOIN agencyMode am ON t.agencyModeFk = am.id JOIN agencyMode am ON t.agencyModeFk = am.id
LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
LEFT JOIN tmp.stock st ON st.itemFk = i.id LEFT JOIN tmp.stock st ON st.itemFk = i.id
@ -103,7 +104,8 @@ BEGIN
t.totalWithVat, t.totalWithVat,
am.name agency, am.name agency,
CAST(SUM(litros) AS DECIMAL(10,0)) liters, CAST(SUM(litros) AS DECIMAL(10,0)) liters,
CAST(COUNT(*) AS DECIMAL(10,0)) `lines` CAST(COUNT(*) AS DECIMAL(10,0)) `lines`,
st.classColor
FROM ticket t FROM ticket t
JOIN sale s ON s.ticketFk = t.id JOIN sale s ON s.ticketFk = t.id
JOIN saleVolume sv ON sv.saleFk = s.id JOIN saleVolume sv ON sv.saleFk = s.id
@ -118,6 +120,5 @@ BEGIN
GROUP BY t.id GROUP BY t.id
) dest ON dest.addressFk = origin.addressFk ) dest ON dest.addressFk = origin.addressFk
WHERE origin.hasStock != 0; WHERE origin.hasStock != 0;
DROP TEMPORARY TABLE tmp.stock; DROP TEMPORARY TABLE tmp.stock;
END END

View File

@ -159,11 +159,6 @@ module.exports = Self => {
stmts.push('CALL ticket_getProblems(FALSE)'); stmts.push('CALL ticket_getProblems(FALSE)');
stmt = new ParameterizedSQL(`
SELECT st.classColor
FROM state st
LEFT JOIN ticket t ON st.classColor = t.id;
`);
stmt = new ParameterizedSQL(` stmt = new ParameterizedSQL(`
SELECT f.*, tp.* SELECT f.*, tp.*
FROM tmp.filter f FROM tmp.filter f

View File

@ -122,7 +122,7 @@
<td>{{::ticket.ipt | dashIfEmpty}}</td> <td>{{::ticket.ipt | dashIfEmpty}}</td>
<td> <td>
<span <span
class="chip {{$ctrl.stateColor(ticket.stateColor)}}"> class="chip {{ticket.classColor}}">
{{::ticket.state | dashIfEmpty}} {{::ticket.state | dashIfEmpty}}
</span> </span>
</td> </td>
@ -150,7 +150,7 @@
<td>{{::ticket.futureIpt | dashIfEmpty}}</td> <td>{{::ticket.futureIpt | dashIfEmpty}}</td>
<td> <td>
<span <span
class="chip {{$ctrl.stateColor(ticket.futureState)}}"> class="chip {{ticket.classColor}}">
{{::ticket.futureState | dashIfEmpty}} {{::ticket.futureState | dashIfEmpty}}
</span> </span>
</td> </td>