Revision 2401956f
Von Tamino Steinert vor etwa 1 Jahr hinzugefügt
SL/DB/Part.pm | ||
---|---|---|
13 | 13 |
use SL::DB::MetaSetup::Part; |
14 | 14 |
use SL::DB::Manager::Part; |
15 | 15 |
use SL::DB::Chart; |
16 |
use SL::DB::Vendor; |
|
16 |
use SL::DB::Manager::Vendor;
|
|
17 | 17 |
use SL::DB::Helper::AttrHTML; |
18 | 18 |
use SL::DB::Helper::AttrSorted; |
19 | 19 |
use SL::DB::Helper::TransNumberGenerator; |
... | ... | |
104 | 104 |
__PACKAGE__->before_save('_before_save_set_partnumber'); |
105 | 105 |
__PACKAGE__->before_save('_before_save_set_assembly_weight'); |
106 | 106 |
|
107 |
sub init_onhandqty{ |
|
108 |
my ($self) = @_; |
|
109 |
my $qty = SL::Helper::Inventory::get_onhand(part => $self->id); |
|
110 |
return $qty; |
|
111 |
} |
|
112 |
|
|
113 |
sub init_stockqty{ |
|
114 |
my ($self) = @_; |
|
115 |
my $qty = SL::Helper::Inventory::get_stock(part => $self->id); |
|
116 |
return $qty; |
|
117 |
} |
|
118 |
|
|
119 |
sub init_get_open_ordered_qty { |
|
120 |
my $self = shift; |
|
121 |
my $result = SL::DB::Manager::Part->get_open_ordered_qty($self->id); |
|
122 |
|
|
123 |
return $result; |
|
124 |
} |
|
125 |
|
|
126 | 107 |
sub _before_save_set_partnumber { |
127 | 108 |
my ($self) = @_; |
128 | 109 |
|
... | ... | |
302 | 283 |
return $result{ $self->id }; |
303 | 284 |
} |
304 | 285 |
|
305 |
sub is_parts_first_order { |
|
306 |
|
|
307 |
my ($self, %params) = @_; |
|
308 |
|
|
309 |
#require SL::DB::OrderItem; |
|
310 |
my $orders_count = SL::DB::Manager::OrderItem->get_all_count( where => [ %params ], with_objects => 'order' ); |
|
311 |
|
|
312 |
return $orders_count == 1 ? 1 : 0; |
|
313 |
} |
|
314 |
|
|
315 | 286 |
sub available_units { |
316 | 287 |
shift->unit_obj->convertible_units; |
317 | 288 |
} |
... | ... | |
625 | 596 |
return \@vendor_dd; |
626 | 597 |
} |
627 | 598 |
|
599 |
sub init_onhandqty{ |
|
600 |
my ($self) = @_; |
|
601 |
my $qty = SL::Helper::Inventory::get_onhand(part => $self->id) || 0; |
|
602 |
return $qty; |
|
603 |
} |
|
604 |
|
|
605 |
sub init_stockqty{ |
|
606 |
my ($self) = @_; |
|
607 |
my $qty = SL::Helper::Inventory::get_stock(part => $self->id) || 0; |
|
608 |
return $qty; |
|
609 |
} |
|
610 |
|
|
611 |
sub init_get_open_ordered_qty { |
|
612 |
my ($self) = @_; |
|
613 |
my $result = SL::DB::Manager::Part->get_open_ordered_qty($self->id); |
|
614 |
|
|
615 |
return $result; |
|
616 |
} |
|
617 |
|
|
628 | 618 |
1; |
629 | 619 |
|
630 | 620 |
__END__ |
Auch abrufbar als: Unified diff
WIP DispositionManager