+
+
+
+ {{item.itemFk}}
+
+ |
+
+
+
+
+ {{item.item}}
+
+ |
+
+
+ {{item.size}}
+
+ |
+
+
+
+
+ Color: {{item.inkFk}}
+
+ |
+
+
+ {{packing || item.packing}}
+
+ |
+
+
+ {{item.stems}}
+
+ |
+
+
+
+
+ Origen: {{item.origin}}
+
+ |
+
+
+
+
+ Productor: {{item.producerName || item.producerFk}}
+
+ |
+ |
+
+
+
+
+ Comprador: {{item.buyerName}}
+
+ |
+
+
+ F: {{date}}
+
+ |
+
+
+ {{`${item.labelNum}/${item.quantity / (packing || item.packing)}`}}
+
+ |
+
+
+
+
+ Entrada: {{item.entryFk}}
+
+ |
+
+
+
+
+ {{
+ (item.longName && item.size && item.subName)
+ ? `${item.longName} ${item.size} ${item.subName}`
+ : item.comment
+ }}
+
+ |
+
+
+
+
\ No newline at end of file
diff --git a/print/templates/reports/item-label-qr/item-label-qr.js b/print/templates/reports/item-label-qr/item-label-qr.js
new file mode 100755
index 000000000..1a0ef767b
--- /dev/null
+++ b/print/templates/reports/item-label-qr/item-label-qr.js
@@ -0,0 +1,57 @@
+const UserError = require('vn-loopback/util/user-error');
+const moment = require('moment');
+const qrcode = require('qrcode');
+
+module.exports = {
+ name: 'item-label-qr',
+ 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.lastBuy = await this.findOneFromDef('lastBuy', [
+ this.id,
+ 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.qr = await this.getQr(this.items[0].buyFk);
+ this.date = moment(this.date).format('WW/E');
+ },
+ methods: {
+ getQr(data) {
+ data = {
+ company: this.company,
+ user: this.userId,
+ created: this.date,
+ table: 'buy',
+ id: data
+ };
+ return qrcode.toDataURL(JSON.stringify(data), {
+ margin: 0,
+ errorCorrectionLevel: 'L'
+ });
+ }
+ },
+ props: {
+ id: {
+ type: Number,
+ required: true,
+ description: 'The item id'
+ },
+ warehouseId: {
+ type: Number
+ },
+ packing: {
+ type: Number
+ },
+ copies: {
+ type: Number
+ },
+ userId: {
+ type: Number
+ }
+ }
+};
diff --git a/print/templates/reports/item-label-qr/locale/es.yml b/print/templates/reports/item-label-qr/locale/es.yml
new file mode 100644
index 000000000..81dbc1877
--- /dev/null
+++ b/print/templates/reports/item-label-qr/locale/es.yml
@@ -0,0 +1 @@
+reportName: Etiqueta de artículo QR
\ No newline at end of file
diff --git a/print/templates/reports/item-label/options.json b/print/templates/reports/item-label-qr/options.json
similarity index 62%
rename from print/templates/reports/item-label/options.json
rename to print/templates/reports/item-label-qr/options.json
index 98c5788b1..c3c395040 100644
--- a/print/templates/reports/item-label/options.json
+++ b/print/templates/reports/item-label-qr/options.json
@@ -1,9 +1,9 @@
{
"width": "10.4cm",
- "height": "4.8cm",
+ "height": "4.9cm",
"margin": {
- "top": "0cm",
- "right": "0cm",
+ "top": "0.17cm",
+ "right": "0.6cm",
"bottom": "0cm",
"left": "0cm"
},
diff --git a/print/templates/reports/item-label-qr/sql/company.sql b/print/templates/reports/item-label-qr/sql/company.sql
new file mode 100644
index 000000000..4047786a9
--- /dev/null
+++ b/print/templates/reports/item-label-qr/sql/company.sql
@@ -0,0 +1,5 @@
+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 = ?
\ No newline at end of file
diff --git a/print/templates/reports/item-label-qr/sql/item.sql b/print/templates/reports/item-label-qr/sql/item.sql
new file mode 100644
index 000000000..3cb42d139
--- /dev/null
+++ b/print/templates/reports/item-label-qr/sql/item.sql
@@ -0,0 +1,34 @@
+WITH RECURSIVE numbers AS (
+ SELECT 1 n
+ UNION ALL
+ SELECT n + 1
+ FROM numbers
+ WHERE n < ?
+)
+SELECT ROW_NUMBER() OVER() labelNum,
+ b.itemFk,
+ i.name item,
+ b.id buyFk,
+ b.quantity,
+ b.packing,
+ b.entryFk,
+ o.code origin,
+ p.`name` producerName,
+ p.id producerFk,
+ i.`size`,
+ i.category,
+ i.stems,
+ i.inkFk,
+ ig.longName,
+ ig.subName,
+ i.comment,
+ w.code buyerName
+ FROM vn.buy b
+ JOIN vn.item i ON i.id = b.itemFk
+ LEFT JOIN vn.item ig ON ig.id = b.itemOriginalFk
+ JOIN vn.origin o ON o.id = i.originFk
+ LEFT JOIN vn.producer p ON p.id = i.producerFk
+ JOIN vn.itemType it ON it.id = i.typeFk
+ JOIN vn.worker w ON w.id = it.workerFk
+ JOIN numbers num
+ WHERE b.id = ?
\ No newline at end of file
diff --git a/print/templates/reports/item-label-qr/sql/lastBuy.sql b/print/templates/reports/item-label-qr/sql/lastBuy.sql
new file mode 100644
index 000000000..d10339998
--- /dev/null
+++ b/print/templates/reports/item-label-qr/sql/lastBuy.sql
@@ -0,0 +1 @@
+SELECT buy_getUltimate(?, ?, ?) id
\ No newline at end of file
diff --git a/print/templates/reports/item-label/assets/css/style.css b/print/templates/reports/item-label/assets/css/style.css
deleted file mode 100644
index 1101604b9..000000000
--- a/print/templates/reports/item-label/assets/css/style.css
+++ /dev/null
@@ -1,88 +0,0 @@
-* {
- box-sizing: border-box;
-}
-.label {
- font-size: 1.2em;
-}
-
-.barcode {
- float: left;
- width: 40%;
-}
-
-.barcode h1 {
- text-align: center;
- font-size: 1.8em;
- margin: 0 0 10px 0
-}
-
-.barcode .image {
- text-align: center
-}
-
-.barcode .image img {
- width: 170px
-}
-
-.data {
- float: left;
- width: 60%;
-}
-
-.data .header {
- background-color: #000;
- text-overflow: ellipsis;
- white-space: nowrap;
- overflow: hidden;
- margin-bottom: 25px;
- text-align: right;
- font-size: 1.2em;
- padding: 0.2em;
- color: #FFF
-}
-
-.data .color,
-.data .producer {
- text-transform: uppercase;
- text-align: right;
- font-size: 1.5em;
- text-overflow: ellipsis;
- white-space: nowrap;
- overflow: hidden;
-}
-
-.data .producer {
- text-justify: inter-character;
-}
-
-.data .details {
- border-top: 4px solid #000;
- padding-top: 2px;
-}
-
-.data .details .package {
- padding-right: 5px;
- float: left;
- width: 50%;
-}
-
-.package .packing,
-.package .dated,
-.package .labelNumber {
- text-align: right
-}
-
-.package .packing {
- font-size: 1.8em;
- font-weight: 400
-}
-
-.data .details .size {
- background-color: #000;
- text-align: center;
- font-size: 3em;
- padding: 0.2em 0;
- float: left;
- width: 50%;
- color: #FFF
-}
\ No newline at end of file
diff --git a/print/templates/reports/item-label/item-label.html b/print/templates/reports/item-label/item-label.html
deleted file mode 100644
index 66509ab38..000000000
--- a/print/templates/reports/item-label/item-label.html
+++ /dev/null
@@ -1,29 +0,0 @@
-