#1348 invoiceOut.summary
This commit is contained in:
parent
2107b57764
commit
fb30a01fde
|
@ -81,14 +81,11 @@ module.exports = Self => {
|
|||
let ticketTotalsIndex = stmts.push('SELECT * FROM tmp.ticketTotal') - 1;
|
||||
|
||||
stmt = new ParameterizedSQL(`
|
||||
SELECT tc.description as type, SUM(ROUND(s.quantity * s.price * (100 - s.discount) / 100,2)) AS base
|
||||
FROM vn.sale s
|
||||
JOIN vn.ticket t ON t.id = s.ticketFk
|
||||
LEFT JOIN vn.itemTaxCountry itc ON itc.itemFk = s.itemFk
|
||||
JOIN vn.country c ON c.id = itc.countryFK AND c.id = ?
|
||||
LEFT JOIN vn.taxClass tc ON tc.id = itc.taxClassFk
|
||||
WHERE t.refFk = ?
|
||||
GROUP BY type`, [summary.invoiceOut.supplier().countryFk, summary.invoiceOut.ref]);
|
||||
SELECT iot.* , pgc.*, IF(pe.equFk IS NULL, taxableBase, 0) AS Base, pgc.rate / 100 as vatPercent
|
||||
FROM vn.invoiceOutTax iot
|
||||
JOIN vn.pgc ON pgc.code = iot.pgcFk
|
||||
LEFT JOIN vn.pgcEqu pe ON pe.equFk = pgc.code
|
||||
WHERE invoiceOutFk = ?`, [summary.invoiceOut.id]);
|
||||
let invoiceOutTaxesIndex = stmts.push(stmt) - 1;
|
||||
|
||||
stmts.push(
|
||||
|
|
|
@ -6,6 +6,15 @@
|
|||
<a translate-attr="{title: 'Preview'}" ui-sref="invoiceOut.card.summary({id: $ctrl.invoiceOut.id})">
|
||||
<vn-icon icon="desktop_windows"></vn-icon>
|
||||
</a>
|
||||
<vn-icon-menu
|
||||
vn-id="more-button"
|
||||
icon="more_vert"
|
||||
show-filter="false"
|
||||
value-field="callback"
|
||||
translate-fields="['name']"
|
||||
data="$ctrl.moreOptions"
|
||||
on-change="$ctrl.onMoreChange(value)">
|
||||
</vn-icon-menu>
|
||||
</div>
|
||||
<div class="body">
|
||||
<div class="attributes">
|
||||
|
|
|
@ -1,6 +1,17 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
class Controller {
|
||||
constructor(vnToken) {
|
||||
this.accessToken = vnToken.token;
|
||||
this.moreOptions = [
|
||||
{callback: this.showInvoiceOutPdf, name: 'Show invoice out PDF'}
|
||||
];
|
||||
}
|
||||
|
||||
onMoreChange(callback) {
|
||||
callback.call(this);
|
||||
}
|
||||
|
||||
set invoiceOut(value) {
|
||||
this._invoiceOut = value;
|
||||
|
||||
|
@ -24,6 +35,11 @@ class Controller {
|
|||
return this._invoiceOut;
|
||||
}
|
||||
|
||||
showInvoiceOutPdf() {
|
||||
let url = `api/InvoiceOuts/${this.invoiceOut.id}/download?access_token=${this.accessToken}`;
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
|
||||
set quicklinks(value = {}) {
|
||||
this._quicklinks = Object.assign(value, this._quicklinks);
|
||||
}
|
||||
|
@ -33,7 +49,7 @@ class Controller {
|
|||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$http', '$state'];
|
||||
Controller.$inject = ['vnToken'];
|
||||
|
||||
ngModule.component('vnInvoiceOutDescriptor', {
|
||||
template: require('./index.html'),
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
Volume exceded: Volumen excedido
|
||||
Volume: Volumen
|
||||
Client card: Ficha del cliente
|
||||
Invoice ticket list: Listado de tickets de la factura
|
||||
Invoice ticket list: Listado de tickets de la factura
|
||||
Show invoice out PDF: Ver factura emitida en PDF
|
|
@ -14,25 +14,31 @@
|
|||
<vn-label-value label="Booked"
|
||||
value="{{$ctrl.summary.invoiceOut.booked | dateTime: 'dd/MM/yyyy'}}">
|
||||
</vn-label-value>
|
||||
</vn-one>
|
||||
<vn-one>
|
||||
<vn-label-value label="Company"
|
||||
value="{{$ctrl.summary.invoiceOut.company.code | dashIfEmpty}}">
|
||||
</vn-label-value>
|
||||
<vn-icon-button
|
||||
ng-show="$ctrl.summary.invoiceOut.hasPdf"
|
||||
ng-click="$ctrl.openPdf(invoiceOut.id, $event)"
|
||||
icon="cloud_download"
|
||||
title="Download PDF"
|
||||
vn-tooltip="Download PDF">
|
||||
</vn-icon-button>
|
||||
</vn-one>
|
||||
<vn-one>
|
||||
<vn-label-value ng-repeat="tax in $ctrl.summary.invoiceOut.taxesBreakdown"
|
||||
label="{{tax.type}}"
|
||||
value="{{tax.base | currency: 'EUR': 2}}">
|
||||
</vn-label-value>
|
||||
</vn-one>
|
||||
<vn-two>
|
||||
<vn-table model="model">
|
||||
<vn-thead>
|
||||
<h4 translate>Desglose impositivo</h4>
|
||||
<vn-tr>
|
||||
<vn-th>Type</vn-th>
|
||||
<vn-th>Taxable base</vn-th>
|
||||
<vn-th>Rate</vn-th>
|
||||
<vn-th>Fee</vn-th>
|
||||
</vn-tr>
|
||||
</vn-thead>
|
||||
<vn-tbody>
|
||||
<vn-tr ng-repeat="tax in $ctrl.summary.invoiceOut.taxesBreakdown">
|
||||
<vn-td>{{tax.name}}</vn-td>
|
||||
<vn-td>{{tax.taxableBase | currency: 'EUR': 2}}</vn-td>
|
||||
<vn-td>{{tax.rate}}%</vn-td>
|
||||
<vn-td>{{tax.vat | currency: 'EUR': 2}}</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
</vn-table>
|
||||
</vn-two>
|
||||
<vn-auto>
|
||||
<h4 translate>Ticket</h4>
|
||||
<vn-table model="model">
|
||||
|
@ -40,6 +46,7 @@
|
|||
<vn-tr>
|
||||
<vn-th number>Ticket id</vn-th>
|
||||
<vn-th>Alias</vn-th>
|
||||
<vn-th>Shipped</vn-th>
|
||||
<vn-th number>Amount</vn-th>
|
||||
</vn-tr>
|
||||
</vn-thead>
|
||||
|
@ -59,6 +66,7 @@
|
|||
{{ticket.nickname}}
|
||||
</span>
|
||||
</vn-td>
|
||||
<vn-td>{{ticket.shipped | dateTime: 'dd/MM/yyyy'}}</vn-td>
|
||||
<vn-td number>{{ticket.total | currency: 'EUR': 2}}</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
|
|
|
@ -18,13 +18,6 @@ class Controller {
|
|||
return this._invoiceOut;
|
||||
}
|
||||
|
||||
openPdf(id, event) {
|
||||
let url = `api/InvoiceOuts/${id}/download?access_token=${this.accessToken}`;
|
||||
window.open(url, '_blank');
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
}
|
||||
|
||||
getSummary() {
|
||||
this.$http.get(`/api/InvoiceOuts/${this.invoiceOut.id}/summary`).then(response => {
|
||||
this.summary = response.data;
|
||||
|
@ -36,7 +29,6 @@ class Controller {
|
|||
this.$.clientDescriptor.parent = event.target;
|
||||
this.$.clientDescriptor.show();
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
}
|
||||
|
||||
showTicketDescriptor(event, ticketFk) {
|
||||
|
@ -44,14 +36,12 @@ class Controller {
|
|||
this.$.ticketDescriptor.parent = event.target;
|
||||
this.$.ticketDescriptor.show();
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
}
|
||||
|
||||
preview(event, invoiceOut) {
|
||||
this.selectedInvoiceOut = invoiceOut;
|
||||
this.$.invoiceOutSummaryDialog.show();
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,4 +12,8 @@ Due: Vencimiento
|
|||
Booked: Asentado
|
||||
General VAT: IVA general
|
||||
Reduced VAT: IVA reducido
|
||||
|
||||
Shipped: F. envío
|
||||
Type: Tipo
|
||||
Rate: Tasa
|
||||
Fee: Cuota
|
||||
Taxable base: Base imp.
|
Loading…
Reference in New Issue