2734 - Added invoice report
This commit is contained in:
parent
661950f94a
commit
af5f0db7f8
|
@ -0,0 +1,9 @@
|
||||||
|
const Stylesheet = require(`${appPath}/core/stylesheet`);
|
||||||
|
|
||||||
|
module.exports = new Stylesheet([
|
||||||
|
`${appPath}/common/css/spacing.css`,
|
||||||
|
`${appPath}/common/css/misc.css`,
|
||||||
|
`${appPath}/common/css/layout.css`,
|
||||||
|
`${appPath}/common/css/report.css`,
|
||||||
|
`${__dirname}/style.css`])
|
||||||
|
.mergeStyles();
|
|
@ -0,0 +1,40 @@
|
||||||
|
#signature {
|
||||||
|
padding-right: 10px
|
||||||
|
}
|
||||||
|
|
||||||
|
#signature img {
|
||||||
|
-webkit-filter: brightness(0%);
|
||||||
|
filter: brightness(0%);
|
||||||
|
margin-bottom: 10px;
|
||||||
|
max-width: 150px
|
||||||
|
}
|
||||||
|
|
||||||
|
.description strong {
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-weight: 100;
|
||||||
|
color: #555
|
||||||
|
}
|
||||||
|
|
||||||
|
.ticket-info {
|
||||||
|
font-size: 26px
|
||||||
|
}
|
||||||
|
|
||||||
|
#phytosanitary {
|
||||||
|
padding-right: 10px
|
||||||
|
}
|
||||||
|
|
||||||
|
#phytosanitary .flag img {
|
||||||
|
width: 100%
|
||||||
|
}
|
||||||
|
|
||||||
|
#phytosanitary .flag .flag-text {
|
||||||
|
padding-left: 10px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phytosanitary-info {
|
||||||
|
margin-top: 10px
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
|
@ -0,0 +1,276 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html v-bind:lang="$i18n.locale">
|
||||||
|
<body>
|
||||||
|
<table class="grid">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<!-- Header block -->
|
||||||
|
<report-header v-bind="$props"
|
||||||
|
v-bind:company-code="invoice.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('title')}}</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('invoice')}}</td>
|
||||||
|
<th>{{invoice.ref}}</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="font gray uppercase">{{$t('date')}}</td>
|
||||||
|
<th>{{invoice.issued | date('%d-%m-%Y')}}</th>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="size50">
|
||||||
|
<div class="panel">
|
||||||
|
<div class="header">{{$t('invoiceData')}}</div>
|
||||||
|
<div class="body">
|
||||||
|
<h3 class="uppercase">{{client.socialName}}</h3>
|
||||||
|
<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">{{$t('price')}}</th>
|
||||||
|
<th class="centered" width="5%">{{$t('discount')}}</th>
|
||||||
|
<th class="centered">{{$t('vat')}}</th>
|
||||||
|
<th class="number">{{$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">{{sale.price | currency('EUR', $i18n.locale)}}</td>
|
||||||
|
<td class="centered" width="5%">{{(sale.discount / 100) | percentage}}</td>
|
||||||
|
<td class="centered">{{sale.vatType}}</td>
|
||||||
|
<td class="number">{{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>
|
||||||
|
<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">
|
||||||
|
<!-- Services block-->
|
||||||
|
<div class="size100 no-page-break" v-if="services.length > 0">
|
||||||
|
<h2>{{$t('services')}}</h2>
|
||||||
|
<table class="column-oriented">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="5%"></th>
|
||||||
|
<th class="number">{{$t('quantity')}}</th>
|
||||||
|
<th width="50%">{{$t('concept')}}</th>
|
||||||
|
<th class="number">{{$t('price')}}</th>
|
||||||
|
<th class="centered" width="5%"></th>
|
||||||
|
<th class="centered">{{$t('vat')}}</th>
|
||||||
|
<th class="number">{{$t('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('subtotal')}}</span>
|
||||||
|
</td>
|
||||||
|
<td class="number">{{serviceTotal | currency('EUR', $i18n.locale)}}</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
</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')}}</h2>
|
||||||
|
<table class="column-oriented">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{{$t('reference')}}</th>
|
||||||
|
<th class="number">{{$t('quantity')}}</th>
|
||||||
|
<th wihth="75%">{{$t('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">
|
||||||
|
<!-- Taxes block -->
|
||||||
|
<div id="taxes" class="size50 pull-right no-page-break" v-if="taxes">
|
||||||
|
<!-- <h2>{{$t('taxBreakdown')}}</h2> -->
|
||||||
|
<table class="column-oriented">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colspan="4">{{$t('taxBreakdown')}}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<thead class="light">
|
||||||
|
<tr>
|
||||||
|
<th width="45%">{{$t('type')}}</th>
|
||||||
|
<th width="25%" class="number">
|
||||||
|
{{$t('taxBase')}}
|
||||||
|
</th>
|
||||||
|
<th>{{$t('tax')}}</th>
|
||||||
|
<th class="number">{{$t('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>
|
||||||
|
</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>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,129 @@
|
||||||
|
const config = require(`${appPath}/core/config`);
|
||||||
|
const Component = require(`${appPath}/core/component`);
|
||||||
|
const reportHeader = new Component('report-header');
|
||||||
|
const reportFooter = new Component('report-footer');
|
||||||
|
const md5 = require('md5');
|
||||||
|
const fs = require('fs-extra');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'invoice',
|
||||||
|
async serverPrefetch() {
|
||||||
|
this.invoice = await this.fetchInvoice(this.invoiceId);
|
||||||
|
this.client = {};
|
||||||
|
this.address = {};
|
||||||
|
this.sales = [];
|
||||||
|
this.services = [];
|
||||||
|
this.taxes = [];
|
||||||
|
this.packagings = [];
|
||||||
|
/* this.client = await this.fetchClient(this.ticketId);
|
||||||
|
this.ticket = await this.fetchTicket(this.ticketId);
|
||||||
|
this.sales = await this.fetchSales(this.ticketId);
|
||||||
|
this.address = await this.fetchAddress(this.ticketId);
|
||||||
|
this.services = await this.fetchServices(this.ticketId);
|
||||||
|
this.taxes = await this.fetchTaxes(this.ticketId);
|
||||||
|
this.packagings = await this.fetchPackagings(this.ticketId);
|
||||||
|
this.signature = await this.fetchSignature(this.ticketId);
|
||||||
|
|
||||||
|
*/
|
||||||
|
if (!this.invoice)
|
||||||
|
throw new Error('Something went wrong');
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {totalBalance: 0.00};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
/* dmsPath() {
|
||||||
|
if (!this.signature) return;
|
||||||
|
|
||||||
|
const hash = md5(this.signature.id.toString()).substring(0, 3);
|
||||||
|
const file = `${config.storage.root}/${hash}/${this.signature.id}.png`;
|
||||||
|
const src = fs.readFileSync(file);
|
||||||
|
const base64 = Buffer.from(src, 'utf8').toString('base64');
|
||||||
|
|
||||||
|
return `data:image/png;base64, ${base64}`;
|
||||||
|
},
|
||||||
|
serviceTotal() {
|
||||||
|
let total = 0.00;
|
||||||
|
this.services.forEach(service => {
|
||||||
|
total += parseFloat(service.price) * service.quantity;
|
||||||
|
});
|
||||||
|
|
||||||
|
return total;
|
||||||
|
} */
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fetchInvoice(invoiceId) {
|
||||||
|
return this.findOneFromDef('invoice', [invoiceId]);
|
||||||
|
},
|
||||||
|
fetchClient(ticketId) {
|
||||||
|
return this.findOneFromDef('client', [ticketId]);
|
||||||
|
},
|
||||||
|
fetchAddress(ticketId) {
|
||||||
|
return this.findOneFromDef(`address`, [ticketId]);
|
||||||
|
},
|
||||||
|
fetchSignature(ticketId) {
|
||||||
|
return this.findOneFromDef('signature', [ticketId]);
|
||||||
|
},
|
||||||
|
fetchTaxes(ticketId) {
|
||||||
|
return this.findOneFromDef(`taxes`, [ticketId]);
|
||||||
|
},
|
||||||
|
fetchSales(ticketId) {
|
||||||
|
return this.rawSqlFromDef('sales', [ticketId]);
|
||||||
|
},
|
||||||
|
fetchPackagings(ticketId) {
|
||||||
|
return this.rawSqlFromDef('packagings', [ticketId]);
|
||||||
|
},
|
||||||
|
fetchServices(ticketId) {
|
||||||
|
return this.rawSqlFromDef('services', [ticketId]);
|
||||||
|
},
|
||||||
|
|
||||||
|
getSubTotal() {
|
||||||
|
let subTotal = 0.00;
|
||||||
|
this.sales.forEach(sale => {
|
||||||
|
subTotal += sale.quantity * sale.price * (1 - sale.discount / 100);
|
||||||
|
});
|
||||||
|
|
||||||
|
return subTotal;
|
||||||
|
},
|
||||||
|
getTotalBase() {
|
||||||
|
let totalBase = 0.00;
|
||||||
|
this.taxes.forEach(tax => {
|
||||||
|
totalBase += parseFloat(tax.Base);
|
||||||
|
});
|
||||||
|
|
||||||
|
return totalBase;
|
||||||
|
},
|
||||||
|
getTotalTax() {
|
||||||
|
let totalTax = 0.00;
|
||||||
|
this.taxes.forEach(tax => {
|
||||||
|
totalTax += parseFloat(tax.tax);
|
||||||
|
});
|
||||||
|
|
||||||
|
return totalTax;
|
||||||
|
},
|
||||||
|
getTotal() {
|
||||||
|
return this.getTotalBase() + this.getTotalTax();
|
||||||
|
},
|
||||||
|
getBotanical() {
|
||||||
|
let phytosanitary = [];
|
||||||
|
this.sales.forEach(sale => {
|
||||||
|
if (sale.botanical)
|
||||||
|
phytosanitary.push(sale.botanical);
|
||||||
|
});
|
||||||
|
|
||||||
|
return phytosanitary.filter((item, index) =>
|
||||||
|
phytosanitary.indexOf(item) == index
|
||||||
|
).join(', ');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
'report-header': reportHeader.build(),
|
||||||
|
'report-footer': reportFooter.build()
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
invoiceId: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,27 @@
|
||||||
|
title: Factura
|
||||||
|
invoice: Factura
|
||||||
|
clientId: Cliente
|
||||||
|
deliveryAddress: Dirección de entrega
|
||||||
|
fiscalData: Datos fiscales
|
||||||
|
saleLines: Líneas de pedido
|
||||||
|
date: Fecha
|
||||||
|
reference: Ref.
|
||||||
|
quantity: Cant.
|
||||||
|
concept: Concepto
|
||||||
|
price: PVP/u
|
||||||
|
discount: Dto.
|
||||||
|
vat: IVA
|
||||||
|
amount: Importe
|
||||||
|
type: Tipo
|
||||||
|
taxBase: Base imp.
|
||||||
|
tax: Tasa
|
||||||
|
fee: Cuota
|
||||||
|
total: Total
|
||||||
|
subtotal: Subtotal
|
||||||
|
taxBreakdown: Desglose impositivo
|
||||||
|
packagings: Cubos y embalajes
|
||||||
|
services: Servicios
|
||||||
|
vatType: Tipo de IVA
|
||||||
|
digitalSignature: Firma digital
|
||||||
|
invoiceRef: Factura {0}
|
||||||
|
plantPassport: Pasaporte fitosanitario
|
|
@ -0,0 +1,11 @@
|
||||||
|
SELECT
|
||||||
|
a.nickname,
|
||||||
|
a.street,
|
||||||
|
a.postalCode,
|
||||||
|
a.city,
|
||||||
|
p.name province
|
||||||
|
FROM ticket t
|
||||||
|
JOIN address a ON a.clientFk = t.clientFk
|
||||||
|
AND a.id = t.addressFk
|
||||||
|
LEFT JOIN province p ON p.id = a.provinceFk
|
||||||
|
WHERE t.id = ?
|
|
@ -0,0 +1,8 @@
|
||||||
|
SELECT
|
||||||
|
c.id,
|
||||||
|
c.socialName,
|
||||||
|
c.street,
|
||||||
|
c.fi
|
||||||
|
FROM ticket t
|
||||||
|
JOIN client c ON c.id = t.clientFk
|
||||||
|
WHERE t.id = ?
|
|
@ -0,0 +1,5 @@
|
||||||
|
SELECT io.amount, io.ref, io.issued, ict.description
|
||||||
|
FROM vn.invoiceCorrection ic
|
||||||
|
JOIN vn.invoiceOut io ON io.id = ic.correctedFk
|
||||||
|
JOIN vn.invoiceCorrectionType ict ON ict.id = ic.invoiceCorrectionTypeFk
|
||||||
|
where ic.correctingFk = #
|
|
@ -0,0 +1,17 @@
|
||||||
|
SELECT
|
||||||
|
io.issued,
|
||||||
|
io.clientFk,
|
||||||
|
io.companyFk,
|
||||||
|
io.ref,
|
||||||
|
c.socialName,
|
||||||
|
c.street postalAddress,
|
||||||
|
cny.code companyCode,
|
||||||
|
IF (ios.taxAreaFk IS NOT NULL, CONCAT(cty.code, c.fi), c.fi) fi,
|
||||||
|
CONCAT(c.postcode,' - ',c.city) postcodeCity
|
||||||
|
FROM vn.invoiceOut io
|
||||||
|
JOIN vn.client c ON c.id = io.clientFk
|
||||||
|
JOIN vn.country cty ON cty.id = c.countryFk
|
||||||
|
JOIN company cny ON cny.id = io.companyFk
|
||||||
|
LEFT JOIN vn.invoiceOutSerial ios ON ios.code = io.serial
|
||||||
|
AND ios.taxAreaFk = 'CEE'
|
||||||
|
WHERE io.id = ?
|
|
@ -0,0 +1,9 @@
|
||||||
|
SELECT
|
||||||
|
tp.quantity,
|
||||||
|
i.name,
|
||||||
|
p.itemFk
|
||||||
|
FROM ticketPackaging tp
|
||||||
|
JOIN packaging p ON p.id = tp.packagingFk
|
||||||
|
JOIN item i ON i.id = p.itemFk
|
||||||
|
WHERE tp.ticketFk = ?
|
||||||
|
ORDER BY itemFk
|
|
@ -0,0 +1,42 @@
|
||||||
|
SELECT
|
||||||
|
s.id,
|
||||||
|
s.itemFk,
|
||||||
|
s.concept,
|
||||||
|
s.quantity,
|
||||||
|
s.price,
|
||||||
|
s.price - SUM(IF(ctr.id = 6, sc.value, 0)) netPrice,
|
||||||
|
s.discount,
|
||||||
|
i.size,
|
||||||
|
i.stems,
|
||||||
|
i.category,
|
||||||
|
it.id itemTypeId,
|
||||||
|
o.code AS origin,
|
||||||
|
i.inkFk,
|
||||||
|
s.ticketFk,
|
||||||
|
tcl.code vatType,
|
||||||
|
ib.ediBotanic botanical,
|
||||||
|
i.tag5,
|
||||||
|
i.value5,
|
||||||
|
i.tag6,
|
||||||
|
i.value6,
|
||||||
|
i.tag7,
|
||||||
|
i.value7
|
||||||
|
FROM vn.sale s
|
||||||
|
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||||
|
LEFT JOIN component cr ON cr.id = sc.componentFk
|
||||||
|
LEFT JOIN componentType ctr ON ctr.id = cr.typeFk
|
||||||
|
LEFT JOIN item i ON i.id = s.itemFk
|
||||||
|
LEFT JOIN ticket t ON t.id = s.ticketFk
|
||||||
|
LEFT JOIN origin o ON o.id = i.originFk
|
||||||
|
LEFT JOIN country c ON c.id = o.countryFk
|
||||||
|
LEFT JOIN supplier sp ON sp.id = t.companyFk
|
||||||
|
LEFT JOIN itemType it ON it.id = i.typeFk
|
||||||
|
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||||
|
LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id
|
||||||
|
AND itc.countryFk = sp.countryFk
|
||||||
|
LEFT JOIN taxClass tcl ON tcl.id = itc.taxClassFk
|
||||||
|
LEFT JOIN itemBotanicalWithGenus ib ON ib.itemFk = i.id
|
||||||
|
AND ic.code = 'plant'
|
||||||
|
WHERE s.ticketFk = ?
|
||||||
|
GROUP BY s.id
|
||||||
|
ORDER BY (it.isPackaging), s.concept, s.itemFk
|
|
@ -0,0 +1,8 @@
|
||||||
|
SELECT
|
||||||
|
tc.code taxDescription,
|
||||||
|
ts.description,
|
||||||
|
ts.quantity,
|
||||||
|
ts.price
|
||||||
|
FROM ticketService ts
|
||||||
|
JOIN taxClass tc ON tc.id = ts.taxClassFk
|
||||||
|
WHERE ts.ticketFk = ?
|
|
@ -0,0 +1,8 @@
|
||||||
|
SELECT
|
||||||
|
d.id,
|
||||||
|
d.created
|
||||||
|
FROM ticket t
|
||||||
|
JOIN ticketDms dt ON dt.ticketFk = t.id
|
||||||
|
JOIN dms d ON d.id = dt.dmsFk
|
||||||
|
AND d.file LIKE '%.png'
|
||||||
|
WHERE t.id = ?
|
|
@ -0,0 +1,8 @@
|
||||||
|
SELECT iot.* , pgc.*, IF(pe.equFk IS NULL, taxableBase, 0) AS Base, pgc.rate / 100 as vatPercent, ios.footNotes
|
||||||
|
FROM vn.invoiceOutTax iot
|
||||||
|
JOIN vn.pgc ON pgc.code = iot.pgcFk
|
||||||
|
LEFT JOIN vn.pgcEqu pe ON pe.equFk = pgc.code
|
||||||
|
JOIN vn.invoiceOut io ON io.id = iot.invoiceOutFk
|
||||||
|
LEFT JOIN vn.invoiceOutSerial ios ON ios.code = io.serial
|
||||||
|
WHERE invoiceOutFk = #
|
||||||
|
ORDER BY iot.id
|
Loading…
Reference in New Issue