feat: report invoiceInPdf
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2022-10-19 15:15:54 +02:00
parent 9ef835a077
commit 4b12405586
7 changed files with 66 additions and 176 deletions

View File

@ -14,10 +14,10 @@ INSERT INTO `salix`.`AccessToken` (`id`, `ttl`, `created`, `userId`)
('DEFAULT_TOKEN', '1209600', util.VN_CURDATE(), 66);
INSERT INTO `salix`.`printConfig` (`id`, `itRecipient`, `incidencesEmail`)
VALUES
VALUES
(1, 'it@gotamcity.com', 'incidences@gotamcity.com');
INSERT INTO `vn`.`ticketConfig` (`id`, `scopeDays`)
INSERT INTO `vn`.`ticketConfig` (`id`, `scopeDays`)
VALUES
('1', '6');
@ -349,7 +349,7 @@ INSERT INTO `vn`.`clientManaCache`(`clientFk`, `mana`, `dated`)
INSERT INTO `vn`.`clientConfig`(`riskTolerance`, `maxCreditRows`)
VALUES
(200, 10);
(200, null);
INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `provinceFk`, `phone`, `mobile`, `isActive`, `clientFk`, `agencyModeFk`, `longitude`, `latitude`, `isEqualizated`, `isDefaultAddress`)
VALUES

View File

@ -46,45 +46,21 @@
<div>
{{invoice.postcodeCity}}
</div>
<div>
<div v-if="invoice.nif">
{{$t('fiscalId')}}: {{invoice.nif}}
</div>
<div>
<div v-if="invoice.phone">
{{$t('phone')}}: {{invoice.phone}}
</div>
</div>
</div>
</div>
</div>
<!--
Rectified invoices block
<div class="size100 no-page-break" v-if="rectified.length > 0">
<h2>{{$t('rectifiedInvoices')}}</h2>
<table class="column-oriented">
<thead>
<tr>
<th>{{$t('invoice')}}</th>
<th>{{$t('issued')}}</th>
<th class="number">{{$t('amount')}}</th>
<th width="50%">{{$t('description')}}</th>
</tr>
</thead>
<tbody>
<tr v-for="row in rectified">
<td>{{row.ref}}</td>
<td>{{row.issued | date}}</td>
<td class="number">{{row.amount | currency('EUR', $i18n.locale)}}</td>
<td width="50%">{{row.description}}</td>
</tr>
</tbody>
</table>
</div>
End of rectified invoices block-->
<div class="vn-mt-lg" v-for="entry in entries">
<div class="table-title clearfix">
<div class="pull-left">
<h2>{{$t('invoiceIn')}}</strong>
<h2>{{$t('invoiceId')}}</strong>
</div>
<div class="pull-left vn-mr-md">
<div class="field rectangle">
@ -153,7 +129,7 @@
<!-- End of sales block -->
<div class="columns vn-mt-xl">
Taxes block
<!-- Taxes block -->
<div id="taxes" class="size50 pull-right no-page-break" v-if="taxes">
<table class="column-oriented">
<thead>
@ -175,9 +151,9 @@
<tr v-for="tax in taxes">
<td width="45%">{{tax.name}}</td>
<td width="25%" class="number">
{{tax.base | currency('EUR', $i18n.locale)}}
{{tax.taxableBase | currency('EUR', $i18n.locale)}}
</td>
<td>{{tax.vatPercent | percentage}}</td>
<td>{{tax.rate | percentage}}</td>
<td class="number">{{tax.vat | currency('EUR', $i18n.locale)}}</td>
</tr>
</tbody>
@ -185,14 +161,14 @@
<tr class="font bold">
<td width="45%">{{$t('subtotal')}}</td>
<td width="20%" class="number">
{{sumTotal(taxes, 'base') | currency('EUR', $i18n.locale)}}
{{sumTotal(taxes, 'taxableBase') | currency('EUR', $i18n.locale)}}
</td>
<td></td>
<td class="number">{{sumTotal(taxes, 'vat') | currency('EUR', $i18n.locale)}}</td>
</tr>
<tr class="font bold">
<td colspan="2">{{$t('total')}}</td>
<td colspan="2" class="number">{{taxTotal | currency('EUR', $i18n.locale)}}</td>
<td colspan="2" class="number">{{taxTotal() | currency('EUR', $i18n.locale)}}</td>
</tr>
</tfoot>
</table>
@ -205,109 +181,30 @@
</div>
</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>{{botanical}}</span>
</div>
<div>
<strong>B</strong>
<span>ES17462130</span>
</div>
<div>
<strong>C</strong>
<span>{{ticketsId}}</span>
</div>
<div>
<strong>D</strong>
<span>ES</span>
</div>
</div>
</div>
</div>
</div>
End of phytosanitary block
</div>
Intrastat block
<div class="size100 no-page-break" v-if="intrastat.length > 0">
<h2>{{$t('intrastat')}}</h2>
<table class="column-oriented">
<thead>
<tr>
<th>{{$t('code')}}</th>
<th width="50%">{{$t('description')}}</th>
<th class="number">{{$t('stems')}}</th>
<th class="number">{{$t('netKg')}}</th>
<th class="number">{{$t('amount')}}</th>
</tr>
</thead>
<tbody>
<tr v-for="row in intrastat">
<td>{{row.code}}</td>
<td width="50%">{{row.description}}</td>
<td class="number">{{row.stems | number($i18n.locale)}}</td>
<td class="number">{{row.netKg | number($i18n.locale)}}</td>
<td class="number">{{row.subtotal | currency('EUR', $i18n.locale)}}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2"></td>
<td class="number">
<strong>{{sumTotal(intrastat, 'stems') | number($i18n.locale)}}</strong>
</td>
<td class="number">
<strong>{{sumTotal(intrastat, 'netKg') | number($i18n.locale)}}</strong>
</td>
<td class="number">
<strong>{{sumTotal(intrastat, 'subtotal') | currency('EUR', $i18n.locale)}}</strong>
</td>
</tr>
</tfoot>
</table>
</div>
End of intrastat block
Observations block
<div class="columns vn-mt-xl" v-if="invoice.payMethodCode == 'wireTransfer'">
<!-- Observations block -->
<div class="columns vn-mt-xl">
<div class="size50 pull-left no-page-break" >
<div class="panel" >
<div class="header">{{$t('observations')}}</div>
<div class="body">
<div>{{$t('wireTransfer')}}</div>
<div>{{$t('accountNumber', [invoice.iban])}}</div>
<div>{{$t('payMethod')}}</div>
<div>{{invoice.payMethod}}</div>
</div>
</div>
</div>
</div>
End of observations block
<!-- End of observations block -->
</div>
</div>
Footer block
<report-footer id="pageFooter"
v-bind:company-code="invoice.companyCode"
v-bind:left-text="$t('invoiceRef', [invoice.ref])"
v-bind:center-text="client.socialName"
v-bind="$props">
</report-footer> -->
</div>
<!-- Footer block -->
<report-footer id="pageFooter"
v-bind:left-text="$t('invoice', [invoice.id])"
v-bind:center-text="invoice.name"
v-bind="$props">
</report-footer>
</td>
</tr>
</tbody>

