invoice

package
v0.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

nolint: gomnd

nolint: all

nolint: gomnd

nolint: gomnd

nolint: gomnd

nolint: gomnd

nolint: gomnd

nolint: gomnd

nolint: gomnd

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCouldNotDoFontStuff is returned when we could not do font stuff
	ErrCouldNotDoFontStuff = errors.New("could not do font stuff")

	// ErrCouldNotSaveInvoice is returned when we could not save the invoice
	ErrCouldNotSaveInvoice = errors.New("could not save the invoice")

	// ErrCouldNotSetInvoiceLayout is returned when we could not set the invoice layout
	ErrCouldNotSetInvoiceLayout = errors.New("could not set the invoice layout")

	// ErrFailedParsingYAML is returned when the invoice input yaml could not be parsed
	ErrFailedParsingYAML = errors.New("could not unmarshal yaml values")
)

Functions

This section is empty.

Types

type Bank

type Bank struct {
	AccountNumber string `yaml:"accountNumber"`
	Swift         string `yaml:"swift"`
}

Bank details on the invoice

type Buyer

type Buyer struct {
	Name    string `yaml:"name"`
	Address string `yaml:"address"`
	VAT     string `yaml:"vat"`
}

Buyer company details

type Company

type Company struct {
	Buyer  Buyer  `yaml:"buyer"`
	Seller Seller `yaml:"seller"`
}

Company details of buyer and seller

type Invoice

type Invoice struct {
	Number    string  `yaml:"number"`
	IssueDate string  `yaml:"issueDate"`
	SaleDate  string  `yaml:"saleDate"`
	DueDate   string  `yaml:"dueDate"`
	Notes     string  `yaml:"notes"`
	Company   Company `yaml:"company"`
	Bank      Bank    `yaml:"bank"`
	Items     []*Item `yaml:"items"`
	Currency  string  `yaml:"currency"`
	Signature string  `yaml:"signature"`
	Options   Options `yaml:"options"`
	// contains filtered or unexported fields
}

Invoice parameters.

func NewInvoice

func NewInvoice(file []byte) (*Invoice, error)

New returns Invoice struct loaded with values from YAML and prepares PDF struct

func (*Invoice) BuildBankDetails

func (i *Invoice) BuildBankDetails()

BuildBankDetails prepares rows with Bank details on the invoice

func (*Invoice) BuildCompanyDetails

func (i *Invoice) BuildCompanyDetails()

BuildCompanyDetails prepares rows with Buyer and Seller contact details on the invoice

func (*Invoice) BuildInvoiceHeader

func (i *Invoice) BuildInvoiceHeader()

BuildInvoiceHeader prepares header on the invoice

func (*Invoice) BuildInvoiceLineItems

func (i *Invoice) BuildInvoiceLineItems()

BuildInvoiceLineItems prepares Tablelist with items on the invoice with calculated tax amounts and total gross amounts

func (*Invoice) BuildPDFFooter

func (i *Invoice) BuildPDFFooter()

BuildPDFFooter prepares footer on the invoice

func (*Invoice) BuildSignatureLines

func (i *Invoice) BuildSignatureLines()

BuildSignatureLines prepares signatures of the buyer and seller

func (*Invoice) SaveAsBytes

func (i *Invoice) SaveAsBytes() ([]byte, error)

Save saves Invoice to bytes and closes it

func (*Invoice) SaveToPdf

func (i *Invoice) SaveToPdf(outputPath string) error

SaveToPdf saves Invoice to a PDF file and closes the file

type Item

type Item struct {
	Description string  `yaml:"description"`
	Quantity    float64 `yaml:"quantity"`
	UnitPrice   float64 `yaml:"unitPrice"`
	VATRate     float64 `yaml:"vatRate"`
}

Item parameters

type Options

type Options struct {
	FontFamily string `yaml:"font" default:"Arial"`
}

Options of the PDF document

type Seller

type Seller struct {
	Name    string `yaml:"name"`
	Address string `yaml:"address"`
	VAT     string `yaml:"vat"`
}

Seller company details

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL