]> wagnertech.de Git - mfinanz.git/blobdiff - SL/IR.pm
ckeditor auf (aktuelle) Version 4.4.5
[mfinanz.git] / SL / IR.pm
index ad28c968b240ce72c4cf894cbaa69572f9e31dfa..b0aa13430e1ea1aa47246943a90246d2076d077e 100644 (file)
--- a/SL/IR.pm
+++ b/SL/IR.pm
@@ -800,6 +800,8 @@ SQL
 
   # safety check datev export
   if ($::instance_conf->get_datev_check_on_purchase_invoice) {
+    # if we need department for kostenstelle in DATEV check
+    $form->{department} = SL::DB::Manager::Department->find_by(id => $form->{department_id})->description if $form->{department_id};
     my $transdate = $::form->{invdate} ? DateTime->from_lxoffice($::form->{invdate}) : undef;
     $transdate  ||= DateTime->today;
 
@@ -873,17 +875,20 @@ sub reverse_invoice {
         #adjust allocated
         $form->update_balance($dbh, "invoice", "allocated", qq|id = $pthref->{id}|, $qty);
 
-        $form->update_balance($dbh, "acc_trans", "amount",
-                              qq|    (trans_id = $pthref->{trans_id})
-                                 AND (chart_id = $ref->{expense_accno_id})
-                                 AND (transdate = '$pthref->{transdate}')|,
-                              $amount);
+        if  ( $::instance_conf->get_inventory_system eq 'perpetual' ) {
 
-        $form->update_balance($dbh, "acc_trans", "amount",
-                              qq|    (trans_id = $pthref->{trans_id})
-                                 AND (chart_id = $ref->{inventory_accno_id})
-                                 AND (transdate = '$pthref->{transdate}')|,
-                              $amount * -1);
+          $form->update_balance($dbh, "acc_trans", "amount",
+                                qq|    (trans_id = $pthref->{trans_id})
+                                   AND (chart_id = $ref->{expense_accno_id})
+                                   AND (transdate = '$pthref->{transdate}')|,
+                                $amount);
+
+          $form->update_balance($dbh, "acc_trans", "amount",
+                                qq|    (trans_id = $pthref->{trans_id})
+                                   AND (chart_id = $ref->{inventory_accno_id})
+                                   AND (transdate = '$pthref->{transdate}')|,
+                                $amount * -1);
+        }
 
         last if (($ref->{allocated} -= $qty) <= 0);
       }
@@ -1280,9 +1285,9 @@ sub retrieve_item {
     qq|SELECT
          p.id, p.partnumber, p.description, p.lastcost AS sellprice, p.listprice,
          p.unit, p.assembly, p.onhand, p.formel,
-         p.notes AS partnotes, p.notes AS longdescription, p.not_discountable,
+         p.not_discountable,
          p.inventory_accno_id, p.price_factor_id,
-         p.ean,
+         p.ean, p.notes,
 
          pfac.factor AS price_factor,