Documentation ¶
Index ¶
- Variables
- type Address
- type BankAccount
- type Billable
- func (b *Billable) FormattedDiscount() string
- func (b *Billable) FormattedQuantity() string
- func (b *Billable) FormattedSubtotal(currency string) string
- func (b *Billable) FormattedTax() string
- func (b *Billable) FormattedUnitPrice(currency string) string
- func (b *Billable) Subtotal() float64
- func (b *Billable) Total() float64
- type BillableList
- func (b BillableList) FormattedSubtotal(currency string) string
- func (b BillableList) FormattedTotal(currency string) string
- func (b BillableList) LongestDiscount() string
- func (b BillableList) LongestQuantity() string
- func (b BillableList) LongestSubtotal(currency string) string
- func (b BillableList) LongestTax() string
- func (b BillableList) LongestUnitPrice(currency string) string
- func (b BillableList) Subtotal() float64
- func (b BillableList) Total() float64
- type BuildOutput
- type Builder
- type Config
- type Entity
- type FontFamily
- type InvoiceDetails
- type InvoicesConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultConfigPath string
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { Name string `json:"name" yaml:"name"` Address string `json:"address" yaml:"address"` Address2 string `json:"address2" yaml:"address2"` City string `json:"city" yaml:"city"` State string `json:"state" yaml:"state"` ZipCode string `json:"zipCode" yaml:"zipCode"` Country string `json:"country" yaml:"country"` }
type BankAccount ¶
type Billable ¶
type Billable struct { Alias string `json:"alias" yaml:"alias"` Description string `json:"description" yaml:"description"` Quantity float64 `json:"quantity" yaml:"quantity"` UnitPrice float64 `json:"unitPrice" yaml:"unitPrice"` Discount float64 `json:"discount" yaml:"discount"` Tax float64 `json:"tax" yaml:"tax"` }
Billable represents a billable item in an invoice.
func (*Billable) FormattedDiscount ¶
func (*Billable) FormattedQuantity ¶
func (*Billable) FormattedSubtotal ¶
func (*Billable) FormattedTax ¶
func (*Billable) FormattedUnitPrice ¶
type BillableList ¶
type BillableList []*Billable
func (BillableList) FormattedSubtotal ¶
func (b BillableList) FormattedSubtotal(currency string) string
func (BillableList) FormattedTotal ¶
func (b BillableList) FormattedTotal(currency string) string
func (BillableList) LongestDiscount ¶
func (b BillableList) LongestDiscount() string
func (BillableList) LongestQuantity ¶
func (b BillableList) LongestQuantity() string
func (BillableList) LongestSubtotal ¶
func (b BillableList) LongestSubtotal(currency string) string
func (BillableList) LongestTax ¶
func (b BillableList) LongestTax() string
func (BillableList) LongestUnitPrice ¶
func (b BillableList) LongestUnitPrice(currency string) string
func (BillableList) Subtotal ¶
func (b BillableList) Subtotal() float64
func (BillableList) Total ¶
func (b BillableList) Total() float64
type Builder ¶
type Builder interface { // Builders can be used as readers after they have generated the invoice. io.ReadCloser // Set the font family to use when BuildInvoice is called. SetFontFamily(FontFamily) // Build an invoice with the given details BuildInvoice(*InvoiceDetails) error // Write the generated invoice to the given path WriteFile(path string) error // A convenience method for building an invoice and automatically // writing it to an output file. BuildAndWriteInvoice(info *InvoiceDetails, outpath string) error }
Builder represents an invoice builder saving to various formats. Currently only PDF is implemented.
type Config ¶
type Config struct { // The configuration for invoices Invoices InvoicesConfig `json:"invoices" yaml:"invoices"` // The entity issuing invoices Payee *Entity `json:"payee" yaml:"payee"` // Entities eligible for invoicing. Payers []*Entity `json:"payers" yaml:"payers"` // Items that can be added to invoices Billables BillableList `json:"billables" yaml:"billables"` }
func (*Config) FormatInvoiceNumber ¶
func (*Config) GetNextInvoiceNumber ¶
type Entity ¶
type Entity struct { *Address `json:",inline" yaml:",inline"` Alias string `json:"alias" yaml:"alias"` BankAccount *BankAccount `json:"bankAccount" yaml:"bankAccount"` RegistrationNo string `json:"registrationNo" yaml:"registrationNo"` Email string `json:"email" yaml:"email"` Currency string `json:"currency" yaml:"currency"` }
type FontFamily ¶
type FontFamily string
const ( FontFamilyHack FontFamily = "Hack" FontFamilyUbuntuMono FontFamily = "UbuntuMono" FontFamilyAnonymousPro FontFamily = "AnonymousPro" FontFamilyGoMono FontFamily = "GoMono" FontFamilySpaceMono FontFamily = "SpaceMono" FontFamilyLiberationMono FontFamily = "LiberationMono" FontFamilyLuxiMono FontFamily = "LuxiMono" )
func (FontFamily) String ¶
func (f FontFamily) String() string
type InvoiceDetails ¶
type InvoiceDetails struct { // The invoice number InvoiceNumber string // The date the invoice is being issued InvoiceDate time.Time // The date the invoice is due DueDate time.Time // The entity sending the invoice Payee *Entity // The entity responsible for paying the invoice Payer *Entity // The billable items in the invoice Items BillableList }
InvoiceDetails represents the details required for building an invoice.
type InvoicesConfig ¶
type InvoicesConfig struct { // A prefix appended to invoice numbers Prefix string `json:"prefix" yaml:"prefix"` // A directory to store invoices by default Directory string `json:"directory" yaml:"directory"` // The font family to use for invoices FontFamily FontFamily `json:"fontFamily" yaml:"fontFamily"` // The number of zeroes to pad invoice numbers with ZeroPadding int `json:"zeroPadding" yaml:"zeroPadding"` }
Click to show internal directories.
Click to hide internal directories.