#
#======================================================================
-require "$form->{path}/arap.pl";
+require "bin/mozilla/arap.pl";
+require "bin/mozilla/common.pl";
use SL::PE;
use SL::RP;
+use SL::USTVA;
+use SL::Iconv;
1;
$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);
</tr>
| 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;
+ $form->{jsscript} = 1;
$jsscript = "";
if ($form->{report} eq "ustva") {
$department = "";
if ($name_1 eq "") {
$button1 = qq|
- <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}">|;
+ <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
$button1_2 = qq|
<input type=button name=$name_2 id="$trigger_2" value=|
. $locale->text('button') . qq|>|;
Form->write_trigger(\%myconfig, "1", "$name_2", "BR", "$trigger_2");
} else {
$button1 = qq|
- <input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value=$value_1>|;
+ <input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value="$value_1" onBlur=\"check_right_date_format(this)\">|;
$button1_2 = qq|
<input type=button name=$name_1 id="$trigger_1" value=|
. $locale->text('button') . qq|>|;
$button2 = qq|
- <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}">|;
+ <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
$button2_2 = qq|
<input type=button name=$name_2 id="$trigger_2" value=|
. $locale->text('button') . qq|>
# without JavaScript Calendar
if ($name_1 eq "") {
$button1 =
- qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}">|;
+ qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
} else {
$button1 =
- qq|<input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value=$value_1>|;
+ qq|<input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value=$value_1 onBlur=\"check_right_date_format(this)\">|;
$button2 =
- qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}">|;
+ qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
}
}
-
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
$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|
-<body>
+<body onLoad="$onload">
<form method=post action=$form->{script}>
print qq|
<tr>
<th align=right nowrap>| . $locale->text('Project') . qq|</th>
- <td colspan=3><input name=projectnumber size=25</td>
+ <td colspan=3>$projectnumber</td>
</tr>
<input type=hidden name=nextsub value=generate_income_statement>
</table>
print qq|
<tr>
<th align=right nowrap>| . $locale->text('Project') . qq|</th>
- <td colspan=3><input name=projectnumber size=25</td>
+ <td colspan=3>$projectnumber</td>
</tr>
<input type=hidden name=nextsub value=generate_bwa>
</table>
}
if ($form->{report} =~ /^tax_/) {
- $gifi = "";
-
$form->{db} = ($form->{report} =~ /_collected/) ? "ar" : "ap";
RP->get_taxaccounts(\%myconfig, \%$form);
</td>
</tr>
-|;
-
- if (@{ $form->{gifi_taxaccounts} }) {
- print qq|
- <tr>
- <th align=right>| . $locale->text('GIFI') . qq|</th>
- <td colspan=3>
-|;
-
- foreach $ref (@{ $form->{gifi_taxaccounts} }) {
-
- print
- qq|<input name=accno class=radio type=radio value="gifi_$ref->{accno}"> $ref->{description}
-
- <input name="gifi_$ref->{accno}_description" type=hidden value="$ref->{description}">
- <input name="gifi_$ref->{accno}_rate" type=hidden value="$ref->{rate}">|;
-
- }
-
- print qq|
- </td>
- </tr>
-|;
- }
-
- print qq|
<tr>
<th align=right>| . $locale->text('Method') . qq|</th>
<td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
}
if ($form->{report} =~ /^nontaxable_/) {
- $gifi = "";
-
$form->{db} = ($form->{report} =~ /_sales/) ? "ar" : "ap";
print qq|
}
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';
# 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);
</table>
<br>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
. $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');
$lxdebug->leave_sub();
}
-sub continue { &{ $form->{nextsub} } }
+sub continue { call_sub($form->{"nextsub"}); }
sub get_project {
$lxdebug->enter_sub();
$form->{endbold} = "</b>";
$form->{br} = "<br>";
- &get_project(generate_income_statement);
-
- $form->{projectnumber} = $form->{projectnumber_1};
-
if ($form->{reporttype} eq "custom") {
#forgotten the year --> thisyear
$column_header{endbalance} =
qq|<th class=listheading>| . $locale->text('Balance') . qq|</th>|;
- if ($form->{accounttype} eq 'gifi') {
- $column_header{accno} =
- qq|<th class=listheading>| . $locale->text('GIFI') . qq|</th>|;
- }
-
$form->header;
print qq|
$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;
$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;
$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;
$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|<td><a href=$href>$ref->{invnumber}</a></td>|;
<input type=hidden name=department value="$form->{department}">
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
sub send_email {
$lxdebug->enter_sub();
- $form->{OUT} = "$sendmail";
-
$form->{subject} = $locale->text('Statement') . qq| - $form->{todate}|
unless $form->{subject};
$form->{"statement_1"} = 1;
- &print_form;
+ $form->{media} = 'email';
+ print_form();
- $form->redirect(
- $locale->text('Statement sent to') . " $form->{$form->{ct}}");
+ $form->redirect($locale->text('Statement sent to') . " $form->{$form->{ct}}");
$lxdebug->leave_sub();
}
$form->error($locale->text('Nothing selected!')) unless $selected;
if ($form->{media} eq 'printer') {
- $form->{OUT} = "| $myconfig{printer}";
$form->{"$form->{ct}_id"} = "";
} else {
$form->{"statement_1"} = 1;
RP->aging(\%myconfig, \%$form);
- &print_form;
+ print_form();
$form->redirect($locale->text('Statements sent to printer!'))
if ($form->{media} eq 'printer');
sub print_form {
$lxdebug->enter_sub();
+ my %replacements =
+ (
+ "ä" => "ae", "ö" => "oe", "ü" => "ue",
+ "Ä" => "Ae", "Ö" => "Oe", "Ü" => "Ue",
+ "ß" => "ss",
+ " " => "_"
+ );
+
+ foreach my $key (keys %replacements) {
+ my $new_key = SL::Iconv::convert("ISO-8859-15", $dbcharset, $key);
+ $replacements{$new_key} = $replacements{$key} if $new_key ne $key;
+ }
+
$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";
+ $form->{OUT} =
+ $form->{media} eq 'email' ? $sendmail :
+ $form->{media} eq 'printer' ? "| $myconfig{printer}" : "";
+
+ # Save $form->{email} because it will be overwritten.
+ $form->{EMAIL_RECIPIENT} = $form->{email};
+
$i = 0;
while (@{ $form->{AG} }) {
$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();
}
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} },
$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";
$column_data{id} = qq|<td>$ref->{id}</td>|;
$column_data{invnumber} =
- qq|<td><a href=$module?path=$form->{path}&action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber}</a></td>|;
+ qq|<td><a href=$module?action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber}</a></td>|;
$column_data{transdate} = qq|<td>$ref->{transdate}</td>|;
$column_data{name} = qq|<td>$ref->{name} </td>|;
$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);
$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} =
$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} = "<td>$payment->{name} </td>";
$column_data{reference} =
$form->{endbold} = "</b>";
$form->{br} = "<br>";
- # &get_project(generate_bwa);
-
if ($form->{reporttype} eq "custom") {
#forgotten the year --> thisyear
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 =