Revision 36d861c1
Von wernerh vor mehr als 1 Jahr hinzugefügt
SL/DB/Part.pm | ||
---|---|---|
92 | 92 |
|
93 | 93 |
__PACKAGE__->meta->initialize; |
94 | 94 |
|
95 |
use Rose::Object::MakeMethods::Generic ( |
|
96 |
'scalar --get_set_init' => [ qw(onhandqty stockqty get_open_ordered_qty) ], |
|
97 |
); |
|
95 | 98 |
__PACKAGE__->attr_html('notes'); |
96 | 99 |
__PACKAGE__->attr_sorted({ unsorted => 'makemodels', position => 'sortorder' }); |
97 | 100 |
__PACKAGE__->attr_sorted({ unsorted => 'customerprices', position => 'sortorder' }); |
... | ... | |
100 | 103 |
__PACKAGE__->before_save('_before_save_set_partnumber'); |
101 | 104 |
__PACKAGE__->before_save('_before_save_set_assembly_weight'); |
102 | 105 |
|
106 |
sub onhandqty_as_number { |
|
107 |
my ($self, $string) = @_; |
|
108 |
$self->onhandqty($::form->parse_amount(\%::myconfig, $string)) if @_ > 1; |
|
109 |
return $::form->format_amount(\%::myconfig, $self->onhandqty, 2); |
|
110 |
} |
|
111 |
|
|
112 |
sub init_onhandqty{ |
|
113 |
my ($self) = @_; |
|
114 |
my $qty = SL::Helper::Inventory::get_onhand(part => $self->id); |
|
115 |
return $qty; |
|
116 |
} |
|
117 |
|
|
118 |
sub stockqty_as_number { |
|
119 |
my ($self, $string) = @_; |
|
120 |
$self->stockqty($::form->parse_amount(\%::myconfig, $string)) if @_ > 1; |
|
121 |
return $::form->format_amount(\%::myconfig, $self->stockqty, 2); |
|
122 |
} |
|
123 |
|
|
124 |
sub init_stockqty{ |
|
125 |
my ($self) = @_; |
|
126 |
my $qty = SL::Helper::Inventory::get_stock(part => $self->id); |
|
127 |
return $qty; |
|
128 |
} |
|
129 |
|
|
130 |
sub get_open_ordered_qty_as_number { |
|
131 |
my ($self, $string) = @_; |
|
132 |
$self->get_open_ordered_qty($::form->parse_amount(\%::myconfig, $string)) if @_ > 1; |
|
133 |
return $::form->format_amount(\%::myconfig, $self->get_open_ordered_qty, 2); |
|
134 |
} |
|
135 |
|
|
136 |
sub init_get_open_ordered_qty { |
|
137 |
my $self = shift; |
|
138 |
my $result = SL::DB::Manager::Part->get_open_ordered_qty($self->id); |
|
139 |
|
|
140 |
return $result; |
|
141 |
} |
|
142 |
#sub reservedqty_as_number { |
|
143 |
# my ($self, $string) = @_; |
|
144 |
# $self->reservedqty($::form->parse_amount(\%::myconfig, $string)) if @_ > 1; |
|
145 |
# return $::form->format_amount(\%::myconfig, $self->reservedqty, $self->places); |
|
146 |
#} |
|
147 |
|
|
148 |
#sub init_onhandqty{ |
|
149 |
# my ($self) = @_; |
|
150 |
# my $qty = get_onhand(part => $self->id); |
|
151 |
# return $qty; |
|
152 |
#} |
|
153 |
>>>>>>> cf3ff322d1 (Einkaufshelfer/Dispositionsmanager bescheleunigt) |
|
154 |
|
|
103 | 155 |
sub _before_save_set_partnumber { |
104 | 156 |
my ($self) = @_; |
105 | 157 |
|
... | ... | |
279 | 331 |
return $result{ $self->id }; |
280 | 332 |
} |
281 | 333 |
|
282 |
sub get_open_ordered_qty { |
|
283 |
my $self = shift; |
|
284 |
my %result = SL::DB::Manager::Part->get_open_ordered_qty($self->id); |
|
334 |
sub is_parts_first_order { |
|
285 | 335 |
|
286 |
return $result{ $self->id }; |
|
336 |
my ($self, %params) = @_; |
|
337 |
|
|
338 |
require SL::DB::OrderItem; |
|
339 |
my $orders_count = SL::DB::Manager::OrderItem->get_all_count( where => [ %params ], with_objects => 'order' ); |
|
340 |
|
|
341 |
return $orders_count == 1 ? 1 : 0; |
|
287 | 342 |
} |
288 | 343 |
|
289 | 344 |
sub available_units { |
Auch abrufbar als: Unified diff
Einkaufshelfer/Dispositionsmanager bescheleunigt