Revision 853e4147
Von Kivitendo Admin vor 11 Monaten hinzugefügt
bin/mozilla/ar.pl | ||
---|---|---|
515 | 515 |
my $now = $form->current_date(\%myconfig); |
516 | 516 |
|
517 | 517 |
my @payments; |
518 |
|
|
519 |
# reset form value of defaultcurrency_totalpaid, as it is currently a hidden and otherwise it gets accumulated after each update |
|
520 |
# is only used if there are exchange rates |
|
521 |
$form->{"defaultcurrency_totalpaid"} = 0; |
|
522 |
|
|
518 | 523 |
for my $i (1 .. $form->{paidaccounts}) { |
519 |
# hook for calc of of fx_paid and check if banktransaction has a record exchangerate |
|
520 |
if ($form->{"exchangerate_$i"}) { |
|
524 |
# hook for calc of of defaultcurrency_paid and check if banktransaction has a record exchangerate |
|
525 |
if ($form->{"exchangerate_$i"} && $form->{"acc_trans_id_$i"}) { |
|
526 |
# only check for bank transactions for payments that have already been saved |
|
521 | 527 |
my $bt_acc_trans = SL::DB::Manager::BankTransactionAccTrans->find_by(acc_trans_id => $form->{"acc_trans_id_$i"}); |
522 |
if ($bt_acc_trans) { |
|
523 |
if ($bt_acc_trans->bank_transaction->exchangerate > 0) { |
|
524 |
$form->{"exchangerate_$i"} = $bt_acc_trans->bank_transaction->exchangerate; |
|
525 |
$form->{"forex_$i"} = $form->{"exchangerate_$i"}; |
|
526 |
$form->{"record_forex_$i"} = 1; |
|
527 |
} |
|
528 |
if ($bt_acc_trans) { |
|
529 |
if ($bt_acc_trans->bank_transaction->exchangerate > 0) { |
|
530 |
$form->{"exchangerate_$i"} = $bt_acc_trans->bank_transaction->exchangerate; |
|
531 |
$form->{"forex_$i"} = $form->{"exchangerate_$i"}; |
|
532 |
$form->{"record_forex_$i"} = 1; |
|
528 | 533 |
} |
529 |
$form->{"fx_paid_$i"} = $form->{"paid_$i"} / $form->{"exchangerate_$i"}; |
|
530 |
$form->{"fx_totalpaid"} += $form->{"fx_paid_$i"}; |
|
531 |
} # end hook fx_paid |
|
534 |
} |
|
535 |
$form->{"defaultcurrency_paid_$i"} = $form->{"paid_$i"} * $form->{"exchangerate_$i"}; |
|
536 |
$form->{"defaultcurrency_totalpaid"} += $form->{"defaultcurrency_paid_$i"}; |
|
537 |
} # end hook defaultcurrency_paid |
|
538 |
|
|
532 | 539 |
my $payment = { |
533 | 540 |
paid => $form->{"paid_$i"}, |
534 | 541 |
exchangerate => $form->{"exchangerate_$i"} || '', |
... | ... | |
542 | 549 |
datepaid => $form->{"datepaid_$i"}, |
543 | 550 |
paid_project_id => $form->{"paid_project_id_$i"}, |
544 | 551 |
gldate => $form->{"gldate_$i"}, |
545 |
fx_paid => $form->{"fx_paid_$i"}, |
|
546 |
fx_totalpaid => $form->{"fx_totalpaid_$i"}, |
|
552 |
# only used if we have an fx currency |
|
553 |
defaultcurrency_paid => $form->{"defaultcurrency_paid_$i"}, |
|
554 |
defaultcurrency_totalpaid => $form->{"defaultcurrency_totalpaid_$i"}, |
|
547 | 555 |
}; |
548 | 556 |
|
549 | 557 |
# default account for current assets (i.e. 1801 - SKR04) if no account is selected |
templates/webpages/ar/form_header.html | ||
---|---|---|
310 | 310 |
<td align=center> |
311 | 311 |
[%- IF row.forex || !row.changeable%] |
312 | 312 |
<input type=hidden name="exchangerate_[% loop.count %]" value="[%- LxERP.format_amount(row.exchangerate, 5, 1) -%]"> |
313 |
[%- LxERP.format_amount(row.exchangerate, 5, 0) -%] = [% LxERP.format_amount(row.fx_paid, 2) %] [% currency %]</br>
|
|
313 |
[%- LxERP.format_amount(row.exchangerate, 5, 0) -%] = [% LxERP.format_amount(row.defaultcurrency_paid, 2) %] [% defaultcurrency %]</br>
|
|
314 | 314 |
[% IF $record_forex %][% 'bank transaction exchange rate' | $T8 %][%- ELSE %][% 'default exchange rate' | $T8 %][%- END %] |
315 | 315 |
[%- ELSE %] |
316 | 316 |
<input name="exchangerate_[% loop.count %]" size=10 value="[%- LxERP.format_amount(row.exchangerate, 5, 1) -%]"> |
... | ... | |
342 | 342 |
<td></td> |
343 | 343 |
<td></td> |
344 | 344 |
<td align="center">[% 'Total' | $T8 %]</td> |
345 |
<td align="center">[% LxERP.format_amount(totalpaid, 2) | html %] [% defaultcurrency %] </td>
|
|
345 |
<td align="center">[% LxERP.format_amount(totalpaid, 2) | html %] [% currency %] </td> |
|
346 | 346 |
[% IF show_exch %] |
347 | 347 |
<td></td> |
348 |
<td align="center">[% LxERP.format_amount(fx_totalpaid, 2) | html %] [% currency %]</td>
|
|
349 |
<input type="hidden" name="fx_totalpaid" value="[% fx_totalpaid %]">
|
|
348 |
<td align="center">[% LxERP.format_amount(defaultcurrency_totalpaid, 2) | html %] [% defaultcurrency %]</td>
|
|
349 |
<input type="hidden" name="defaultcurrency_totalpaid" value="[% defaultcurrency_totalpaid %]">
|
|
350 | 350 |
<input type="hidden" name="is_linked_bank_transaction" value="[% is_linked_bank_transaction %]"> |
351 | 351 |
[% END %] |
352 | 352 |
</tr> |
... | ... | |
354 | 354 |
<td></td> |
355 | 355 |
<td></td> |
356 | 356 |
<td align="center">[% 'Missing amount' | $T8 %]</td> |
357 |
<td align="center">[% LxERP.format_amount(paid_missing, 2) | html %]</td> |
|
357 |
<td align="center">[% LxERP.format_amount(paid_missing, 2) | html %] [% currency %]</td>
|
|
358 | 358 |
</tr> |
359 | 359 |
<input type=hidden name=paidaccounts value='[% paidaccounts %]'> |
360 | 360 |
|
Auch abrufbar als: Unified diff
Debitorenbuchungen - fx_paid -> defaultcurrency_paid