5 |
5 |
|
6 |
6 |
use List::MoreUtils qw(none);
|
7 |
7 |
|
|
8 |
use SL::DB::Employee;
|
8 |
9 |
use SL::DB::Invoice;
|
9 |
10 |
use SL::DB::Order;
|
10 |
11 |
use SL::DB::PurchaseInvoice;
|
... | ... | |
12 |
13 |
use SL::Locale::String;
|
13 |
14 |
|
14 |
15 |
use Rose::Object::MakeMethods::Generic (
|
15 |
|
scalar => [ qw(report number_columns year current_year types objects data subtotals_per_quarter) ],
|
|
16 |
scalar => [ qw(report number_columns year current_year types objects data subtotals_per_quarter salesman_id) ],
|
|
17 |
'scalar --get_set_init' => [ qw(employees) ],
|
16 |
18 |
);
|
17 |
19 |
|
18 |
20 |
__PACKAGE__->run_before(sub { $::auth->assert('report'); });
|
... | ... | |
20 |
22 |
sub action_list {
|
21 |
23 |
my ($self) = @_;
|
22 |
24 |
|
23 |
|
$self->subtotals_per_quarter($::form->{subtotals_per_quarter});
|
|
25 |
$self->$_($::form->{$_}) for qw(subtotals_per_quarter salesman_id);
|
24 |
26 |
|
25 |
27 |
$self->get_objects;
|
26 |
28 |
$self->calculate_data;
|
... | ... | |
64 |
66 |
);
|
65 |
67 |
$self->report->set_columns(%column_defs);
|
66 |
68 |
$self->report->set_column_order(@columns);
|
67 |
|
$self->report->set_export_options(qw(list year subtotals_per_quarter));
|
|
69 |
$self->report->set_export_options(qw(list year subtotals_per_quarter salesman_id));
|
68 |
70 |
$self->report->set_options_from_form;
|
69 |
71 |
}
|
70 |
72 |
|
... | ... | |
77 |
79 |
my $start = DateTime->new(year => $self->year, month => 1, day => 1);
|
78 |
80 |
my $end = DateTime->new(year => $self->year, month => 12, day => 31);
|
79 |
81 |
|
80 |
|
my @date_filter = (and => [ transdate => { ge => $start }, transdate => { le => $end } ]);
|
|
82 |
my @f_date = (transdate => { ge => $start }, transdate => { le => $end });
|
|
83 |
my @f_salesman = $self->salesman_id ? (salesman_id => $self->salesman_id) : ();
|
81 |
84 |
|
82 |
85 |
$self->objects({
|
83 |
|
sales_quotations => SL::DB::Manager::Order->get_all( where => [ and => [ @date_filter, SL::DB::Manager::Order->type_filter('sales_quotation') ]]),
|
84 |
|
sales_orders => SL::DB::Manager::Order->get_all( where => [ and => [ @date_filter, SL::DB::Manager::Order->type_filter('sales_order') ]]),
|
85 |
|
requests_for_quotation => SL::DB::Manager::Order->get_all( where => [ and => [ @date_filter, SL::DB::Manager::Order->type_filter('request_quotation') ]]),
|
86 |
|
purchase_orders => SL::DB::Manager::Order->get_all( where => [ and => [ @date_filter, SL::DB::Manager::Order->type_filter('purchase_order') ]]),
|
87 |
|
sales_invoices => SL::DB::Manager::Invoice->get_all( where => \@date_filter),
|
88 |
|
purchase_invoices => SL::DB::Manager::PurchaseInvoice->get_all(where => \@date_filter),
|
|
86 |
sales_quotations => SL::DB::Manager::Order->get_all( where => [ and => [ @f_date, @f_salesman, SL::DB::Manager::Order->type_filter('sales_quotation') ]]),
|
|
87 |
sales_orders => SL::DB::Manager::Order->get_all( where => [ and => [ @f_date, @f_salesman, SL::DB::Manager::Order->type_filter('sales_order') ]]),
|
|
88 |
requests_for_quotation => SL::DB::Manager::Order->get_all( where => [ and => [ @f_date, @f_salesman, SL::DB::Manager::Order->type_filter('request_quotation') ]]),
|
|
89 |
purchase_orders => SL::DB::Manager::Order->get_all( where => [ and => [ @f_date, @f_salesman, SL::DB::Manager::Order->type_filter('purchase_order') ]]),
|
|
90 |
sales_invoices => SL::DB::Manager::Invoice->get_all( where => [ and => [ @f_date, @f_salesman, ]]),
|
|
91 |
purchase_invoices => SL::DB::Manager::PurchaseInvoice->get_all(where => [ and => \@f_date ]),
|
89 |
92 |
});
|
90 |
93 |
}
|
91 |
94 |
|
... | ... | |
162 |
165 |
return $self->report->generate_with_headers;
|
163 |
166 |
}
|
164 |
167 |
|
|
168 |
sub init_employees { SL::DB::Manager::Employee->get_all_sorted }
|
|
169 |
|
165 |
170 |
1;
|
Finanzübersicht: Filtermöglichkeit nach VerkäuferIn