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,
|
||||
description: 'The entry id',
|
||||
http: {source: 'path'}
|
||||
}, {
|
||||
arg: 'showEntryLines',
|
||||
type: 'boolean',
|
||||
required: false
|
||||
}
|
||||
],
|
||||
returns: [
|
||||
|
|
|
@ -47,8 +47,7 @@ module.exports = Self => {
|
|||
|
||||
for (const buy of buys) {
|
||||
if (buy.stickers < 1) continue;
|
||||
ctx.args.id = buy.id;
|
||||
ctx.args.copies = buy.stickers;
|
||||
ctx.args = {...ctx.args, id: buy.id, showEntryLines: true};
|
||||
const pdfBuffer = await models.Entry.buyLabelSupplier(ctx, myOptions);
|
||||
await merger.add(new Uint8Array(pdfBuffer[0]));
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
<td>
|
||||
<div class="cell">
|
||||
<span class="lbl">{{$t('boxNum')}}</span>
|
||||
{{`${buy.labelNum} / ${buy.maxLabelNum}`}}
|
||||
{{getTotal(buy)}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -9,7 +9,7 @@ module.exports = {
|
|||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
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();
|
||||
this.weekNum = moment(date).isoWeek();
|
||||
this.dayNum = moment(date).day();
|
||||
|
@ -27,6 +27,11 @@ module.exports = {
|
|||
height: 115,
|
||||
});
|
||||
return new XMLSerializer().serializeToString(svgNode);
|
||||
},
|
||||
getTotal(buy) {
|
||||
return (this.showEntryLines) ?
|
||||
`${buy.entryLabelNum} / ${buy.entryLabels}` :
|
||||
`${buy.buyLabelNum} / ${buy.buyLabels}`;
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
@ -34,6 +39,10 @@ module.exports = {
|
|||
type: Number,
|
||||
required: true,
|
||||
description: 'The entry id'
|
||||
},
|
||||
showEntryLines: {
|
||||
type: Boolean,
|
||||
required: false
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -10,7 +10,7 @@ WITH RECURSIVE numbers 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.`size`,
|
||||
i.category,
|
||||
|
@ -33,6 +33,9 @@ labels AS (
|
|||
WHERE b.entryFk = ?
|
||||
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
|
||||
WHERE id = ?
|
Loading…
Reference in New Issue