}
//
-// account data --- add accounts to consider here!
+// accounts considered in tax included balance check
//
var iaa []inv_accnts = []inv_accnts{
// wareneingang 19% and 7% (note: pids!)
var trn_exc = []string{
}
+//
+// accounts which will be summed up
+//
+
+type sum_accnt struct {
+ name string
+ aid string
+ valplus int
+ valminus int
+}
+
+var summed_accounts = []sum_accnt{
+ {"Bankkonto","02ea930fdcc500cf7d3a21b80a126eb0",0,0},
+ {"Kasse","04e71353130ccb554ebaf4c2438d6b2f",0,0},
+}
+
// account maps
type amap struct {
pid string // parent id
-tax_report.SalesTax[1]);
fmt.Println("------------------------------------")
+ // summed accounts
+ fmt.Println("")
+ fmt.Println("Summen einiger Konten:")
+ fmt.Println("----------------------")
+ for sac := range summed_accounts {
+ saccnt := summed_accounts[sac]
+ fmt.Println(" Konto: ",saccnt.name)
+ fmt.Println(" +: ",saccnt.valplus)
+ fmt.Println(" -: ",saccnt.valminus)
+ }
}
func check_balance(ta *Transaction,accnt map[string]amap,sel_date string) bool {
// [taxval: 19=0 7=1][tax: no=0 yes=1][buy: no=0 yes=1]
var sum [2][2][2]int
+ // loop over splits within the transaction
for sc := range ta.Spl {
aid := ta.Spl[sc].AccountId
//accnt[aid].tax
+ // loop over all considered accounts (defined earlier as global)
for iac := range iaa {
tv := int(0)
- // taxval - check accnt instead of iaa!
+ // taxval changed by exception
if tv_ow != -1 {
if tv_ow == 7 {
tv=1
continue
}
}
+ // taxval as defined by account
} else {
if accnt[aid].taxval == 0 {
if accnt[aid].tax {
break
}
}
+ // now get the sums
+ for sac := range summed_accounts {
+ if summed_accounts[sac].aid == aid {
+ inc, _ := strconv.Atoi(strings.TrimSuffix(ta.Spl[sc].Value,"/100"))
+ if inc >= 0 {
+ summed_accounts[sac].valplus += inc
+ } else {
+ summed_accounts[sac].valminus += inc
+ }
+ }
+ }
}
// check for exceptions