Merge pull request '2847 - Driver route now shows item packaging type' (#671) from 2847-driver_route into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #671
Reviewed-by: Carlos Jimenez Ruiz <carlosjr@verdnatura.es>
This commit is contained in:
Carlos Jimenez Ruiz 2021-07-01 08:19:56 +00:00
commit b4d46f6876
5 changed files with 182 additions and 172 deletions

View File

@ -18,20 +18,15 @@
"acquireTimeout": 20000 "acquireTimeout": 20000
}, },
"osticket": { "osticket": {
"connector": "vn-mysql", "connector": "memory",
"database": "vn", "timezone": "local"
"debug": false,
"host": "localhost",
"port": "3306",
"username": "root",
"password": "root"
}, },
"tempStorage": { "tempStorage": {
"name": "tempStorage", "name": "tempStorage",
"connector": "loopback-component-storage", "connector": "loopback-component-storage",
"provider": "filesystem", "provider": "filesystem",
"root": "./storage/tmp", "root": "./storage/tmp",
"maxFileSize": "262144000", "maxFileSize": "262144000",
"allowedContentTypes": [ "allowedContentTypes": [
"application/x-7z-compressed", "application/x-7z-compressed",
"application/x-zip-compressed", "application/x-zip-compressed",
@ -41,17 +36,17 @@
"application/zip", "application/zip",
"application/rar", "application/rar",
"multipart/x-zip", "multipart/x-zip",
"image/png", "image/png",
"image/jpeg", "image/jpeg",
"image/jpg" "image/jpg"
] ]
}, },
"dmsStorage": { "dmsStorage": {
"name": "dmsStorage", "name": "dmsStorage",
"connector": "loopback-component-storage", "connector": "loopback-component-storage",
"provider": "filesystem", "provider": "filesystem",
"root": "./storage/dms", "root": "./storage/dms",
"maxFileSize": "262144000", "maxFileSize": "262144000",
"allowedContentTypes": [ "allowedContentTypes": [
"application/x-7z-compressed", "application/x-7z-compressed",
"application/x-zip-compressed", "application/x-zip-compressed",
@ -61,32 +56,32 @@
"application/zip", "application/zip",
"application/rar", "application/rar",
"multipart/x-zip", "multipart/x-zip",
"image/png", "image/png",
"image/jpeg", "image/jpeg",
"image/jpg" "image/jpg"
] ]
}, },
"imageStorage": { "imageStorage": {
"name": "imageStorage", "name": "imageStorage",
"connector": "loopback-component-storage", "connector": "loopback-component-storage",
"provider": "filesystem", "provider": "filesystem",
"root": "./storage/image", "root": "./storage/image",
"maxFileSize": "52428800", "maxFileSize": "52428800",
"allowedContentTypes": [ "allowedContentTypes": [
"image/png", "image/png",
"image/jpeg", "image/jpeg",
"image/jpg" "image/jpg"
] ]
}, },
"invoiceStorage": { "invoiceStorage": {
"name": "invoiceStorage", "name": "invoiceStorage",
"connector": "loopback-component-storage", "connector": "loopback-component-storage",
"provider": "filesystem", "provider": "filesystem",
"root": "./storage/pdfs/invoice", "root": "./storage/pdfs/invoice",
"maxFileSize": "52428800", "maxFileSize": "52428800",
"allowedContentTypes": [ "allowedContentTypes": [
"application/octet-stream", "application/octet-stream",
"application/pdf" "application/pdf"
] ]
} }
} }

View File

