diff options
| -rw-r--r-- | interact.go | 18 | ||||
| -rw-r--r-- | sqlite.go | 10 |
2 files changed, 25 insertions, 3 deletions
diff --git a/interact.go b/interact.go index 392af16..d5bf1dc 100644 --- a/interact.go +++ b/interact.go @@ -756,17 +756,25 @@ func interact(fulldb bool) { //SELECT SUBSET AND NAME BILLITEM //c.clear()//Println(some,"Str2:",str2) for { + doneinfo := "Already Billed\n" if len(restids) == 0 { break } + for _,itm := range allitems { + doneinfo = fmt.Sprintf("%s %s - %v(h)\n",doneinfo,itm.Task,itm.Hours) + } resttasks := GetSelectedTasks(restids) rcount, rhours, _ := AnalyzeTasks(resttasks) rids, rstr := GetTaskList(restids, false,false) qu := "Select Tasks to Group as Billitem" restinfo = fmt.Sprintf("%v Tasks Left, Total %.2f(h)\n%s", rcount, rhours, qu) - pre := fmt.Sprintf("%s%s%s", fullbillinfo, sep, restinfo) - + pre := "" + if len(allitems) > 0{ + pre = fmt.Sprintf("%s%s%s%s%s", fullbillinfo, sep,doneinfo,sep, restinfo) + }else{ + pre = fmt.Sprintf("%s%s%s", fullbillinfo, sep, restinfo) + } choices2 := c.Checklist(rstr, pre, nil) out = func() (c []int) { for _, v := range choices2 { @@ -781,8 +789,12 @@ func interact(fulldb bool) { if len(taskids) > 0 { ittasks := GetSelectedTasks(taskids) + comm := GetSelectedComments(ittasks) itcount, ithours, itdur := AnalyzeTasks(ittasks) c.Printf("\n%v Tasks Selected, Total %.2f(h), Date: %s\n", itcount, ithours, itdur) + if len(comm) >0 { + c.Printf(" Comments on selected Tasks:\n%s\n",StrLines(comm," ")) + } c.ShowPrompt(false) c.Print("Name your Item for the Bill: ") tsk := c.ReadLine() @@ -798,7 +810,7 @@ func interact(fulldb bool) { } } c.Printf("%T %v - %T %v\n", tsk, tsk, hrf, hrf) - allitems = append(allitems, billitem{tsk, itdur, hrf, Round(hrf*cust.Satz, 5)}) + allitems = append(allitems, billitem{tsk, itdur, hrf, Round(hrf*cust.Satz, 1)}) c.Print("<<Continue>>") c.ReadLine() //c.ShowPrompt(true) @@ -940,6 +940,16 @@ func GetSelectedProjects(in []int) (out []Project) { return } +// Return the Comments of all selected Tasks if they exist as a []string +func GetSelectedComments(in []Task) (comms []string) { + for _,tsk := range in { + if len(tsk.Comment) > 0{ + comms = append(comms,fmt.Sprintf("%s - %s",tsk.Taskname,tsk.Comment)) + } + } + return +} + // Return the []tasks corresponding to an []int of task ids func GetSelectedTasks(in []int) (outtask []Task) { ins := strings.Trim(strings.Replace(fmt.Sprint(in), " ", " , ", -1), "[]") |
