Skip to content

Commit 5293a63

Browse files
committed
feat: currency format on amounts
1 parent 039c2c2 commit 5293a63

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

src/app/afip/afip.component.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,6 @@ export class AfipComponent implements OnInit {
270270
let day = `${(date.getDate())}`.padStart(2,'0');
271271
let month = `${(date.getMonth()+1)}`.padStart(2,'0');
272272
let year = date.getFullYear();
273-
const formatter = new Intl.NumberFormat('es-AR', {
274-
style: 'currency',
275-
currency: 'ARS',
276-
});
277273

278274
var wscols = [
279275
{wch:5},
@@ -303,8 +299,8 @@ export class AfipComponent implements OnInit {
303299
'Receptor': row.nameRec,
304300
'Receptor CUIT': row.cuitRec,
305301
'Fecha': date.toLocaleString('es-AR', { year: 'numeric', month: '2-digit', day: '2-digit' }),
306-
'Importe': formatter.format(row.amount),
307-
'Importe sin IVA 21': formatter.format((Number(row.amount) / 1.21)),
302+
'Importe': row.amount,
303+
'Importe sin IVA 21': Number((Number(row.amount) / 1.21).toFixed(2)),
308304
'Moneda': row.currency,
309305
});
310306

@@ -321,8 +317,8 @@ export class AfipComponent implements OnInit {
321317
'Receptor': '',
322318
'Receptor CUIT': '',
323319
'Fecha': '',
324-
'Importe': formatter.format(amount),
325-
'Importe sin IVA 21': formatter.format(amount_iva),
320+
'Importe': amount,
321+
'Importe sin IVA 21': Number(amount_iva.toFixed(2)),
326322
'Moneda': '',
327323
});
328324

@@ -339,6 +335,16 @@ export class AfipComponent implements OnInit {
339335
},
340336
};
341337
}
338+
339+
for (let i = 2; i < this.invoices.length + 3; i++) {
340+
worksheet["I" + (i)].s = {
341+
numFmt: '$#.###,##'
342+
};
343+
worksheet["J" + (i)].s = {
344+
numFmt: '$#.###,##'
345+
};
346+
}
347+
342348
var wbout = XLSX.write(workbook, {bookType:'xlsx', type: 'binary'});
343349

344350
let b = new Blob([this.s2ab(wbout)],{type:"application/vnd.ms-excel"});

0 commit comments

Comments
 (0)