Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision cd14a8ba

Von Tamino Steinert vor fast 2 Jahren hinzugefügt

  • ID cd14a8ba81ea3bd94e155df8641eb5056d78ddeb
  • Vorgänger 90b47258
  • Nachfolger 3c56e013

Part: verschiebe Lieferantenauswahl nach Presenter

Unterschiede anzeigen:

SL/DB/Part.pm
use SL::DB::MetaSetup::Part;
use SL::DB::Manager::Part;
use SL::DB::Chart;
use SL::DB::Manager::Vendor;
use SL::DB::Helper::AttrHTML;
use SL::DB::Helper::AttrSorted;
use SL::DB::Helper::TransNumberGenerator;
......
return 1;
}
sub vendor_dropdown {
my ($self) = @_;
my @vendor_dd;
foreach my $mm ( @{$self->makemodels} ){
my $vendor = SL::DB::Manager::Vendor->get_first( where => [ id => $mm->make ] );
my @tmp = ({ title => $vendor->vendornumber . "--" .$vendor->name . " (" . $::form->format_amount(\%::myconfig, $mm->lastcost, 2) . ")", value => $vendor->{id} });
push @vendor_dd, @tmp;
}
return \@vendor_dd;
}
sub init_onhandqty{
my ($self) = @_;
my $qty = SL::Helper::Inventory::get_onhand(part => $self->id) || 0;
SL/Presenter/Part.pm
our @EXPORT_OK = qw(
part_picker part select_classification classification_abbreviation
type_abbreviation separate_abbreviation typeclass_abbreviation
vendor_price_dropdown
);
our %EXPORT_TAGS = (ALL => \@EXPORT_OK);
......
select_tag( $name, $collection, %attributes );
}
sub vendor_price_dropdown {
my ($name, $part, %attributes) = @_;
$attributes{value_key} = 'id';
$attributes{title_key} = 'text';
my @vendor_price_list = map {{
id => $_->vendor->id,
text => $_->vendor->vendornumber . "--" .$_->vendor->name
. " ("
. $::form->format_amount(\%::myconfig, $_->lastcost, 2)
. ")",
}}
@{$part->makemodels};
select_tag( $name, \@vendor_price_list, %attributes );
}
1;
__END__
......
=over 2
=item C<vendor_price_dropdown $name, $part, %params>
Returns an HTML select tag with all available vendors with the best price
for the given part. The value of the select tag is the vendor id.
C<%params> can include:
=over 4
=item * default
The id of the selected vendor.
=back
=back
=over 2
=item C<part_picker $name, $value, %params>
All-in-one picker widget for parts. The name will be both id and name
templates/webpages/disposition_manager/_show_vendor_parts.html
<tbody>
[% FOREACH makemodel_item = MAKEMODEL_ITEMS %]
[% SET select_size = basket_item.part.vendor_dropdown.size %]
<tr class="listrow">
<td>[% L.checkbox_tag('vendor_part_ids[+]',
checked='0', value=makemodel_item.id) %]</td>
......
<td class="numeric">[% makemodel_item.get_ordered_qty %]</td>
<td class="numeric">[% makemodel_item.rop_as_number %]</td>
<td class="numeric">[% makemodel_item.qty_as_number %]</td>
<td>[% L.select_tag('vendor_ids[]', makemodel_item.vendor_dropdown,
value_key='value', title_key='title',
<td>[% P.part.vendor_price_dropdown(
'vendor_ids[]', makemodel_item,
default=makemodel_item.makemodels.item(0).make,
size=select_size, style='width:350px;' ) %]
style='width: 350px;'
) %]
</td>
</tr>
[% END %]
templates/webpages/disposition_manager/list_parts.html
</td>
<td>[% HTML.escape(part.partnumber) %]</td>
<td>[% HTML.escape(part.description) %]</td>
<td>
[% L.select_tag(
'vendor_ids[]', part.vendor_dropdown,
value_key = 'value', title_key = 'title',
default = basket_item.part.makemodels.item(0).make,
size = select_size, style='width: 250px;' ) %]
<td>[% P.part.vendor_price_dropdown(
'vendor_ids[]', part,
default=part.makemodels.item(0).make,
style='width: 350px;'
) %]
</td>
<td class="numeric">[% LxERP.format_amount(part.onhandqty, 2) %]</td>
<td class="numeric">[% part.rop_as_number %]</td>
templates/webpages/disposition_manager/show_purchase_basket.html
[%- INCLUDE 'common/flash.html' %]
<h1>[% title %]</h1>
[% # Dumper.dump_html(BASKET_ITEMS) %]
<form id="purchasebasket" style="margin:1em;">
<div>
<p>
......
<tbody>
[% FOREACH basket_item = BASKET_ITEMS %]
[% SET select_size = basket_item.part.vendor_dropdown.size %]
<tr class="listrow">
<td>[% L.checkbox_tag('ids[+]', "data-checkall"=1, checked = '1', value=basket_item.id) %] [% HTML.escape(basket_item.part.partsgroup.partsgroup) %]
[% L.hidden_tag('partsgroup_ids[]', basket_item.part.partsgroup_id ) %]
......
<td class="numeric">[% basket_item.part.onhand_as_number %]</td>
<td class="numeric">[% basket_item.part.rop_as_number %]</td>
<td class="numeric">[% basket_item.qty_as_number %]</td>
<td>[% L.select_tag('vendor_ids[]', basket_item.part.vendor_dropdown,
value_key='value', title_key='title',
<td>[% P.part.vendor_price_dropdown(
'vendor_ids[]', basket_item.part,
default=basket_item.part.makemodels.item(0).make,
size=select_size, style='width: 350px;' ) %]
style='width: 350px;'
) %]
</td>
</tr>
[% END %]

Auch abrufbar als: Unified diff