refs #4650 cambios en la query
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Alexandre Riera 2022-10-25 15:03:09 +02:00
parent 67402dfe5e
commit 7948523685
3 changed files with 300 additions and 295 deletions

View File

@ -1,299 +1,304 @@
<!DOCTYPE html> <!DOCTYPE html>
<html v-bind:lang="$i18n.locale"> <html v-bind:lang="$i18n.locale">
<body>
<table class="grid">
<tbody>
<tr>
<td>
<!-- Header block -->
<report-header v-bind="$props"
v-bind:company-code="ticket.companyCode">
</report-header>
<!-- Block -->
<div class="grid-row">
<div class="grid-block">
<div class="columns">
<div class="size50">
<div class="size75 vn-mt-ml">
<h1 class="title uppercase">{{$t(deliverNoteType)}}</h1>
<table class="row-oriented ticket-info">
<tbody>
<tr>
<td class="font gray uppercase">{{$t('clientId')}}</td>
<th>{{client.id}}</th>
</tr>
<tr>
<td class="font gray uppercase">{{$t(deliverNoteType)}}</td>
<th>{{ticket.id}}</th>
</tr>
<tr>
<td class="font gray uppercase">{{$t('date')}}</td>
<th>{{ticket.shipped | date('%d-%m-%Y')}}</th>
</tr>
<tr>
<td class="font gray uppercase">{{$t('packages')}}</td>
<th>{{ticket.packages}}</th>
</tr>
</tbody>
</table>
</div>
</div>
<div class="size50">
<div class="panel">
<div class="header">{{$t('deliveryAddress')}}</div>
<div class="body">
<h3 class="uppercase">{{address.nickname}}</h3>
<div>
{{address.street}}
</div>
<div>
{{address.postalCode}}, {{address.city}} ({{address.province}})
</div>
</div>
</div>
<div class="panel">
<div class="header">{{$t('fiscalData')}}</div>
<div class="body">
<div>
{{client.socialName}}
</div>
<div>
{{client.street}}
</div>
<div>
{{client.fi}}
</div>
</div>
</div>
</div>
</div>
<!-- Sales block -->
<h2>{{$t('saleLines')}}</h2>
<table class="column-oriented">
<thead>
<tr>
<th width="5%">{{$t('reference')}}</th>
<th class="number">{{$t('quantity')}}</th>
<th width="50%">{{$t('concept')}}</th>
<th class="number" v-if="showPrices">{{$t('price')}}</th>
<th class="centered" width="5%" v-if="showPrices">{{$t('discount')}}</th>
<th class="centered" v-if="showPrices">{{$t('vat')}}</th>
<th class="number" v-if="showPrices">{{$t('amount')}}</th>
</tr>
</thead>
<tbody v-for="sale in sales" class="no-page-break">
<tr>
<td width="5%">{{sale.itemFk | zerofill('000000')}}</td>
<td class="number">{{sale.quantity}}</td>
<td width="50%">{{sale.concept}}</td>
<td class="number" v-if="showPrices">{{sale.price | currency('EUR', $i18n.locale)}}</td>
<td class="centered" width="5%" v-if="showPrices">{{(sale.discount / 100) | percentage}}</td>
<td class="centered" v-if="showPrices">{{sale.vatType}}</td>
<td class="number" v-if="showPrices">{{sale.price * sale.quantity * (1 - sale.discount / 100) | currency('EUR', $i18n.locale)}}</td>
</tr>
<tr class="description font light-gray">
<td colspan="7">
<span v-if="sale.value5">
<strong>{{sale.tag5}}</strong> {{sale.value5}}
</span>
<span v-if="sale.value6">
<strong>{{sale.tag6}}</strong> {{sale.value6}}
</span>
<span v-if="sale.value7">
<strong>{{sale.tag7}}</strong> {{sale.value7}}
</span>
</td>
</tr>
</tbody>
<tfoot v-if="showPrices">
<tr>
<td colspan="6" class="font bold">
<span class="pull-right">{{$t('subtotal')}}</span>
</td>
<td class="number">{{getSubTotal() | currency('EUR', $i18n.locale)}}</td>
</tr>
</tfoot>
</table>
<!-- End of sales block -->
<div class="columns vn-mb-ml">
<!-- Services block-->
<div class="size100 no-page-break" v-if="services.length > 0">
<h2>{{$t('services.title')}}</h2>
<table class="column-oriented">
<thead>
<tr>
<th width="5%"></th>
<th class="number">{{$t('services.theader.quantity')}}</th>
<th width="50%">{{$t('services.theader.concept')}}</th>
<th class="number">{{$t('services.theader.price')}}</th>
<th class="centered" width="5%"></th>
<th class="centered">{{$t('services.theader.vat')}}</th>
<th class="number">{{$t('services.theader.amount')}}</th>
</tr>
</thead>
<tbody>
<tr v-for="service in services">
<td width="5%"></td>
<td class="number">{{service.quantity}}</td>
<td width="50%">{{service.description}}</td>
<td class="number">{{service.price | currency('EUR', $i18n.locale)}}</td>
<td class="centered" width="5%"></td>
<td class="centered">{{service.taxDescription}}</td>
<td class="number">{{service.price | currency('EUR', $i18n.locale)}}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="6" class="font bold">
<span class="pull-right">{{$t('services.tfoot.subtotal')}}</span>
</td>
<td class="number">{{serviceTotal | currency('EUR', $i18n.locale)}}</td>
</tr>
</tfoot>
</table>
<span class="font gray">* {{ $t('services.warning') }}</span>
</div>
<!-- End of services block -->
</div>
<div class="columns">
<!-- Packages block -->
<div id="packagings" class="size100 no-page-break" v-if="packagings.length > 0">
<h2>{{$t('packagings.title')}}</h2>
<table class="column-oriented">
<thead>
<tr>
<th>{{$t('packagings.theader.reference')}}</th>
<th class="number">{{$t('packagings.theader.quantity')}}</th>
<th wihth="75%">{{$t('packagings.theader.concept')}}</th>
</tr>
</thead>
<tbody>
<tr v-for="packaging in packagings">
<td>{{packaging.itemFk | zerofill('000000')}}</td>
<td class="number">{{packaging.quantity}}</td>
<td width="85%">{{packaging.name}}</td>
</tr>
</tbody>
</table>
</div>
<!-- End of packages block -->
</div>
<div class="columns vn-mt-xl" v-if="showPrices">
<!-- Taxes block -->
<div id="taxes" class="size50 pull-right no-page-break" v-if="taxes">
<table class="column-oriented">
<thead>
<tr>
<th colspan="4">{{$t('taxes.title')}}</th>
</tr>
</thead>
<thead class="light">
<tr>
<th width="45%">{{$t('taxes.theader.type')}}</th>
<th width="25%" class="number">{{$t('taxes.theader.taxBase')}}</th>
<th>{{$t('taxes.theader.tax')}}</th>
<th class="number">{{$t('taxes.theader.fee')}}</th>
</tr>
</thead>
<tbody>
<tr v-for="tax in taxes">
<td width="45%">{{tax.name}}</td>
<td width="25%" class="number">
{{tax.Base | currency('EUR', $i18n.locale)}}
</td>
<td>{{tax.vatPercent | percentage}}</td>
<td class="number">{{tax.tax | currency('EUR', $i18n.locale)}}</td>
</tr>
</tbody>
<tfoot>
<tr class="font bold">
<td width="45%">{{$t('subtotal')}}</td>
<td width="20%" class="number">
{{getTotalBase() | currency('EUR', $i18n.locale)}}
</td>
<td></td>
<td class="number">{{getTotalTax()| currency('EUR', $i18n.locale)}}</td>
</tr>
<tr class="font bold">
<td colspan="2">{{$t('total')}}</td>
<td colspan="2" class="number">{{getTotal() | currency('EUR', $i18n.locale)}}</td>
</tr>
</tfoot>
</table>
</div>
<!-- End of taxes block -->
<!-- Phytosanitary block --> <body>
<div id="phytosanitary" class="size50 pull-left no-page-break"> <table class="grid">
<div class="panel"> <tbody>
<div class="body"> <tr>
<div class="flag"> <td>
<div class="columns"> <!-- Header block -->
<div class="size25"> <report-header v-bind="$props" v-bind:company-code="ticket.companyCode">
<img v-bind:src="getReportSrc('europe.png')"/> </report-header>
</div> <!-- Block -->
<div class="size75 flag-text"> <div class="grid-row">
<strong>{{$t('plantPassport')}}</strong><br/> <div class="grid-block">
</div> <div class="columns">
</div> <div class="size50">
</div> <div class="size75 vn-mt-ml">
<div class="phytosanitary-info"> <h1 class="title uppercase">{{$t(deliverNoteType)}}</h1>
<div> <table class="row-oriented ticket-info">
<strong>A</strong> <tbody>
<span>{{getBotanical()}}</span> <tr>
</div> <td class="font gray uppercase">{{$t('clientId')}}</td>
<div> <th>{{client.id}}</th>
<strong>B</strong> </tr>
<span>ES17462130</span> <tr>
</div> <td class="font gray uppercase">{{$t(deliverNoteType)}}</td>
<div> <th>{{ticket.id}}</th>
<strong>C</strong> </tr>
<span>{{ticket.id}}</span> <tr>
</div> <td class="font gray uppercase">{{$t('date')}}</td>
<div> <th>{{ticket.shipped | date('%d-%m-%Y')}}</th>
<strong>D</strong> </tr>
<span>ES</span> <tr>
</div> <td class="font gray uppercase">{{$t('packages')}}</td>
</div> <th>{{ticket.packages}}</th>
</div> </tr>
</div> </tbody>
</table>
</div> </div>
<!-- End of phytosanitary block -->
</div> </div>
<div class="columns vn-mb-ml"> <div class="size50">
<!-- Observations block--> <div class="panel">
<div class="size100 no-page-break" v-if="hasObservations"> <div class="header">{{$t('deliveryAddress')}}</div>
<h2>{{$t('observations')}}</h2> <div class="body">
<p class="observations">{{ticket.description}}</p> <h3 class="uppercase">{{address.nickname}}</h3>
</div> <div>
<div class="columns"> {{address.street}}
<!-- Signature block --> </div>
<div class="size50 pull-left no-page-break"> <div>
<div id="signature" class="panel" v-if="signature && signature.id"> {{address.postalCode}}, {{address.city}} ({{address.province}})
<div class="header">{{$t('digitalSignature')}}</div>
<div class="body centered">
<img v-bind:src="dmsPath"/>
<div>{{signature.created | date('%d-%m-%Y')}}</div>
</div> </div>
</div> </div>
</div> </div>
<!-- End of signature block -->
<div class="panel">
<div class="header">{{$t('fiscalData')}}</div>
<div class="body">
<div>
{{client.socialName}}
</div>
<div>
{{client.street}}
</div>
<div>
{{client.fi}}
</div>
</div>
</div>
</div>
</div>
<!-- Sales block -->
<h2>{{$t('saleLines')}}</h2>
<table class="column-oriented">
<thead>
<tr>
<th width="5%">{{$t('reference')}}</th>
<th class="number">{{$t('quantity')}}</th>
<th width="50%">{{$t('concept')}}</th>
<th class="number" v-if="showPrices">{{$t('price')}}</th>
<th class="centered" width="5%" v-if="showPrices">{{$t('discount')}}</th>
<th class="centered" v-if="showPrices">{{$t('vat')}}</th>
<th class="number" v-if="showPrices">{{$t('amount')}}</th>
</tr>
</thead>
<tbody v-for="sale in sales" class="no-page-break">
<tr>
<td width="5%">{{sale.itemFk | zerofill('000000')}}</td>
<td class="number">{{sale.quantity}}</td>
<td width="50%">{{sale.concept}}</td>
<td class="number" v-if="showPrices">{{sale.price | currency('EUR',
$i18n.locale)}}</td>
<td class="centered" width="5%" v-if="showPrices">{{(sale.discount / 100) |
percentage}}</td>
<td class="centered" v-if="showPrices">{{sale.vatType}}</td>
<td class="number" v-if="showPrices">{{sale.price * sale.quantity * (1 -
sale.discount / 100) | currency('EUR', $i18n.locale)}}</td>
</tr>
<tr class="description font light-gray">
<td colspan="7">
<span v-if="sale.value5">
<strong>{{sale.tag5}}</strong> {{sale.value5}}
</span>
<span v-if="sale.value6">
<strong>{{sale.tag6}}</strong> {{sale.value6}}
</span>
<span v-if="sale.value7">
<strong>{{sale.tag7}}</strong> {{sale.value7}}
</span>
</td>
</tr>
</tbody>
<tfoot v-if="showPrices">
<tr>
<td colspan="6" class="font bold">
<span class="pull-right">{{$t('subtotal')}}</span>
</td>
<td class="number">{{getSubTotal() | currency('EUR', $i18n.locale)}}</td>
</tr>
</tfoot>
</table>
<!-- End of sales block -->
<div class="columns vn-mb-ml">
<!-- Services block-->
<div class="size100 no-page-break" v-if="services.length > 0">
<h2>{{$t('services.title')}}</h2>
<table class="column-oriented">
<thead>
<tr>
<th width="5%"></th>
<th class="number">{{$t('services.theader.quantity')}}</th>
<th width="50%">{{$t('services.theader.concept')}}</th>
<th class="number">{{$t('services.theader.price')}}</th>
<th class="centered" width="5%"></th>
<th class="centered">{{$t('services.theader.vat')}}</th>
<th class="number">{{$t('services.theader.amount')}}</th>
</tr>
</thead>
<tbody>
<tr v-for="service in services">
<td width="5%"></td>
<td class="number">{{service.quantity}}</td>
<td width="50%">{{service.description}}</td>
<td class="number">{{service.price | currency('EUR', $i18n.locale)}}
</td>
<td class="centered" width="5%"></td>
<td class="centered">{{service.taxDescription}}</td>
<td class="number">{{service.price | currency('EUR', $i18n.locale)}}
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="6" class="font bold">
<span class="pull-right">{{$t('services.tfoot.subtotal')}}</span>
</td>
<td class="number">{{serviceTotal | currency('EUR', $i18n.locale)}}</td>
</tr>
</tfoot>
</table>
<span class="font gray">* {{ $t('services.warning') }}</span>
</div>
<!-- End of services block -->
</div>
<div class="columns">
<!-- Packages block -->
<div id="packagings" class="size100 no-page-break" v-if="packagings.length > 0">
<h2>{{$t('packagings.title')}}</h2>
<table class="column-oriented">
<thead>
<tr>
<th>{{$t('packagings.theader.reference')}}</th>
<th class="number">{{$t('packagings.theader.quantity')}}</th>
<th wihth="75%">{{$t('packagings.theader.concept')}}</th>
</tr>
</thead>
<tbody>
<tr v-for="packaging in packagings">
<td>{{packaging.itemFk | zerofill('000000')}}</td>
<td class="number">{{packaging.quantity}}</td>
<td width="85%">{{packaging.name}}</td>
</tr>
</tbody>
</table>
</div>
<!-- End of packages block -->
</div>
<div class="columns vn-mt-xl" v-if="showPrices">
<!-- Taxes block -->
<div id="taxes" class="size50 pull-right no-page-break" v-if="taxes">
<table class="column-oriented">
<thead>
<tr>
<th colspan="4">{{$t('taxes.title')}}</th>
</tr>
</thead>
<thead class="light">
<tr>
<th width="45%">{{$t('taxes.theader.type')}}</th>
<th width="25%" class="number">{{$t('taxes.theader.taxBase')}}</th>
<th>{{$t('taxes.theader.tax')}}</th>
<th class="number">{{$t('taxes.theader.fee')}}</th>
</tr>
</thead>
<tbody>
<tr v-for="tax in taxes">
<td width="45%">{{tax.name}}</td>
<td width="25%" class="number">
{{tax.Base | currency('EUR', $i18n.locale)}}
</td>
<td>{{tax.vatPercent | percentage}}</td>
<td class="number">{{tax.tax | currency('EUR', $i18n.locale)}}</td>
</tr>
</tbody>
<tfoot>
<tr class="font bold">
<td width="45%">{{$t('subtotal')}}</td>
<td width="20%" class="number">
{{getTotalBase() | currency('EUR', $i18n.locale)}}
</td>
<td></td>
<td class="number">{{getTotalTax()| currency('EUR', $i18n.locale)}}</td>
</tr>
<tr class="font bold">
<td colspan="2">{{$t('total')}}</td>
<td colspan="2" class="number">{{getTotal() | currency('EUR',
$i18n.locale)}}</td>
</tr>
</tfoot>
</table>
</div>
<!-- End of taxes block -->
<!-- Phytosanitary block -->
<div id="phytosanitary" class="size50 pull-left no-page-break">
<div class="panel">
<div class="body">
<div class="flag">
<div class="columns">
<div class="size25">
<img v-bind:src="getReportSrc('europe.png')" />
</div>
<div class="size75 flag-text">
<strong>{{$t('plantPassport')}}</strong><br />
</div>
</div>
</div>
<div class="phytosanitary-info">
<div>
<strong>A</strong>
<span>{{getBotanical()}}</span>
</div>
<div>
<strong>B</strong>
<span>ES17462130</span>
</div>
<div>
<strong>C</strong>
<span>{{ticket.id}}</span>
</div>
<div>
<strong>D</strong>
<span>ES</span>
</div>
</div>
</div>
</div>
</div>
<!-- End of phytosanitary block -->
</div>
<div class="columns">
<!-- Signature block -->
<div class="size50 pull-left no-page-break">
<div id="signature" class="panel" v-if="signature && signature.id">
<div class="header">{{$t('digitalSignature')}}</div>
<div class="body centered">
<img v-bind:src="dmsPath" />
<div>{{signature.created | date('%d-%m-%Y')}}</div>
</div>
</div>
</div>
<!-- End of signature block -->
</div>
<div class="columns vn-mb-ml" v-if="hasObservations">
<!-- Observations block-->
<div class="size100 no-page-break">
<h2>{{$t('observations')}}</h2>
<p class="observations">{{ticket.description}}</p>
</div> </div>
</div> </div>
</div> </div>
<!-- Footer block --> </div>
<report-footer id="pageFooter" <!-- Footer block -->
v-bind:company-code="ticket.companyCode" <report-footer id="pageFooter" v-bind:company-code="ticket.companyCode"
v-bind:left-text="footerType" v-bind:left-text="footerType" v-bind:center-text="client.socialName" v-bind="$props">
v-bind:center-text="client.socialName" </report-footer>
v-bind="$props"> </td>
</report-footer> </tr>
</td> </tbody>
</tr> </table>
</tbody> </body>
</table>
</body>
</html> </html>

