Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a222e324

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID a222e32406aade497b6c8dce6f4869d8b0eec6e1
  • Vorgänger 29a62ccc
  • Nachfolger fde528b6

Finanzübersicht: Filtermöglichkeit nach VerkäuferIn

Unterschiede anzeigen:

SL/Controller/FinancialOverview.pm
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;
templates/webpages/financial_overview/report_top.html
11 11
  |
12 12
  <a href="[% SELF.url_for(action='list', year=(SELF.year + 1), subtotals_per_quarter=SELF.subtotals_per_quarter) %]">[%- LxERP.t8("Following year") %]: [% SELF.year + 1 %] &raquo;</a>
13 13
 [% END %]
14

  
15 14
 <br>
15

  
16 16
 [% L.checkbox_tag('subtotals_per_quarter', checked=SELF.subtotals_per_quarter, label=LxERP.t8('Subtotals per quarter'), onchange='$("#form").submit();') %]
17
 <br>
18

  
19
 [% LxERP.t8("Salesperson") %]:
20
 [% L.select_tag('salesman_id', SELF.employees, with_empty=1, title_key='name', onchange='$("#form").submit();', default=SELF.salesman_id) %]</p>
17 21
</form>
18 22
<hr>

Auch abrufbar als: Unified diff