Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 4000272e

Von Jan Büren vor mehr als 13 Jahren hinzugefügt

  • ID 4000272e5ea3a605f3625934f07033472832de49
  • Vorgänger 10af2ad6
  • Nachfolger 3286128e

Buchungsjournal: Bearbeiter und Buchungsdatum

- Buchungsjournal: Auswahl nach Bearbeiter einschränken

- Sortierung: Auswahl ob Buchungsjournal nach Buchungsdatum oder
Rechnungsdatum sortiert wird (Buchungsdatum ist Default)

- Datumsauswahl von-bis berücksichtigt ebenfalls Auswahl
Buchungsdatum/Rechnungsdatum

Unterschiede anzeigen:

bin/mozilla/gl.pl
242 242
| if $form->{selectdepartment};
243 243

  
244 244
  $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
245
                                   "all" => 1 });
245
                                   "all" => 1},
246
                                   "employees"    => "ALL_EMPLOYEES" );
246 247

  
247 248
  my %project_labels = ();
248 249
  my @project_values = ("");
......
256 257
                         '-values' => \@project_values,
257 258
                         '-labels' => \%project_labels));
258 259

  
260
  my %employee_labels = ();
261
  my @employee_values = ("");
262
  foreach my $item (@{ $form->{"ALL_EMPLOYEES"} }) {
263
    # value in Form "1234--Name" ?bergeben
264
    my $id = "$item->{'id'}--$item->{'name'}";
265
    push(@employee_values, "$id");
266
    $employee_labels{$id} = $item->{"name"};
267
  }
268

  
269
  my $employeenumber =
270
    NTI($cgi->popup_menu('-name' => "employee",
271
                         '-values' => \@employee_values,
272
                         '-labels' => \%employee_labels));
273

  
259 274
  # use JavaScript Calendar or not
260 275
  $form->{jsscript} = 1;
261 276
  my $jsscript = "";
......
296 311

  
297 312
<form method=post action=gl.pl>
298 313

  
299
<input type=hidden name=sort value=transdate>
314
<input type=hidden name=sort value=datesort>
300 315

  
301 316
<table width=100%>
302 317
  <tr>
......
329 344
        </tr>
330 345
        <tr>
331 346
          <th align=right>| . $locale->text('From') . qq|</th>
347
 <tr>
348
    <th align=right>| . $locale->text('Employee') . qq|</th>
349
    <td colspan=3>$employeenumber</td>
350
  </tr>
351
  <tr>
352
    <th align=right>| . $locale->text('Date Sorting') . qq|</th>
353
    <td colspan=3>
354
    <input name=datesort class=radio type=radio value=gldate checked>&nbsp;| . $locale->text('Booking Date') . qq|
355
    <input name=datesort class=radio type=radio value=transdate>&nbsp;| . $locale->text('Invoice Date') . qq|
356
    </td>
357
  </tr>
358
  <tr>
359
    <th align=right>| . $locale->text('From') . qq|</th>
332 360
          $button1
333 361
          <th align=right>| . $locale->text('To (time)') . qq|</th>
334 362
          $button2
......
357 385
                    <td align=right><input name="l_id" class=checkbox type=checkbox value=Y></td>
358 386
                    <td>| . $locale->text('ID') . qq|</td>
359 387
                    <td align=right><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
360
                    <td>| . $locale->text('Date') . qq|</td>
388
                    <td>| . $locale->text('Invoice Date') . qq|</td>
389
                    <td align=right><input name="l_gldate" class=checkbox type=checkbox value=Y checked></td>
390
                    <td>| . $locale->text('Booking Date') . qq|</td>
361 391
                    <td align=right><input name="l_reference" class=checkbox type=checkbox value=Y checked></td>
362 392
                    <td>| . $locale->text('Reference') . qq|</td>
363 393
                    <td align=right><input name="l_description" class=checkbox type=checkbox value=Y checked></td>
......
380 410
                    <td>| . $locale->text('Subtotal') . qq|</td>
381 411
                    <td align=right><input name="l_projectnumbers" class=checkbox type=checkbox value=Y></td>
382 412
                    <td>| . $locale->text('Project Number') . qq|</td>
