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

View File

@ -10,8 +10,9 @@ module.exports = {
this.data = await this.findOneFromDef('data', [this.id]); this.data = await this.findOneFromDef('data', [this.id]);
if (this.data.ticketFk) { if (this.data.ticketFk) {
this.merchandises = await this.rawSqlFromDef('merchandise', [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: { props: {
id: { id: {
@ -20,19 +21,20 @@ module.exports = {
description: 'The cmr id' description: 'The cmr id'
}, },
}, },
methods: { computed: {
dmsPath(isClient) { signPath() {
if (!this.signatures) return; if (!this.signature) return;
const signatureName = (isClient) const signatureName = this.signature.signature
? this.signatures.clientSignature
: this.signatures.deliverySignature;
const hash = md5(signatureName.toString()).substring(0, 3); const hash = md5(signatureName.toString()).substring(0, 3);
const file = `${config.storage.root}/${hash}/${signatureName}.png`; const file = `${config.storage.root}/${hash}/${signatureName}.png`;
if (!fs.existsSync(file)) return null; if (!fs.existsSync(file)) return null;
return `data:image/png;base64, ${Buffer.from(fs.readFileSync(file), 'utf8').toString('base64')}`; 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.street loadStreet,
a2.postalCode loadPostalCode, a2.postalCode loadPostalCode,
a2.city loadCity, a2.city loadCity,
cou4.country loadCountry cou4.country loadCountry,
co.stamp
FROM cmr c FROM cmr c
LEFT JOIN supplier s ON s.id = c.supplierFk LEFT JOIN supplier s ON s.id = c.supplierFk
LEFT JOIN country cou ON cou.id = s.countryFk 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 = ?