Trn []Transaction `xml:"book>transaction"`
}
+// tax
+type TaxReport struct {
+ Expenses [2]int
+ InputTax [2]int
+ ExpExc [2]int
+ ITExc [2]int
+ Receipts [2]int
+ SalesTax [2]int
+}
+
// 'global' data
var data ParsedData
+var tax_report TaxReport
func main() {
check_balance(&data.Trn[tc],accnt,sel_date)
}
+ // tax report
+ fmt.Println("Umsatzsteuervoranmeldung (19% | 7%):")
+ fmt.Println("------------------------------------")
+ fmt.Println("Aufwendungen:",tax_report.Expenses[0],
+ tax_report.Expenses[1]);
+ fmt.Println("ohne Ausn. :",tax_report.Expenses[0]-
+ tax_report.ExpExc[0],
+ tax_report.Expenses[1]-
+ tax_report.ExpExc[1]);
+ fmt.Println("gesch. Vst. :",int((tax_report.Expenses[0]*19)/100.0),
+ int((tax_report.Expenses[1]*7)/100.0))
+ fmt.Println("ohne Ausn. :",int(((tax_report.Expenses[0]-
+ tax_report.ExpExc[0])*19)/100.0),
+ int(((tax_report.Expenses[1]-
+ tax_report.ExpExc[1])*7)/100.0))
+ fmt.Println("Vorsteuer :",tax_report.InputTax[0],
+ tax_report.InputTax[1],
+ "->",tax_report.InputTax[0]+tax_report.InputTax[1]);
+ fmt.Println("------------------------------------")
+ fmt.Println("Einnahmen :",-tax_report.Receipts[0],
+ -tax_report.Receipts[1]);
+ fmt.Println("gesch. Ust. :",int((-tax_report.Receipts[0]*19)/100.0),
+ int((-tax_report.Receipts[1]*7)/100.0));
+ fmt.Println("Umsatzsteuer:",-tax_report.SalesTax[0],
+ -tax_report.SalesTax[1]);
+ fmt.Println("------------------------------------")
+
}
func check_balance(ta *Transaction,accnt map[string]amap,sel_date string) bool {
// check for exceptions
exc := false
for ec := range trn_exc {
- if ta.Description == trn_exc[ec] {
+ if strings.Contains(ta.Description,trn_exc[ec]) {
exc = true
break
}
// }
//}
+ // tax report
+ for tv := 0; tv<2; tv++ {
+ tax_report.Expenses[tv] += sum[tv][0][1]
+ tax_report.InputTax[tv] += sum[tv][1][1]
+ tax_report.Receipts[tv] += sum[tv][0][0]
+ tax_report.SalesTax[tv] += sum[tv][1][0]
+ if exc {
+ tax_report.ExpExc[tv] += sum[tv][0][1]
+ tax_report.ITExc[tv] += sum[tv][1][1]
+ }
+ }
+
// check
var expected [2]int
check := true