summaryrefslogtreecommitdiff
path: root/interact.go
diff options
context:
space:
mode:
authorNikolaus Gotsche <n@softwarefools.com>2019-03-30 00:57:02 +0100
committerNikolaus Gotsche <n@softwarefools.com>2019-03-30 00:57:02 +0100
commit31bea987b8e6fbcbe0c34f1ea5f2b96e436da41a (patch)
treefb0328d533aadde8dd5a81b399374f2f42e7948b /interact.go
parent8ae371a94cd1fa75e74e91960783648e82aaf031 (diff)
show invoice details0.3.9
Diffstat (limited to 'interact.go')
-rw-r--r--interact.go40
1 files changed, 39 insertions, 1 deletions
diff --git a/interact.go b/interact.go
index 4cdb1a7..4aad9d1 100644
--- a/interact.go
+++ b/interact.go
@@ -490,7 +490,7 @@ func interact(fulldb bool) {
showcmd.AddCmd(&ishell.Cmd{
Name: "bills",
Help: "<n> - Show the last n bills. If no n specified all Bills are shown ",
- LongHelp: ` Usage: all bills <n>
+ LongHelp: ` Usage: show bills <n>
Show the last n Bills with a small summary. If no <n> is specified all bills are shown.`,
Func: func(c *ishell.Context) {
//c.ClearScreen()
@@ -511,6 +511,44 @@ func interact(fulldb bool) {
c.Println(promptcol("______________________"))
},
})
+ showcmd.AddCmd(&ishell.Cmd{
+ Name: "invoice",
+ Help: "<id> - Show details of the invoice with given id.",
+ LongHelp: ` Usage: show invoice <id>
+ Show detailed information of Invoice with given id. If no <id> is specified a selection screen is shown.`,
+ Func: func(c *ishell.Context) {
+ //c.ClearScreen()
+ arg := "none"
+ if len(c.Args) > 0 {
+ arg = strings.Join(c.Args, " ")
+ argi, err := strconv.Atoi(arg)
+ if err == nil {
+ if isBill(argi){
+ mid := []int{argi}
+ thebill := loadBills(mid)
+ ShowBill(thebill[0], true)
+ }else{
+ c.Println(boldRed(arg, "is not a valid id!"))
+ }
+ } else {
+ c.Println(boldRed(arg, "is not a valid integer!"))
+ }
+ } else {
+ tids := GetBillIds()
+ selids, lids := GetBillList(tids)
+ choice := c.MultiChoice(lids, "Select a Bill to Edit")
+ //c.Println(tids)
+ //c.Println(selids)
+ if choice > -1 {
+ mid := []int{selids[choice]}
+ thebill := loadBills(mid)
+ ShowBill(thebill[0], true)
+ }
+ }
+ //stdOut()
+ c.Println(promptcol("______________________"))
+ },
+ })
shell.AddCmd(showcmd)
}
/*