From cd8bf769831d98d52d510a1fe9d4e2b6d3cdaaf0 Mon Sep 17 00:00:00 2001 From: Joerg Lehmann Date: Wed, 10 Jan 2024 20:06:35 +0100 Subject: [PATCH] complete first version of new_year --- bookkeeper.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/bookkeeper.go b/bookkeeper.go index 5b05e20..3c64ca1 100644 --- a/bookkeeper.go +++ b/bookkeeper.go @@ -702,6 +702,25 @@ func outputJournal() { } } +func outputNewYear() { + var active_accounts []string + for k := range account_balance { + active_accounts = append(active_accounts, k) + } + sort.Strings(active_accounts) + for _, myaccount := range active_accounts { + // only Assets or Liabilities + at := accountType(myaccount) + amountString := fmt.Sprintf("%.2f", account_balance[myaccount].balance_end+avoidMinusZero) + if at == "A" || at == "L" { + if amountString != "0.00" { + fmt.Printf("%s: %.2f\n", myaccount, account_balance[myaccount].balance_end) + } + } + + } +} + func usage() { fmt.Fprintf(os.Stderr, "usage: bookkeeper \n") fmt.Fprintf(os.Stderr, "\n") @@ -736,6 +755,7 @@ func main() { outputMwst(action) case "new_year": fmt.Fprintln(os.Stderr, "INFO: Create New Year") + outputNewYear() default: usage() }