From 86c22853ee70e74954c652ba34dd0d499de50e54 Mon Sep 17 00:00:00 2001 From: Nikolaus Gotsche Date: Mon, 9 Nov 2020 02:49:21 +0100 Subject: UstIDs for Customers and Owner, Tax Rate implemented --- config.go | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'config.go') diff --git a/config.go b/config.go index 944bd45..5f84da1 100644 --- a/config.go +++ b/config.go @@ -5,7 +5,7 @@ import ( "fmt" //"os" "io/ioutil" - //"strconv" + "strconv" "github.com/BurntSushi/toml" "github.com/atrox/homedir" "github.com/fatih/color" @@ -25,11 +25,13 @@ type Config struct { Mail string //`toml:"mail"` Url string //`toml:"url"` Taxid string //`toml:"taxid"` + Uid string //`toml:"uid"` Bankacc string //`toml:"bankacc"` Banklz string //`toml:"banklz"` Bankname string //`toml:"bankname"` Iban string //`toml:"iban"` Bic string //`toml:"bic"` + Ust float64 //`toml:"ust"` } var conffile string @@ -87,7 +89,7 @@ func makeNewTOML(gibts bool) { n := "" file, err := homedir.Expand("~/.mywork.db") checkErr(err) - config = Config{file, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n} + config = Config{file, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n,0.0} } //fmt.Println("Whats Your Namecount\n") database := getNewInterInput("DB File Path: ", config.Database, nli) @@ -103,13 +105,25 @@ func makeNewTOML(gibts bool) { mail := getNewInterInput("Email: ", config.Mail, nli) url := getNewInterInput("URL: ", config.Url, nli) taxid := getNewInterInput("Tax ID: ", config.Taxid, nli) + uid := getNewInterInput("UID: ", config.Uid, nli) + var ust float64 + for{ + uststr := getNewInterInput("USt %: ", fmt.Sprint(config.Ust), nli) + ust, err = strconv.ParseFloat(uststr, 64) + if err != nil { + //fmt.Println(nli,uststr, boldRed("can not be Parsed as a Float."), "Try a sh ape of X.X") + fmt.Println(nli,uststr, "can not be Parsed as a Float.", "Try a sh ape of X.X") + } else { + break + } + } bankname := getNewInterInput("Bank Name: ", config.Bankname, nli) bankacc := getNewInterInput("Bank Account: ", config.Bankacc, nli) banklz := getNewInterInput("BLZ: ", config.Banklz, nli) iban := getNewInterInput("IBAN: ", config.Iban, nli) bic := getNewInterInput("BIC: ", config.Bic, nli) - conf := Config{database, folder, prefix, name, street, zip, city, country, telefon, mobile, mail, url, taxid, bankacc, banklz, bankname, iban, bic} + conf := Config{database, folder, prefix, name, street, zip, city, country, telefon, mobile, mail, url, taxid, uid, bankacc, banklz, bankname, iban, bic, ust} buf := new(bytes.Buffer) err = toml.NewEncoder(buf).Encode(conf) -- cgit v1.2.3