- {{item.item}}
+ {{buy.item}}
|
- {{item.size}}
+ {{buy.size}}
|
{{
- (item.longName && item.size && item.subName)
- ? `${item.longName} ${item.size} ${item.subName}`
- : item.comment
+ (buy.longName && buy.size && buy.subName)
+ ? `${buy.longName} ${buy.size} ${buy.subName}`
+ : buy.comment
}}
|
- {{item.producerName || item.producerFk}}
+ {{buy.producerName || buy.producerFk}}
|
- {{item.inkFk}}
+ {{buy.inkFk}}
|
- {{item.itemFk}}
+ {{buy.itemFk}}
|
- {{`${(packing || item.packing)} x ${item.stems || ''}`}}
+ {{`${(packing || buy.packing)} x ${buy.stems || ''}`}}
|
||
- + |
-
- {{item.entryFk}}
+
+ {{'LAID'}}
+
+
+ {{buy.entryFk}}
|
||
- {{item.buyerName}}
+ {{buy.buyerName}}
|
- {{item.origin}}
+ {{buy.origin}}
|
||
- {{item.buyFk}}
+ {{buy.buyFk}}
|
@@ -82,7 +85,7 @@ |
- {{`${item.labelNum}/${item.quantity / (packing || item.packing)}`}}
+ {{`${buy.labelNum}/${buy.quantity / (packing || buy.packing)}`}}
|
@@ -12,7 +12,7 @@ | |||
- {{item.buyFk}} + {{buy.buyFk}} | |||
- {{item.itemFk}}
+ {{buy.itemFk}}
|
|||
- {{item.item}}
+ {{buy.item}}
|
- {{item.size}}
+ {{buy.size}}
|
||
- Color: {{item.inkFk}}
+ Color: {{buy.inkFk}}
|
- {{packing || item.packing}}
+ {{packing || buy.packing}}
|
- {{item.stems}}
+ {{buy.stems}}
|
|
- Origen: {{item.origin}}
+ Origen: {{buy.origin}}
|
|||
- Productor: {{item.producerName || item.producerFk}}
+ Productor: {{buy.producerName || buy.producerFk}}
+
+ |
+
+
+ {{'LAID'}}
+
+
+ {{buy.entryFk}}
|
- ||
- Comprador: {{item.buyerName}}
+ Comprador: {{buy.buyerName}}
|
@@ -89,14 +96,14 @@ |
- {{`${item.labelNum}/${item.quantity / (packing || item.packing)}`}}
+ {{`${buy.labelNum}/${buy.quantity / (packing || buy.packing)}`}}
|
|
- Entrada: {{item.entryFk}}
+ Entrada: {{buy.entryFk}}
|
{{
- (item.longName && item.size && item.subName)
- ? `${item.longName} ${item.size} ${item.subName}`
- : item.comment
+ (buy.longName && buy.size && buy.subName)
+ ? `${buy.longName} ${buy.size} ${buy.subName}`
+ : buy.comment
}}
|
diff --git a/print/templates/reports/item-label-qr/item-label-qr.js b/print/templates/reports/buy-label-qr/buy-label-qr.js
similarity index 61%
rename from print/templates/reports/item-label-qr/item-label-qr.js
rename to print/templates/reports/buy-label-qr/buy-label-qr.js
index 1a0ef767b..74470ad6d 100755
--- a/print/templates/reports/item-label-qr/item-label-qr.js
+++ b/print/templates/reports/buy-label-qr/buy-label-qr.js
@@ -3,27 +3,18 @@ const moment = require('moment');
const qrcode = require('qrcode');
module.exports = {
- name: 'item-label-qr',
+ name: 'buy-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.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.company,
+ company: this.buys.company,
user: this.userId,
created: this.date,
table: 'buy',
@@ -52,6 +43,9 @@ module.exports = {
},
userId: {
type: Number
+ },
+ typeId: {
+ type: String
}
}
};
diff --git a/print/templates/reports/item-label-qr/locale/es.yml b/print/templates/reports/buy-label-qr/locale/es.yml
similarity index 100%
rename from print/templates/reports/item-label-qr/locale/es.yml
rename to print/templates/reports/buy-label-qr/locale/es.yml
diff --git a/print/templates/reports/item-label-qr/options.json b/print/templates/reports/buy-label-qr/options.json
similarity index 86%
rename from print/templates/reports/item-label-qr/options.json
rename to print/templates/reports/buy-label-qr/options.json
index c3c395040..c6ffaddea 100644
--- a/print/templates/reports/item-label-qr/options.json
+++ b/print/templates/reports/buy-label-qr/options.json
@@ -3,7 +3,7 @@
"height": "4.9cm",
"margin": {
"top": "0.17cm",
- "right": "0.6cm",
+ "right": "0.3cm",
"bottom": "0cm",
"left": "0cm"
},
diff --git a/print/templates/reports/item-label-qr/sql/item.sql b/print/templates/reports/buy-label-qr/sql/buy.sql
similarity index 82%
rename from print/templates/reports/item-label-qr/sql/item.sql
rename to print/templates/reports/buy-label-qr/sql/buy.sql
index 3cb42d139..739f8449f 100644
--- a/print/templates/reports/item-label-qr/sql/item.sql
+++ b/print/templates/reports/buy-label-qr/sql/buy.sql
@@ -22,7 +22,9 @@ SELECT ROW_NUMBER() OVER() labelNum,
ig.longName,
ig.subName,
i.comment,
- w.code buyerName
+ 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
@@ -30,5 +32,7 @@ SELECT ROW_NUMBER() OVER() labelNum,
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/item-label-qr/assets/css/import.js b/print/templates/reports/buy-label-supplier/assets/css/import.js
similarity index 100%
rename from print/templates/reports/item-label-qr/assets/css/import.js
rename to print/templates/reports/buy-label-supplier/assets/css/import.js
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-barcode/sql/company.sql b/print/templates/reports/item-label-barcode/sql/company.sql
deleted file mode 100644
index 4047786a9..000000000
--- a/print/templates/reports/item-label-barcode/sql/company.sql
+++ /dev/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 = ?
\ No newline at end of file
diff --git a/print/templates/reports/item-label-barcode/sql/lastBuy.sql b/print/templates/reports/item-label-barcode/sql/lastBuy.sql
deleted file mode 100644
index d10339998..000000000
--- a/print/templates/reports/item-label-barcode/sql/lastBuy.sql
+++ /dev/null
@@ -1 +0,0 @@
-SELECT buy_getUltimate(?, ?, ?) id
\ No newline at end of file
diff --git a/print/templates/reports/item-label-qr/sql/company.sql b/print/templates/reports/item-label-qr/sql/company.sql
deleted file mode 100644
index 4047786a9..000000000
--- a/print/templates/reports/item-label-qr/sql/company.sql
+++ /dev/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 = ?
\ 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
deleted file mode 100644
index d10339998..000000000
--- a/print/templates/reports/item-label-qr/sql/lastBuy.sql
+++ /dev/null
@@ -1 +0,0 @@
-SELECT buy_getUltimate(?, ?, ?) id
\ No newline at end of file