View File

@ -42,8 +42,9 @@ module.exports = {
fetchBuy(id) {
return this.rawSqlFromDef('buy', [id]);
},
fetchTaxes(id) {
return this.rawSqlFromDef(`taxes`, [id]);
async fetchTaxes(id) {
const taxes = await this.rawSqlFromDef(`taxes`, [id]);
return this.taxVat(taxes);
},
buyImport(buy) {
return buy.quantity * buy.buyingValue;
@ -61,6 +62,23 @@ module.exports = {
total += parseFloat(row[prop]);
return total;
},
taxVat(taxes) {
for (tax of taxes) {
let vat = 0;
if (tax.rate && tax.taxableBase)
vat = (tax.rate / 100) * tax.taxableBase;
tax.vat = vat;
}
return taxes;
},
taxTotal() {
const base = this.sumTotal(this.taxes, 'taxableBase');
const vat = this.sumTotal(this.taxes, 'vat');
return base + vat;
}
},
components: {

View File

@ -1,17 +1,16 @@
reportName: invoice
title: Invoice
invoice: Invoice
clientId: Client
title: Agrobusiness invoice
invoiceId: Agrobusiness invoice
supplierId: Proveedor
invoiceData: Invoice data
reference: Reference
fiscalId: FI / NIF
invoiceRef: Invoice {0}
deliveryNote: Delivery note
shipped: Shipped
phone: Phone
date: Date
reference: Ref.
item: Item
quantity: Qty.
concept: Concept
price: PSP/u
buyingValue: PSP/u
discount: Disc.
vat: VAT
amount: Amount
@ -22,15 +21,5 @@ fee: Fee
total: Total
subtotal: Subtotal
taxBreakdown: Tax breakdown
notes: Notes
intrastat: Intrastat
code: Code
description: Description
stems: Stems
netKg: Net kg
rectifiedInvoices: Rectified invoices
issued: Issued
plantPassport: Plant passport
observations: Observations
wireTransfer: "Pay method: Transferencia"
accountNumber: "Account number: {0}"
payMethod: Pay method

View File

@ -3,15 +3,14 @@ title: Factura Agrícola
invoiceId: Factura Agrícola
supplierId: Proveedor
invoiceData: Datos de facturación
reference: Referencia
fiscalId: CIF / NIF
invoiceRef: Factura {0}
deliveryNote: Albarán
shipped: F. envío
phone: Tlf
date: Fecha
reference: Ref.
item: Artículo
quantity: Cant.
concept: Concepto
price: PVP/u
buyingValue: PVP/u
discount: Dto.
vat: IVA
amount: Importe
@ -22,15 +21,5 @@ fee: Cuota
total: Total
subtotal: Subtotal
taxBreakdown: Desglose impositivo
notes: Notas
intrastat: Intrastat
code: Código
description: Descripción
stems: Tallos
netKg: KG Neto
rectifiedInvoices: Facturas rectificadas
issued: F. emisión
plantPassport: Pasaporte fitosanitario
observations: Observaciones
wireTransfer: "Forma de pago: Transferencia"
accountNumber: "Número de cuenta: {0}"
payMethod: Método de pago

View File

@ -5,8 +5,10 @@ SELECT
s.name,
s.street AS postalAddress,
s.nif,
s.phone
s.phone,
p.name payMethod
FROM invoiceIn i
JOIN supplier s ON s.id = i.supplierFk
JOIN company c ON c.id = i.companyFk
JOIN payMethod p ON p.id = s.payMethodFk
WHERE i.id = ?

View File

@ -1,13 +1,8 @@
SELECT
id,
invoiceInFk,
taxableBase,
expenseFk,
taxTypeSageFk,
transactionTypeSageFk,
foreignValue
FROM invoiceInTax iit
JOIN transactionTypeSage ts ON iit.transactionTypeSageFk = ts.id
JOIN taxTypeSage tts ON tts.id =
WHERE io.ref = ?
ORDER BY iot.id
ti.iva as name,
ti.PorcentajeIva as rate,
iit.taxableBase
FROM invoiceIn ii
JOIN invoiceInTax iit ON ii.id = iit.invoiceInFk
JOIN sage.TiposIva ti ON ti.CodigoIva = iit.taxTypeSageFk
WHERE ii.id = ?;