From 8da0a48a443ff0da752b21e265a6fa8eb35ba3d2 Mon Sep 17 00:00:00 2001 From: Sam Lown Date: Thu, 4 Jul 2024 15:18:01 +0000 Subject: [PATCH] Correctly applying discounts to the total --- items.go | 2 +- items_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/items.go b/items.go index cc1b077..3ed739e 100644 --- a/items.go +++ b/items.go @@ -52,7 +52,7 @@ func generateLineDetails(inv *bill.Invoice) []*dettaglioLinee { Descrizione: line.Item.Name, Quantita: formatAmount(&line.Quantity), PrezzoUnitario: formatAmount(&line.Item.Price), - PrezzoTotale: formatAmount(&line.Sum), + PrezzoTotale: formatAmount(&line.Total), ScontoMaggiorazione: extractLinePriceAdjustments(line), } if line.Taxes != nil && len(line.Taxes) > 0 { diff --git a/items_test.go b/items_test.go index 12e605d..edd45d2 100644 --- a/items_test.go +++ b/items_test.go @@ -20,7 +20,7 @@ func TestDettaglioLinee(t *testing.T) { assert.Equal(t, "Development services", dl.Descrizione) assert.Equal(t, "20.00", dl.Quantita) assert.Equal(t, "90.00", dl.PrezzoUnitario) - assert.Equal(t, "1800.00", dl.PrezzoTotale) + assert.Equal(t, "1620.00", dl.PrezzoTotale) assert.Equal(t, "22.00", dl.AliquotaIVA) assert.Equal(t, "", dl.Natura)