Revision 361d8846
Von Sven Schöling vor fast 12 Jahren hinzugefügt
SL/AR.pm | ||
---|---|---|
173 | 173 |
my $project_id = conv_i($form->{"project_id_$i"}); |
174 | 174 |
|
175 | 175 |
# insert detail records in acc_trans |
176 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey, tax_id)
|
|
177 |
VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, ?, ?, ?)|;
|
|
176 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey) |
|
177 |
VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, ?, ?)|; |
|
178 | 178 |
@values = (conv_i($form->{id}), $form->{AR_amounts}{"amount_$i"}, conv_i($form->{"amount_$i"}), conv_date($form->{transdate}), $project_id, |
179 |
conv_i($form->{"taxkey_$i"}), conv_i($form->{"tax_id_$i"}));
|
|
179 |
conv_i($form->{"taxkey_$i"})); |
|
180 | 180 |
do_query($form, $dbh, $query, @values); |
181 | 181 |
|
182 | 182 |
if ($form->{"tax_$i"} != 0) { |
183 | 183 |
# insert detail records in acc_trans |
184 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey, tax_id)
|
|
185 |
VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, ?, ?, ?)|;
|
|
184 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey) |
|
185 |
VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, ?, ?)|; |
|
186 | 186 |
@values = (conv_i($form->{id}), $form->{AR_amounts}{"tax_$i"}, conv_i($form->{"tax_$i"}), conv_date($form->{transdate}), $project_id, |
187 |
conv_i($form->{"taxkey_$i"}), conv_i($form->{"tax_id_$i"}));
|
|
187 |
conv_i($form->{"taxkey_$i"})); |
|
188 | 188 |
do_query($form, $dbh, $query, @values); |
189 | 189 |
} |
190 | 190 |
} |
191 | 191 |
} |
192 | 192 |
|
193 | 193 |
# add recievables |
194 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, tax_id) |
|
195 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, (SELECT taxkey_id FROM chart WHERE accno = ?), |
|
196 |
(SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1))|; |
|
197 |
@values = (conv_i($form->{id}), $form->{AR_amounts}{receivables}, conv_i($form->{receivables}), conv_date($form->{transdate}), |
|
198 |
$form->{AR_amounts}{receivables}, $form->{AR_amounts}{receivables}, conv_date($form->{transdate})); |
|
194 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey) |
|
195 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, (SELECT taxkey_id FROM chart WHERE accno = ?))|; |
|
196 |
@values = (conv_i($form->{id}), $form->{AR_amounts}{receivables}, conv_i($form->{receivables}), conv_date($form->{transdate}), $form->{AR_amounts}{receivables}); |
|
199 | 197 |
do_query($form, $dbh, $query, @values); |
200 | 198 |
|
201 | 199 |
} else { |
... | ... | |
232 | 230 |
|
233 | 231 |
if ($amount != 0) { |
234 | 232 |
# add receivable |
235 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey, tax_id) |
|
236 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, (SELECT taxkey_id FROM chart WHERE accno = ?), |
|
237 |
(SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1))|; |
|
238 |
@values = (conv_i($form->{id}), $form->{AR}{receivables}, $amount, conv_date($form->{"datepaid_$i"}), $project_id, $form->{AR}{receivables}, $form->{AR}{receivables}, conv_date($form->{"datepaid_$i"})); |
|
233 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey) |
|
234 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, (SELECT taxkey_id FROM chart WHERE accno = ?))|; |
|
235 |
@values = (conv_i($form->{id}), $form->{AR}{receivables}, $amount, conv_date($form->{"datepaid_$i"}), $project_id, $form->{AR}{receivables}); |
|
239 | 236 |
do_query($form, $dbh, $query, @values); |
240 | 237 |
} |
241 | 238 |
|
... | ... | |
244 | 241 |
my $project_id = conv_i($form->{"paid_project_id_$i"}); |
245 | 242 |
my $gldate = (conv_date($form->{"gldate_$i"}))? conv_date($form->{"gldate_$i"}) : conv_date($form->current_date($myconfig)); |
246 | 243 |
$amount = $form->{"paid_$i"} * -1; |
247 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, project_id, taxkey, tax_id) |
|
248 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?, ?, ?, (SELECT taxkey_id FROM chart WHERE accno = ?), |
|
249 |
(SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1))|; |
|
250 |
@values = (conv_i($form->{id}), $form->{AR}{"paid_$i"}, $amount, conv_date($form->{"datepaid_$i"}), $gldate, $form->{"source_$i"}, $form->{"memo_$i"}, $project_id, $form->{AR}{"paid_$i"}, |
|
251 |
$form->{AR}{"paid_$i"}, conv_date($form->{"datepaid_$i"})); |
|
244 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, project_id, taxkey) |
|
245 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?, ?, ?, (SELECT taxkey_id FROM chart WHERE accno = ?))|; |
|
246 |
@values = (conv_i($form->{id}), $form->{AR}{"paid_$i"}, $amount, conv_date($form->{"datepaid_$i"}), $gldate, $form->{"source_$i"}, $form->{"memo_$i"}, $project_id, $form->{AR}{"paid_$i"}); |
|
252 | 247 |
do_query($form, $dbh, $query, @values); |
253 | 248 |
|
254 | 249 |
# exchangerate difference for payment |
255 | 250 |
$amount = $form->round_amount( $form->{"paid_$i"} * ($form->{"exchangerate_$i"} - 1) * -1, 2); |
256 | 251 |
|
257 | 252 |
if ($amount != 0) { |
258 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey, tax_id) |
|
259 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 't', 'f', ?, (SELECT taxkey_id FROM chart WHERE accno = ?), |
|
260 |
(SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1))|; |
|
261 |
@values = (conv_i($form->{id}), $form->{AR}{"paid_$i"}, $amount, conv_date($form->{"datepaid_$i"}), $project_id, $form->{AR}{"paid_$i"}, |
|
262 |
$form->{AR}{"paid_$i"}, conv_date($form->{"datepaid_$i"})); |
|
253 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey) |
|
254 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 't', 'f', ?, (SELECT taxkey_id FROM chart WHERE accno = ?))|; |
|
255 |
@values = (conv_i($form->{id}), $form->{AR}{"paid_$i"}, $amount, conv_date($form->{"datepaid_$i"}), $project_id, $form->{AR}{"paid_$i"}); |
|
263 | 256 |
do_query($form, $dbh, $query, @values); |
264 | 257 |
} |
265 | 258 |
|
... | ... | |
268 | 261 |
|
269 | 262 |
if ($amount != 0) { |
270 | 263 |
my $accno = ($amount > 0) ? $form->{fxgain_accno} : $form->{fxloss_accno}; |
271 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey, tax_id) |
|
272 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 't', 'f', ?, (SELECT taxkey_id FROM chart WHERE accno = ?), |
|
273 |
(SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1))|; |
|
274 |
@values = (conv_i($form->{id}), $accno, $amount, conv_date($form->{"datepaid_$i"}), $project_id, $accno, $accno, conv_date($form->{"datepaid_$i"})); |
|
264 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey) |
|
265 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 't', 'f', ?, (SELECT taxkey_id FROM chart WHERE accno = ?))|; |
|
266 |
@values = (conv_i($form->{id}), $accno, $amount, conv_date($form->{"datepaid_$i"}), $project_id, $accno); |
|
275 | 267 |
do_query($form, $dbh, $query, @values); |
276 | 268 |
} |
277 | 269 |
} |
Auch abrufbar als: Unified diff
Revert "tax_id in acc_trans"
This reverts commit 357d134d265637fb37ed2cd47da2ce3ef44d015a.