X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=bin%2Fmozilla%2Fca.pl;h=4bef1d2ee147c0fa1ce7e3920659f8433ba2094a;hb=1f9b0c55e2288183a36b9026f1758a3921967811;hp=372004e1b6ee0a579b3085fcae5627028d1818de;hpb=7d0e997b23aad589dc6d052a177bb277122cdf42;p=kivitendo-erp.git diff --git a/bin/mozilla/ca.pl b/bin/mozilla/ca.pl index 372004e1b..4bef1d2ee 100644 --- a/bin/mozilla/ca.pl +++ b/bin/mozilla/ca.pl @@ -35,10 +35,13 @@ use POSIX qw(strftime); use SL::CA; +use SL::DB::Default; use SL::ReportGenerator; require "bin/mozilla/reportgenerator.pl"; +use strict; + 1; # end of main @@ -72,12 +75,21 @@ require "bin/mozilla/reportgenerator.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; - $auth->assert('report'); + $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); @@ -96,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); @@ -107,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)) { @@ -132,246 +146,50 @@ 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'); - $auth->assert('report'); + $::form->{title} = $::locale->text('List Transactions') . " - " . $::locale->text('Account') . " $::form->{accno}" . " - " . $::form->{description}; - $form->{title} = $locale->text('List Transactions'); - $form->{title} .= " - " . $locale->text('Account') . " $form->{accno}"; - $year = (localtime)[5] + 1900; + $::form->header; + print $::form->parse_html_template('ca/list', { + year => DateTime->today->year, + }); - # get departments - $form->all_departments(\%myconfig); - if (@{ $form->{all_departments} }) { - $form->{selectdepartment} = "\n"; + $::lxdebug->leave_sub; +} - map { - $form->{selectdepartment} .= - "$_->{description}--$_->{id}\n" - } (@{ $form->{all_departments} }); - } +sub format_debit_credit { + $main::lxdebug->enter_sub(); - $department = qq| - - | . $locale->text('Department') . qq| - $form->{selectdepartment} - -| if $form->{selectdepartment}; - $accrual = ($eur) ? "" : "checked"; - $cash = ($eur) ? "checked" : ""; - - $name_1 = "fromdate"; - $id_1 = "fromdate"; - $value_1 = "$form->{fromdate}"; - $trigger_1 = "trigger1"; - $name_2 = "todate"; - $id_2 = "todate"; - $value_2 = ""; - $trigger_2 = "trigger2"; - - - # with JavaScript Calendar - if ($form->{jsscript}) { - if ($name_1 eq "") { - - $button1 = qq| - |; - $button1_2 = qq| - text('button') . qq|>|; - - #write Trigger - $jsscript = - Form->write_trigger(\%myconfig, "1", "$name_2", "BR", "$trigger_2"); - } else { - $button1 = qq| - |; - $button1_2 = qq| - text('button') . qq|>|; - $button2 = qq| - |; - $button2_2 = qq| - text('button') . qq|> - |; - - #write Trigger - $jsscript = - Form->write_trigger(\%myconfig, "2", "$name_1", "BR", "$trigger_1", - "$name_2", "BL", "$trigger_2"); - } - } else { + my $dc = shift; - # without JavaScript Calendar - if ($name_1 eq "") { - $button1 = - qq||; - } else { - $button1 = - qq||; - $button2 = - qq||; - } - } - $form->{javascript} .= qq||; - $form->header; - $onload = qq|focus()|; - $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|; - $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|; - - - $form->header; - - $form->{description} =~ s/\"/"/g; - - print qq| - - -{script}> - -{accno}> - - - -{accounttype}> - - - - $form->{title} - - - - - - | - . $locale->text('Customized Report') . qq| - - - | . $locale->text('Year') . qq| - - -|; - - print qq| - - - | . $locale->text('Yearly') . qq| - | . $locale->text('Quarterly') . qq| - | . $locale->text('Monthly') . qq| - - - - 1. | - . $locale->text('Quarter') . qq| -|; - $checked = "checked"; - print qq| - | - . $locale->text('January') . qq| -|; - $checked = ""; - print qq| - | - . $locale->text('May') . qq| - | - . $locale->text('September') . qq| - - - - - 2. | - . $locale->text('Quarter') . qq| - | - . $locale->text('February') . qq| - | - . $locale->text('June') . qq| - | - . $locale->text('October') . qq| - - - - 3. | - . $locale->text('Quarter') . qq| - | - . $locale->text('March') . qq| - | - . $locale->text('July') . qq| - | - . $locale->text('November') . qq| - - - - - 4. | - . $locale->text('Quarter') . qq| - | - . $locale->text('April') . qq| - | - . $locale->text('August') . qq| - | - . $locale->text('December') . qq| - - - - - - - | - . $locale->text('Free report period') . qq| - | . $locale->text('From') . qq| - $button1 - $button1_2 - | . $locale->text('Bis') . qq| - $button2 - $button2_2 - - - - - - - | . $locale->text('Method') . qq| - | - . $locale->text('Accrual') . qq| - | - . $locale->text('EUR') . qq| - - - | - . $locale->text('Decimalplaces') - . qq| - - - - | . $locale->text('Subtotal') . qq| - - -$jsscript - - - - - - - -