Revision cd14a8ba
Von Tamino Steinert vor mehr als 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::Manager::Vendor; |
|
17 | 16 |
use SL::DB::Helper::AttrHTML; |
18 | 17 |
use SL::DB::Helper::AttrSorted; |
19 | 18 |
use SL::DB::Helper::TransNumberGenerator; |
... | ... | |
583 | 582 |
return 1; |
584 | 583 |
} |
585 | 584 |
|
586 |
sub vendor_dropdown { |
|
587 |
my ($self) = @_; |
|
588 |
|
|
589 |
my @vendor_dd; |
|
590 |
|
|
591 |
foreach my $mm ( @{$self->makemodels} ){ |
|
592 |
my $vendor = SL::DB::Manager::Vendor->get_first( where => [ id => $mm->make ] ); |
|
593 |
my @tmp = ({ title => $vendor->vendornumber . "--" .$vendor->name . " (" . $::form->format_amount(\%::myconfig, $mm->lastcost, 2) . ")", value => $vendor->{id} }); |
|
594 |
push @vendor_dd, @tmp; |
|
595 |
} |
|
596 |
return \@vendor_dd; |
|
597 |
} |
|
598 |
|
|
599 | 585 |
sub init_onhandqty{ |
600 | 586 |
my ($self) = @_; |
601 | 587 |
my $qty = SL::Helper::Inventory::get_onhand(part => $self->id) || 0; |
SL/Presenter/Part.pm | ||
---|---|---|
12 | 12 |
our @EXPORT_OK = qw( |
13 | 13 |
part_picker part select_classification classification_abbreviation |
14 | 14 |
type_abbreviation separate_abbreviation typeclass_abbreviation |
15 |
vendor_price_dropdown |
|
15 | 16 |
); |
16 | 17 |
our %EXPORT_TAGS = (ALL => \@EXPORT_OK); |
17 | 18 |
|
... | ... | |
133 | 134 |
select_tag( $name, $collection, %attributes ); |
134 | 135 |
} |
135 | 136 |
|
137 |
sub vendor_price_dropdown { |
|
138 |
my ($name, $part, %attributes) = @_; |
|
139 |
|
|
140 |
$attributes{value_key} = 'id'; |
|
141 |
$attributes{title_key} = 'text'; |
|
142 |
|
|
143 |
my @vendor_price_list = map {{ |
|
144 |
id => $_->vendor->id, |
|
145 |
text => $_->vendor->vendornumber . "--" .$_->vendor->name |
|
146 |
. " (" |
|
147 |
. $::form->format_amount(\%::myconfig, $_->lastcost, 2) |
|
148 |
. ")", |
|
149 |
}} |
|
150 |
@{$part->makemodels}; |
|
151 |
|
|
152 |
select_tag( $name, \@vendor_price_list, %attributes ); |
|
153 |
} |
|
154 |
|
|
136 | 155 |
1; |
137 | 156 |
|
138 | 157 |
__END__ |
... | ... | |
219 | 238 |
|
220 | 239 |
=over 2 |
221 | 240 |
|
241 |
=item C<vendor_price_dropdown $name, $part, %params> |
|
242 |
|
|
243 |
Returns an HTML select tag with all available vendors with the best price |
|
244 |
for the given part. The value of the select tag is the vendor id. |
|
245 |
|
|
246 |
C<%params> can include: |
|
247 |
|
|
248 |
=over 4 |
|
249 |
|
|
250 |
=item * default |
|
251 |
|
|
252 |
The id of the selected vendor. |
|
253 |
|
|
254 |
=back |
|
255 |
|
|
256 |
=back |
|
257 |
|
|
258 |
=over 2 |
|
259 |
|
|
222 | 260 |
=item C<part_picker $name, $value, %params> |
223 | 261 |
|
224 | 262 |
All-in-one picker widget for parts. The name will be both id and name |
templates/webpages/disposition_manager/_show_vendor_parts.html | ||
---|---|---|
21 | 21 |
<tbody> |
22 | 22 |
[% FOREACH makemodel_item = MAKEMODEL_ITEMS %] |
23 | 23 |
|
24 |
[% SET select_size = basket_item.part.vendor_dropdown.size %] |
|
25 | 24 |
<tr class="listrow"> |
26 | 25 |
<td>[% L.checkbox_tag('vendor_part_ids[+]', |
27 | 26 |
checked='0', value=makemodel_item.id) %]</td> |
... | ... | |
38 | 37 |
<td class="numeric">[% makemodel_item.get_ordered_qty %]</td> |
39 | 38 |
<td class="numeric">[% makemodel_item.rop_as_number %]</td> |
40 | 39 |
<td class="numeric">[% makemodel_item.qty_as_number %]</td> |
41 |
<td>[% L.select_tag('vendor_ids[]', makemodel_item.vendor_dropdown,
|
|
42 |
value_key='value', title_key='title',
|
|
40 |
<td>[% P.part.vendor_price_dropdown(
|
|
41 |
'vendor_ids[]', makemodel_item,
|
|
43 | 42 |
default=makemodel_item.makemodels.item(0).make, |
44 |
size=select_size, style='width:350px;' ) %] |
|
43 |
style='width: 350px;' |
|
44 |
) %] |
|
45 | 45 |
</td> |
46 | 46 |
</tr> |
47 | 47 |
[% END %] |
templates/webpages/disposition_manager/list_parts.html | ||
---|---|---|
36 | 36 |
</td> |
37 | 37 |
<td>[% HTML.escape(part.partnumber) %]</td> |
38 | 38 |
<td>[% HTML.escape(part.description) %]</td> |
39 |
<td> |
|
40 |
[% L.select_tag( |
|
41 |
'vendor_ids[]', part.vendor_dropdown, |
|
42 |
value_key = 'value', title_key = 'title', |
|
43 |
default = basket_item.part.makemodels.item(0).make, |
|
44 |
size = select_size, style='width: 250px;' ) %] |
|
39 |
<td>[% P.part.vendor_price_dropdown( |
|
40 |
'vendor_ids[]', part, |
|
41 |
default=part.makemodels.item(0).make, |
|
42 |
style='width: 350px;' |
|
43 |
) %] |
|
45 | 44 |
</td> |
46 | 45 |
<td class="numeric">[% LxERP.format_amount(part.onhandqty, 2) %]</td> |
47 | 46 |
<td class="numeric">[% part.rop_as_number %]</td> |
templates/webpages/disposition_manager/show_purchase_basket.html | ||
---|---|---|
6 | 6 |
|
7 | 7 |
[%- INCLUDE 'common/flash.html' %] |
8 | 8 |
<h1>[% title %]</h1> |
9 |
[% # Dumper.dump_html(BASKET_ITEMS) %] |
|
10 | 9 |
<form id="purchasebasket" style="margin:1em;"> |
11 | 10 |
<div> |
12 | 11 |
<p> |
... | ... | |
33 | 32 |
<tbody> |
34 | 33 |
[% FOREACH basket_item = BASKET_ITEMS %] |
35 | 34 |
|
36 |
[% SET select_size = basket_item.part.vendor_dropdown.size %] |
|
37 | 35 |
<tr class="listrow"> |
38 | 36 |
<td>[% L.checkbox_tag('ids[+]', "data-checkall"=1, checked = '1', value=basket_item.id) %] [% HTML.escape(basket_item.part.partsgroup.partsgroup) %] |
39 | 37 |
[% L.hidden_tag('partsgroup_ids[]', basket_item.part.partsgroup_id ) %] |
... | ... | |
50 | 48 |
<td class="numeric">[% basket_item.part.onhand_as_number %]</td> |
51 | 49 |
<td class="numeric">[% basket_item.part.rop_as_number %]</td> |
52 | 50 |
<td class="numeric">[% basket_item.qty_as_number %]</td> |
53 |
<td>[% L.select_tag('vendor_ids[]', basket_item.part.vendor_dropdown,
|
|
54 |
value_key='value', title_key='title',
|
|
51 |
<td>[% P.part.vendor_price_dropdown(
|
|
52 |
'vendor_ids[]', basket_item.part,
|
|
55 | 53 |
default=basket_item.part.makemodels.item(0).make, |
56 |
size=select_size, style='width: 350px;' ) %] |
|
54 |
style='width: 350px;' |
|
55 |
) %] |
|
57 | 56 |
</td> |
58 | 57 |
</tr> |
59 | 58 |
[% END %] |
Auch abrufbar als: Unified diff
Part: verschiebe Lieferantenauswahl nach Presenter