Revision 3dd73b25
Von Moritz Bunkus vor fast 18 Jahren hinzugefügt
SL/AP.pm | ||
---|---|---|
268 | 268 |
# add paid transactions |
269 | 269 |
for my $i (1 .. $form->{paidaccounts}) { |
270 | 270 |
if ($form->{"paid_$i"} != 0) { |
271 |
my $project_id = conv_i($form->{"paid_project_id_$i"}); |
|
271 | 272 |
|
272 | 273 |
$exchangerate = 0; |
273 | 274 |
if ($form->{currency} eq $form->{defaultcurrency}) { |
... | ... | |
300 | 301 |
2); |
301 | 302 |
if ($form->{payables}) { |
302 | 303 |
$query = |
303 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate) | . |
|
304 |
qq|VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?)|; |
|
304 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id) | .
|
|
305 |
qq|VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, ?)|;
|
|
305 | 306 |
@values = ($form->{id}, $form->{AP}{payables}, $amount, |
306 |
conv_date($form->{"datepaid_$i"})); |
|
307 |
conv_date($form->{"datepaid_$i"}), $project_id);
|
|
307 | 308 |
do_query($form, $dbh, $query, @values); |
308 | 309 |
} |
309 | 310 |
$form->{payables} = $amount; |
310 | 311 |
|
311 | 312 |
# add payment |
312 | 313 |
$query = |
313 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, source, memo) | . |
|
314 |
qq|VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, ?, ?)|; |
|
314 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, source, memo, project_id) | .
|
|
315 |
qq|VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, ?, ?, ?)|;
|
|
315 | 316 |
@values = ($form->{id}, $form->{AP}{"paid_$i"}, $form->{"paid_$i"}, |
316 | 317 |
conv_date($form->{"datepaid_$i"}), $form->{"source_$i"}, |
317 |
$form->{"memo_$i"}); |
|
318 |
$form->{"memo_$i"}, $project_id);
|
|
318 | 319 |
do_query($form, $dbh, $query, @values); |
319 | 320 |
|
320 | 321 |
# add exchange rate difference |
... | ... | |
323 | 324 |
($form->{"exchangerate_$i"} - 1), 2); |
324 | 325 |
if ($amount != 0) { |
325 | 326 |
$query = |
326 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared) | . |
|
327 |
qq|VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, 't', 'f')|; |
|
327 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id) | .
|
|
328 |
qq|VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, 't', 'f', ?)|;
|
|
328 | 329 |
@values = ($form->{id}, $form->{AP}{"paid_$i"}, $amount, |
329 |
conv_date($form->{"datepaid_$i"})); |
|
330 |
conv_date($form->{"datepaid_$i"}), $project_id);
|
|
330 | 331 |
do_query($form, $dbh, $query, @values); |
331 | 332 |
} |
332 | 333 |
|
... | ... | |
338 | 339 |
|
339 | 340 |
if ($amount != 0) { |
340 | 341 |
$query = |
341 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared) | . |
|
342 |
qq|VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, 't', 'f')|; |
|
342 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id) | .
|
|
343 |
qq|VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, 't', 'f', ?)|;
|
|
343 | 344 |
@values = ($form->{id}, ($amount > 0) ? |
344 | 345 |
$form->{fxgain_accno} : $form->{fxloss_accno}, |
345 |
$amount, conv_date($form->{"datepaid_$i"})); |
|
346 |
$amount, conv_date($form->{"datepaid_$i"}), $project_id);
|
|
346 | 347 |
do_query($form, $dbh, $query, @values); |
347 | 348 |
} |
348 | 349 |
|
Auch abrufbar als: Unified diff
Kreditorenbuchung: Beim initialen Buchen müssen die Projektnummern für die Zahlungsausgänge in acc_trans gespeichert werden.