diff options
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{ |
