diff options
| author | Nikolaus Gotsche <n@softwarefools.com> | 2019-03-31 01:59:49 +0100 |
|---|---|---|
| committer | Nikolaus Gotsche <n@softwarefools.com> | 2019-03-31 01:59:49 +0100 |
| commit | 0b97a731b9f38f7d98bd9331453aae918953b26d (patch) | |
| tree | a46351d5c62a5e0a5233b126fe20b1559f7957e7 /interact.go | |
| parent | 31bea987b8e6fbcbe0c34f1ea5f2b96e436da41a (diff) | |
Reprint Bills
Diffstat (limited to 'interact.go')
| -rw-r--r-- | interact.go | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/interact.go b/interact.go index 4aad9d1..d25c644 100644 --- a/interact.go +++ b/interact.go @@ -448,6 +448,60 @@ func interact(fulldb bool) { }) shell.AddCmd(stopcmd) } + // PRINT commans + { + printcmd := &ishell.Cmd{ + Name: "print", + Help: "yyy / xxx / bills", + LongHelp: ` Usage: print <command> + Print Bills and Reports.`, + } + printcmd.AddCmd(&ishell.Cmd{ + Name: "bills", + Help: "Print selected Bills again to pdf", + LongHelp: ` Usage: print bills + Show all Projects with a small summary, sorted by Customer.`, + Func: func(c *ishell.Context) { + tids := GetBillIds() + ids, str := GetBillList(tids) + choices := c.Checklist(str, + "Which Tasks should be charged in the new bill ?", + nil) + out := func() (c []int) { + for _, v := range choices { + if v > -1 { + c = append(c, ids[v]) + } + } + return + } + prbills := loadBills(out()) + if isInterSure(fmt.Sprintf("Print %v Bills?",len(prbills))) { + c.ProgressBar().Indeterminate(true) + c.ProgressBar().Start() + for i,_ := range prbills { + _, cust := GetProject(prbills[i].project) + files := billTemplate(prbills[i], cust) + err = runLatex(files.Main, prbills[i].identity) + } + c.ProgressBar().Stop() + if err == nil { + c.Println("Finished without Errors") + } else { + c.Println("Finished with error:", err) + } + c.Print("<<Continue>>") + c.ReadLine() + }else{ + c.Println(boldRed("Charging Aborted")) + } + + + c.Println(promptcol("______________________")) + }, + }) + shell.AddCmd(printcmd) + } // SHOW commands { showcmd := &ishell.Cmd{ |
