From bf7dfda3e67f67687109290209c8b09576a417fd Mon Sep 17 00:00:00 2001 From: Nikolaus Gotsche Date: Fri, 10 May 2019 01:08:05 +0200 Subject: Minor beautifications --- sqlite.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'sqlite.go') diff --git a/sqlite.go b/sqlite.go index 1c92a17..bacb21b 100644 --- a/sqlite.go +++ b/sqlite.go @@ -87,8 +87,10 @@ func (t Task) Duration() float64 { dur := t.Stop.Sub(t.Start) return dur.Hours() } - - +func (t Task) Money() float64 { + _,cu := GetProject(t.Projectid) + return t.Duration()*cu.Satz +} // Global Variables @@ -1565,8 +1567,12 @@ func AddPayment(dat string) { if len(selids)>0{ break }else{ + // TODO allow no bills and ask fmt.Println(boldRed("At least one Bill should Correspont to a payment!")) - getInterInput("") + if isInterSure(sli+"Do you want to continue without a selection?") { + //getInterInput("") + break + } } } mybills := loadBills(selids) @@ -1578,7 +1584,7 @@ func AddPayment(dat string) { } fmt.Println(frame(boldGreen("New Payment"),true)) - fmt.Println(nli," Amount:",amtfl) + fmt.Println(nli," Amount:",amtfl,"[€]") fmt.Println(nli," Date:",date.Format("2006-01-02")) fmt.Println(nli,"Customer:",getCustomerName(icust)) fmt.Println(sub("Invoices")) @@ -1590,7 +1596,7 @@ func AddPayment(dat string) { hsum += it.Hours } fmt.Printf("%s %s : %s (%s) %.1f[h] %.2f[€]\n",nli,bi.identity,bi.projectname,bi.date.Format("2006-01-02 15:04"),hsum,bsum) - sum += bsum + //sum += bsum } if amtfl != sum { fmt.Println(sli,boldRed(" The sum of the bills (",sum,"€) does not match Payment amount!")) -- cgit v1.2.3