diff --git a/README.md b/README.md index dbbdefb..19388c9 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ bookkeeper action can be one of the following: - check : checks data - balance : creates a balance sheet on STDOUT (Format: PDF) -- journal : creates a journal on STDOUT (Format: Markdown) +- journal : creates a journal on STDOUT (Format: Text) - mwst1 : create VAT report (1st to 4th quarter) mwst2 on STDOUT mwst3 diff --git a/bookkeeper.go b/bookkeeper.go index 3c64ca1..75f4411 100644 --- a/bookkeeper.go +++ b/bookkeeper.go @@ -728,33 +728,40 @@ func usage() { os.Exit(1) } +func readData(accountdatafile string, transactiondatafile string) { + readAccountData(accountdatafile) + readTransactionData(transactiondatafile) + profit = calculateProfit() +} + func main() { if len(os.Args) != 4 { usage() } - readAccountData(os.Args[2]) - readTransactionData(os.Args[3]) - profit = calculateProfit() - //fmt.Fprintf(os.Stderr,"accounts: %#v\n", accounts) //fmt.Fprintf(os.Stderr,"transactions: %#v\n", transactions) //fmt.Fprintf(os.Stderr,"account_balance: %#v\n", account_balance) switch action := os.Args[1]; action { case "check": - fmt.Fprintln(os.Stderr, "Check Data") + fmt.Fprintln(os.Stderr, "INFO: Data is checked by reading it...") + readData(os.Args[2], os.Args[3]) case "balance": fmt.Fprintln(os.Stderr, "INFO: Create Balance Sheet") + readData(os.Args[2], os.Args[3]) createBalanceSheet() case "journal": fmt.Fprintln(os.Stderr, "INFO: Create Journal") + readData(os.Args[2], os.Args[3]) outputJournal() case "mwst1", "mwst2", "mwst3", "mwst4": fmt.Fprintln(os.Stderr, "INFO: Create Mwst Quarterly Report") + readData(os.Args[2], os.Args[3]) outputMwst(action) case "new_year": fmt.Fprintln(os.Stderr, "INFO: Create New Year") + readData(os.Args[2], os.Args[3]) outputNewYear() default: usage()