invoice

package
v0.0.0-...-4df7676 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bill

type Bill struct {
	ClientName    string
	ClientAddress CompanyAddress
	InvoiceNumber string
	DateOfIssue   string
	// nothing fancy here and complicated, we will just prepend the currency with the price
	Currency string
	Units    []Unit
}

Bill represent the overview representation of a bill

func (Bill) FullClientAddress

func (b Bill) FullClientAddress() string

FullClientAddress returns the complete information of the client in string

func (Bill) InvoiceTotal

func (b Bill) InvoiceTotal() (total float64)

InvoiceTotal computes the total of the invoice due by the client

type CompanyAddress

type CompanyAddress struct {
	Number  int
	Street  string
	ZipCode string
	Country string
}

CompanyAddress contains the address of the company

func (CompanyAddress) String

func (c CompanyAddress) String() string

type CompanyDetails

type CompanyDetails struct {
	Email  string
	Phone  string
	Domain string
}

CompanyDetails contains the details of the company

func (CompanyDetails) String

func (c CompanyDetails) String() string

type Generator

type Generator struct {
	CompanyDetails
	CompanyAddress
	Bill
}

Generator invoice in PDF

func (*Generator) Generate

func (g *Generator) Generate()

Generate invoice in PDF

type Unit

type Unit struct {
	UnitName       string
	PricePerUnit   int // in cent
	UnitsPurchased int
}

Unit represents a line in the bill

func (Unit) Amount

func (u Unit) Amount() float64

Amount computes the total cost of the unit

Jump to

Keyboard shortcuts

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