+ # USTVA Pos 35
+ if ($ref->{pos_ustva} eq '35') {
+ if ($ref->{rate} == 0.16) {
+ $form->{"pos_ustva_81b_kivi"} += $ref->{amount};
+ } elsif ($ref->{rate} == 0.05) {
+ $form->{"pos_ustva_86b_kivi"} += $ref->{amount};
+ } elsif ($ref->{rate} == 0.19) {
+ # pos_ustva says 16, but rate says 19
+ # (pos_ustva should be tax dependent and not taxkeys dependent)
+ # correction hotfix for this case:
+ # bookings exists with 19% ->
+ # move 19% bookings to the 19% position
+ # Dont rely on dates of taxkeys
+ $corr = 1;
+ $form->{"81"} += $ref->{amount};
+ } elsif ($ref->{rate} == 0.07) {
+ # pos_ustva says 5, but rate says 7
+ # see comment above:
+ # Dont rely on dates of taxkeys
+ $corr = 1;
+ $form->{"86"} += $ref->{amount};
+ } else {die ("No valid tax rate for pos 35" . Dumper($ref)); }
+ }
+ # USTVA Pos 36 (Steuerkonten)
+ if ($ref->{pos_ustva} eq '36') {
+ if ($ref->{accno} =~ /^$accno_sixteen/) {
+ $form->{"pos_ustva_811b_kivi"} += $ref->{amount};
+ } elsif ($ref->{accno} =~ /^$accno_five/) {
+ $form->{"pos_ustva_861b_kivi"} += $ref->{amount};
+ } else { die ("No valid accno for pos 36" . Dumper($ref)); }
+ }
+ $form->{ $ref->{$category} } += $ref->{amount} unless $corr;