X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fca.pl;h=c2fd6a218fda525373143ab36e10114c67b58f65;hb=8bde65163db8c36ffa5e83bed7ee68ab859c106d;hp=497ee6157483da95df7ec11567853eef6be8bd73;hpb=ec022a581e19d03e34ae31e7ba53ee4dde66ea73;p=kivitendo-erp.git diff --git a/bin/mozilla/ca.pl b/bin/mozilla/ca.pl index 497ee6157..c2fd6a218 100644 --- a/bin/mozilla/ca.pl +++ b/bin/mozilla/ca.pl @@ -35,9 +35,12 @@ use POSIX qw(strftime); use SL::CA; +use SL::DB::Default; use SL::ReportGenerator; -require "bin/mozilla/report_generator.pl"; +require "bin/mozilla/reportgenerator.pl"; + +use strict; 1; @@ -72,10 +75,21 @@ require "bin/mozilla/report_generator.pl"; # $locale->text('Dec') sub chart_of_accounts { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my %myconfig = %main::myconfig; + my $locale = $main::locale; + + $main::auth->assert('report'); $form->{title} = $locale->text('Chart of Accounts'); + if ( $::instance_conf->get_accounting_method eq 'cash' ) { + # $form->{method} can probably be made redundant now that we have get_accounting_method + $form->{method} = "cash"; + } + CA->all_accounts(\%myconfig, \%$form); my @columns = qw(accno description debit credit); @@ -94,6 +108,7 @@ sub chart_of_accounts { 'std_column_visibility' => 1, ); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; $report->set_columns(%column_defs); $report->set_column_order(@columns); @@ -105,6 +120,7 @@ sub chart_of_accounts { my %totals = ('debit' => 0, 'credit' => 0); foreach my $ca (@{ $form->{CA} }) { + next unless defined $ca->{amount}; my $row = { }; foreach (qw(debit credit)) { @@ -130,94 +146,162 @@ sub chart_of_accounts { $report->generate_with_headers(); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub list { - $lxdebug->enter_sub(); + $::lxdebug->enter_sub; + $::auth->assert('report'); - $form->{title} = $locale->text('List Transactions'); - $form->{title} .= " - " . $locale->text('Account') . " $form->{accno}"; + $::form->{title} = $::locale->text('List Transactions') . " - " . $::locale->text('Account') . " $::form->{accno}"; - # get departments - $form->all_departments(\%myconfig); - if (@{ $form->{all_departments} }) { - $form->{selectdepartment} = "\n"; + $::form->header; + print $::form->parse_html_template('ca/list', { + year => DateTime->today->year, + }); - map { - $form->{selectdepartment} .= - "$_->{description}--$_->{id}\n" - } (@{ $form->{all_departments} }); - } + $::lxdebug->leave_sub; +} + +sub format_debit_credit { + $main::lxdebug->enter_sub(); + + my $dc = shift; + + my $form = $main::form; + my %myconfig = %main::myconfig; + my $locale = $main::locale; + + my $formatted_dc = $form->format_amount(\%myconfig, abs($dc), 2) . ' '; + $formatted_dc .= ($dc > 0) ? $locale->text('Credit (one letter abbreviation)') : $locale->text('Debit (one letter abbreviation)'); - $department = qq| - - | . $locale->text('Department') . qq| - $form->{selectdepartment} - -| if $form->{selectdepartment}; - - $form->header; - - $form->{description} =~ s/\"/"/g; - - print qq| - - -{script}> - -{accno}> - - - -{accounttype}> - - - $form->{title} - - - - $department - - | . $locale->text('From') . qq| - - | . $locale->text('To') . qq| - - - - | . $locale->text('Include in Report') . qq| - - | - . $locale->text('Subtotal') . qq| - - - - - - - -{login}> -{password}> - - - - - -