X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FInventory.pm;h=6a7dadc4f2bc6e2c3eab26b35676f34227471193;hb=a4a09b2a3309cd9e1f8b382d91da284a4623fc56;hp=c56bb7826df6590424c1daf114ca1ae90f12b830;hpb=25755954bef7be451290f6b74d480541ef4244d5;p=kivitendo-erp.git diff --git a/SL/Controller/Inventory.pm b/SL/Controller/Inventory.pm index c56bb7826..6a7dadc4f 100644 --- a/SL/Controller/Inventory.pm +++ b/SL/Controller/Inventory.pm @@ -59,7 +59,6 @@ sub action_stock_usage { $self->render('inventory/warehouse_usage', title => $::form->{title}, year => DateTime->today->year, - # PARTSCLASSIFICATIONS => SL::DB:Manager::PartsClassification->get_all_classifications_by_name() , WAREHOUSES => $::form->{WAREHOUSES}, WAREHOUSE_FILTER => 1, warehouse_id => 0, @@ -70,7 +69,7 @@ sub action_stock_usage { sub getnumcolumns { my ($self) = @_; - return qw(stock incorrection found insum back outcorrection disposed + return qw(stock incorrection found insum back outcorrection disposed missing shipped used outsum consumed averconsumed); } @@ -92,12 +91,12 @@ sub action_usage { push @columns , qw(ptype unit) if $form->{report_generator_output_format} eq 'HTML'; - my @numcolumns = qw(stock incorrection found insum back outcorrection disposed + my @numcolumns = qw(stock incorrection found insum back outcorrection disposed missing shipped used outsum consumed averconsumed); push @columns , $self->getnumcolumns(); - my @hidden_variables = qw(reporttype year duetyp fromdate todate + my @hidden_variables = qw(reporttype year duetyp fromdate todate warehouse_id bin_id partnumber description bestbefore chargenumber partstypes_id); my %column_defs = ( 'partnumber' => { 'text' => $locale->text('Part Number'), }, @@ -126,7 +125,7 @@ sub action_usage { my @custom_headers = (); # Zeile 1: push @custom_headers, [ - { 'text' => $locale->text('Part'), + { 'text' => $locale->text('Part'), 'colspan' => ($form->{report_generator_output_format} eq 'HTML'?4:2), 'align' => 'center'}, { 'text' => $locale->text('Into bin'), 'colspan' => 4, 'align' => 'center'}, { 'text' => $locale->text('From bin'), 'colspan' => 7, 'align' => 'center'}, @@ -250,7 +249,7 @@ sub action_usage { $end->set_second(59); $end->set_minute(59); $end->set_hour(23); - if ( $end->epoch() > $actualepoch ) { + if ( $end->epoch() > $actualepoch ) { $end = DateTime->now_local; my $dur = $start->delta_md($end); $days = $dur->delta_months()*30 + $dur->delta_days() ; @@ -317,7 +316,7 @@ sub action_usage { $report->add_data($last_row); } $row_ind++ ; - } + } $last_partid = $entry->parts_id; $last_row = { }; $last_row->{partnumber}->{data} = $entry->part->partnumber; @@ -344,14 +343,14 @@ sub action_usage { if ( $entry->trans_type->description eq 'correction' ) { $prefix = $entry->trans_type->direction; } - $last_row->{$prefix.$entry->trans_type->description}->{data} += + $last_row->{$prefix.$entry->trans_type->description}->{data} += ( $entry->trans_type->direction eq 'out' ? -$entry->qty : $entry->qty ); } if ( $last_partid > 0 && ( $allrows || ($row_ind >= $first_nr && $row_ind < $last_nr ))) { $self->make_row_result($last_row,$days,$last_partid); $report->add_data($last_row); $row_ind++ ; - } + } my $num_rows = @{ $report->{data} } ; #$main::lxdebug->message(LXDebug->DEBUG2(), "count=".$row_ind." rows=".$num_rows); @@ -380,11 +379,11 @@ sub make_row_result { $row->{insum}->{data} = $row->{stock}->{data} + $row->{incorrection}->{data} + $row->{found}->{data}; $row->{outsum}->{data} = $row->{back}->{data} + $row->{outcorrection}->{data} + $row->{disposed}->{data} + $row->{missing}->{data} + $row->{shipped}->{data} + $row->{used}->{data}; - $row->{consumed}->{data} = $row->{outsum}->{data} - + $row->{consumed}->{data} = $row->{outsum}->{data} - $row->{outcorrection}->{data} - $row->{incorrection}->{data}; $row->{averconsumed}->{data} = $row->{consumed}->{data}*30/$days ; map { $row->{$_}->{data} = $form->format_amount($myconfig,$row->{$_}->{data},2); } $self->getnumcolumns(); - $row->{partnumber}->{link} = 'ic.pl?action=edit&id='.$partid; + $row->{partnumber}->{link} = 'controller.pl?action=Part/edit&part.id' . $partid; # $row->{partdescription}->{link} = 'ic.pl?action=edit&id='.$partid; } @@ -624,3 +623,59 @@ sub show_no_warehouses_error { } 1; +__END__ + +=encoding utf-8 + +=head1 NAME + +SL::Controller::Inventory - Report Controller for inventory + +=head1 DESCRIPTION + +This controller makes three reports about inventory in warehouses/stocks + +- warehouse content + +- warehouse journal + +- warehouse withdrawal + +=head1 FUNCTIONS + +=over 4 + +=item C + +Create a search form for stock withdrawal. +The search parameter for report are made like the reports in bin/mozilla/rp.pl + +=item C + +Make a report about stock withdrawal. + +The manual pagination is implemented like the pagination in SL::Controller::CsvImport. + +=back + +=head1 SPECIAL CASES + +Because of the PFD-Table Formatter some parameters for PDF must be different to the HTML parameters. +So in german language there are some tries to use a HTML Break in the second heading line +to produce two line heading inside table. The actual version has some abbreviations for the header texts. + +=head1 BUGS + +The PDF-Table library has some limits (doesn't display all if the line is to large) so +the format is adapted to this + + +=head1 AUTHOR + +only for C and C: + +Martin Helmling Emartin.helmling@opendynamic.deE + + +=cut +