complete first version of new_year

This commit is contained in:
Joerg Lehmann 2024-01-10 20:06:35 +01:00
parent 46e3dccd2a
commit cd8bf76983
1 changed files with 20 additions and 0 deletions

View File

@ -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 <action> <accounts file> <transactions file>\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()
}