Revision 78078fbf
Von Jan Büren vor mehr als 7 Jahren hinzugefügt
SL/DB/BankTransaction.pm | ||
---|---|---|
99 | 99 |
if ( $bank_code eq $self->remote_bank_code && $account_number eq $self->remote_account_number ) { |
100 | 100 |
$agreement += $points{remote_account_number}; |
101 | 101 |
$rule_matches .= 'remote_account_number(' . $points{'remote_account_number'} . ') '; |
102 |
};
|
|
102 |
} |
|
103 | 103 |
if ( $iban eq $self->remote_account_number ) { |
104 | 104 |
$agreement += $points{remote_account_number}; |
105 | 105 |
$rule_matches .= 'remote_account_number(' . $points{'remote_account_number'} . ') '; |
106 |
};
|
|
106 |
} |
|
107 | 107 |
|
108 | 108 |
my $datediff = $self->transdate->{utc_rd_days} - $invoice->transdate->{utc_rd_days}; |
109 | 109 |
$invoice->{datediff} = $datediff; |
... | ... | |
112 | 112 |
if (abs(abs($invoice->amount) - abs($self->amount)) < 0.01) { |
113 | 113 |
$agreement += $points{exact_amount}; |
114 | 114 |
$rule_matches .= 'exact_amount(' . $points{'exact_amount'} . ') '; |
115 |
};
|
|
115 |
} |
|
116 | 116 |
|
117 | 117 |
# compare open amount, preventing double points when open amount = invoice amount |
118 | 118 |
if ( $invoice->amount != $invoice->open_amount && abs(abs($invoice->open_amount) - abs($self->amount)) < 0.01) { |
119 | 119 |
$agreement += $points{exact_open_amount}; |
120 | 120 |
$rule_matches .= 'exact_open_amount(' . $points{'exact_open_amount'} . ') '; |
121 |
};
|
|
121 |
} |
|
122 | 122 |
|
123 | 123 |
if ( $invoice->skonto_date && abs(abs($invoice->amount_less_skonto) - abs($self->amount)) < 0.01) { |
124 | 124 |
$agreement += $points{skonto_exact_amount}; |
125 | 125 |
$rule_matches .= 'skonto_exact_amount(' . $points{'skonto_exact_amount'} . ') '; |
126 | 126 |
$invoice->{skonto_type} = 'with_skonto_pt'; |
127 |
};
|
|
127 |
} |
|
128 | 128 |
|
129 | 129 |
#search invoice number in purpose |
130 | 130 |
my $invnumber = $invoice->invnumber; |
... | ... | |
143 | 143 |
if ( $invoice->is_sales && $self->amount < 0 ) { |
144 | 144 |
$agreement += $points{wrong_sign}; |
145 | 145 |
$rule_matches .= 'wrong_sign(' . $points{'wrong_sign'} . ') '; |
146 |
};
|
|
146 |
} |
|
147 | 147 |
if ( ! $invoice->is_sales && $self->amount > 0 ) { |
148 | 148 |
$agreement += $points{wrong_sign}; |
149 | 149 |
$rule_matches .= 'wrong_sign(' . $points{'wrong_sign'} . ') '; |
150 |
};
|
|
150 |
} |
|
151 | 151 |
|
152 | 152 |
# search customer/vendor number in purpose |
153 | 153 |
my $cvnumber; |
... | ... | |
165 | 165 |
if ( $cvname && $self->purpose =~ /\b\Q$cvname\E\b/i ) { |
166 | 166 |
$agreement += $points{cust_vend_name_in_purpose}; |
167 | 167 |
$rule_matches .= 'cust_vend_name_in_purpose(' . $points{'cust_vend_name_in_purpose'} . ') '; |
168 |
};
|
|
168 |
} |
|
169 | 169 |
|
170 | 170 |
# compare depositorname, don't try to match empty depositors |
171 | 171 |
my $depositorname; |
... | ... | |
174 | 174 |
if ( $depositorname && $self->remote_name =~ /$depositorname/ ) { |
175 | 175 |
$agreement += $points{depositor_matches}; |
176 | 176 |
$rule_matches .= 'depositor_matches(' . $points{'depositor_matches'} . ') '; |
177 |
};
|
|
177 |
} |
|
178 | 178 |
|
179 | 179 |
#Check if words in remote_name appear in cvname |
180 | 180 |
my $check_string_points = _check_string($self->remote_name,$cvname); |
181 | 181 |
if ( $check_string_points ) { |
182 | 182 |
$agreement += $check_string_points; |
183 | 183 |
$rule_matches .= 'remote_name(' . $check_string_points . ') '; |
184 |
};
|
|
184 |
} |
|
185 | 185 |
|
186 | 186 |
# transdate prefilter: compare transdate of bank_transaction with transdate of invoice |
187 | 187 |
if ( $datediff < -5 ) { # this might conflict with advance payments |
188 | 188 |
$agreement += $points{payment_before_invoice}; |
189 | 189 |
$rule_matches .= 'payment_before_invoice(' . $points{'payment_before_invoice'} . ') '; |
190 |
};
|
|
190 |
} |
|
191 | 191 |
if ( $datediff < 30 ) { |
192 | 192 |
$agreement += $points{payment_within_30_days}; |
193 | 193 |
$rule_matches .= 'payment_within_30_days(' . $points{'payment_within_30_days'} . ') '; |
194 |
};
|
|
194 |
} |
|
195 | 195 |
|
196 | 196 |
# only if we already have a good agreement, let date further change value of agreement. |
197 | 197 |
# this is so that if there are several plausible open invoices which are all equal |
... | ... | |
216 | 216 |
$agreement += $points{datebonus_negative}; |
217 | 217 |
$rule_matches .= 'datebonus_negative(' . $points{'datebonus_negative'} . ') '; |
218 | 218 |
} else { |
219 |
# e.g. datediff > 120 |
|
220 |
};
|
|
221 |
};
|
|
219 |
# e.g. datediff > 120
|
|
220 |
} |
|
221 |
} |
|
222 | 222 |
|
223 | 223 |
# if there is exactly one non-executed sepa_export_item for the invoice |
224 | 224 |
if ( my $seis = $invoice->find_sepa_export_items({ executed => 0 }) ) { |
Auch abrufbar als: Unified diff
BankTransaction Code cleaning
längst überfällige und häßliche semikolons entfernt