sub action_search {
my ($self) = @_;
+ $self->setup_search_action_bar;
$self->render('reconciliation/search');
}
sub action_reconciliation {
my ($self) = @_;
+ $self->_get_proposals;
+
$self->_get_linked_transactions;
$self->_get_balances;
+ $self->setup_reconciliation_action_bar;
$self->render('reconciliation/form',
+ ui_tab => scalar(@{$self->{PROPOSALS}}) > 0?1:0,
title => t8('Reconciliation'));
}
my $output = $self->render('reconciliation/assigning_table', { output => 0 },
bt_sum => $::form->format_amount(\%::myconfig, $self->{bt_sum}, 2),
bb_sum => $::form->format_amount(\%::myconfig, -1 * $self->{bb_sum}, 2),
- show_button => !@errors
+ errors => @errors,
);
my %result = ( html => $output );
my $rec_group = SL::DB::Manager::ReconciliationLink->get_new_rec_group();
my $bank_transaction = SL::DB::Manager::BankTransaction->find_by(id => $bt_id);
$bank_transaction->cleared('1');
- if ( $bank_transaction->isa('SL::DB::BankTransaction') ) {
- $bank_transaction->invoice_amount($bank_transaction->amount);
- }
$bank_transaction->save;
foreach my $acc_trans_id (@{ $::form->{proposal_list}->{$bt_id}->{BB} }) {
SL::DB::ReconciliationLink->new(
}
if ($::form->round_amount($bt_sum + $bb_sum, 2) != 0) {
- push @errors, t8('Out of balance!');
+ push @errors, t8('Out of balance!'), t8('Sum of bank #1 and sum of bookings #2',$bt_sum, $bb_sum);
}
$self->{ELEMENTS} = \@elements;
# 1. step: set AccTrans and BankTransactions to 'cleared'
foreach my $element (@{ $self->{ELEMENTS} }) {
$element->cleared('1');
- $element->invoice_amount($element->amount) if $element->isa('SL::DB::BankTransaction');
+ # veto either invoice_amount is fully assigned or not! No state tricks in later workflow!
+ # invoice_amount should be a distinct sign, that some bookings were really made from a bank transaction
+ # $element->invoice_amount($element->amount) if $element->isa('SL::DB::BankTransaction');
$element->save;
}
}
if ( $self->{bank_account}->reconciliation_starting_date ) {
- push @bt_where, (transdate => { gt => $self->{bank_account}->reconciliation_starting_date });
- push @bb_where, (transdate => { gt => $self->{bank_account}->reconciliation_starting_date });
+ push @bt_where, (transdate => { ge => $self->{bank_account}->reconciliation_starting_date });
+ push @bb_where, (transdate => { ge => $self->{bank_account}->reconciliation_starting_date });
}
# don't try to reconcile opening and closing balance transactions
SL::DB::Manager::BankAccount->get_all_sorted( query => [ obsolete => 0 ] );
}
+sub setup_search_action_bar {
+ my ($self, %params) = @_;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ t8('Show'),
+ submit => [ '#search_form', { action => 'Reconciliation/reconciliation' } ],
+ accesskey => 'enter',
+ ],
+ );
+ }
+}
+
+sub setup_reconciliation_action_bar {
+ my ($self, %params) = @_;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ t8('Filter'),
+ call => [ 'filter_table' ],
+ accesskey => 'enter',
+ ],
+ );
+ }
+}
+
1;