Revision 8f7fe4a4
Von Kivitendo Admin vor fast 8 Jahren hinzugefügt
t/bank/bank_transactions.t | ||
---|---|---|
183 | 183 |
my $netamount = 100; |
184 | 184 |
my $amount = $::form->round_amount($netamount * 1.19,2); |
185 | 185 |
my $invoice = SL::DB::PurchaseInvoice->new( |
186 |
invoice => 0,
|
|
187 |
invnumber => $params{invnumber} || 'test_ap_transaction',
|
|
188 |
amount => $amount,
|
|
189 |
netamount => $netamount,
|
|
190 |
transdate => $transdate1,
|
|
191 |
taxincluded => 0,
|
|
192 |
vendor_id => $vendor->id,
|
|
193 |
taxzone_id => $vendor->taxzone_id,
|
|
194 |
currency_id => $currency_id,
|
|
195 |
transactions => [],
|
|
196 |
notes => 'test_ap_transaction',
|
|
186 |
invoice => 0, |
|
187 |
invnumber => $params{invnumber} || 'test_ap_transaction', |
|
188 |
amount => $amount, |
|
189 |
netamount => $netamount, |
|
190 |
transdate => $transdate1, |
|
191 |
taxincluded => 0, |
|
192 |
vendor_id => $vendor->id, |
|
193 |
taxzone_id => $vendor->taxzone_id, |
|
194 |
currency_id => $currency_id, |
|
195 |
transactions => [], |
|
196 |
notes => 'test_ap_transaction', |
|
197 | 197 |
); |
198 | 198 |
$invoice->add_ap_amount_row( |
199 | 199 |
amount => $invoice->netamount, |
... | ... | |
226 | 226 |
my $bt = SL::Dev::Payment::create_bank_transaction(record => $ar_transaction) or die "Couldn't create bank_transaction"; |
227 | 227 |
|
228 | 228 |
$::form->{invoice_ids} = { |
229 |
$bt->id => [ $ar_transaction->id ]
|
|
230 |
};
|
|
229 |
$bt->id => [ $ar_transaction->id ] |
|
230 |
}; |
|
231 | 231 |
|
232 | 232 |
save_btcontroller_to_string(); |
233 | 233 |
|
... | ... | |
253 | 253 |
) or die "Couldn't create bank_transaction"; |
254 | 254 |
|
255 | 255 |
$::form->{invoice_ids} = { |
256 |
$bt->id => [ $ar_transaction->id ]
|
|
257 |
};
|
|
256 |
$bt->id => [ $ar_transaction->id ] |
|
257 |
}; |
|
258 | 258 |
$::form->{invoice_skontos} = { |
259 |
$bt->id => [ 'with_skonto_pt' ]
|
|
260 |
};
|
|
259 |
$bt->id => [ 'with_skonto_pt' ] |
|
260 |
}; |
|
261 | 261 |
|
262 | 262 |
save_btcontroller_to_string(); |
263 | 263 |
|
... | ... | |
286 | 286 |
is($agreement, 16, "points for ar_transaction_1 in test_two_invoices ok"); |
287 | 287 |
|
288 | 288 |
$::form->{invoice_ids} = { |
289 |
$bt->id => [ $ar_transaction_1->id, $ar_transaction_2->id ]
|
|
290 |
};
|
|
289 |
$bt->id => [ $ar_transaction_1->id, $ar_transaction_2->id ] |
|
290 |
}; |
|
291 | 291 |
|
292 | 292 |
save_btcontroller_to_string(); |
293 | 293 |
|
... | ... | |
316 | 316 |
) or die "Couldn't create bank_transaction"; |
317 | 317 |
|
318 | 318 |
$::form->{invoice_ids} = { |
319 |
$bt->id => [ $ar_transaction->id ]
|
|
320 |
};
|
|
319 |
$bt->id => [ $ar_transaction->id ] |
|
320 |
}; |
|
321 | 321 |
|
322 | 322 |
save_btcontroller_to_string(); |
323 | 323 |
|
... | ... | |
351 | 351 |
) or die "Couldn't create bank_transaction"; |
352 | 352 |
|
353 | 353 |
$::form->{invoice_ids} = { |
354 |
$bt_1->id => [ $ar_transaction->id ]
|
|
355 |
};
|
|
354 |
$bt_1->id => [ $ar_transaction->id ] |
|
355 |
}; |
|
356 | 356 |
save_btcontroller_to_string(); |
357 | 357 |
|
358 | 358 |
$::form->{invoice_ids} = { |
359 |
$bt_2->id => [ $ar_transaction->id ]
|
|
360 |
};
|
|
359 |
$bt_2->id => [ $ar_transaction->id ] |
|
360 |
}; |
|
361 | 361 |
save_btcontroller_to_string(); |
362 | 362 |
|
363 | 363 |
$ar_transaction->load; |
... | ... | |
383 | 383 |
) or die "Couldn't create bank_transaction"; |
384 | 384 |
|
385 | 385 |
$::form->{invoice_ids} = { |
386 |
$bt->id => [ $ar_transaction->id ]
|
|
387 |
};
|
|
386 |
$bt->id => [ $ar_transaction->id ] |
|
387 |
}; |
|
388 | 388 |
|
389 | 389 |
save_btcontroller_to_string(); |
390 | 390 |
|
... | ... | |
420 | 420 |
is($rule_matches, 'remote_account_number(3) exact_amount(4) wrong_sign(-1) depositor_matches(2) remote_name(2) payment_within_30_days(1) datebonus14(2) ', "rules_matches for credit note ok"); |
421 | 421 |
|
422 | 422 |
$::form->{invoice_ids} = { |
423 |
$bt->id => [ $credit_note->id ]
|
|
423 |
$bt->id => [ $credit_note->id ] |
|
424 | 424 |
}; |
425 | 425 |
|
426 | 426 |
save_btcontroller_to_string(); |
... | ... | |
433 | 433 |
} |
434 | 434 |
|
435 | 435 |
sub test_neg_ap_transaction { |
436 |
my (%params) = @_; |
|
437 | 436 |
my $testname = 'test_neg_ap_transaction'; |
438 | 437 |
my $netamount = -20; |
439 | 438 |
my $amount = $::form->round_amount($netamount * 1.19,2); |
440 | 439 |
my $invoice = SL::DB::PurchaseInvoice->new( |
441 |
invoice => 0,
|
|
442 |
invnumber => $params{invnumber} || 'test_neg_ap_transaction',
|
|
443 |
amount => $amount,
|
|
444 |
netamount => $netamount,
|
|
445 |
transdate => $transdate1,
|
|
446 |
taxincluded => 0,
|
|
447 |
vendor_id => $vendor->id,
|
|
448 |
taxzone_id => $vendor->taxzone_id,
|
|
449 |
currency_id => $currency_id,
|
|
450 |
transactions => [],
|
|
451 |
notes => 'test_neg_ap_transaction',
|
|
440 |
invoice => 0, |
|
441 |
invnumber => $params{invnumber} || 'test_neg_ap_transaction', |
|
442 |
amount => $amount, |
|
443 |
netamount => $netamount, |
|
444 |
transdate => $transdate1, |
|
445 |
taxincluded => 0, |
|
446 |
vendor_id => $vendor->id, |
|
447 |
taxzone_id => $vendor->taxzone_id, |
|
448 |
currency_id => $currency_id, |
|
449 |
transactions => [], |
|
450 |
notes => 'test_neg_ap_transaction', |
|
452 | 451 |
); |
453 | 452 |
$invoice->add_ap_amount_row( |
454 | 453 |
amount => $invoice->netamount, |
... | ... | |
459 | 458 |
$invoice->create_ap_row(chart => $ap_chart); |
460 | 459 |
$invoice->save; |
461 | 460 |
|
462 |
is($invoice->netamount , -20 , "$testname: netamount ok");
|
|
463 |
is($invoice->amount , -23.8 , "$testname: amount ok");
|
|
461 |
is($invoice->netamount, -20 , "$testname: netamount ok");
|
|
462 |
is($invoice->amount , -23.8, "$testname: amount ok");
|
|
464 | 463 |
|
465 | 464 |
my $bt = SL::Dev::Payment::create_bank_transaction(record => $invoice, |
466 | 465 |
amount => $invoice->amount, |
... | ... | |
471 | 470 |
is($agreement, 15, "points for negative ap transaction ok"); |
472 | 471 |
|
473 | 472 |
$::form->{invoice_ids} = { |
474 |
$bt->id => [ $invoice->id ]
|
|
473 |
$bt->id => [ $invoice->id ] |
|
475 | 474 |
}; |
476 | 475 |
|
477 | 476 |
save_btcontroller_to_string(); |
... | ... | |
485 | 484 |
return $invoice; |
486 | 485 |
}; |
487 | 486 |
|
488 |
|
|
489 | 487 |
1; |
Auch abrufbar als: Unified diff
Testfall Kosmetik (Alignment)