Revision 744cfc20
Von Philip Reetz vor etwa 18 Jahren hinzugefügt
SL/GL.pm | ||
---|---|---|
145 | 145 |
|
146 | 146 |
# insert acc_trans transactions |
147 | 147 |
for $i (1 .. $form->{rowcount}) { |
148 |
|
|
148 |
my $taxkey; |
|
149 |
my $rate; |
|
149 | 150 |
# extract accno |
151 |
print(STDERR $form->{"taxchart_$i"}, "TAXCHART\n"); |
|
150 | 152 |
my ($accno) = split(/--/, $form->{"accno_$i"}); |
151 | 153 |
my ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"}); |
154 |
($form->{"tax_id_$i"}, $NULL) = split /--/, $form->{"taxchart_$i"}; |
|
155 |
if ($form->{"tax_id_$i"} ne "") { |
|
156 |
$query = qq|SELECT t.taxkey, t.rate |
|
157 |
FROM tax t |
|
158 |
WHERE t.id=$form->{"tax_id_$i"}|; |
|
159 |
|
|
160 |
$sth = $dbh->prepare($query); |
|
161 |
$sth->execute || $form->dberror($query); |
|
162 |
($taxkey, $rate) = |
|
163 |
$sth->fetchrow_array; |
|
164 |
$sth->finish; |
|
165 |
} |
|
166 |
|
|
152 | 167 |
my $amount = 0; |
153 | 168 |
my $debit = $form->{"debit_$i"}; |
154 | 169 |
my $credit = $form->{"credit_$i"}; |
... | ... | |
194 | 209 |
VALUES |
195 | 210 |
($form->{id}, (SELECT t.chart_id |
196 | 211 |
FROM tax t |
197 |
WHERE t.taxkey = $taxkey),
|
|
212 |
WHERE t.id = $form->{"tax_id_$i"}),
|
|
198 | 213 |
$amount, '$form->{transdate}', | |
199 | 214 |
. $dbh->quote($form->{"source_$i"}) . qq|, | |
200 | 215 |
. $dbh->quote($form->{"memo_$i"}) . qq|, |
... | ... | |
608 | 623 |
WHERE a.chart_id = c.id |
609 | 624 |
AND a.trans_id = $form->{id} |
610 | 625 |
ORDER BY a.oid"; |
626 |
|
|
627 |
$query = qq|SELECT c.accno, t.taxkey AS accnotaxkey, a.amount, a.memo, |
|
628 |
a.transdate, a.cleared, a.project_id, p.projectnumber,(SELECT p.projectnumber FROM project p |
|
629 |
WHERE a.project_id = p.id) AS projectnumber, a.taxkey, t.rate AS taxrate, t.id, (SELECT c1.accno FROM chart c1, tax t1 WHERE t1.id=t.id AND c1.id=t.chart_id) AS taxaccno |
|
630 |
FROM acc_trans a |
|
631 |
JOIN chart c ON (c.id = a.chart_id) |
|
632 |
LEFT JOIN project p ON (p.id = a.project_id) |
|
633 |
LEFT JOIN tax t ON (t.id=(SELECT tk.tax_id from taxkeys tk WHERE (tk.taxkey_id=a.taxkey) AND ((CASE WHEN a.chart_id IN (SELECT chart_id FROM taxkeys WHERE taxkey_id=a.taxkey) THEN tk.chart_id=a.chart_id ELSE 1=1 END) OR (c.link='%tax%')) AND startdate <=a.transdate ORDER BY startdate DESC LIMIT 1)) |
|
634 |
WHERE a.trans_id = $form->{id} |
|
635 |
AND a.fx_transaction = '0' |
|
636 |
ORDER BY a.oid,a.transdate|; |
|
637 |
|
|
638 |
|
|
611 | 639 |
$sth = $dbh->prepare($query); |
612 | 640 |
$sth->execute || $form->dberror($query); |
613 | 641 |
|
... | ... | |
645 | 673 |
} |
646 | 674 |
|
647 | 675 |
$sth->finish; |
648 |
|
|
676 |
my $transdate = "current_date"; |
|
677 |
if ($form->{transdate}) { |
|
678 |
$transdate = qq|'$form->{transdate}'|; |
|
679 |
} |
|
649 | 680 |
# get chart of accounts |
650 |
$query = qq|SELECT c.accno, c.description, c.taxkey_id
|
|
651 |
FROM chart c
|
|
652 |
WHERE c.charttype = 'A'
|
|
653 |
ORDER by c.accno|;
|
|
681 |
$query = qq|SELECT c.accno, c.description, c.link, tk.taxkey_id, tk.tax_id
|
|
682 |
FROM chart c
|
|
683 |
LEFT JOIN taxkeys tk ON (tk.id = (SELECT id from taxkeys where taxkeys.chart_id =c.id AND startdate<=$transdate ORDER BY startdate desc LIMIT 1))
|
|
684 |
ORDER BY c.accno|;
|
|
654 | 685 |
$sth = $dbh->prepare($query); |
655 | 686 |
$sth->execute || $form->dberror($query); |
656 | 687 |
$form->{chart} = (); |
bin/mozilla/gl.pl | ||
---|---|---|
82 | 82 |
|
83 | 83 |
map { |
84 | 84 |
$chart .= |
85 |
"<option value=\"$_->{accno}--$_->{taxkey_id}\">$_->{accno}--$_->{description}</option>"
|
|
85 |
"<option value=\"$_->{accno}--$_->{tax_id}\">$_->{accno}--$_->{description}</option>" |
|
86 | 86 |
} @{ $form->{chart} }; |
87 | 87 |
map { |
88 | 88 |
$tax .= |
89 |
qq|<option value="$_->{taxkey}--$_->{rate}">$_->{taxdescription} |
|
|
89 |
qq|<option value="$_->{id}--$_->{rate}">$_->{taxdescription} |
|
|
90 | 90 |
. ($_->{rate} * 100) . qq| %| |
91 | 91 |
} @{ $form->{TAX} }; |
92 | 92 |
|
... | ... | |
124 | 124 |
GL->transaction(\%myconfig, \%$form); |
125 | 125 |
map { |
126 | 126 |
$chart .= |
127 |
"<option value=\"$_->{accno}--$_->{taxkey_id}\">$_->{accno}--$_->{description}</option>"
|
|
127 |
"<option value=\"$_->{accno}--$_->{tax_id}\">$_->{accno}--$_->{description}</option>" |
|
128 | 128 |
} @{ $form->{chart} }; |
129 | 129 |
|
130 | 130 |
map { |
131 | 131 |
$tax .= |
132 |
qq|<option value="$_->{taxkey}--$_->{rate}">$_->{taxdescription} |
|
|
132 |
qq|<option value="$_->{id}--$_->{rate}">$_->{taxdescription} |
|
|
133 | 133 |
. ($_->{rate} * 100) . qq| %| |
134 | 134 |
} @{ $form->{TAX} }; |
135 | 135 |
|
... | ... | |
159 | 159 |
$j = $i - 1; |
160 | 160 |
if ($tax && ($ref->{accno} eq $taxaccno)) { |
161 | 161 |
$form->{"tax_$j"} = abs($ref->{amount}); |
162 |
$form->{"taxchart_$j"} = $ref->{taxkey} . "--" . $ref->{taxrate};
|
|
162 |
$form->{"taxchart_$j"} = $ref->{id} . "--" . $ref->{taxrate};
|
|
163 | 163 |
if ($form->{taxincluded}) { |
164 | 164 |
if ($ref->{amount} < 0) { |
165 | 165 |
$form->{"debit_$j"} += $form->{"tax_$j"}; |
... | ... | |
1105 | 1105 |
. qq|>$accno</select></td>|; |
1106 | 1106 |
$tax = $taxchart; |
1107 | 1107 |
$tax_selected = $form->{"taxchart_$i"}; |
1108 |
print(STDERR "TAX_SELCTED $tax_selected\n"); |
|
1108 | 1109 |
$tax =~ s/value=\"$tax_selected\"/value=\"$tax_selected\" selected/; |
1109 | 1110 |
$tax = |
1110 | 1111 |
qq|<td><select id="taxchart_$i" name="taxchart_$i" tabindex=| |
... | ... | |
1211 | 1212 |
<!-- |
1212 | 1213 |
function setTaxkey(accno, row) { |
1213 | 1214 |
var taxkey = accno.options[accno.selectedIndex].value; |
1214 |
var reg = /--([0-9])*/;
|
|
1215 |
var reg = /--([0-9]*)/;
|
|
1215 | 1216 |
var found = reg.exec(taxkey); |
1216 | 1217 |
var index = found[1]; |
1217 | 1218 |
index = parseInt(index); |
Auch abrufbar als: Unified diff
Anpassung Dialogbuchen an neues Steuersystem