first commit

This commit is contained in:
Guillermo Bonet 2022-10-04 10:55:13 +02:00
parent e4b61f81a9
commit 23726b6e60
8 changed files with 239 additions and 0 deletions

View File

@ -0,0 +1,46 @@
@page {
size: auto;
margin: 0mm;
}
html {
font-family: "Roboto";
}
* {
box-sizing: border-box;
text-align: center;
font-size: 32px;
}
.grid {
border: 1px solid gray;
width: 580px;
max-width: 580px;
padding-right: 12px;
}
.vertical {
writing-mode: vertical-rl;
}
.outline {
border: 1px solid black;
width: 120px;
font-size: 30px;
}
#nickname {
font-size: 28px;
}
#agencyDescripton {
font-size: 36px;
font-weight: bold;
}
#bold {
font-weight: bold;
}
#right{
text-align: right;
width: 230px;
}
#left{
text-align: left;
}
.center {
padding-left: 55px;
}

View File

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html v-bind:lang="$i18n.locale">
<body>
<table class="grid">
<tbody>
<tr>
<td rowspan="6"><span class="vertical">{{levelV}}</span></td>
<td id="right">{{ticketFk}}</td>
<td>/</td>
<td id="left">{{clientFk}}</td>
<td colspan="2">{{shipped}}</td>
</tr>
<tr>
<td colspan="3" rowspan="3" class="center">{{barcode}}</td>
<td></td>
<td class="outline">{{workerCode}}</td>
</tr>
<tr>
<td></td>
<td class="outline">{{labelCount}}</td>
</tr>
<tr>
<td></td>
<td class="outline">{{packingTypeFk}}</td>
</tr>
<tr>
<td colspan="3" id="agencyDescripton" class="center">{{agencyDescripton}}</span></td>
<td></td>
<td id="bold">{{lineCount}}</td>
</tr>
<tr>
<td colspan="3" id="nickname" class="center">{{nickname}}</td>
<td></td>
<td id="bold">{{agencyHour}}</td>
</tr>
</tbody>
</table>
</body>
</html>

View File

@ -0,0 +1,68 @@
const Component = require(`${appPath}/core/component`);
const reportHeader = new Component('report-header');
const reportFooter = new Component('report-footer');
const qrcode = require('qrcode');
module.exports = {
name: 'collection-label',
async serverPrefetch() {
this.collectionTicket = await this.fetchItem(this.collectionTicketId);
this.tags = await this.fetchItemTags(this.collectionTicketId);
this.barcode = await this.getBarcodeBase64(this.collectionTicketId);
if (!this.collectionTicket)
throw new Error('Something went wrong');
},
computed: {
dated() {
const filters = this.$options.filters;
return filters.date(new Date(), '%W/%d');
},
labelPage() {
const labelNumber = this.labelNumber ? this.labelNumber : 1;
const totalLabels = this.totalLabels ? this.totalLabels : 1;
return `${labelNumber}/${totalLabels}`;
}
},
methods: {
fetchItem(id, warehouseId) {
return this.findOneFromDef('item', [id, warehouseId]);
},
fetchItemTags(itemId) {
return this.rawSqlFromDef('itemTags', [itemId]).then(rows => {
const tags = {};
rows.forEach(row => tags[row.code] = row.value);
return tags;
});
},
getBarcodeBase64(itemId) {
return qrcode.toDataURL(itemId, {margin: 0});
},
packing() {
const stems = this.item.stems ? this.item.stems : 1;
return `${this.item.packing}x${stems}`;
}
},
components: {
'report-header': reportHeader.build(),
'report-footer': reportFooter.build()
},
props: {
itemId: {
required: true
},
warehouseId: {
required: true
},
labelNumber: {
type: String
},
totalLabels: {
type: String
}
}
};

View File

@ -0,0 +1 @@
reportName: labelCollection

View File

@ -0,0 +1,11 @@
{
"width": "10.4cm",
"height": "4.8cm",
"margin": {
"top": "0cm",
"right": "0cm",
"bottom": "0cm",
"left": "0cm"
},
"printBackground": true
}

View File

