Anzahlungs-Rg.: Buchen auf Verrechnungskonto ohne Steuer
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Wed, 10 Nov 2021 15:31:03 +0000 (16:31 +0100)
committerJan Büren <jan@kivitendo.de>
Mon, 14 Feb 2022 12:52:01 +0000 (13:52 +0100)
SL/IS.pm

index 9474b18..f64d929 100644 (file)
--- a/SL/IS.pm
+++ b/SL/IS.pm
@@ -51,6 +51,7 @@ use SL::MoreCommon;
 use SL::IC;
 use SL::IO;
 use SL::TransNumber;
+use SL::DB::Chart;
 use SL::DB::Default;
 use SL::DB::Draft;
 use SL::DB::Tax;
@@ -776,6 +777,10 @@ sub _post_invoice {
     my $basefactor;
     my $baseqty;
 
+    if ($form->{type} eq 'invoice_for_advance_payment') {
+      $form->{"income_accno_$i"} = SL::DB::Chart->new(id => $::instance_conf->get_advance_payment_clearing_chart_id)->load->accno;
+    }
+
     $form->{"marge_percent_$i"} = $form->parse_amount($myconfig, $form->{"marge_percent_$i"}) * 1;
     $form->{"marge_absolut_$i"} = $form->parse_amount($myconfig, $form->{"marge_absolut_$i"}) * 1;
     $form->{"lastcost_$i"} = $form->parse_amount($myconfig, $form->{"lastcost_$i"}) * 1;
@@ -1010,6 +1015,16 @@ SQL
     }
   }
 
+  if ($form->{type} eq 'invoice_for_advance_payment') {
+    # invoice for advance payment show tax but does not account it.
+    # tax has to be accounted on payment
+    foreach my $item (split(/ /, $form->{taxaccounts})) {
+      delete $form->{amount}{ $form->{id} }{$item};
+    }
+
+    $tax = 0;
+  }
+
   # Invoice Summary includes Rounding
   my $grossamount = $netamount + $tax;
   my $rounding = $form->round_amount(