Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 7a1f60ec

Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt

  • ID 7a1f60ec2df4d0d0a1b546f186df7bb968b8f498
  • Vorgänger 0020bd73
  • Nachfolger af1e7bc5

Das Buchungsjournal auf die Verwendung der ReportGenerator-Klasse umgestellt.

Unterschiede anzeigen:

bin/mozilla/gl.pl
31 31
#
32 32
#======================================================================
33 33

  
34
use POSIX qw(strftime);
35

  
34 36
use SL::GL;
35 37
use SL::IS;
36 38
use SL::PE;
39
use SL::ReportGenerator;
37 40

  
38 41
require "bin/mozilla/arap.pl";
39 42
require "bin/mozilla/common.pl";
43
require "bin/mozilla/report_generator.pl";
40 44

  
41 45
1;
42 46

  
......
204 208
sub search {
205 209
  $lxdebug->enter_sub();
206 210

  
207
  $form->{title} = $locale->text('Buchungsjournal');
211
  $form->{title} = $locale->text('Journal');
208 212

  
209 213
  $form->all_departments(\%myconfig);
210 214

  
......
392 396
  $lxdebug->leave_sub();
393 397
}
394 398

  
395
sub generate_report {
399
sub create_subtotal_row {
396 400
  $lxdebug->enter_sub();
397 401

  
398
  $form->{sort} = "transdate" unless $form->{sort};
402
  my ($totals, $columns, $column_alignment, $subtotal_columns, $class) = @_;
399 403

  
400
  GL->all_transactions(\%myconfig, \%$form);
404
  my $row = { map { $_ => { 'data' => '', 'class' => $class, 'align' => $column_alignment->{$_}, } } @{ $columns } };
401 405

  
402
  $callback =
403
    "$form->{script}?action=generate_report&login=$form->{login}&password=$form->{password}";
406
  map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals->{$_}, 2) } @{ $subtotal_columns };
404 407

  
405
  $href = $callback;
408
  map { $totals->{$_} = 0 } @{ $subtotal_columns };
406 409

  
407
  %acctype = ('A' => $locale->text('Asset'),
408
              'C' => $locale->text('Contra'),
409
              'L' => $locale->text('Liability'),
410
              'Q' => $locale->text('Equity'),
411
              'I' => $locale->text('Revenue'),
412
              'E' => $locale->text('Expense'),);
410
  $lxdebug->leave_sub();
413 411

  
414
  $form->{title} = $locale->text('General Ledger');
412
  return $row;
413
}
415 414

  
416
  $ml = ($form->{ml} =~ /(A|E|Q)/) ? -1 : 1;
