Das Verhalten der Checkbox "Formulardetails anzeigen/verstecken" kann in den Benutzer...
[kivitendo-erp.git] / bin / mozilla / ustva.pl
index 6f097c7..e0ff7a6 100644 (file)
@@ -77,23 +77,20 @@ sub report {
   $form->{title} = $locale->text('UStVA');
   $form->{kz10}  = '';                       #Berichtigte Anmeldung? Ja =1 Nein=0
 
-  my $year = substr(
-                    $form->datetonum($form->current_date(\%myconfig),
-                                     \%myconfig
-                    ),
-                    0, 4);
+  my $year = substr($form->datetonum($form->current_date(\%myconfig), \%myconfig ),
+             0, 4);
 
   my $department = '';
   local $hide = '';
   $form->header;
 
   print qq|
-<body>
-<form method=post action=$form->{script}>
+ <body>
+ <form method=post action=$form->{script}>
 
-<input type=hidden name=title value="$form->{title}">
+ <input type=hidden name=title value="$form->{title}">
 
-<table width=100%>
+ <table width=100%>
   <tr>
     <th class=listtop>$form->{title}</th>
   </tr>
@@ -102,7 +99,7 @@ sub report {
     <td>
       <table>
       $department
-|;
+ |;
 
   # Hier Aufruf von get_config aus bin/mozilla/fa.pl zum
   # Einlesen der Finanzamtdaten
@@ -127,7 +124,7 @@ sub report {
          <td width="50%" align="left" valign="top">
          <fieldset>
          <legend>
-         <b>| . $locale->text('Firma') . qq|</b>
+         <b>| . $locale->text('Company') . qq|</b>
          </legend>
   |;
   if ($form->{company} ne '') {
@@ -135,7 +132,7 @@ sub report {
   } else {
     print qq|
            <a href=am.pl?path=$form->{path}&action=config&level=Programm--Preferences&login=$form->{login}&password=$form->{password}>
-           | . $locale->text('Kein Firmenname hinterlegt!') . qq|</a><br>
+           | . $locale->text('No Company Name given') . qq|!</a><br>
     |;
   }
 
@@ -161,7 +158,7 @@ sub report {
     } else {
     print qq|
          <a href=am.pl?path=$form->{path}&action=config&level=Programm--Preferences&login=$form->{login}&password=$form->{password}>
-         | . $locale->text('Keine Firmenadresse hinterlegt!') . qq|</a>\n|;
+         | . $locale->text('No Company Address given') . qq|!</a>\n|;
   }
   $form->{co_email} = $form->{email} unless $form->{co_email};
   $form->{co_tel}   = $form->{tel}   unless $form->{co_tel};
@@ -171,17 +168,17 @@ sub report {
   print qq|
          <br>
          <br>
-         | . $locale->text('Tel.: ') . qq|
+         | . $locale->text('Tel') . qq|.:&nbsp;
          $form->{co_tel}
          <br>
-         | . $locale->text('Fax.: ') . qq|
+         | . $locale->text('Fax') . qq|.:nbsp;
          $form->{co_fax}         
          <br>
          <br>
          $form->{co_email}       
          <br>
          <br>
-         | . $locale->text('Steuernummer: ') . qq|
+         | . $locale->text('Tax Number') . qq|:&nbsp;
   |;
 
   if ($form->{steuernummer} ne '') {
@@ -193,7 +190,7 @@ sub report {
   }
   print qq|
          <br>
-         | . $locale->text('ELSTER-Steuernummer: ') . qq|
+         | . $locale->text('ELSTER Tax Number') . qq|:&nbsp;
          $form->{elstersteuernummer}
           <br>
           <br>
@@ -206,9 +203,9 @@ sub report {
          <fieldset>
          <legend>
             <input checked="checked" title="|
-      . $locale->text('Beraterdaten in UStVA übernehmen?')
+      . $locale->text('Assume Tax Consultant Data in Tax Computation?')
       . qq|" name="FA_steuerberater" id=steuerberater class=checkbox type=checkbox value="1">&nbsp;
-            <b>| . $locale->text('Steuerberater/-in') . qq|</b>
+            <b>| . $locale->text('Tax Consultant') . qq|</b>
             </legend>
             
             $form->{FA_steuerberater_name}<br>
@@ -222,7 +219,7 @@ sub report {
   print qq|
          <fieldset>
          <legend>
-          <b>| . $locale->text('Voranmeldezeitraum') . qq|</b>
+          <b>| . $locale->text('Tax Period') . qq|</b>
          </legend>
   |;
   &ustva_vorauswahl();
@@ -255,9 +252,9 @@ sub report {
   print qq|
            <input name="FA_10" id=FA_10 class=checkbox type=checkbox value="1" $checked title = "|
     . $locale->text(
-      'Ist dies eine berichtigte Anmeldung? (Nr. 10/Zeile 15 Steuererklärung)')
+      'Amended Advance Turnover Tax Return (Nr. 10)')
     . qq|">
-            | . $locale->text('Berichtigte Anmeldung') . qq|
+            | . $locale->text('Amended Advance Turnover Tax Return') . qq|
           <br>
   |;
 
@@ -266,7 +263,7 @@ sub report {
           <br>
           | . $locale->text($voranmeld) . qq|
   |;
-    print qq| mit Dauerfristverlängerung| if ($form->{FA_dauerfrist} eq '1');
+    print $locale->text('With Extension Of Time') if ($form->{FA_dauerfrist} eq '1');
     print qq|
 
       <br>
@@ -288,7 +285,7 @@ sub report {
     <td width="50%" valign="top">        
          <fieldset>
          <legend>
-         <b>| . $locale->text('Finanzamt') . qq|</b>
+         <b>| . $locale->text('Tax Office') . qq|</b>
          </legend>
           <h3>$form->{FA_Name}</h2>
     |;
@@ -305,10 +302,10 @@ sub report {
           $form->{FA_PLZ}&nbsp; &nbsp;$form->{FA_Ort}
           <br>
           <br>
-          | . $locale->text('Tel. : ') . qq|
+          | . $locale->text('Tel') . qq|.:&nbsp;
           $form->{FA_Telefon}
           <br> 
-          | . $locale->text('Fax. : ') . qq|
+          | . $locale->text('Fax') . qq|.:$nbsp;
           $form->{FA_Fax}
           <br>
           <br>
@@ -326,7 +323,7 @@ sub report {
           </a>
           <br>
           <br>
-          | . $locale->text('Öffnungszeiten') . qq|
+          | . $locale->text('Openings') . qq|
           <br>
           $oeffnungszeiten
           <br>
@@ -344,25 +341,25 @@ sub report {
     if ($FA_1 && $FA_2) {
       print qq|
           <br>
-          | . $locale->text('Bankverbindungen') . qq|
+          | . $locale->text('Bank Connection') . qq|
           <table>
           <tr>
           <td>
           $form->{FA_Bankbezeichnung_1}
           <br>                  
-          | . $locale->text('Konto: ') . qq|
+          | . $locale->text('Account') . qq|:&nbsp;
           $form->{FA_Kontonummer_1}
           <br>
-          | . $locale->text('BLZ: ') . qq|
+          | . $locale->text('Bank Code') . qq|:&nbsp;
           $form->{FA_BLZ_1}
           </td>
           <td>
           $form->{FA_Bankbezeichnung_oertlich}
           <br>
-          | . $locale->text('Konto: ') . qq|
+          | . $locale->text('Account') . qq|:&nbsp;
           $form->{FA_Kontonummer_2}
           <br> 
-          | . $locale->text('BLZ: ') . qq|
+          | . $locale->text('Bank Code') . qq|:&nbsp;
           $form->{FA_BLZ_2}
           </td>
           </tr>
@@ -371,29 +368,29 @@ sub report {
     } elsif ($FA_1) {
       print qq|
           <br>
-          | . $locale->text('Bankverbindung') . qq|
+          | . $locale->text('Bank Connection') . qq|
           <br>
           <br>
           $form->{FA_Bankbezeichnung_1}
           <br>                  
-          | . $locale->text('Konto: ') . qq|
+          | . $locale->text('Account') . qq|:&nbsp;
           $form->{FA_Kontonummer_1}
           <br> 
-          | . $locale->text('BLZ: ') . qq|
+          | . $locale->text('Bank Code') . qq|:&nbsp;
           $form->{FA_BLZ_1}          <br>
           <br>|;
     } elsif ($FA_2) {
       print qq|
           <br>
-          | . $locale->text('Bankverbindung') . qq|
+          | . $locale->text('Bank Connection') . qq|
           <br>
           <br>
           $form->{FA_Bankbezeichnung_oertlich}
           <br>                  
-          | . $locale->text('Konto: ') . qq|
+          | . $locale->text('Account') . qq|:&nbsp;
           $form->{FA_Kontonummer_2}
           <br> 
-          | . $locale->text('BLZ: ') . qq|
+          | . $locale->text('Bank Code') . qq|:&nbsp;
           $form->{FA_BLZ_2}
      |;
     }
@@ -403,7 +400,7 @@ sub report {
       <br>
       <fieldset>
       <legend>
-      <b>| . $locale->text('Ausgabeformat') . qq|</b>
+      <b>| . $locale->text('Outputformat') . qq|</b>
       </legend>
   |;
 
@@ -418,12 +415,12 @@ sub report {
      <td width="50%" valign="bottom">
      <fieldset>
      <legend>
-     <b>| . $locale->text('Hinweise') . qq|</b>
+     <b>| . $locale->text('Hints') . qq|</b>
      </legend>
       <h2 class="confirm">|
       . $locale->text('Missing Preferences: Outputroutine disabled')
       . qq|</h2>
-      <h3>| . $locale->text('Help:') . qq|</h3>
+      <h3>| . $locale->text('Help') . qq|</h3>
       <ul>
       <li>| . $locale->text('Hint-Missing-Preferences') . qq|</li>
       </ul>
@@ -466,12 +463,13 @@ sub report {
    </td>
    <td align="right">
 
-    <!--</form>
+    </form>
+    <!--
     <form action="doc/ustva.html" method="get">
-    -->
+    
        <input type=submit class=submit name=action value="|
     . $locale->text('Help') . qq|">
-   <!-- </form>-->
+   </form>-->
    </td>
   </tr>
   </table>
@@ -656,23 +654,23 @@ sub ustva_vorauswahl {
   SWITCH: {
       $yymmdd <= ($yy + 110 + $dfv) && do {
         $form->{year} = $form->{year} - 1;
-        $sel = 'D';
+        $sel = '44';
         last SWITCH;
       };
       $yymmdd <= ($yy + 410 + $dfv) && do {
-        $sel = 'A';
+        $sel = '41';
         last SWITCH;
       };
       $yymmdd <= ($yy + 710 + $dfv) && do {
-        $sel = 'B';
+        $sel = '42';
         last SWITCH;
       };
       $yymmdd <= ($yy + 1010 + $dfv) && do {
-        $sel = 'C';
+        $sel = '43';
         last SWITCH;
       };
       $yymmdd <= ($yy + 1231) && do {
-        $sel = 'D';
+        $sel = '44';
       };
     }
 
@@ -755,12 +753,12 @@ sub show_options {
   my $media  = qq|      <input type=hidden name="media" value="screen">|;
   my $format =
       qq|       <option value=html selected>|
-    . $locale->text('Vorschau')
+    . $locale->text('Preview')
     . qq|</option>|;
   if ($latex_templates) {
     $format .=
         qq|    <option value=pdf>|
-      . $locale->text('UStVA als PDF-Dokument')
+      . $locale->text('UStVA (PDF-Dokument)')
       . qq|</option>|;
   }
 
@@ -769,10 +767,10 @@ sub show_options {
   if ($form->{elster} eq '1') {
     $format .=
         qq|<option value=elsterwinston>|
-      . $locale->text('ELSTER Export nach Winston')
+      . $locale->text('ELSTER Export (Winston)')
       . qq|</option>|
       . qq|<option value=elstertaxbird>|
-      . $locale->text('ELSTER Export nach Taxbird')
+      . $locale->text('ELSTER Export (Taxbird)')
       . qq|</option>|;      
   }
 
@@ -781,7 +779,7 @@ sub show_options {
     $type
     $media
     <select name=format title = "|
-    . $locale->text('Ausgabeformat auswählen...') . qq|">$format</select>
+    . $locale->text('Choose Outputformat') . qq|">$format</select>
   |;
   $lxdebug->leave_sub();
 }
@@ -794,7 +792,7 @@ sub generate_ustva {
 
   get_config($userspath, 'finanzamt.ini');
 
-  # form vars initialisieren
+  # init some form vars
   my @anmeldungszeitraum =
     qw('0401' '0402' '0403' '0404' '0405' '0405' '0406' '0407' '0408' '0409' '0410' '0411' '0412' '0441' '0442' '0443' '0444');
   foreach my $item (@anmeldungszeitraum) {
@@ -812,6 +810,10 @@ sub generate_ustva {
                         qq|Actual year from Database: $form->{year}\n|);
     }
 
+    #
+    # using dates in ISO-8601 format: yyyymmmdd  for Postgres...
+    #
+    
     #yearly report
     if ($form->{period} eq "13") {
       $form->{fromdate} = "$form->{year}0101";
@@ -919,13 +921,16 @@ sub generate_ustva {
       };
     }
 
-  # using dates in ISO-8601 format: yyyymmmdd  for Postgres...
+
+
+
+  # Get the USTVA
   USTVA->ustva(\%myconfig, \%$form);
 
   # reformat Dates to dateformat
   $form->{fromdate} = $locale->date(\%myconfig, $form->{fromdate}, 0, 0, 0);
 
-  $form->{todate} = $form->current_date($myconfig) unless $form->{todate};
+  $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
   $form->{todate} = $locale->date(\%myconfig, $form->{todate}, 0, 0, 0);
 
   $form->{longperiod} =
@@ -946,7 +951,7 @@ sub generate_ustva {
     $form->{longperiod}      =
         $locale->text('for Period')
       . qq|<br>\n$longfromdate |
-      . $locale->text('bis')
+      . $locale->text('to (date)')
       . qq| $longtodate|;
   }
 
@@ -964,7 +969,7 @@ sub generate_ustva {
     $form->{last_period} = "$shortcomparefromdate<br>\n$shortcomparetodate";
     $form->{longperiod} .=
         "<br>\n$longcomparefromdate "
-      . $locale->text('bis')
+      . $locale->text('to (date)')
       . qq| $longcomparetodate|;
   }
 
@@ -972,7 +977,6 @@ sub generate_ustva {
     $locale->date(\%myconfig, $form->current_date(\%myconfig), 0, 0, 0);
 
   # setup variables for the form
-  # steuernummer für prerelease entfernt
   my @a = qw(company businessnumber tel fax email
     co_chief co_department co_custom1 co_custom2 co_custom3 co_custom4 co_custom5
     co_name1 co_name2  co_street co_street1 co_zip co_city co_city1 co_country co_tel co_tel1 co_tel2
@@ -989,43 +993,39 @@ sub generate_ustva {
     $form->{co_city} =~ s/\\n//g;
   }
 
+  #
+  # Outputformat specific customisation's
+  #
+
+  my @category_cent = qw(511 861 36 80 971 931 98 96 53 74
+    85 65 66 61 62 67 63 64 59 69 39 83
+    Z43 Z45 Z53 Z62 Z65 Z67);
+
+  my @category_euro = qw(41 44 49 43 48 51 86 35 77 76 91 97 93
+    95 94 42 60 45 52 73 84);
+
   if ( $form->{format} eq 'pdf' or $form->{format} eq 'postscript') {
 
     $form->{IN} = "$form->{type}-$form->{year}.tex";
-
     $form->{padding} = "~~";
     $form->{bold}    = "\textbf{";
     $form->{endbold} = "}";
     $form->{br}      = '\\\\';
 
-    my @numbers = qw(511 861 36 80 971 931 98 96 53 74
-      85 65 66 61 62 Z67 63 64 59 69 39 83
-      Z43 Z45 Z53 Z62 Z65);
-
-    my $number = '';
-
     # Zahlenformatierung für Latex USTVA Formulare
-    if (   $myconfig{numberformat} eq '1.000,00'
-           or $myconfig{numberformat} eq '1000,00') {
-      foreach $number (@numbers) {
-        $form->{$number} =~ s/,/~~/g;
-      }
-    }
-    if (   $myconfig{numberformat} eq '1000.00'
-        or $myconfig{numberformat} eq '1,000.00') {
-      foreach $number (@numbers) {
-        $form->{$number} =~ s/\./~~/g;
-      }
+
+    foreach my $number (@category_euro) {
+      $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '0', '');
     }
-    if ( $form->{period} eq '13'){ #Catch yearly USTE for now, not yet implemented.
-      $form->header;
-      USTVA::error(
-        $locale->text(
-        'Impossible to create yearly Tax Report as PDF or Postscript<br \> Not yet implemented!'
-        )
-      );
+
+    my ${decimal_comma} = ( $myconfig{numberformat} eq '1.000,00'
+         or $myconfig{numberformat} eq '1000,00' ) ? ',':'.';
+
+    foreach my $number (@category_cent) {
+      $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '2', '');
+      $form->{$number} =~ s/${decimal_comma}/~~/g;
     }
-      
+
   } elsif ( $form->{format} eq 'html') { # Formatierungen für HTML Ausgabe
 
     $form->{IN} = $form->{type} . '.html';
@@ -1035,109 +1035,163 @@ sub generate_ustva {
     $form->{br}      = "<br>";
     $form->{address} =~ s/\\n/\n/g;
 
-  } elsif ($form->{format} =~ /^elster/) {
-
-    if ( $form->{period} eq '13' ) {
-      $form->header;
-      USTVA::info(
-        $locale->text(
-        'Impossible to create yearly Tax Report via Winston or Taxbird.<br \> Not yet implemented!'
-      ));
+    foreach $number (@category_cent) {
+      $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '2', '0');
     }
+    
+    foreach $number (@category_euro) {
+      $form->{$number} = $form->format_amount(\%myconfig, $form->{$number}, '0', '0');
+    }
+
+  } elsif ( $form->{format} eq 'elsterwinston' ) {
 
-    if ( $form->{format} eq 'elsterwinston' ) {
-
-      $form->{IN} = 'winston.xml';
-     
-      # Build Winston filename
-      my $file = 'U';     # 1. char 'U' = USTVA
-      $file .= $form->{period};
-      #4. and 5. char = year modulo 100
-      $file .= sprintf("%02d", $form->{year} % 100);
-      #6. to 18. char = Elstersteuernummer
-      #Beispiel: Steuernummer in Bayern
-      #111/222/33334 ergibt für UStVA Jan 2004: U01049111022233334
-      $file .= $form->{elsterFFFF};
-      $file .= $form->{elstersteuernummer};
-      #file suffix
-      $file .= '.xml';
-      $form->{tmpfile} = "$userspath/$file";
+    $form->{IN} = 'winston.xml';
+    
+    #
+    # Build Winston filename
+    #
+    
+    my $file = 'U';     # 1. char 'U' = USTVA
+    $file .= $form->{period};
+    #4. and 5. char = year modulo 100
+    $file .= sprintf("%02d", $form->{year} % 100);
+    #6. to 18. char = Elstersteuernummer
+    #Beispiel: Steuernummer in Bayern
+    #111/222/33334 ergibt für UStVA Jan 2004: U01049111022233334
+    $file .= $form->{elsterFFFF};
+    $file .= $form->{elstersteuernummer};
+    #file suffix
+    $file .= '.xml';
+    $form->{tmpfile} = "$userspath/$file";
+
+    $form->{attachment_filename} = "$file";
+    # Zahlenformatierung für Winston
+
+    my $temp_numberformat = $myconfig{numberformat};
+
+    # Numberformat must be '1000.00' for Winston
+
+    $myconfig{numberformat} = '1000.00';
+
+    foreach my $number (@category_cent) {
+      $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '2', '') : '';
+    }
+    
+    foreach my $number (@category_euro) {
+      $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '0', '') : '';
     }
+    # Re-set Numberformat
+    $myconfig{numberformat} = $temp_numberformat;
 
-    if ( $form->{format} eq 'elstertaxbird' ) {
+  }
+
+  elsif ( $form->{format} eq 'elstertaxbird' ) {
 
-      $form->{IN} = 'taxbird.txb';
-     
-      $form->{tmpfile} = "$userspath/USTVA-" . $form->{period} 
-      . sprintf("%02d", $form->{year} % 100) . ".txb";
+    $form->{IN} = 'taxbird.txb';
 
-      if ($form->{period} =~ /^[4]\d$/ ){
-        my %periods = ( # Lx => taxbird
-                     '41' => '12',
-                     '42' => '13',
-                     '43' => '14',
-                     '44' => '15',
-                   );
+    $form->{attachment_filename} = "USTVA-" . $form->{period} 
+    . sprintf("%02d", $form->{year} % 100) . ".txb";
+    
+    $form->{tmpfile} = "$userspath/" . $form->{attachment_filename};
+
+    if ($form->{period} =~ /^[4]\d$/ ){
+      my %periods = ( # Lx => taxbird
+                   '41' => '12',
+                   '42' => '13',
+                   '43' => '14',
+                   '44' => '15',
+                 );
+    
+      foreach my $quarter ( keys %periods ) {
+        $form->{taxbird_period} = $periods{$quarter} if ( $form->{period} eq $quarter);
+      }
+      
+      my %lands = ( # Lx => taxbird # TODO: besser als array...
+                  'Baden Würtemberg'       => '0',
+                  'Bayern'                 => '1',
+                  'Berlin'                 => '2',
+                  'Brandenburg'            => '3',
+                  'Bremen'                 => '4',
+                  'Hamburg'                => '5',
+                  'Hessen'                 => '6',
+                  'Mecklenburg Vorpommern' => '7',
+                  'Niedersachsen'          => '8',
+                  'Nordrhein Westfalen'    => '9',
+                  'Rheinland Pfalz'        => '10',
+                  'Saarland'               => '11',
+                  'Sachsen'                => '12',
+                  'Sachsen Anhalt'         => '13',
+                  'Schleswig Holstein'     => '14',
+                  'Thüringen'              => '15',
+            );
+
+      foreach my $land ( keys %lands ){
+        $form->{taxbird_land_nr} = $lands{$land} if ($form->{elsterland} eq $land );
+      }
       
-        foreach my $quarter ( keys %periods ) {
-          $form->{period} = $periods{$quarter} if ( $form->{period} eq $quarter);
-        }
-        
-        my %lands = ( # Lx => taxbird # TODO: besser als array...
-                    'Baden Würtemberg'       => '0',
-                    'Bayern'                 => '1',
-                    'Berlin'                 => '2',
-                    'Brandenburg'            => '3',
-                    'Bremen'                 => '4',
-                    'Hamburg'                => '5',
-                    'Hessen'                 => '6',
-                    'Mecklenburg Vorpommern' => '7',
-                    'Niedersachsen'          => '8',
-                    'Nordrhein Westfalen'    => '9',
-                    'Rheinland Pfalz'        => '10',
-                    'Saarland'               => '11',
-                    'Sachsen'                => '12',
-                    'Sachsen Anhalt'         => '13',
-                    'Schleswig Holstein'     => '14',
-                    'Thüringen'              => '15',
-              );
-
-
-        foreach my $land ( keys %lands ){
-          $form->{elsterland} = $lands{$land} if ($form->{elsterland} eq $land );
-        }
-      } elsif ($form->{period} =~ /^\d+$/ ) {
-        $form->{period} =~ s/^0//g;
-        my $period = $form->{period};
-        $period * 1;
-        $period--;
-        $form->{period} = $period;
-       } else {
-         $form->header;
-         USTVA::error( $locale->text('Wrong Period' ));
-         exit(0);
-                
-       }
+      $form->{taxbird_steuernummer} = $form->{steuernummer};
+      $form->{taxbird_steuernummer} =~ s/\D//g;
       
+      $form->{co_zip} = $form->{co_city};
+      $form->{co_zip} =~ s/\D//g;
+      $form->{co_city} =~ s/\d//g;
+      $form->{co_city} =~ s/^\s//g;
+      
+      ($form->{co_phone_prefix}, $form->{co_phone}) = split("-", $form->{tel});
+      
+      # Numberformatting for Taxbird
+
+      my $temp_numberformat = $myconfig{numberformat};
+      # Numberformat must be '1000.00' for Taxbird ?!
+
+      $myconfig{numberformat} = '1000.00';
+
+      foreach my $number (@category_cent) {
+        $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '2', '') : '';
+      }
+      
+      foreach my $number (@category_euro) {
+        $form->{$number} = ( $form->{$number} !=0 ) ? $form->format_amount(\%myconfig, $form->{$number}, '0', '') : '';
+      }
+      # Re-set Numberformat
+      $myconfig{numberformat} = $temp_numberformat;
+      
+    } elsif ($form->{period} =~ /^\d+$/ ) {
+      $form->{period} =~ s/^0//g;
+      my $period = $form->{period};
+      $period * 1;
+      $period--;
+      $form->{period} = $period;
+    } else {
+      $form->header;
+      USTVA::error( $locale->text('Wrong Period' ));
+      exit(0);
     }
-    # Other Elster formats follow here...
     
   } elsif ( $form->{format} eq '' ){ # No format error.
     $form->header;
-    USTVA::error( $locale->text('Application Error. No Format given!' ));
+    USTVA::error( $locale->text('Application Error. No Format given' ) . "!");
     exit(0);
  
   } else { # All other Formats are wrong
     $form->header;
-    USTVA::error( $locale->text('Application Error. Wrong Format: ') . $form->{format} );
+    USTVA::error( $locale->text('Application Error. Wrong Format') . ": " . $form->{format} );
     exit(0);
   }
+
+  if ( $form->{period} eq '13' and $form->{format} ne 'html') {
+    $form->header;
+    USTVA::info(
+      $locale->text(
+      'Yearly taxreport not yet implemented')
+      . '!');
+  }
     
-  
   $form->{templates} = $myconfig{templates};
   $form->{templates} = "doc" if ( $form->{type} eq 'help' );
 
-  $form->parse_template($myconfig, $userspath);
+  $form->parse_template(\%myconfig, $userspath);
 
   $lxdebug->leave_sub();
 }
@@ -1160,21 +1214,21 @@ sub edit {
     "$form->{cbscript}?action=edit&login=$form->{cblogin}&path=$form->{cbpath}&root=$form->{cbroot}&rpw=$form->{cbrpw}"
     if ($form->{cbscript} ne '' and $form->{cblogin} ne '');
 
-  $form->{title} = $locale->text('Finanzamt - Einstellungen');
+  $form->{title} = $locale->text('Tax Office Preferences');
   print qq|
     <body>
     <form name="verzeichnis" method=post action="$form->{script}">
      <table width=100%>
        <tr>
          <th class="listtop">|
-    . $locale->text('Finanzamt - Einstellungen') . qq|</th>
+    . $locale->text('Tax Office Preferences') . qq|</th>
        </tr>
         <tr>
          <td>
            <br>
            <fieldset>
            <legend><b>|
-    . $locale->text('Angaben zum Finanzamt') . qq|</b></legend>
+    . $locale->text('Local Tax Office Preferences') . qq|</b></legend>
   |;
 
   #print qq|$form->{terminal}|;
@@ -1188,7 +1242,7 @@ sub edit {
   $checked = "checked" if ($form->{method} eq 'accrual');
   print qq|
            <fieldset>
-           <legend><b>| . $locale->text('Verfahren') . qq|</b>
+           <legend><b>| . $locale->text('Taxation') . qq|</b>
            </legend>
            <input name=method id=accrual class=radio type=radio value="accrual" $checked>
            <label for="accrual">| . $locale->text('accrual') . qq|</label>
@@ -1202,7 +1256,7 @@ sub edit {
            </fieldset>
            <br>
            <fieldset>
-           <legend><b>| . $locale->text('Voranmeldungszeitraum') . qq|</b>
+           <legend><b>| . $locale->text('Tax Period') . qq|</b>
            </legend>
   |;
   $checked = '';
@@ -1224,12 +1278,12 @@ sub edit {
   print qq|
            <input name="FA_dauerfrist" id=FA_dauerfrist class=checkbox type=checkbox value="1" $checked>
            <label for="">|
-    . $locale->text('Dauerfristverlängerung') . qq|</label>
+    . $locale->text('Extension Of Time') . qq|</label>
            
            </fieldset>
            <br>
            <fieldset>
-           <legend><b>| . $locale->text('Steuerberater/-in') . qq|</b>
+           <legend><b>| . $locale->text('Tax Consultant') . qq|</b>
            </legend>
   |;
   $checked = '';
@@ -1237,7 +1291,7 @@ sub edit {
   print qq|
           <!-- <input name="FA_71" id=FA_71 class=checkbox type=checkbox value="X" $checked>
            <label for="FA_71">|
-    . $locale->text('Verrechnung des Erstattungsbetrages erwünscht (Zeile 71)')
+    . $locale->text('Clearing Tax Received (No 71)')
     . qq|</label>
            <br>
            <br>-->
@@ -1247,13 +1301,13 @@ sub edit {
            | . $locale->text('Name') . qq|
            </td>
            <td>
-           | . $locale->text('Straße') . qq|
+           | . $locale->text('Street') . qq|
            </td>
            <td>
-           | . $locale->text('PLZ, Ort') . qq|
+           | . $locale->text('Zip, City') . qq|
            </td>
            <td>
-           | . $locale->text('Telefon') . qq|
+           | . $locale->text('Telephone') . qq|
            </td>
            </tr>
            <tr>
@@ -1281,7 +1335,7 @@ sub edit {
            |;
   print qq|
            <input type="button" name="Verweis" value="|
-    . $locale->text('Back to user config...') . qq|" 
+    . $locale->text('User Config') . qq|" 
             onClick="self.location.href='$callback'">| if ($callback ne '');
   print qq|
            &nbsp; &nbsp;
@@ -1307,7 +1361,7 @@ sub edit {
           <input type=hidden name="nextsub" value="edit_form">
           <input type=hidden name="warnung" value="1">
           <input type=hidden name="saved" value="|
-    . $locale->text('Bitte Angaben überprüfen') . qq|">
+    . $locale->text('Check Details') . qq|">
           <input type=hidden name="path" value=$form->{path}>
           <input type=hidden name="login" value=$form->{login}>
           <input type=hidden name="password" value=$form->{password}>
@@ -1419,7 +1473,7 @@ sub edit_form {
    <table width="100%">
        <tr>
         <th colspan="2" class="listtop">|
-    . $locale->text('Finanzamt - Einstellungen') . qq|</th>
+    . $locale->text('Tax Office Preferences') . qq|</th>
        </tr>
        <tr>
          <td colspan=2>
@@ -1434,7 +1488,7 @@ sub edit_form {
            <br>
            <fieldset>
            <legend>
-           <font size="+1">| . $locale->text('Steuernummer') . qq|</font>
+           <font size="+1">| . $locale->text('Tax Number') . qq|</font>
            </legend>
            <br>
   |;
@@ -1460,7 +1514,7 @@ sub edit_form {
 
   print qq|
            <input type="button" name="Verweis" value="|
-    . $locale->text('Back to user config...') . qq|" 
+    . $locale->text('User Config') . qq|" 
             onClick="self.location.href='$form->{callback}'">|
     if ($form->{callback} ne '');
 
@@ -1470,7 +1524,7 @@ sub edit_form {
           <input type=submit class=submit name=action value="|
       . $locale->text('continue') . qq|">
           <input type=hidden name="saved" value="|
-      . $locale->text('Bitte alle Angaben überprüfen') . qq|">
+      . $locale->text('Check Details') . qq|">
     |;
   } else {
     print qq|
@@ -1642,7 +1696,7 @@ sub save {
 
   } else {
 
-    $form->{saved} = $locale->text('Bitte eine Steuernummer angeben');
+    $form->{saved} = $locale->text('Choose a Tax Number');
   }
 
   &edit_form;
@@ -1658,7 +1712,7 @@ sub show_fa_daten {
                <fieldset>
                <legend>
                <font size="+1">|
-    . $locale->text('Finanzamt') . qq| $form->{FA_Name}</font>
+    . $locale->text('Tax Office') . qq| $form->{FA_Name}</font>
                </legend>
   |;
 
@@ -1677,7 +1731,7 @@ sub show_fa_daten {
                   <table width="100%">
                    <tr>
                     <td>
-                    | . $locale->text('Finanzamt') . qq|
+                    | . $locale->text('Tax Office') . qq|
                     </td>
                    </tr>
                    <tr>
@@ -1703,9 +1757,9 @@ sub show_fa_daten {
                   <br>
                   <fieldset>
                   <legend>
-                  <b>| . $locale->text('Kontakt') . qq|</b>
+                  <b>| . $locale->text('Contact') . qq|</b>
                   </legend>
-                      | . $locale->text('Telefon') . qq|<br>
+                      | . $locale->text('Telephone') . qq|<br>
                       <input name="FA_Telefon" size="40" title="FA_Telefon" value="$form->{FA_Telefon}" $readonly>
                       <br>
                       <br> 
@@ -1725,7 +1779,7 @@ sub show_fa_daten {
                   <br>
                   <fieldset>
                   <legend>
-                  <b>| . $locale->text('Öffnungszeiten') . qq|</b>
+                  <b>| . $locale->text('Openings') . qq|</b>
                   </legend>
                   <textarea name="FA_Oeffnungszeiten" rows="4" cols="40" $readonly>$oeffnungszeiten</textarea>
                   </fieldset>
@@ -1745,37 +1799,37 @@ sub show_fa_daten {
                     <fieldset>
                     <legend>
                     <b>|
-      . $locale->text('Bankverbindungen des Finanzamts') . qq|</b>
+      . $locale->text('Bank Connection Tax Office') . qq|</b>
                     <legend>
                     <table>   
                     <tr>
                      <td>
-                        | . $locale->text('Kreditinstitut') . qq|
+                        | . $locale->text('Bank') . qq|
                         <br>
                         <input name="FA_Bankbezeichnung_1" size="30" value="$form->{FA_Bankbezeichnung_1}" $readonly>
                         <br>
                         <br>
-                        | . $locale->text('Kontonummer') . qq|
+                        | . $locale->text('Account Nummer') . qq|
                         <br>
                         <input name="FA_Kontonummer_1" size="15" value="$form->{FA_Kontonummer_1}" $readonly>
                         <br>
                         <br> 
-                        | . $locale->text('Bankleitzahl') . qq|
+                        | . $locale->text('Bank Code (long)') . qq|
                         <br>
                         <input name="FA_BLZ_1" size="15" value="$form->{FA_BLZ_1}" $readonly>
                      </td>
                      <td>
-                        | . $locale->text('Kreditinstitut') . qq|
+                        | . $locale->text('Bank') . qq|
                         <br>
                         <input name="FA_Bankbezeichnung_oertlich" size="30" value="$form->{FA_Bankbezeichnung_oertlich}" $readonly>
                         <br>
                         <br>
-                        | . $locale->text('Kontonummer') . qq|
+                        | . $locale->text('Account Nummer') . qq|
                         <br>
                         <input name="FA_Kontonummer_2" size="15" value="$form->{FA_Kontonummer_2}" $readonly>
                         <br>
                         <br> 
-                        | . $locale->text('Bankleitzahl') . qq|
+                        | . $locale->text('Bank Code (long)') . qq|
                         <br>
                         <input name="FA_BLZ_2" size="15" value="$form->{FA_BLZ_2}" $readonly>
                      </td>
@@ -1788,19 +1842,19 @@ sub show_fa_daten {
                     <fieldset>
                     <legend>
                       <b>|
-      . $locale->text('Bankverbindung des Finanzamts') . qq|</b>
+      . $locale->text('Bank Connection Tax Office') . qq|</b>
                     <legend>
-                    | . $locale->text('Kontonummer') . qq|
+                    | . $locale->text('Account Nummer') . qq|
                     <br>
                     <input name="FA_Kontonummer_1" size="30" value="$form->{FA_Kontonummer_1}" $readonly>
                     <br>
                     <br> 
-                    | . $locale->text('Bankleitzahl (BLZ)') . qq|
+                    | . $locale->text('Bank Code (long)') . qq|
                     <br>
                     <input name="FA_BLZ_1" size="15" value="$form->{FA_BLZ_1}" $readonly>
                     <br>
                     <br>
-                    | . $locale->text('Kreditinstitut') . qq|
+                    | . $locale->text('Bank') . qq|
                     <br>
                     <input name="FA_Bankbezeichnung_1" size="15" value="$form->{FA_Bankbezeichnung_1}" $readonly>
                     <br>
@@ -1811,19 +1865,19 @@ sub show_fa_daten {
                     <fieldset>
                     <legend>
                       <b>|
-      . $locale->text('Bankverbindung des Finanzamts') . qq|</b>
+      . $locale->text('Bank Connection Tax Office') . qq|</b>
                     <legend> 
-                    | . $locale->text('Kontonummer') . qq|
+                    | . $locale->text('Account Nummer') . qq|
                     <br>
                     <input name="FA_Kontonummer_2" size="30" value="$form->{FA_Kontonummer_2}" $readonly>
                     <br>
                     <br> 
-                    | . $locale->text('Bankleitzahl (BLZ)') . qq|
+                    | . $locale->text('Bank Code (long)') . qq|
                     <br>
                     <input name="FA_BLZ_2" size="15" value="$form->{FA_BLZ_2}" $readonly>
                     <br>
                     <br>
-                    | . $locale->text('Kreditinstitut') . qq|
+                    | . $locale->text('Bank') . qq|
                     <br>
                     <input name="FA_Bankbezeichnung_oertlich" size="15" value="$form->{FA_Bankbezeichnung_oertlich}" $readonly>
                     </fieldset>