Revision eca3a478
Von Sven Schöling vor fast 13 Jahren hinzugefügt
bin/mozilla/gl.pl | ||
---|---|---|
211 | 211 |
|
212 | 212 |
|
213 | 213 |
sub search { |
214 |
$main::lxdebug->enter_sub(); |
|
215 |
|
|
216 |
$main::auth->assert('general_ledger'); |
|
217 |
|
|
218 |
my $form = $main::form; |
|
219 |
my %myconfig = %main::myconfig; |
|
220 |
my $locale = $main::locale; |
|
221 |
my $cgi = $::request->{cgi}; |
|
222 |
|
|
223 |
$form->{title} = $locale->text('Journal'); |
|
224 |
|
|
225 |
$form->all_departments(\%myconfig); |
|
226 |
|
|
227 |
# departments |
|
228 |
if (@{ $form->{all_departments} || [] }) { |
|
229 |
$form->{selectdepartment} = "<option>\n"; |
|
230 |
|
|
231 |
map { |
|
232 |
$form->{selectdepartment} .= |
|
233 |
"<option>$_->{description}--$_->{id}\n" |
|
234 |
} (@{ $form->{all_departments} || [] }); |
|
235 |
} |
|
236 |
|
|
237 |
my $department; |
|
238 |
$department = qq| |
|
239 |
<tr> |
|
240 |
<th align=right nowrap>| . $locale->text('Department') . qq|</th> |
|
241 |
<td colspan=3><select name=department>$form->{selectdepartment}</select></td> |
|
242 |
</tr> |
|
243 |
| if $form->{selectdepartment}; |
|
244 |
|
|
245 |
$form->get_lists("projects" => { "key" => "ALL_PROJECTS", |
|
246 |
"all" => 1}, |
|
247 |
"employees" => "ALL_EMPLOYEES" ); |
|
248 |
|
|
249 |
my %project_labels = (); |
|
250 |
my @project_values = (""); |
|
251 |
foreach my $item (@{ $form->{"ALL_PROJECTS"} }) { |
|
252 |
push(@project_values, $item->{"id"}); |
|
253 |
$project_labels{$item->{"id"}} = $item->{"projectnumber"}; |
|
254 |
} |
|
255 |
|
|
256 |
my $projectnumber = |
|
257 |
NTI($cgi->popup_menu('-name' => "project_id", |
|
258 |
'-values' => \@project_values, |
|
259 |
'-labels' => \%project_labels)); |
|
260 |
|
|
261 |
my %employee_labels = (); |
|
262 |
my @employee_values = (""); |
|
263 |
foreach my $item (@{ $form->{"ALL_EMPLOYEES"} }) { |
|
264 |
# value in Form "1234--Name" ?bergeben |
|
265 |
my $id = "$item->{'id'}--$item->{'name'}"; |
|
266 |
push(@employee_values, "$id"); |
|
267 |
$employee_labels{$id} = $item->{"name"}; |
|
268 |
} |
|
269 |
|
|
270 |
my $employeenumber = |
|
271 |
NTI($cgi->popup_menu('-name' => "employee", |
|
272 |
'-values' => \@employee_values, |
|
273 |
'-labels' => \%employee_labels)); |
|
214 |
$::lxdebug->enter_sub; |
|
215 |
$::auth->assert('general_ledger'); |
|
274 | 216 |
|
275 |
# use JavaScript Calendar or not |
|
276 |
$form->{jsscript} = 1; |
|
277 |
my $jsscript = ""; |
|
278 |
my ($button1, $button2, $onload); |
|
279 |
if ($form->{jsscript}) { |
|
280 |
|
|
281 |
# with JavaScript Calendar |
|
282 |
$button1 = qq| |
|
283 |
<td><input name=datefrom id=datefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"> |
|
284 |
<input type=button name=datefrom id="trigger1" value=| |
|
285 |
. $locale->text('button') . qq|></td> |
|
286 |
|; |
|
287 |
$button2 = qq| |
|
288 |
<td><input name=dateto id=dateto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"> |
|
289 |
<input type=button name=dateto id="trigger2" value=| |
|
290 |
. $locale->text('button') . qq|></td> |
|
291 |
|; |
|
292 |
|
|
293 |
#write Trigger |
|
294 |
$jsscript = |
|
295 |
Form->write_trigger(\%myconfig, "2", "datefrom", "BR", "trigger1", |
|
296 |
"dateto", "BL", "trigger2"); |
|
297 |
} else { |
|
298 |
|
|
299 |
# without JavaScript Calendar |
|
300 |
$button1 = |
|
301 |
qq|<td><input name=datefrom id=datefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|; |
|
302 |
$button2 = |
|
303 |
qq|<td><input name=dateto id=dateto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|; |
|
304 |
} |
|
305 |
$form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|; |
|
306 |
$form->header; |
|
307 |
$onload = qq|focus()|; |
|
308 |
$onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|; |
|
309 |
$onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|; |
|
310 |
print qq| |
|
311 |
<body onLoad="$onload"> |
|
312 |
|
|
313 |
<form method=post action=gl.pl> |
|
314 |
|
|
315 |
<input type=hidden name=sort value=datesort> |
|
316 |
|
|
317 |
<table width=100%> |
|
318 |
<tr> |
|
319 |
<th class=listtop>$form->{title}</th> |
|
320 |
</tr> |
|
321 |
<tr height="5"></tr> |
|
322 |
<tr> |
|
323 |
<td> |
|
324 |
<table> |
|
325 |
<tr> |
|
326 |
<th align=right>| . $locale->text('Reference') . qq|</th> |
|
327 |
<td><input name=reference size=20></td> |
|
328 |
<th align=right>| . $locale->text('Source') . qq|</th> |
|
329 |
<td><input name=source size=20></td> |
|
330 |
</tr> |
|
331 |
$department |
|
332 |
<tr> |
|
333 |
<th align=right>| . $locale->text('Description') . qq|</th> |
|
334 |
<td><input name=description size=40></td> |
|
335 |
<th align=right>| . $locale->text('Account Number') . qq|</th> |
|
336 |
<td><input name=accno size=20></td> |
|
337 |
</tr> |
|
338 |
<tr> |
|
339 |
<th align=right>| . $locale->text('Notes') . qq|</th> |
|
340 |
<td colspan=3><input name=notes size=40></td> |
|
341 |
</tr> |
|
342 |
<tr> |
|
343 |
<th align=right>| . $locale->text('Project Number') . qq|</th> |
|
344 |
<td colspan=3>$projectnumber</td> |
|
345 |
</tr> |
|
346 |
<tr> |
|
347 |
<th align=right>| . $locale->text('Employee') . qq|</th> |
|
348 |
<td colspan=3>$employeenumber</td> |
|
349 |
</tr> |
|
350 |
<tr> |
|
351 |
<th align=right>| . $locale->text('Filter date by') . qq|</th> |
|
352 |
<td colspan=3> |
|
353 |
<input name=datesort class=radio type=radio value=gldate checked> | . $locale->text('Booking Date') . qq| |
|
354 |
<input name=datesort class=radio type=radio value=transdate> | . $locale->text('Invoice Date') . qq| |
|
355 |
</td> |
|
356 |
</tr> |
|
357 |
<tr> |
|
358 |
<th align=right>| . $locale->text('From') . qq|</th> |
|
359 |
$button1 |
|
360 |
<th align=right>| . $locale->text('To (time)') . qq|</th> |
|
361 |
$button2 |
|
362 |
</tr> |
|
363 |
<tr> |
|
364 |
<th align=right>| . $locale->text('Include in Report') . qq|</th> |
|
365 |
<td colspan=3> |
|
366 |
<table> |
|
367 |
<tr> |
|
368 |
<td> |
|
369 |
<input name="category" class=radio type=radio value=X checked> | |
|
370 |
. $locale->text('All') . qq| |
|
371 |
<input name="category" class=radio type=radio value=A> | |
|
372 |
. $locale->text('Asset') . qq| |
|
373 |
<input name="category" class=radio type=radio value=L> | |
|
374 |
. $locale->text('Liability') . qq| |
|
375 |
<input name="category" class=radio type=radio value=I> | |
|
376 |
. $locale->text('Revenue') . qq| |
|
377 |
<input name="category" class=radio type=radio value=E> | |
|
378 |
. $locale->text('Expense') . qq| |
|
379 |
</td> |
|
380 |
</tr> |
|
381 |
<tr> |
|
382 |
<table> |
|
383 |
<tr> |
|
384 |
<td align=right><input name="l_id" class=checkbox type=checkbox value=Y></td> |
|
385 |
<td>| . $locale->text('ID') . qq|</td> |
|
386 |
<td align=right><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td> |
|
387 |
<td>| . $locale->text('Invoice Date') . qq|</td> |
|
388 |
<td align=right><input name="l_gldate" class=checkbox type=checkbox value=Y checked></td> |
|
389 |
<td>| . $locale->text('Booking Date') . qq|</td> |
|
390 |
<td align=right><input name="l_reference" class=checkbox type=checkbox value=Y checked></td> |
|
391 |
<td>| . $locale->text('Reference') . qq|</td> |
|
392 |
<td align=right><input name="l_description" class=checkbox type=checkbox value=Y checked></td> |
|
393 |
<td>| . $locale->text('Description') . qq|</td> |
|
394 |
<td align=right><input name="l_notes" class=checkbox type=checkbox value=Y></td> |
|
395 |
<td>| . $locale->text('Notes') . qq|</td> |
|
396 |
</tr> |
|
397 |
<tr> |
|
398 |
<td align=right><input name="l_debit" class=checkbox type=checkbox value=Y checked></td> |
|
399 |
<td>| . $locale->text('Debit') . qq|</td> |
|
400 |
<td align=right><input name="l_credit" class=checkbox type=checkbox value=Y checked></td> |
|
401 |
<td>| . $locale->text('Credit') . qq|</td> |
|
402 |
<td align=right><input name="l_source" class=checkbox type=checkbox value=Y checked></td> |
|
403 |
<td>| . $locale->text('Source') . qq|</td> |
|
404 |
<td align=right><input name="l_accno" class=checkbox type=checkbox value=Y checked></td> |
|
405 |
<td>| . $locale->text('Account') . qq|</td> |
|
406 |
</tr> |
|
407 |
<tr> |
|
408 |
<td align=right><input name="l_subtotal" class=checkbox type=checkbox value=Y></td> |
|
409 |
<td>| . $locale->text('Subtotal') . qq|</td> |
|
410 |
<td align=right><input name="l_projectnumbers" class=checkbox type=checkbox value=Y></td> |
|
411 |
<td>| . $locale->text('Project Number') . qq|</td> |
|
412 |
<td align=right><input name="l_employee" class=checkbox type=checkbox value=Y></td> |
|
413 |
<td>| . $locale->text('Employee') . qq|</td> |
|
414 |
</tr> |
|
415 |
</table> |
|
416 |
</tr> |
|
417 |
</table> |
|
418 |
</tr> |
|
419 |
</table> |
|
420 |
</td> |
|
421 |
</tr> |
|
422 |
<tr> |
|
423 |
<td><hr size=3 noshade></td> |
|
424 |
</tr> |
|
425 |
</table> |
|
217 |
$::form->all_departments(\%::myconfig); |
|
218 |
$::form->get_lists( |
|
219 |
projects => { key => "ALL_PROJECTS", all => 1 }, |
|
220 |
employees => "ALL_EMPLOYEES", |
|
221 |
); |
|
426 | 222 |
|
427 |
$jsscript |
|
223 |
my $onload = "focus()" |
|
224 |
. qq|;setupDateFormat('|. $::myconfig{dateformat} . qq|', '| . $::locale->text("Falsches Datumsformat!") . qq|')| |
|
225 |
. qq|;setupPoints('|. $::myconfig{numberformat} . qq|', '| . $::locale->text("wrongformat") . qq|')|; |
|
428 | 226 |
|
429 |
<input type=hidden name=nextsub value=generate_report> |
|
227 |
$::form->header; |
|
228 |
print $::form->parse_html_template('gl/search', { |
|
229 |
onload => $onload, |
|
230 |
department_label => sub { ("$_[0]{description}--$_[0]{id}")x2 }, |
|
231 |
employee_label => sub { "$_[0]{id}--$_[0]{name}" }, |
|
232 |
}); |
|
430 | 233 |
|
431 |
<br> |
|
432 |
<input class=submit type=submit name=action value="| |
|
433 |
. $locale->text('Continue') . qq|"> |
|
434 |
</form> |
|
435 |
|
|
436 |
</body> |
|
437 |
</html> |
|
438 |
|; |
|
439 |
$main::lxdebug->leave_sub(); |
|
234 |
$::lxdebug->leave_sub; |
|
440 | 235 |
} |
441 | 236 |
|
442 | 237 |
sub create_subtotal_row { |
Auch abrufbar als: Unified diff
gl.pl:search -> templates