+
+
+
+ {{buy.itemFk}}
+
+ |
+
+
+
+
+ {{buy.item}}
+
+ |
+
+
+ {{buy.size}}
+
+ |
+
+
+
+
+ Color: {{buy.inkFk}}
+
+ |
+
+
+ {{packing || buy.packing}}
+
+ |
+
+
+ {{buy.stems}}
+
+ |
+
+
+
+
+ Origen: {{buy.origin}}
+
+ |
+
+
+
+
+ Productor: {{buy.producerName || buy.producerFk}}
+
+ |
+
+
+ {{'LAID'}}
+
+
+ {{buy.entryFk}}
+
+ |
+
+
+
+
+ Comprador: {{buy.buyerName}}
+
+ |
+
+
+ F: {{date}}
+
+ |
+
+
+ {{`${buy.labelNum}/${buy.quantity / (packing || buy.packing)}`}}
+
+ |
+
+
+
+
+ Entrada: {{buy.entryFk}}
+
+ |
+
+
+
+
+ {{
+ (buy.longName && buy.size && buy.subName)
+ ? `${buy.longName} ${buy.size} ${buy.subName}`
+ : buy.comment
+ }}
+
+ |
+
+
+
+
\ No newline at end of file
diff --git a/print/templates/reports/buy-label-qr/buy-label-qr.js b/print/templates/reports/buy-label-qr/buy-label-qr.js
new file mode 100755
index 000000000..74470ad6d
--- /dev/null
+++ b/print/templates/reports/buy-label-qr/buy-label-qr.js
@@ -0,0 +1,51 @@
+const UserError = require('vn-loopback/util/user-error');
+const moment = require('moment');
+const qrcode = require('qrcode');
+
+module.exports = {
+ name: 'buy-label-qr',
+ async serverPrefetch() {
+ this.date = Date.vnNew();
+ this.buys = await this.rawSqlFromDef('buy', [this.copies || 1, this.id]);
+ if (!this.buys.length) throw new UserError(`Empty data source`);
+ this.qr = await this.getQr(this.buys[0].buyFk);
+ this.date = moment(this.date).format('WW/E');
+ },
+ methods: {
+ getQr(data) {
+ data = {
+ company: this.buys.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
+ },
+ typeId: {
+ type: String
+ }
+ }
+};
diff --git a/print/templates/reports/buy-label-qr/locale/es.yml b/print/templates/reports/buy-label-qr/locale/es.yml
new file mode 100644
index 000000000..81dbc1877
--- /dev/null
+++ b/print/templates/reports/buy-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/buy-label-qr/options.json
similarity index 62%
rename from print/templates/reports/item-label/options.json
rename to print/templates/reports/buy-label-qr/options.json
index 98c5788b1..c6ffaddea 100644
--- a/print/templates/reports/item-label/options.json
+++ b/print/templates/reports/buy-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.3cm",
"bottom": "0cm",
"left": "0cm"
},
diff --git a/print/templates/reports/buy-label-qr/sql/buy.sql b/print/templates/reports/buy-label-qr/sql/buy.sql
new file mode 100644
index 000000000..739f8449f
--- /dev/null
+++ b/print/templates/reports/buy-label-qr/sql/buy.sql
@@ -0,0 +1,38 @@
+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,
+ i.isLaid,
+ c.code company
+ 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 vn.entry e ON e.id = b.entryFk
+ JOIN vn.company c ON c.id = e.companyFk
+ JOIN numbers num
+ WHERE b.id = ?
\ No newline at end of file
diff --git a/print/templates/reports/buy-label-supplier/assets/css/import.js b/print/templates/reports/buy-label-supplier/assets/css/import.js
new file mode 100644
index 000000000..37a98dfdd
--- /dev/null
+++ b/print/templates/reports/buy-label-supplier/assets/css/import.js
@@ -0,0 +1,12 @@
+const Stylesheet = require(`vn-print/core/stylesheet`);
+
+const path = require('path');
+const vnPrintPath = path.resolve('print');
+
+module.exports = new Stylesheet([
+ `${vnPrintPath}/common/css/spacing.css`,
+ `${vnPrintPath}/common/css/misc.css`,
+ `${vnPrintPath}/common/css/layout.css`,
+ `${vnPrintPath}/common/css/report.css`,
+ `${__dirname}/style.css`])
+ .mergeStyles();
diff --git a/print/templates/reports/buy-label/assets/css/style.css b/print/templates/reports/buy-label-supplier/assets/css/style.css
similarity index 100%
rename from print/templates/reports/buy-label/assets/css/style.css
rename to print/templates/reports/buy-label-supplier/assets/css/style.css
diff --git a/print/templates/reports/buy-label/buy-label.html b/print/templates/reports/buy-label-supplier/buy-label-supplier.html
similarity index 100%
rename from print/templates/reports/buy-label/buy-label.html
rename to print/templates/reports/buy-label-supplier/buy-label-supplier.html
diff --git a/print/templates/reports/buy-label/buy-label.js b/print/templates/reports/buy-label-supplier/buy-label-supplier.js
similarity index 97%
rename from print/templates/reports/buy-label/buy-label.js
rename to print/templates/reports/buy-label-supplier/buy-label-supplier.js
index 289483051..3cef5f295 100755
--- a/print/templates/reports/buy-label/buy-label.js
+++ b/print/templates/reports/buy-label-supplier/buy-label-supplier.js
@@ -5,7 +5,7 @@ const jsBarcode = require('jsbarcode');
const moment = require('moment');
module.exports = {
- name: 'buy-label',
+ name: 'buy-label-supplier',
mixins: [vnReport],
async serverPrefetch() {
const buy = await models.Buy.findById(this.id, null);
diff --git a/print/templates/reports/buy-label/locale/en.yml b/print/templates/reports/buy-label-supplier/locale/en.yml
similarity index 100%
rename from print/templates/reports/buy-label/locale/en.yml
rename to print/templates/reports/buy-label-supplier/locale/en.yml
diff --git a/print/templates/reports/buy-label/locale/es.yml b/print/templates/reports/buy-label-supplier/locale/es.yml
similarity index 100%
rename from print/templates/reports/buy-label/locale/es.yml
rename to print/templates/reports/buy-label-supplier/locale/es.yml
diff --git a/print/templates/reports/buy-label/options.json b/print/templates/reports/buy-label-supplier/options.json
similarity index 100%
rename from print/templates/reports/buy-label/options.json
rename to print/templates/reports/buy-label-supplier/options.json
diff --git a/print/templates/reports/buy-label/sql/buy.sql b/print/templates/reports/buy-label-supplier/sql/buy.sql
similarity index 100%
rename from print/templates/reports/buy-label/sql/buy.sql
rename to print/templates/reports/buy-label-supplier/sql/buy.sql
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 @@
-