]> wagnertech.de Git - mfinanz.git/blobdiff - bin/mozilla/ic.pl
BUG-Fix: Falsche Links zu Lieferscheinen.
[mfinanz.git] / bin / mozilla / ic.pl
index 12037639da289188df16396ece3180a19135d4fb..6218c8e8eeef1bc3adea2596658f28aea3e874c3 100644 (file)
@@ -38,7 +38,7 @@ use List::MoreUtils qw(any);
 use SL::AM;
 use SL::CVar;
 use SL::IC;
 use SL::AM;
 use SL::CVar;
 use SL::IC;
-use SL::Helper::Flash;
+use SL::Helper::Flash qw(flash);
 use SL::HTML::Util;
 use SL::ReportGenerator;
 
 use SL::HTML::Util;
 use SL::ReportGenerator;
 
@@ -51,7 +51,6 @@ use strict;
 our ($form, $locale, %myconfig, $lxdebug, $auth);
 
 require "bin/mozilla/io.pl";
 our ($form, $locale, %myconfig, $lxdebug, $auth);
 
 require "bin/mozilla/io.pl";
-require "bin/mozilla/invoice_io.pl";
 require "bin/mozilla/common.pl";
 require "bin/mozilla/reportgenerator.pl";
 
 require "bin/mozilla/common.pl";
 require "bin/mozilla/reportgenerator.pl";
 
@@ -116,9 +115,7 @@ sub search {
   $form->header;
 
   $form->get_lists('partsgroup'    => 'ALL_PARTSGROUPS');
   $form->header;
 
   $form->get_lists('partsgroup'    => 'ALL_PARTSGROUPS');
-  print $form->parse_html_template('ic/search', { %is_xyz,
-                                                  dateformat => $myconfig{dateformat},
-                                                  limit => $myconfig{vclimit}, });
+  print $form->parse_html_template('ic/search', { %is_xyz, });
 
   $lxdebug->leave_sub();
 }    #end search()
 
   $lxdebug->leave_sub();
 }    #end search()
@@ -1023,6 +1020,7 @@ sub generate_report {
     'drawing'            => { 'text' => $locale->text('Drawing'), },
     'ean'                => { 'text' => $locale->text('EAN'), },
     'image'              => { 'text' => $locale->text('Image'), },
     'drawing'            => { 'text' => $locale->text('Drawing'), },
     'ean'                => { 'text' => $locale->text('EAN'), },
     'image'              => { 'text' => $locale->text('Image'), },
+    'insertdate'         => { 'text' => $locale->text('Insert Date'), },
     'invnumber'          => { 'text' => $locale->text('Invoice Number'), },
     'lastcost'           => { 'text' => $locale->text('Last Cost'), },
     'linetotallastcost'  => { 'text' => $locale->text('Extended'), },
     'invnumber'          => { 'text' => $locale->text('Invoice Number'), },
     'lastcost'           => { 'text' => $locale->text('Last Cost'), },
     'linetotallastcost'  => { 'text' => $locale->text('Extended'), },
@@ -1045,7 +1043,7 @@ sub generate_report {
     'transdate'          => { 'text' => $locale->text('Transdate'), },
     'unit'               => { 'text' => $locale->text('Unit'), },
     'weight'             => { 'text' => $locale->text('Weight'), },
     'transdate'          => { 'text' => $locale->text('Transdate'), },
     'unit'               => { 'text' => $locale->text('Unit'), },
     'weight'             => { 'text' => $locale->text('Weight'), },
-    'shop'               => { 'text' => $locale->text('Shopartikel'), },
+    'shop'               => { 'text' => $locale->text('Shop article'), },
     'projectnumber'      => { 'text' => $locale->text('Project Number'), },
     'projectdescription' => { 'text' => $locale->text('Project Description'), },
   );
     'projectnumber'      => { 'text' => $locale->text('Project Number'), },
     'projectdescription' => { 'text' => $locale->text('Project Description'), },
   );
