X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/27fe7b11f5817702c3b47d0187bc9f0ba5328e2f..b9aaed24f1b5b7fbd52ecb097236fcdfe15215d0:/SL/WH.pm diff --git a/SL/WH.pm b/SL/WH.pm index 722916bf1..2899aaf30 100644 --- a/SL/WH.pm +++ b/SL/WH.pm @@ -530,7 +530,7 @@ sub get_warehouse_journal { }; $form->{l_classification_id} = 'Y'; - $form->{l_id} = 'Y'; + $form->{l_trans_id} = 'Y'; $form->{l_part_type} = 'Y'; $form->{l_itime} = 'Y'; $form->{l_invoice_id} = $form->{l_oe_id} if $form->{l_oe_id}; @@ -548,26 +548,10 @@ sub get_warehouse_journal { $where_clause = defined($where_clause) ? $where_clause : ''; my $query = - qq|SELECT * FROM (SELECT DISTINCT $select{trans} - FROM inventory i1 - LEFT JOIN inventory i2 ON i1.trans_id = i2.trans_id - LEFT JOIN parts p ON i1.parts_id = p.id - LEFT JOIN bin b1 ON i1.bin_id = b1.id - LEFT JOIN bin b2 ON i2.bin_id = b2.id - LEFT JOIN warehouse w1 ON i1.warehouse_id = w1.id - LEFT JOIN warehouse w2 ON i2.warehouse_id = w2.id - LEFT JOIN transfer_type tt ON i1.trans_type_id = tt.id - LEFT JOIN project pr ON i1.project_id = pr.id - LEFT JOIN employee e ON i1.employee_id = e.id - WHERE $where_clause i2.qty = -i1.qty AND i2.qty > 0 AND - i1.trans_id IN ( SELECT i.trans_id FROM inventory i GROUP BY i.trans_id HAVING COUNT(i.trans_id) = 2 ) - GROUP BY $group_clause - - UNION - + qq|SELECT * FROM ( SELECT DISTINCT $select{out} FROM inventory i1 - LEFT JOIN inventory i2 ON i1.trans_id = i2.trans_id + LEFT JOIN inventory i2 ON i1.trans_id = i2.trans_id AND i1.id = i2.id LEFT JOIN parts p ON i1.parts_id = p.id LEFT JOIN bin b1 ON i1.bin_id = b1.id LEFT JOIN bin b2 ON i2.bin_id = b2.id @@ -576,7 +560,7 @@ sub get_warehouse_journal { LEFT JOIN transfer_type tt ON i1.trans_type_id = tt.id LEFT JOIN project pr ON i1.project_id = pr.id LEFT JOIN employee e ON i1.employee_id = e.id - WHERE $where_clause i1.qty < 0 AND + WHERE $where_clause i1.qty != 0 AND tt.direction = 'out' AND i1.trans_id IN ( SELECT i.trans_id FROM inventory i GROUP BY i.trans_id HAVING COUNT(i.trans_id) >= 1 ) GROUP BY $group_clause @@ -584,7 +568,7 @@ sub get_warehouse_journal { SELECT DISTINCT $select{in} FROM inventory i1 - LEFT JOIN inventory i2 ON i1.trans_id = i2.trans_id + LEFT JOIN inventory i2 ON i1.trans_id = i2.trans_id AND i1.id = i2.id LEFT JOIN parts p ON i1.parts_id = p.id LEFT JOIN bin b1 ON i1.bin_id = b1.id LEFT JOIN bin b2 ON i2.bin_id = b2.id @@ -593,12 +577,12 @@ sub get_warehouse_journal { LEFT JOIN transfer_type tt ON i1.trans_type_id = tt.id LEFT JOIN project pr ON i1.project_id = pr.id LEFT JOIN employee e ON i1.employee_id = e.id - WHERE $where_clause i1.qty > 0 AND + WHERE $where_clause i1.qty != 0 AND tt.direction = 'in' AND i1.trans_id IN ( SELECT i.trans_id FROM inventory i GROUP BY i.trans_id HAVING COUNT(i.trans_id) >= 1 ) GROUP BY $group_clause - ORDER BY r_${sort_spec}) AS lines WHERE r_qty>0|; + ORDER BY r_${sort_spec}) AS lines WHERE r_qty != 0|; - my @all_vars = (@filter_vars,@filter_vars,@filter_vars); + my @all_vars = (@filter_vars,@filter_vars); if ($filter{limit}) { $query .= " LIMIT ?"; @@ -1346,10 +1330,13 @@ unsuccessfully with a return value of undef. There has to be at least one data set in the table assembly referenced to this assembly_id. -=item Assembly cannot be destroyed or disassembled +=item Assembly can be disassembled Assemblies are like cakes. You cannot disassemble it. NEVER. - No negative nor zero qty's are valid inputs. + But if your assembly is a mechanical cake you may unscrew it. + Assemblies are created in one transaction therefore you can + safely rely on the trans_id in inventory to disassemble the + created assemblies (see action disassemble_assembly in wh.pl). =item The assembly item(s) have to be in the same warehouse