X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FIC.pm;h=ce3bc00a8ea9ed4ef48aba1ceb1f9c4faf5359b5;hb=4d3be9c7cbf7d525181428a9b3697338aa066f0f;hp=f164d097f35b930e4bcb80d23e74c4f6ea27a096;hpb=667cfdce6bf2a06094339fc09fb7d27fc1636d96;p=kivitendo-erp.git diff --git a/SL/IC.pm b/SL/IC.pm index f164d097f..ce3bc00a8 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -25,7 +25,8 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1335, USA. #====================================================================== # # Inventory Control backend @@ -91,6 +92,7 @@ sub retrieve_buchungsgruppen { $main::lxdebug->leave_sub(); } + sub assembly_item { $main::lxdebug->enter_sub(); @@ -128,6 +130,7 @@ sub assembly_item { my $query = qq|SELECT p.id, p.partnumber, p.description, p.sellprice, + p.classification_id, p.weight, p.onhand, p.unit, pg.partsgroup, p.lastcost, p.price_factor_id, pfac.factor AS price_factor, p.notes as longdescription FROM parts p @@ -209,7 +212,7 @@ sub all_parts { # my @other_flags = qw(onhand); # ToDO: implement these # my @inactive_flags = qw(l_subtotal short l_linetotal); - my @select_tokens = qw(id factor); + my @select_tokens = qw(id factor part_type classification_id); my @where_tokens = qw(1=1); my @group_tokens = (); my @bind_vars = (); @@ -286,7 +289,7 @@ sub all_parts { insertdate => 'itime::DATE', ); - if (($form->{searchitems} eq 'assembly') && $form->{l_lastcost}) { + if ($form->{l_assembly} && $form->{l_lastcost}) { @simple_l_switches = grep { $_ ne 'lastcost' } @simple_l_switches; } @@ -376,10 +379,23 @@ sub all_parts { push @select_tokens, $_; } - for ($form->{searchitems}) { - push @where_tokens, "p.part_type = 'part'" if /part/; - push @where_tokens, "p.part_type = 'service'" if /service/; - push @where_tokens, "p.part_type = 'assembly'" if /assembly/; + # Oder Bedingungen fuer Ware Dienstleistung Erzeugnis: + if ($form->{l_part} || $form->{l_assembly} || $form->{l_service} || $form->{l_assortment}) { + my @or_tokens = (); + push @or_tokens, "p.part_type = 'service'" if $form->{l_service}; + push @or_tokens, "p.part_type = 'assembly'" if $form->{l_assembly}; + push @or_tokens, "p.part_type = 'part'" if $form->{l_part}; + push @or_tokens, "p.part_type = 'assortment'" if $form->{l_assortment}; + push @where_tokens, join ' OR ', map { "($_)" } @or_tokens; + } + else { + # gar keine Teile + push @where_tokens, q|'F' = 'T'|; + } + + if ( $form->{classification_id} > 0 ) { + push @where_tokens, "p.classification_id = ?"; + push @bind_vars, $form->{classification_id}; } for ($form->{itemstatus}) { @@ -437,7 +453,7 @@ sub all_parts { push @select_tokens, @qsooqr_flags, 'quotation', 'cv', 'ioi.id', 'ioi.ioi' if $bsooqr; push @select_tokens, @deliverydate_flags if $bsooqr && $form->{l_deliverydate}; - push @select_tokens, $q_assembly_lastcost if ($form->{searchitems} eq 'assembly') && $form->{l_lastcost}; + push @select_tokens, $q_assembly_lastcost if $form->{l_assembly} && $form->{l_lastcost}; push @bsooqr_tokens, q|module = 'ir' AND NOT ioi.assemblyitem| if $form->{bought}; push @bsooqr_tokens, q|module = 'is' AND NOT ioi.assemblyitem| if $form->{sold}; push @bsooqr_tokens, q|module = 'oe' AND NOT quotation AND cv = 'customer'| if $form->{ordered}; @@ -535,7 +551,7 @@ sub all_parts { # post processing for assembly parts lists (bom) # for each part get the assembly parts and add them into the partlist. my @assemblies; - if ($form->{searchitems} eq 'assembly' && $form->{bom}) { + if ($form->{l_assembly} && $form->{bom}) { $query = qq|SELECT p.id, p.partnumber, p.description, a.qty AS onhand, p.unit, p.notes, p.itime::DATE as insertdate, @@ -582,8 +598,7 @@ SQL } $sth->finish; } - }; - + } $main::lxdebug->leave_sub(); @@ -814,7 +829,8 @@ sub get_parts { } my $query = - qq|SELECT id, partnumber, description, unit, sellprice + qq|SELECT id, partnumber, description, unit, sellprice, + classification_id FROM parts WHERE $where ORDER BY $order|; @@ -827,6 +843,8 @@ sub get_parts { } $j++; + $form->{"type_and_classific_$j"} = $::request->presenter->type_abbreviation($ref->{part_type}). + $::request->presenter->classification_abbreviation($ref->{classification_id}); $form->{"id_$j"} = $ref->{id}; $form->{"partnumber_$j"} = $ref->{partnumber}; $form->{"description_$j"} = $ref->{description}; @@ -1121,12 +1139,15 @@ sub prepare_parts_for_printing { for my $i (1..$rowcount) { my $id = $form->{"${prefix}${i}"}; next unless $id; - - push @{ $template_arrays{part_type} }, $parts_by_id{$id}->type; + my $prt = $parts_by_id{$id}; + my $type_abbr = $::request->presenter->type_abbreviation($prt->part_type); + push @{ $template_arrays{part_type} }, $type_abbr; + push @{ $template_arrays{type_and_classific}}, $type_abbr.$::request->presenter->classification_abbreviation($prt->classification_id); + push @{ $template_arrays{separate} }, $::request->presenter->separate_abbreviation($prt->classification_id); } - return %template_arrays; $main::lxdebug->leave_sub(); + return %template_arrays; } sub normalize_text_blocks {