]> wagnertech.de Git - mfinanz.git/blobdiff - SL/IS.pm
Ersatzmuster für Kunden/Lieferanten mit \n und/oder \r im Namen hinzugefügt. (bug...
[mfinanz.git] / SL / IS.pm
index cd90a8578d02acd93719eb7f635d6cf6ee08bc01..6523d243bb5606137025786503ae20cfa0e3f109 100644 (file)
--- a/SL/IS.pm
+++ b/SL/IS.pm
@@ -382,8 +382,12 @@ sub invoice_details {
       $form->{paid} += $form->parse_amount($myconfig, $form->{"paid_$i"});
     }
   }
-
-  $form->{subtotal} = $form->format_amount($myconfig, $form->{total}, 2);
+  if($form->{taxincluded}) {
+    $form->{subtotal} = $form->format_amount($myconfig, $form->{total} - $tax, 2);
+  }
+  else {
+    $form->{subtotal} = $form->format_amount($myconfig, $form->{total}, 2);
+  }
   $yesdiscount = $form->{nodiscount_total} - $nodiscount;
   $form->{nodiscount_subtotal} = $form->format_amount($myconfig, $form->{nodiscount_total}, 2);
   $form->{discount_total} = $form->format_amount($myconfig, $form->{discount_total}, 2);
@@ -1696,12 +1700,12 @@ sub get_customer {
   map { $form->{$_} = $ref->{$_} } keys %$ref;
 
   my $query = qq|SELECT sum(a.amount - a.paid) AS dunning_amount FROM ar a 
-                 WHERE a.paid < a.amount AND a.customer_id = ? AND a.dunning_id IS NOT NULL|;
+                 WHERE a.paid < a.amount AND a.customer_id = ? AND a.dunning_config_id IS NOT NULL|;
   $ref = selectfirst_hashref_query($form, $dbh, $query, $form->{customer_id});
   map { $form->{$_} = $ref->{$_} } keys %$ref;
 
   my $query = qq|SELECT dnn.dunning_description AS max_dunning_level FROM dunning_config dnn 
-                 WHERE id in (SELECT dunning_id from ar WHERE paid < amount AND customer_id = ? AND dunning_id IS NOT NULL)
+                 WHERE id in (SELECT dunning_config_id from ar WHERE paid < amount AND customer_id = ? AND dunning_config_id IS NOT NULL)
                  ORDER BY dunning_level DESC LIMIT 1|;
   $ref = selectfirst_hashref_query($form, $dbh, $query, $form->{customer_id});
   map { $form->{$_} = $ref->{$_} } keys %$ref;