Revision d1408ca1
Von Niclas Zimmermann vor mehr als 11 Jahren hinzugefügt
SL/AP.pm | ||
---|---|---|
209 | 209 |
# insert detail records in acc_trans |
210 | 210 |
$query = |
211 | 211 |
qq|INSERT INTO acc_trans | . |
212 |
qq| (trans_id, chart_id, amount, transdate, project_id, taxkey, tax_id)| . |
|
212 |
qq| (trans_id, chart_id, amount, transdate, project_id, taxkey, tax_id, chart_link)| .
|
|
213 | 213 |
qq|VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), | . |
214 |
qq| ?, ?, ?, ?, ?)|; |
|
214 |
qq| ?, ?, ?, ?, ?| . |
|
215 |
qq| (SELECT c.link FROM chart c WHERE c.accno = ?))|; |
|
215 | 216 |
@values = ($form->{id}, $form->{AP_amounts}{"amount_$i"}, |
216 | 217 |
$form->{"amount_$i"}, conv_date($form->{transdate}), |
217 |
$project_id, $form->{"taxkey_$i"}, conv_i($form->{"tax_id_$i"})); |
|
218 |
$project_id, $form->{"taxkey_$i"}, conv_i($form->{"tax_id_$i"}), |
|
219 |
$form->{AP_amounts}{"amount_$i"}); |
|
218 | 220 |
do_query($form, $dbh, $query, @values); |
219 | 221 |
|
220 | 222 |
if ($form->{"tax_$i"} != 0) { |
221 | 223 |
# insert detail records in acc_trans |
222 | 224 |
$query = |
223 | 225 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, | . |
224 |
qq| project_id, taxkey, tax_id) | . |
|
226 |
qq| project_id, taxkey, tax_id, chart_link) | .
|
|
225 | 227 |
qq|VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), | . |
226 |
qq| ?, ?, ?, ?, ?)|; |
|
228 |
qq| ?, ?, ?, ?, ?)| . |
|
229 |
qq| (SELECT c.link FROM chart c WHERE c.accno = ?))|; |
|
227 | 230 |
@values = ($form->{id}, $form->{AP_amounts}{"tax_$i"}, |
228 | 231 |
$form->{"tax_$i"}, conv_date($form->{transdate}), |
229 |
$project_id, $form->{"taxkey_$i"}, conv_i($form->{"tax_id_$i"})); |
|
232 |
$project_id, $form->{"taxkey_$i"}, conv_i($form->{"tax_id_$i"}), |
|
233 |
$form->{AP_amounts}{"tax_$i"}); |
|
230 | 234 |
do_query($form, $dbh, $query, @values); |
231 | 235 |
} |
232 | 236 |
|
... | ... | |
235 | 239 |
|
236 | 240 |
# add payables |
237 | 241 |
$query = |
238 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, tax_id) | . |
|
242 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, tax_id, chart_link) | .
|
|
239 | 243 |
qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, | . |
240 | 244 |
qq| (SELECT taxkey_id FROM chart WHERE accno = ?),| . |
241 | 245 |
qq| (SELECT tax_id| . |
... | ... | |
244 | 248 |
qq| FROM chart| . |
245 | 249 |
qq| WHERE accno = ?)| . |
246 | 250 |
qq| AND startdate <= ?| . |
247 |
qq| ORDER BY startdate DESC LIMIT 1))|; |
|
251 |
qq| ORDER BY startdate DESC LIMIT 1),| . |
|
252 |
qq| (SELECT c.link FROM chart c WHERE c.accno = ?))|; |
|
248 | 253 |
@values = ($form->{id}, $form->{AP_amounts}{payables}, $form->{payables}, |
249 |
conv_date($form->{transdate}), $form->{AP_amounts}{payables}, $form->{AP_amounts}{payables}, conv_date($form->{transdate})); |
|
254 |
conv_date($form->{transdate}), $form->{AP_amounts}{payables}, $form->{AP_amounts}{payables}, conv_date($form->{transdate}), |
|
255 |
$form->{AP_amounts}{payables}); |
|
250 | 256 |
do_query($form, $dbh, $query, @values); |
251 | 257 |
} |
252 | 258 |
|
... | ... | |
290 | 296 |
2); |
291 | 297 |
if ($form->{payables}) { |
292 | 298 |
$query = |
293 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey, tax_id) | . |
|
299 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey, tax_id, chart_link) | .
|
|
294 | 300 |
qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, | . |
295 | 301 |
qq| (SELECT taxkey_id FROM chart WHERE accno = ?),| . |
296 | 302 |
qq| (SELECT tax_id| . |
... | ... | |
299 | 305 |
qq| FROM chart| . |
300 | 306 |
qq| WHERE accno = ?)| . |
301 | 307 |
qq| AND startdate <= ?| . |
302 |
qq| ORDER BY startdate DESC LIMIT 1))|; |
|
308 |
qq| ORDER BY startdate DESC LIMIT 1),| . |
|
309 |
qq| (SELECT c.link FROM chart c WHERE c.accno = ?))|; |
|
303 | 310 |
@values = ($form->{id}, $form->{AP_payables}, $amount, |
304 | 311 |
conv_date($form->{"datepaid_$i"}), $project_id, |
305 |
$form->{AP_payables}, $form->{AP_payables}, conv_date($form->{"datepaid_$i"})); |
|
312 |
$form->{AP_payables}, $form->{AP_payables}, conv_date($form->{"datepaid_$i"}), |
|
313 |
$form->{AP_payables}); |
|
306 | 314 |
do_query($form, $dbh, $query, @values); |
307 | 315 |
} |
308 | 316 |
$form->{payables} = $amount; |
... | ... | |
310 | 318 |
# add payment |
311 | 319 |
my $gldate = (conv_date($form->{"gldate_$i"}))? conv_date($form->{"gldate_$i"}) : conv_date($form->current_date($myconfig)); |
312 | 320 |
$query = |
313 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, project_id, taxkey, tax_id) | . |
|
321 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, project_id, taxkey, tax_id, chart_link) | .
|
|
314 | 322 |
qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?, ?, ?, | . |
315 | 323 |
qq| (SELECT taxkey_id FROM chart WHERE accno = ?), | . |
316 | 324 |
qq| (SELECT tax_id| . |
... | ... | |
319 | 327 |
qq| FROM chart| . |
320 | 328 |
qq| WHERE accno = ?)| . |
321 | 329 |
qq| AND startdate <= ?| . |
322 |
qq| ORDER BY startdate DESC LIMIT 1))|; |
|
330 |
qq| ORDER BY startdate DESC LIMIT 1),| . |
|
331 |
qq| (SELECT c.link FROM chart c WHERE c.accno = ?))|; |
|
323 | 332 |
@values = ($form->{id}, $form->{"AP_paid_account_$i"}, $form->{"paid_$i"}, |
324 | 333 |
conv_date($form->{"datepaid_$i"}), $gldate, $form->{"source_$i"}, |
325 | 334 |
$form->{"memo_$i"}, $project_id, $form->{"AP_paid_account_$i"}, |
326 |
$form->{"AP_paid_account_$i"}, conv_date($form->{"datepaid_$i"})); |
|
335 |
$form->{"AP_paid_account_$i"}, conv_date($form->{"datepaid_$i"}), |
|
336 |
$form->{"AP_paid_account_$i"}); |
|
327 | 337 |
do_query($form, $dbh, $query, @values); |
328 | 338 |
|
329 | 339 |
# add exchange rate difference |
... | ... | |
332 | 342 |
($form->{"exchangerate_$i"} - 1), 2); |
333 | 343 |
if ($amount != 0) { |
334 | 344 |
$query = |
335 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey, tax_id) | . |
|
345 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey, tax_id, chart_link) | .
|
|
336 | 346 |
qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 't', 'f', ?, | . |
337 | 347 |
qq| (SELECT taxkey_id FROM chart WHERE accno = ?), | . |
338 | 348 |
qq| (SELECT tax_id| . |
... | ... | |
341 | 351 |
qq| FROM chart| . |
342 | 352 |
qq| WHERE accno = ?)| . |
343 | 353 |
qq| AND startdate <= ?| . |
344 |
qq| ORDER BY startdate DESC LIMIT 1))|; |
|
354 |
qq| ORDER BY startdate DESC LIMIT 1),| . |
|
355 |
qq| (SELECT c.link FROM chart c WHERE c.accno = ?))|; |
|
345 | 356 |
@values = ($form->{id}, $form->{"AP_paid_account_$i"}, $amount, |
346 | 357 |
conv_date($form->{"datepaid_$i"}), $project_id, |
347 | 358 |
$form->{"AP_paid_account_$i"}, |
348 |
$form->{"AP_paid_account_$i"}, conv_date($form->{"datepaid_$i"})); |
|
359 |
$form->{"AP_paid_account_$i"}, conv_date($form->{"datepaid_$i"}), |
|
360 |
$form->{"AP_paid_account_$i"}); |
|
349 | 361 |
do_query($form, $dbh, $query, @values); |
350 | 362 |
} |
351 | 363 |
|
... | ... | |
357 | 369 |
|
358 | 370 |
if ($amount != 0) { |
359 | 371 |
$query = |
360 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey, tax_id) | . |
|
372 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey, tax_id, chart_link) | .
|
|
361 | 373 |
qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 't', 'f', ?, | . |
362 | 374 |
qq| (SELECT taxkey_id FROM chart WHERE accno = ?)| . |
363 | 375 |
qq| (SELECT tax_id| . |
... | ... | |
366 | 378 |
qq| FROM chart| . |
367 | 379 |
qq| WHERE accno = ?)| . |
368 | 380 |
qq| AND startdate <= ?| . |
369 |
qq| ORDER BY startdate DESC LIMIT 1))|; |
|
370 |
@values = ($form->{id}, ($amount > 0) ? |
|
371 |
$form->{fxgain_accno} : $form->{fxloss_accno}, |
|
381 |
qq| ORDER BY startdate DESC LIMIT 1),| . |
|
382 |
qq| (SELECT c.link FROM chart c WHERE c.accno = ?))|; |
|
383 |
@values = ($form->{id}, |
|
384 |
($amount > 0) ? $form->{fxgain_accno} : $form->{fxloss_accno}, |
|
372 | 385 |
$amount, conv_date($form->{"datepaid_$i"}), $project_id, |
373 |
($amount > 0) ? |
|
374 |
$form->{fxgain_accno} : $form->{fxloss_accno},
|
|
375 |
($amount > 0) ? $form->{fxgain_accno} : $form->{fxloss_accno}, conv_date($form->{"datepaid_$i"}));
|
|
386 |
($amount > 0) ? $form->{fxgain_accno} : $form->{fxloss_accno},
|
|
387 |
($amount > 0) ? $form->{fxgain_accno} : $form->{fxloss_accno}, conv_date($form->{"datepaid_$i"}),
|
|
388 |
($amount > 0) ? $form->{fxgain_accno} : $form->{fxloss_accno}); |
|
376 | 389 |
do_query($form, $dbh, $query, @values); |
377 | 390 |
} |
378 | 391 |
|
Auch abrufbar als: Unified diff
chart_link in acc_trans
Erstellt ein neues Pflichtfeld chart_link in der Tabelle acc_trans.
Wird bisher nur beschrieben und noch an keiner Stelle ausgelesen.
Conflicts: