5995-newCmr #1698

Merged
guillermo merged 6 commits from 5995-newCmr into master 2023-08-03 07:09:05 +00:00
6 changed files with 22 additions and 21 deletions
Showing only changes of commit 84624935d6 - Show all commits

View File

@ -180,7 +180,7 @@
</span>
<hr>
<div class="imgSection">
<img v-bind:src="getReportSrc('signature.png')"/>
<img v-bind:src="getStamp"/>
</div>
</td>
<td>
@ -191,7 +191,7 @@
</span>
<hr>
<div class="imgSection">
<img v-bind:src="dmsPath"/>
Aquí va la el stamp
</div>
</td>
<td>
@ -202,7 +202,7 @@
</span>
<hr>
<div class="imgSection">
<img v-bind:src="dmsPath(true)"/>
<img v-bind:src="signPath"/>
</div>
</td>
</tr>

View File

@ -10,8 +10,9 @@ module.exports = {
this.data = await this.findOneFromDef('data', [this.id]);
if (this.data.ticketFk) {
this.merchandises = await this.rawSqlFromDef('merchandise', [this.data.ticketFk]);
this.signatures = await this.findOneFromDef('signatures', [this.data.ticketFk]);
}
this.signature = await this.findOneFromDef('signature', [this.data.ticketFk]);
} else
this.merchandises = null;
},
props: {
id: {
@ -20,19 +21,20 @@ module.exports = {
description: 'The cmr id'
},
},
methods: {
dmsPath(isClient) {
if (!this.signatures) return;
computed: {
signPath() {
if (!this.signature) return;
const signatureName = (isClient)
? this.signatures.clientSignature
: this.signatures.deliverySignature;
const signatureName = this.signature.signature
const hash = md5(signatureName.toString()).substring(0, 3);
const file = `${config.storage.root}/${hash}/${signatureName}.png`;
if (!fs.existsSync(file)) return null;
return `data:image/png;base64, ${Buffer.from(fs.readFileSync(file), 'utf8').toString('base64')}`;
},
async getStamp() {
const data = this.data.stamp.toString('base64');
return `data:image/png;base64, ${data}`;
}
}
},
};

View File

@ -31,7 +31,8 @@ SELECT c.id cmrFk,
a2.street loadStreet,
a2.postalCode loadPostalCode,
a2.city loadCity,
cou4.country loadCountry
cou4.country loadCountry,
co.stamp
FROM cmr c
LEFT JOIN supplier s ON s.id = c.supplierFk
LEFT JOIN country cou ON cou.id = s.countryFk

View File

@ -0,0 +1,5 @@
SELECT dc.id `signature`
FROM ticket t
JOIN ticketDms dt ON dt.ticketFk = t.id
LEFT JOIN dms dc ON dc.id = dt.dmsFk
WHERE t.id = ?

View File

@ -1,7 +0,0 @@
SELECT dc.id clientSignature, dd.id deliverySignature
FROM ticket t
JOIN ticketDms dt ON dt.ticketFk = t.id
LEFT JOIN dms dc ON dc.id = dt.dmsFk
JOIN `route` r ON r.id = t.routeFk
LEFT JOIN dms dd ON dd.id = r.deliverySignFk
WHERE t.id = ?