Revision 7368797d
Von Kivitendo Admin vor mehr als 1 Jahr hinzugefügt
bin/mozilla/ar.pl | ||
---|---|---|
my $now = $form->current_date(\%myconfig);
|
||
|
||
my @payments;
|
||
|
||
# reset form value of defaultcurrency_totalpaid, as it is currently a hidden and otherwise it gets accumulated after each update
|
||
# is only used if there are exchange rates
|
||
$form->{"defaultcurrency_totalpaid"} = 0;
|
||
|
||
for my $i (1 .. $form->{paidaccounts}) {
|
||
# hook for calc of of fx_paid and check if banktransaction has a record exchangerate
|
||
if ($form->{"exchangerate_$i"}) {
|
||
# hook for calc of of defaultcurrency_paid and check if banktransaction has a record exchangerate
|
||
if ($form->{"exchangerate_$i"} && $form->{"acc_trans_id_$i"}) {
|
||
# only check for bank transactions for payments that have already been saved
|
||
my $bt_acc_trans = SL::DB::Manager::BankTransactionAccTrans->find_by(acc_trans_id => $form->{"acc_trans_id_$i"});
|
||
if ($bt_acc_trans) {
|
||
if ($bt_acc_trans->bank_transaction->exchangerate > 0) {
|
||
$form->{"exchangerate_$i"} = $bt_acc_trans->bank_transaction->exchangerate;
|
||
$form->{"forex_$i"} = $form->{"exchangerate_$i"};
|
||
$form->{"record_forex_$i"} = 1;
|
||
}
|
||
if ($bt_acc_trans) {
|
||
if ($bt_acc_trans->bank_transaction->exchangerate > 0) {
|
||
$form->{"exchangerate_$i"} = $bt_acc_trans->bank_transaction->exchangerate;
|
||
$form->{"forex_$i"} = $form->{"exchangerate_$i"};
|
||
$form->{"record_forex_$i"} = 1;
|
||
}
|
||
$form->{"fx_paid_$i"} = $form->{"paid_$i"} / $form->{"exchangerate_$i"};
|
||
$form->{"fx_totalpaid"} += $form->{"fx_paid_$i"};
|
||
} # end hook fx_paid
|
||
}
|
||
$form->{"defaultcurrency_paid_$i"} = $form->{"paid_$i"} * $form->{"exchangerate_$i"};
|
||
$form->{"defaultcurrency_totalpaid"} += $form->{"defaultcurrency_paid_$i"};
|
||
} # end hook defaultcurrency_paid
|
||
|
||
my $payment = {
|
||
paid => $form->{"paid_$i"},
|
||
exchangerate => $form->{"exchangerate_$i"} || '',
|
||
... | ... | |
datepaid => $form->{"datepaid_$i"},
|
||
paid_project_id => $form->{"paid_project_id_$i"},
|
||
gldate => $form->{"gldate_$i"},
|
||
fx_paid => $form->{"fx_paid_$i"},
|
||
fx_totalpaid => $form->{"fx_totalpaid_$i"},
|
||
# only used if we have an fx currency
|
||
defaultcurrency_paid => $form->{"defaultcurrency_paid_$i"},
|
||
defaultcurrency_totalpaid => $form->{"defaultcurrency_totalpaid_$i"},
|
||
};
|
||
|
||
# default account for current assets (i.e. 1801 - SKR04) if no account is selected
|
templates/webpages/ar/form_header.html | ||
---|---|---|
<td align=center>
|
||
[%- IF row.forex || !row.changeable%]
|
||
<input type=hidden name="exchangerate_[% loop.count %]" value="[%- LxERP.format_amount(row.exchangerate, 5, 1) -%]">
|
||
[%- LxERP.format_amount(row.exchangerate, 5, 0) -%] = [% LxERP.format_amount(row.fx_paid, 2) %] [% currency %]</br>
|
||
[%- LxERP.format_amount(row.exchangerate, 5, 0) -%] = [% LxERP.format_amount(row.defaultcurrency_paid, 2) %] [% defaultcurrency %]</br>
|
||
[% IF $record_forex %][% 'bank transaction exchange rate' | $T8 %][%- ELSE %][% 'default exchange rate' | $T8 %][%- END %]
|
||
[%- ELSE %]
|
||
<input name="exchangerate_[% loop.count %]" size=10 value="[%- LxERP.format_amount(row.exchangerate, 5, 1) -%]">
|
||
... | ... | |
<td></td>
|
||
<td></td>
|
||
<td align="center">[% 'Total' | $T8 %]</td>
|
||
<td align="center">[% LxERP.format_amount(totalpaid, 2) | html %] [% defaultcurrency %] </td>
|
||
<td align="center">[% LxERP.format_amount(totalpaid, 2) | html %] [% currency %] </td>
|
||
[% IF show_exch %]
|
||
<td></td>
|
||
<td align="center">[% LxERP.format_amount(fx_totalpaid, 2) | html %] [% currency %]</td>
|
||
<input type="hidden" name="fx_totalpaid" value="[% fx_totalpaid %]">
|
||
<td align="center">[% LxERP.format_amount(defaultcurrency_totalpaid, 2) | html %] [% defaultcurrency %]</td>
|
||
<input type="hidden" name="defaultcurrency_totalpaid" value="[% defaultcurrency_totalpaid %]">
|
||
<input type="hidden" name="is_linked_bank_transaction" value="[% is_linked_bank_transaction %]">
|
||
[% END %]
|
||
</tr>
|
||
... | ... | |
<td></td>
|
||
<td></td>
|
||
<td align="center">[% 'Missing amount' | $T8 %]</td>
|
||
<td align="center">[% LxERP.format_amount(paid_missing, 2) | html %]</td>
|
||
<td align="center">[% LxERP.format_amount(paid_missing, 2) | html %] [% currency %]</td>
|
||
</tr>
|
||
<input type=hidden name=paidaccounts value='[% paidaccounts %]'>
|
||
|
Auch abrufbar als: Unified diff
Debitorenbuchungen - fx_paid -> defaultcurrency_paid