Keine Tabs in SL/* Modulen.
[kivitendo-erp.git] / SL / IS.pm
index 9b97821..a176b4d 100644 (file)
--- a/SL/IS.pm
+++ b/SL/IS.pm
@@ -34,8 +34,6 @@
 
 package IS;
 
-#use strict;
-
 use List::Util qw(max);
 
 use SL::AM;
@@ -47,8 +45,11 @@ use SL::DO;
 use SL::GenericTranslations;
 use SL::MoreCommon;
 use SL::IC;
+use SL::IO;
 use Data::Dumper;
 
+use strict;
+
 sub invoice_details {
   $main::lxdebug->enter_sub();
 
@@ -948,9 +949,11 @@ sub post_invoice {
     $form->{marge_total} *= -1;
   }
 
+  IO->set_datepaid(table => 'ar', id => $form->{id}, dbh => $dbh);
+
   if ($payments_only) {
-    $query = qq|UPDATE ar SET paid = ?, datepaid = ? WHERE id = ?|;
-    do_query($form, $dbh, $query,  $form->{paid}, $form->{paid} ? conv_date($form->{datepaid}) : undef, conv_i($form->{id}));
+    $query = qq|UPDATE ar SET paid = ? WHERE id = ?|;
+    do_query($form, $dbh, $query,  $form->{paid}, conv_i($form->{id}));
 
     if (!$provided_dbh) {
       $dbh->commit();
@@ -988,7 +991,7 @@ sub post_invoice {
   $query = qq|UPDATE ar set
                 invnumber   = ?, ordnumber     = ?, quonumber     = ?, cusordnumber  = ?,
                 transdate   = ?, orddate       = ?, quodate       = ?, customer_id   = ?,
-                amount      = ?, netamount     = ?, paid          = ?, datepaid      = ?,
+                amount      = ?, netamount     = ?, paid          = ?,
                 duedate     = ?, deliverydate  = ?, invoice       = ?, shippingpoint = ?,
                 shipvia     = ?, terms         = ?, notes         = ?, intnotes      = ?,
                 curr        = ?, department_id = ?, payment_id    = ?, taxincluded   = ?,
@@ -997,11 +1000,11 @@ sub post_invoice {
                 cp_id       = ?, marge_total   = ?, marge_percent = ?,
                 globalproject_id               = ?, delivery_customer_id             = ?,
                 transaction_description        = ?, delivery_vendor_id               = ?,
-               donumber    = ?
+                donumber    = ?
               WHERE id = ?|;
   @values = (          $form->{"invnumber"},           $form->{"ordnumber"},             $form->{"quonumber"},          $form->{"cusordnumber"},
              conv_date($form->{"invdate"}),  conv_date($form->{"orddate"}),    conv_date($form->{"quodate"}),    conv_i($form->{"customer_id"}),
-                       $amount,                        $netamount,                       $form->{"paid"},     conv_date($form->{"datepaid"}),
+                       $amount,                        $netamount,                       $form->{"paid"},
              conv_date($form->{"duedate"}),  conv_date($form->{"deliverydate"}),    '1',                                $form->{"shippingpoint"},
                        $form->{"shipvia"},      conv_i($form->{"terms"}),                $form->{"notes"},              $form->{"intnotes"},
                        $form->{"currency"},     conv_i($form->{"department_id"}), conv_i($form->{"payment_id"}),        $form->{"taxincluded"} ? 't' : 'f',
@@ -1010,7 +1013,7 @@ sub post_invoice {
                 conv_i($form->{"cp_id"}),            1 * $form->{marge_total} ,      1 * $form->{marge_percent},
                 conv_i($form->{"globalproject_id"}),                              conv_i($form->{"delivery_customer_id"}),
                        $form->{transaction_description},                          conv_i($form->{"delivery_vendor_id"}),
-                      $form->{"donumber"}, #das entsprechende feld lieferscheinnummer aus der html-form 12.02.09 jb
+                       $form->{"donumber"}, #das entsprechende feld lieferscheinnummer aus der html-form 12.02.09 jb
                 conv_i($form->{"id"}));
   do_query($form, $dbh, $query, @values);
 
@@ -1751,8 +1754,8 @@ sub retrieve_item {
 
   #Es soll auch nach EAN gesucht werden, ohne Einschränkung durch Beschreibung
   if ($form->{"partnumber_$i"} && !$form->{"description_$i"}) {
-       $where .= qq| OR (NOT p.obsolete = '1' AND p.ean = ? )|;
-       push @values, $form->{"partnumber_$i"};
+    $where .= qq| OR (NOT p.obsolete = '1' AND p.ean = ? )|;
+    push @values, $form->{"partnumber_$i"};
   }
 
   if ($form->{"description_$i"}) {
@@ -1976,12 +1979,10 @@ sub get_pricegroups_for_parts {
     $id = $form->{"id_$i"};
 
     if (!($form->{"id_$i"}) and $form->{"new_id_$i"}) {
-
       $id = $form->{"new_id_$i"};
     }
 
-    my ($price, $selectedpricegroup_id) = split(/--/,
-      $form->{"sellprice_pg_$i"});
+    my ($price, $selectedpricegroup_id) = split(/--/, $form->{"sellprice_pg_$i"});
 
     my $pricegroup_old = $form->{"pricegroup_old_$i"};
     $form->{"new_pricegroup_$i"} = $selectedpricegroup_id;
@@ -2054,14 +2055,11 @@ sub get_pricegroups_for_parts {
 
       # if there is an exchange rate change price
       if (($form->{exchangerate} * 1) != 0) {
-
         $pkr->{price} /= $form->{exchangerate};
       }
 
       $pkr->{price} *= $form->{"basefactor_$i"};
-
       $pkr->{price} *= $basefactor;
-
       $pkr->{price} = $form->format_amount($myconfig, $pkr->{price}, 5);
 
       if ($selectedpricegroup_id eq undef) {