Skip to content

Commit 9562b08

Browse files
committed
feat: add totals
1 parent f0643ad commit 9562b08

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/app/afip/afip.component.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,19 @@ export class AfipComponent implements OnInit {
212212

213213
async exportToCSV() {
214214
let csvContent = '';
215+
let amount = 0;
216+
let amount_iva = 0;
217+
215218
csvContent += 'Tipo,Nro,CAE,Emisor,Emisor CUIT,Receptor,Receptor CUIT,Fecha,Importe,Importe sin IVA 21,Moneda\r\n';
216219

217220
this.invoices.forEach((row) => {
218221
csvContent += row.docName + ',' + row.docNumber + ',' + row.cae + ',' + row.nameEmi + ',' + row.cuitEmi + ',' + row.nameRec + ',' + row.cuitRec + ',' + row.date + ',' + row.amount + ',' + Number(row.amount) / 1.21 + ',' + row.currency + '\r\n';
222+
amount = amount + Number(row.amount);
223+
amount_iva = amount_iva + (Number(row.amount) / 1.21);
219224
});
220225

226+
csvContent += ',,,,,,,,' + amount + ',' + amount_iva + ',\r\n';
227+
221228
let date = new Date()
222229
let day = `${(date.getDate())}`.padStart(2,'0');
223230
let month = `${(date.getMonth()+1)}`.padStart(2,'0');

0 commit comments

Comments
 (0)