X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Frp.pl;h=966df6e025f5132cf60b4d44561dd9d5a5892475;hb=98662ad2b031a81c88ce6da0babf6f9d0b37059a;hp=9e3bc9fc9a670d9f9da524a562a7724b48bf1e67;hpb=fbbfe531162f1aa0bfff02e1dbd944b6851915b7;p=kivitendo-erp.git diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index 9e3bc9fc9..966df6e02 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -36,6 +36,7 @@ #====================================================================== require "$form->{path}/arap.pl"; +require "bin/mozilla/common.pl"; use SL::PE; use SL::RP; @@ -130,6 +131,21 @@ sub report { | if $form->{selectdepartment}; + $form->get_lists("projects" => { "key" => "ALL_PROJECTS", + "all" => 1 }); + + my %project_labels = (); + my @project_values = (""); + foreach my $item (@{ $form->{"ALL_PROJECTS"} }) { + push(@project_values, $item->{"id"}); + $project_labels{$item->{"id"}} = $item->{"projectnumber"}; + } + + my $projectnumber = + NTI($cgi->popup_menu('-name' => "project_id", + '-values' => \@project_values, + '-labels' => \%project_labels)); + # use JavaScript Calendar or not $form->{jsscript} = $jscalendar; $jsscript = ""; @@ -280,7 +296,7 @@ $jsscript print qq| | . $locale->text('Project') . qq| - + $projectnumber @@ -390,7 +406,7 @@ $jsscript print qq| | . $locale->text('Project') . qq| - + $projectnumber @@ -495,7 +511,7 @@ $checked> | . $locale->text('Decimalplaces') . qq| - + $jsscript @@ -620,7 +636,7 @@ $checked> | . $locale->text('Decimalplaces') . qq| - + @@ -1062,10 +1078,6 @@ sub generate_income_statement { $form->{endbold} = ""; $form->{br} = "
"; - &get_project(generate_income_statement); - - $form->{projectnumber} = $form->{projectnumber_1}; - if ($form->{reporttype} eq "custom") { #forgotten the year --> thisyear @@ -1253,7 +1265,8 @@ sub generate_balance_sheet { $form->{IN} = "balance_sheet.html"; # setup company variables for the form - map { $form->{$_} = $myconfig{$_} } + map { $form->{$_} = $myconfig{$_}; + $form->{$_} =~ s/\\n/\n/g; } (qw(company address businessnumber nativecurr)); $form->{templates} = $myconfig{templates}; @@ -1392,8 +1405,8 @@ sub list_accounts { $ml = ($ref->{category} =~ /(A|C|E)/) ? -1 : 1; - $debit = $form->format_amount(\%myconfig, $ref->{debit}, 2, " "); - $credit = $form->format_amount(\%myconfig, $ref->{credit}, 2, " "); + $debit = ($ref->{debit} != 0) ? $form->format_amount(\%myconfig, $ref->{debit}, 2, " ") : " "; + $credit = ($ref->{credit} != 0) ? $form->format_amount(\%myconfig, $ref->{credit}, 2, " ") : " "; $begbalance = $form->format_amount(\%myconfig, $ref->{balance} * $ml, 2, " "); $endbalance = @@ -1672,14 +1685,14 @@ sub aging { $i++; if ($subtotal) { - $c0subtotal = - $form->format_amount(\%myconfig, $c0subtotal, 2, " "); - $c30subtotal = - $form->format_amount(\%myconfig, $c30subtotal, 2, " "); - $c60subtotal = - $form->format_amount(\%myconfig, $c60subtotal, 2, " "); - $c90subtotal = - $form->format_amount(\%myconfig, $c90subtotal, 2, " "); + $c0subtotal = ($c0subtotal != 0) ? + $form->format_amount(\%myconfig, $c0subtotal, 2, " ") : ""; + $c30subtotal = ($c30subtotal != 0) ? + $form->format_amount(\%myconfig, $c30subtotal, 2, " ") : ""; + $c60subtotal = ($c60subtotal != 0) ? + $form->format_amount(\%myconfig, $c60subtotal, 2, " ") : ""; + $c90subtotal = ($c90subtotal != 0) ? + $form->format_amount(\%myconfig, $c90subtotal, 2, " ") : ""; } $column_data{ct} = qq| |; @@ -1735,10 +1748,10 @@ sub aging { $c60total += $ref->{c60}; $c90total += $ref->{c90}; - $ref->{c0} = $form->format_amount(\%myconfig, $ref->{c0}, 2, " "); - $ref->{c30} = $form->format_amount(\%myconfig, $ref->{c30}, 2, " "); - $ref->{c60} = $form->format_amount(\%myconfig, $ref->{c60}, 2, " "); - $ref->{c90} = $form->format_amount(\%myconfig, $ref->{c90}, 2, " "); + $ref->{c0} = ($ref->{c0} != 0) ? $form->format_amount(\%myconfig, $ref->{c0}, 2, " ") : ""; + $ref->{c30} = ($ref->{c30} != 0) ? $form->format_amount(\%myconfig, $ref->{c30}, 2, " ") : ""; + $ref->{c60} = ($ref->{c60} != 0) ? $form->format_amount(\%myconfig, $ref->{c60}, 2, " ") : ""; + $ref->{c90} = ($ref->{c90} != 0) ? $form->format_amount(\%myconfig, $ref->{c90}, 2, " ") : ""; $href = qq|$ref->{module}.pl?path=$form->{path}&action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=| @@ -1850,16 +1863,10 @@ sub aging { -|; - } - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } + . $locale->text('E-mail') . qq|">|; +} - print qq| +print qq| @@ -2119,7 +2126,13 @@ sub print_form { } } } - + # saving the history + if(!exists $form->{addition} && $form->{id} ne "") { + $form->{addition} = "PRINTED"; + $form->{what_done} = $form->{type}; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history $lxdebug->leave_sub(); } @@ -2132,10 +2145,10 @@ sub statement_details { push @{ $form->{duedate} }, $ref->{duedate}; foreach $item (qw(c0 c30 c60 c90)) { - eval { + if ($ref->{exchangerate} * 1) { $ref->{$item} = $form->round_amount($ref->{$item} / $ref->{exchangerate}, 2); - }; + } $form->{"${item}total"} += $ref->{$item}; $form->{total} += $ref->{$item}; push @{ $form->{$item} }, @@ -2637,7 +2650,16 @@ sub print_options { $lxdebug->enter_sub(); $form->{sendmode} = "attachment"; - $form->{copies} = 2 unless $form->{copies}; + + $form->{"format"} = + $form->{"format"} ? $form->{"format"} : + $myconfig{"template_format"} ? $myconfig{"template_format"} : + "pdf"; + + $form->{"copies"} = + $form->{"copies"} ? $form->{"copies"} : + $myconfig{"copies"} ? $myconfig{"copies"} : + 2; $form->{PD}{ $form->{type} } = "selected"; $form->{DF}{ $form->{format} } = "selected"; @@ -2710,8 +2732,6 @@ sub generate_bwa { $form->{endbold} = ""; $form->{br} = "
"; - # &get_project(generate_bwa); - if ($form->{reporttype} eq "custom") { #forgotten the year --> thisyear