View File

@ -54,6 +54,9 @@ module.exports = {
footerType() { footerType() {
const translatedType = this.$t(this.deliverNoteType); const translatedType = this.$t(this.deliverNoteType);
return `${translatedType} ${this.id}`; return `${translatedType} ${this.id}`;
},
hasObservations() {
return this.ticket.description !== null;
} }
}, },
@ -120,9 +123,6 @@ module.exports = {
return phytosanitary.filter((item, index) => return phytosanitary.filter((item, index) =>
phytosanitary.indexOf(item) == index phytosanitary.indexOf(item) == index
).join(', '); ).join(', ');
},
hasObservations() {
return this.ticket.code == 'deliveryNote' && this.ticket.description != null;
} }
}, },
components: { components: {

View File

@ -3,10 +3,10 @@ SELECT
t.shipped, t.shipped,
c.code companyCode, c.code companyCode,
t.packages, t.packages,
tto.description, tto.description
ot.code
FROM ticket t FROM ticket t
JOIN company c ON c.id = t.companyFk JOIN company c ON c.id = t.companyFk
LEFT JOIN ticketObservation tto ON tto.ticketFk = t.id LEFT JOIN ticketObservation tto
LEFT JOIN observationType ot ON tto.observationTypeFk = ot.id ON tto.ticketFk = t.id
WHERE t.id = 1; AND tto.observationTypeFk = (SELECT id FROM observationType WHERE code = 'deliveryNote')
WHERE t.id = ?