feat: refs #7266 Added details and improvements in item label reports
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
8c4d3bac0d
commit
c43bdb5021
|
@ -0,0 +1,48 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('labelBarcodePdf', {
|
||||||
|
description: 'Returns the item label pdf with barcode',
|
||||||
|
accessType: 'READ',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'id',
|
||||||
|
type: 'number',
|
||||||
|
required: true,
|
||||||
|
description: 'The item id',
|
||||||
|
http: {source: 'path'}
|
||||||
|
}, {
|
||||||
|
arg: 'packing',
|
||||||
|
type: 'number',
|
||||||
|
required: false
|
||||||
|
}, {
|
||||||
|
arg: 'copies',
|
||||||
|
type: 'number',
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
returns: [
|
||||||
|
{
|
||||||
|
arg: 'body',
|
||||||
|
type: 'file',
|
||||||
|
root: true
|
||||||
|
}, {
|
||||||
|
arg: 'Content-Type',
|
||||||
|
type: 'String',
|
||||||
|
http: {target: 'header'}
|
||||||
|
}, {
|
||||||
|
arg: 'Content-Disposition',
|
||||||
|
type: 'String',
|
||||||
|
http: {target: 'header'}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
http: {
|
||||||
|
path: '/:id/label-barcode-pdf',
|
||||||
|
verb: 'GET'
|
||||||
|
},
|
||||||
|
accessScopes: ['DEFAULT', 'read:multimedia']
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.labelBarcodePdf = (ctx, id) => {
|
||||||
|
ctx.args.typeId = 'buy';
|
||||||
|
return Self.printReport(ctx, id, 'item-label-barcode');
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,49 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('labelQrPdf', {
|
||||||
|
description: 'Returns the item label pdf with qr',
|
||||||
|
accessType: 'READ',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'id',
|
||||||
|
type: 'number',
|
||||||
|
required: true,
|
||||||
|
description: 'The item id',
|
||||||
|
http: {source: 'path'}
|
||||||
|
}, {
|
||||||
|
arg: 'packing',
|
||||||
|
type: 'number',
|
||||||
|
required: false
|
||||||
|
}, {
|
||||||
|
arg: 'copies',
|
||||||
|
type: 'number',
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
returns: [
|
||||||
|
{
|
||||||
|
arg: 'body',
|
||||||
|
type: 'file',
|
||||||
|
root: true
|
||||||
|
}, {
|
||||||
|
arg: 'Content-Type',
|
||||||
|
type: 'String',
|
||||||
|
http: {target: 'header'}
|
||||||
|
}, {
|
||||||
|
arg: 'Content-Disposition',
|
||||||
|
type: 'String',
|
||||||
|
http: {target: 'header'}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
http: {
|
||||||
|
path: '/:id/label-qr-pdf',
|
||||||
|
verb: 'GET'
|
||||||
|
},
|
||||||
|
accessScopes: ['DEFAULT', 'read:multimedia']
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.labelQrPdf = (ctx, id) => {
|
||||||
|
ctx.args.userId = ctx.req.accessToken.userId;
|
||||||
|
ctx.args.typeId = 'buy';
|
||||||
|
return Self.printReport(ctx, id, 'item-label-qr');
|
||||||
|
};
|
||||||
|
};
|
|
@ -2,4 +2,6 @@ module.exports = Self => {
|
||||||
require('../methods/entry/editLatestBuys')(Self);
|
require('../methods/entry/editLatestBuys')(Self);
|
||||||
require('../methods/entry/latestBuysFilter')(Self);
|
require('../methods/entry/latestBuysFilter')(Self);
|
||||||
require('../methods/entry/deleteBuys')(Self);
|
require('../methods/entry/deleteBuys')(Self);
|
||||||
|
require('../methods/entry/labelBarcodePdf')(Self);
|
||||||
|
require('../methods/entry/labelQrPdf')(Self);
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,12 +21,6 @@ module.exports = Self => {
|
||||||
arg: 'copies',
|
arg: 'copies',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
required: false
|
required: false
|
||||||
}, {
|
|
||||||
arg: 'userId',
|
|
||||||
type: 'number',
|
|
||||||
description: 'The user id from accessToken',
|
|
||||||
http: ctx => ctx.req.accessToken.userId,
|
|
||||||
required: true
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
returns: [
|
returns: [
|
||||||
|
@ -51,5 +45,8 @@ module.exports = Self => {
|
||||||
accessScopes: ['DEFAULT', 'read:multimedia']
|
accessScopes: ['DEFAULT', 'read:multimedia']
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.labelBarcodePdf = (ctx, id) => Self.printReport(ctx, id, 'item-label-barcode');
|
Self.labelBarcodePdf = (ctx, id) => {
|
||||||
|
ctx.args.typeId = 'item';
|
||||||
|
return Self.printReport(ctx, id, 'item-label-barcode');
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,12 +21,6 @@ module.exports = Self => {
|
||||||
arg: 'copies',
|
arg: 'copies',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
required: false
|
required: false
|
||||||
}, {
|
|
||||||
arg: 'userId',
|
|
||||||
type: 'number',
|
|
||||||
description: 'The user id from accessToken',
|
|
||||||
http: ctx => ctx.req.accessToken.userId,
|
|
||||||
required: true
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
returns: [
|
returns: [
|
||||||
|
@ -51,5 +45,9 @@ module.exports = Self => {
|
||||||
accessScopes: ['DEFAULT', 'read:multimedia']
|
accessScopes: ['DEFAULT', 'read:multimedia']
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.labelQrPdf = (ctx, id) => Self.printReport(ctx, id, 'item-label-qr');
|
Self.labelQrPdf = (ctx, id) => {
|
||||||
|
ctx.args.userId = ctx.req.accessToken.userId;
|
||||||
|
ctx.args.typeId = 'item';
|
||||||
|
return Self.printReport(ctx, id, 'item-label-qr');
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
html {
|
html {
|
||||||
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
|
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
|
||||||
margin-top: -9px;
|
margin-top: -9px;
|
||||||
margin-left: -6px;
|
margin-left: -3px;
|
||||||
}
|
}
|
||||||
table {
|
table {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -52,8 +52,8 @@ td {
|
||||||
max-height: 50px;
|
max-height: 50px;
|
||||||
}
|
}
|
||||||
.md-height {
|
.md-height {
|
||||||
height: 75px;
|
height: 70px;
|
||||||
max-height: 75px;
|
max-height: 70px;
|
||||||
}
|
}
|
||||||
.sm-width {
|
.sm-width {
|
||||||
width: 60px;
|
width: 60px;
|
||||||
|
|
|
@ -52,7 +52,10 @@
|
||||||
<div v-html="getBarcode(item.buyFk)"></div>
|
<div v-html="getBarcode(item.buyFk)"></div>
|
||||||
</td>
|
</td>
|
||||||
<td colspan="2" class="center md-width xs-height xs-txt">
|
<td colspan="2" class="center md-width xs-height xs-txt">
|
||||||
<div class="overflow-line">
|
<div v-if="item.isLaid && typeId === 'buy'" class="overflow-line black-bg bold">
|
||||||
|
{{'LAID'}}
|
||||||
|
</div>
|
||||||
|
<div v-else class="overflow-line">
|
||||||
{{item.entryFk}}
|
{{item.entryFk}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -6,17 +6,18 @@ const jsbarcode = require('jsbarcode');
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'item-label-barcode',
|
name: 'item-label-barcode',
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.company = await this.findOneFromDef('company', [this.warehouseId]);
|
|
||||||
if (!this.company)
|
|
||||||
throw new UserError(`There is no company associated with that warehouse`);
|
|
||||||
|
|
||||||
this.date = Date.vnNew();
|
this.date = Date.vnNew();
|
||||||
this.lastBuy = await this.findOneFromDef('lastBuy', [
|
if (this.typeId === 'item') {
|
||||||
this.id,
|
this.company = await this.findOneFromDef('company', [this.warehouseId]);
|
||||||
this.warehouseId,
|
if (!this.company)
|
||||||
this.date
|
throw new UserError(`There is no company associated with that warehouse`);
|
||||||
]);
|
this.lastBuy = await this.findOneFromDef('lastBuy', [
|
||||||
this.items = await this.rawSqlFromDef('item', [this.copies || 1, this.lastBuy.id]);
|
this.id,
|
||||||
|
this.warehouseId,
|
||||||
|
this.date
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
this.items = await this.rawSqlFromDef('item', [this.copies || 1, this.lastBuy?.id || this.id]);
|
||||||
if (!this.items.length) throw new UserError(`Empty data source`);
|
if (!this.items.length) throw new UserError(`Empty data source`);
|
||||||
this.date = moment(this.date).format('WW/E');
|
this.date = moment(this.date).format('WW/E');
|
||||||
},
|
},
|
||||||
|
@ -51,8 +52,8 @@ module.exports = {
|
||||||
copies: {
|
copies: {
|
||||||
type: Number
|
type: Number
|
||||||
},
|
},
|
||||||
userId: {
|
typeId: {
|
||||||
type: Number
|
type: String
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"height": "4.9cm",
|
"height": "4.9cm",
|
||||||
"margin": {
|
"margin": {
|
||||||
"top": "0.17cm",
|
"top": "0.17cm",
|
||||||
"right": "0.745cm",
|
"right": "0.37cm",
|
||||||
"bottom": "0cm",
|
"bottom": "0cm",
|
||||||
"left": "0cm"
|
"left": "0cm"
|
||||||
},
|
},
|
||||||
|
|
|
@ -22,7 +22,8 @@ SELECT ROW_NUMBER() OVER() labelNum,
|
||||||
ig.longName,
|
ig.longName,
|
||||||
ig.subName,
|
ig.subName,
|
||||||
i.comment,
|
i.comment,
|
||||||
w.code buyerName
|
w.code buyerName,
|
||||||
|
i.isLaid
|
||||||
FROM vn.buy b
|
FROM vn.buy b
|
||||||
JOIN vn.item i ON i.id = b.itemFk
|
JOIN vn.item i ON i.id = b.itemFk
|
||||||
LEFT JOIN vn.item ig ON ig.id = b.itemOriginalFk
|
LEFT JOIN vn.item ig ON ig.id = b.itemOriginalFk
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
html {
|
html {
|
||||||
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
|
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
|
||||||
margin-top: -7px;
|
margin-top: -7px;
|
||||||
margin-left: -6px;
|
margin-left: -3px;
|
||||||
}
|
}
|
||||||
.leftTable {
|
.leftTable {
|
||||||
width: 47%;
|
width: 47%;
|
||||||
|
|
|
@ -74,7 +74,14 @@
|
||||||
<i>Productor:</i> {{item.producerName || item.producerFk}}
|
<i>Productor:</i> {{item.producerName || item.producerFk}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td class="center xs-width xs-txt">
|
||||||
|
<div v-if="item.isLaid && typeId === 'buy'" class="overflow-line black-bg bold">
|
||||||
|
{{'LAID'}}
|
||||||
|
</div>
|
||||||
|
<div v-else class="overflow-line">
|
||||||
|
{{item.entryFk}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="sm-width">
|
<td class="sm-width">
|
||||||
|
|
|
@ -5,17 +5,18 @@ const qrcode = require('qrcode');
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'item-label-qr',
|
name: 'item-label-qr',
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.company = await this.findOneFromDef('company', [this.warehouseId]);
|
|
||||||
if (!this.company)
|
|
||||||
throw new UserError(`There is no company associated with that warehouse`);
|
|
||||||
|
|
||||||
this.date = Date.vnNew();
|
this.date = Date.vnNew();
|
||||||
this.lastBuy = await this.findOneFromDef('lastBuy', [
|
if (this.typeId === 'item') {
|
||||||
this.id,
|
this.company = await this.findOneFromDef('company', [this.warehouseId]);
|
||||||
this.warehouseId,
|
if (!this.company)
|
||||||
this.date
|
throw new UserError(`There is no company associated with that warehouse`);
|
||||||
]);
|
this.lastBuy = await this.findOneFromDef('lastBuy', [
|
||||||
this.items = await this.rawSqlFromDef('item', [this.copies || 1, this.lastBuy.id]);
|
this.id,
|
||||||
|
this.warehouseId,
|
||||||
|
this.date
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
this.items = await this.rawSqlFromDef('item', [this.copies || 1, this.lastBuy?.id || this.id]);
|
||||||
if (!this.items.length) throw new UserError(`Empty data source`);
|
if (!this.items.length) throw new UserError(`Empty data source`);
|
||||||
this.qr = await this.getQr(this.items[0].buyFk);
|
this.qr = await this.getQr(this.items[0].buyFk);
|
||||||
this.date = moment(this.date).format('WW/E');
|
this.date = moment(this.date).format('WW/E');
|
||||||
|
@ -52,6 +53,9 @@ module.exports = {
|
||||||
},
|
},
|
||||||
userId: {
|
userId: {
|
||||||
type: Number
|
type: Number
|
||||||
|
},
|
||||||
|
typeId: {
|
||||||
|
type: String
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"height": "4.9cm",
|
"height": "4.9cm",
|
||||||
"margin": {
|
"margin": {
|
||||||
"top": "0.17cm",
|
"top": "0.17cm",
|
||||||
"right": "0.6cm",
|
"right": "0.3cm",
|
||||||
"bottom": "0cm",
|
"bottom": "0cm",
|
||||||
"left": "0cm"
|
"left": "0cm"
|
||||||
},
|
},
|
||||||
|
|
|
@ -22,7 +22,8 @@ SELECT ROW_NUMBER() OVER() labelNum,
|
||||||
ig.longName,
|
ig.longName,
|
||||||
ig.subName,
|
ig.subName,
|
||||||
i.comment,
|
i.comment,
|
||||||
w.code buyerName
|
w.code buyerName,
|
||||||
|
i.isLaid
|
||||||
FROM vn.buy b
|
FROM vn.buy b
|
||||||
JOIN vn.item i ON i.id = b.itemFk
|
JOIN vn.item i ON i.id = b.itemFk
|
||||||
LEFT JOIN vn.item ig ON ig.id = b.itemOriginalFk
|
LEFT JOIN vn.item ig ON ig.id = b.itemOriginalFk
|
||||||
|
|
Loading…
Reference in New Issue