Revision 607163f5
Von Jan Büren vor etwa 2 Jahren hinzugefügt
bin/mozilla/ir.pl | ||
---|---|---|
181 | 181 |
$form->{"memo_$i"} = $form->{acc_trans}{$key}->[$i - 1]->{memo}; |
182 | 182 |
|
183 | 183 |
$form->{paidaccounts} = $i; |
184 |
# hook for calc of of fx_paid and check if banktransaction has a record exchangerate |
|
185 |
if ($form->{"exchangerate_$i"}) { |
|
186 |
my $bt_acc_trans; |
|
187 |
my $bt_acc_trans = SL::DB::Manager::BankTransactionAccTrans->find_by(acc_trans_id => $form->{"acc_trans_id_$i"}); |
|
188 |
if ($bt_acc_trans) { |
|
189 |
if ($bt_acc_trans->bank_transaction->exchangerate > 0) { |
|
190 |
$form->{"exchangerate_$i"} = $bt_acc_trans->bank_transaction->exchangerate; |
|
191 |
$form->{"forex_$i"} = $form->{"exchangerate_$i"}; |
|
192 |
$form->{"record_forex_$i"} = 1; |
|
193 |
} |
|
194 |
} |
|
195 |
$form->{"fx_paid_$i"} = $form->{"paid_$i"} / $form->{"exchangerate_$i"}; |
|
196 |
$form->{"fx_totalpaid"} += $form->{"fx_paid_$i"}; |
|
197 |
} # end hook fx_paid |
|
184 | 198 |
} |
185 | 199 |
} else { |
186 | 200 |
$form->{$key} = |
... | ... | |
668 | 682 |
if (($form->{previous_vendor_id} || $form->{vendor_id}) != $form->{vendor_id}) { |
669 | 683 |
IR->get_vendor(\%myconfig, $form); |
670 | 684 |
} |
671 |
|
|
672 |
if (!$form->{forex}) { # read exchangerate from input field (not hidden) |
|
673 |
$form->{exchangerate} = $form->parse_amount(\%myconfig, $form->{exchangerate}); |
|
685 |
# |
|
686 |
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig); |
|
687 |
if ($form->{defaultcurrency} ne $form->{currency}) { |
|
688 |
if ($form->{exchangerate}) { # user input OR first default -> leave this value |
|
689 |
$form->{exchangerate} = $form->parse_amount(\%myconfig, $form->{exchangerate}); |
|
690 |
# does this differ from daily default? |
|
691 |
my $current_daily_rate = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{invdate}, 'sell'); |
|
692 |
$form->{record_forex} = $current_daily_rate > 0 && $current_daily_rate != $form->{exchangerate} |
|
693 |
? 1 : 0; |
|
694 |
} else { # no value, but get defaults -> maybe user changes invdate as well ... |
|
695 |
($form->{exchangerate}, $form->{record_forex}) = $form->check_exchangerate(\%myconfig, $form->{currency}, |
|
696 |
$form->{invdate}, 'sell', $form->{id}, 'ap'); |
|
697 |
} |
|
674 | 698 |
} |
675 |
$form->{forex} = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{invdate}, 'sell'); |
|
676 |
$form->{exchangerate} = $form->{forex} if $form->{forex}; |
|
677 |
|
|
678 | 699 |
for my $i (1 .. $form->{paidaccounts}) { |
679 | 700 |
next unless $form->{"paid_$i"}; |
680 | 701 |
map { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } qw(paid exchangerate); |
681 |
$form->{"forex_$i"} = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'sell'); |
|
702 |
$form->{"forex_$i"} = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'sell') unless $form->{"record_forex_$i"};
|
|
682 | 703 |
$form->{"exchangerate_$i"} = $form->{"forex_$i"} if $form->{"forex_$i"}; |
683 | 704 |
} |
684 | 705 |
|
bin/mozilla/is.pl | ||
---|---|---|
235 | 235 |
$form->{"memo_$i"} = $form->{acc_trans}{$key}->[$i - 1]->{memo}; |
236 | 236 |
|
237 | 237 |
$form->{paidaccounts} = $i; |
238 |
# hook for calc of of fx_paid and check if banktransaction has a record exchangerate |
|
239 |
if ($form->{"exchangerate_$i"}) { |
|
240 |
my $bt_acc_trans; |
|
241 |
my $bt_acc_trans = SL::DB::Manager::BankTransactionAccTrans->find_by(acc_trans_id => $form->{"acc_trans_id_$i"}); |
|
242 |
if ($bt_acc_trans) { |
|
243 |
if ($bt_acc_trans->bank_transaction->exchangerate > 0) { |
|
244 |
$form->{"exchangerate_$i"} = $bt_acc_trans->bank_transaction->exchangerate; |
|
245 |
$form->{"forex_$i"} = $form->{"exchangerate_$i"}; |
|
246 |
$form->{"record_forex_$i"} = 1; |
|
247 |
} |
|
248 |
} |
|
249 |
$form->{"fx_paid_$i"} = $form->{"paid_$i"} / $form->{"exchangerate_$i"}; |
|
250 |
$form->{"fx_totalpaid"} += $form->{"fx_paid_$i"}; |
|
251 |
} # end hook fx_paid |
|
238 | 252 |
} |
239 | 253 |
} else { |
240 | 254 |
$form->{$key} = "$form->{acc_trans}{$key}->[0]->{accno}--$form->{acc_trans}{$key}->[0]->{description}"; |
... | ... | |
863 | 877 |
|
864 | 878 |
$form->{taxincluded} ||= $taxincluded; |
865 | 879 |
|
866 |
if (!$form->{forex}) { # read exchangerate from input field (not hidden) |
|
867 |
$form->{exchangerate} = $form->parse_amount(\%myconfig, $form->{exchangerate}) unless $recursive_call; |
|
880 |
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig); |
|
881 |
if ($form->{defaultcurrency} ne $form->{currency}) { |
|
882 |
if ($form->{exchangerate}) { # user input OR first default -> leave this value |
|
883 |
$form->{exchangerate} = $form->parse_amount(\%myconfig, $form->{exchangerate}) unless $recursive_call; |
|
884 |
# does this differ from daily default? |
|
885 |
my $current_daily_rate = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{invdate}, 'buy'); |
|
886 |
$form->{record_forex} = $current_daily_rate > 0 && $current_daily_rate != $form->{exchangerate} |
|
887 |
? 1 : 0; |
|
888 |
} else { # no value, but get defaults -> maybe user changes invdate as well ... |
|
889 |
($form->{exchangerate}, $form->{record_forex}) = $form->check_exchangerate(\%myconfig, $form->{currency}, |
|
890 |
$form->{invdate}, 'buy', $form->{id}, 'ar'); |
|
891 |
} |
|
868 | 892 |
} |
869 |
($form->{forex}, $form->{record_forex}) = $form->check_exchangerate(\%myconfig, $form->{currency}, |
|
870 |
$form->{invdate}, 'buy', $form->{id}, 'ar'); |
|
871 |
$form->{exchangerate} = $form->{forex} if $form->{forex}; |
|
872 | 893 |
for my $i (1 .. $form->{paidaccounts}) { |
873 | 894 |
next unless $form->{"paid_$i"}; |
874 | 895 |
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