Revision 41cceb1e
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
SL/AR.pm | ||
---|---|---|
75 | 75 |
$form->parse_amount($myconfig, $form->{exchangerate}) ); |
76 | 76 |
|
77 | 77 |
# get the charts selected |
78 |
map { ($form->{AR_amounts}{"amount_$_"}) = split /--/, $form->{"AR_amount_$_"} } 1 .. $form->{rowcount}; |
|
79 |
|
|
80 |
$form->{AR_amounts}{receivables} = $form->{ARselected}; |
|
81 |
$form->{AR}{receivables} = $form->{ARselected}; |
|
78 |
$form->{AR_amounts}{"amount_$_"} = $form->{"AR_amount_chart_id_$_"} for (1 .. $form->{rowcount}); |
|
82 | 79 |
|
83 | 80 |
$form->{tax} = 0; # is this still needed? |
84 | 81 |
|
... | ... | |
157 | 154 |
|
158 | 155 |
# insert detail records in acc_trans |
159 | 156 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey, tax_id, chart_link) |
160 |
VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, ?, ?, ?, (SELECT c.link FROM chart c WHERE c.accno = ?))|;
|
|
157 |
VALUES (?, ?, ?, ?, ?, ?, ?, (SELECT c.link FROM chart c WHERE c.id = ?))|;
|
|
161 | 158 |
@values = (conv_i($form->{id}), $form->{AR_amounts}{"amount_$i"}, conv_i($form->{"amount_$i"}), conv_date($form->{transdate}), $project_id, |
162 | 159 |
conv_i($form->{"taxkey_$i"}), conv_i($form->{"tax_id_$i"}), $form->{AR_amounts}{"amount_$i"}); |
163 | 160 |
do_query($form, $dbh, $query, @values); |
... | ... | |
175 | 172 |
|
176 | 173 |
# add recievables |
177 | 174 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, tax_id, chart_link) |
178 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, (SELECT taxkey_id FROM chart WHERE accno = ?),
|
|
175 |
VALUES (?, ?, ?, ?, (SELECT taxkey_id FROM chart WHERE id = ?),
|
|
179 | 176 |
(SELECT tax_id |
180 | 177 |
FROM taxkeys |
181 |
WHERE chart_id= (SELECT id |
|
182 |
FROM chart |
|
183 |
WHERE accno = ?) |
|
178 |
WHERE chart_id = ? |
|
184 | 179 |
AND startdate <= ? |
185 | 180 |
ORDER BY startdate DESC LIMIT 1), |
186 |
(SELECT c.link FROM chart c WHERE c.accno = ?))|;
|
|
187 |
@values = (conv_i($form->{id}), $form->{AR_amounts}{receivables}, conv_i($form->{receivables}), conv_date($form->{transdate}),
|
|
188 |
$form->{AR_amounts}{receivables}, $form->{AR_amounts}{receivables}, conv_date($form->{transdate}), $form->{AR_amounts}{receivables});
|
|
181 |
(SELECT c.link FROM chart c WHERE c.id = ?))|;
|
|
182 |
@values = (conv_i($form->{id}), $form->{AR_chart_id}, conv_i($form->{receivables}), conv_date($form->{transdate}),
|
|
183 |
$form->{AR_chart_id}, $form->{AR_chart_id}, conv_date($form->{transdate}), $form->{AR_chart_id});
|
|
189 | 184 |
do_query($form, $dbh, $query, @values); |
190 | 185 |
|
191 | 186 |
} else { |
... | ... | |
225 | 220 |
if ($amount != 0) { |
226 | 221 |
# add receivable |
227 | 222 |
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey, tax_id, chart_link) |
228 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, (SELECT taxkey_id FROM chart WHERE accno = ?),
|
|
223 |
VALUES (?, ?, ?, ?, ?, (SELECT taxkey_id FROM chart WHERE id = ?),
|
|
229 | 224 |
(SELECT tax_id |
230 | 225 |
FROM taxkeys |
231 |
WHERE chart_id= (SELECT id |
|
232 |
FROM chart |
|
233 |
WHERE accno = ?) |
|
226 |
WHERE chart_id = ? |
|
234 | 227 |
AND startdate <= ? |
235 | 228 |
ORDER BY startdate DESC LIMIT 1), |
236 |
(SELECT c.link FROM chart c WHERE c.accno = ?))|; |
|
237 |
@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"}), |
|
238 |
$form->{AR}{receivables}); |
|
229 |
(SELECT c.link FROM chart c WHERE c.id = ?))|; |
|
230 |
@values = (conv_i($form->{id}), $form->{AR_chart_id}, $amount, conv_date($form->{"datepaid_$i"}), $project_id, $form->{AR_chart_id}, $form->{AR_chart_id}, conv_date($form->{"datepaid_$i"}), $form->{AR_chart_id}); |
|
239 | 231 |
|
240 | 232 |
do_query($form, $dbh, $query, @values); |
241 | 233 |
} |
... | ... | |
421 | 413 |
$form->{exchangerate} = $form->format_amount($myconfig, $form->{exchangerate}); |
422 | 414 |
$form->{defaultcurrency} = $form->get_default_currency($myconfig); |
423 | 415 |
|
424 |
# Get the AR accno (which is normally done by Form::create_links()).
|
|
416 |
# Get the AR chart ID (which is normally done by Form::create_links()).
|
|
425 | 417 |
$query = |
426 |
qq|SELECT c.accno
|
|
418 |
qq|SELECT c.id
|
|
427 | 419 |
FROM acc_trans at |
428 | 420 |
LEFT JOIN chart c ON (at.chart_id = c.id) |
429 | 421 |
WHERE (trans_id = ?) |
... | ... | |
431 | 423 |
ORDER BY at.acc_trans_id |
432 | 424 |
LIMIT 1|; |
433 | 425 |
|
434 |
($form->{ARselected}) = selectfirst_array_query($form, $dbh, $query, conv_i($form->{id}));
|
|
426 |
($form->{AR_chart_id}) = selectfirst_array_query($form, $dbh, $query, conv_i($form->{id}));
|
|
435 | 427 |
|
436 | 428 |
# Post the new payments. |
437 | 429 |
$self->post_transaction($myconfig, $form, $dbh, 1); |
... | ... | |
739 | 731 |
$form->{"projectnumber_$k"} = $form->{acc_trans}{$key}->[$i-1]->{projectnumber}; |
740 | 732 |
$form->{taxrate} = $form->{acc_trans}{$key}->[$i - 1]->{rate}; |
741 | 733 |
$form->{"project_id_$k"} = $form->{acc_trans}{$key}->[$i-1]->{project_id}; |
742 |
} |
|
743 |
|
|
744 |
$form->{"${key}_$i"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}"; |
|
745 |
|
|
746 |
if ($akey eq "AR") { |
|
747 |
$form->{ARselected} = $form->{acc_trans}{$key}->[$i-1]->{accno}; |
|
748 | 734 |
|
749 |
} elsif ($akey eq "amount") { |
|
750 |
$form->{"${key}_$k"} = $form->{acc_trans}{$key}->[$i-1]->{accno} . "--" . $form->{acc_trans}{$key}->[$i-1]->{id}; |
|
735 |
$form->{"${key}_chart_id_$k"} = $form->{acc_trans}{$key}->[$i-1]->{chart_id}; |
|
751 | 736 |
$form->{"taxchart_$k"} = $form->{acc_trans}{$key}->[$i-1]->{id} . "--" . $form->{acc_trans}{$key}->[$i-1]->{rate}; |
752 | 737 |
} |
753 | 738 |
} |
Auch abrufbar als: Unified diff
Debitorenbuchungen auf Verwendung des Chart-Pickers umgestellt