413
                    <td align=right><input name="l_employee" class=checkbox type=checkbox value=Y></td>
414
                    <td>| . $locale->text('Employee') . qq|</td>
383 415
                  </tr>
384 416
                </table>
385 417
              </tr>
......
436 468
  my %myconfig = %main::myconfig;
437 469
  my $locale   = $main::locale;
438 470

  
439
  report_generator_set_default_sort('transdate', 1);
471
  # generate_report wird beim ersten Aufruf per Weiter-Knopf und POST mit der hidden Variablen sort mit Wert "datesort" (fr?her "transdate" als Defaultsortiervariable) ?bertragen
472

  
473
  # <form method=post action=gl.pl>
474
  # <input type=hidden name=sort value=datesort>    # form->{sort} setzen
475
  # <input type=hidden name=nextsub value=generate_report>
476

  
477
  # anhand von neuer Variable datesort wird jetzt $form->{sort} auf transdate oder gldate gesetzt
478
  # damit ist die Hidden Variable "sort" wahrscheinlich sogar ?berfl?ssig
479

  
480
  # ?ndert man die Sortierreihenfolge per Klick auf eine der ?berschriften wird die Variable "sort" per GET ?bergeben, z.B. id,transdate, gldate, ...
481
  # gl.pl?action=generate_report&employee=18383--Jan%20B%c3%bcren&datesort=transdate&category=X&l_transdate=Y&l_gldate=Y&l_id=Y&l_reference=Y&l_description=Y&l_source=Y&l_debit=Y&l_credit=Y&sort=gldate&sortdir=0
482

  
483
  if ( $form->{sort} eq 'datesort' ) {   # sollte bei einem Post (Aufruf aus Suchmaske) immer wahr sein
484
      # je nachdem ob in Suchmaske "transdate" oder "gldate" ausgesucht wurde erstes Suchergebnis entsprechend sortieren
485
      $form->{sort} = $form->{datesort};
486
  };
487

  
488
  # was passiert hier?
489
  report_generator_set_default_sort("$form->{datesort}", 1);
490
#  report_generator_set_default_sort('transdate', 1);
440 491

  
441 492
  GL->all_transactions(\%myconfig, \%$form);
442 493

  
......
457 508
  my $ml = ($form->{ml} =~ /(A|E|Q)/) ? -1 : 1;
458 509

  
459 510
  my @columns = qw(
460
    transdate      id               reference      description
461
    notes          source           debit          debit_accno
511
    gldate         transdate        id             reference      description
512
    notes          source           debit          debit_accno   
462 513
    credit         credit_accno     debit_tax      debit_tax_accno
463 514
    credit_tax     credit_tax_accno projectnumbers balance
464 515
  );
465 516

  
466
  my @hidden_variables = qw(accno source reference department description notes project_id datefrom dateto category l_subtotal);
517
  # add employee here, so that variable is still known and passed in url when choosing a different sort order in resulting table
518
  my @hidden_variables = qw(accno source reference department description notes project_id datefrom dateto employee datesort category l_subtotal);
467 519
  push @hidden_variables, map { "l_${_}" } @columns;
520
  foreach ( @hidden_variables ) {
521
      print URL "$_\n";
522
  };
468 523

  
469 524
  my (@options, @date_options);
470 525
  push @options,      $locale->text('Account')     . " : $form->{accno} $form->{account_description}" if ($form->{accno});
......
472 527
  push @options,      $locale->text('Reference')   . " : $form->{reference}"                          if ($form->{reference});
473 528
  push @options,      $locale->text('Description') . " : $form->{description}"                        if ($form->{description});
474 529
  push @options,      $locale->text('Notes')       . " : $form->{notes}"                              if ($form->{notes});
475

  
530
  push @options,      $locale->text('Employee')       . " : $form->{employee_name}"                              if ($form->{employee_name});
531
  my $datesorttext = $form->{datesort} eq 'transdate' ? $locale->text('Invoice Date') :  $locale->text('Booking Date');
532
  push @date_options,      "$datesorttext"                              if ($form->{datesort} and ($form->{datefrom} or $form->{dateto}));
