Revision 7368797d
Von Kivitendo Admin vor 8 Monaten hinzugefügt
bin/mozilla/ar.pl | ||
---|---|---|
492 | 492 |
my $now = $form->current_date(\%myconfig); |
493 | 493 |
|
494 | 494 |
my @payments; |
495 |
|
|
496 |
# reset form value of defaultcurrency_totalpaid, as it is currently a hidden and otherwise it gets accumulated after each update |
|
497 |
# is only used if there are exchange rates |
|
498 |
$form->{"defaultcurrency_totalpaid"} = 0; |
|
499 |
|
|
495 | 500 |
for my $i (1 .. $form->{paidaccounts}) { |
496 |
# hook for calc of of fx_paid and check if banktransaction has a record exchangerate |
|
497 |
if ($form->{"exchangerate_$i"}) { |
|
501 |
# hook for calc of of defaultcurrency_paid and check if banktransaction has a record exchangerate |
|
502 |
if ($form->{"exchangerate_$i"} && $form->{"acc_trans_id_$i"}) { |
|
503 |
# only check for bank transactions for payments that have already been saved |
|
498 | 504 |
my $bt_acc_trans = SL::DB::Manager::BankTransactionAccTrans->find_by(acc_trans_id => $form->{"acc_trans_id_$i"}); |
499 |
if ($bt_acc_trans) { |
|
500 |
if ($bt_acc_trans->bank_transaction->exchangerate > 0) { |
|
501 |
$form->{"exchangerate_$i"} = $bt_acc_trans->bank_transaction->exchangerate; |
|
502 |
$form->{"forex_$i"} = $form->{"exchangerate_$i"}; |
|
503 |
$form->{"record_forex_$i"} = 1; |
|
504 |
} |
|
505 |
if ($bt_acc_trans) { |
|
506 |
if ($bt_acc_trans->bank_transaction->exchangerate > 0) { |
|
507 |
$form->{"exchangerate_$i"} = $bt_acc_trans->bank_transaction->exchangerate; |
|
508 |
$form->{"forex_$i"} = $form->{"exchangerate_$i"}; |
|
509 |
$form->{"record_forex_$i"} = 1; |
|
505 | 510 |
} |
506 |
$form->{"fx_paid_$i"} = $form->{"paid_$i"} / $form->{"exchangerate_$i"}; |
|
507 |
$form->{"fx_totalpaid"} += $form->{"fx_paid_$i"}; |
|
508 |
} # end hook fx_paid |
|
511 |
} |
|
512 |
$form->{"defaultcurrency_paid_$i"} = $form->{"paid_$i"} * $form->{"exchangerate_$i"}; |
|
513 |
$form->{"defaultcurrency_totalpaid"} += $form->{"defaultcurrency_paid_$i"}; |
|
514 |
} # end hook defaultcurrency_paid |
|
515 |
|
|
509 | 516 |
my $payment = { |
510 | 517 |
paid => $form->{"paid_$i"}, |
511 | 518 |
exchangerate => $form->{"exchangerate_$i"} || '', |
... | ... | |
519 | 526 |
datepaid => $form->{"datepaid_$i"}, |
520 | 527 |
paid_project_id => $form->{"paid_project_id_$i"}, |
521 | 528 |
gldate => $form->{"gldate_$i"}, |
522 |
fx_paid => $form->{"fx_paid_$i"}, |
|
523 |
fx_totalpaid => $form->{"fx_totalpaid_$i"}, |
|
529 |
# only used if we have an fx currency |
|
530 |
defaultcurrency_paid => $form->{"defaultcurrency_paid_$i"}, |
|
531 |
defaultcurrency_totalpaid => $form->{"defaultcurrency_totalpaid_$i"}, |
|
524 | 532 |
}; |
525 | 533 |
|
526 | 534 |
# default account for current assets (i.e. 1801 - SKR04) if no account is selected |
Auch abrufbar als: Unified diff
Debitorenbuchungen - fx_paid -> defaultcurrency_paid