@@ -1130,11 +1128,13 @@ sub generate_report {
     microfiche    => $locale->text('Microfiche')       . ": '$form->{microfiche}'",
     l_soldtotal   => $locale->text('Qty in Selected Records'),
     ean           => $locale->text('EAN')              . ": '$form->{ean}'",
     microfiche    => $locale->text('Microfiche')       . ": '$form->{microfiche}'",
     l_soldtotal   => $locale->text('Qty in Selected Records'),
     ean           => $locale->text('EAN')              . ": '$form->{ean}'",
+    insertdatefrom => $locale->text('Insert Date') . ": " . $locale->text('From')       . " " . $locale->date(\%myconfig, $form->{insertdatefrom}, 1),
+    insertdateto   => $locale->text('Insert Date') . ": " . $locale->text('To (time)')  . " " . $locale->date(\%myconfig, $form->{insertdateto}, 1),
   );
 
   my @itemstatus_keys = qw(active obsolete orphaned onhand short);
   my @callback_keys   = qw(onorder ordered rfq quoted bought sold partnumber partsgroup partsgroup_id serialnumber description make model
   );
 
   my @itemstatus_keys = qw(active obsolete orphaned onhand short);
   my @callback_keys   = qw(onorder ordered rfq quoted bought sold partnumber partsgroup partsgroup_id serialnumber description make model
-                           drawing microfiche l_soldtotal l_deliverydate transdatefrom transdateto ean shop);
+                           drawing microfiche l_soldtotal l_deliverydate transdatefrom transdateto insertdatefrom insertdateto ean shop);
 
   # calculate dependencies
   for (@itemstatus_keys, @callback_keys) {
 
   # calculate dependencies
   for (@itemstatus_keys, @callback_keys) {
@@ -1220,7 +1220,7 @@ sub generate_report {
     linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost
     priceupdate weight image drawing microfiche invnumber ordnumber quonumber
     transdate name serialnumber deliverydate ean projectnumber projectdescription
     linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost
     priceupdate weight image drawing microfiche invnumber ordnumber quonumber
     transdate name serialnumber deliverydate ean projectnumber projectdescription
-    shop
+    insertdate shop
   );
 
   my $pricegroups = SL::DB::Manager::Pricegroup->get_all(sort => 'id');
   );
 
   my $pricegroups = SL::DB::Manager::Pricegroup->get_all(sort => 'id');
@@ -1248,7 +1248,7 @@ sub generate_report {
   map { $column_defs{$_}->{align}   = 'right' } qw(onhand sellprice listprice lastcost linetotalsellprice linetotallastcost linetotallistprice rop weight soldtotal shop), @pricegroup_columns;
 
   my @hidden_variables = (
   map { $column_defs{$_}->{align}   = 'right' } qw(onhand sellprice listprice lastcost linetotalsellprice linetotallastcost linetotallistprice rop weight soldtotal shop), @pricegroup_columns;
 
   my @hidden_variables = (
-    qw(l_subtotal l_linetotal searchitems itemstatus bom l_pricegroups),
+    qw(l_subtotal l_linetotal searchitems itemstatus bom l_pricegroups insertdatefrom insertdateto),
     @itemstatus_keys,
     @callback_keys,
     map({ "cvar_$_->{name}" } @searchable_custom_variables),
     @itemstatus_keys,
     @callback_keys,
     map({ "cvar_$_->{name}" } @searchable_custom_variables),
@@ -1258,7 +1258,7 @@ sub generate_report {
 
   my $callback         = build_std_url('action=generate_report', grep { $form->{$_} } @hidden_variables);
 
 
   my $callback         = build_std_url('action=generate_report', grep { $form->{$_} } @hidden_variables);
 
-  my @sort_full        = qw(partnumber description onhand soldtotal deliverydate shop);
+  my @sort_full        = qw(partnumber description onhand soldtotal deliverydate insertdate shop);
   my @sort_no_revers   = qw(partsgroup bin priceupdate invnumber ordnumber quonumber name image drawing serialnumber);
 
   foreach my $col (@sort_full) {
   my @sort_no_revers   = qw(partsgroup bin priceupdate invnumber ordnumber quonumber name image drawing serialnumber);
 
   foreach my $col (@sort_full) {
@@ -1380,7 +1380,7 @@ sub generate_report {
       $row->{quonumber}{link} = $edit_oe_quo_link if (!$ref->{ordnumber});
 
     } else {
       $row->{quonumber}{link} = $edit_oe_quo_link if (!$ref->{ordnumber});
 
     } else {
-      $row->{invnumber}{link} = build_std_url("script=$ref->{module}.pl", 'action=edit', 'type=invoice', 'id=' . E($ref->{trans_id}), 'callback');
+      $row->{invnumber}{link} = build_std_url("script=$ref->{module}.pl", 'action=edit', 'type=invoice', 'id=' . E($ref->{trans_id}), 'callback') if ($ref->{invnumber});
     }
 
     # set properties of images
     }
 
     # set properties of images
@@ -1641,7 +1641,7 @@ sub form_header {
     if (scalar @{ $form->{CUSTOM_VARIABLES} });
 
   $::request->layout->use_javascript("${_}.js") for qw(ckeditor/ckeditor ckeditor/adapters/jquery kivi.PriceRule);
     if (scalar @{ $form->{CUSTOM_VARIABLES} });
 
   $::request->layout->use_javascript("${_}.js") for qw(ckeditor/ckeditor ckeditor/adapters/jquery kivi.PriceRule);
-  $::request->layout->add_javascripts_inline("\$(function(){kivi.PriceRule.load_price_rules_for_part(@{[ $::form->{id} * 1 ]})})") if $::form->{id};
+  $::request->layout->add_javascripts_inline("\$(function(){kivi.PriceRule.load_price_rules_for_part(@{[ $::form->{id} * 1 ]})});") if $::form->{id};
   $form->header;
   #print $form->parse_html_template('ic/form_header', { ALL_PRICE_FACTORS => $form->{ALL_PRICE_FACTORS},
   #                                                     ALL_UNITS         => $form->{ALL_UNITS},
   $form->header;
   #print $form->parse_html_template('ic/form_header', { ALL_PRICE_FACTORS => $form->{ALL_PRICE_FACTORS},
   #                                                     ALL_UNITS         => $form->{ALL_UNITS},
@@ -1845,8 +1845,8 @@ sub update {
 
         if ($rows > 1) {
           $form->{makemodel_rows}--;
 
         if ($rows > 1) {
           $form->{makemodel_rows}--;
-          select_item(mode => 'IC');
-          ::end_of_request();
+          select_item(mode => 'IC', pre_entered_qty => $form->parse_amount(\%myconfig, $form->{"qty_$i"}));
+          $::dispatcher->end_request;
         } else {
           map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
             qw(partnumber description unit partsgroup);
         } else {
           map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
             qw(partnumber description unit partsgroup);
@@ -1880,7 +1880,7 @@ sub save {
   $lxdebug->enter_sub();
 
   $auth->assert('part_service_assembly_edit');
   $lxdebug->enter_sub();
 
   $auth->assert('part_service_assembly_edit');
-
+  $::form->mtime_ischanged('parts');
   my ($parts_id, %newform, $amount, $callback);
 
   # check if there is a part number - commented out, cause there is an automatic allocation of numbers
   my ($parts_id, %newform, $amount, $callback);
 
   # check if there is a part number - commented out, cause there is an automatic allocation of numbers
@@ -1912,8 +1912,9 @@ sub save {
   }
   # saving the history
   if(!exists $form->{addition}) {
   }
   # saving the history
   if(!exists $form->{addition}) {
-    $form->{snumbers} = qq|partnumber_| . $form->{partnumber};
-    $form->{addition} = "SAVED";
+    $form->{snumbers}  = qq|partnumber_| . $form->{partnumber};
+    $form->{what_done} = "part";
+    $form->{addition}  = "SAVED";
     $form->save_history;
   }
   # /saving the history
     $form->save_history;
   }
   # /saving the history
@@ -2040,8 +2041,9 @@ sub save_as_new {
 
   # saving the history
   if(!exists $form->{addition}) {
 
   # saving the history
   if(!exists $form->{addition}) {
-    $form->{snumbers} = qq|partnumber_| . $form->{partnumber};
-    $form->{addition} = "SAVED AS NEW";
+    $form->{snumbers}  = qq|partnumber_| . $form->{partnumber};
+    $form->{addition}  = "SAVED AS NEW";
+    $form->{what_done} = "part";
     $form->save_history;
   }
   # /saving the history
     $form->save_history;
   }
   # /saving the history
@@ -2061,8 +2063,9 @@ sub delete {
 
   # saving the history
   if(!exists $form->{addition}) {
 
   # saving the history
   if(!exists $form->{addition}) {
-    $form->{snumbers} = qq|partnumber_| . $form->{partnumber};
-    $form->{addition} = "DELETED";
+    $form->{snumbers}  = qq|partnumber_| . $form->{partnumber};
+    $form->{addition}  = "DELETED";
+    $form->{what_done} = "part";
     $form->save_history;
   }
   # /saving the history
     $form->save_history;
   }
   # /saving the history
@@ -2112,6 +2115,27 @@ sub ajax_autocomplete {
   $main::lxdebug->leave_sub();
 }
 
   $main::lxdebug->leave_sub();
 }
 
+sub display_form {
+  $::lxdebug->enter_sub;
+
+  $auth->assert('part_service_assembly_edit');
+
+  relink_accounts();
+
+  $::form->language_payment(\%::myconfig);
+
+  Common::webdav_folder($::form);
+
+  form_header();
+  price_row($::form->{price_rows});
+  makemodel_row(++$::form->{makemodel_rows}) if $::form->{item} =~ /^(part|service)$/;
+  assembly_row(++$::form->{assembly_rows})   if $::form->{item} eq 'assembly';
+
+  form_footer();
+
+  $::lxdebug->leave_sub;
+}
+
 sub back_to_record {
   _check_io_auth();
 
 sub back_to_record {
   _check_io_auth();