476 533
  push @date_options, $locale->text('From'), $locale->date(\%myconfig, $form->{datefrom}, 1)          if ($form->{datefrom});
477 534
  push @date_options, $locale->text('Bis'),  $locale->date(\%myconfig, $form->{dateto},   1)          if ($form->{dateto});
478 535
  push @options,      join(' ', @date_options)                                                        if (scalar @date_options);
......
484 541

  
485 542

  
486 543
  my $callback = build_std_url('action=generate_report', grep { $form->{$_} } @hidden_variables);
544
  print URL $callback;
545
  close URL;
487 546

  
488 547
  $form->{l_credit_accno}     = 'Y';
489 548
  $form->{l_debit_accno}      = 'Y';
490 549
  $form->{l_credit_tax}       = 'Y';
491 550
  $form->{l_debit_tax}        = 'Y';
551
#  $form->{l_gldate}           = 'Y';  # Spalte mit gldate immer anzeigen
492 552
  $form->{l_credit_tax_accno} = 'Y';
553
  $form->{l_datesort} = 'Y';
493 554
  $form->{l_debit_tax_accno}  = 'Y';
494 555
  $form->{l_balance}          = $form->{accno} ? 'Y' : '';
495 556

  
496 557
  my %column_defs = (
497 558
    'id'               => { 'text' => $locale->text('ID'), },
498
    'transdate'        => { 'text' => $locale->text('Date'), },
559
    'transdate'        => { 'text' => $locale->text('Invoice Date'), },
560
    'gldate'           => { 'text' => $locale->text('Booking Date'), },
499 561
    'reference'        => { 'text' => $locale->text('Reference'), },
500 562
    'source'           => { 'text' => $locale->text('Source'), },
501 563
    'description'      => { 'text' => $locale->text('Description'), },
......
510 572
    'credit_tax_accno' => { 'text' => $locale->text('Credit Tax Account'), },
511 573
    'balance'          => { 'text' => $locale->text('Balance'), },
512 574
    'projectnumbers'   => { 'text' => $locale->text('Project Numbers'), },
575
    'employee'         => { 'text' => $locale->text('Employee'), },
513 576
  );
514 577

  
515
  foreach my $name (qw(id transdate reference description debit_accno credit_accno debit_tax_accno credit_tax_accno)) {
578
  foreach my $name (qw(id transdate gldate reference description debit_accno credit_accno debit_tax_accno credit_tax_accno)) {
516 579
    my $sortname                = $name =~ m/accno/ ? 'accno' : $name;
517 580
    my $sortdir                 = $sortname eq $form->{sort} ? 1 - $form->{sortdir} : $form->{sortdir};
518 581
    $column_defs{$name}->{link} = $callback . "&sort=$sortname&sortdir=$sortdir";
......
523 586

  
524 587
  my %column_alignment;
525 588
  map { $column_alignment{$_}     = 'right'  } qw(balance id debit credit debit_tax credit_tax balance);
526
  map { $column_alignment{$_}     = 'center' } qw(reference debit_accno credit_accno debit_tax_accno credit_tax_accno);
589
  map { $column_alignment{$_}     = 'center' } qw(transdate gldate reference debit_accno credit_accno debit_tax_accno credit_tax_accno);
527 590
  map { $column_alignment{$_}     = 'left' } qw(description source notes);
528 591
  map { $column_defs{$_}->{align} = $column_alignment{$_} } keys %column_alignment;
529 592

  
......
597 660

  
598 661
    map { $row->{$_}->{data} = $ref->{$_} } qw(id reference description notes);
599 662

  
600
    map { $row->{$_}->{data} = \@{ $rows{$_} }; } qw(transdate debit credit debit_accno credit_accno debit_tax_accno credit_tax_accno source);
663
    map { $row->{$_}->{data} = \@{ $rows{$_} }; } qw(transdate gldate debit credit debit_accno credit_accno debit_tax_accno credit_tax_accno source);
601 664

  
602 665
    foreach my $col (qw(debit_accno credit_accno debit_tax_accno credit_tax_accno)) {
603 666
      $row->{$col}->{link} = [ map { "${callback}&accno=" . E($_) } @{ $rows{$col} } ];

Auch abrufbar als: Unified diff