]> wagnertech.de Git - mfinanz.git/blobdiff - bin/mozilla/rp.pl
Simple Übergaben von globals an templates in templates verschoben
[mfinanz.git] / bin / mozilla / rp.pl
index 8ec6c45037ca385450d7cfa32c7c8af5cce83931..ae2669fe35e046fe31384899138b3178f83a5ae4 100644 (file)
@@ -39,6 +39,7 @@ use POSIX qw(strftime);
 
 use SL::DB::Default;
 use SL::DB::Project;
+use SL::DB::Customer;
 use SL::PE;
 use SL::RP;
 use SL::Iconv;
@@ -140,6 +141,7 @@ sub report {
   );
 
   $::form->{title} = $title{$::form->{report}};
+  $::request->{layout}->add_javascripts('autocomplete_customer.js');
 
   # get departments
   $::form->all_departments(\%::myconfig);
@@ -197,8 +199,6 @@ sub report {
     year                => DateTime->today->year,
     today               => DateTime->today,
     nextsub             => $nextsub,
-    accrual             => $::instance_conf->get_accounting_method ne 'cash',
-    cash                => $::instance_conf->get_accounting_method eq 'cash',
     is_payments         => $is_payments,
     is_trial_balance    => $is_trial_balance,
     is_balance_sheet    => $is_balance_sheet,
@@ -221,10 +221,6 @@ sub generate_income_statement {
   my %myconfig = %main::myconfig;
   my $locale   = $main::locale;
 
-  my $defaults = SL::DB::Default->get;
-  $form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates;
-  $form->{templates} = $defaults->templates;
-
   $form->{padding} = "  ";
   $form->{bold}    = "<b>";
   $form->{endbold} = "</b>";
@@ -634,6 +630,11 @@ sub generate_trial_balance {
   $form->{company} = $locale->text('Company') . " " . $defaults->company;
   push (@options, $form->{company});
 
+  if ($::form->{customer_id}) {
+    my $customer = SL::DB::Manager::Customer->find_by(id => $::form->{customer_id});
+    push @options, $::locale->text('Customer') . ' ' . $customer->displayable_name;
+  }
+
 
   $form->{template_to} = $locale->date(\%myconfig, $form->{todate}, 0);
 
@@ -1128,7 +1129,6 @@ sub e_mail {
 
   $::form->header;
   print $::form->parse_html_template('rp/e_mail', {
-    show_bcc      => $::auth->assert('email_bcc', 'may fail'),
     print_options => print_options(inline => 1),
     hidden_values => \@hidden_values,
   });
@@ -1627,8 +1627,6 @@ sub print_options {
   $::form->{SM}{ $::form->{sendmode} } = "selected";
 
   my $output = $::form->parse_html_template('rp/print_options', {
-    got_printer => $::myconfig{printer},
-    show_latex  => $::lx_office_conf{print_templates}->{latex},
     is_email    => $::form->{media} eq 'email',
   });
 
@@ -1793,8 +1791,7 @@ sub generate_bwa {
     # if (defined ($form->{fromdate|todate}=='..'))
     # immer wahr
     if ($form->{fromdate}){
-      my ($yy, $mm, $dd) = $locale->parse_date(\%myconfig, $form->{fromdate});
-      my $datetime = $locale->parse_date_to_object(\%myconfig, $form->{fromdate});
+      my $datetime = $locale->parse_date_to_object($form->{fromdate});
       $datetime->set( month      => 1,
                       day        => 1);
       $form->{comparefromdate} = $locale->format_date(\%::myconfig, $datetime);
@@ -1847,6 +1844,7 @@ sub generate_bwa {
 
   $form->{title} = $locale->text('BWA');
 
+  $::request->layout->add_stylesheets('bwa.css');
   $form->header;
   print $form->parse_html_template('rp/bwa');