package report import ( "time" _ "embed" "git.schreifuchs.ch/lou-taylor/accounting/pkg/invoice/issue" "git.schreifuchs.ch/lou-taylor/accounting/pkg/invoice/model" "git.schreifuchs.ch/lou-taylor/accounting/pkg/invoice/report/qrbill" ) //go:embed assets/template.html var htmlTemplate string type Report struct { Date time.Time Issues []issue.Issue Invoice qrbill.Invoice Rate float64 Company model.Entity Client *model.Entity template string } func New(issues []issue.Issue, company model.Entity, client *model.Entity, rate float64) Report { r := Report{ Date: time.Now(), Issues: issues, Rate: rate, Company: company, Client: client, template: htmlTemplate, } r.Invoice = qrbill.New(r.applyRate(r.Total()), r.Company, r.Client) return r } func (r Report) WithTemplate(template string) Report { r.template = template return r }