diff --git a/README.md b/README.md index 19388c9..d29f824 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,8 @@ action can be one of the following: mwst3 mwst4 - new_year : writes current account balance values to STDOUT (to be used for - new transaction file for next year) + new transaction file for next year), profit will be added to + the PROFIT_ACCOUNT (2970) is a text file with the following format (example line): diff --git a/bookkeeper.go b/bookkeeper.go index 75f4411..ba63caa 100644 --- a/bookkeeper.go +++ b/bookkeeper.go @@ -60,6 +60,7 @@ var profit float64 = 0.0 const reportTitle = "Jahresrechnung - nbit Informatik GmbH" const journalTitle = "Journal - nbit Informatik GmbH" const MWST_ACCOUNT = "2201" +const PROFIT_ACCOUNT = "2970" const defaultFontSize = 12 const smallFontSize = 8 const marginTop = 10 @@ -704,6 +705,7 @@ func outputJournal() { func outputNewYear() { var active_accounts []string + var amountString string for k := range account_balance { active_accounts = append(active_accounts, k) } @@ -711,10 +713,14 @@ func outputNewYear() { for _, myaccount := range active_accounts { // only Assets or Liabilities at := accountType(myaccount) - amountString := fmt.Sprintf("%.2f", account_balance[myaccount].balance_end+avoidMinusZero) + if myaccount == PROFIT_ACCOUNT { + amountString = fmt.Sprintf("%.2f", account_balance[myaccount].balance_end+avoidMinusZero-profit) + } else { + 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) + fmt.Printf("%s: %s\n", myaccount, amountString) } }