Revision e7214232
Von Moritz Bunkus vor etwa 18 Jahren hinzugefügt
bin/mozilla/ct.pl | ||
---|---|---|
307 | 307 |
$lxdebug->leave_sub(); |
308 | 308 |
} |
309 | 309 |
|
310 |
sub search_adr { |
|
311 |
$lxdebug->enter_sub(); |
|
312 |
|
|
313 |
$form->{title} = $locale->text('ADR Report'); |
|
314 |
|
|
315 |
# use JavaScript Calendar or not |
|
316 |
$form->{jsscript} = $jscalendar; |
|
317 |
$jsscript = ""; |
|
318 |
|
|
319 |
if ($form->{jsscript}) { |
|
320 |
|
|
321 |
# with JavaScript Calendar |
|
322 |
$button1 = qq| |
|
323 |
<td><input name=from id=from size=11 title="$myconfig{dateformat}" value=$form->{from}></td> |
|
324 |
<td><input type=button name=from id="trigger1" value=| |
|
325 |
. $locale->text('button') . qq|></td> |
|
326 |
|; |
|
327 |
$button2 = qq| |
|
328 |
<td width="13"><input name=to id=to size=11 title="$myconfig{dateformat}" value=$form->{to}></td> |
|
329 |
<td width="4"><input type=button name=to id="trigger2" value=| |
|
330 |
. $locale->text('button') . qq|></td></td> |
|
331 |
|; |
|
332 |
|
|
333 |
|
|
334 |
#write Trigger |
|
335 |
$jsscript = |
|
336 |
Form->write_trigger(\%myconfig, "2", |
|
337 |
"from", "BL", |
|
338 |
"trigger1", "to", |
|
339 |
"BL", "trigger2"); |
|
340 |
} else { |
|
341 |
|
|
342 |
# without JavaScript Calendar |
|
343 |
$button1 = |
|
344 |
qq|<td><input name=from size=11 title="$myconfig{dateformat}" value=$form->{from}></td>|; |
|
345 |
$button2 = |
|
346 |
qq|<td width="13"><input name=to size=11 title="$myconfig{dateformat}" value=$form->{to}></td>|; |
|
347 |
} |
|
348 |
|
|
349 |
$form->header; |
|
350 |
|
|
351 |
print qq| |
|
352 |
<body> |
|
353 |
|
|
354 |
<form method=post action=$form->{script}> |
|
355 |
|
|
356 |
|
|
357 |
<table width=100%> |
|
358 |
<tr> |
|
359 |
<th class=listtop>$form->{title}</th> |
|
360 |
</tr> |
|
361 |
<tr height="5"></tr> |
|
362 |
<tr valign=top> |
|
363 |
<td> |
|
364 |
<table> |
|
365 |
<tr> |
|
366 |
<th align=right nowrap>| . $locale->text('Year') . qq|</th> |
|
367 |
<td><input name=year type=input value=$form->{year}></td> |
|
368 |
<tr> |
|
369 |
<th align=right nowrap>| . $locale->text('From') . qq|</th> |
|
370 |
$button1 |
|
371 |
</tr> |
|
372 |
<tr> |
|
373 |
<th align=right nowrap>| . $locale->text('Bis') . qq|</th> |
|
374 |
$button2 |
|
375 |
</tr> |
|
376 |
<tr> |
|
377 |
<td></td> |
|
378 |
<td><input name=format class=radio type=radio value=html checked> | |
|
379 |
. $locale->text('HTML') . qq| |
|
380 |
<input name=format class=radio type=radio value=csv> | |
|
381 |
. $locale->text('CSV') . qq|</td> |
|
382 |
</tr> |
|
383 |
</table> |
|
384 |
</td> |
|
385 |
</tr> |
|
386 |
<tr> |
|
387 |
<td><hr size=3 noshade></td> |
|
388 |
</tr> |
|
389 |
</table> |
|
390 |
$jsscript |
|
391 |
<input type=hidden name=nextsub value=adr_report> |
|
392 |
|
|
393 |
<input type=hidden name=path value=$form->{path}> |
|
394 |
<input type=hidden name=login value=$form->{login}> |
|
395 |
<input type=hidden name=password value=$form->{password}> |
|
396 |
|
|
397 |
<br> |
|
398 |
<input type=submit class=submit name=action value="| |
|
399 |
. $locale->text('Continue') . qq|"> |
|
400 |
</form> |
|
401 |
|
|
402 |
</body> |
|
403 |
</html> |
|
404 |
|; |
|
405 |
$lxdebug->leave_sub(); |
|
406 |
} |
|
407 |
sub adr_report { |
|
408 |
$lxdebug->enter_sub(); |
|
409 |
|
|
410 |
CT->adr(\%myconfig, \%$form); |
|
411 |
|
|
412 |
$form->{title} = $locale->text('ADR Report'); |
|
413 |
if ($form->{from} || $form->{to}) { |
|
414 |
$option = "F?r den Zeitraum $form->{from} bis $form->{to}"; |
|
415 |
} elsif ($form->{year}) { |
|
416 |
$option = "F?r das Jahr $form->{year}"; |
|
417 |
} |
|
418 |
|
|
419 |
if ($form->{format} eq "html") { |
|
420 |
$form->header(); |
|
421 |
print qq| |
|
422 |
<body> |
|
423 |
|
|
424 |
<table width=100%> |
|
425 |
<tr> |
|
426 |
<th class=listtop>$form->{title}</th> |
|
427 |
</tr> |
|
428 |
<tr height="5"></tr> |
|
429 |
<tr> |
|
430 |
<td>$option</td> |
|
431 |
</tr> |
|
432 |
</table>|; |
|
433 |
|
|
434 |
|
|
435 |
@column_index = |
|
436 |
$form->sort_columns(adr_code, |
|
437 |
adr_description, |
|
438 |
sum, |
|
439 |
unit); |
|
440 |
|
|
441 |
|
|
442 |
|
|
443 |
$column_header{adr_code} = |
|
444 |
qq|<th class=listheading>| . $locale->text('ADR Code') . qq|</th>|; |
|
445 |
$column_header{adr_description} = |
|
446 |
qq|<th class=listheading>|. $locale->text('ADR Description'). qq|</th>|; |
|
447 |
$column_header{sum} = |
|
448 |
qq|<th class=listheading>|. $locale->text('Quantity'). qq|</th>|; |
|
449 |
$column_header{unit} = |
|
450 |
qq|<th class=listheading>| . $locale->text('Unit') . qq|</th>|; |
|
451 |
|
|
452 |
print qq| |
|
453 |
|
|
454 |
<table width=100%> |
|
455 |
<tr> |
|
456 |
<td> |
|
457 |
<table width=100%> |
|
458 |
<tr class=listheading> |
|
459 |
|; |
|
460 |
|
|
461 |
map { print "$column_header{$_}\n" } @column_index; |
|
462 |
|
|
463 |
print qq| |
|
464 |
</tr> |
|
465 |
|; |
|
466 |
|
|
467 |
|
|
468 |
foreach $ref (@{ $form->{ADR} }) { |
|
469 |
|
|
470 |
map { $column_data{$_} = "<td>$ref->{$_} </td>" } @column_index; |
|
471 |
|
|
472 |
|
|
473 |
$i++; |
|
474 |
$i %= 2; |
|
475 |
print " |
|
476 |
<tr class=listrow$i> |
|
477 |
"; |
|
478 |
|
|
479 |
map { print "$column_data{$_}\n" } @column_index; |
|
480 |
|
|
481 |
print qq| |
|
482 |
</tr> |
|
483 |
|; |
|
484 |
|
|
485 |
|
|
486 |
} |
|
487 |
|
|
488 |
print qq| |
|
489 |
</table> |
|
490 |
</body> |
|
491 |
</html> |
|
492 |
|; |
|
493 |
} else { |
|
494 |
my $filename = "adr-report-$form->{from}-$form->{to}.csv"; |
|
495 |
if ($form->{year}) { |
|
496 |
$filename = "adr-report-$form->{year}.csv"; |
|
497 |
} |
|
498 |
@column_index = |
|
499 |
$form->sort_columns(adr_code, |
|
500 |
adr_description, |
|
501 |
sum, |
|
502 |
unit); |
|
503 |
|
|
504 |
$tmpfile = qq|ADR Code;ADR Beschreibung;Menge;Einheit\n|; |
|
505 |
foreach $ref (@{ $form->{ADR} }) { |
|
506 |
|
|
507 |
map { $column_data{$_} = qq|"$ref->{$_}"| } @column_index; |
|
508 |
|
|
509 |
$line = ""; |
|
510 |
map { $line .= "$column_data{$_};" } @column_index; |
|
511 |
chomp($line); |
|
512 |
$tmpfile .= qq|$line\n|;; |
|
513 |
} |
|
514 |
|
|
515 |
my $size = length($tmpfile); |
|
516 |
# launch application |
|
517 |
print qq|Content-Type: application/csv |
|
518 |
Content-Disposition: attachment; filename="$filename" |
|
519 |
Content-Length: $size |
|
520 |
|
|
521 |
$tmpfile |
|
522 |
|; |
|
523 |
} |
|
524 |
|
|
525 |
$lxdebug->leave_sub(); |
|
526 |
} |
|
527 |
|
|
528 | 310 |
sub list_names { |
529 | 311 |
$lxdebug->enter_sub(); |
530 | 312 |
|
... | ... | |
1851 | 1633 |
ordnumber, |
1852 | 1634 |
transdate, |
1853 | 1635 |
description, |
1854 |
adr_code, |
|
1855 | 1636 |
qty, |
1856 | 1637 |
unit); |
1857 | 1638 |
|
... | ... | |
1867 | 1648 |
qq|<th class=listheading>| . $locale->text('Invdate') . qq|</th>|; |
1868 | 1649 |
$column_header{description} = |
1869 | 1650 |
qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|; |
1870 |
$column_header{adr_code} = |
|
1871 |
qq|<th class=listheading>| . $locale->text('ADR') . qq|</th>|; |
|
1872 | 1651 |
$column_header{qty} = |
1873 | 1652 |
qq|<th class=listheading>| . $locale->text('Qty') . qq|</th>|; |
1874 | 1653 |
$column_header{unit} = |
Auch abrufbar als: Unified diff
ADR entfernt (kam aus Kundenprojekt und ist nicht fuer die allgemeine Lx-Office-Variante gedacht).