diff --git a/modules/invoiceOut/back/methods/invoiceOut/summary.js b/modules/invoiceOut/back/methods/invoiceOut/summary.js index 6369f3ca1..caa2a1c06 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/summary.js +++ b/modules/invoiceOut/back/methods/invoiceOut/summary.js @@ -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( diff --git a/modules/invoiceOut/front/descriptor/index.html b/modules/invoiceOut/front/descriptor/index.html index 65d4816fe..ae0694227 100644 --- a/modules/invoiceOut/front/descriptor/index.html +++ b/modules/invoiceOut/front/descriptor/index.html @@ -6,6 +6,15 @@ + +
diff --git a/modules/invoiceOut/front/descriptor/index.js b/modules/invoiceOut/front/descriptor/index.js index 777ab6bb1..f8ceab5e7 100644 --- a/modules/invoiceOut/front/descriptor/index.js +++ b/modules/invoiceOut/front/descriptor/index.js @@ -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'), diff --git a/modules/invoiceOut/front/descriptor/locale/es.yml b/modules/invoiceOut/front/descriptor/locale/es.yml index 63ea7b6b5..490139184 100644 --- a/modules/invoiceOut/front/descriptor/locale/es.yml +++ b/modules/invoiceOut/front/descriptor/locale/es.yml @@ -1,4 +1,5 @@ Volume exceded: Volumen excedido Volume: Volumen Client card: Ficha del cliente -Invoice ticket list: Listado de tickets de la factura \ No newline at end of file +Invoice ticket list: Listado de tickets de la factura +Show invoice out PDF: Ver factura emitida en PDF \ No newline at end of file diff --git a/modules/invoiceOut/front/summary/index.html b/modules/invoiceOut/front/summary/index.html index 810c847f5..ab25cde92 100644 --- a/modules/invoiceOut/front/summary/index.html +++ b/modules/invoiceOut/front/summary/index.html @@ -14,25 +14,31 @@ - - - - - - - - + + + +

Desglose impositivo

+ + Type + Taxable base + Rate + Fee + +
+ + + {{tax.name}} + {{tax.taxableBase | currency: 'EUR': 2}} + {{tax.rate}}% + {{tax.vat | currency: 'EUR': 2}} + + +
+

Ticket

@@ -40,6 +46,7 @@ Ticket id Alias + Shipped Amount @@ -59,6 +66,7 @@ {{ticket.nickname}} + {{ticket.shipped | dateTime: 'dd/MM/yyyy'}} {{ticket.total | currency: 'EUR': 2}} diff --git a/modules/invoiceOut/front/summary/index.js b/modules/invoiceOut/front/summary/index.js index ed82242e8..6135942fb 100644 --- a/modules/invoiceOut/front/summary/index.js +++ b/modules/invoiceOut/front/summary/index.js @@ -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(); } } diff --git a/modules/invoiceOut/front/summary/locale/es.yml b/modules/invoiceOut/front/summary/locale/es.yml index 74ddf1df3..4444939c7 100644 --- a/modules/invoiceOut/front/summary/locale/es.yml +++ b/modules/invoiceOut/front/summary/locale/es.yml @@ -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. \ No newline at end of file