Revision 666d4cad
Von Sven Schöling vor mehr als 11 Jahren hinzugefügt
SL/DB/Part.pm | ||
---|---|---|
179 | 179 |
return $charts->{$taxzone}->{$type}; |
180 | 180 |
} |
181 | 181 |
|
182 |
# this is designed to ignore chargenumbers, expiration dates and just give a list of how much <-> where |
|
183 |
sub get_simple_stock { |
|
184 |
my ($self, %params) = @_; |
|
185 |
|
|
186 |
return [] unless $self->id; |
|
187 |
|
|
188 |
my $query = <<''; |
|
189 |
SELECT sum(qty), warehouse_id, bin_id FROM inventory WHERE parts_id = ? |
|
190 |
GROUP BY warehouse_id, bin_id |
|
191 |
|
|
192 |
my $stock_info = selectall_hashref_query($::form, $::form->get_standard_dbh, $query, $self->id); |
|
193 |
[ map { bless $_, 'SL::DB::Part::SimpleStock'} @$stock_info ]; |
|
194 |
} |
|
195 |
# helper class to have bin/warehouse accessors in stock result |
|
196 |
{ package SL::DB::Part::SimpleStock; |
|
197 |
sub warehouse { require SL::DB::Warehouse; SL::DB::Manager::Warehouse->find_by_or_create(id => $_[0]->{warehouse_id}) } |
|
198 |
sub bin { require SL::DB::Bin; SL::DB::Manager::Bin ->find_by_or_create(id => $_[0]->{bin_id}) } |
|
199 |
} |
|
200 |
|
|
182 | 201 |
sub long_description { |
183 | 202 |
join ' ', grep $_, map $_[0]->$_, qw(partnumber description); |
184 | 203 |
} |
Auch abrufbar als: Unified diff
Inventory Controller und neue stock_in Maske
Alte Methode ist weiter im Code vorhanden, wird aber geplant nach und nach
durch das neue Interface ersetzt.
Benötigt Partpicker