Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Invoice ¶
type Invoice struct {
From string
Logo string
Title string
Subtotal string
Discount string
Tax string
Total string
// contains filtered or unexported fields
}
func New ¶
func New(regularFont, boldFont, headlineFont *Font, currency *Currency, subtotal, discount, tax, total, logopath, from string) (*Invoice, error)
Invoice Instantiator regularFont - A goeasyinvoice Font Object that contains a reference to the byte[] of the font and title of the font boldFont - A goeasyinvoice Font Object that contains a reference to the byte[] of the font and title of the font headlineFont - A goeasyinvoice Font Object that contains a reference to the byte[] of the font and title of the font subtotal - The label for your subtitle discount - The label for a discount tax - The label for taxes total - The label for the total sum logopath - The path to your logo from - Who the invoice is from
func (*Invoice) Generate ¶
func (i *Invoice) Generate(title, id, issueDate, dueDate, to, note, filePathName string, discount, tax float64, lineItems []InvoiceItem) error
Generate a PDF with the following parameters title - The title of the Invoice in the PDF id - Your Invoice ID issueDate - The Invoice's Issue Date dueDate - The Invoice's Due Date to - Who the Invoice is addressed to note - A note at the bottom left corner of the invoice - typically used for remarks filePathName - Where you would like the invoice saved. Make sure to clean this up if you're using it for SaaS discount - A discount percentage that will be multiplied by the subtotal - i.e 0.25 is a 25% discount - Please note that the subtotal is calculated pre-tax and the tax is applied after this tax - The taxable percentage (we will add 1 to it so if you apply a 15% tax then you would put 0.15) lineItems - An array of Invoice Items that represent the line items in your invoice RETURNS err - We will return an error or nil if successful. Check your filePathName for a successful PDF on nil return