Revision 92361072
Von Moritz Bunkus vor fast 18 Jahren hinzugefügt
SL/AP.pm | ||
---|---|---|
516 | 516 |
# connect to database, turn off autocommit |
517 | 517 |
my $dbh = $form->dbconnect_noauto($myconfig); |
518 | 518 |
|
519 |
$form->{datepaid} = $form->{invdate};
|
|
519 |
$form->{datepaid} = $form->{transdate};
|
|
520 | 520 |
|
521 | 521 |
# total payments, don't move we need it here |
522 | 522 |
for my $i (1 .. $form->{paidaccounts}) { |
... | ... | |
526 | 526 |
} |
527 | 527 |
|
528 | 528 |
$form->{exchangerate} = |
529 |
$form->get_exchangerate($dbh, $form->{currency}, $form->{invdate},
|
|
529 |
$form->get_exchangerate($dbh, $form->{currency}, $form->{transdate},
|
|
530 | 530 |
"buy"); |
531 | 531 |
|
532 | 532 |
my (@values, $query); |
533 | 533 |
|
534 |
my ($accno_ap) = split(/--/, $form->{APselected}); |
|
535 |
|
|
534 | 536 |
# record payments and offsetting AP |
535 | 537 |
for my $i (1 .. $form->{paidaccounts}) { |
536 | 538 |
|
537 | 539 |
if ($form->{"paid_$i"} != 0) { |
538 | 540 |
my ($accno) = split /--/, $form->{"AP_paid_$i"}; |
539 |
$form->{"datepaid_$i"} = $form->{invdate}
|
|
541 |
$form->{"datepaid_$i"} = $form->{transdate}
|
|
540 | 542 |
unless ($form->{"datepaid_$i"}); |
541 | 543 |
$form->{datepaid} = $form->{"datepaid_$i"}; |
542 | 544 |
|
... | ... | |
559 | 561 |
$form->round_amount($form->{"paid_$i"} * $form->{"exchangerate"}, |
560 | 562 |
2) * -1; |
561 | 563 |
|
562 |
|
|
563 | 564 |
$query = |
564 | 565 |
qq|DELETE FROM acc_trans | . |
565 | 566 |
qq|WHERE trans_id = ? | . |
566 | 567 |
qq| AND chart_id = (SELECT c.id FROM chart c WHERE c.accno = ?) | . |
567 | 568 |
qq| AND amount = ? AND transdate = ?|; |
568 |
@values = ($form->{id}, $form->{AP}, $amount,
|
|
569 |
@values = ($form->{id}, $accno_ap, $amount,
|
|
569 | 570 |
conv_date($form->{"datepaid_$i"})); |
570 | 571 |
do_query($form, $dbh, $query, @values); |
571 | 572 |
|
572 | 573 |
$query = |
573 | 574 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id) | . |
574 | 575 |
qq|VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, ?)|; |
575 |
@values = ($form->{id}, $form->{AP}, $amount,
|
|
576 |
@values = ($form->{id}, $accno_ap, $amount,
|
|
576 | 577 |
conv_date($form->{"datepaid_$i"}), |
577 | 578 |
conv_i($form->{"paid_project_id_$i"})); |
578 | 579 |
do_query($form, $dbh, $query, @values); |
SL/AR.pm | ||
---|---|---|
383 | 383 |
# connect to database, turn off autocommit |
384 | 384 |
my $dbh = $form->dbconnect_noauto($myconfig); |
385 | 385 |
|
386 |
$form->{datepaid} = $form->{invdate};
|
|
386 |
$form->{datepaid} = $form->{transdate};
|
|
387 | 387 |
|
388 | 388 |
# total payments, don't move we need it here |
389 | 389 |
for my $i (1 .. $form->{paidaccounts}) { |
... | ... | |
397 | 397 |
} |
398 | 398 |
|
399 | 399 |
$form->{exchangerate} = |
400 |
$form->get_exchangerate($dbh, $form->{currency}, $form->{invdate},
|
|
400 |
$form->get_exchangerate($dbh, $form->{currency}, $form->{transdate},
|
|
401 | 401 |
"buy"); |
402 | 402 |
|
403 |
my ($accno_ar) = split(/--/, $form->{ARselected}); |
|
404 |
|
|
403 | 405 |
# record payments and offsetting AR |
404 | 406 |
for my $i (1 .. $form->{paidaccounts}) { |
405 | 407 |
|
... | ... | |
407 | 409 |
my $project_id = conv_i($form->{"paid_project_id_$i"}); |
408 | 410 |
|
409 | 411 |
my ($accno) = split /--/, $form->{"AR_paid_$i"}; |
410 |
$form->{"datepaid_$i"} = $form->{invdate}
|
|
412 |
$form->{"datepaid_$i"} = $form->{transdate}
|
|
411 | 413 |
unless ($form->{"datepaid_$i"}); |
412 | 414 |
$form->{datepaid} = $form->{"datepaid_$i"}; |
413 | 415 |
|
... | ... | |
432 | 434 |
|
433 | 435 |
|
434 | 436 |
$query = qq|DELETE FROM acc_trans WHERE trans_id=$form->{id} AND chart_id=(SELECT c.id FROM chart c |
435 |
WHERE c.accno = '$form->{AR}') AND amount=$amount AND transdate='$form->{"datepaid_$i"}'|;
|
|
437 |
WHERE c.accno = '$accno_ar') AND amount=$amount AND transdate='$form->{"datepaid_$i"}'|;
|
|
436 | 438 |
$dbh->do($query) || $form->dberror($query); |
437 | 439 |
|
438 | 440 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, |
439 | 441 |
transdate, project_id) |
440 | 442 |
VALUES ($form->{id}, (SELECT c.id FROM chart c |
441 |
WHERE c.accno = '$form->{AR}'),
|
|
443 |
WHERE c.accno = '$accno_ar'),
|
|
442 | 444 |
$amount, '$form->{"datepaid_$i"}', ?)|; |
443 | 445 |
do_query($form, $dbh, $query, $project_id); |
444 | 446 |
|
SL/Form.pm | ||
---|---|---|
1092 | 1092 |
|
1093 | 1093 |
unless ($transdate) { |
1094 | 1094 |
$main::lxdebug->leave_sub(); |
1095 |
return "";
|
|
1095 |
return 1;
|
|
1096 | 1096 |
} |
1097 | 1097 |
|
1098 | 1098 |
my $query = qq|SELECT e.$fld FROM exchangerate e |
... | ... | |
1104 | 1104 |
my ($exchangerate) = $sth->fetchrow_array; |
1105 | 1105 |
$sth->finish; |
1106 | 1106 |
|
1107 |
if ($exchangerate == 0) {
|
|
1107 |
if (!$exchangerate) {
|
|
1108 | 1108 |
$exchangerate = 1; |
1109 | 1109 |
} |
1110 | 1110 |
|
Auch abrufbar als: Unified diff
"Zahlung buchen" bei Kreditoren- und Debitorenrechnungen: Konten richtig zuordnen und das richtige Datumsfeld benutzen.