diff options
| -rw-r--r-- | interact.go | 12 | ||||
| -rw-r--r-- | sqlite.go | 18 |
2 files changed, 21 insertions, 9 deletions
diff --git a/interact.go b/interact.go index 44f8971..a03a672 100644 --- a/interact.go +++ b/interact.go @@ -403,17 +403,11 @@ func interact(fulldb bool) { c.Println(boldRed(arg, "is not a valid id!")) } } else { - /* pids := GetProjectIds() - selids, lids := getProjectList(pids) - choice := c.MultiChoice(lids, "Select a Project to Edit") - //c.Println(pids) - //c.Println(selids) + selids, lids := GetPaymentList() + choice := c.MultiChoice(lids, "Select a Payment to Edit") if choice > -1 { - editProject(selids[choice]) - //c.Println(choice,selids[choice]) + EditPayment(selids[choice]) } - //c.Println(boldRed("editproject <id> - Please enter an id")) - */ } c.Println(promptcol("______________________")) }, @@ -1815,6 +1815,24 @@ func setProject(nid int) { showCurrentTask() } +func GetPaymentList() (outint []int, outstr []string) { + rows, err := db.Query("SELECT id, customerid, amount, bills, date FROM payments") + checkErr(err) + var id, cuid int + var amt float64 + var bills string + var dat time.Time + + for rows.Next() { + err = rows.Scan(&id, &cuid, &amt, &bills, &dat) + checkErr(err) + cun := getCustomerName(cuid) + st := fmt.Sprintf("%v: (%s) %s : %.2f[€] - Bills: %s",id, dat.Local().Format("2006-01-02"),cun, amt,bills) + outint = append(outint, id) + outstr = append(outstr, st) + } + return +} func getCustomerList() (outint []int, outstr []string) { rows, err := db.Query("SELECT id, company, name FROM customers") checkErr(err) |
