feat: refs #7644 Added distinct total label count
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
ed79aa488d
commit
187cd226c4
|
@ -9,6 +9,10 @@ module.exports = Self => {
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The entry id',
|
description: 'The entry id',
|
||||||
http: {source: 'path'}
|
http: {source: 'path'}
|
||||||
|
}, {
|
||||||
|
arg: 'showEntryLines',
|
||||||
|
type: 'boolean',
|
||||||
|
required: false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
returns: [
|
returns: [
|
||||||
|
|
|
@ -47,8 +47,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
for (const buy of buys) {
|
for (const buy of buys) {
|
||||||
if (buy.stickers < 1) continue;
|
if (buy.stickers < 1) continue;
|
||||||
ctx.args.id = buy.id;
|
ctx.args = {...ctx.args, id: buy.id, showEntryLines: true};
|
||||||
ctx.args.copies = buy.stickers;
|
|
||||||
const pdfBuffer = await models.Entry.buyLabelSupplier(ctx, myOptions);
|
const pdfBuffer = await models.Entry.buyLabelSupplier(ctx, myOptions);
|
||||||
await merger.add(new Uint8Array(pdfBuffer[0]));
|
await merger.add(new Uint8Array(pdfBuffer[0]));
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
<td>
|
<td>
|
||||||
<div class="cell">
|
<div class="cell">
|
||||||
<span class="lbl">{{$t('boxNum')}}</span>
|
<span class="lbl">{{$t('boxNum')}}</span>
|
||||||
{{`${buy.labelNum} / ${buy.maxLabelNum}`}}
|
{{getTotal(buy)}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -9,7 +9,7 @@ module.exports = {
|
||||||
mixins: [vnReport],
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
const buy = await models.Buy.findById(this.id, null);
|
const buy = await models.Buy.findById(this.id, null);
|
||||||
this.buys = await this.rawSqlFromDef('buy', [buy.entryFk, buy.entryFk, buy.entryFk, this.id]);
|
this.buys = await this.rawSqlFromDef('buy', [buy.entryFk, buy.entryFk, buy.entryFk, this.id, this.id]);
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
this.weekNum = moment(date).isoWeek();
|
this.weekNum = moment(date).isoWeek();
|
||||||
this.dayNum = moment(date).day();
|
this.dayNum = moment(date).day();
|
||||||
|
@ -27,6 +27,11 @@ module.exports = {
|
||||||
height: 115,
|
height: 115,
|
||||||
});
|
});
|
||||||
return new XMLSerializer().serializeToString(svgNode);
|
return new XMLSerializer().serializeToString(svgNode);
|
||||||
|
},
|
||||||
|
getTotal(buy) {
|
||||||
|
return (this.showEntryLines) ?
|
||||||
|
`${buy.entryLabelNum} / ${buy.entryLabels}` :
|
||||||
|
`${buy.buyLabelNum} / ${buy.buyLabels}`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@ -34,6 +39,10 @@ module.exports = {
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The entry id'
|
description: 'The entry id'
|
||||||
|
},
|
||||||
|
showEntryLines: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,7 +10,7 @@ WITH RECURSIVE numbers AS (
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
labels AS (
|
labels AS (
|
||||||
SELECT ROW_NUMBER() OVER(ORDER BY b.id, num.n) labelNum,
|
SELECT ROW_NUMBER() OVER(ORDER BY b.id, num.n) entryLabelNum,
|
||||||
i.name,
|
i.name,
|
||||||
i.`size`,
|
i.`size`,
|
||||||
i.category,
|
i.category,
|
||||||
|
@ -33,6 +33,9 @@ labels AS (
|
||||||
WHERE b.entryFk = ?
|
WHERE b.entryFk = ?
|
||||||
AND num.n <= b.stickers
|
AND num.n <= b.stickers
|
||||||
)
|
)
|
||||||
SELECT *, (SELECT SUM(stickers) FROM buy WHERE entryFk = ?) maxLabelNum
|
SELECT *,
|
||||||
|
ROW_NUMBER() OVER(ORDER BY entryLabelNum) buyLabelNum,
|
||||||
|
(SELECT SUM(stickers) FROM buy WHERE entryFk = ?) entryLabels,
|
||||||
|
(SELECT stickers FROM buy WHERE id = ?) buyLabels
|
||||||
FROM labels
|
FROM labels
|
||||||
WHERE id = ?
|
WHERE id = ?
|
Loading…
Reference in New Issue