Revision e4efda35
Von Jan Büren vor fast 2 Jahren hinzugefügt
bin/mozilla/is.pl | ||
---|---|---|
234 | 234 |
$form->{"memo_$i"} = $form->{acc_trans}{$key}->[$i - 1]->{memo}; |
235 | 235 |
|
236 | 236 |
$form->{paidaccounts} = $i; |
237 |
# hook for calc of of fx_paid and check if banktransaction has a record exchangerate |
|
238 |
if ($form->{"exchangerate_$i"}) { |
|
239 |
my $bt_acc_trans; |
|
240 |
my $bt_acc_trans = SL::DB::Manager::BankTransactionAccTrans->find_by(acc_trans_id => $form->{"acc_trans_id_$i"}); |
|
241 |
if ($bt_acc_trans) { |
|
242 |
if ($bt_acc_trans->bank_transaction->exchangerate > 0) { |
|
243 |
$form->{"exchangerate_$i"} = $bt_acc_trans->bank_transaction->exchangerate; |
|
244 |
$form->{"forex_$i"} = $form->{"exchangerate_$i"}; |
|
245 |
$form->{"record_forex_$i"} = 1; |
|
246 |
} |
|
247 |
} |
|
248 |
$form->{"fx_paid_$i"} = $form->{"paid_$i"} / $form->{"exchangerate_$i"}; |
|
249 |
$form->{"fx_totalpaid"} += $form->{"fx_paid_$i"}; |
|
250 |
} # end hook fx_paid |
|
237 | 251 |
} |
238 | 252 |
} else { |
239 | 253 |
$form->{$key} = "$form->{acc_trans}{$key}->[0]->{accno}--$form->{acc_trans}{$key}->[0]->{description}"; |
... | ... | |
856 | 870 |
|
857 | 871 |
$form->{taxincluded} ||= $taxincluded; |
858 | 872 |
|
859 |
if (!$form->{forex}) { # read exchangerate from input field (not hidden) |
|
860 |
$form->{exchangerate} = $form->parse_amount(\%myconfig, $form->{exchangerate}) unless $recursive_call; |
|
873 |
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig); |
|
874 |
if ($form->{defaultcurrency} ne $form->{currency}) { |
|
875 |
if ($form->{exchangerate}) { # user input OR first default -> leave this value |
|
876 |
$form->{exchangerate} = $form->parse_amount(\%myconfig, $form->{exchangerate}) unless $recursive_call; |
|
877 |
# does this differ from daily default? |
|
878 |
my $current_daily_rate = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{invdate}, 'buy'); |
|
879 |
$form->{record_forex} = $current_daily_rate > 0 && $current_daily_rate != $form->{exchangerate} |
|
880 |
? 1 : 0; |
|
881 |
} else { # no value, but get defaults -> maybe user changes invdate as well ... |
|
882 |
($form->{exchangerate}, $form->{record_forex}) = $form->check_exchangerate(\%myconfig, $form->{currency}, |
|
883 |
$form->{invdate}, 'buy', $form->{id}, 'ar'); |
|
884 |
} |
|
861 | 885 |
} |
862 |
($form->{forex}, $form->{record_forex}) = $form->check_exchangerate(\%myconfig, $form->{currency}, |
|
863 |
$form->{invdate}, 'buy', $form->{id}, 'ar'); |
|
864 |
$form->{exchangerate} = $form->{forex} if $form->{forex}; |
|
865 | 886 |
for my $i (1 .. $form->{paidaccounts}) { |
866 | 887 |
next unless $form->{"paid_$i"}; |
867 | 888 |
map { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } qw(paid exchangerate); |
Auch abrufbar als: Unified diff
Wechselkurse für Zahlungen in Einkauf- und Verkaufsrechnung anzeigen