new_year: add profit to account 2970

This commit is contained in:
Joerg Lehmann 2024-01-13 12:07:07 +01:00
parent 3b073d8737
commit 4b85156f60
2 changed files with 10 additions and 3 deletions

View File

@ -14,7 +14,8 @@ action can be one of the following:
mwst3 mwst3
mwst4 mwst4
- new_year : writes current account balance values to STDOUT (to be used for - 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)
<accounts file> is a text file with the following format (example line): <accounts file> is a text file with the following format (example line):

View File

@ -60,6 +60,7 @@ var profit float64 = 0.0
const reportTitle = "Jahresrechnung - nbit Informatik GmbH" const reportTitle = "Jahresrechnung - nbit Informatik GmbH"
const journalTitle = "Journal - nbit Informatik GmbH" const journalTitle = "Journal - nbit Informatik GmbH"
const MWST_ACCOUNT = "2201" const MWST_ACCOUNT = "2201"
const PROFIT_ACCOUNT = "2970"
const defaultFontSize = 12 const defaultFontSize = 12
const smallFontSize = 8 const smallFontSize = 8
const marginTop = 10 const marginTop = 10
@ -704,6 +705,7 @@ func outputJournal() {
func outputNewYear() { func outputNewYear() {
var active_accounts []string var active_accounts []string
var amountString string
for k := range account_balance { for k := range account_balance {
active_accounts = append(active_accounts, k) active_accounts = append(active_accounts, k)
} }
@ -711,10 +713,14 @@ func outputNewYear() {
for _, myaccount := range active_accounts { for _, myaccount := range active_accounts {
// only Assets or Liabilities // only Assets or Liabilities
at := accountType(myaccount) 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 at == "A" || at == "L" {
if amountString != "0.00" { if amountString != "0.00" {
fmt.Printf("%s: %.2f\n", myaccount, account_balance[myaccount].balance_end) fmt.Printf("%s: %s\n", myaccount, amountString)
} }
} }