use SL::Controller::Helper::GetModels;
use SL::Controller::Helper::ReportGenerator;
use SL::Locale::String;
+use Carp;
use Rose::Object::MakeMethods::Generic (
scalar => [ qw(db_args flat_filter) ],
my $report = SL::ReportGenerator->new(\%::myconfig, $::form);
$self->{report} = $report;
- my @columns = qw(reqdate customer ordnumber partnumber description qty shipped_qty not_shipped_qty delivered_qty value_of_goods);
- my @sortable = qw(reqdate customer ordnumber partnumber description);
+ my @columns = qw(reqdate customer vendor ordnumber partnumber description qty shipped_qty not_shipped_qty delivered_qty value_of_goods);
+
+ my @sortable = qw(reqdate customer vendor ordnumber partnumber description);
my %column_defs = (
reqdate => { sub => sub { $_[0]->reqdate_as_date || $_[0]->order->reqdate_as_date } },
delivered_qty => { sub => sub { $::form->format_amount(\%::myconfig, $_[0]->delivered_qty, 2) . ' ' . $_[0]->unit } },
ordnumber => { sub => sub { $_[0]->order->ordnumber },
obj_link => sub { $self->link_to($_[0]->order) } },
- $vc => { sub => sub { $_[0]->order->$vc->name },
- obj_link => sub { $self->link_to($_[0]->order->$vc) } },
+ #vendor => { sub => sub { $_[0]->order->vendor->name },
+ # obj_link => sub { $self->link_to($_[0]->order->vendor) } },
+ #customer => { sub => sub { $_[0]->order->customer->name },
+ # obj_link => sub { $self->link_to($_[0]->order->customer) } },
);
# add value of goods in report
if ($main::auth->assert('sales_order_edit') && $::instance_conf->get_delivery_plan_show_value_of_goods) {
$column_defs{value_of_goods} = { sub => sub { $::form->format_amount(\%::myconfig, $_[0]->value_of_goods, 2) . ' ' . $_[0]->taxincluded } };
}
+
+ # hotfix for today
+ # if visible is not working
+ if ($vc eq 'customer') {
+ $column_defs{customer} = { sub => sub { $_[0]->order->customer->name },
+ obj_link => sub { $self->link_to($_[0]->order->customer) } };
+ }
+ if ($vc eq 'vendor') {
+ $column_defs{vendor} = { sub => sub { $_[0]->order->vendor->name },
+ obj_link => sub { $self->link_to($_[0]->order->vendor) } },
+ }
+
$column_defs{$_}->{text} = $sort_columns{$_} for keys %column_defs;
$report->set_options(
[ $filter->{"reqdate:date::ge"}, $::locale->text('Delivery Date') . " " . $::locale->text('From Date') ],
[ $filter->{"reqdate:date::le"}, $::locale->text('Delivery Date') . " " . $::locale->text('To Date') ],
[ $filter->{"qty:number"}, $::locale->text('Quantity') ],
- [ $filter->{order}{$vc}{"name:substr::ilike"}, ($vc eq 'customer') ? $::locale->text('Customer') : $::locale->text('Vendor') ],
- [ $filter->{order}{$vc}{"${vc}number:substr::ilike"}, ($vc eq 'customer') ? $::locale->text('Customer Number') : $::locale->text('Vendor Number') ],
+ [ $filter->{order}{vendor}{"name:substr::ilike"}, $::locale->text('Vendor') ],
+ [ $filter->{order}{vendor}{"vendornumber:substr::ilike"}, $::locale->text('Vendor Number') ],
+ [ $filter->{order}{customer}{"name:substr::ilike"}, $::locale->text('Customer') ],
+ [ $filter->{order}{customer}{"customernumber:substr::ilike"}, $::locale->text('Customer Number') ],
);
my %flags = (
$::auth->assert('sales_all_edit', 1)
}
sub init_vc {
- return $::form->{vc} || croak "self (DeliveryPlan) has no vc defined";
+ return $::form->{vc} if ($::form->{vc} eq 'customer' || $::form->{vc} eq 'vendor') || croak "self (DeliveryPlan) has no vc defined";
}
sub link_to {
</tr>
[% IF vc == 'customer' %]
<tr>
- <th align="right">[% Customer | $T8 %]</th>
+ <th align="right">[% 'Customer' | $T8 %]</th>
<td>[% L.input_tag('filter.order.customer.name:substr::ilike', filter.order.customer.name_substr__ilike, size = 20) %]</td>
</tr>
<tr>
<td>[% L.input_tag('filter.order.customer.customernumber:substr::ilike', filter.order.customer.customernumber_substr__ilike, size = 20) %]</td>
</tr>
[% ELSE %] <tr>
- <th align="right">[% Vendor | $T8 %]</th>
+ <th align="right">[% 'Vendor' | $T8 %]</th>
<td>[% L.input_tag('filter.order.vendor.name:substr::ilike', filter.order.vendor.name_substr__ilike, size = 20) %]</td>
</tr>
<tr>
[% L.hidden_tag('sort_by', FORM.sort_by) %]
[% L.hidden_tag('sort_dir', FORM.sort_dir) %]
[% L.hidden_tag('page', FORM.page) %]
-[% L.hidden_tag('vc', vc) %]
+[% L.hidden_tag('vc', SELF.vc) %]
[% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit')%]