Die Funktion "Zahlung buchen" bei Debitorenrechnungen komplett umgeschrieben. Sie...
[kivitendo-erp.git] / bin / mozilla / is.pl
index 1a61ab2..78ee3d3 100644 (file)
@@ -79,7 +79,7 @@ sub add {
 
 sub edit {
   $lxdebug->enter_sub();
-  $form->{"Watchdog::paidaccounts"} = 1;
+
   # show history button
   $form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
   #/show hhistory button
@@ -199,11 +199,6 @@ sub invoice_links {
 
     if ($key eq "AR_paid") {
       for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
-        $lxdebug->message(0, "link " . $form->{acc_trans}->{$key}->[$i - 1]->{link});
-        $lxdebug->dump(0, "...", $form->{acc_trans}->{$key}->[$i - 1]);
-        my $previous_links = { map { $_, 1 } split m/:/, $form->{acc_trans}->{$key}->[$i - 1]->{link} };
-        next if (!$previous_links->{AR});
-
         $form->{"AR_paid_$i"} =
           "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
 
@@ -1016,7 +1011,8 @@ if ($form->{type} eq "credit_note") {
         </tr>
 ";
 
-  my @triggers = ();
+  my @triggers  = ();
+  my $totalpaid = 0;
 
   $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
   for $i (1 .. $form->{paidaccounts}) {
@@ -1067,6 +1063,23 @@ if ($form->{type} eq "credit_note") {
     push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
   }
 
+  my $paid_missing = $form->{oldinvtotal} - $totalpaid;
+
+  print qq|
+    <tr>
+      <td></td>
+      <td></td>
+      <td align="center">| . $locale->text('Total') . qq|</td>
+      <td align="center">| . H($form->format_amount(\%myconfig, $totalpaid, 2)) . qq|</td>
+    </tr>
+    <tr>
+      <td></td>
+      <td></td>
+      <td align="center">| . $locale->text('Missing amount') . qq|</td>
+      <td align="center">| . H($form->format_amount(\%myconfig, $paid_missing, 2)) . qq|</td>
+    </tr>
+|;
+
   map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } qw(paidaccounts selectAR_paid oldinvtotal));
   print qq|<input type="hidden" name="oldtotalpaid" value="$totalpaid">
     </table>