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

View File

@ -159,11 +159,6 @@ module.exports = Self => {
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(`
SELECT f.*, tp.*
FROM tmp.filter f

View File

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