Revision d4651135
Von Moritz Bunkus vor fast 18 Jahren hinzugefügt
SL/IR.pm | ||
---|---|---|
389 | 389 |
} |
390 | 390 |
} |
391 | 391 |
|
392 |
$project_id = conv_i($form->{"globalproject_id"}); |
|
393 |
|
|
392 | 394 |
$form->{datepaid} = $form->{invdate}; |
393 | 395 |
|
394 | 396 |
# all amounts are in natural state, netamount includes the taxes |
... | ... | |
476 | 478 |
) != 0 |
477 | 479 |
) { |
478 | 480 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, |
479 |
transdate, taxkey) |
|
481 |
transdate, taxkey, project_id)
|
|
480 | 482 |
VALUES ($trans_id, (SELECT c.id FROM chart c |
481 | 483 |
WHERE c.accno = '$accno'), |
482 | 484 |
$form->{amount}{$trans_id}{$accno}, '$form->{invdate}', |
483 |
(SELECT taxkey_id FROM chart WHERE accno = '$accno'))|; |
|
484 |
$dbh->do($query) || $form->dberror($query);
|
|
485 |
(SELECT taxkey_id FROM chart WHERE accno = '$accno'), ?)|;
|
|
486 |
do_query($form, $dbh, $query, $project_id);
|
|
485 | 487 |
} |
486 | 488 |
} |
487 | 489 |
} |
... | ... | |
518 | 520 |
|
519 | 521 |
if ($form->{amount}{ $form->{id} }{ $form->{AP} } != 0) { |
520 | 522 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, |
521 |
transdate) |
|
523 |
transdate, project_id)
|
|
522 | 524 |
VALUES ($form->{id}, (SELECT c.id FROM chart c |
523 | 525 |
WHERE c.accno = '$form->{AP}'), |
524 |
$amount, '$form->{"datepaid_$i"}')|; |
|
525 |
$dbh->do($query) || $form->dberror($query);
|
|
526 |
$amount, '$form->{"datepaid_$i"}', ?)|;
|
|
527 |
do_query($form, $dbh, $query, $project_id);
|
|
526 | 528 |
} |
527 | 529 |
|
528 | 530 |
# record payment |
529 | 531 |
|
530 | 532 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, |
531 |
source, memo) |
|
533 |
source, memo, project_id)
|
|
532 | 534 |
VALUES ($form->{id}, (SELECT c.id FROM chart c |
533 | 535 |
WHERE c.accno = '$accno'), |
534 | 536 |
$form->{"paid_$i"}, '$form->{"datepaid_$i"}', |
535 |
'$form->{"source_$i"}', '$form->{"memo_$i"}')|; |
|
536 |
$dbh->do($query) || $form->dberror($query);
|
|
537 |
'$form->{"source_$i"}', '$form->{"memo_$i"}', ?)|;
|
|
538 |
do_query($form, $dbh, $query, $project_id);
|
|
537 | 539 |
|
538 | 540 |
$exchangerate = 0; |
539 | 541 |
|
... | ... | |
587 | 589 |
) { |
588 | 590 |
|
589 | 591 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, |
590 |
transdate, cleared, fx_transaction) |
|
592 |
transdate, cleared, fx_transaction, project_id)
|
|
591 | 593 |
VALUES ($form->{id}, (SELECT c.id FROM chart c |
592 | 594 |
WHERE c.accno = '$accno'), |
593 |
$form->{fx}{$accno}{$transdate}, '$transdate', '0', '1')|; |
|
594 |
$dbh->do($query) || $form->dberror($query);
|
|
595 |
$form->{fx}{$accno}{$transdate}, '$transdate', '0', '1', ?)|;
|
|
596 |
do_query($form, $dbh, $query, $project_id);
|
|
595 | 597 |
} |
596 | 598 |
} |
597 | 599 |
} |
... | ... | |
1302 | 1304 |
$form->get_exchangerate($dbh, $form->{currency}, $form->{invdate}, |
1303 | 1305 |
"buy"); |
1304 | 1306 |
|
1307 |
my $project_id = conv_i($form->{"globalproject_id"}); |
|
1308 |
|
|
1305 | 1309 |
# record payments and offsetting AP |
1306 | 1310 |
for my $i (1 .. $form->{paidaccounts}) { |
1307 | 1311 |
|
... | ... | |
1336 | 1340 |
$dbh->do($query) || $form->dberror($query); |
1337 | 1341 |
|
1338 | 1342 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, |
1339 |
transdate) |
|
1343 |
transdate, project_id)
|
|
1340 | 1344 |
VALUES ($form->{id}, (SELECT c.id FROM chart c |
1341 | 1345 |
WHERE c.accno = '$form->{AP}'), |
1342 |
$amount, '$form->{"datepaid_$i"}')|; |
|
1343 |
$dbh->do($query) || $form->dberror($query);
|
|
1346 |
$amount, '$form->{"datepaid_$i"}', ?)|;
|
|
1347 |
do_query($form, $dbh, $query, $project_id);
|
|
1344 | 1348 |
|
1345 | 1349 |
|
1346 | 1350 |
|
... | ... | |
1349 | 1353 |
$dbh->do($query) || $form->dberror($query); |
1350 | 1354 |
|
1351 | 1355 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, |
1352 |
source, memo) |
|
1356 |
source, memo, project_id)
|
|
1353 | 1357 |
VALUES ($form->{id}, (SELECT c.id FROM chart c |
1354 | 1358 |
WHERE c.accno = '$accno'), |
1355 | 1359 |
$form->{"paid_$i"}, '$form->{"datepaid_$i"}', |
1356 |
'$form->{"source_$i"}', '$form->{"memo_$i"}')|; |
|
1357 |
$dbh->do($query) || $form->dberror($query);
|
|
1360 |
'$form->{"source_$i"}', '$form->{"memo_$i"}', ?)|;
|
|
1361 |
do_query($form, $dbh, $query, $project_id);
|
|
1358 | 1362 |
|
1359 | 1363 |
|
1360 | 1364 |
# gain/loss |
... | ... | |
1392 | 1396 |
WHERE c.accno = '$accno') AND amount=$form->{fx}{$accno}{$transdate} AND transdate='$transdate' AND cleared='0' AND fx_transaction='1'|; |
1393 | 1397 |
$dbh->do($query) || $form->dberror($query); |
1394 | 1398 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, |
1395 |
transdate, cleared, fx_transaction) |
|
1399 |
transdate, cleared, fx_transaction, project_id)
|
|
1396 | 1400 |
VALUES ($form->{id}, |
1397 | 1401 |
(SELECT c.id FROM chart c |
1398 | 1402 |
WHERE c.accno = '$accno'), |
1399 |
$form->{fx}{$accno}{$transdate}, '$transdate', '0', '1')|; |
|
1400 |
$dbh->do($query) || $form->dberror($query);
|
|
1403 |
$form->{fx}{$accno}{$transdate}, '$transdate', '0', '1', ?)|;
|
|
1404 |
do_query($form, $dbh, $query, $project_id);
|
|
1401 | 1405 |
} |
1402 | 1406 |
} |
1403 | 1407 |
} |
SL/IS.pm | ||
---|---|---|
797 | 797 |
$form->{exchangerate}, 0); |
798 | 798 |
} |
799 | 799 |
|
800 |
$project_id = conv_i($form->{"globalproject_id"}); |
|
801 |
|
|
800 | 802 |
foreach my $trans_id (keys %{ $form->{amount} }) { |
801 | 803 |
foreach my $accno (keys %{ $form->{amount}{$trans_id} }) { |
802 | 804 |
next unless ($form->{expense_inventory} =~ /$accno/); |
... | ... | |
806 | 808 |
) != 0 |
807 | 809 |
) { |
808 | 810 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, |
809 |
transdate, taxkey) |
|
811 |
transdate, taxkey, project_id)
|
|
810 | 812 |
VALUES ($trans_id, (SELECT c.id FROM chart c |
811 | 813 |
WHERE c.accno = '$accno'), |
812 | 814 |
$form->{amount}{$trans_id}{$accno}, '$form->{invdate}', |
813 |
(SELECT taxkey_id FROM chart WHERE accno = '$accno'))|; |
|
814 |
$dbh->do($query) || $form->dberror($query);
|
|
815 |
(SELECT taxkey_id FROM chart WHERE accno = '$accno'), ?)|;
|
|
816 |
do_query($form, $dbh, $query, $project_id);
|
|
815 | 817 |
$form->{amount}{$trans_id}{$accno} = 0; |
816 | 818 |
} |
817 | 819 |
} |
... | ... | |
823 | 825 |
) != 0 |
824 | 826 |
) { |
825 | 827 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, |
826 |
transdate, taxkey) |
|
828 |
transdate, taxkey, project_id)
|
|
827 | 829 |
VALUES ($trans_id, (SELECT id FROM chart |
828 | 830 |
WHERE accno = '$accno'), |
829 | 831 |
$form->{amount}{$trans_id}{$accno}, '$form->{invdate}', |
830 |
(SELECT taxkey_id FROM chart WHERE accno = '$accno'))|; |
|
831 |
$dbh->do($query) || $form->dberror($query);
|
|
832 |
(SELECT taxkey_id FROM chart WHERE accno = '$accno'), ?)|;
|
|
833 |
do_query($form, $dbh, $query, $project_id);
|
|
832 | 834 |
} |
833 | 835 |
} |
834 | 836 |
} |
... | ... | |
877 | 879 |
|
878 | 880 |
if ($form->{amount}{ $form->{id} }{ $form->{AR} } != 0) { |
879 | 881 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, |
880 |
transdate) |
|
882 |
transdate, project_id)
|
|
881 | 883 |
VALUES ($form->{id}, (SELECT c.id FROM chart c |
882 | 884 |
WHERE c.accno = '$form->{AR}'), |
883 |
$amount, '$form->{"datepaid_$i"}')|; |
|
884 |
$dbh->do($query) || $form->dberror($query);
|
|
885 |
$amount, '$form->{"datepaid_$i"}', ?)|;
|
|
886 |
do_query($form, $dbh, $query, $project_id);
|
|
885 | 887 |
} |
886 | 888 |
|
887 | 889 |
# record payment |
888 | 890 |
$form->{"paid_$i"} *= -1; |
889 | 891 |
|
890 | 892 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, |
891 |
source, memo) |
|
893 |
source, memo, ?)
|
|
892 | 894 |
VALUES ($form->{id}, (SELECT c.id FROM chart c |
893 |
WHERE c.accno = '$accno'), |
|
895 |
WHERE c.accno = '$accno', project_id),
|
|
894 | 896 |
$form->{"paid_$i"}, '$form->{"datepaid_$i"}', |
895 | 897 |
'$form->{"source_$i"}', '$form->{"memo_$i"}')|; |
896 |
$dbh->do($query) || $form->dberror($query);
|
|
898 |
do_query($form, $dbh, $query, $project_id);
|
|
897 | 899 |
|
898 | 900 |
# exchangerate difference |
899 | 901 |
$form->{fx}{$accno}{ $form->{"datepaid_$i"} } += |
... | ... | |
933 | 935 |
) { |
934 | 936 |
|
935 | 937 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, |
936 |
transdate, cleared, fx_transaction) |
|
938 |
transdate, cleared, fx_transaction, project_id)
|
|
937 | 939 |
VALUES ($form->{id}, |
938 | 940 |
(SELECT c.id FROM chart c |
939 | 941 |
WHERE c.accno = '$accno'), |
940 |
$form->{fx}{$accno}{$transdate}, '$transdate', '0', '1')|; |
|
941 |
$dbh->do($query) || $form->dberror($query);
|
|
942 |
$form->{fx}{$accno}{$transdate}, '$transdate', '0', '1', ?)|;
|
|
943 |
do_query($form, $dbh, $query, $project_id);
|
|
942 | 944 |
} |
943 | 945 |
} |
944 | 946 |
} |
... | ... | |
1071 | 1073 |
$form->get_exchangerate($dbh, $form->{currency}, $form->{invdate}, |
1072 | 1074 |
"buy"); |
1073 | 1075 |
|
1076 |
my $project_id = conv_i($form->{"globalproject_id"}); |
|
1077 |
|
|
1074 | 1078 |
# record payments and offsetting AR |
1075 | 1079 |
for my $i (1 .. $form->{paidaccounts}) { |
1076 | 1080 |
|
... | ... | |
1105 | 1109 |
$dbh->do($query) || $form->dberror($query); |
1106 | 1110 |
|
1107 | 1111 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, |
1108 |
transdate) |
|
1112 |
transdate, project_id)
|
|
1109 | 1113 |
VALUES ($form->{id}, (SELECT c.id FROM chart c |
1110 | 1114 |
WHERE c.accno = '$form->{AR}'), |
1111 |
$amount, '$form->{"datepaid_$i"}')|; |
|
1112 |
$dbh->do($query) || $form->dberror($query);
|
|
1115 |
$amount, '$form->{"datepaid_$i"}', ?)|;
|
|
1116 |
do_query($form, $dbh, $query, $project_id);
|
|
1113 | 1117 |
|
1114 | 1118 |
|
1115 | 1119 |
# record payment |
... | ... | |
1120 | 1124 |
$dbh->do($query) || $form->dberror($query); |
1121 | 1125 |
|
1122 | 1126 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, |
1123 |
source, memo) |
|
1127 |
source, memo, project_id)
|
|
1124 | 1128 |
VALUES ($form->{id}, (SELECT c.id FROM chart c |
1125 | 1129 |
WHERE c.accno = '$accno'), |
1126 | 1130 |
$form->{"paid_$i"}, '$form->{"datepaid_$i"}', |
1127 |
'$form->{"source_$i"}', '$form->{"memo_$i"}')|; |
|
1128 |
$dbh->do($query) || $form->dberror($query);
|
|
1131 |
'$form->{"source_$i"}', '$form->{"memo_$i"}', ?)|;
|
|
1132 |
do_query($form, $dbh, $query, $project_id);
|
|
1129 | 1133 |
|
1130 | 1134 |
|
1131 | 1135 |
# gain/loss |
... | ... | |
1163 | 1167 |
WHERE c.accno = '$accno') AND amount=$form->{fx}{$accno}{$transdate} AND transdate='$transdate' AND cleared='0' AND fx_transaction='1'|; |
1164 | 1168 |
$dbh->do($query) || $form->dberror($query); |
1165 | 1169 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, |
1166 |
transdate, cleared, fx_transaction) |
|
1170 |
transdate, cleared, fx_transaction, project_id)
|
|
1167 | 1171 |
VALUES ($form->{id}, |
1168 | 1172 |
(SELECT c.id FROM chart c |
1169 | 1173 |
WHERE c.accno = '$accno'), |
1170 |
$form->{fx}{$accno}{$transdate}, '$transdate', '0', '1')|; |
|
1171 |
$dbh->do($query) || $form->dberror($query);
|
|
1174 |
$form->{fx}{$accno}{$transdate}, '$transdate', '0', '1', ?)|;
|
|
1175 |
do_query($form, $dbh, $query, $project_id);
|
|
1172 | 1176 |
} |
1173 | 1177 |
} |
1174 | 1178 |
} |
Auch abrufbar als: Unified diff
Einkaufs- und Verkaufsrechnungen: Bei den Buchungen (sowohl für die Positionen als auch für die Zahlungsein- und ausgänge) die globale Projektnummer in acc_trans speichern.