X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/471af251c02dc9b72fc44d4de661dba56586a4d5..0fa8098195ca1634920bf65264a987b59a91ebe1:/SL/WH.pm diff --git a/SL/WH.pm b/SL/WH.pm index 007283570..df5bad909 100644 --- a/SL/WH.pm +++ b/SL/WH.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. #====================================================================== # # Warehouse module @@ -191,7 +192,7 @@ sub transfer_assembly { my $query = qq|SELECT assembly.parts_id, assembly.qty, parts.warehouse_id FROM assembly INNER JOIN parts ON assembly.parts_id = parts.id - WHERE assembly.id = ? AND (inventory_accno_id IS NOT NULL OR parts.assembly = TRUE)|; + WHERE assembly.id = ? AND parts.part_type != 'service'|; my $sth_part_qty_assembly = prepare_execute_query($form, $dbh, $query, $params{assembly_id}); @@ -368,6 +369,11 @@ sub get_warehouse_journal { push @filter_vars, like($filter{description}); } + if ($filter{classification_id}) { + push @filter_ary, "p.classification_id = ?"; + push @filter_vars, $filter{classification_id}; + } + if ($filter{chargenumber}) { push @filter_ary, "i1.chargenumber ILIKE ?"; push @filter_vars, like($filter{chargenumber}); @@ -426,6 +432,8 @@ sub get_warehouse_journal { "qty" => "ABS(SUM(i1.qty))", "partnumber" => "p.partnumber", "partdescription" => "p.description", + "classification_id" => "p.classification_id", + "part_type" => "p.part_type", "bindescription" => "b.description", "chargenumber" => "i1.chargenumber", "bestbefore" => "i1.bestbefore", @@ -457,6 +465,7 @@ sub get_warehouse_journal { "warehouse_from" => "'$filter{na}'", }; + $form->{l_classification_id} = 'Y'; $form->{l_invoice_id} = $form->{l_oe_id} if $form->{l_oe_id}; # build the select clauses. @@ -614,6 +623,7 @@ SQL # - warehouse_id - will return matches with this warehouse_id only # - partnumber - will return only matches where the given string is a substring of the partnumber # - partsid - will return matches with this parts_id only +# - classification_id - will return matches with this parts with this classification only # - description - will return only matches where the given string is a substring of the description # - chargenumber - will return only matches where the given string is a substring of the chargenumber # - bestbefore - will return only matches with this bestbefore date @@ -665,6 +675,11 @@ sub get_warehouse_report { push @filter_vars, like($filter{partnumber}); } + if ($filter{classification_id}) { + push @filter_ary, "p.classification_id = ?"; + push @filter_vars, $filter{classification_id}; + } + if ($filter{description}) { push @filter_ary, "p.description ILIKE ?"; push @filter_vars, like($filter{description}); @@ -737,6 +752,8 @@ sub get_warehouse_report { "warehouseid" => "i.warehouse_id", "partnumber" => "p.partnumber", "partdescription" => "p.description", + "classification_id" => "p.classification_id", + "part_type" => "p.part_type", "bindescription" => "b.description", "binid" => "b.id", "chargenumber" => "i.chargenumber", @@ -747,6 +764,9 @@ sub get_warehouse_report { "partunit" => "p.unit", "stock_value" => "p.lastcost / COALESCE(pfac.factor, 1)", ); + $form->{l_classification_id} = 'Y'; + $form->{l_part_type} = 'Y'; + my $select_clause = join ', ', map { +/^l_/; "$select_tokens{$'} AS $'" } ( grep( { !/qty/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form), qw(l_parts_id l_qty l_partunit) ); @@ -1168,7 +1188,7 @@ Creates an assembly if all defined items are available. Assembly item(s) will be stocked out and the assembly will be stocked in, taking into account the qty and units which can be defined for each -assembly item seperately. +assembly item separately. The calling params originate from C but only parts_id with the attribute assembly are processed.