|
package SL::Controller::BankTransaction;
|
|
|
|
# idee- möglichkeit bankdaten zu übernehmen in stammdaten
|
|
# erst Kontenabgleich, um alle gl-Einträge wegzuhaben
|
|
use strict;
|
|
|
|
use parent qw(SL::Controller::Base);
|
|
|
|
use SL::Controller::Helper::GetModels;
|
|
use SL::Controller::Helper::ReportGenerator;
|
|
use SL::ReportGenerator;
|
|
|
|
use SL::DB::BankTransaction;
|
|
use SL::Helper::Flash;
|
|
use SL::Locale::String;
|
|
use SL::SEPA;
|
|
use SL::DB::Invoice;
|
|
use SL::DB::PurchaseInvoice;
|
|
use SL::DB::RecordLink;
|
|
use SL::DB::ReconciliationLink;
|
|
use SL::JSON;
|
|
use SL::DB::Chart;
|
|
use SL::DB::AccTransaction;
|
|
use SL::DB::BankTransactionAccTrans;
|
|
use SL::DB::Tax;
|
|
use SL::DB::BankAccount;
|
|
use SL::DB::GLTransaction;
|
|
use SL::DB::RecordTemplate;
|
|
use SL::DB::SepaExportItem;
|
|
use SL::DBUtils qw(like do_query);
|
|
|
|
use SL::Presenter::Tag qw(checkbox_tag html_tag);
|
|
use Carp;
|
|
use List::UtilsBy qw(partition_by);
|
|
use List::MoreUtils qw(any);
|
|
use List::Util qw(max);
|
|
|
|
use Rose::Object::MakeMethods::Generic
|
|
(
|
|
scalar => [ qw(callback transaction) ],
|
|
'scalar --get_set_init' => [ qw(models problems) ],
|
|
);
|
|
|
|
__PACKAGE__->run_before('check_auth');
|
|
|
|
|
|
#
|
|
# actions
|
|
#
|
|
|
|
sub action_search {
|
|
my ($self) = @_;
|
|
|
|
my $bank_accounts = SL::DB::Manager::BankAccount->get_all_sorted( query => [ obsolete => 0 ] );
|
|
|
|
$self->setup_search_action_bar;
|
|
$self->render('bank_transactions/search',
|
|
BANK_ACCOUNTS => $bank_accounts);
|
|
}
|
|
|
|
sub action_list_all {
|
|
my ($self) = @_;
|
|
|
|
$self->make_filter_summary;
|
|
$self->prepare_report;
|
|
|
|
$self->setup_list_all_action_bar;
|
|
$self->report_generator_list_objects(report => $self->{report}, objects => $self->models->get);
|
|
}
|
|
|
|
sub gather_bank_transactions_and_proposals {
|
|
my ($self, %params) = @_;
|
|
|
|
my $sort_by = $params{sort_by} || 'transdate';
|
|
$sort_by = 'transdate' if $sort_by eq 'proposal';
|
|
$sort_by .= $params{sort_dir} ? ' DESC' : ' ASC';
|
|
|
|
my @where = ();
|
|
push @where, (transdate => { ge => $params{fromdate} }) if $params{fromdate};
|
|
push @where, (transdate => { lt => $params{todate} }) if $params{todate};
|
|
# bank_transactions no younger than starting date,
|
|
# including starting date (same search behaviour as fromdate)
|
|
# but OPEN invoices to be matched may be from before
| "BankTransaction.pm.html#L1103" data-txt="1103">
action => [
|
|
t8('Filter'),
|
|
submit => [ '#search_form', { action => 'BankTransaction/list' } ],
|
|
accesskey => 'enter',
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
sub setup_list_all_action_bar {
|
|
my ($self, %params) = @_;
|
|
|
|
for my $bar ($::request->layout->get('actionbar')) {
|
|
$bar->add(
|
|