@ -1,163 +1,166 @@
<!DOCTYPE html> <!DOCTYPE html>
<html v-bind:lang="$i18n.locale"> <html v-bind:lang="$i18n.locale">
<body> <body>
<table class="grid"> <table class="grid">
<tbody> <tbody>
<tr> <tr>
<td> <td>
<!-- Header block --> <!-- Header block -->
<report-header v-bind="$props"></report-header> <report-header v-bind="$props"></report-header>
<!-- Block --> <!-- Block -->
<div class="grid-row route-block" v-for="route in routes"> <div class="grid-row route-block" v-for="route in routes">
<div class="grid-block"> <div class="grid-block">
<h1 class="title uppercase">{{$t('route')}} {{route.id}}</h1> <h1 class="title uppercase">{{$t('route')}} {{route.id}}</h1>
<div class="panel"> <div class="panel">
<div class="header">{{$t('information')}}</div> <div class="header">{{$t('information')}}</div>
<div class="body"> <div class="body">
<div>
<table width="100%">
<tbody>
<tr>
<th class="font gray align-right">{{$t('route')}}</th>
<td>{{route.id}}</td>
<th class="font gray align-right">{{$t('driver')}}</th>
<td>{{route.userNickName}}</td>
</tr>
<tr>
<th class="font gray align-right">{{$t('date')}}</th>
<td>{{route.created | date('%d-%m-%Y')}}</td>
<th class="font gray align-right">{{$t('vehicle')}}</th>
<td>{{route.vehicleTradeMark}} {{route.vehicleModel}}</td>
</tr>
<tr>
<th class="font gray align-right">{{$t('time')}}</th>
<td>{{route.time | date('%H:%M')}}</td>
<td></td>
<td>{{route.plateNumber}}</td>
</tr>
<tr>
<th class="font gray align-right">{{$t('volume')}}</th>
<td>{{route.m3}}</td>
<th class="font gray align-right">{{$t('agency')}}</th>
<td>{{route.agencyName}}</td>
</tr>
</tbody>
</table>
<div class="contained">
<table class="middle centered" width="70%">
<tbody>
<tr>
<td>
<p class="small">Hora inicio</p>
</td>
<td>
<p class="small">Hora fin</p>
</td>
<td class="gap"></td>
<td>
<p class="small">Km inicio</p>
</td>
<td>
<p class="small">Km fin</p>
</td>
</tr>
<tr>
<td v-for="i in 2">
<div class="field rectangle">
<span></span>
</div>
</td>
<td class="gap"></td>
<td v-for="i in 2">
<div class="field rectangle">
<span></span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Route ticket list -->
<div class="no-page-break" v-for="ticket in route.tickets">
<div>
<table class="column-oriented repeatable">
<thead>
<tr>
<th class="number">{{$t('order')}}</th>
<th class="number">{{$t('ticket')}}</th>
<th width="50%">{{$t('client')}}</th>
<th class="number">{{$t('address')}}</th>
<th class="number">{{$t('packages')}}</th>
</tr>
</thead>
<tbody>
<tr>
<td class="number">{{ticket.priority}}</td>
<td class="number">{{ticket.id}}</td>
<td width="50%">{{ticket.clientFk}} {{ticket.addressName}}</td>
<td v-if="ticket.addressFk" class="number">
{{ticket.addressFk.toString().substr(0, ticket.addressFk.toString().length - 3)}}
<span class="black-container">
{{ticket.addressFk.toString().substr(-3, 3)}}
</span>
</td>
<td class="number">{{ticket.packages}}</td>
</tr>
</tbody>
</table>
</div>
<div> <div>
<table width="100%"> <table width="100%">
<tbody> <tbody>
<tr> <tr>
<th class="font gray align-right">{{$t('street')}}</th> <th class="font gray align-right">{{$t('route')}}</th>
<td>{{ticket.street}}</td> <td>{{route.id}}</td>
<th class="font gray align-right">{{$t('postcode')}}</th> <th class="font gray align-right">{{$t('driver')}}</th>
<td>{{ticket.postalCode}}</td> <td>{{route.userNickName}}</td>
</tr> </tr>
<tr> <tr>
<th class="font gray align-right">{{$t('city')}}</th> <th class="font gray align-right">{{$t('date')}}</th>
<td>{{ticket.city}}</td> <td>{{route.created | date('%d-%m-%Y')}}</td>
<th class="font gray align-right">{{$t('vehicle')}}</th>
<td>{{route.vehicleTradeMark}} {{route.vehicleModel}}</td>
</tr>
<tr>
<th class="font gray align-right">{{$t('time')}}</th>
<td>{{route.time | date('%H:%M')}}</td>
<td></td>
<td>{{route.plateNumber}}</td>
</tr>
<tr>
<th class="font gray align-right">{{$t('volume')}}</th>
<td>{{route.m3}}</td>
<th class="font gray align-right">{{$t('agency')}}</th> <th class="font gray align-right">{{$t('agency')}}</th>
<td>{{ticket.ticketAgency}}</td> <td>{{route.agencyName}}</td>
</tr>
<tr>
<th class="font gray align-right">{{$t('mobile')}}</th>
<td>{{ticket.mobile}}</td>
<th class="font gray align-right">{{$t('phone')}}</th>
<td>{{ticket.phone}}</td>
</tr>
<tr>
<th class="font gray align-right">{{$t('warehouse')}}</th>
<td>{{ticket.warehouseName}}</td>
<th class="font gray align-right">{{$t('salesPerson')}}</th>
<td>{{ticket.salesPersonName}}</td>
</tr>
<tr>
<th class="font gray align-right">{{$t('import')}}</th>
<td>{{ticket.import | currency('EUR', $i18n.locale)}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div v-if="ticket.description || ticket.shipFk" class="text-area"> <div class="contained">
<p>{{ticket.description}}</p> <table class="middle centered" width="70%">
<p v-if="ticket.shipFk">{{$t('stowaway')}}: {{ticket.shipFk}}</p> <tbody>
<tr>
<td>
<p class="small">Hora inicio</p>
</td>
<td>
<p class="small">Hora fin</p>
</td>
<td class="gap"></td>
<td>
<p class="small">Km inicio</p>
</td>
<td>
<p class="small">Km fin</p>
</td>
</tr>
<tr>
<td v-for="i in 2">
<div class="field rectangle">
<span></span>
</div>
</td>
<td class="gap"></td>
<td v-for="i in 2">
<div class="field rectangle">
<span></span>
</div>
</td>
</tr>
</tbody>
</table>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- Route ticket list -->
<div class="no-page-break" v-for="ticket in route.tickets">
<div>
<table class="column-oriented repeatable">
<thead>
<tr>
<th class="number">{{$t('order')}}</th>
<th class="number">{{$t('ticket')}}</th>
<th width="50%">{{$t('client')}}</th>
<th class="number">{{$t('address')}}</th>
<th class="number">{{$t('packages')}}</th>
<th>{{$t('packagingType')}}</th>
</tr>
</thead>
<tbody>
<tr>
<td class="number">{{ticket.priority}}</td>
<td class="number">{{ticket.id}}</td>
<td width="50%">{{ticket.clientFk}} {{ticket.addressName}}</td>
<td v-if="ticket.addressFk" class="number">
{{ticket.addressFk.toString().substr(0,
ticket.addressFk.toString().length - 3)}}
<span class="black-container">
{{ticket.addressFk.toString().substr(-3, 3)}}
</span>
</td>
<td class="number">{{ticket.packages}}</td>
<td>{{ticket.itemPackingTypes}}</td>
</tr>
</tbody>
</table>
</div>
<div>
<table width="100%">
<tbody>
<tr>
<th class="font gray align-right">{{$t('street')}}</th>
<td>{{ticket.street}}</td>
<th class="font gray align-right">{{$t('postcode')}}</th>
<td>{{ticket.postalCode}}</td>
</tr>
<tr>
<th class="font gray align-right">{{$t('city')}}</th>
<td>{{ticket.city}}</td>
<th class="font gray align-right">{{$t('agency')}}</th>
<td>{{ticket.ticketAgency}}</td>
</tr>
<tr>
<th class="font gray align-right">{{$t('mobile')}}</th>
<td>{{ticket.mobile}}</td>
<th class="font gray align-right">{{$t('phone')}}</th>
<td>{{ticket.phone}}</td>
</tr>
<tr>
<th class="font gray align-right">{{$t('warehouse')}}</th>
<td>{{ticket.warehouseName}}</td>
<th class="font gray align-right">{{$t('salesPerson')}}</th>
<td>{{ticket.salesPersonName}}</td>
</tr>
<tr>
<th class="font gray align-right">{{$t('import')}}</th>
<td>{{ticket.import | currency('EUR', $i18n.locale)}}</td>
</tr>
</tbody>
</table>
<div v-if="ticket.description || ticket.shipFk" class="text-area">
<p>{{ticket.description}}</p>
<p v-if="ticket.shipFk">{{$t('stowaway')}}: {{ticket.shipFk}}</p>
</div>
</div>
</div>
</div> </div>
<!-- Footer block --> </div>
<report-footer id="pageFooter" <!-- Footer block -->
v-bind:left-text="$t('routeId', [routeId])" <report-footer id="pageFooter"
v-bind="$props"> v-bind:left-text="$t('routeId', [routeId])"
</report-footer> v-bind="$props">
</td> </report-footer>
</tr> </td>
</tbody> </tr>
</table> </tbody>
</body> </table>
</body>
</html> </html>

View File

@ -30,7 +30,7 @@ module.exports = {
return this.rawSqlFromDef('routes', [routesId]); return this.rawSqlFromDef('routes', [routesId]);
}, },
fetchTickets(routesId) { fetchTickets(routesId) {
return this.rawSqlFromDef('tickets', [routesId]); return this.rawSqlFromDef('tickets', [routesId, routesId]);
} }
}, },
components: { components: {

View File

@ -10,6 +10,7 @@ order: Orden
client: Cliente client: Cliente
address: Consignatario address: Consignatario
packages: Bultos packages: Bultos
packagingType: Encajado
street: Dirección street: Dirección
postcode: Código Postal postcode: Código Postal
city: Ciudad city: Ciudad

View File

@ -18,8 +18,9 @@ SELECT
am.name ticketAgency, am.name ticketAgency,
tob.description, tob.description,
s.shipFk, s.shipFk,
u.nickName salesPersonName u.nickName salesPersonName,
FROM route r ipkg.itemPackingTypes
FROM route r
LEFT JOIN ticket t ON t.routeFk = r.id LEFT JOIN ticket t ON t.routeFk = r.id
LEFT JOIN address a ON a.id = t.addressFk LEFT JOIN address a ON a.id = t.addressFk
LEFT JOIN client c ON c.id = t.clientFk LEFT JOIN client c ON c.id = t.clientFk
@ -30,5 +31,15 @@ FROM route r
LEFT JOIN warehouse wh ON wh.id = t.warehouseFk LEFT JOIN warehouse wh ON wh.id = t.warehouseFk
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
LEFT JOIN stowaway s ON s.id = t.id LEFT JOIN stowaway s ON s.id = t.id
WHERE r.id IN(?) LEFT JOIN (
ORDER BY t.priority, t.id SELECT t.id AS ticketFk,
GROUP_CONCAT(DISTINCT(i.itemPackingTypeFk)) AS itemPackingTypes
FROM route r
JOIN ticket t ON t.routeFk = r.id
JOIN sale s ON s.ticketFk = t.id
JOIN item i ON i.id = s.itemFk
WHERE r.id IN (?)
GROUP BY t.id
) ipkg ON ipkg.ticketFk = t.id
WHERE r.id IN (?)
ORDER BY t.priority, t.id;