415
sub generate_report {
416
  $lxdebug->enter_sub();
417 417

  
418
  unless ($form->{category} eq 'X') {
418
  $form->{sort} ||= "transdate";
419

  
420
  GL->all_transactions(\%myconfig, \%$form);
421

  
422
  my %acctype = ('A' => $locale->text('Asset'),
423
                 'C' => $locale->text('Contra'),
424
                 'L' => $locale->text('Liability'),
425
                 'Q' => $locale->text('Equity'),
426
                 'I' => $locale->text('Revenue'),
427
                 'E' => $locale->text('Expense'),);
428

  
429
  $form->{title} = $locale->text('Journal');
430
  if ($form->{category} ne 'X') {
419 431
    $form->{title} .= " : " . $locale->text($acctype{ $form->{category} });
420 432
  }
433

  
434
  $form->{landscape} = 1;
435

  
436
  my $ml = ($form->{ml} =~ /(A|E|Q)/) ? -1 : 1;
437

  
438
  my @columns = qw(
439
    transdate      id               reference      description
440
    notes          source           debit          debit_accno
441
    credit         credit_accno     debit_tax      debit_tax_accno
442
    credit_tax     credit_tax_accno projectnumbers balance
443
  );
444

  
445
  my @hidden_variables = qw(accno source reference department description notes project_id datefrom dateto category l_subtotal);
446
  push @hidden_variables, map { "l_${_}" } @columns;
447

  
448
  my (@options, $date_option);
421 449
  if ($form->{accno}) {
422
    $href .= "&accno=" . $form->escape($form->{accno});
423
    $callback .= "&accno=" . $form->escape($form->{accno}, 1);
424
    $option =
425
      $locale->text('Account')
426
      . " : $form->{accno} $form->{account_description}";
450
    push @options, $locale->text('Account') . " : $form->{accno} $form->{account_description}";
427 451
  }
428 452
  if ($form->{source}) {
429
    $href     .= "&source=" . $form->escape($form->{source});
430
    $callback .= "&source=" . $form->escape($form->{source}, 1);
431
    $option   .= "\n<br>" if $option;
432
    $option   .= $locale->text('Source') . " : $form->{source}";
453
    push @options, $locale->text('Source') . " : $form->{source}";
433 454
  }
434 455
  if ($form->{reference}) {
435
    $href     .= "&reference=" . $form->escape($form->{reference});
436
    $callback .= "&reference=" . $form->escape($form->{reference}, 1);
437
    $option   .= "\n<br>" if $option;
438
    $option   .= $locale->text('Reference') . " : $form->{reference}";
456
    push @options, $locale->text('Reference') . " : $form->{reference}";
439 457
  }
440 458
  if ($form->{department}) {
441
    $href .= "&department=" . $form->escape($form->{department});
442
    $callback .= "&department=" . $form->escape($form->{department}, 1);
443
    ($department) = split /--/, $form->{department};
444
    $option .= "\n<br>" if $option;
445
    $option .= $locale->text('Department') . " : $department";
459
    my ($department) = split /--/, $form->{department};
460
    push @options, $locale->text('Department') . " : $department";
446 461
  }
447

  
448 462
  if ($form->{description}) {
449
    $href     .= "&description=" . $form->escape($form->{description});
450
    $callback .= "&description=" . $form->escape($form->{description}, 1);
451
    $option   .= "\n<br>" if $option;
452
    $option   .= $locale->text('Description') . " : $form->{description}";
463
    push @options, $locale->text('Description') . " : $form->{description}";
453 464
  }
454 465
  if ($form->{notes}) {
455
    $href     .= "&notes=" . $form->escape($form->{notes});
456
    $callback .= "&notes=" . $form->escape($form->{notes}, 1);
457
    $option   .= "\n<br>" if $option;
458
    $option   .= $locale->text('Notes') . " : $form->{notes}";
459
  }
460
 if ($form->{project_id}) {
461
    $href     .= "&project_id=" . $form->escape($form->{project_id});
462
    $callback .= "&project_id=" . $form->escape($form->{project_id});
466
    push @options, $locale->text('Notes') . " : $form->{notes}";
463 467
  }
464

  
465 468
  if ($form->{datefrom}) {
466
    $href     .= "&datefrom=$form->{datefrom}";
467
    $callback .= "&datefrom=$form->{datefrom}";
468
    $option   .= "\n<br>" if $option;
469
    $option   .=
470
        $locale->text('From') . " "
471
      . $locale->date(\%myconfig, $form->{datefrom}, 1);
469
    $date_option = $locale->text('From') . " " . $locale->date(\%myconfig, $form->{datefrom}, 1);
472 470
  }
473 471
  if ($form->{dateto}) {
474
    $href     .= "&dateto=$form->{dateto}";
475
    $callback .= "&dateto=$form->{dateto}";
476 472
    if ($form->{datefrom}) {
477
      $option .= " ";
478
    } else {
479
      $option .= "\n<br>" if $option;
473
      $date_option .= " ";
480 474
    }
481
    $option .=
482
        $locale->text('Bis') . " "
483
      . $locale->date(\%myconfig, $form->{dateto}, 1);
475
    $date_option .= $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{dateto}, 1);
484 476
  }
485

  
486
  @columns = $form->sort_columns( qw(
487
       transdate       id                reference         description  
488
       notes           source            debit             debit_accno  
489
       credit          credit_accno      debit_tax         debit_tax_accno
490
       credit_tax      credit_tax_accno  accno
491
       projectnumbers  
492
       )
477
  push @options, $date_option if $date_option;
478

  
479
  my $callback = build_std_url('action=generate_report', @hidden_variables);
480

  
481
  $form->{l_credit_accno}     = 'Y';
482
  $form->{l_debit_accno}      = 'Y';
483
  $form->{l_credit_tax}       = 'Y';
484
  $form->{l_debit_tax}        = 'Y';
485
  $form->{l_credit_tax_accno} = 'Y';
486
  $form->{l_debit_tax_accno}  = 'Y';
487
  $form->{l_balance}          = $form->{accno} ? 'Y' : '';
488

  
489
  my %column_defs = (
490
    'id'               => { 'text' => $locale->text('ID'), },
491
    'transdate'        => { 'text' => $locale->text('Date'), },
492
    'reference'        => { 'text' => $locale->text('Reference'), },
493
    'source'           => { 'text' => $locale->text('Source'), },
494
    'description'      => { 'text' => $locale->text('Description'), },
495
    'notes'            => { 'text' => $locale->text('Notes'), },
496
    'debit'            => { 'text' => $locale->text('Debit'), },
497
    'debit_accno'      => { 'text' => $locale->text('Debit Account'), },
498
    'credit'           => { 'text' => $locale->text('Credit'), },
499
    'credit_accno'     => { 'text' => $locale->text('Credit Account'), },
500
    'debit_tax'        => { 'text' => $locale->text('Debit Tax'), },
501
    'debit_tax_accno'  => { 'text' => $locale->text('Debit Tax Account'), },
502
    'credit_tax'       => { 'text' => $locale->text('Credit Tax'), },
503
    'credit_tax_accno' => { 'text' => $locale->text('Credit Tax Account'), },
504
    'balance'          => { 'text' => $locale->text('Balance'), },
505
    'projectnumbers'   => { 'text' => $locale->text('Project Numbers'), },
493 506
  );
494 507

  
495
  if ($form->{accno}) {
496
    @columns = grep !/accno/, @columns;
497
    push @columns, "balance";
498
    $form->{l_balance} = "Y";
508
  map { $column_defs{$_}->{link}    = $callback . "&sort=${_}" }  qw(id transdate reference source description);
509
  map { $column_defs{$_}->{link}    = $callback . "&sort=accno" } qw(debit_accno credit_accno debit_tax_accno credit_tax_accno debit_tax credit_tax);
510
  map { $column_defs{$_}->{visible} = $form->{"l_${_}"} ? 1 : 0 } @columns;
511
  map { $column_defs{$_}->{visible} = 0 } qw(debit_accno credit_accno debit_tax_accno credit_tax_accno) if $form->{accno};
499 512

  
500
  }
513
  my %column_alignment;
514
  map { $column_alignment{$_} = 'right' }  qw(balance id debit credit debit_tax credit_tax);
515
  map { $column_alignment{$_} = 'center' } qw(transdate reference description source notes debit_accno credit_accno debit_tax_accno credit_tax_accno);
501 516

  
502
  $form->{l_credit_accno}     = "Y";
503
  $form->{l_debit_accno}      = "Y";
504
  $form->{l_credit_tax}       = "Y";
505
  $form->{l_debit_tax}        = "Y";
506
  $form->{l_credit_tax_accno} = "Y";
507
  $form->{l_debit_tax_accno}  = "Y";
508
  $form->{l_accno}            = "N";
509
  foreach $item (@columns) {
510
    if ($form->{"l_$item"} eq "Y") {
511
      push @column_index, $item;
512

  
513
      # add column to href and callback
514
      $callback .= "&l_$item=Y";
515
      $href     .= "&l_$item=Y";
516
    }
517
  }
518

  
519
  if ($form->{l_subtotal} eq 'Y') {
520
    $callback .= "&l_subtotal=Y";
521
    $href     .= "&l_subtotal=Y";
522
  }
523

  
524
  $callback .= "&category=$form->{category}";
525
  $href     .= "&category=$form->{category}";
526

  
527
  $column_header{id} =
528
      "<th><a class=listheading href=$href&sort=id>"
529
    . $locale->text('ID')
530
    . "</a></th>";
531
  $column_header{transdate} =
532
      "<th><a class=listheading href=$href&sort=transdate>"
533
    . $locale->text('Date')
534
    . "</a></th>";
535
  $column_header{reference} =
536
      "<th><a class=listheading href=$href&sort=reference>"
537
    . $locale->text('Reference')
538
    . "</a></th>";
539
  $column_header{source} =
540
      "<th><a class=listheading href=$href&sort=source>"
541
    . $locale->text('Source')
542
    . "</a></th>";
543
  $column_header{description} =
544
      "<th><a class=listheading href=$href&sort=description>"
545
    . $locale->text('Description')
546
    . "</a></th>";
547
  $column_header{notes} =
548
    "<th class=listheading>" . $locale->text('Notes') . "</th>";
549
  $column_header{debit} =
550
    "<th class=listheading>" . $locale->text('Debit') . "</th>";
551
  $column_header{debit_accno} =
552
      "<th><a class=listheading href=$href&sort=accno>"
553
    . $locale->text('Debit Account')
554
    . "</a></th>";
555
  $column_header{credit} =
556
    "<th class=listheading>" . $locale->text('Credit') . "</th>";
557
  $column_header{credit_accno} =
558
      "<th><a class=listheading href=$href&sort=accno>"
559
    . $locale->text('Credit Account')
560
    . "</a></th>";
561
  $column_header{debit_tax} =
562
      "<th><a class=listheading href=$href&sort=accno>"
563
    . $locale->text('Debit Tax')
564
    . "</a></th>";
565
  $column_header{debit_tax_accno} =
566
      "<th><a class=listheading href=$href&sort=accno>"
567
    . $locale->text('Debit Tax Account')
568
    . "</a></th>";
569
  $column_header{credit_tax} =
570
      "<th><a class=listheading href=$href&sort=accno>"
571
    . $locale->text('Credit Tax')
572
    . "</a></th>";
573
  $column_header{credit_tax_accno} =
574
      "<th><a class=listheading href=$href&sort=accno>"
575
    . $locale->text('Credit Tax Account')
576
    . "</a></th>";
577
  $column_header{balance} = "<th>" . $locale->text('Balance') . "</th>";
578
  $column_header{projectnumbers} =
579
      "<th class=listheading>"  . $locale->text('Project Numbers') . "</th>";
580

  
581
  $form->{landscape} = 1;
582

  
583
  $form->header;
517
  my $report = SL::ReportGenerator->new(\%myconfig, $form);
584 518

  
585
  print qq|
586
<body>
519
  $report->set_columns(%column_defs);
520
  $report->set_column_order(@columns);
587 521

  
588
<table width=100%>
589
  <tr>
590
    <th class=listtop>$form->{title}</th>
591
  </tr>
592
  <tr height="5"></tr>
593
  <tr>
594
    <td>$option</td>
595
  </tr>
596
  <tr>
597
    <td>
598
      <table width=100%>
599
       <thead>
600
	<tr class=listheading>
601
|;
522
  $report->set_export_options('generate_report', @hidden_variables);
602 523

  
603
  map { print "$column_header{$_}\n" } @column_index;
524
  $report->set_sort_indicator($form->{sort}, 1);
604 525

  
605
  print "
606
        </tr>
607
        </thead>
608
        </tfoot>
609
        <tbody>
610
";
526
  $report->set_options('top_info_text'        => join("\n", @options),
527
                       'output_format'        => 'HTML',
528
                       'title'                => $form->{title},
529
                       'attachment_basename'  => $locale->text('general_ledger_list') . strftime('_%Y%m%d', localtime time),
530
    );
531
  $report->set_options_from_form();
611 532

  
612 533
  # add sort to callback
613
  $form->{callback} = "$callback&sort=$form->{sort}";
614
  $callback = $form->escape($form->{callback});
534
  $form->{callback} = "$callback&sort=" . E($form->{sort});
615 535

  
616
  # initial item for subtotals
617
  if (@{ $form->{GL} }) {
618
    $sameitem = $form->{GL}->[0]->{ $form->{sort} };
619
  }
536
  $form->{balance} *= $ml;
620 537

  
621 538
  if ($form->{accno} && $form->{balance}) {
539
    my $row = {
540
      'balance' => {
541
        'data'  => $form->format_amount(\%myconfig, $form->{balance}, 2),
542
        'align' => 'right',
543
      },
544
    };
545

  
546
    $report->add_data($row);
547
  }
622 548

  
623
    map { $column_data{$_} = "<td>&nbsp;</td>" } @column_index;
624
    $column_data{balance} =
625
        "<td align=right>"
626
      . $form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0)
627
      . "</td>";
628

  
629
    $i++;
630
    $i %= 2;
631
    print qq|
632
        <tr class=listrow$i>
633
|;
634
    map { print "$column_data{$_}\n" } @column_index;
549
  my @totals_columns = qw(debit credit debit_tax credit_tax);
550
  my %subtotals      = map { $_ => 0 } @totals_columns;
551
  my %totals         = map { $_ => 0 } @totals_columns;
552
  my $idx            = 0;
635 553

  
636
    print qq|
637
        </tr>
638
|;
639
  }
