Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision cadf8b8b

Von Martin Helmling martin.helmling@octosoft.eu vor fast 8 Jahren hinzugefügt

  • ID cadf8b8bfba4fe1b337761d64999fd37ef40ffb0
  • Vorgänger 641d6d24
  • Nachfolger 50c2cd31

Banktransaction: Kontoauszug verbuchen überarbeitet

kein _as_number für amount verwenden

Fehlermeldung bei Transaktionen bearbeitet

Bei Sammelanweisung Zuweisung korrigiert

Die per SEPA-Export gefundenen Übereinstimmungen werden nun auch bewertet,
damit gleichartige Rechnungen genauer zugeordnet werden

Unterschiede anzeigen:

SL/Controller/BankTransaction.pm
124 124
    foreach ( @{$all_open_sepa_export_items}) {
125 125
      if ( $_->ap_id == $open_invoice->id ||  $_->ar_id == $open_invoice->id ) {
126 126
        my $factor = ( $_->ar_id == $open_invoice->id>0?1:-1);
127
        #$main::lxdebug->message(LXDebug->DEBUG2(),"exitem=".$_->id." for invoice ".$open_invoice->id." factor=".$factor);
127
        $main::lxdebug->message(LXDebug->DEBUG2(),"exitem=".$_->id." for invoice ".$open_invoice->id." factor=".$factor);
128
        $open_invoice->{realamount}  = $::form->format_amount(\%::myconfig,$open_invoice->amount*$factor,2);
128 129
        $open_invoice->{sepa_export_item} = $_ ;
129 130
        $open_invoice->{skonto_type} = $_->payment_type;
130 131
        $sepa_exports{$_->sepa_export_id} ||= { count => 0, is_ar => 0, amount => 0, proposed => 0, invoices => [], item => $_ };
......
144 145

  
145 146
  # try to match each bank_transaction with each of the possible open invoices
146 147
  # by awarding points
147
  @all_open_invoices = @all_non_sepa_invoices;
148 148
  my @proposals;
149 149

  
150 150
  foreach my $bt (@{ $bank_transactions }) {
151 151
    ## 5 Stellen hinter dem Komma auf 2 Stellen reduzieren
152
    @{$bt->{rule_matches}} = ();
152 153
    $bt->amount($bt->amount*1);
153 154
    $bt->invoice_amount($bt->invoice_amount*1);
154 155
    $main::lxdebug->message(LXDebug->DEBUG2(),"BT ".$bt->id." amount=".$bt->amount." invoice_amount=".$bt->invoice_amount." remote=". $bt->{remote_name});
155 156

  
156
    $bt->{proposals} = [];
157
    $bt->{proposals} = ();
157 158

  
158 159
    $bt->{remote_name} .= $bt->{remote_name_1} if $bt->{remote_name_1};
159 160

  
......
162 163
        #$main::lxdebug->message(LXDebug->DEBUG2(),"Exp ID=".$_." compare sum amount ".($sepa_exports{$_}->{amount} *1) ." == ".($bt->amount * 1));
163 164
        if ( $bt->transaction_code eq '191' && abs(($sepa_exports{$_}->{amount} * 1) - ($bt->amount * 1)) < 0.01 ) {
164 165
          ## jupp
165
          $bt->{proposals} = $sepa_exports{$_}->{invoices} ;
166
          @{$bt->{proposals}} = @{$sepa_exports{$_}->{invoices}};
166 167
          $bt->{agreement}    = 20;
167
          $bt->{rule_matches} = 'sepa_export_item(20)';
168
          push(@{$bt->{rule_matches}},'sepa_export_item(20)');
168 169
          $sepa_exports{$_}->{proposed}=1;
169 170
          #$main::lxdebug->message(LXDebug->DEBUG2(),"has ".scalar($bt->{proposals})." invoices");
170 171
          push(@proposals, $bt);
......
184 185
          #$main::lxdebug->message(LXDebug->DEBUG2(),"remote account '".$bt->{remote_account_number}."' bt_amount=". ($bt->amount * $factor));
185 186
          #$main::lxdebug->message(LXDebug->DEBUG2(),"compare with   '".$_->vc_iban."'    amount=".$_->amount);
186 187
          if ( $bt->{remote_account_number} eq $_->vc_iban && abs(( $_->amount *1 ) - ($bt->amount * $factor)) < 0.01 ) {
187
            push @{ $bt->{proposals} }, $open_invoice;
188
            $bt->{agreement}    = 20;
189
            $bt->{rule_matches} = 'sepa_export_item(20)';
190
            #$main::lxdebug->message(LXDebug->DEBUG2(),"found invoice");
191
            push(@proposals, $bt);
192
            @all_sepa_invoices = grep { $_ != $open_invoice } @all_sepa_invoices;
193
            last;
188
            ($open_invoice->{agreement}, $open_invoice->{rule_matches}) = $bt->get_agreement_with_invoice($open_invoice);
189
            $open_invoice->{agreement} += 5;
190
            $open_invoice->{rule_matches} .= 'sepa_export_item(5) ';
191
            $main::lxdebug->message(LXDebug->DEBUG2(),"sepa invoice_id=".$open_invoice->id." agreement=".$open_invoice->{agreement}." rules matches=".$open_invoice->{rule_matches});
192
            $open_invoice->{realamount} = $::form->format_amount(\%::myconfig,$open_invoice->amount*$factor,2);
194 193
          }
195 194
        }
196 195
      }
......
205 204
    # the arrays $bt->{proposals} and $bt->{rule_matches}, and the agreement
206 205
    # score is stored in $bt->{agreement}
207 206

  
208
    foreach my $open_invoice (@all_open_invoices){
207
    foreach my $open_invoice (@all_non_sepa_invoices){
209 208
      ($open_invoice->{agreement}, $open_invoice->{rule_matches}) = $bt->get_agreement_with_invoice($open_invoice);
210 209
      $open_invoice->{realamount} = $::form->format_amount(\%::myconfig,$open_invoice->amount*($open_invoice->{is_ar}?1:-1),2);
211
       # $main::lxdebug->message(LXDebug->DEBUG2(),"agreement=".$open_invoice->{agreement}." rules matches=".$open_invoice->{rule_matches});
210
      $main::lxdebug->message(LXDebug->DEBUG2(),"nons invoice_id=".$open_invoice->id." agreement=".$open_invoice->{agreement}." rules matches=".$open_invoice->{rule_matches});
212 211
    };
213 212

  
214 213
    my $agreement = 15;

Auch abrufbar als: Unified diff