Revision 361d8846
Von Sven Schöling vor fast 12 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)| . |
|
213 | 213 |
qq|VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), | . |
214 |
qq| ?, ?, ?, ?, (SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1))|;
|
|
214 |
qq| ?, ?, ?, ?)|; |
|
215 | 215 |
@values = ($form->{id}, $form->{AP_amounts}{"amount_$i"}, |
216 | 216 |
$form->{"amount_$i"}, conv_date($form->{transdate}), |
217 |
$project_id, $form->{"taxkey_$i"}, $form->{AP_amounts}{"amount_$i"}, conv_date($form->{transdate}));
|
|
217 |
$project_id, $form->{"taxkey_$i"}); |
|
218 | 218 |
do_query($form, $dbh, $query, @values); |
219 | 219 |
|
220 | 220 |
if ($form->{"tax_$i"} != 0) { |
221 | 221 |
# insert detail records in acc_trans |
222 | 222 |
$query = |
223 | 223 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, | . |
224 |
qq| project_id, taxkey, tax_id) | .
|
|
224 |
qq| project_id, taxkey) | . |
|
225 | 225 |
qq|VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), | . |
226 |
qq| ?, ?, ?, ?, (SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1))|;
|
|
226 |
qq| ?, ?, ?, ?)|; |
|
227 | 227 |
@values = ($form->{id}, $form->{AP_amounts}{"tax_$i"}, |
228 | 228 |
$form->{"tax_$i"}, conv_date($form->{transdate}), |
229 |
$project_id, $form->{"taxkey_$i"}, $form->{AP_amounts}{"tax_$i"}, conv_date($form->{transdate}));
|
|
229 |
$project_id, $form->{"taxkey_$i"}); |
|
230 | 230 |
do_query($form, $dbh, $query, @values); |
231 | 231 |
} |
232 | 232 |
|
... | ... | |
235 | 235 |
|
236 | 236 |
# add payables |
237 | 237 |
$query = |
238 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, tax_id) | .
|
|
238 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey) | . |
|
239 | 239 |
qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, | . |
240 |
qq| (SELECT taxkey_id FROM chart WHERE accno = ?),| . |
|
241 |
qq| (SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1))|; |
|
240 |
qq| (SELECT taxkey_id FROM chart WHERE accno = ?))|; |
|
242 | 241 |
@values = ($form->{id}, $form->{AP_amounts}{payables}, $form->{payables}, |
243 |
conv_date($form->{transdate}), $form->{AP_amounts}{payables}, $form->{AP_amounts}{payables}, conv_date($form->{transdate}));
|
|
242 |
conv_date($form->{transdate}), $form->{AP_amounts}{payables}); |
|
244 | 243 |
do_query($form, $dbh, $query, @values); |
245 | 244 |
} |
246 | 245 |
|
... | ... | |
284 | 283 |
2); |
285 | 284 |
if ($form->{payables}) { |
286 | 285 |
$query = |
287 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey, tax_id) | .
|
|
286 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey) | . |
|
288 | 287 |
qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, | . |
289 |
qq| (SELECT taxkey_id FROM chart WHERE accno = ?),| . |
|
290 |
qq| (SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1))|; |
|
288 |
qq| (SELECT taxkey_id FROM chart WHERE accno = ?))|; |
|
291 | 289 |
@values = ($form->{id}, $form->{AP_payables}, $amount, |
292 | 290 |
conv_date($form->{"datepaid_$i"}), $project_id, |
293 |
$form->{AP_payables}, $form->{AP_payables}, conv_date($form->{"datepaid_$i"}));
|
|
291 |
$form->{AP_payables}); |
|
294 | 292 |
do_query($form, $dbh, $query, @values); |
295 | 293 |
} |
296 | 294 |
$form->{payables} = $amount; |
... | ... | |
298 | 296 |
# add payment |
299 | 297 |
my $gldate = (conv_date($form->{"gldate_$i"}))? conv_date($form->{"gldate_$i"}) : conv_date($form->current_date($myconfig)); |
300 | 298 |
$query = |
301 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, project_id, taxkey, tax_id) | .
|
|
299 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, project_id, taxkey) | . |
|
302 | 300 |
qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?, ?, ?, | . |
303 |
qq| (SELECT taxkey_id FROM chart WHERE accno = ?), | . |
|
304 |
qq| (SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1))|; |
|
301 |
qq| (SELECT taxkey_id FROM chart WHERE accno = ?))|; |
|
305 | 302 |
@values = ($form->{id}, $form->{"AP_paid_account_$i"}, $form->{"paid_$i"}, |
306 | 303 |
conv_date($form->{"datepaid_$i"}), $gldate, $form->{"source_$i"}, |
307 |
$form->{"memo_$i"}, $project_id, $form->{"AP_paid_account_$i"}, |
|
308 |
$form->{"AP_paid_account_$i"}, conv_date($form->{"datepaid_$i"})); |
|
304 |
$form->{"memo_$i"}, $project_id, $form->{"AP_paid_account_$i"}); |
|
309 | 305 |
do_query($form, $dbh, $query, @values); |
310 | 306 |
|
311 | 307 |
# add exchange rate difference |
... | ... | |
314 | 310 |
($form->{"exchangerate_$i"} - 1), 2); |
315 | 311 |
if ($amount != 0) { |
316 | 312 |
$query = |
317 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey, tax_id) | .
|
|
313 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey) | . |
|
318 | 314 |
qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 't', 'f', ?, | . |
319 |
qq| (SELECT taxkey_id FROM chart WHERE accno = ?), | . |
|
320 |
qq| (SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1))|; |
|
315 |
qq| (SELECT taxkey_id FROM chart WHERE accno = ?))|; |
|
321 | 316 |
@values = ($form->{id}, $form->{"AP_paid_account_$i"}, $amount, |
322 | 317 |
conv_date($form->{"datepaid_$i"}), $project_id, |
323 |
$form->{"AP_paid_account_$i"}, |
|
324 |
$form->{"AP_paid_account_$i"}, conv_date($form->{"datepaid_$i"})); |
|
318 |
$form->{"AP_paid_account_$i"}); |
|
325 | 319 |
do_query($form, $dbh, $query, @values); |
326 | 320 |
} |
327 | 321 |
|
... | ... | |
333 | 327 |
|
334 | 328 |
if ($amount != 0) { |
335 | 329 |
$query = |
336 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey, tax_id) | .
|
|
330 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey) | . |
|
337 | 331 |
qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 't', 'f', ?, | . |
338 |
qq| (SELECT taxkey_id FROM chart WHERE accno = ?)| . |
|
339 |
qq| (SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1))|; |
|
332 |
qq| (SELECT taxkey_id FROM chart WHERE accno = ?))|; |
|
340 | 333 |
@values = ($form->{id}, ($amount > 0) ? |
341 | 334 |
$form->{fxgain_accno} : $form->{fxloss_accno}, |
342 | 335 |
$amount, conv_date($form->{"datepaid_$i"}), $project_id, |
343 | 336 |
($amount > 0) ? |
344 |
$form->{fxgain_accno} : $form->{fxloss_accno}, |
|
345 |
($amount > 0) ? $form->{fxgain_accno} : $form->{fxloss_accno}, conv_date($form->{"datepaid_$i"})); |
|
337 |
$form->{fxgain_accno} : $form->{fxloss_accno}); |
|
346 | 338 |
do_query($form, $dbh, $query, @values); |
347 | 339 |
} |
348 | 340 |
|
Auch abrufbar als: Unified diff
Revert "tax_id in acc_trans"
This reverts commit 357d134d265637fb37ed2cd47da2ce3ef44d015a.