Revision 36a93d2e
Von Jan Büren vor fast 2 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
2572 | 2572 |
do_statement($self, $sth, $query, $self->{id}); |
2573 | 2573 |
|
2574 | 2574 |
# get exchangerate for currency |
2575 |
$self->{exchangerate} = |
|
2576 |
$self->check_exchangerate($myconfig, $self->{currency}, $self->{transdate}, $fld); |
|
2575 |
($self->{exchangerate}, $self->{record_forex}) = $self->check_exchangerate($myconfig, $self->{currency}, $self->{transdate}, $fld, |
|
2576 |
$self->{id}, $arap); |
|
2577 |
|
|
2577 | 2578 |
my $index = 0; |
2578 | 2579 |
|
2579 | 2580 |
# store amounts in {acc_trans}{$key} for multiple accounts |
2580 | 2581 |
while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { |
2582 |
# credit and debit bookings calc fx rate for positions |
|
2583 |
# also used as exchangerate_$i for payments |
|
2581 | 2584 |
$ref->{exchangerate} = |
2582 | 2585 |
$self->check_exchangerate($myconfig, $self->{currency}, $ref->{transdate}, $fld); |
2583 | 2586 |
if (!($xkeyref{ $ref->{accno} } =~ /tax/)) { |
bin/mozilla/ap.pl | ||
---|---|---|
403 | 403 |
|
404 | 404 |
# currencies |
405 | 405 |
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig); |
406 |
if ($form->{currency} ne $form->{defaultcurrency}) { |
|
407 |
($form->{exchangerate}, $form->{record_forex}) = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{transdate}, "sell", $form->{id}, 'ap'); |
|
406 |
if ($form->{currency} ne $form->{defaultcurrency} && !$form->{exchangerate}) { |
|
407 |
($form->{exchangerate}, $form->{record_forex}) = $form->{id} |
|
408 |
? $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{transdate}, "sell", $form->{id}, 'ap') |
|
409 |
: $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{transdate}, "sell"); |
|
408 | 410 |
} |
409 | 411 |
|
410 | 412 |
# format amounts |
... | ... | |
540 | 542 |
$form->{accno_arap} = IS->get_standard_accno_current_assets(\%myconfig, \%$form); |
541 | 543 |
|
542 | 544 |
for my $i (1 .. $form->{paidaccounts}) { |
545 |
# hook for calc of of fx_paid and check if banktransaction has a record exchangerate |
|
546 |
if ($form->{"exchangerate_$i"}) { |
|
547 |
my $bt_acc_trans; |
|
548 |
my $bt_acc_trans = SL::DB::Manager::BankTransactionAccTrans->find_by(acc_trans_id => $form->{"acc_trans_id_$i"}); |
|
549 |
if ($bt_acc_trans) { |
|
550 |
if ($bt_acc_trans->bank_transaction->exchangerate > 0) { |
|
551 |
$form->{"exchangerate_$i"} = $bt_acc_trans->bank_transaction->exchangerate; |
|
552 |
$form->{"forex_$i"} = $form->{"exchangerate_$i"}; |
|
553 |
$form->{"record_forex_$i"} = 1; |
|
554 |
} |
|
555 |
} |
|
556 |
$form->{"fx_paid_$i"} = $form->{"paid_$i"} / $form->{"exchangerate_$i"}; |
|
557 |
$form->{"fx_totalpaid"} += $form->{"fx_paid_$i"}; |
|
558 |
} # end hook fx_paid |
|
543 | 559 |
# format amounts |
544 | 560 |
if ($form->{"paid_$i"}) { |
545 | 561 |
$form->{"paid_$i"} = $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2); |
... | ... | |
574 | 590 |
$form->{'AP_paid_' . $i} . " " . SL::DB::Manager::Chart->find_by(accno => $form->{'AP_paid_' . $i})->description |
575 | 591 |
: ''; |
576 | 592 |
} |
577 |
|
|
578 |
$form->{paid_missing} = $form->{invtotal_unformatted} - $form->{totalpaid}; |
|
593 |
$form->{paid_missing} = $::form->{is_linked_bank_transaction} && $form->{invoice_obj}->forex ? |
|
594 |
$form->{invoice_obj}->open_amount |
|
595 |
: $form->{invtotal_unformatted} - $form->{totalpaid}; |
|
579 | 596 |
|
580 | 597 |
$form->{payment_id} = $form->{invoice_obj}->{payment_id} // $form->{payment_id}; |
581 | 598 |
print $form->parse_html_template('ap/form_header', { |
... | ... | |
1407 | 1424 |
: $is_linked_bank_transaction ? 1 |
1408 | 1425 |
: $has_sepa_exports ? 1 |
1409 | 1426 |
: 0; |
1427 |
# and is_linked_bank_transaction |
|
1428 |
$::form->{is_linked_bank_transaction} = $is_linked_bank_transaction; |
|
1410 | 1429 |
|
1411 | 1430 |
my $create_post_action = sub { |
1412 | 1431 |
# $_[0]: description |
1413 | 1432 |
# $_[1]: after_action |
1414 | 1433 |
action => [ |
1434 |
|
|
1415 | 1435 |
$_[0], |
1416 | 1436 |
submit => [ '#form', { action => "post", after_action => $_[1] } ], |
1417 | 1437 |
checks => [ 'kivi.validate_form', 'kivi.AP.check_fields_before_posting', 'kivi.AP.check_duplicate_invnumber' ], |
bin/mozilla/ar.pl | ||
---|---|---|
483 | 483 |
|
484 | 484 |
my @payments; |
485 | 485 |
for my $i (1 .. $form->{paidaccounts}) { |
486 |
# hook for calc of of fx_paid and check if banktransaction has a record exchangerate |
|
487 |
if ($form->{"exchangerate_$i"}) { |
|
488 |
my $bt_acc_trans; |
|
489 |
my $bt_acc_trans = SL::DB::Manager::BankTransactionAccTrans->find_by(acc_trans_id => $form->{"acc_trans_id_$i"}); |
|
490 |
if ($bt_acc_trans) { |
|
491 |
if ($bt_acc_trans->bank_transaction->exchangerate > 0) { |
|
492 |
$form->{"exchangerate_$i"} = $bt_acc_trans->bank_transaction->exchangerate; |
|
493 |
$form->{"forex_$i"} = $form->{"exchangerate_$i"}; |
|
494 |
$form->{"record_forex_$i"} = 1; |
|
495 |
} |
|
496 |
} |
|
497 |
$form->{"fx_paid_$i"} = $form->{"paid_$i"} / $form->{"exchangerate_$i"}; |
|
498 |
$form->{"fx_totalpaid"} += $form->{"fx_paid_$i"}; |
|
499 |
} # end hook fx_paid |
|
486 | 500 |
my $payment = { |
487 | 501 |
paid => $form->{"paid_$i"}, |
488 | 502 |
exchangerate => $form->{"exchangerate_$i"} || '', |
... | ... | |
492 | 506 |
memo => $form->{"memo_$i"}, |
493 | 507 |
AR_paid => $form->{"AR_paid_$i"}, |
494 | 508 |
forex => $form->{"forex_$i"}, |
509 |
record_forex => $form->{"record_forex_$i"}, |
|
495 | 510 |
datepaid => $form->{"datepaid_$i"}, |
496 | 511 |
paid_project_id => $form->{"paid_project_id_$i"}, |
497 | 512 |
gldate => $form->{"gldate_$i"}, |
513 |
fx_paid => $form->{"fx_paid_$i"}, |
|
514 |
fx_totalpaid => $form->{"fx_totalpaid_$i"}, |
|
498 | 515 |
}; |
499 | 516 |
|
500 | 517 |
# default account for current assets (i.e. 1801 - SKR04) if no account is selected |
... | ... | |
541 | 558 |
); |
542 | 559 |
|
543 | 560 |
setup_ar_form_header_action_bar(); |
561 |
$::form->{paid_missing} = $form->{is_linked_bank_transaction} && $form->{invoice_obj}->forex ? |
|
562 |
$form->{invoice_obj}->open_amount |
|
563 |
: $::form->{invtotal} - $::form->{totalpaid}; |
|
544 | 564 |
|
545 | 565 |
$form->header; |
546 | 566 |
print $::form->parse_html_template('ar/form_header', { |
547 |
paid_missing => $::form->{invtotal} - $::form->{totalpaid},
|
|
567 |
paid_missing => $::form->{paidmissing},
|
|
548 | 568 |
show_exch => ($::form->{defaultcurrency} && ($::form->{currency} ne $::form->{defaultcurrency})), |
549 | 569 |
payments => \@payments, |
550 | 570 |
transactions => \@transactions, |
... | ... | |
1373 | 1393 |
|
1374 | 1394 |
my $is_linked_bank_transaction; |
1375 | 1395 |
if ($::form->{id} |
1376 |
&& SL::DB::Default->get->payments_changeable != 0 |
|
1377 | 1396 |
&& SL::DB::Manager::BankTransactionAccTrans->find_by(ar_id => $::form->{id})) { |
1378 | 1397 |
|
1379 | 1398 |
$is_linked_bank_transaction = 1; |
... | ... | |
1387 | 1406 |
: ($::form->{id} && $change_on_same_day_only) ? 1 |
1388 | 1407 |
: $is_linked_bank_transaction ? 1 |
1389 | 1408 |
: 0; |
1409 |
# and is_linked_bank_transaction |
|
1410 |
$::form->{is_linked_bank_transaction} = $is_linked_bank_transaction; |
|
1390 | 1411 |
for my $bar ($::request->layout->get('actionbar')) { |
1391 | 1412 |
$bar->add( |
1392 | 1413 |
action => [ |
Auch abrufbar als: Unified diff
Wechselkurse für Belege oder Zahlungen für ar und ap holen und berechnen