Skip to content

Commit

Permalink
Merge pull request #31 from invopop/line-total-fix
Browse files Browse the repository at this point in the history
Correctly applying discounts to the total
  • Loading branch information
samlown authored Jul 4, 2024
2 parents 2eb6cba + 8da0a48 commit c3a6baf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion items.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion items_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit c3a6baf

Please sign in to comment.