@ -0,0 +1,35 @@
SELECT c.itemPackingTypeFk,
CONCAT(tc.collectionFk, ' ', LEFT(cc.code, 4)) color,
CONCAT(tc.collectionFk, ' ', SUBSTRING('ABCDEFGH',tc.wagon, 1), '-', tc.`level`) levelV,
tc.ticketFk,
LEFT(COALESCE(et.description, zo.name, am.name),12) agencyDescription,
am.name,
t.clientFk,
CONCAT(CAST(SUM(sv.volume) AS DECIMAL(5, 2)), '') m3 ,
CAST(IF(ic.code = 'plant', CONCAT(MAX(i.`size`),' cm'), COUNT(*)) AS CHAR) size,
w.code workerCode,
tt.labelCount,
IF(HOUR(t.shipped), TIME(t.shipped), TIME(zo.`hour`)) agencyHour,
t.shipped,
COUNT(*) lineCount,
t.nickName
FROM vn.ticket t
JOIN vn.ticketCollection tc ON tc.ticketFk = t.id
JOIN vn.collection c ON c.id = tc.collectionFk
LEFT JOIN vn.collectionColors cc ON cc.shelve = tc.`level`
AND cc.wagon = tc.wagon
AND cc.trainFk = c.trainFk
JOIN vn.sale s ON s.ticketFk = t.id
LEFT JOIN vn.saleVolume sv ON sv.saleFk = s.id
JOIN vn.item i ON i.id = s.itemFk
JOIN vn.itemType it ON it.id = i.typeFk
JOIN vn.itemCategory ic ON ic.id = it.categoryFk
JOIN vn.worker w ON w.id = c.workerFk
JOIN vn.agencyMode am ON am.id = t.agencyModeFk
LEFT JOIN vn.ticketTrolley tt ON tt.ticket = t.id
LEFT JOIN vn.`zone` zo ON t.zoneFk = zo.id
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk
LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk
WHERE IF(vIsCollection, tc.collectionFk = vParam, tc.ticketFk = vParam)
GROUP BY t.id
ORDER BY cc.`code`;

View File

@ -0,0 +1,35 @@
SELECT c.itemPackingTypeFk,
CONCAT(tc.collectionFk, ' ', LEFT(cc.code, 4)) color,
CONCAT(tc.collectionFk, ' ', SUBSTRING('ABCDEFGH',tc.wagon, 1), '-', tc.`level`) levelV,
tc.ticketFk,
LEFT(COALESCE(et.description, zo.name, am.name),12) agencyDescription,
am.name,
t.clientFk,
CONCAT(CAST(SUM(sv.volume) AS DECIMAL(5, 2)), '') m3 ,
CAST(IF(ic.code = 'plant', CONCAT(MAX(i.`size`),' cm'), COUNT(*)) AS CHAR) size,
w.code workerCode,
tt.labelCount,
IF(HOUR(t.shipped), TIME(t.shipped), TIME(zo.`hour`)) agencyHour,
t.shipped,
COUNT(*) lineCount,
t.nickName
FROM vn.ticket t
JOIN vn.ticketCollection tc ON tc.ticketFk = t.id
JOIN vn.collection c ON c.id = tc.collectionFk
LEFT JOIN vn.collectionColors cc ON cc.shelve = tc.`level`
AND cc.wagon = tc.wagon
AND cc.trainFk = c.trainFk
JOIN vn.sale s ON s.ticketFk = t.id
LEFT JOIN vn.saleVolume sv ON sv.saleFk = s.id
JOIN vn.item i ON i.id = s.itemFk
JOIN vn.itemType it ON it.id = i.typeFk
JOIN vn.itemCategory ic ON ic.id = it.categoryFk
JOIN vn.worker w ON w.id = c.workerFk
JOIN vn.agencyMode am ON am.id = t.agencyModeFk
LEFT JOIN vn.ticketTrolley tt ON tt.ticket = t.id
LEFT JOIN vn.`zone` zo ON t.zoneFk = zo.id
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk
LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk
WHERE IF(?, tc.collectionFk = ?, tc.ticketFk = ?)
GROUP BY t.id
ORDER BY cc.`code`;

View File

@ -0,0 +1,3 @@
SELECT IF(id, TRUE, FALSE)
FROM vn.collection
WHERE id = ?;