Revision c7f9bb36
Von Philip Reetz vor fast 19 Jahren hinzugefügt
bin/mozilla/gl.pl | ||
---|---|---|
31 | 31 |
# |
32 | 32 |
#====================================================================== |
33 | 33 |
|
34 |
|
|
34 | 35 |
use SL::GL; |
35 | 36 |
use SL::PE; |
36 | 37 |
|
37 |
use Data::Dumper; |
|
38 |
|
|
39 | 38 |
require "$form->{path}/arap.pl"; |
40 | 39 |
|
41 | 40 |
1; |
42 |
|
|
43 | 41 |
# end of main |
44 | 42 |
|
43 |
|
|
45 | 44 |
# this is for our long dates |
46 | 45 |
# $locale->text('January') |
47 | 46 |
# $locale->text('February') |
... | ... | |
70 | 69 |
# $locale->text('Nov') |
71 | 70 |
# $locale->text('Dec') |
72 | 71 |
|
72 |
|
|
73 | 73 |
sub add { |
74 |
$lxdebug->enter_sub(); |
|
75 | 74 |
|
76 | 75 |
$form->{title} = "Add"; |
77 |
|
|
78 |
$form->{callback} = |
|
79 |
"$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}" |
|
80 |
unless $form->{callback}; |
|
76 |
|
|
77 |
$form->{callback} = "$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}" unless $form->{callback}; |
|
81 | 78 |
|
82 | 79 |
# we use this only to set a default date |
83 | 80 |
GL->transaction(\%myconfig, \%$form); |
84 | 81 |
|
85 |
map { |
|
86 |
$chart .= |
|
87 |
"<option value=\"$_->{accno}--$_->{taxkey_id}\">$_->{accno}--$_->{description}</option>" |
|
88 |
} @{ $form->{chart} }; |
|
89 |
map { |
|
90 |
$tax .= |
|
91 |
qq|<option value="$_->{taxkey}--$_->{rate}">$_->{taxdescription} | |
|
92 |
. ($_->{rate} * 100) . qq| %| |
|
93 |
} @{ $form->{TAX} }; |
|
94 |
|
|
82 |
map { $chart .= "<option value=\"$_->{accno}--$_->{taxkey_id}\">$_->{accno}--$_->{description}</option>" } @{ $form->{chart} }; |
|
83 |
map { $tax .= qq|<option value="$_->{taxkey}--$_->{rate}">$_->{taxdescription} |.($_->{rate} * 100).qq| %|} @{ $form->{TAX} }; |
|
84 |
|
|
95 | 85 |
$form->{chart} = $chart; |
86 |
$form->{chartinit} = $chart; |
|
87 |
$form->{rowcount} = 2; |
|
96 | 88 |
|
97 |
$form->{debitchart} = $chart;
|
|
89 |
$form->{debitchart} = $chart; |
|
98 | 90 |
$form->{creditchart} = $chart; |
99 |
$form->{taxchart} = $tax;
|
|
100 |
|
|
101 |
$form->{debit} = 0;
|
|
91 |
$form->{taxchart} = $tax; |
|
92 |
|
|
93 |
$form->{debit} = 0; |
|
102 | 94 |
$form->{credit} = 0; |
103 |
$form->{tax} = 0; |
|
104 |
|
|
105 |
$form->{creditrowcount} = 2; |
|
106 |
$form->{debitrowcount} = 2; |
|
95 |
$form->{tax} = 0; |
|
96 |
|
|
107 | 97 |
|
108 | 98 |
# departments |
109 | 99 |
$form->all_departments(\%myconfig); |
110 | 100 |
if (@{ $form->{all_departments} }) { |
111 | 101 |
$form->{selectdepartment} = "<option>\n"; |
112 | 102 |
|
113 |
map { |
|
114 |
$form->{selectdepartment} .= |
|
115 |
"<option>$_->{description}--$_->{id}\n" |
|
116 |
} (@{ $form->{all_departments} }); |
|
103 |
map { $form->{selectdepartment} .= "<option>$_->{description}--$_->{id}\n" } (@{ $form->{all_departments} }); |
|
117 | 104 |
} |
118 |
|
|
119 |
&display_form; |
|
120 |
|
|
121 |
$lxdebug->leave_sub(); |
|
105 |
|
|
106 |
&display_form(1); |
|
107 |
|
|
122 | 108 |
} |
123 | 109 |
|
110 |
|
|
124 | 111 |
sub edit { |
125 |
$lxdebug->enter_sub(); |
|
126 | 112 |
|
127 | 113 |
GL->transaction(\%myconfig, \%$form); |
128 | 114 |
|
129 |
map { |
|
130 |
if ($form->{debitaccno} eq $_->{accno}) { |
|
131 |
$form->{debitchart} .= |
|
132 |
"<option value=\"$_->{accno}--$_->{taxkey_id}\">$_->{accno}--$_->{description}"; |
|
133 |
} |
|
134 |
} @{ $form->{chart} }; |
|
135 |
map { |
|
136 |
if ($form->{creditaccno} eq $_->{accno}) { |
|
137 |
$form->{creditchart} .= |
|
138 |
"<option value=\"$_->{accno}--$_->{taxkey_id}\">$_->{accno}--$_->{description}"; |
|
139 |
} |
|
140 |
} @{ $form->{chart} }; |
|
141 |
map { |
|
142 |
$tax .= |
|
143 |
qq|<option value="$_->{taxkey}--$_->{rate}">$_->{taxdescription} | |
|
144 |
. ($_->{rate} * 100) . qq| %| |
|
145 |
} @{ $form->{TAX} }; |
|
146 |
|
|
147 |
if ($form->{creditrowcount} > 2) { |
|
148 |
for $i (2 .. $form->{creditrowcount}) { |
|
149 |
map { |
|
150 |
if ($form->{"creditchartselected_$i"} eq $_->{accno}) { |
|
151 |
$form->{"creditchartselected_$i"} = "$_->{accno}--$_->{taxkey_id}"; |
|
152 |
} |
|
153 |
} @{ $form->{chart} }; |
|
154 |
map { |
|
155 |
if ($form->{"taxchartselected_$i"} eq $_->{taxkey}) { |
|
156 |
$form->{"taxchartselected_$i"} = "$_->{taxkey}--$_->{rate}"; |
|
157 |
} |
|
158 |
} @{ $form->{TAX} }; |
|
159 |
} |
|
160 |
} |
|
161 |
if ($form->{debitrowcount} > 2) { |
|
162 |
for $i (2 .. $form->{debitrowcount}) { |
|
163 |
map { |
|
164 |
if ($form->{"debitchartselected_$i"} eq $_->{accno}) { |
|
165 |
$form->{"debitchartselected_$i"} = "$_->{accno}--$_->{taxkey_id}"; |
|
166 |
} |
|
167 |
} @{ $form->{chart} }; |
|
168 |
map { |
|
169 |
if ($form->{"taxchartselected_$i"} eq $_->{taxkey}) { |
|
170 |
$form->{"taxchartselected_$i"} = "$_->{taxkey}--$_->{rate}"; |
|
171 |
} |
|
172 |
} @{ $form->{TAX} }; |
|
173 |
} |
|
174 |
} |
|
175 |
map { |
|
176 |
$chart .= |
|
177 |
"<option value=\"$_->{accno}--$_->{taxkey_id}\">$_->{accno}--$_->{description}</option>" |
|
178 |
} @{ $form->{chart} }; |
|
115 |
map { if ($form->{debitaccno} eq $_->{accno}) {$form->{debitchart} .= "<option value=\"$_->{accno}--$_->{taxkey_id}\">$_->{accno}--$_->{description}"} } @{ $form->{chart} }; |
|
116 |
map { if ($form->{creditaccno} eq $_->{accno}) {$form->{creditchart} .= "<option value=\"$_->{accno}--$_->{taxkey_id}\">$_->{accno}--$_->{description}"} } @{ $form->{chart} }; |
|
117 |
map { $tax .= qq|<option value="$_->{taxkey}--$_->{rate}">$_->{taxdescription} |.($_->{rate} * 100).qq| %|} @{ $form->{TAX} }; |
|
118 |
|
|
179 | 119 |
$form->{chart} = $chart; |
180 |
map { |
|
181 |
$tax .= |
|
182 |
qq|<option value="$_->{taxkey}--$_->{rate}">$_->{taxdescription} | |
|
183 |
. ($_->{rate} * 100) . qq| %| |
|
184 |
} @{ $form->{TAX} }; |
|
185 |
$form->{taxchart} = $tax; |
|
186 | 120 |
|
121 |
$form->{taxchart} = $tax; |
|
122 |
|
|
187 | 123 |
if ($form->{tax} < 0) { |
188 | 124 |
$form->{tax} = $form->{tax} * (-1); |
189 | 125 |
} |
190 |
|
|
191 |
$form->{amount} = $form->format_amount(\%myconfig, $form->{amount}, 2);
|
|
192 |
|
|
126 |
|
|
127 |
$form->{amount}=$form->format_amount(\%myconfig, $form->{amount}, 2);
|
|
128 |
|
|
193 | 129 |
# departments |
194 | 130 |
$form->all_departments(\%myconfig); |
195 | 131 |
if (@{ $form->{all_departments} }) { |
196 | 132 |
$form->{selectdepartment} = "<option>\n"; |
197 | 133 |
|
198 |
map { |
|
199 |
$form->{selectdepartment} .= |
|
200 |
"<option>$_->{description}--$_->{id}\n" |
|
201 |
} (@{ $form->{all_departments} }); |
|
134 |
map { $form->{selectdepartment} .= "<option>$_->{description}--$_->{id}\n" } (@{ $form->{all_departments} }); |
|
202 | 135 |
} |
203 | 136 |
|
204 |
$form->{locked} = |
|
205 |
($form->datetonum($form->{transdate}, \%myconfig) <= |
|
206 |
$form->datetonum($form->{closedto}, \%myconfig)); |
|
137 |
$i = 1; |
|
138 |
foreach $ref (@{ $form->{GL} }) { |
|
139 |
$form->{"accno_$i"} = "$ref->{accno}--$ref->{description}"; |
|
140 |
|
|
141 |
$form->{"projectnumber_$i"} = "$ref->{projectnumber}--$ref->{project_id}"; |
|
142 |
for (qw(fx_transaction source memo)) { $form->{"${_}_$i"} = $ref->{$_} } |
|
143 |
|
|
144 |
if ($ref->{amount} < 0) { |
|
145 |
$form->{totaldebit} -= $ref->{amount}; |
|
146 |
$form->{"debit_$i"} = $ref->{amount} * -1; |
|
147 |
} else { |
|
148 |
$form->{totalcredit} += $ref->{amount}; |
|
149 |
$form->{"credit_$i"} = $ref->{amount}; |
|
150 |
} |
|
207 | 151 |
|
208 |
$form->{title} = "Edit"; |
|
152 |
$i++; |
|
153 |
} |
|
209 | 154 |
|
210 |
&form_header; |
|
155 |
$form->{rowcount} = $i; |
|
156 |
$form->{locked} = ($form->datetonum($form->{transdate}, \%myconfig) <= $form->datetonum($form->{closedto}, \%myconfig)); |
|
211 | 157 |
|
158 |
$form->{title} = "Edit"; |
|
159 |
|
|
160 |
&form_header; |
|
161 |
&display_rows; |
|
212 | 162 |
&form_footer; |
213 |
|
|
214 |
$lxdebug->leave_sub(); |
|
163 |
|
|
215 | 164 |
} |
216 | 165 |
|
166 |
|
|
167 |
|
|
217 | 168 |
sub search { |
218 |
$lxdebug->enter_sub(); |
|
219 | 169 |
|
220 | 170 |
$form->{title} = $locale->text('Buchungsjournal'); |
221 |
|
|
171 |
|
|
222 | 172 |
$form->all_departments(\%myconfig); |
223 |
|
|
224 | 173 |
# departments |
225 | 174 |
if (@{ $form->{all_departments} }) { |
226 | 175 |
$form->{selectdepartment} = "<option>\n"; |
227 | 176 |
|
228 |
map { |
|
229 |
$form->{selectdepartment} .= |
|
230 |
"<option>$_->{description}--$_->{id}\n" |
|
231 |
} (@{ $form->{all_departments} }); |
|
177 |
map { $form->{selectdepartment} .= "<option>$_->{description}--$_->{id}\n" } (@{ $form->{all_departments} }); |
|
232 | 178 |
} |
233 |
|
|
179 |
|
|
234 | 180 |
$department = qq| |
235 | 181 |
<tr> |
236 |
<th align=right nowrap>| . $locale->text('Department') . qq|</th>
|
|
182 |
<th align=right nowrap>|.$locale->text('Department').qq|</th>
|
|
237 | 183 |
<td colspan=3><select name=department>$form->{selectdepartment}</select></td> |
238 | 184 |
</tr> |
239 | 185 |
| if $form->{selectdepartment}; |
240 |
|
|
186 |
|
|
241 | 187 |
# use JavaScript Calendar or not |
242 | 188 |
$form->{jsscript} = $jscalendar; |
243 | 189 |
$jsscript = ""; |
244 |
if ($form->{jsscript}) {
|
|
245 |
|
|
190 |
if ($form->{jsscript}) |
|
191 |
{ |
|
246 | 192 |
# with JavaScript Calendar |
247 | 193 |
$button1 = qq| |
248 | 194 |
<td><input name=datefrom id=datefrom size=11 title="$myconfig{dateformat}"> |
249 |
<input type=button name=datefrom id="trigger1" value=| |
|
250 |
. $locale->text('button') |
|
251 |
. qq|></td> |
|
195 |
<input type=button name=datefrom id="trigger1" value=|.$locale->text('button').qq|></td> |
|
252 | 196 |
|; |
253 |
$button2 = qq| |
|
197 |
$button2 = qq|
|
|
254 | 198 |
<td><input name=dateto id=dateto size=11 title="$myconfig{dateformat}"> |
255 |
<input type=button name=dateto id="trigger2" value=| |
|
256 |
. $locale->text('button') |
|
257 |
. qq|></td> |
|
199 |
<input type=button name=dateto id="trigger2" value=|.$locale->text('button').qq|></td> |
|
258 | 200 |
|; |
259 |
|
|
260 |
#write Trigger |
|
261 |
$jsscript = |
|
262 |
Form->write_trigger(\%myconfig, "2", "datefrom", "BR", "trigger1", |
|
263 |
"dateto", "BL", "trigger2"); |
|
264 |
} else { |
|
265 |
|
|
266 |
# without JavaScript Calendar |
|
267 |
$button1 = |
|
268 |
qq|<td><input name=datefrom id=datefrom size=11 title="$myconfig{dateformat}"></td>|; |
|
269 |
$button2 = |
|
270 |
qq|<td><input name=dateto id=dateto size=11 title="$myconfig{dateformat}"></td>|; |
|
271 |
} |
|
201 |
#write Trigger |
|
202 |
$jsscript = Form->write_trigger(\%myconfig,"2","datefrom","BR","trigger1","dateto","BL","trigger2"); |
|
203 |
} |
|
204 |
else |
|
205 |
{ |
|
206 |
# without JavaScript Calendar |
|
207 |
$button1 = qq|<td><input name=datefrom id=datefrom size=11 title="$myconfig{dateformat}"></td>|; |
|
208 |
$button2 = qq|<td><input name=dateto id=dateto size=11 title="$myconfig{dateformat}"></td>|; |
|
209 |
} |
|
272 | 210 |
|
273 | 211 |
$form->header; |
274 | 212 |
|
... | ... | |
288 | 226 |
<td> |
289 | 227 |
<table> |
290 | 228 |
<tr> |
291 |
<th align=right>| . $locale->text('Reference') . qq|</th>
|
|
229 |
<th align=right>|.$locale->text('Reference').qq|</th>
|
|
292 | 230 |
<td><input name=reference size=20></td> |
293 |
<th align=right>| . $locale->text('Source') . qq|</th>
|
|
231 |
<th align=right>|.$locale->text('Source').qq|</th>
|
|
294 | 232 |
<td><input name=source size=20></td> |
295 | 233 |
</tr> |
296 | 234 |
$department |
297 | 235 |
<tr> |
298 |
<th align=right>| . $locale->text('Description') . qq|</th>
|
|
236 |
<th align=right>|.$locale->text('Description').qq|</th>
|
|
299 | 237 |
<td colspan=3><input name=description size=40></td> |
300 | 238 |
</tr> |
301 | 239 |
<tr> |
302 |
<th align=right>| . $locale->text('Notes') . qq|</th>
|
|
240 |
<th align=right>|.$locale->text('Notes').qq|</th>
|
|
303 | 241 |
<td colspan=3><input name=notes size=40></td> |
304 | 242 |
</tr> |
305 | 243 |
<tr> |
306 |
<th align=right>| . $locale->text('From') . qq|</th>
|
|
244 |
<th align=right>|.$locale->text('From').qq|</th>
|
|
307 | 245 |
$button1 |
308 | 246 |
$button2 |
309 | 247 |
</tr> |
310 | 248 |
<tr> |
311 |
<th align=right>| . $locale->text('Include in Report') . qq|</th>
|
|
249 |
<th align=right>|.$locale->text('Include in Report').qq|</th>
|
|
312 | 250 |
<td colspan=3> |
313 | 251 |
<table> |
314 | 252 |
<tr> |
315 | 253 |
<td> |
316 |
<input name="category" class=radio type=radio value=X checked> | |
|
317 |
. $locale->text('All') . qq| |
|
318 |
<input name="category" class=radio type=radio value=A> | |
|
319 |
. $locale->text('Asset') . qq| |
|
320 |
<input name="category" class=radio type=radio value=L> | |
|
321 |
. $locale->text('Liability') . qq| |
|
322 |
<input name="category" class=radio type=radio value=I> | |
|
323 |
. $locale->text('Revenue') . qq| |
|
324 |
<input name="category" class=radio type=radio value=E> | |
|
325 |
. $locale->text('Expense') . qq| |
|
254 |
<input name="category" class=radio type=radio value=X checked> |.$locale->text('All').qq| |
|
255 |
<input name="category" class=radio type=radio value=A> |.$locale->text('Asset').qq| |
|
256 |
<input name="category" class=radio type=radio value=C> |.$locale->text('Contra').qq| |
|
257 |
<input name="category" class=radio type=radio value=L> |.$locale->text('Liability').qq| |
|
258 |
<input name="category" class=radio type=radio value=Q> |.$locale->text('Equity').qq| |
|
259 |
<input name="category" class=radio type=radio value=I> |.$locale->text('Revenue').qq| |
|
260 |
<input name="category" class=radio type=radio value=E> |.$locale->text('Expense').qq| |
|
326 | 261 |
</td> |
327 | 262 |
</tr> |
328 | 263 |
<tr> |
329 | 264 |
<table> |
330 | 265 |
<tr> |
331 | 266 |
<td align=right><input name="l_id" class=checkbox type=checkbox value=Y></td> |
332 |
<td>| . $locale->text('ID') . qq|</td>
|
|
267 |
<td>|.$locale->text('ID').qq|</td>
|
|
333 | 268 |
<td align=right><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td> |
334 |
<td>| . $locale->text('Date') . qq|</td>
|
|
269 |
<td>|.$locale->text('Date').qq|</td>
|
|
335 | 270 |
<td align=right><input name="l_reference" class=checkbox type=checkbox value=Y checked></td> |
336 |
<td>| . $locale->text('Reference') . qq|</td>
|
|
271 |
<td>|.$locale->text('Reference').qq|</td>
|
|
337 | 272 |
<td align=right><input name="l_description" class=checkbox type=checkbox value=Y checked></td> |
338 |
<td>| . $locale->text('Description') . qq|</td>
|
|
273 |
<td>|.$locale->text('Description').qq|</td>
|
|
339 | 274 |
<td align=right><input name="l_notes" class=checkbox type=checkbox value=Y></td> |
340 |
<td>| . $locale->text('Notes') . qq|</td>
|
|
275 |
<td>|.$locale->text('Notes').qq|</td>
|
|
341 | 276 |
</tr> |
342 | 277 |
<tr> |
343 | 278 |
<td align=right><input name="l_debit" class=checkbox type=checkbox value=Y checked></td> |
344 |
<td>| . $locale->text('Debit') . qq|</td>
|
|
279 |
<td>|.$locale->text('Debit').qq|</td>
|
|
345 | 280 |
<td align=right><input name="l_credit" class=checkbox type=checkbox value=Y checked></td> |
346 |
<td>| . $locale->text('Credit') . qq|</td>
|
|
281 |
<td>|.$locale->text('Credit').qq|</td>
|
|
347 | 282 |
<td align=right><input name="l_source" class=checkbox type=checkbox value=Y checked></td> |
348 |
<td>| . $locale->text('Source') . qq|</td>
|
|
283 |
<td>|.$locale->text('Source').qq|</td>
|
|
349 | 284 |
<td align=right><input name="l_accno" class=checkbox type=checkbox value=Y checked></td> |
350 |
<td>| . $locale->text('Account') . qq|</td>
|
|
285 |
<td>|.$locale->text('Account').qq|</td>
|
|
351 | 286 |
<td align=right><input name="l_gifi_accno" class=checkbox type=checkbox value=Y></td> |
352 |
<td>| . $locale->text('GIFI') . qq|</td>
|
|
287 |
<td>|.$locale->text('GIFI').qq|</td>
|
|
353 | 288 |
</tr> |
354 | 289 |
<tr> |
355 | 290 |
<td align=right><input name="l_subtotal" class=checkbox type=checkbox value=Y></td> |
356 |
<td>| . $locale->text('Subtotal') . qq|</td>
|
|
291 |
<td>|.$locale->text('Subtotal').qq|</td>
|
|
357 | 292 |
</tr> |
358 | 293 |
</table> |
359 | 294 |
</tr> |
... | ... | |
376 | 311 |
<input type=hidden name=password value=$form->{password}> |
377 | 312 |
|
378 | 313 |
<br> |
379 |
<input class=submit type=submit name=action value="| |
|
380 |
. $locale->text('Continue') . qq|"> |
|
314 |
<input class=submit type=submit name=action value="|.$locale->text('Continue').qq|"> |
|
381 | 315 |
</form> |
382 | 316 |
|
383 | 317 |
</body> |
384 | 318 |
</html> |
385 | 319 |
|; |
386 |
$lxdebug->leave_sub(); |
|
387 | 320 |
} |
388 | 321 |
|
322 |
|
|
389 | 323 |
sub generate_report { |
390 |
$lxdebug->enter_sub(); |
|
391 | 324 |
|
392 | 325 |
$form->{sort} = "transdate" unless $form->{sort}; |
393 | 326 |
|
394 | 327 |
GL->all_transactions(\%myconfig, \%$form); |
395 |
|
|
396 |
$callback = |
|
397 |
"$form->{script}?action=generate_report&path=$form->{path}&login=$form->{login}&password=$form->{password}"; |
|
328 |
|
|
329 |
$callback = "$form->{script}?action=generate_report&path=$form->{path}&login=$form->{login}&password=$form->{password}"; |
|
398 | 330 |
|
399 | 331 |
$href = $callback; |
400 |
|
|
401 |
%acctype = ('A' => $locale->text('Asset'), |
|
402 |
'C' => $locale->text('Contra'), |
|
403 |
'L' => $locale->text('Liability'), |
|
404 |
'Q' => $locale->text('Equity'), |
|
405 |
'I' => $locale->text('Revenue'), |
|
406 |
'E' => $locale->text('Expense'),); |
|
407 |
|
|
332 |
|
|
333 |
%acctype = ( 'A' => $locale->text('Asset'), |
|
334 |
'C' => $locale->text('Contra'), |
|
335 |
'L' => $locale->text('Liability'), |
|
336 |
'Q' => $locale->text('Equity'), |
|
337 |
'I' => $locale->text('Revenue'), |
|
338 |
'E' => $locale->text('Expense'), |
|
339 |
); |
|
340 |
|
|
408 | 341 |
$form->{title} = $locale->text('General Ledger'); |
409 |
|
|
342 |
|
|
410 | 343 |
$ml = ($form->{ml} =~ /(A|E)/) ? -1 : 1; |
411 | 344 |
|
412 | 345 |
unless ($form->{category} eq 'X') { |
413 |
$form->{title} .= " : " . $locale->text($acctype{ $form->{category} });
|
|
346 |
$form->{title} .= " : ".$locale->text($acctype{$form->{category}});
|
|
414 | 347 |
} |
415 | 348 |
if ($form->{accno}) { |
416 |
$href .= "&accno=" . $form->escape($form->{accno}); |
|
417 |
$callback .= "&accno=" . $form->escape($form->{accno}, 1); |
|
418 |
$option = |
|
419 |
$locale->text('Account') |
|
420 |
. " : $form->{accno} $form->{account_description}"; |
|
349 |
$href .= "&accno=".$form->escape($form->{accno}); |
|
350 |
$callback .= "&accno=".$form->escape($form->{accno},1); |
|
351 |
$option = $locale->text('Account')." : $form->{accno} $form->{account_description}"; |
|
421 | 352 |
} |
422 | 353 |
if ($form->{gifi_accno}) { |
423 |
$href .= "&gifi_accno=" . $form->escape($form->{gifi_accno}); |
|
424 |
$callback .= "&gifi_accno=" . $form->escape($form->{gifi_accno}, 1); |
|
425 |
$option .= "\n<br>" if $option; |
|
426 |
$option .= |
|
427 |
$locale->text('GIFI') |
|
428 |
. " : $form->{gifi_accno} $form->{gifi_account_description}"; |
|
354 |
$href .= "&gifi_accno=".$form->escape($form->{gifi_accno}); |
|
355 |
$callback .= "&gifi_accno=".$form->escape($form->{gifi_accno},1); |
|
356 |
$option .= "\n<br>" if $option; |
|
357 |
$option .= $locale->text('GIFI')." : $form->{gifi_accno} $form->{gifi_account_description}"; |
|
429 | 358 |
} |
430 | 359 |
if ($form->{source}) { |
431 |
$href .= "&source=" . $form->escape($form->{source});
|
|
432 |
$callback .= "&source=" . $form->escape($form->{source}, 1);
|
|
433 |
$option .= "\n<br>" if $option;
|
|
434 |
$option .= $locale->text('Source') . " : $form->{source}";
|
|
360 |
$href .= "&source=".$form->escape($form->{source});
|
|
361 |
$callback .= "&source=".$form->escape($form->{source},1);
|
|
362 |
$option .= "\n<br>" if $option; |
|
363 |
$option .= $locale->text('Source')." : $form->{source}";
|
|
435 | 364 |
} |
436 | 365 |
if ($form->{reference}) { |
437 |
$href .= "&reference=" . $form->escape($form->{reference});
|
|
438 |
$callback .= "&reference=" . $form->escape($form->{reference}, 1);
|
|
439 |
$option .= "\n<br>" if $option;
|
|
440 |
$option .= $locale->text('Reference') . " : $form->{reference}";
|
|
366 |
$href .= "&reference=".$form->escape($form->{reference});
|
|
367 |
$callback .= "&reference=".$form->escape($form->{reference},1);
|
|
368 |
$option .= "\n<br>" if $option; |
|
369 |
$option .= $locale->text('Reference')." : $form->{reference}";
|
|
441 | 370 |
} |
442 | 371 |
if ($form->{department}) { |
443 |
$href .= "&department=" . $form->escape($form->{department});
|
|
444 |
$callback .= "&department=" . $form->escape($form->{department}, 1);
|
|
372 |
$href .= "&department=".$form->escape($form->{department});
|
|
373 |
$callback .= "&department=".$form->escape($form->{department},1);
|
|
445 | 374 |
($department) = split /--/, $form->{department}; |
446 | 375 |
$option .= "\n<br>" if $option; |
447 |
$option .= $locale->text('Department') . " : $department";
|
|
376 |
$option .= $locale->text('Department')." : $department";
|
|
448 | 377 |
} |
449 | 378 |
|
450 | 379 |
if ($form->{description}) { |
451 |
$href .= "&description=" . $form->escape($form->{description});
|
|
452 |
$callback .= "&description=" . $form->escape($form->{description}, 1);
|
|
453 |
$option .= "\n<br>" if $option;
|
|
454 |
$option .= $locale->text('Description') . " : $form->{description}";
|
|
380 |
$href .= "&description=".$form->escape($form->{description});
|
|
381 |
$callback .= "&description=".$form->escape($form->{description},1);
|
|
382 |
$option .= "\n<br>" if $option; |
|
383 |
$option .= $locale->text('Description')." : $form->{description}";
|
|
455 | 384 |
} |
456 | 385 |
if ($form->{notes}) { |
457 |
$href .= "¬es=" . $form->escape($form->{notes});
|
|
458 |
$callback .= "¬es=" . $form->escape($form->{notes}, 1);
|
|
459 |
$option .= "\n<br>" if $option;
|
|
460 |
$option .= $locale->text('Notes') . " : $form->{notes}";
|
|
386 |
$href .= "¬es=".$form->escape($form->{notes});
|
|
387 |
$callback .= "¬es=".$form->escape($form->{notes},1);
|
|
388 |
$option .= "\n<br>" if $option; |
|
389 |
$option .= $locale->text('Notes')." : $form->{notes}";
|
|
461 | 390 |
} |
462 |
|
|
391 |
|
|
463 | 392 |
if ($form->{datefrom}) { |
464 |
$href .= "&datefrom=$form->{datefrom}";
|
|
393 |
$href .= "&datefrom=$form->{datefrom}"; |
|
465 | 394 |
$callback .= "&datefrom=$form->{datefrom}"; |
466 |
$option .= "\n<br>" if $option; |
|
467 |
$option .= |
|
468 |
$locale->text('From') . " " |
|
469 |
. $locale->date(\%myconfig, $form->{datefrom}, 1); |
|
395 |
$option .= "\n<br>" if $option; |
|
396 |
$option .= $locale->text('From')." ".$locale->date(\%myconfig, $form->{datefrom}, 1); |
|
470 | 397 |
} |
471 | 398 |
if ($form->{dateto}) { |
472 |
$href .= "&dateto=$form->{dateto}";
|
|
399 |
$href .= "&dateto=$form->{dateto}"; |
|
473 | 400 |
$callback .= "&dateto=$form->{dateto}"; |
474 | 401 |
if ($form->{datefrom}) { |
475 | 402 |
$option .= " "; |
476 | 403 |
} else { |
477 | 404 |
$option .= "\n<br>" if $option; |
478 | 405 |
} |
479 |
$option .= |
|
480 |
$locale->text('Bis') . " " |
|
481 |
. $locale->date(\%myconfig, $form->{dateto}, 1); |
|
406 |
$option .= $locale->text('Bis')." ".$locale->date(\%myconfig, $form->{dateto}, 1); |
|
482 | 407 |
} |
483 | 408 |
|
484 |
@columns = |
|
485 |
$form->sort_columns( |
|
486 |
qw(transdate id reference description notes source debit debit_accno credit credit_accno debit_tax debit_tax_accno credit_tax credit_tax_accno accno gifi_accno) |
|
487 |
); |
|
409 |
|
|
410 |
@columns = $form->sort_columns(qw(transdate id reference description notes source debit debit_accno credit credit_accno debit_tax debit_tax_accno credit_tax credit_tax_accno accno gifi_accno)); |
|
488 | 411 |
|
489 | 412 |
if ($form->{accno} || $form->{gifi_accno}) { |
490 | 413 |
@columns = grep !/(accno|gifi_accno)/, @columns; |
491 | 414 |
push @columns, "balance"; |
492 | 415 |
$form->{l_balance} = "Y"; |
493 |
|
|
494 |
}
|
|
495 |
|
|
496 |
$form->{l_credit_accno} = "Y";
|
|
497 |
$form->{l_debit_accno} = "Y";
|
|
498 |
$form->{l_credit_tax} = "Y";
|
|
499 |
$form->{l_debit_tax} = "Y";
|
|
416 |
|
|
417 |
} |
|
418 |
|
|
419 |
$form->{l_credit_accno} = "Y"; |
|
420 |
$form->{l_debit_accno} = "Y"; |
|
421 |
$form->{l_credit_tax} = "Y"; |
|
422 |
$form->{l_debit_tax} = "Y"; |
|
500 | 423 |
$form->{l_credit_tax_accno} = "Y"; |
501 |
$form->{l_debit_tax_accno} = "Y";
|
|
502 |
$form->{l_accno} = "N";
|
|
424 |
$form->{l_debit_tax_accno} = "Y"; |
|
425 |
$form->{l_accno} = "N"; |
|
503 | 426 |
foreach $item (@columns) { |
504 | 427 |
if ($form->{"l_$item"} eq "Y") { |
505 | 428 |
push @column_index, $item; |
506 | 429 |
|
507 | 430 |
# add column to href and callback |
508 | 431 |
$callback .= "&l_$item=Y"; |
509 |
$href .= "&l_$item=Y";
|
|
432 |
$href .= "&l_$item=Y"; |
|
510 | 433 |
} |
511 | 434 |
} |
512 | 435 |
|
513 | 436 |
if ($form->{l_subtotal} eq 'Y') { |
514 | 437 |
$callback .= "&l_subtotal=Y"; |
515 |
$href .= "&l_subtotal=Y";
|
|
438 |
$href .= "&l_subtotal=Y"; |
|
516 | 439 |
} |
517 | 440 |
|
518 | 441 |
$callback .= "&category=$form->{category}"; |
519 |
$href .= "&category=$form->{category}"; |
|
520 |
|
|
521 |
$column_header{id} = |
|
522 |
"<th><a class=listheading href=$href&sort=id>" |
|
523 |
. $locale->text('ID') |
|
524 |
. "</a></th>"; |
|
525 |
$column_header{transdate} = |
|
526 |
"<th><a class=listheading href=$href&sort=transdate>" |
|
527 |
. $locale->text('Date') |
|
528 |
. "</a></th>"; |
|
529 |
$column_header{reference} = |
|
530 |
"<th><a class=listheading href=$href&sort=reference>" |
|
531 |
. $locale->text('Reference') |
|
532 |
. "</a></th>"; |
|
533 |
$column_header{source} = |
|
534 |
"<th><a class=listheading href=$href&sort=source>" |
|
535 |
. $locale->text('Source') |
|
536 |
. "</a></th>"; |
|
537 |
$column_header{description} = |
|
538 |
"<th><a class=listheading href=$href&sort=description>" |
|
539 |
. $locale->text('Description') |
|
540 |
. "</a></th>"; |
|
541 |
$column_header{notes} = |
|
542 |
"<th class=listheading>" . $locale->text('Notes') . "</th>"; |
|
543 |
$column_header{debit} = |
|
544 |
"<th class=listheading>" . $locale->text('Debit') . "</th>"; |
|
545 |
$column_header{debit_accno} = |
|
546 |
"<th><a class=listheading href=$href&sort=accno>" |
|
547 |
. $locale->text('Debit Account') |
|
548 |
. "</a></th>"; |
|
549 |
$column_header{credit} = |
|
550 |
"<th class=listheading>" . $locale->text('Credit') . "</th>"; |
|
551 |
$column_header{credit_accno} = |
|
552 |
"<th><a class=listheading href=$href&sort=accno>" |
|
553 |
. $locale->text('Credit Account') |
|
554 |
. "</a></th>"; |
|
555 |
$column_header{debit_tax} = |
|
556 |
"<th><a class=listheading href=$href&sort=accno>" |
|
557 |
. $locale->text('Debit Tax') |
|
558 |
. "</a></th>"; |
|
559 |
$column_header{debit_tax_accno} = |
|
560 |
"<th><a class=listheading href=$href&sort=accno>" |
|
561 |
. $locale->text('Debit Tax Account') |
|
562 |
. "</a></th>"; |
|
563 |
$column_header{credit_tax} = |
|
564 |
"<th><a class=listheading href=$href&sort=accno>" |
|
565 |
. $locale->text('Credit Tax') |
|
566 |
. "</a></th>"; |
|
567 |
$column_header{credit_tax_accno} = |
|
568 |
"<th><a class=listheading href=$href&sort=accno>" |
|
569 |
. $locale->text('Credit Tax Account') |
|
570 |
. "</a></th>"; |
|
571 |
$column_header{gifi_accno} = |
|
572 |
"<th><a class=listheading href=$href&sort=gifi_accno>" |
|
573 |
. $locale->text('GIFI') |
|
574 |
. "</a></th>"; |
|
575 |
$column_header{balance} = "<th>" . $locale->text('Balance') . "</th>"; |
|
576 |
|
|
442 |
$href .= "&category=$form->{category}"; |
|
443 |
|
|
444 |
$column_header{id} = "<th><a class=listheading href=$href&sort=id>".$locale->text('ID')."</a></th>"; |
|
445 |
$column_header{transdate} = "<th><a class=listheading href=$href&sort=transdate>".$locale->text('Date')."</a></th>"; |
|
446 |
$column_header{reference} = "<th><a class=listheading href=$href&sort=reference>".$locale->text('Reference')."</a></th>"; |
|
447 |
$column_header{source} = "<th><a class=listheading href=$href&sort=source>".$locale->text('Source')."</a></th>"; |
|
448 |
$column_header{description} = "<th><a class=listheading href=$href&sort=description>".$locale->text('Description')."</a></th>"; |
|
449 |
$column_header{notes} = "<th class=listheading>".$locale->text('Notes')."</th>"; |
|
450 |
$column_header{debit} = "<th class=listheading>".$locale->text('Debit')."</th>"; |
|
451 |
$column_header{debit_accno} = "<th><a class=listheading href=$href&sort=accno>".$locale->text('Debit Account')."</a></th>"; |
|
452 |
$column_header{credit} = "<th class=listheading>".$locale->text('Credit')."</th>"; |
|
453 |
$column_header{credit_accno} = "<th><a class=listheading href=$href&sort=accno>".$locale->text('Credit Account')."</a></th>"; |
|
454 |
$column_header{debit_tax} = "<th><a class=listheading href=$href&sort=accno>".$locale->text('Debit Tax')."</a></th>"; |
|
455 |
$column_header{debit_tax_accno} = "<th><a class=listheading href=$href&sort=accno>".$locale->text('Debit Tax Account')."</a></th>"; |
|
456 |
$column_header{credit_tax} = "<th><a class=listheading href=$href&sort=accno>".$locale->text('Credit Tax')."</a></th>"; |
|
457 |
$column_header{credit_tax_accno} = "<th><a class=listheading href=$href&sort=accno>".$locale->text('Credit Tax Account')."</a></th>"; |
|
458 |
$column_header{gifi_accno} = "<th><a class=listheading href=$href&sort=gifi_accno>".$locale->text('GIFI')."</a></th>"; |
|
459 |
$column_header{balance} = "<th>".$locale->text('Balance')."</th>"; |
|
460 |
|
|
577 | 461 |
$form->{landscape} = 1; |
578 |
|
|
462 |
|
|
579 | 463 |
$form->header; |
580 | 464 |
|
581 | 465 |
print qq| |
... | ... | |
596 | 480 |
<tr class=listheading> |
597 | 481 |
|; |
598 | 482 |
|
599 |
map { print "$column_header{$_}\n" } @column_index;
|
|
483 |
map { print "$column_header{$_}\n" } @column_index; |
|
600 | 484 |
|
601 |
print "
|
|
485 |
print " |
|
602 | 486 |
</tr> |
603 | 487 |
</thead> |
604 | 488 |
</tfoot> |
605 | 489 |
<tbody> |
606 | 490 |
"; |
607 |
|
|
491 |
|
|
608 | 492 |
# add sort to callback |
609 | 493 |
$form->{callback} = "$callback&sort=$form->{sort}"; |
610 | 494 |
$callback = $form->escape($form->{callback}); |
611 |
|
|
495 |
|
|
612 | 496 |
# initial item for subtotals |
613 | 497 |
if (@{ $form->{GL} }) { |
614 |
$sameitem = $form->{GL}->[0]->{ $form->{sort} };
|
|
498 |
$sameitem = $form->{GL}->[0]->{$form->{sort}};
|
|
615 | 499 |
} |
616 |
|
|
500 |
|
|
617 | 501 |
if (($form->{accno} || $form->{gifi_accno}) && $form->{balance}) { |
618 | 502 |
|
619 | 503 |
map { $column_data{$_} = "<td> </td>" } @column_index; |
620 |
$column_data{balance} = |
|
621 |
"<td align=right>" |
|
622 |
. $form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0) |
|
623 |
. "</td>"; |
|
624 |
|
|
625 |
$i++; |
|
626 |
$i %= 2; |
|
504 |
$column_data{balance} = "<td align=right>".$form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0)."</td>"; |
|
505 |
|
|
506 |
$i++; $i %= 2; |
|
627 | 507 |
print qq| |
628 | 508 |
<tr class=listrow$i> |
629 | 509 |
|; |
630 | 510 |
map { print "$column_data{$_}\n" } @column_index; |
631 |
|
|
511 |
|
|
632 | 512 |
print qq| |
633 | 513 |
</tr> |
634 | 514 |
|; |
635 | 515 |
} |
636 |
|
|
516 |
|
|
637 | 517 |
foreach $ref (@{ $form->{GL} }) { |
638 | 518 |
|
639 | 519 |
# if item ne sort print subtotal |
640 | 520 |
if ($form->{l_subtotal} eq 'Y') { |
641 |
if ($sameitem ne $ref->{ $form->{sort} }) {
|
|
642 |
&gl_subtotal;
|
|
521 |
if ($sameitem ne $ref->{$form->{sort}}) {
|
|
522 |
&gl_subtotal;
|
|
643 | 523 |
} |
644 | 524 |
} |
645 |
foreach $key (sort keys(%{ $ref->{amount} })) {
|
|
525 |
foreach $key (sort keys (%{$ref->{amount}})) {
|
|
646 | 526 |
$form->{balance} += $ref->{amount}{$key}; |
647 | 527 |
} |
648 |
|
|
528 |
|
|
649 | 529 |
$debit = ""; |
650 |
foreach $key (sort keys(%{ $ref->{debit} })) {
|
|
530 |
foreach $key (sort keys (%{$ref->{debit}})) {
|
|
651 | 531 |
$subtotaldebit += $ref->{debit}{$key}; |
652 |
$totaldebit += $ref->{debit}{$key};
|
|
532 |
$totaldebit += $ref->{debit}{$key}; |
|
653 | 533 |
if ($key == 0) { |
654 |
$debit = $form->format_amount(\%myconfig, $ref->{debit}{$key}, 2, 0); |
|
534 |
$debit = $form->format_amount(\%myconfig, $ref->{debit}{$key} , 2, 0);
|
|
655 | 535 |
} else { |
656 |
$debit .= |
|
657 |
"<br>" . $form->format_amount(\%myconfig, $ref->{debit}{$key}, 2, 0); |
|
536 |
$debit .= "<br>".$form->format_amount(\%myconfig, $ref->{debit}{$key} , 2, 0); |
|
658 | 537 |
} |
659 | 538 |
} |
660 |
|
|
539 |
|
|
661 | 540 |
$credit = ""; |
662 |
foreach $key (sort keys(%{ $ref->{credit} })) {
|
|
541 |
foreach $key (sort keys (%{$ref->{credit}})) {
|
|
663 | 542 |
$subtotalcredit += $ref->{credit}{$key}; |
664 |
$totalcredit += $ref->{credit}{$key};
|
|
543 |
$totalcredit += $ref->{credit}{$key}; |
|
665 | 544 |
if ($key == 0) { |
666 |
$credit = $form->format_amount(\%myconfig, $ref->{credit}{$key}, 2, 0); |
|
545 |
$credit = $form->format_amount(\%myconfig, $ref->{credit}{$key} , 2, 0);
|
|
667 | 546 |
} else { |
668 |
$credit .= "<br>" |
|
669 |
. $form->format_amount(\%myconfig, $ref->{credit}{$key}, 2, 0); |
|
670 |
} |
|
547 |
$credit .= "<br>".$form->format_amount(\%myconfig, $ref->{credit}{$key} , 2, 0); |
|
548 |
} |
|
671 | 549 |
} |
672 |
|
|
550 |
|
|
673 | 551 |
$debittax = ""; |
674 |
foreach $key (sort keys(%{ $ref->{debit_tax} })) {
|
|
552 |
foreach $key (sort keys (%{$ref->{debit_tax}})) {
|
|
675 | 553 |
$subtotaldebittax += $ref->{debit_tax}{$key}; |
676 |
$totaldebittax += $ref->{debit_tax}{$key};
|
|
554 |
$totaldebittax += $ref->{debit_tax}{$key}; |
|
677 | 555 |
if ($key == 0) { |
678 |
$debittax = |
|
679 |
$form->format_amount(\%myconfig, $ref->{debit_tax}{$key}, 2, 0); |
|
556 |
$debittax = $form->format_amount(\%myconfig, $ref->{debit_tax}{$key} , 2, 0); |
|
680 | 557 |
} else { |
681 |
$debittax .= "<br>" |
|
682 |
. $form->format_amount(\%myconfig, $ref->{debit_tax}{$key}, 2, 0); |
|
558 |
$debittax .= "<br>".$form->format_amount(\%myconfig, $ref->{debit_tax}{$key} , 2, 0); |
|
683 | 559 |
} |
684 | 560 |
} |
685 |
|
|
561 |
|
|
686 | 562 |
$credittax = ""; |
687 |
foreach $key (sort keys(%{ $ref->{credit_tax} })) {
|
|
563 |
foreach $key (sort keys (%{$ref->{credit_tax}})) {
|
|
688 | 564 |
$subtotalcredittax += $ref->{credit_tax}{$key}; |
689 |
$totalcredittax += $ref->{credit_tax}{$key};
|
|
565 |
$totalcredittax += $ref->{credit_tax}{$key}; |
|
690 | 566 |
if ($key == 0) { |
691 |
$credittax = |
|
692 |
$form->format_amount(\%myconfig, $ref->{credit_tax}{$key}, 2, 0); |
|
567 |
$credittax = $form->format_amount(\%myconfig, $ref->{credit_tax}{$key} , 2, 0); |
|
693 | 568 |
} else { |
694 |
$credittax .= "<br>" |
|
695 |
. $form->format_amount(\%myconfig, $ref->{credit_tax}{$key}, 2, 0); |
|
569 |
$credittax .= "<br>".$form->format_amount(\%myconfig, $ref->{credit_tax}{$key} , 2, 0); |
|
696 | 570 |
} |
697 | 571 |
} |
698 |
|
|
699 |
$debitaccno = "";
|
|
572 |
|
|
573 |
$debitaccno = ""; |
|
700 | 574 |
$debittaxkey = ""; |
701 |
$taxaccno = "";
|
|
702 |
foreach $key (sort keys(%{ $ref->{debit_accno} })) {
|
|
575 |
$taxaccno = ""; |
|
576 |
foreach $key (sort keys (%{$ref->{debit_accno}})) {
|
|
703 | 577 |
if ($key == 0) { |
704 |
$debitaccno = |
|
705 |
"<a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{debit_accno}{$key}</a>"; |
|
578 |
$debitaccno = "<a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{debit_accno}{$key}</a>"; |
|
706 | 579 |
} else { |
707 |
$debitaccno .= |
|
708 |
"<br><a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{debit_accno}{$key}</a>"; |
|
580 |
$debitaccno .= "<br><a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{debit_accno}{$key}</a>"; |
|
709 | 581 |
} |
710 | 582 |
if ($ref->{debit_taxkey}{$key} eq $debittaxkey) { |
711 | 583 |
$ref->{debit_tax_accno}{$key} = $taxaccno; |
712 |
} |
|
713 |
$taxaccno = $ref->{debit_tax_accno}{$key};
|
|
584 |
}
|
|
585 |
$taxaccno = $ref->{debit_tax_accno}{$key}; |
|
714 | 586 |
$debittaxkey = $ref->{debit_taxkey}{$key}; |
715 | 587 |
} |
716 |
|
|
717 |
$creditaccno = "";
|
|
588 |
|
|
589 |
$creditaccno = ""; |
|
718 | 590 |
$credittaxkey = ""; |
719 |
$taxaccno = "";
|
|
720 |
foreach $key (sort keys(%{ $ref->{credit_accno} })) {
|
|
591 |
$taxaccno = ""; |
|
592 |
foreach $key (sort keys (%{$ref->{credit_accno}})) {
|
|
721 | 593 |
if ($key == 0) { |
722 |
$creditaccno = |
|
723 |
"<a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{credit_accno}{$key}</a>"; |
|
594 |
$creditaccno = "<a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{credit_accno}{$key}</a>"; |
|
724 | 595 |
} else { |
725 |
$creditaccno .= |
|
726 |
"<br><a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{credit_accno}{$key}</a>"; |
|
596 |
$creditaccno .= "<br><a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{credit_accno}{$key}</a>"; |
|
727 | 597 |
} |
728 | 598 |
if ($ref->{credit_taxkey}{$key} eq $credittaxkey) { |
729 | 599 |
$ref->{credit_tax_accno}{$key} = $taxaccno; |
730 | 600 |
} |
731 |
$taxaccno = $ref->{credit_tax_accno}{$key};
|
|
601 |
$taxaccno = $ref->{credit_tax_accno}{$key}; |
|
732 | 602 |
$credittaxkey = $ref->{credit_taxkey}{$key}; |
733 |
} |
|
734 |
|
|
603 |
}
|
|
604 |
|
|
735 | 605 |
$debittaxaccno = ""; |
736 |
foreach $key (sort keys(%{ $ref->{debit_tax_accno} })) {
|
|
606 |
foreach $key (sort keys (%{$ref->{debit_tax_accno}})) {
|
|
737 | 607 |
if ($key == 0) { |
738 |
$debittaxaccno = |
|
739 |
"<a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{debit_tax_accno}{$key}</a>"; |
|
608 |
$debittaxaccno = "<a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{debit_tax_accno}{$key}</a>"; |
|
740 | 609 |
} else { |
741 |
$debittaxaccno .= |
|
742 |
"<br><a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{debit_tax_accno}{$key}</a>"; |
|
610 |
$debittaxaccno .= "<br><a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{debit_tax_accno}{$key}</a>"; |
|
743 | 611 |
} |
744 | 612 |
} |
745 |
|
|
613 |
|
|
746 | 614 |
$credittaxaccno = ""; |
747 |
foreach $key (sort keys(%{ $ref->{credit_tax_accno} })) {
|
|
615 |
foreach $key (sort keys (%{$ref->{credit_tax_accno}})) {
|
|
748 | 616 |
if ($key == 0) { |
749 |
$credittaxaccno = |
|
750 |
"<a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{credit_tax_accno}{$key}</a>"; |
|
617 |
$credittaxaccno = "<a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{credit_tax_accno}{$key}</a>"; |
|
751 | 618 |
} else { |
752 |
$credittaxaccno .= |
|
753 |
"<br><a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{credit_tax_accno}{$key}</a>"; |
|
619 |
$credittaxaccno .= "<br><a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{credit_tax_accno}{$key}</a>"; |
|
754 | 620 |
} |
755 |
} |
|
756 |
|
|
757 |
# $ref->{debit} = $form->format_amount(\%myconfig, $ref->{debit}, 2, " "); |
|
758 |
# $ref->{credit} = $form->format_amount(\%myconfig, $ref->{credit}, 2, " "); |
|
759 |
|
|
760 |
$column_data{id} = "<td align=right> $ref->{id} </td>"; |
|
761 |
$column_data{transdate} = |
|
762 |
"<td align=center> $ref->{transdate} </td>"; |
|
763 |
$column_data{reference} = |
|
764 |
"<td align=center><a href=$ref->{module}.pl?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{reference}</td>"; |
|
765 |
$column_data{description} = |
|
766 |
"<td align=center>$ref->{description} </td>"; |
|
767 |
$column_data{source} = "<td align=center>$ref->{source} </td>"; |
|
768 |
$column_data{notes} = "<td align=center>$ref->{notes} </td>"; |
|
769 |
$column_data{debit} = "<td align=right>$debit</td>"; |
|
770 |
$column_data{debit_accno} = "<td align=center>$debitaccno</td>"; |
|
771 |
$column_data{credit} = "<td align=right>$credit</td>"; |
|
621 |
} |
|
622 |
# $ref->{debit} = $form->format_amount(\%myconfig, $ref->{debit}, 2, " "); |
|
623 |
# $ref->{credit} = $form->format_amount(\%myconfig, $ref->{credit}, 2, " "); |
|
624 |
|
|
625 |
$column_data{id} = "<td align=right> $ref->{id} </td>"; |
|
626 |
$column_data{transdate} = "<td align=center> $ref->{transdate} </td>"; |
|
627 |
$column_data{reference} = "<td align=center><a href=$ref->{module}.pl?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{reference}</td>"; |
|
628 |
$column_data{description} = "<td align=center>$ref->{description} </td>"; |
|
629 |
$column_data{source} = "<td align=center>$ref->{source} </td>"; |
|
630 |
$column_data{notes} = "<td align=center>$ref->{notes} </td>"; |
|
631 |
$column_data{debit} = "<td align=right>$debit</td>"; |
|
632 |
$column_data{debit_accno} = "<td align=center>$debitaccno</td>"; |
|
633 |
$column_data{credit} = "<td align=right>$credit</td>"; |
|
772 | 634 |
$column_data{credit_accno} = "<td align=center>$creditaccno</td>"; |
773 |
$column_data{debit_tax} = |
|
774 |
($ref->{debit_tax_accno} ne "") |
|
775 |
? "<td align=right>$debittax</td>" |
|
776 |
: "<td></td>"; |
|
635 |
$column_data{debit_tax} = ($ref->{debit_tax_accno} ne "") ? "<td align=right>$debittax</td>" : "<td></td>"; |
|
777 | 636 |
$column_data{debit_tax_accno} = "<td align=center>$debittaxaccno</td>"; |
778 |
$column_data{gifi_accno} = |
|
779 |
"<td><a href=$href&gifi_accno=$ref->{gifi_accno}&callback=$callback>$ref->{gifi_accno}</a> </td>"; |
|
780 |
$column_data{credit_tax} = |
|
781 |
($ref->{credit_tax_accno} ne "") |
|
782 |
? "<td align=right>$credittax</td>" |
|
783 |
: "<td></td>"; |
|
637 |
$column_data{gifi_accno} = "<td><a href=$href&gifi_accno=$ref->{gifi_accno}&callback=$callback>$ref->{gifi_accno}</a> </td>"; |
|
638 |
$column_data{credit_tax} = ($ref->{credit_tax_accno} ne "") ? "<td align=right>$credittax</td>" : "<td></td>"; |
|
784 | 639 |
$column_data{credit_tax_accno} = "<td align=center>$credittaxaccno</td>"; |
785 |
$column_data{gifi_accno} = |
|
786 |
"<td><a href=$href&gifi_accno=$ref->{gifi_accno}&callback=$callback>$ref->{gifi_accno}</a> </td>"; |
|
787 |
$column_data{balance} = |
|
788 |
"<td align=right>" |
|
789 |
. $form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0) |
|
790 |
. "</td>"; |
|
640 |
$column_data{gifi_accno} = "<td><a href=$href&gifi_accno=$ref->{gifi_accno}&callback=$callback>$ref->{gifi_accno}</a> </td>"; |
|
641 |
$column_data{balance} = "<td align=right>".$form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0)."</td>"; |
|
791 | 642 |
|
792 |
$i++; |
|
793 |
$i %= 2; |
|
643 |
$i++; $i %= 2; |
|
794 | 644 |
print " |
795 | 645 |
<tr class=listrow$i>"; |
796 | 646 |
map { print "$column_data{$_}\n" } @column_index; |
797 | 647 |
print "</tr>"; |
798 |
|
|
648 |
|
|
799 | 649 |
} |
800 | 650 |
|
801 |
&gl_subtotal if ($form->{l_subtotal} eq 'Y'); |
|
802 | 651 |
|
803 |
map { $column_data{$_} = "<td> </td>" } @column_index;
|
|
652 |
&gl_subtotal if ($form->{l_subtotal} eq 'Y');
|
|
804 | 653 |
|
805 |
$column_data{debit} = |
|
806 |
"<th align=right class=listtotal>" |
|
807 |
. $form->format_amount(\%myconfig, $totaldebit, 2, " ") . "</th>"; |
|
808 |
$column_data{credit} = |
|
809 |
"<th align=right class=listtotal>" |
|
810 |
. $form->format_amount(\%myconfig, $totalcredit, 2, " ") . "</th>"; |
|
811 |
$column_data{debit_tax} = |
|
812 |
"<th align=right class=listtotal>" |
|
813 |
. $form->format_amount(\%myconfig, $totaldebittax, 2, " ") . "</th>"; |
|
814 |
$column_data{credit_tax} = |
|
815 |
"<th align=right class=listtotal>" |
|
816 |
. $form->format_amount(\%myconfig, $totalcredittax, 2, " ") . "</th>"; |
|
817 |
$column_data{balance} = |
|
818 |
"<th align=right class=listtotal>" |
|
819 |
. $form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0) . "</th>"; |
|
820 | 654 |
|
655 |
map { $column_data{$_} = "<td> </td>" } @column_index; |
|
656 |
|
|
657 |
$column_data{debit} = "<th align=right class=listtotal>".$form->format_amount(\%myconfig, $totaldebit, 2, " ")."</th>"; |
|
658 |
$column_data{credit} = "<th align=right class=listtotal>".$form->format_amount(\%myconfig, $totalcredit, 2, " ")."</th>"; |
|
659 |
$column_data{debit_tax} = "<th align=right class=listtotal>".$form->format_amount(\%myconfig, $totaldebittax, 2, " ")."</th>"; |
|
660 |
$column_data{credit_tax} = "<th align=right class=listtotal>".$form->format_amount(\%myconfig, $totalcredittax, 2, " ")."</th>"; |
|
661 |
$column_data{balance} = "<th align=right class=listtotal>".$form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0)."</th>"; |
|
662 |
|
|
821 | 663 |
print qq| |
822 | 664 |
<tr class=listtotal> |
823 | 665 |
|; |
... | ... | |
845 | 687 |
<input type=hidden name=login value=$form->{login}> |
846 | 688 |
<input type=hidden name=password value=$form->{password}> |
847 | 689 |
|
848 |
<input class=submit type=submit name=action value="| |
|
849 |
. $locale->text('GL Transaction') . qq|"> |
|
850 |
<input class=submit type=submit name=action value="| |
|
851 |
. $locale->text('AR Transaction') . qq|"> |
|
852 |
<input class=submit type=submit name=action value="| |
|
853 |
. $locale->text('AP Transaction') . qq|"> |
|
854 |
<input class=submit type=submit name=action value="| |
|
855 |
. $locale->text('Sales Invoice') . qq|"> |
|
856 |
<input class=submit type=submit name=action value="| |
|
857 |
. $locale->text('Vendor Invoice') . qq|">|; |
|
690 |
<input class=submit type=submit name=action value="|.$locale->text('GL Transaction').qq|"> |
|
691 |
<input class=submit type=submit name=action value="|.$locale->text('AR Transaction').qq|"> |
|
692 |
<input class=submit type=submit name=action value="|.$locale->text('AP Transaction').qq|"> |
|
693 |
<input class=submit type=submit name=action value="|.$locale->text('Sales Invoice').qq|"> |
|
694 |
<input class=submit type=submit name=action value="|.$locale->text('Vendor Invoice').qq|">|; |
|
695 |
|
|
858 | 696 |
|
859 | 697 |
if ($form->{menubar}) { |
860 | 698 |
require "$form->{path}/menu.pl"; |
... | ... | |
869 | 707 |
</html> |
870 | 708 |
|; |
871 | 709 |
|
872 |
$lxdebug->leave_sub(); |
|
873 | 710 |
} |
874 | 711 |
|
875 |
sub gl_subtotal { |
|
876 |
$lxdebug->enter_sub(); |
|
877 |
|
|
878 |
$subtotaldebit = |
|
879 |
$form->format_amount(\%myconfig, $subtotaldebit, 2, " "); |
|
880 |
$subtotalcredit = |
|
881 |
$form->format_amount(\%myconfig, $subtotalcredit, 2, " "); |
|
882 | 712 |
|
883 |
map { $column_data{$_} = "<td> </td>" } |
|
884 |
qw(transdate id reference source description accno); |
|
885 |
$column_data{debit} = "<th align=right>$subtotaldebit</td>"; |
|
713 |
sub gl_subtotal { |
|
714 |
|
|
715 |
$subtotaldebit = $form->format_amount(\%myconfig, $subtotaldebit, 2, " "); |
|
716 |
$subtotalcredit = $form->format_amount(\%myconfig, $subtotalcredit, 2, " "); |
|
717 |
|
|
718 |
map { $column_data{$_} = "<td> </td>" } qw(transdate id reference source description accno); |
|
719 |
$column_data{debit} = "<th align=right>$subtotaldebit</td>"; |
|
886 | 720 |
$column_data{credit} = "<th align=right>$subtotalcredit</td>"; |
887 | 721 |
|
722 |
|
|
888 | 723 |
print "<tr class=listsubtotal>"; |
889 | 724 |
map { print "$column_data{$_}\n" } @column_index; |
890 | 725 |
print "</tr>"; |
891 | 726 |
|
892 |
$subtotaldebit = 0;
|
|
727 |
$subtotaldebit = 0; |
|
893 | 728 |
$subtotalcredit = 0; |
894 | 729 |
|
895 |
$sameitem = $ref->{ $form->{sort} }; |
|
896 |
|
|
897 |
$lxdebug->leave_sub(); |
|
730 |
$sameitem = $ref->{$form->{sort}}; |
|
898 | 731 |
|
899 |
return $sameitem; |
|
900 | 732 |
} |
901 | 733 |
|
734 |
|
|
902 | 735 |
sub update { |
903 |
$lxdebug->enter_sub(); |
|
904 |
|
|
905 |
@a = (); |
|
906 |
$count = 0; |
|
907 |
@flds = (qw(accno debit credit projectnumber project_id oldprojectnumber)); |
|
908 |
$credit_save = $form->{credit}; |
|
909 |
$debit_save = $form->{debit}; |
|
910 |
|
|
911 |
if ($form->{chart} eq "") { |
|
912 |
$form->{creditchart} = |
|
913 |
"<option>" . $form->{creditchartselected} . "</option>"; |
|
914 |
$form->{debitchart} = |
|
915 |
"<option>" . $form->{debitchartselected} . "</option>"; |
|
916 |
} else { |
|
917 |
$form->{creditchart} = $form->{chart}; |
|
918 |
$form->{creditchart} =~ |
|
919 |
s/value=\"$form->{creditchartselected}\"/value=\"$form->{creditchartselected}\" selected/; |
|
920 | 736 |
|
921 |
$form->{debitchart} = $form->{chart}; |
|
922 |
$form->{debitchart} =~ |
|
923 |
s/value=\"$form->{debitchartselected}\"/value=\"$form->{debitchartselected}\" selected/; |
|
737 |
if ($form->{transdate} ne $form->{oldtransdate}) { |
|
738 |
if ($form->{selectprojectnumber}) { |
|
739 |
$form->all_projects(\%myconfig, undef, $form->{transdate}); |
|
740 |
if (@{ $form->{all_project} }) { |
|
741 |
$form->{selectprojectnumber} = "<option>\n"; |
|
742 |
for (@{ $form->{all_project} }) { $form->{selectprojectnumber} .= qq|<option value="$_->{projectnumber}--$_->{id}">$_->{projectnumber}\n| } |
|
743 |
$form->{selectprojectnumber} = $form->escape($form->{selectprojectnumber},1); |
|
744 |
} |
|
745 |
} |
|
746 |
$form->{oldtransdate} = $form->{transdate}; |
|
924 | 747 |
} |
925 |
($debitaccno, $debittaxkey) = split(/--/, $form->{debitchartselected}); |
|
926 |
($creditaccno, $credittaxkey) = split(/--/, $form->{creditchartselected}); |
|
927 |
if ($debittaxkey > 0) { |
|
928 |
$form->{taxchart} = $form->unescape($form->{taxchart}); |
|
929 |
$form->{taxchart} =~ s/selected//ig; |
|
930 |
$form->{taxchart} =~ |
|
931 |
s/\"$debittaxkey--([^\"]*)\"/\"$debittaxkey--$1\" selected/; |
|
932 |
|
|
933 |
$rate = $1; |
|
934 |
|
|
935 |
if ($form->{taxincluded}) { |
|
936 |
$form->{debit} = |
|
937 |
$form->parse_amount(\%myconfig, $form->{amount}) / ($rate + 1); |
|
938 |
$form->{credit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1; |
|
939 |
$form->{tax} = |
|
940 |
$form->parse_amount(\%myconfig, $form->{amount}) / ($rate + 1) * $rate; |
|
941 |
} else { |
|
942 |
$form->{debit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1; |
|
943 |
$form->{credit} = |
|
944 |
$form->parse_amount(\%myconfig, $form->{amount}) * ($rate + 1); |
|
945 |
$form->{tax} = $form->parse_amount(\%myconfig, $form->{amount}) * $rate; |
|
748 |
|
|
749 |
my @a = (); |
|
750 |
my $count = 0; |
|
751 |
my $debittax = 0; |
|
752 |
my $credittax = 0; |
|
753 |
my @flds = qw(accno debit credit projectnumber fx_transaction source memo tax taxchart); |
|
754 |
|
|
755 |
for my $i (1 .. $form->{rowcount}) { |
|
756 |
|
|
757 |
unless (($form->{"debit_$i"} eq "") && ($form->{"credit_$i"} eq "")) { |
|
758 |
for (qw(debit credit tax)) { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } |
|
759 |
|
|
760 |
push @a, {}; |
|
761 |
$debitcredit = ($form->{"debit_$i"} == 0) ? "0" : "1"; |
|
762 |
$amount = ($form->{"debit_$i"} == 0) ? $form->{"credit_$i"} : $form->{"debit_$i"}; |
|
763 |
$j = $#a; |
|
764 |
if (($debitcredit && $credittax) || (!$debitcredit && $debittax)) { |
|
765 |
$form->{"taxchart_$i"} = "0--"; |
|
766 |
$form->{"tax_$i"} = 0; |
|
767 |
} |
|
768 |
if (!$form->{"korrektur_$i"}) { |
|
769 |
($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"}); |
|
770 |
if ($taxkey > 1) { |
|
771 |
if ($debitcredit) { |
|
772 |
$debittax = 1; |
|
773 |
} else { |
|
774 |
$credittax = 1; |
|
775 |
} |
|
776 |
if ($form->{taxincluded}) { |
|
777 |
$form->{"tax_$i"} = $amount / ($rate + 1) * $rate; |
|
778 |
} else { |
|
779 |
$form->{"tax_$i"} = $amount * $rate; |
|
780 |
} |
|
781 |
} else { |
|
782 |
$form->{"tax_$i"} = 0; |
|
783 |
} |
|
784 |
} |
|
785 |
|
|
786 |
for (@flds) { $a[$j]->{$_} = $form->{"${_}_$i"} } |
|
787 |
$count++; |
|
946 | 788 |
} |
947 |
} else { |
|
948 |
$form->{taxchart} = $form->unescape($form->{taxchart}); |
|
949 |
$form->{taxchart} =~ s/selected//ig; |
|
950 |
$form->{taxchart} =~ |
|
951 |
s/\"$credittaxkey--([^\"]*)\"/\"$credittaxkey--$1\" selected/; |
|
952 |
$rate = $1; |
|
789 |
} |
|
953 | 790 |
|
954 |
if ($form->{taxincluded}) { |
|
955 |
$form->{debit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1; |
|
956 |
$form->{credit} = |
|
957 |
$form->parse_amount(\%myconfig, $form->{amount}) / ($rate + 1); |
|
958 |
$form->{tax} = |
|
959 |
$form->parse_amount(\%myconfig, $form->{amount}) / ($rate + 1) * $rate; |
|
960 |
} else { |
|
961 |
$form->{debit} = |
|
962 |
$form->parse_amount(\%myconfig, $form->{amount}) * ($rate + 1); |
|
963 |
$form->{credit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1; |
|
964 |
$form->{tax} = $form->parse_amount(\%myconfig, $form->{amount}) * $rate; |
|
965 |
} |
|
791 |
|
|
792 |
for $i (1 .. $count) { |
|
793 |
$j = $i - 1; |
|
794 |
for (@flds) { $form->{"${_}_$i"} = $a[$j]->{$_} } |
|
966 | 795 |
} |
967 |
if ($form->{credit_splited}) { |
|
968 |
$form->{debit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1; |
|
969 |
$form->{credit} = $credit_save; |
|
970 |
$form->{tax} = 0; |
|
971 |
} elsif ($form->{debit_splited}) { |
|
972 |
$form->{credit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1; |
|
973 |
$form->{debit} = $debit_save; |
|
974 |
$form->{tax} = 0; |
|
796 |
|
|
797 |
for $i ($count + 1 .. $form->{rowcount}) { |
|
798 |
for (@flds) { delete $form->{"${_}_$i"} } |
|
975 | 799 |
} |
976 |
&check_project; |
|
977 | 800 |
|
978 |
&display_form;
|
|
801 |
$form->{rowcount} = $count + 1;
|
|
979 | 802 |
|
980 |
$lxdebug->leave_sub(); |
|
803 |
&display_form; |
|
804 |
|
|
981 | 805 |
} |
982 | 806 |
|
807 |
|
|
983 | 808 |
sub display_form { |
984 |
$lxdebug->enter_sub(); |
|
809 |
my ($init) = @_; |
|
810 |
|
|
811 |
&form_header($init); |
|
812 |
# for $i (1 .. $form->{rowcount}) { |
|
813 |
# $form->{totaldebit} += $form->parse_amount(\%myconfig, $form->{"debit_$i"}); |
|
814 |
# $form->{totalcredit} += $form->parse_amount(\%myconfig, $form->{"credit_$i"}); |
|
815 |
# |
|
816 |
# &form_row($i); |
|
817 |
# } |
|
818 |
&display_rows($init); |
|
819 |
&form_footer; |
|
985 | 820 |
|
986 |
&form_header;
|
|
821 |
}
|
|
987 | 822 |
|
988 |
# for $i (1 .. $form->{rowcount}) { |
|
989 |
# $form->{totaldebit} += $form->parse_amount(\%myconfig, $form->{"debit_$i"}); |
|
990 |
# $form->{totalcredit} += $form->parse_amount(\%myconfig, $form->{"credit_$i"}); |
|
991 |
# |
|
992 |
# &form_row($i); |
|
993 |
# } |
|
994 | 823 |
|
995 |
&form_footer; |
|
824 |
sub display_rows { |
|
825 |
my ($init) = @_; |
|
826 |
|
|
827 |
$form->{selectprojectnumber} = $form->unescape($form->{selectprojectnumber}) if $form->{selectprojectnumber}; |
|
828 |
|
|
829 |
$form->{totaldebit} = 0; |
|
830 |
$form->{totalcredit} = 0; |
|
831 |
my $chart= $form->{chart}; |
|
832 |
$chart = $form->unquote($chart); |
|
833 |
$form->{taxchart} = $form->unquote($form->{taxchart}); |
|
834 |
$taxchart = $form->{taxchart}; |
|
835 |
for $i (1 .. $form->{rowcount}) { |
|
836 |
|
|
837 |
$source = qq| |
|
838 |
<td><input name="source_$i" value="$form->{"source_$i"}" tabindex=|.($i+11+(($i-1)*8)).qq|></td>|; |
|
839 |
$memo = qq| |
|
840 |
<td><input name="memo_$i" value="$form->{"memo_$i"}" tabindex=|.($i+12+(($i-1)*8)).qq|></td>|; |
|
841 |
|
|
842 |
if ($init) { |
|
843 |
$accno = qq| |
|
844 |
<td><select name="accno_$i" onChange="setTaxkey(this, $i)" style="width:300px" tabindex=|.($i+5+(($i-1)*8)).qq|>$form->{chartinit}</select></td>|; |
|
845 |
$tax = qq|<td><select id="taxchart_$i" name="taxchart_$i" tabindex=|.($i+10+(($i-1)*8)).qq|>$form->{taxchart}</select></td>|; |
|
846 |
if ($form->{selectprojectnumber}) { |
|
847 |
$project = qq| |
|
848 |
<td><select name="projectnumber_$i">$form->{selectprojectnumber}</select></td>|; |
|
849 |
} |
|
850 |
$korrektur = qq|<td><input type="checkbox" name="korrektur_$i" value="1" tabindex=|.($i+9+(($i-1)*8)).qq|></td>|; |
|
851 |
if ($form->{transfer}) { |
|
852 |
$fx_transaction = qq| |
|
853 |
<td><input name="fx_transaction_$i" class=checkbox type=checkbox value=1></td> |
|
854 |
|; |
|
855 |
} |
|
996 | 856 |
|
997 |
$lxdebug->leave_sub(); |
|
998 |
} |
|
857 |
} else { |
|
858 |
|
|
859 |
$form->{totaldebit} += $form->{"debit_$i"}; |
|
860 |
$form->{totalcredit} += $form->{"credit_$i"}; |
|
861 |
|
|
862 |
for (qw(debit credit tax)) { $form->{"${_}_$i"} = ($form->{"${_}_$i"}) ? $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) : "" } |
|
863 |
|
|
864 |
if ($i < $form->{rowcount}) { |
|
865 |
|
|
866 |
$accno = $chart; |
|
867 |
$chart_selected = $form->{"accno_$i"}; |
|
868 |
$accno =~ s/value=\"$chart_selected\"/value=\"$chart_selected\" selected/; |
|
869 |
$accno = qq|<td><select name="accno_$i" onChange="setTaxkey(this, $i)" style="width:300px" tabindex=|.($i+5+(($i-1)*8)).qq|>$accno</select></td>|; |
|
870 |
$tax = $taxchart; |
|
871 |
$tax_selected = $form->{"taxchart_$i"}; |
|
872 |
$tax =~ s/value=\"$tax_selected\"/value=\"$tax_selected\" selected/; |
|
873 |
$tax = qq|<td><select id="taxchart_$i" name="taxchart_$i" tabindex=|.($i+10+(($i-1)*8)).qq|>$tax</select></td>|; |
|
874 |
if ($form->{selectprojectnumber}) { |
|
875 |
$form->{"projectnumber_$i"} = "" if $form->{selectprojectnumber} !~ /$form->{"projectnumber_$i"}/; |
|
876 |
|
|
877 |
$project = $form->{"projectnumber_$i"}; |
|
878 |
$project =~ s/--.*//; |
|
879 |
$project = qq|<td>$project</td>|; |
|
880 |
} |
|
881 |
|
|
882 |
if ($form->{transfer}) { |
|
883 |
$checked = ($form->{"fx_transaction_$i"}) ? "1" : ""; |
|
884 |
$x = ($checked) ? "x" : ""; |
|
885 |
$fx_transaction = qq| |
|
886 |
<td><input type=hidden name="fx_transaction_$i" value="$checked">$x</td> |
|
887 |
|; |
|
888 |
} |
|
889 |
$checked = ($form->{"korrektur_$i"}) ? "checked" : ""; |
|
890 |
$korrektur = qq|<td><input type="checkbox" name="korrektur_$i" value="1" $checked tabindex=|.($i+9+(($i-1)*8)).qq|></td>|; |
|
891 |
$form->hide_form("accno_$i", "projectnumber_$i"); |
|
892 |
|
|
893 |
} else { |
|
894 |
|
|
895 |
$accno = qq| |
|
896 |
<td><select name="accno_$i" onChange="setTaxkey(this, $i)" style="width:300px" tabindex=|.($i+5+(($i-1)*8)).qq|>$chart</select></td>|; |
|
897 |
$tax = qq| |
|
898 |
<td><select id="taxchart_$i" name="taxchart_$i" tabindex=|.($i+10+(($i-1)*8)).qq|>$taxchart</select></td>|; |
|
899 |
if ($form->{selectprojectnumber}) { |
|
900 |
$project = qq| |
|
901 |
<td><select name="projectnumber_$i">$form->{selectprojectnumber}</select></td>|; |
|
902 |
} |
|
903 |
$korrektur = qq|<td><input type="checkbox" name="korrektur_$i" value="1" tabindex=|.($i+9+(($i-1)*8)).qq|></td>|; |
|
904 |
if ($form->{transfer}) { |
|
905 |
$fx_transaction = qq| |
|
906 |
<td><input name="fx_transaction_$i" class=checkbox type=checkbox value=1></td> |
|
907 |
|; |
|
908 |
} |
|
909 |
} |
|
910 |
} |
|
911 |
|
|
912 |
print qq|<tr valign=top> |
|
913 |
$accno |
|
914 |
$fx_transaction |
|
915 |
<td><input name="debit_$i" size=10 value="$form->{"debit_$i"}" accesskey=$i tabindex=|.($i+6+(($i-1)*8)).qq|></td> |
|
916 |
<td><input name="credit_$i" size=10 value="$form->{"credit_$i"}" tabindex=|.($i+7+(($i-1)*8)).qq|></td> |
|
917 |
<td><input name="tax_$i" size=8 value="$form->{"tax_$i"}" tabindex=|.($i+8+(($i-1)*8)).qq|></td> |
|
918 |
$korrektur |
|
919 |
$tax |
|
920 |
$source |
|
921 |
$memo |
|
922 |
$project |
|
923 |
</tr> |
|
999 | 924 |
|
1000 |
sub form_header {
|
|
1001 |
$lxdebug->enter_sub();
|
|
925 |
|;
|
|
926 |
}
|
|
1002 | 927 |
|
1003 |
$title = $form->{title};
|
|
1004 |
$form->{title} = $locale->text("$title General Ledger Transaction");
|
|
1005 |
$readonly = ($form->{id}) ? "readonly" : "";
|
|
928 |
$form->hide_form(qw(rowcount selectaccno));
|
|
929 |
print qq|
|
|
930 |
<input type=hidden name=selectprojectnumber value="|.$form->escape($form->{selectprojectnumber},1).qq|">|;
|
|
1006 | 931 |
|
1007 |
$form->{urldebit} = |
|
1008 |
"$form->{script}?action=split_debit&path=$form->{path}&login=$form->{login}&password=$form->{password}"; |
|
1009 |
$form->{urlcredit} = |
|
1010 |
"$form->{script}?action=split_credit&path=$form->{path}&login=$form->{login}&password=$form->{password}"; |
|
932 |
} |
|
1011 | 933 |
|
1012 |
# $locale->text('Add General Ledger Transaction') |
|
1013 |
# $locale->text('Edit General Ledger Transaction') |
|
1014 |
map { $form->{$_} =~ s/\"/"/g } qw(reference description chart); |
|
934 |
sub form_header { |
|
935 |
my ($init) = @_; |
|
936 |
$title = $form->{title}; |
|
937 |
$form->{title} = $locale->text("$title General Ledger Transaction"); |
|
938 |
$readonly = ($form->{id}) ? "readonly" : ""; |
|
939 |
|
|
940 |
|
|
941 |
# $locale->text('Add General Ledger Transaction') |
|
942 |
# $locale->text('Edit General Ledger Transaction') |
|
943 |
|
|
944 |
map { $form->{$_} =~ s/\"/"/g } qw(reference description chart taxchart); |
|
945 |
$form->{javascript} = qq|<script type="text/javascript"> |
|
946 |
<!-- |
|
947 |
function setTaxkey(accno, row) { |
|
948 |
var taxkey = accno.options[accno.selectedIndex].value; |
|
949 |
var reg = /--([0-9])*/; |
|
950 |
var found = reg.exec(taxkey); |
|
951 |
var index = found[1]; |
|
952 |
index = parseInt(index); |
|
953 |
var tax = 'taxchart_' + row; |
|
954 |
for (var i = 0; i < document.getElementById(tax).options.length; ++i) { |
|
955 |
var reg2 = new RegExp("^"+ index, ""); |
|
956 |
if (reg2.exec(document.getElementById(tax).options[i].value)) { |
|
957 |
document.getElementById(tax).options[i].selected = true; |
|
958 |
break; |
|
959 |
} |
|
960 |
} |
|
961 |
}; |
|
962 |
//--> |
|
963 |
</script>|; |
|
1015 | 964 |
|
1016 | 965 |
$form->{selectdepartment} =~ s/ selected//; |
1017 |
$form->{taxchart} =~ s/ selected//; |
|
1018 |
$form->{selectdepartment} =~ |
|
1019 |
s/option>\Q$form->{department}\E/option selected>$form->{department}/; |
|
966 |
$form->{selectdepartment} =~ s/option>\Q$form->{department}\E/option selected>$form->{department}/; |
|
1020 | 967 |
|
1021 | 968 |
if (($rows = $form->numtextrows($form->{description}, 50)) > 1) { |
1022 |
$description = |
|
1023 |
qq|<textarea name=description rows=$rows cols=50 wrap=soft $readonly >$form->{description}</textarea>|; |
|
969 |
$description = qq|<textarea name=description rows=$rows cols=50 wrap=soft $readonly >$form->{description}</textarea>|; |
|
1024 | 970 |
} else { |
1025 |
$description = |
|
1026 |
qq|<input name=description size=50 value="$form->{description}" tabindex="3" $readonly>|; |
|
971 |
$description = qq|<input name=description size=50 value="$form->{description}" tabindex="3" $readonly>|; |
|
1027 | 972 |
} |
1028 |
|
|
973 |
|
|
1029 | 974 |
$taxincluded = ($form->{taxincluded}) ? "checked" : ""; |
1030 |
|
|
1031 |
if (!$form->{id}) {
|
|
1032 |
$taxincluded = "checked";
|
|
975 |
|
|
976 |
if ($init) {
|
|
977 |
$taxincluded = "checked";
|
|
1033 | 978 |
} |
1034 |
|
|
1035 |
$amount = |
|
1036 |
qq|<input name=amount size=20 value="$form->{amount}" tabindex="4" $readonly>|; |
|
1037 |
|
|
979 |
|
|
980 |
$amount = qq|<input name=amount size=20 value="$form->{amount}" tabindex="4" $readonly>|;
|
|
981 |
|
|
982 |
|
|
1038 | 983 |
$department = qq| |
1039 | 984 |
<tr> |
1040 |
<th align=right nowrap>| . $locale->text('Department') . qq|</th>
|
|
985 |
<th align=right nowrap>|.$locale->text('Department').qq|</th>
|
|
1041 | 986 |
<td colspan=3><select name=department>$form->{selectdepartment}</select></td> |
1042 | 987 |
<input type=hidden name=selectdepartment value="$form->{selectdepartment}"> |
1043 | 988 |
</tr> |
1044 | 989 |
| if $form->{selectdepartment}; |
1045 |
|
|
1046 |
$form->{fokus} = "gl.reference"; |
|
1047 |
$form->{remote} = 1; |
|
1048 |
|
|
990 |
if ($init) { |
|
991 |
$form->{fokus} = "gl.reference"; |
|
992 |
} else { |
|
993 |
$form->{fokus} = qq|gl.accno_$form->{rowcount}|; |
|
994 |
} |
|
995 |
|
|
1049 | 996 |
# use JavaScript Calendar or not |
1050 | 997 |
$form->{jsscript} = $jscalendar; |
1051 | 998 |
$jsscript = ""; |
1052 |
if ($form->{jsscript}) {
|
|
1053 |
|
|
999 |
if ($form->{jsscript}) |
|
1000 |
{ |
|
1054 | 1001 |
# with JavaScript Calendar |
1055 | 1002 |
$button1 = qq| |
1056 |
<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate} tabindex="2" $readonly></td> |
|
1057 |
<td><input type=button name=transdate id="trigger1" value=| |
|
1058 |
. $locale->text('button') |
|
1059 |
. qq|></td> |
|
1003 |
<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate} tabindex="2" $readonly> |
|
1004 |
<input type=button name=transdate id="trigger1" value=|.$locale->text('button').qq|></td> |
|
1060 | 1005 |
|; |
1061 |
|
|
1062 |
#write Trigger |
|
1063 |
$jsscript = |
|
1064 |
Form->write_trigger(\%myconfig, "1", "transdate", "BL", "trigger1", "", |
|
1065 |
"", ""); |
|
1066 |
} else { |
|
1067 |
|
|
1068 |
# without JavaScript Calendar |
|
1069 |
$button1 = |
|
1070 |
qq|<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate} tabindex="2" $readonly></td>|; |
|
1071 |
} |
|
1072 |
|
|
1006 |
#write Trigger |
|
1007 |
$jsscript = Form->write_trigger(\%myconfig,"1","transdate","BL","trigger1","","",""); |
|
1008 |
} |
|
1009 |
else |
|
1010 |
{ |
|
1011 |
# without JavaScript Calendar |
|
1012 |
$button1 = qq|<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate} tabindex="2" $readonly></td>|; |
|
1013 |
} |
|
1014 |
|
|
1073 | 1015 |
$form->header; |
1074 | 1016 |
|
1017 |
|
|
1075 | 1018 |
print qq| |
1076 | 1019 |
<body onLoad="fokus()"> |
1077 | 1020 |
|
... | ... | |
1082 | 1025 |
<input type=hidden name=closedto value=$form->{closedto}> |
1083 | 1026 |
<input type=hidden name=locked value=$form->{locked}> |
1084 | 1027 |
<input type=hidden name=title value="$title"> |
1085 |
<input type=hidden name=taxchart value=| |
|
1086 |
. $form->escape($form->{taxchart}) . qq|> |
Auch abrufbar als: Unified diff
Buchungsjournal um Anzeige von Splitbuchungen erweitert, Splitbuchungen beim Dialogbuchen zu 80% fertig. Neue Maske fuer Splitbuchungen