X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Frp.pl;h=cc272249df3874a5aa2944e48af3b96c83b43c82;hb=6bad0469c4f5bb92830f77cf7675e76730e79ae4;hp=47d6d4b645f1c8621fa08892bb09412420b0a67f;hpb=9324ddb241ed8818d2067b76a2a3fdaf6a1c90ba;p=kivitendo-erp.git diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index 47d6d4b64..cc272249d 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -35,10 +35,12 @@ # #====================================================================== -require "$form->{path}/arap.pl"; +require "bin/mozilla/arap.pl"; +require "bin/mozilla/common.pl"; use SL::PE; use SL::RP; +use SL::USTVA; 1; @@ -108,9 +110,7 @@ sub report { $accrual = ($eur) ? "" : "checked"; $cash = ($eur) ? "checked" : ""; - ($null, $null, $null, $null, $null, $year, $null, $null, $null) = - localtime(); - $year += 1900; + $year = (localtime)[5] + 1900; # get departments $form->all_departments(\%myconfig); @@ -130,6 +130,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 = ""; @@ -183,7 +198,7 @@ sub report { if ($name_1 eq "") { $button1 = qq| - |; + |; $button1_2 = qq| text('button') . qq|>|; @@ -193,12 +208,12 @@ sub report { 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|> @@ -214,19 +229,21 @@ sub report { # without JavaScript Calendar if ($name_1 eq "") { $button1 = - qq||; + qq||; } else { $button1 = - qq||; + qq||; $button2 = - qq||; + 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|')|; print qq| - +
{script}> @@ -280,7 +297,7 @@ $jsscript print qq| | . $locale->text('Project') . qq| - + $projectnumber @@ -390,7 +407,7 @@ $jsscript print qq| | . $locale->text('Project') . qq| - + $projectnumber @@ -687,8 +704,6 @@ $jsscript } if ($form->{report} =~ /^tax_/) { - $gifi = ""; - $form->{db} = ($form->{report} =~ /_collected/) ? "ar" : "ap"; RP->get_taxaccounts(\%myconfig, \%$form); @@ -725,32 +740,6 @@ $jsscript -|; - - if (@{ $form->{gifi_taxaccounts} }) { - print qq| - - | . $locale->text('GIFI') . qq| - -|; - - foreach $ref (@{ $form->{gifi_taxaccounts} }) { - - print - qq| $ref->{description} - - - |; - - } - - print qq| - - -|; - } - - print qq| | . $locale->text('Method') . qq| | @@ -807,8 +796,6 @@ $jsscript } if ($form->{report} =~ /^nontaxable_/) { - $gifi = ""; - $form->{db} = ($form->{report} =~ /_sales/) ? "ar" : "ap"; print qq| @@ -872,8 +859,6 @@ $jsscript } if (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) { - $gifi = ""; - if ($form->{report} eq 'ar_aging') { $label = $locale->text('Customer'); $form->{vc} = 'customer'; @@ -922,8 +907,6 @@ $jsscript # above action can be removed if there is more than one input field if ($form->{report} =~ /(receipts|payments)$/) { - $gifi = ""; - $form->{db} = ($form->{report} =~ /payments$/) ? "ap" : "ar"; RP->paymentaccounts(\%myconfig, \%$form); @@ -993,7 +976,6 @@ $jsscript
-{path}> {login}> {password}> @@ -1001,9 +983,8 @@ $jsscript . $locale->text('Continue') . qq|"> |; - # Hier Aufruf von get_config aus bin/mozilla/fa.pl zum - # Einlesen der Finanzamtdaten - get_config($userspath, 'finanzamt.ini'); + # Hier Aufruf von get_config zum Einlesen der Finanzamtdaten + USTVA->get_config($userspath, 'finanzamt.ini'); $disabled = qq|disabled="disabled"|; $disabled = '' if ($form->{elster} eq '1'); @@ -1030,7 +1011,7 @@ $jsscript $lxdebug->leave_sub(); } -sub continue { &{ $form->{nextsub} } } +sub continue { call_sub($form->{"nextsub"}); } sub get_project { $lxdebug->enter_sub(); @@ -1062,10 +1043,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 @@ -1346,11 +1323,6 @@ sub list_accounts { $column_header{endbalance} = qq|| . $locale->text('Balance') . qq||; - if ($form->{accounttype} eq 'gifi') { - $column_header{accno} = - qq|| . $locale->text('GIFI') . qq||; - } - $form->header; print qq| @@ -1381,15 +1353,7 @@ sub list_accounts { $description = $form->escape($ref->{description}); $href = - qq|ca.pl?path=$form->{path}&action=list_transactions&accounttype=$form->{accounttype}&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&sort=transdate&l_heading=$form->{l_heading}&l_subtotal=$form->{l_subtotal}&department=$department&eur=$form->{eur}&projectnumber=$projectnumber&project_id=$form->{project_id}&title=$title&nextsub=$form->{nextsub}|; - - if ($form->{accounttype} eq 'gifi') { - $href .= "&gifi_accno=$ref->{accno}&gifi_description=$description"; - $na = $locale->text('N/A'); - map { $ref->{$_} = $na } qw(accno description) unless $ref->{accno}; - } else { - $href .= "&accno=$ref->{accno}&description=$description"; - } + qq|ca.pl?action=list_transactions&accounttype=$form->{accounttype}&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&sort=transdate&l_heading=$form->{l_heading}&l_subtotal=$form->{l_subtotal}&department=$department&eur=$form->{eur}&projectnumber=$projectnumber&project_id=$form->{project_id}&title=$title&nextsub=$form->{nextsub}&accno=$ref->{accno}&description=$description|; $ml = ($ref->{category} =~ /(A|C|E)/) ? -1 : 1; @@ -1557,7 +1521,7 @@ sub generate_ar_aging { $form->{arap} = "ar"; $form->{callback} = - qq|$form->{script}?path=$form->{path}&action=generate_ar_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&customer=$customer&title=$title|; + qq|$form->{script}?action=generate_ar_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&customer=$customer&title=$title|; RP->aging(\%myconfig, \%$form); &aging; @@ -1577,7 +1541,7 @@ sub generate_ap_aging { $form->{arap} = "ap"; $form->{callback} = - qq|$form->{script}?path=$form->{path}&action=generate_ap_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&vendor=$vendor&title=$title|; + qq|$form->{script}?action=generate_ap_aging&login=$form->{login}&password=$form->{password}&todate=$form->{todate}&vendor=$vendor&title=$title|; RP->aging(\%myconfig, \%$form); &aging; @@ -1742,7 +1706,7 @@ sub aging { $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=| + qq|$ref->{module}.pl?action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=| . $form->escape($form->{callback}); $column_data{invnumber} = qq|$ref->{invnumber}|; @@ -1841,7 +1805,6 @@ sub aging { -{path}> {login}> {password}> @@ -2038,21 +2001,36 @@ sub print { sub print_form { $lxdebug->enter_sub(); + my %replacements = + ( + "ä" => "ae", "ö" => "oe", "ü" => "ue", + "Ä" => "Ae", "Ö" => "Oe", "Ü" => "Ue", + "ß" => "ss", + " " => "_" + ); + $form->{statementdate} = $locale->date(\%myconfig, $form->{todate}, 1); $form->{templates} = "$myconfig{templates}"; - $form->{IN} = "$form->{type}.html"; - + my $suffix = "html"; + my $attachment_suffix = "html"; if ($form->{format} eq 'postscript') { $form->{postscript} = 1; - $form->{IN} =~ s/html$/tex/; - } - if ($form->{format} eq 'pdf') { + $suffix = "tex"; + $attachment_suffix = "ps"; + } elsif ($form->{format} eq 'pdf') { $form->{pdf} = 1; - $form->{IN} =~ s/html$/tex/; + $suffix = "tex"; + $attachment_suffix = "pdf"; } + $form->{IN} = "$form->{type}.$suffix"; + + + # Save $form->{email} because it will be overwritten. + $form->{EMAIL_RECIPIENT} = $form->{email}; + $i = 0; while (@{ $form->{AG} }) { @@ -2109,12 +2087,22 @@ sub print_form { $form->format_amount(\%myconfig, $form->{"${_}total"}, 2) } (c0, c30, c60, c90, ""); + $form->{attachment_filename} = $locale->text("Statement") . "_$form->{todate}.$attachment_suffix"; + map({ $form->{attachment_filename} =~ s/$_/$replacements{$_}/g; } keys(%replacements)); + $form->parse_template(\%myconfig, $userspath); } } } - + # saving the history + if(!exists $form->{addition} && $form->{id} ne "") { + $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber}; + $form->{addition} = "PRINTED"; + $form->{what_done} = $form->{type}; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history $lxdebug->leave_sub(); } @@ -2127,10 +2115,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} }, @@ -2149,26 +2137,17 @@ sub generate_tax_report { $description = $form->escape($form->{$descvar}); $ratevar = "$form->{accno}_rate"; - if ($form->{accno} =~ /^gifi_/) { - $descvar = "gifi_$form->{accno}_description"; - $description = $form->escape($form->{$descvar}); - $ratevar = "gifi_$form->{accno}_rate"; - } - $department = $form->escape($form->{department}); # construct href $href = - "$form->{script}?path=$form->{path}&action=generate_tax_report&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&$ratevar=$taxrate&report=$form->{report}"; + "$form->{script}?&action=generate_tax_report&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&$ratevar=$taxrate&report=$form->{report}"; # construct callback $description = $form->escape($form->{$descvar}, 1); $department = $form->escape($form->{department}, 1); $callback = - "$form->{script}?path=$form->{path}&action=generate_tax_report&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&$ratevar=$taxrate&report=$form->{report}"; - - $form->{title} = $locale->text('GIFI') . " - " - if ($form->{accno} =~ /^gifi_/); + "$form->{script}?&action=generate_tax_report&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&$ratevar=$taxrate&report=$form->{report}"; $title = $form->escape($form->{title}); $href .= "&title=$title"; @@ -2307,7 +2286,7 @@ sub generate_tax_report { $column_data{id} = qq|$ref->{id}|; $column_data{invnumber} = - qq|{path}&action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber}|; + qq|{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber}|; $column_data{transdate} = qq|$ref->{transdate}|; $column_data{name} = qq|$ref->{name} |; @@ -2427,7 +2406,7 @@ sub list_payments { $memo = $form->escape($form->{memo}); $href = - "$form->{script}?path=$form->{path}&action=list_payments&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&fx_transaction=$form->{fx_transaction}&db=$form->{db}&prepayment=$form->{prepayment}&title=$title&account=$account&department=$department&paymentaccounts=$form->{paymentaccounts}&reference=$reference&source=$source&memo=$memo"; + "$form->{script}?action=list_payments&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&fx_transaction=$form->{fx_transaction}&db=$form->{db}&prepayment=$form->{prepayment}&title=$title&account=$account&department=$department&paymentaccounts=$form->{paymentaccounts}&reference=$reference&source=$source&memo=$memo"; # construct callback $account = $form->escape($form->{account}, 1); @@ -2438,7 +2417,7 @@ sub list_payments { $memo = $form->escape($form->{memo}, 1); $form->{callback} = - "$form->{script}?path=$form->{path}&action=list_payments&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&fx_transaction=$form->{fx_transaction}&db=$form->{db}&prepayment=$form->{prepayment}&title=$title&account=$account&department=$department&paymentaccounts=$form->{paymentaccounts}&reference=$reference&source=$source&memo=$memo&sort=$form->{sort}"; + "$form->{script}?action=list_payments&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&fx_transaction=$form->{fx_transaction}&db=$form->{db}&prepayment=$form->{prepayment}&title=$title&account=$account&department=$department&paymentaccounts=$form->{paymentaccounts}&reference=$reference&source=$source&memo=$memo&sort=$form->{sort}"; $callback = $form->escape($form->{callback}); $column_header{name} = @@ -2522,7 +2501,7 @@ sub list_payments { $module = 'ir' if ($payment->{invoice} && $payment->{module} eq 'ap'); $href = - qq|${module}.pl?path=$form->{path}&action=edit&id=$payment->{id}&login=$form->{login}&password=$form->{password}&callback=$callback|; + qq|${module}.pl?action=edit&id=$payment->{id}&login=$form->{login}&password=$form->{password}&callback=$callback|; $column_data{name} = "$payment->{name} "; $column_data{reference} = @@ -2714,8 +2693,6 @@ sub generate_bwa { $form->{endbold} = ""; $form->{br} = "
"; - # &get_project(generate_bwa); - if ($form->{reporttype} eq "custom") { #forgotten the year --> thisyear @@ -2904,9 +2881,8 @@ sub generate_bwa { sub generate_ustva { $lxdebug->enter_sub(); - # Hier Aufruf von get_config aus bin/mozilla/fa.pl zum - # Einlesen der Finanzamtdaten - get_config($userspath, 'finanzamt.ini'); + # Hier Aufruf von get_config zum Einlesen der Finanzamtdaten + USTVA->get_config($userspath, 'finanzamt.ini'); # &get_project(generate_bwa); @anmeldungszeitraum =