640
  $form->{balance} *= $ml;
641 554
  foreach $ref (@{ $form->{GL} }) {
642 555
    $form->{balance} *= $ml;
643 556

  
644
    # if item ne sort print subtotal
645
    if ($form->{l_subtotal} eq 'Y') {
646
      if ($sameitem ne $ref->{ $form->{sort} }) {
647
        &gl_subtotal;
648
      }
649
    }
650

  
651
    #foreach $key (sort keys(%{ $ref->{amount} })) {
652
    #  $form->{balance} += $ref->{amount}{$key};
653
    #}
557
    my %rows;
654 558

  
655
    $debit = "";
656
    foreach $key (sort keys(%{ $ref->{debit} })) {
657
      $subtotaldebit += $ref->{debit}{$key};
658
      $totaldebit    += $ref->{debit}{$key};
659
      if ($key == 0) {
660
        $debit = $form->format_amount(\%myconfig, $ref->{debit}{$key}, 2, 0);
661
      } else {
662
        $debit .=
663
          "<br>" . $form->format_amount(\%myconfig, $ref->{debit}{$key}, 2, 0);
559
    foreach my $key (qw(debit credit debit_tax credit_tax)) {
560
      $rows{$key} = [];
561
      foreach my $idx (sort keys(%{ $ref->{$key} })) {
562
        my $value         = $ref->{$key}->{$idx};
563
        $subtotals{$key} += $value;
564
        $totals{$key}    += $value;
565
        $form->{balance}  = abs($form->{balance}) - abs($value);
566
        push @{ $rows{$key} }, $form->format_amount(\%myconfig, $value, 2);
664 567
      }
665
      $form->{balance} = abs($form->{balance}) - abs($ref->{debit}{$key});
666 568
    }
667 569

  
668
    $credit = "";
669
    foreach $key (sort keys(%{ $ref->{credit} })) {
670
      $subtotalcredit += $ref->{credit}{$key};
671
      $totalcredit    += $ref->{credit}{$key};
672
      if ($key == 0) {
673
        $credit = $form->format_amount(\%myconfig, $ref->{credit}{$key}, 2, 0);
674
      } else {
675
        $credit .= "<br>"
676
          . $form->format_amount(\%myconfig, $ref->{credit}{$key}, 2, 0);
677
      }
678
      $form->{balance} = abs($form->{balance}) - abs($ref->{credit}{$key});
570
    foreach my $key (qw(debit_accno credit_accno debit_tax_accno credit_tax_accno ac_transdate)) {
571
      my $col = $key eq 'ac_transdate' ? 'transdate' : $key;
572
      $rows{$col} = [ map { $ref->{$key}->{$_} } sort keys(%{ $ref->{$key} }) ];
679 573
    }
680 574

  
681
    $debittax = "";
682
    foreach $key (sort keys(%{ $ref->{debit_tax} })) {
683
      $subtotaldebittax += $ref->{debit_tax}{$key};
684
      $totaldebittax    += $ref->{debit_tax}{$key};
685
      if ($key == 0) {
686
        $debittax =
687
          $form->format_amount(\%myconfig, $ref->{debit_tax}{$key}, 2, 0);
688
      } else {
689
        $debittax .= "<br>"
690
          . $form->format_amount(\%myconfig, $ref->{debit_tax}{$key}, 2, 0);
691
      }
692
      $form->{balance} = abs($form->{balance}) - abs($ref->{debit_tax}{$key});
693
    }
575
    my $row = { };
576
    map { $row->{$_} = { 'data' => '', 'align' => $column_alignment{$_} } } @columns;
694 577

  
695
    $credittax = "";
696
    foreach $key (sort keys(%{ $ref->{credit_tax} })) {
697
      $subtotalcredittax += $ref->{credit_tax}{$key};
698
      $totalcredittax    += $ref->{credit_tax}{$key};
699
      if ($key == 0) {
700
        $credittax =
701
          $form->format_amount(\%myconfig, $ref->{credit_tax}{$key}, 2, 0);
702
      } else {
703
        $credittax .= "<br>"
704
          . $form->format_amount(\%myconfig, $ref->{credit_tax}{$key}, 2, 0);
705
      }
706
      $form->{balance} = abs($form->{balance}) - abs($ref->{credit_tax}{$key});
707
    }
578
    $row->{balance}->{data}        = $form->format_amount(\%myconfig, $form->{balance}, 2);
579
    $row->{projectnumbers}->{data} = join ", ", sort { lc($a) cmp lc($b) } keys %{ $ref->{projectnumbers} };
708 580

  
709
    $debitaccno  = "";
710
    $debittaxkey = "";
711
    $taxaccno    = "";
712
    foreach $key (sort keys(%{ $ref->{debit_accno} })) {
713
      if ($key == 0) {
714
        $debitaccno =
715
          "<a href=$href&accno=$ref->{debit_accno}{$key}&callback=$callback>$ref->{debit_accno}{$key}</a>";
716
      } else {
717
        $debitaccno .=
718
          "<br><a href=$href&accno=$ref->{debit_accno}{$key}&callback=$callback>$ref->{debit_accno}{$key}</a>";
719
      }
581
    map { $row->{$_}->{data} = $ref->{$_} } qw(id reference description source notes);
720 582

  
721
      #       if ($ref->{debit_taxkey}{$key} eq $debittaxkey) {
722
      #         $ref->{debit_tax_accno}{$key} = $taxaccno;
723
      #       }
724
      $taxaccno    = $ref->{debit_tax_accno}{$key};
725
      $debittaxkey = $ref->{debit_taxkey}{$key};
726
    }
583
    map { $row->{$_}->{data} = join "\n", @{ $rows{$_} }; } qw(transdate debit credit);
727 584

  
728
    $creditaccno  = "";
729
    $credittaxkey = "";
730
    $taxaccno     = "";
731
    foreach $key (sort keys(%{ $ref->{credit_accno} })) {
732
      if ($key == 0) {
733
        $creditaccno =
734
          "<a href=$href&accno=$ref->{credit_accno}{$key}&callback=$callback>$ref->{credit_accno}{$key}</a>";
735
      } else {
736
        $creditaccno .=
737
          "<br><a href=$href&accno=$ref->{credit_accno}{$key}&callback=$callback>$ref->{credit_accno}{$key}</a>";
738
      }
739

  
740
      #       if ($ref->{credit_taxkey}{$key} eq $credittaxkey) {
741
      #         $ref->{credit_tax_accno}{$key} = $taxaccno;
742
      #       }
743
      $taxaccno     = $ref->{credit_tax_accno}{$key};
744
      $credittaxkey = $ref->{credit_taxkey}{$key};
745
    }
585
    map { $row->{$_}->{data} = join "\n", @{ $rows{$_} } if ($ref->{"${_}_accno"} ne "") } qw(debit_tax credit_tax);
746 586

  
747
    $debittaxaccno = "";
748
    foreach $key (sort keys(%{ $ref->{debit_tax_accno} })) {
749
      if ($key == 0) {
750
        $debittaxaccno =
751
          "<a href=$href&accno=$ref->{debit_tax_accno}{$key}&callback=$callback>$ref->{debit_tax_accno}{$key}</a>";
587
    foreach my $col (qw(debit_accno credit_accno debit_tax_accno credit_tax_accno)) {
588
      if (lc $report->{options}->{output_format} eq 'html') {
589
        $row->{$col}->{raw_data} = join "<br>", map { "<a href=\"${callback}&accno=" . E($_) . "\">$_</a>" } @{ $rows{$col} };
752 590
      } else {
753
        $debittaxaccno .=
754
          "<br><a href=$href&accno=$ref->{debit_tax_accno}{$key}&callback=$callback>$ref->{debit_tax_accno}{$key}</a>";
591
        $row->{$col}->{data} = join "\n", @{ $rows{$col} };
755 592
      }
756 593
    }
757 594

  
758
    $credittaxaccno = "";
759
    foreach $key (sort keys(%{ $ref->{credit_tax_accno} })) {
760
      if ($key == 0) {
761
        $credittaxaccno =
762
          "<a href=$href&accno=$ref->{credit_tax_accno}{$key}&callback=$callback>$ref->{credit_tax_accno}{$key}</a>";
763
      } else {
764
        $credittaxaccno .=
765
          "<br><a href=$href&accno=$ref->{credit_tax_accno}{$key}&callback=$callback>$ref->{credit_tax_accno}{$key}</a>";
766
      }
767
    }
595
    $row->{reference}->{link} = build_std_url("script=$ref->{module}.pl", 'action=edit', 'id=' . E($ref->{id}), 'callback');
768 596

  
769
    $transdate = "";
770
    foreach $key (sort keys(%{ $ref->{ac_transdate} })) {
771
      if ($key == 0) {
772
        $transdate = "$ref->{ac_transdate}{$key}";
773
      } else {
774
        $transdate .= "<br>$ref->{ac_transdate}{$key}";
775
      }
597
    my $row_set = [ $row ];
598

  
599
    if (($form->{l_subtotal} eq 'Y')
600
        && (($idx == (scalar @{ $form->{GL} } - 1))
601
            || ($ref->{ $form->{sort} } ne $form->{GL}->[$idx + 1]->{ $form->{sort} }))) {
602
      push @{ $row_set }, create_subtotal_row(\%subtotals, \@columns, \%column_alignment, [ qw(debit credit) ], 'listsubtotal');
776 603
    }
777 604

  
778
    #    $ref->{debit} = $form->format_amount(\%myconfig, $ref->{debit}, 2, "&nbsp;");
779
    #    $ref->{credit} = $form->format_amount(\%myconfig, $ref->{credit}, 2, "&nbsp;");
780

  
781
    $column_data{id}        = "<td align=right>&nbsp;$ref->{id}&nbsp;</td>";
782
    $column_data{transdate}    = "<td align=center>$transdate</td>";
783
    $column_data{reference} =
784
      "<td align=center><a href=$ref->{module}.pl?action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{reference}</td>";
785
    $column_data{description}  = "<td align=center>$ref->{description}&nbsp;</td>";
786
    $column_data{source}       = "<td align=center>$ref->{source}&nbsp;</td>";
787
    $column_data{notes}        = "<td align=center>$ref->{notes}&nbsp;</td>";
788
    $column_data{debit}        = "<td align=right>$debit</td>";
789
    $column_data{debit_accno}  = "<td align=center>$debitaccno</td>";
790
    $column_data{credit}       = "<td align=right>$credit</td>";
791
    $column_data{credit_accno} = "<td align=center>$creditaccno</td>";
792
    $column_data{debit_tax}    =
793
      ($ref->{debit_tax_accno} ne "")
794
      ? "<td align=right>$debittax</td>"
795
      : "<td></td>";
796
    $column_data{debit_tax_accno} = "<td align=center>$debittaxaccno</td>";
797
    $column_data{credit_tax} =
798
      ($ref->{credit_tax_accno} ne "")
799
      ? "<td align=right>$credittax</td>"
800
      : "<td></td>";
801
    $column_data{credit_tax_accno} = "<td align=center>$credittaxaccno</td>";
802
    $column_data{balance} =
803
      "<td align=right>"
804
      . $form->format_amount(\%myconfig, $form->{balance}, 2, 0) . "</td>";
805
    $column_data{projectnumbers} =
806
      "<td>" . join(", ", sort({ lc($a) cmp lc($b) } keys(%{ $ref->{projectnumbers} }))) . "</td>";
807

  
808
    $i++;
809
    $i %= 2;
810
    print "
811
        <tr class=listrow$i>";
812
    map { print "$column_data{$_}\n" } @column_index;
813
    print "</tr>";
605
    $report->add_data($row_set);
814 606

  
607
    $idx++;
815 608
  }
816 609

  
817
  &gl_subtotal if ($form->{l_subtotal} eq 'Y');
818

  
819
  map { $column_data{$_} = "<td>&nbsp;</td>" } @column_index;
820

  
821
  my $balanced_ledger = $totaldebit 
822
                      + $totaldebittax 
823
                      - $totalcredit 
824
                      - $totalcredittax;
825
                    # = 0 for balanced ledger
826
                    
827
  $column_data{debit} =
828
    "<th align=right class=listtotal>"
829
    . $form->format_amount(\%myconfig, $totaldebit, 2, "&nbsp;") . "</th>";
830
  $column_data{credit} =
831
    "<th align=right class=listtotal>"
832
    . $form->format_amount(\%myconfig, $totalcredit, 2, "&nbsp;") . "</th>";
833
  $column_data{debit_tax} =
834
    "<th align=right class=listtotal>"
835
    . $form->format_amount(\%myconfig, $totaldebittax, 2, "&nbsp;") . "</th>";
836
  $column_data{credit_tax} =
837
    "<th align=right class=listtotal>"
838
    . $form->format_amount(\%myconfig, $totalcredittax, 2, "&nbsp;") . "</th>";
839
  $column_data{balance} =
840
    "<th align=right class=listtotal>"
841
    . $form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0) . "</th>";
842

  
843
  print qq|
844
	<tr class=listtotal>
845
|;
846

  
847
  map { print "$column_data{$_}\n" } @column_index;
848

  
849
  print qq|
850
        </tr>
851
        <tr>|;
852

  
610
  $report->add_separator();
853 611

  
854
  if ( abs($balanced_ledger) >  0.001 ) {
612
  # = 0 for balanced ledger
613
  my $balanced_ledger = $totals{debit} + $totals{debit_tax} - $totals{credit} - $totals{credit_tax};
855 614

  
856
    print qq|<td colspan="4" style="background-color:#FFA0A0" >|
857
        . $locale->text('Unbalanced Ledger') 
858
        . ": " 
859
        . $form->format_amount(\%myconfig, $balanced_ledger, 3, "&nbsp;")
860

  
861
  } elsif ( abs($balanced_ledger) <= 0.001 ) {
615
  my $row = create_subtotal_row(\%totals, \@columns, \%column_alignment, [ qw(debit credit debit_tax credit_tax) ], 'listtotal');
616
  $row->{balance} = {
617
    'data'  => $form->format_amount(\%myconfig, $form->{balance} * $ml, 2),
618
    'align' => 'right',
619
    'class' => 'listtotal',
620
  };
621
  $report->add_data($row);
862 622

  
863
    print qq|<td colspan="3">|
864
          . $locale->text('Balanced Ledger') 
623
  my $raw_bottom_info_text;
865 624

  
625
  if (!$form->{accno} && (abs($balanced_ledger) >  0.001)) {
626
    $raw_bottom_info_text .=
627
        '<p><span class="unbalanced_ledger">'
628
      . $locale->text('Unbalanced Ledger')
629
      . ': '
630
      . $form->format_amount(\%myconfig, $balanced_ledger, 3)
631
      . '</span></p> ';
866 632
  }
867 633

  
868
  
869
  print qq|
870
         </td>
871
        </tr>
872
        </tbody>
873
      </table>
874
    </td>
875
  </tr>
876
  <tr>
877
    <td><hr size=3 noshade></td>
878
  </tr>
879
</table>
634
  $raw_bottom_info_text .= $form->parse_html_template('gl/generate_report_bottom');
880 635

  
881
<br>
882

  
883
<form method=post action=$form->{script}>
884

  
885
<input name=callback type=hidden value="$form->{callback}">
636
  $report->set_options('raw_bottom_info_text' => $raw_bottom_info_text);
886 637

  
887
<input type=hidden name=login value=$form->{login}>
888
<input type=hidden name=password value=$form->{password}>
889

  
890
<input class=submit type=submit name=action value="|
891
    . $locale->text('GL Transaction') . qq|">
892
<input class=submit type=submit name=action value="|
893
    . $locale->text('AR Transaction') . qq|">
894
<input class=submit type=submit name=action value="|
895
    . $locale->text('AP Transaction') . qq|">
896
<input class=submit type=submit name=action value="|
897
    . $locale->text('Sales Invoice') . qq|">
898
<input class=submit type=submit name=action value="|
899
    . $locale->text('Vendor Invoice') . qq|">
638
  $report->generate_with_headers();
900 639

  
901
</form>
902

  
903
</body>
904
</html>
905
|;
906
  $lxdebug->leave_sub();
907

  
908
}
909

  
910
sub gl_subtotal {
911
  $lxdebug->enter_sub();
912

  
913
  $subtotaldebit =
914
    $form->format_amount(\%myconfig, $subtotaldebit, 2, "&nbsp;");
915
  $subtotalcredit =
916
    $form->format_amount(\%myconfig, $subtotalcredit, 2, "&nbsp;");
917

  
918
  map { $column_data{$_} = "<td>&nbsp;</td>" }
919
    qw(transdate id reference source description accno);
920
  $column_data{debit}  = "<th align=right>$subtotaldebit</td>";
921
  $column_data{credit} = "<th align=right>$subtotalcredit</td>";
922

  
923
  print "<tr class=listsubtotal>";
924
  map { print "$column_data{$_}\n" } @column_index;
925
  print "</tr>";
926

  
927
  $subtotaldebit  = 0;
928
  $subtotalcredit = 0;
929

  
930
  $sameitem = $ref->{ $form->{sort} };
931 640
  $lxdebug->leave_sub();
932

  
933 641
}
934 642

  
935 643
sub update {
css/lx-office-erp.css
218 218
label {
219 219
  cursor:pointer;
220 220
}
221

  
222
.unbalanced_ledger {
223
  background-color: #ffa0a0;
224
}
locale/de/all
176 176
  'Backup of dataset'           => 'Sicherung der Datenbank',
177 177
  'Balance'                     => 'Bilanz',
178 178
  'Balance Sheet'               => 'Bilanz',
179
  'Balanced Ledger'             => 'Bilanz ausgeglichen',
180 179
  'Bank'                        => 'Bank',
181 180
  'Bank Code'                   => 'BLZ',
182 181
  'Bank Code (long)'            => 'Bankleitzahl (BLZ)',
......
205 204
  'Buchungsdatum'               => 'Buchungsdatum',
206 205
  'Buchungsgruppe'              => 'Buchungsgruppe',
207 206
  'Buchungsgruppen'             => 'Buchungsgruppen',
208
  'Buchungsjournal'             => 'Buchungsjournal',
209 207
  'Buchungsnummer'              => 'Buchungsnummer',
210 208
  'Business Number'             => 'Firmennummer',
211 209
  'Business Volume'             => 'Gesch?ftsvolumen',
......
216 214
  'Calculate'                   => 'Berechnen',
217 215
  'Cancel Accounts Payables Transaction' => 'Kreditorenbuchung stornieren',
218 216
  'Cancel Accounts Receivables Transaction' => 'Debitorenbuchung stornieren',
219
  'Cancel General Ledger Transaction' => 'Buchung stornieren',
220 217
  'Cannot create Lock!'         => 'System kann nicht gesperrt werden!',
221 218
  'Cannot delete account!'      => 'Konto kann nicht gel?scht werden!',
222 219
  'Cannot delete customer!'     => 'Kunde kann nicht gel?scht werden!',
......
1290 1287
  'emailed to'                  => 'gemailt an',
1291 1288
  'for Period'                  => 'f?r den Zeitraum',
1292 1289
  'from (time)'                 => 'von',
1290
  'general_ledger_list'         => 'buchungsjournal',
1293 1291
  'history'                     => 'Historie',
1294 1292
  'history search engine'       => 'Historien Suchmaschine',
1295 1293
  'invoice'                     => 'Rechnung',
locale/de/gl
1 1
$self->{texts} = {
2 2
  'ADDED'                       => 'Hinzugef?gt',
3
  'AP Transaction'              => 'Kreditorenbuchung',
4
  'AR Transaction'              => 'Debitorenbuchung',
5 3
  'Account'                     => 'Konto',
6 4
  'Add General Ledger Transaction' => 'Dialogbuchen',
7 5
  'Address'                     => 'Adresse',
......
14 12
  'Aug'                         => 'Aug',
15 13
  'August'                      => 'August',
16 14
  'Balance'                     => 'Bilanz',
17
  'Balanced Ledger'             => 'Bilanz ausgeglichen',
18 15
  'Belegnummer'                 => 'Buchungsnummer',
19 16
  'Bin List'                    => 'Lagerliste',
20 17
  'Bis'                         => 'bis',
21 18
  'Buchungsdatum'               => 'Buchungsdatum',
22
  'Buchungsjournal'             => 'Buchungsjournal',
23 19
  'Buchungsnummer'              => 'Buchungsnummer',
24 20
  'CANCELED'                    => 'Storniert',
25
  'Cancel General Ledger Transaction' => 'Buchung stornieren',
21
  'CSV export -- options'       => 'CSV-Export -- Optionen',
22
  'Cancel Accounts Receivables Transaction' => 'Debitorenbuchung stornieren',
26 23
  'Cannot delete transaction!'  => 'Buchung kann nicht gel?scht werden!',
27 24
  'Cannot have a value in both Debit and Credit!' => 'Es kann nicht gleichzeitig Soll und Haben gebucht werden!',
28 25
  'Cannot post a transaction without a value!' => 'Eine Buchung ohne Betrag kann nicht vorgenommen werden!',
......
32 29
  'Confirmation'                => 'Auftragsbest?tigung',
33 30
  'Continue'                    => 'Weiter',
34 31
  'Contra'                      => 'gegen',
32
  'Could not spawn html2ps or GhostScript.' => 'html2ps oder GhostScript konnte nicht gestartet werden.',
33
  'Could not spawn the printer command.' => 'Die Druckanwendung konnte nicht gestartet werden.',
34
  'Could not write the html2ps config file.' => 'Die tempor&auml;re html2ps-Konfigurationsdatei konnte nicht geschrieben werden.',
35
  'Could not write the temporary HTML file.' => 'Eine tempor&auml;re HTML-Datei konnte nicht geschrieben werden.',
35 36
  'Credit'                      => 'Haben',
36 37
  'Credit Account'              => 'Habenkonto',
37 38
  'Credit Note'                 => 'Gutschrift',
......
68 69
  'Feb'                         => 'Feb',
69 70
  'February'                    => 'Februar',
70 71
  'From'                        => 'Von',
71
  'GL Transaction'              => 'Dialogbuchung',
72
  'General Ledger'              => 'Finanzbuchhaltung',
73 72
  'History'                     => 'Historie',
74 73
  'ID'                          => 'Buchungsnummer',
75 74
  'Include in Report'           => 'In Bericht aufnehmen',
76 75
  'Invoice'                     => 'Rechnung',
77 76
  'Jan'                         => 'Jan',
78 77
  'January'                     => 'Januar',
78
  'Journal'                     => 'Buchungsjournal',
79 79
  'Jul'                         => 'Jul',
80 80
  'July'                        => 'Juli',
81 81
  'Jun'                         => 'Jun',
......
111 111
  'October'                     => 'Oktober',
112 112
  'Out of balance transaction!' => 'Buchung ist nicht ausgeglichen!',
113 113
  'PAYMENT POSTED'              => 'Rechung gebucht',
114
  'PDF export -- options'       => 'PDF-Export -- Optionen',
114 115
  'POSTED'                      => 'Gebucht',
115 116
  'POSTED AS NEW'               => 'Als neu gebucht',
116 117
  'PRINTED'                     => 'Gedruckt',
......
136 137
  'SAVED'                       => 'Gespeichert',
137 138
  'SAVED FOR DUNNING'           => 'Gespeichert',
138 139
  'SCREENED'                    => 'Angezeigt',
139
  'Sales Invoice'               => 'Rechnung',
140 140
  'Select a Customer'           => 'Endkunde ausw?hlen',
141 141
  'Select a part'               => 'Artikel ausw&auml;hlen',
142 142
  'Select a project'            => 'Projekt ausw&auml;hlen',
......
154 154
  'Tax'                         => 'Steuer',
155 155
  'Taxkey'                      => 'Steuerschl?ssel',
156 156
  'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
157
  'The list has been printed.'  => 'Die Liste wurde ausgedruckt.',
157 158
  'To (time)'                   => 'Bis',
158 159
  'Transaction %d cancelled.'   => 'Buchung %d erfolgreich storniert.',
159 160
  'Transaction Date missing!'   => 'Buchungsdatum fehlt!',
......
166 167
  'Update'                      => 'Erneuern',
167 168
  'Value'                       => 'Wert',
168 169
  'Variable'                    => 'Variable',
169
  'Vendor Invoice'              => 'Einkaufsrechnung',
170 170
  'Vendor details'              => 'Lieferantendetails',
171 171
  'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
172 172
  'Vendor not on file!'         => 'Lieferant ist nicht in der Datenbank!',
173 173
  'Yes'                         => 'Ja',
174 174
  'bin_list'                    => 'Lagerliste',
175 175
  'button'                      => '?',
176
  'general_ledger_list'         => 'buchungsjournal',
176 177
  'invoice'                     => 'Rechnung',
177 178
  'no'                          => 'nein',
178 179
  'packing_list'                => 'Versandliste',
179 180
  'pick_list'                   => 'Entnahmeliste',
180 181
  'proforma'                    => 'Proforma',
181 182
  'purchase_order'              => 'Auftrag',
183
  'report_generator_dispatch_to is not defined.' => 'report_generator_dispatch_to ist nicht definiert.',
184
  'report_generator_nextsub is not defined.' => 'report_generator_nextsub ist nicht definiert.',
182 185
  'request_quotation'           => 'Angebotsanforderung',
183 186
  'sales_order'                 => 'Kundenauftrag',
184 187
  'sales_quotation'             => 'Verkaufsangebot',
......
201 204
  'check_name'                  => 'check_name',
202 205
  'check_project'               => 'check_project',
203 206
  'continue'                    => 'continue',
207
  'create_subtotal_row'         => 'create_subtotal_row',
204 208
  'delete'                      => 'delete',
205 209
  'delivery_customer_selection' => 'delivery_customer_selection',
206 210
  'display_form'                => 'display_form',
......
211 215
  'form_header'                 => 'form_header',
212 216
  'format_dates'                => 'format_dates',
213 217
  'generate_report'             => 'generate_report',
214
  'gl_subtotal'                 => 'gl_subtotal',
215 218
  'gl_transaction'              => 'gl_transaction',
216 219
  'mark_as_paid_common'         => 'mark_as_paid_common',
217 220
  'name_selected'               => 'name_selected',
......
223 226
  'project_selected'            => 'project_selected',
224 227
  'project_selection_internal'  => 'project_selection_internal',
225 228
  'reformat_numbers'            => 'reformat_numbers',
229
  'report_generator_back'       => 'report_generator_back',
230
  'report_generator_dispatcher' => 'report_generator_dispatcher',
231
  'report_generator_do'         => 'report_generator_do',
232
  'report_generator_export_as_csv' => 'report_generator_export_as_csv',
233
  'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
226 234
  'sales_invoice'               => 'sales_invoice',
227 235
  'search'                      => 'search',
228 236
  'select_employee'             => 'select_employee',
locale/de/rp
121 121
  'Pick List'                   => 'Sammelliste',
122 122
  'Please enter values'         => 'Bitte Werte eingeben',
123 123
  'Postscript'                  => 'Postscript',
124
  'Print'                       => 'Drucken',
125 124
  'Printer'                     => 'Drucker',
126 125
  'Proforma Invoice'            => 'Proformarechnung',
127 126
  'Project'                     => 'Projekt',
......
144 143
  'Select a Customer'           => 'Endkunde ausw?hlen',
145 144
  'Select a part'               => 'Artikel ausw&auml;hlen',
146 145
  'Select a project'            => 'Projekt ausw&auml;hlen',
147
  'Select all'                  => 'Alle ausw?hlen',
148 146
  'Select an employee'          => 'Angestellten ausw&auml;hlen',
149 147
  'Select from one of the names below' => 'W?hlen Sie einen der untenstehenden Namen',
150 148
  'Select from one of the projects below' => 'W?hlen Sie eines der untenstehenden Projekte',
templates/webpages/gl/generate_report_bottom_de.html
1
<form method="post" action="gl.pl">
2

  
3
 <input name="callback" type="hidden" value="<TMPL_VAR callback ESCAPE=HTML>">
4

  
5
 <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
6
 <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
7

  
8
 <input class="submit" type="submit" name="action" value="Dialogbuchung">
9
 <input class="submit" type="submit" name="action" value="Debitorenbuchung">
10
 <input class="submit" type="submit" name="action" value="Kreditorenbuchung">
11
 <input class="submit" type="submit" name="action" value="Rechnung">
12
 <input class="submit" type="submit" name="action" value="Einkaufsrechnung">
13

  
14
</form>
templates/webpages/gl/generate_report_bottom_master.html
1
<form method="post" action="gl.pl">
2

  
3
 <input name="callback" type="hidden" value="<TMPL_VAR callback ESCAPE=HTML>">
4

  
5
 <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
6
 <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
7

  
8
 <input class="submit" type="submit" name="action" value="<translate>GL Transaction</translate>">
9
 <input class="submit" type="submit" name="action" value="<translate>AR Transaction</translate>">
10
 <input class="submit" type="submit" name="action" value="<translate>AP Transaction</translate>">
11
 <input class="submit" type="submit" name="action" value="<translate>Sales Invoice</translate>">
12
 <input class="submit" type="submit" name="action" value="<translate>Vendor Invoice</translate>">
13

  
14
</form>

Auch abrufbar als: Unified diff