diff options
| author | Nikolaus Gotsche <n@softwarefools.com> | 2018-08-29 04:27:16 +0200 |
|---|---|---|
| committer | Nikolaus Gotsche <n@softwarefools.com> | 2018-08-29 04:27:16 +0200 |
| commit | ad7b23c17dbe05e7e6a4ad3ea023f692f832a938 (patch) | |
| tree | 0832c6fa8e8be7a66a59e371222aab19c3a2bf5d /texify.go | |
| parent | ed43a6d9c450483914281e5fc3b6877116fc6ad0 (diff) | |
LaTeX templating and bills begin
Diffstat (limited to 'texify.go')
| -rw-r--r-- | texify.go | 84 |
1 files changed, 68 insertions, 16 deletions
@@ -5,35 +5,87 @@ import ( "text/template" ) -type Todo struct { - Name string - Adresse string - Number uint +type FeeItem struct{ + Task string + Timeframe string + Hours int + Price float64 +} + +type Data struct { + InvDate string + WorkDate string + InvNo string + ProjName string + CustComp string + CustName string + CustStr string + CustZip string + CustCity string + TaxID string + MyName string + MyStr string + MyZip string + MyCity string + MyTel string + MyMob string + MyMail string + MyUrl string + BankNum string + BankLZ string + BankName string + Iban string + Bic string } func tmpltest() { //Sampledata - td := Todo{"Jemand Wiadschosei", "123 Fakestreet 299",99} + dat := Data{"17.6.18", + "3.4.-7.6.18", + "HN 07/18", + "Testkopfstrasse 132", + "Somecompany", + "Jemand Wiadschosei", + "Fakestreet 123", + "6996", + "Busenhausen", + "6575-6544", + "Meinam Sauluschtig", + "Saubastrasse 86", + "1111", + "Nicetown", + "+43 (1) 655 555 23", + "+43 (0) 650 555 32", + "Meinam@sauluscht.ig", + "www.saulust.com", + "7272626272", + "20220", + "Might Bank Inc.", + "IB47 2382 4338 2822 1222", + "BICBICBIC"} + var inv []FeeItem + + inv = append(inv,FeeItem{"Modellierung Dachkonstruktion", "1.4.-27.4.18",13,325}) + inv = append(inv,FeeItem{"Dokument Vorbereitung", "9.4.-5.5.18",15,375}) + inv = append(inv,FeeItem{"Begehungen und Besprechungen", "1.4.-19.4.18",12,300}) + inv = append(inv,FeeItem{"Wichtig aussehen", "5.5.-5.5.18",2,50}) //Parse Templates tmpl, err := template.New("invoice").Delims("[[","]]").ParseGlob("templates/*.tex") checkErr(err) - //if err != nil { - // panic(err) - //} - //t, err := template.New("todos").Parse("You have a task named \"{{ .Name}}\" with description: \"{{ .Description}}\"") - //if err != nil { - // panic(err) - //} - //err = tmpl.Execute(os.Stdout, td) //Open File - f, err := os.Create("outtex/1_data.tex") + datf, err := os.Create("outtex/1_data.tex") checkErr(err) - defer f.Close() + invf, err := os.Create("outtex/1_invoice.tex") + checkErr(err) + defer datf.Close() + defer invf.Close() //Execute Template //err = tmpl.ExecuteTemplate(os.Stdout, "invoice.tex", td) - err = tmpl.ExecuteTemplate(f, "_data.tex", td) + err = tmpl.ExecuteTemplate(datf, "_data.tex", dat) + checkErr(err) + err = tmpl.ExecuteTemplate(invf, "_invoice.tex", inv) checkErr(err) } |
