8 |
8 |
use SL::Controller::Helper::GetModels;
|
9 |
9 |
use SL::Controller::Helper::ReportGenerator;
|
10 |
10 |
use SL::Locale::String;
|
|
11 |
use Carp;
|
11 |
12 |
|
12 |
13 |
use Rose::Object::MakeMethods::Generic (
|
13 |
14 |
scalar => [ qw(db_args flat_filter) ],
|
... | ... | |
50 |
51 |
my $report = SL::ReportGenerator->new(\%::myconfig, $::form);
|
51 |
52 |
$self->{report} = $report;
|
52 |
53 |
|
53 |
|
my @columns = qw(reqdate customer ordnumber partnumber description qty shipped_qty not_shipped_qty delivered_qty value_of_goods);
|
54 |
|
my @sortable = qw(reqdate customer ordnumber partnumber description);
|
|
54 |
my @columns = qw(reqdate customer vendor ordnumber partnumber description qty shipped_qty not_shipped_qty delivered_qty value_of_goods);
|
|
55 |
|
|
56 |
my @sortable = qw(reqdate customer vendor ordnumber partnumber description);
|
55 |
57 |
|
56 |
58 |
my %column_defs = (
|
57 |
59 |
reqdate => { sub => sub { $_[0]->reqdate_as_date || $_[0]->order->reqdate_as_date } },
|
... | ... | |
65 |
67 |
delivered_qty => { sub => sub { $::form->format_amount(\%::myconfig, $_[0]->delivered_qty, 2) . ' ' . $_[0]->unit } },
|
66 |
68 |
ordnumber => { sub => sub { $_[0]->order->ordnumber },
|
67 |
69 |
obj_link => sub { $self->link_to($_[0]->order) } },
|
68 |
|
$vc => { sub => sub { $_[0]->order->$vc->name },
|
69 |
|
obj_link => sub { $self->link_to($_[0]->order->$vc) } },
|
|
70 |
#vendor => { sub => sub { $_[0]->order->vendor->name },
|
|
71 |
# obj_link => sub { $self->link_to($_[0]->order->vendor) } },
|
|
72 |
#customer => { sub => sub { $_[0]->order->customer->name },
|
|
73 |
# obj_link => sub { $self->link_to($_[0]->order->customer) } },
|
70 |
74 |
);
|
71 |
75 |
|
72 |
76 |
# add value of goods in report
|
73 |
77 |
if ($main::auth->assert('sales_order_edit') && $::instance_conf->get_delivery_plan_show_value_of_goods) {
|
74 |
78 |
$column_defs{value_of_goods} = { sub => sub { $::form->format_amount(\%::myconfig, $_[0]->value_of_goods, 2) . ' ' . $_[0]->taxincluded } };
|
75 |
79 |
}
|
|
80 |
|
|
81 |
# hotfix for today
|
|
82 |
# if visible is not working
|
|
83 |
if ($vc eq 'customer') {
|
|
84 |
$column_defs{customer} = { sub => sub { $_[0]->order->customer->name },
|
|
85 |
obj_link => sub { $self->link_to($_[0]->order->customer) } };
|
|
86 |
}
|
|
87 |
if ($vc eq 'vendor') {
|
|
88 |
$column_defs{vendor} = { sub => sub { $_[0]->order->vendor->name },
|
|
89 |
obj_link => sub { $self->link_to($_[0]->order->vendor) } },
|
|
90 |
}
|
|
91 |
|
76 |
92 |
$column_defs{$_}->{text} = $sort_columns{$_} for keys %column_defs;
|
77 |
93 |
|
78 |
94 |
$report->set_options(
|
... | ... | |
112 |
128 |
[ $filter->{"reqdate:date::ge"}, $::locale->text('Delivery Date') . " " . $::locale->text('From Date') ],
|
113 |
129 |
[ $filter->{"reqdate:date::le"}, $::locale->text('Delivery Date') . " " . $::locale->text('To Date') ],
|
114 |
130 |
[ $filter->{"qty:number"}, $::locale->text('Quantity') ],
|
115 |
|
[ $filter->{order}{$vc}{"name:substr::ilike"}, ($vc eq 'customer') ? $::locale->text('Customer') : $::locale->text('Vendor') ],
|
116 |
|
[ $filter->{order}{$vc}{"${vc}number:substr::ilike"}, ($vc eq 'customer') ? $::locale->text('Customer Number') : $::locale->text('Vendor Number') ],
|
|
131 |
[ $filter->{order}{vendor}{"name:substr::ilike"}, $::locale->text('Vendor') ],
|
|
132 |
[ $filter->{order}{vendor}{"vendornumber:substr::ilike"}, $::locale->text('Vendor Number') ],
|
|
133 |
[ $filter->{order}{customer}{"name:substr::ilike"}, $::locale->text('Customer') ],
|
|
134 |
[ $filter->{order}{customer}{"customernumber:substr::ilike"}, $::locale->text('Customer Number') ],
|
117 |
135 |
);
|
118 |
136 |
|
119 |
137 |
my %flags = (
|
... | ... | |
264 |
282 |
$::auth->assert('sales_all_edit', 1)
|
265 |
283 |
}
|
266 |
284 |
sub init_vc {
|
267 |
|
return $::form->{vc} || croak "self (DeliveryPlan) has no vc defined";
|
|
285 |
return $::form->{vc} if ($::form->{vc} eq 'customer' || $::form->{vc} eq 'vendor') || croak "self (DeliveryPlan) has no vc defined";
|
268 |
286 |
}
|
269 |
287 |
|
270 |
288 |
sub link_to {
|
DeliveryPlan - kleinere Details verbesert
a) SQL-sanitize $vc param
b) Syntaxfehler in Template
c) SELF.vc leicht sinnvoller als nur $vc
d) Column defs mit visible an- und ausschalten, bzw. hotfix für heute