webinvoice

package
Version: v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2019 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Template = "invoice.tex.tmpl"

Variables

This section is empty.

Functions

func DivideTimesRate

func DivideTimesRate(a, b, rate float64) float64

func Euro

func Euro(a, rate float64) float64

func Half

func Half(a float64) float64

func HalfTimesRate

func HalfTimesRate(a, rate float64) float64

func Kenmerk

func Kenmerk(now time.Time) string

Kernmerk returns a unique identifier for this invoice.

func TeXFiles

func TeXFiles(dir string) ([]string, error)

TeXFiles returns the tex and jpg files found in the directory dir.

Types

type Invoice

type Invoice struct {
	FileName string // Name of the generated PDF.

	Kenmerk string // Unique kenmerk of this invoice.

	Tour     string
	Persons  int
	Time     string
	Duration string // 2:00
	Cost     float64
	Date     string // YYYY/MM/DD form
	Name     string
	FullName string
	Email    string // Has become optional.
	Where    string // Where to pickup.
	How      string // Ends in "om".

	Rate float64 // current GBP:EUR rate, autofill
	Day  string  // autofill

	OrigDate string // original values of Time and Data (before we converted to NL).
	OrigTime string
}

Invoice holds all the data we need to generate an invoice

func (i *Invoice) CalendarLink(t1, t2 time.Time) string

CalendarLink returns a Google calendar link that can be used to add the tour directly in the calendar.

func (*Invoice) Create

func (i *Invoice) Create(tmplDir, tmpl string) ([]byte, error)

Create parses the templates and runs pdflatex on the resulting tex file. It returns generated PDF.

func (*Invoice) ExecuteTemplateAndWrite

func (i *Invoice) ExecuteTemplateAndWrite(t *template.Template, name, dst string) error

ExecuteTemplateAndWrite executes the template and writes the buffer to dst.

func (*Invoice) FillOut

func (i *Invoice) FillOut() (err error)

FillOut fills in these missing fields in i, such as: Rate, Day, Filename and makes Date Dutch.

func (*Invoice) MailBody

func (i *Invoice) MailBody() (*bytes.Buffer, error)

func (*Invoice) MailSubject

func (i *Invoice) MailSubject() string

type InvoiceMail

type InvoiceMail struct {
	Name    string
	Kenmerk string
	Link    string
}

Invoice is a customer invoice form.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL