diff --git a/body.go b/body.go index f7e1ff3..5db0e15 100644 --- a/body.go +++ b/body.go @@ -98,12 +98,17 @@ func newDatiGenerali(inv *bill.Invoice) (*datiGenerali, error) { return nil, errors.New("simplified invoices are not currently supported") } + code := inv.Code + if inv.Series != "" { + code = fmt.Sprintf("%s-%s", inv.Series, inv.Code) + } + return &datiGenerali{ DatiGeneraliDocumento: &datiGeneraliDocumento{ TipoDocumento: codeTipoDocumento, Divisa: string(inv.Currency), Data: inv.IssueDate.String(), - Numero: inv.Code, + Numero: code, DatiRitenuta: dr, DatiBollo: newDatiBollo(inv.Charges), ImportoTotaleDocumento: formatAmount(&inv.Totals.Payable), diff --git a/items.go b/items.go index 6b19138..c6ae0b5 100644 --- a/items.go +++ b/items.go @@ -55,7 +55,7 @@ func generateLineDetails(inv *bill.Invoice) []*dettaglioLinee { PrezzoTotale: formatAmount(&line.Sum), ScontoMaggiorazione: extractLinePriceAdjustments(line), } - if len(line.Taxes) > 0 { + if line.Taxes != nil && len(line.Taxes) > 0 { vatTax := line.Taxes.Get(tax.CategoryVAT) if vatTax != nil { d.AliquotaIVA = formatPercentage(vatTax.Percent)