Merge pull request 'feat: refs #7266 Added details and improvements in item label reports' (!3154) from 7266-itemQrBarcodeLabel into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #3154 Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
commit
6afb8fbeb5
|
@ -0,0 +1,7 @@
|
||||||
|
UPDATE salix.ACL
|
||||||
|
SET property='buyLabelSupplier'
|
||||||
|
WHERE property = 'buyLabel'
|
||||||
|
AND model = 'Entry';
|
||||||
|
|
||||||
|
INSERT IGNORE INTO salix.ACL (model,property,principalId)
|
||||||
|
VALUES ('Entry','buyLabel','employee');
|
|
@ -1,14 +1,28 @@
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('buyLabel', {
|
Self.remoteMethodCtx('buyLabel', {
|
||||||
description: 'Returns the entry buy labels',
|
description: 'Returns the buy label',
|
||||||
accessType: 'READ',
|
accessType: 'READ',
|
||||||
accepts: [
|
accepts: [
|
||||||
{
|
{
|
||||||
arg: 'id',
|
arg: 'id',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The entry id',
|
description: 'The buy id',
|
||||||
http: {source: 'path'}
|
http: {source: 'path'}
|
||||||
|
}, {
|
||||||
|
arg: 'labelType',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
description: 'The label type',
|
||||||
|
http: {source: 'path'}
|
||||||
|
}, {
|
||||||
|
arg: 'packing',
|
||||||
|
type: 'number',
|
||||||
|
required: false
|
||||||
|
}, {
|
||||||
|
arg: 'copies',
|
||||||
|
type: 'number',
|
||||||
|
required: false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
returns: [
|
returns: [
|
||||||
|
@ -27,11 +41,16 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
http: {
|
http: {
|
||||||
path: '/:id/buy-label',
|
path: '/:id/:labelType/buy-label',
|
||||||
verb: 'GET'
|
verb: 'GET'
|
||||||
},
|
},
|
||||||
accessScopes: ['DEFAULT', 'read:multimedia']
|
accessScopes: ['DEFAULT', 'read:multimedia']
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.buyLabel = (ctx, id) => Self.printReport(ctx, id, 'buy-label');
|
Self.buyLabel = (ctx, id, labelType) => {
|
||||||
|
if (labelType == 'qr')
|
||||||
|
return Self.printReport(ctx, id, 'buy-label-qr');
|
||||||
|
else
|
||||||
|
return Self.printReport(ctx, id, 'buy-label-barcode');
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('buyLabelSupplier', {
|
||||||
|
description: 'Returns the entry buy labels',
|
||||||
|
accessType: 'READ',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'id',
|
||||||
|
type: 'number',
|
||||||
|
required: true,
|
||||||
|
description: 'The entry id',
|
||||||
|
http: {source: 'path'}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
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/buy-label-supplier',
|
||||||
|
verb: 'GET'
|
||||||
|
},
|
||||||
|
accessScopes: ['DEFAULT', 'read:multimedia']
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.buyLabelSupplier = (ctx, id) => Self.printReport(ctx, id, 'buy-label-supplier');
|
||||||
|
};
|
|
@ -2,4 +2,5 @@ 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/buyLabel')(Self);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
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: 'warehouseId',
|
|
||||||
type: 'number',
|
|
||||||
required: true
|
|
||||||
}, {
|
|
||||||
arg: 'packing',
|
|
||||||
type: 'number',
|
|
||||||
required: false
|
|
||||||
}, {
|
|
||||||
arg: 'copies',
|
|
||||||
type: 'number',
|
|
||||||
required: false
|
|
||||||
}, {
|
|
||||||
arg: 'userId',
|
|
||||||
type: 'number',
|
|
||||||
description: 'The user id from accessToken',
|
|
||||||
http: ctx => ctx.req.accessToken.userId,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
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) => Self.printReport(ctx, id, 'item-label-barcode');
|
|
||||||
};
|
|
|
@ -1,55 +0,0 @@
|
||||||
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: 'warehouseId',
|
|
||||||
type: 'number',
|
|
||||||
required: true
|
|
||||||
}, {
|
|
||||||
arg: 'packing',
|
|
||||||
type: 'number',
|
|
||||||
required: false
|
|
||||||
}, {
|
|
||||||
arg: 'copies',
|
|
||||||
type: 'number',
|
|
||||||
required: false
|
|
||||||
}, {
|
|
||||||
arg: 'userId',
|
|
||||||
type: 'number',
|
|
||||||
description: 'The user id from accessToken',
|
|
||||||
http: ctx => ctx.req.accessToken.userId,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
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) => Self.printReport(ctx, id, 'item-label-qr');
|
|
||||||
};
|
|
|
@ -15,8 +15,6 @@ module.exports = Self => {
|
||||||
require('../methods/item/getWasteByItem')(Self);
|
require('../methods/item/getWasteByItem')(Self);
|
||||||
require('../methods/item/createIntrastat')(Self);
|
require('../methods/item/createIntrastat')(Self);
|
||||||
require('../methods/item/buyerWasteEmail')(Self);
|
require('../methods/item/buyerWasteEmail')(Self);
|
||||||
require('../methods/item/labelBarcodePdf')(Self);
|
|
||||||
require('../methods/item/labelQrPdf')(Self);
|
|
||||||
require('../methods/item/setVisibleDiscard')(Self);
|
require('../methods/item/setVisibleDiscard')(Self);
|
||||||
require('../methods/item/get')(Self);
|
require('../methods/item/get')(Self);
|
||||||
|
|
||||||
|
|
|
@ -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;
|
|
@ -1,16 +1,16 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<body table v-for="item in items" style="break-before: page">
|
<body table v-for="buy in buys" style="break-before: page">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="md-txt bold center black-bg lg-width md-height">
|
<td class="md-txt bold center black-bg lg-width md-height">
|
||||||
<div class="overflow-multiline">
|
<div class="overflow-multiline">
|
||||||
{{item.item}}
|
{{buy.item}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td colspan="2" class="xl-txt bold center black-bg md-height md-width">
|
<td colspan="2" class="xl-txt bold center black-bg md-height md-width">
|
||||||
<div class="overflow-line">
|
<div class="overflow-line">
|
||||||
{{item.size}}
|
{{buy.size}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -18,61 +18,64 @@
|
||||||
<td class="right lg-width">
|
<td class="right lg-width">
|
||||||
<div class="overflow-line">
|
<div class="overflow-line">
|
||||||
{{
|
{{
|
||||||
(item.longName && item.size && item.subName)
|
(buy.longName && buy.size && buy.subName)
|
||||||
? `${item.longName} ${item.size} ${item.subName}`
|
? `${buy.longName} ${buy.size} ${buy.subName}`
|
||||||
: item.comment
|
: buy.comment
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="center sm-width">
|
<td class="center sm-width">
|
||||||
<div class="overflow-line">
|
<div class="overflow-line">
|
||||||
{{item.producerName || item.producerFk}}
|
{{buy.producerName || buy.producerFk}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="center sm-width">
|
<td class="center sm-width">
|
||||||
<div class="overflow-line">
|
<div class="overflow-line">
|
||||||
{{item.inkFk}}
|
{{buy.inkFk}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="md-txt xl-width bold center">
|
<td class="md-txt xl-width bold center">
|
||||||
<div class="overflow-line">
|
<div class="overflow-line">
|
||||||
{{item.itemFk}}
|
{{buy.itemFk}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td colspan="2" class="md-txt md-width center">
|
<td colspan="2" class="md-txt md-width center">
|
||||||
<div class="overflow-line">
|
<div class="overflow-line">
|
||||||
{{`${(packing || item.packing)} x ${item.stems || ''}`}}
|
{{`${(packing || buy.packing)} x ${buy.stems || ''}`}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td rowspan="2" class="center">
|
<td rowspan="2" class="center">
|
||||||
<div v-html="getBarcode(item.buyFk)"></div>
|
<div v-html="getBarcode(buy.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="buy.isLaid && typeId === 'buy'" class="overflow-line black-bg bold">
|
||||||
{{item.entryFk}}
|
{{'LAID'}}
|
||||||
|
</div>
|
||||||
|
<div v-else class="overflow-line">
|
||||||
|
{{buy.entryFk}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="center xs-txt sm-width">
|
<td class="center xs-txt sm-width">
|
||||||
<div class="overflow-line">
|
<div class="overflow-line">
|
||||||
{{item.buyerName}}
|
{{buy.buyerName}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="center xs-txt sm-width">
|
<td class="center xs-txt sm-width">
|
||||||
<div class="overflow-line">
|
<div class="overflow-line">
|
||||||
{{item.origin}}
|
{{buy.origin}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="center xl-width">
|
<td class="center xl-width">
|
||||||
<div class="overflow-line">
|
<div class="overflow-line">
|
||||||
{{item.buyFk}}
|
{{buy.buyFk}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="xs-txt sm-width center">
|
<td class="xs-txt sm-width center">
|
||||||
|
@ -82,7 +85,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td class="xs-txt sm-width cursive center bold">
|
<td class="xs-txt sm-width cursive center bold">
|
||||||
<div class="overflow-line">
|
<div class="overflow-line">
|
||||||
{{`${item.labelNum}/${item.quantity / (packing || item.packing)}`}}
|
{{`${buy.labelNum}/${buy.quantity / (packing || buy.packing)}`}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
|
@ -4,20 +4,11 @@ const moment = require('moment');
|
||||||
const jsbarcode = require('jsbarcode');
|
const jsbarcode = require('jsbarcode');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'item-label-barcode',
|
name: 'buy-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', [
|
this.buys = await this.rawSqlFromDef('buy', [this.copies || 1, this.id]);
|
||||||
this.id,
|
if (!this.buys.length) throw new UserError(`Empty data source`);
|
||||||
this.warehouseId,
|
|
||||||
this.date
|
|
||||||
]);
|
|
||||||
this.items = await this.rawSqlFromDef('item', [this.copies || 1, this.lastBuy.id]);
|
|
||||||
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');
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -51,8 +42,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,9 @@ 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,
|
||||||
|
c.code company
|
||||||
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
|
||||||
|
@ -30,5 +32,7 @@ SELECT ROW_NUMBER() OVER() labelNum,
|
||||||
LEFT JOIN vn.producer p ON p.id = i.producerFk
|
LEFT JOIN vn.producer p ON p.id = i.producerFk
|
||||||
JOIN vn.itemType it ON it.id = i.typeFk
|
JOIN vn.itemType it ON it.id = i.typeFk
|
||||||
JOIN vn.worker w ON w.id = it.workerFk
|
JOIN vn.worker w ON w.id = it.workerFk
|
||||||
|
JOIN vn.entry e ON e.id = b.entryFk
|
||||||
|
JOIN vn.company c ON c.id = e.companyFk
|
||||||
JOIN numbers num
|
JOIN numbers num
|
||||||
WHERE b.id = ?
|
WHERE b.id = ?
|
|
@ -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%;
|
|
@ -1,6 +1,6 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<body v-for="item in items" style="break-before: page">
|
<body v-for="buy in buys" style="break-before: page">
|
||||||
<table class="leftTable">
|
<table class="leftTable">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
{{item.buyFk}}
|
{{buy.buyFk}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -28,58 +28,65 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3" class="lg-width black-bg center bold xl-txt padding">
|
<td colspan="3" class="lg-width black-bg center bold xl-txt padding">
|
||||||
<div class="overflow-line">
|
<div class="overflow-line">
|
||||||
{{item.itemFk}}
|
{{buy.itemFk}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" class="black-bg center bold md-txt md-width md-height">
|
<td colspan="2" class="black-bg center bold md-txt md-width md-height">
|
||||||
<div class="overflow-multiline">
|
<div class="overflow-multiline">
|
||||||
{{item.item}}
|
{{buy.item}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="xs-width black-bg center bold xl-txt">
|
<td class="xs-width black-bg center bold xl-txt">
|
||||||
<div class="overflow-line">
|
<div class="overflow-line">
|
||||||
{{item.size}}
|
{{buy.size}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="sm-width">
|
<td class="sm-width">
|
||||||
<div class="overflow-line">
|
<div class="overflow-line">
|
||||||
<i>Color:</i> <b>{{item.inkFk}}</b>
|
<i>Color:</i> <b>{{buy.inkFk}}</b>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td rowspan="2" class="xs-width center md-txt">
|
<td rowspan="2" class="xs-width center md-txt">
|
||||||
<div class="overflow-line cell">
|
<div class="overflow-line cell">
|
||||||
{{packing || item.packing}}
|
{{packing || buy.packing}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td rowspan="2" class="xs-width center md-txt">
|
<td rowspan="2" class="xs-width center md-txt">
|
||||||
<div class="overflow-line cell">
|
<div class="overflow-line cell">
|
||||||
{{item.stems}}
|
{{buy.stems}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="sm-width">
|
<td class="sm-width">
|
||||||
<div class="overflow-line">
|
<div class="overflow-line">
|
||||||
<i>Origen:</i> {{item.origin}}
|
<i>Origen:</i> {{buy.origin}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" class="md-width">
|
<td colspan="2" class="md-width">
|
||||||
<div class="overflow-line">
|
<div class="overflow-line">
|
||||||
<i>Productor:</i> {{item.producerName || item.producerFk}}
|
<i>Productor:</i> {{buy.producerName || buy.producerFk}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="center xs-width xs-txt">
|
||||||
|
<div v-if="buy.isLaid && typeId === 'buy'" class="overflow-line black-bg bold">
|
||||||
|
{{'LAID'}}
|
||||||
|
</div>
|
||||||
|
<div v-else class="overflow-line">
|
||||||
|
{{buy.entryFk}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="sm-width">
|
<td class="sm-width">
|
||||||
<div class="overflow-line">
|
<div class="overflow-line">
|
||||||
<i>Comprador:</i> {{item.buyerName}}
|
<i>Comprador:</i> {{buy.buyerName}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td rowspan="2" class="xs-width">
|
<td rowspan="2" class="xs-width">
|
||||||
|
@ -89,14 +96,14 @@
|
||||||
</td>
|
</td>
|
||||||
<td rowspan="2" class="xs-width center cursive bold md-txt">
|
<td rowspan="2" class="xs-width center cursive bold md-txt">
|
||||||
<div class="overflow-line">
|
<div class="overflow-line">
|
||||||
{{`${item.labelNum}/${item.quantity / (packing || item.packing)}`}}
|
{{`${buy.labelNum}/${buy.quantity / (packing || buy.packing)}`}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="sm-width">
|
<td class="sm-width">
|
||||||
<div class="overflow-line">
|
<div class="overflow-line">
|
||||||
<i>Entrada:</i> {{item.entryFk}}
|
<i>Entrada:</i> {{buy.entryFk}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -104,9 +111,9 @@
|
||||||
<td colspan="3" class="lg-width center cursive bold">
|
<td colspan="3" class="lg-width center cursive bold">
|
||||||
<div class="overflow-line">
|
<div class="overflow-line">
|
||||||
{{
|
{{
|
||||||
(item.longName && item.size && item.subName)
|
(buy.longName && buy.size && buy.subName)
|
||||||
? `${item.longName} ${item.size} ${item.subName}`
|
? `${buy.longName} ${buy.size} ${buy.subName}`
|
||||||
: item.comment
|
: buy.comment
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
|
@ -3,27 +3,18 @@ const moment = require('moment');
|
||||||
const qrcode = require('qrcode');
|
const qrcode = require('qrcode');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'item-label-qr',
|
name: 'buy-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', [
|
this.buys = await this.rawSqlFromDef('buy', [this.copies || 1, this.id]);
|
||||||
this.id,
|
if (!this.buys.length) throw new UserError(`Empty data source`);
|
||||||
this.warehouseId,
|
this.qr = await this.getQr(this.buys[0].buyFk);
|
||||||
this.date
|
|
||||||
]);
|
|
||||||
this.items = await this.rawSqlFromDef('item', [this.copies || 1, this.lastBuy.id]);
|
|
||||||
if (!this.items.length) throw new UserError(`Empty data source`);
|
|
||||||
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');
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getQr(data) {
|
getQr(data) {
|
||||||
data = {
|
data = {
|
||||||
company: this.company,
|
company: this.buys.company,
|
||||||
user: this.userId,
|
user: this.userId,
|
||||||
created: this.date,
|
created: this.date,
|
||||||
table: 'buy',
|
table: 'buy',
|
||||||
|
@ -52,6 +43,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,9 @@ 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,
|
||||||
|
c.code company
|
||||||
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
|
||||||
|
@ -30,5 +32,7 @@ SELECT ROW_NUMBER() OVER() labelNum,
|
||||||
LEFT JOIN vn.producer p ON p.id = i.producerFk
|
LEFT JOIN vn.producer p ON p.id = i.producerFk
|
||||||
JOIN vn.itemType it ON it.id = i.typeFk
|
JOIN vn.itemType it ON it.id = i.typeFk
|
||||||
JOIN vn.worker w ON w.id = it.workerFk
|
JOIN vn.worker w ON w.id = it.workerFk
|
||||||
|
JOIN vn.entry e ON e.id = b.entryFk
|
||||||
|
JOIN vn.company c ON c.id = e.companyFk
|
||||||
JOIN numbers num
|
JOIN numbers num
|
||||||
WHERE b.id = ?
|
WHERE b.id = ?
|
|
@ -5,7 +5,7 @@ const jsBarcode = require('jsbarcode');
|
||||||
const moment = require('moment');
|
const moment = require('moment');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'buy-label',
|
name: 'buy-label-supplier',
|
||||||
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);
|
|
@ -1,5 +0,0 @@
|
||||||
SELECT co.code
|
|
||||||
FROM warehouse w
|
|
||||||
JOIN address a ON a.id = w.addressFk
|
|
||||||
JOIN company co ON co.clientFk = a.clientFk
|
|
||||||
WHERE w.id = ?
|
|
|
@ -1 +0,0 @@
|
||||||
SELECT buy_getUltimate(?, ?, ?) id
|
|
|
@ -1,5 +0,0 @@
|
||||||
SELECT co.code
|
|
||||||
FROM warehouse w
|
|
||||||
JOIN address a ON a.id = w.addressFk
|
|
||||||
JOIN company co ON co.clientFk = a.clientFk
|
|
||||||
WHERE w.id = ?
|
|
|
@ -1 +0,0 @@
|
||||||
SELECT buy_getUltimate(?, ?, ?) id
|
|
Loading…
Reference in New Issue