Beim Anlegen einer Einheit bei allen Einheiten nachsehen, ob es eine Einheit mit...
[kivitendo-erp.git] / bin / mozilla / rp.pl
index 5772e16..034fa4f 100644 (file)
@@ -137,13 +137,13 @@ sub report {
     $department = "";
   } else {
     if ($form->{report} eq "balance_sheet") {
-      $name_1    = "compareasofdate";
-      $id_1      = "compareasofdate";
-      $value_1   = "";
+      $name_1    = "asofdate";
+      $id_1      = "asofdate";
+      $value_1   = "$form->{asofdate}";
       $trigger_1 = "trigger1";
-      $name_2    = "asofdate";
-      $id_2      = "asofdate";
-      $value_2   = "$form->{asofdate}";
+      $name_2    = "compareasofdate";
+      $id_2      = "compareasofdate";
+      $value_2   = "$form->{compareasofdate}";
       $trigger_2 = "trigger2";
     } elsif ($form->{report} =~ /(receipts|payments)$/) {
       $name_1    = "fromdate";
@@ -190,8 +190,7 @@ sub report {
 
       #write Trigger
       $jsscript =
-        Form->write_trigger(\%myconfig, "1", "$name_2", "BR", "$trigger_2", "",
-                            "", "");
+        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>|;
@@ -200,7 +199,7 @@ sub report {
         . $locale->text('button') . qq|>|;
       $button2 = qq|
          <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}">|;
-      $button2_2 = qq|  
+      $button2_2 = qq|
          <input type=button name=$name_2 id="$trigger_2" value=|
         . $locale->text('button') . qq|>
        |;
@@ -270,8 +269,7 @@ sub report {
          <td><input name=l_heading class=checkbox type=checkbox value=Y>&nbsp;|
       . $locale->text('Heading') . qq|
          <input name=l_subtotal class=checkbox type=checkbox value=Y>&nbsp;|
-      . $locale->text('Subtotal')
-      . qq|</td>
+      . $locale->text('Subtotal') . qq|</td>
        </tr>
 
 $jsscript
@@ -289,14 +287,12 @@ $jsscript
 <table>
        <tr>
          <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
-      . $locale->text('Customized Report')
-      . qq|</th>
+      . $locale->text('Customized Report') . qq|</th>
        </tr>
        <tr>
          <th colspan=1>| . $locale->text('Year') . qq|</th>
          <td><input name=year size=11 title="|
-      . $locale->text('YYYY')
-      . qq|" value="$year"></td>
+      . $locale->text('YYYY') . qq|" value="$year"></td>
        </tr>
 |;
 
@@ -311,70 +307,54 @@ $jsscript
                <td align=right>&nbsp; <input name=duetyp class=radio type=radio value="13"
 "checked"></td>
                <td><input name=duetyp class=radio type=radio value="A" $checked >&nbsp;1. |
-      . $locale->text('Quarter')
-      . qq|</td>
+      . $locale->text('Quarter') . qq|</td>
 |;
     $checked = "";
     print qq|
                <td><input name=duetyp class=radio type=radio value="1" $checked >&nbsp;|
-      . $locale->text('January')
-      . qq|</td>
+      . $locale->text('January') . qq|</td>
 |;
     $checked = "";
     print qq|
                <td><input name=duetyp class=radio type=radio value="5" $checked >&nbsp;|
-      . $locale->text('May')
-      . qq|</td>
+      . $locale->text('May') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="9" $checked >&nbsp;|
-      . $locale->text('September')
-      . qq|</td>
+      . $locale->text('September') . qq|</td>
 
        </tr>
        <tr>
                <td align= right>&nbsp;</td>
                <td><input name=duetyp class=radio type=radio value="B" $checked>&nbsp;2. |
-      . $locale->text('Quarter')
-      . qq|</td>
+      . $locale->text('Quarter') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="2" $checked >&nbsp;|
-      . $locale->text('February')
-      . qq|</td>
+      . $locale->text('February') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="6" $checked >&nbsp;|
-      . $locale->text('June')
-      . qq|</td>
+      . $locale->text('June') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="10" $checked >&nbsp;|
-      . $locale->text('October')
-      . qq|</td>
+      . $locale->text('October') . qq|</td>
        </tr>
        <tr>
                <td> &nbsp;</td>
                <td><input name=duetyp class=radio type=radio value="C" $checked>&nbsp;3. |
-      . $locale->text('Quarter')
-      . qq|</td>
+      . $locale->text('Quarter') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="3" $checked >&nbsp;|
-      . $locale->text('March')
-      . qq|</td>
+      . $locale->text('March') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="7" $checked >&nbsp;|
-      . $locale->text('July')
-      . qq|</td>
+      . $locale->text('July') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="11" $checked >&nbsp;|
-      . $locale->text('November')
-      . qq|</td>
+      . $locale->text('November') . qq|</td>
 
        </tr>
        <tr>
                <td> &nbsp;</td>
                <td><input name=duetyp class=radio type=radio value="D" $checked>&nbsp;4. |
-      . $locale->text('Quarter')
-      . qq|&nbsp;</td>
+      . $locale->text('Quarter') . qq|&nbsp;</td>
                <td><input name=duetyp class=radio type=radio value="4" $checked >&nbsp;|
-      . $locale->text('April')
-      . qq|</td>
+      . $locale->text('April') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="8" $checked >&nbsp;|
-      . $locale->text('August')
-      . qq|</td>
+      . $locale->text('August') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="12" $checked >&nbsp;|
-      . $locale->text('December')
-      . qq|</td>
+      . $locale->text('December') . qq|</td>
 
        </tr>
        <tr>
@@ -382,8 +362,7 @@ $jsscript
        </tr>
        <tr>
           <th align=left><input name=reporttype class=radio type=radio value="free" $checked> |
-      . $locale->text('Free report period')
-      . qq|</th>
+      . $locale->text('Free report period') . qq|</th>
          <td align=left colspan=4>| . $locale->text('From') . qq|&nbsp;
              $button1
               $button1_2&nbsp;
@@ -394,14 +373,13 @@ $jsscript
         </tr>
        <tr>
                <td colspan=5><hr size=3 noshade></td>
-       </tr>   
+       </tr>
        <tr>
          <th align=leftt>| . $locale->text('Method') . qq|</th>
          <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
       . $locale->text('Accrual') . qq|
          &nbsp;<input name=method class=radio type=radio value=cash $cash>|
-      . $locale->text('EUR')
-      . qq|</td>
+      . $locale->text('EUR') . qq|</td>
        </tr>
 
 $jsscript
@@ -419,14 +397,12 @@ $jsscript
 <table>
        <tr>
          <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
-      . $locale->text('Customized Report')
-      . qq|</th>
+      . $locale->text('Customized Report') . qq|</th>
        </tr>
        <tr>
          <th colspan=1>| . $locale->text('Year') . qq|</th>
          <td><input name=year size=11 title="|
-      . $locale->text('YYYY')
-      . qq|" value="$year"></td>
+      . $locale->text('YYYY') . qq|" value="$year"></td>
        </tr>
 |;
 
@@ -441,70 +417,54 @@ $jsscript
                <td align=right>&nbsp; <input name=duetyp class=radio type=radio value="13"
 $checked></td>
                <td><input name=duetyp class=radio type=radio value="A" $checked >&nbsp;1. |
-      . $locale->text('Quarter')
-      . qq|</td>
+      . $locale->text('Quarter') . qq|</td>
 |;
     $checked = "checked";
     print qq|
                <td><input name=duetyp class=radio type=radio value="1" $checked >&nbsp;|
-      . $locale->text('January')
-      . qq|</td>
+      . $locale->text('January') . qq|</td>
 |;
     $checked = "";
     print qq|
                <td><input name=duetyp class=radio type=radio value="5" $checked >&nbsp;|
-      . $locale->text('May')
-      . qq|</td>
+      . $locale->text('May') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="9" $checked >&nbsp;|
-      . $locale->text('September')
-      . qq|</td>
+      . $locale->text('September') . qq|</td>
 
        </tr>
        <tr>
                <td align= right>&nbsp;</td>
                <td><input name=duetyp class=radio type=radio value="B" $checked>&nbsp;2. |
-      . $locale->text('Quarter')
-      . qq|</td>
+      . $locale->text('Quarter') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="2" $checked >&nbsp;|
-      . $locale->text('February')
-      . qq|</td>
+      . $locale->text('February') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="6" $checked >&nbsp;|
-      . $locale->text('June')
-      . qq|</td>
+      . $locale->text('June') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="10" $checked >&nbsp;|
-      . $locale->text('October')
-      . qq|</td>
+      . $locale->text('October') . qq|</td>
        </tr>
        <tr>
                <td> &nbsp;</td>
                <td><input name=duetyp class=radio type=radio value="C" $checked>&nbsp;3. |
-      . $locale->text('Quarter')
-      . qq|</td>
+      . $locale->text('Quarter') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="3" $checked >&nbsp;|
-      . $locale->text('March')
-      . qq|</td>
+      . $locale->text('March') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="7" $checked >&nbsp;|
-      . $locale->text('July')
-      . qq|</td>
+      . $locale->text('July') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="11" $checked >&nbsp;|
-      . $locale->text('November')
-      . qq|</td>
+      . $locale->text('November') . qq|</td>
 
        </tr>
        <tr>
                <td> &nbsp;</td>
                <td><input name=duetyp class=radio type=radio value="D" $checked>&nbsp;4. |
-      . $locale->text('Quarter')
-      . qq|&nbsp;</td>
+      . $locale->text('Quarter') . qq|&nbsp;</td>
                <td><input name=duetyp class=radio type=radio value="4" $checked >&nbsp;|
-      . $locale->text('April')
-      . qq|</td>
+      . $locale->text('April') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="8" $checked >&nbsp;|
-      . $locale->text('August')
-      . qq|</td>
+      . $locale->text('August') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="12" $checked >&nbsp;|
-      . $locale->text('December')
-      . qq|</td>
+      . $locale->text('December') . qq|</td>
 
        </tr>
        <tr>
@@ -512,8 +472,7 @@ $checked></td>
        </tr>
        <tr>
           <th align=left><input name=reporttype class=radio type=radio value="free" $checked> |
-      . $locale->text('Free report period')
-      . qq|</th>
+      . $locale->text('Free report period') . qq|</th>
          <td align=left colspan=4>| . $locale->text('From') . qq|&nbsp;
              $button1
               $button1_2&nbsp;
@@ -524,38 +483,41 @@ $checked></td>
         </tr>
        <tr>
                <td colspan=5><hr size=3 noshade></td>
-       </tr>   
+       </tr>
        <tr>
          <th align=leftt>| . $locale->text('Method') . qq|</th>
          <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
       . $locale->text('Accrual') . qq|
          &nbsp;<input name=method class=radio type=radio value=cash $cash>|
-      . $locale->text('EUR')
-      . qq|</td>
+      . $locale->text('EUR') . qq|</td>
        </tr>
-        
-$jsscript    
+        <tr>
+         <th align=right colspan=4>|
+      . $locale->text('Decimalplaces')
+      . qq|</th>
+             <td><input name=decimalplaces size=3 value="2"></td>
+         </tr>
+                                    
+$jsscript
 |;
   }
 
   if ($form->{report} eq "ustva") {
 
     print qq|
-    
+
         <br>
         <input type=hidden name=nextsub value=generate_ustva>
 </table>
 <table>
        <tr>
          <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
-      . $locale->text('Zeitraum')
-      . qq|</th>
+      . $locale->text('Zeitraum') . qq|</th>
        </tr>
        <tr>
          <th colspan=1>| . $locale->text('Year') . qq|</th>
          <td><input name=year size=11 title="|
-      . $locale->text('YYYY')
-      . qq|" value="$year"></td>
+      . $locale->text('YYYY') . qq|" value="$year"></td>
        </tr>
 |;
 
@@ -570,82 +532,65 @@ $jsscript
                <td align=right>&nbsp; <input name=duetyp class=radio type=radio value="13"
 $checked></td>
                <td><input name=duetyp class=radio type=radio value="A" $checked >&nbsp;1. |
-      . $locale->text('Quarter')
-      . qq|</td>
+      . $locale->text('Quarter') . qq|</td>
 |;
     $checked = "checked";
     print qq|
                <td><input name=duetyp class=radio type=radio value="1" $checked >&nbsp;|
-      . $locale->text('January')
-      . qq|</td>
+      . $locale->text('January') . qq|</td>
 |;
     $checked = "";
     print qq|
                <td><input name=duetyp class=radio type=radio value="5" $checked >&nbsp;|
-      . $locale->text('May')
-      . qq|</td>
+      . $locale->text('May') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="9" $checked >&nbsp;|
-      . $locale->text('September')
-      . qq|</td>
+      . $locale->text('September') . qq|</td>
 
        </tr>
        <tr>
                <td align= right>&nbsp;</td>
                <td><input name=duetyp class=radio type=radio value="B" $checked>&nbsp;2. |
-      . $locale->text('Quarter')
-      . qq|</td>
+      . $locale->text('Quarter') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="2" $checked >&nbsp;|
-      . $locale->text('February')
-      . qq|</td>
+      . $locale->text('February') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="6" $checked >&nbsp;|
-      . $locale->text('June')
-      . qq|</td>
+      . $locale->text('June') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="10" $checked >&nbsp;|
-      . $locale->text('October')
-      . qq|</td>
+      . $locale->text('October') . qq|</td>
        </tr>
        <tr>
                <td> &nbsp;</td>
                <td><input name=duetyp class=radio type=radio value="C" $checked>&nbsp;3. |
-      . $locale->text('Quarter')
-      . qq|</td>
+      . $locale->text('Quarter') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="3" $checked >&nbsp;|
-      . $locale->text('March')
-      . qq|</td>
+      . $locale->text('March') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="7" $checked >&nbsp;|
-      . $locale->text('July')
-      . qq|</td>
+      . $locale->text('July') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="11" $checked >&nbsp;|
-      . $locale->text('November')
-      . qq|</td>
+      . $locale->text('November') . qq|</td>
 
        </tr>
        <tr>
                <td> &nbsp;</td>
                <td><input name=duetyp class=radio type=radio value="D" $checked>&nbsp;4. |
-      . $locale->text('Quarter')
-      . qq|&nbsp;</td>
+      . $locale->text('Quarter') . qq|&nbsp;</td>
                <td><input name=duetyp class=radio type=radio value="4" $checked >&nbsp;|
-      . $locale->text('April')
-      . qq|</td>
+      . $locale->text('April') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="8" $checked >&nbsp;|
-      . $locale->text('August')
-      . qq|</td>
+      . $locale->text('August') . qq|</td>
                <td><input name=duetyp class=radio type=radio value="12" $checked >&nbsp;|
-      . $locale->text('December')
-      . qq|</td>
+      . $locale->text('December') . qq|</td>
 
        </tr>
        <tr>
                <td colspan=5><hr size=3 noshade></td>
-       </tr>   
+       </tr>
        <tr>
          <th align=left>| . $locale->text('Method') . qq|</th>
          <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
       . $locale->text('Accrual') . qq|
          &nbsp;<input name=method class=radio type=radio value=cash $cash>|
-      . $locale->text('EUR')
-      . qq|</td>
+      . $locale->text('EUR') . qq|</td>
        </tr>
        <tr>
          <th colspan=4>|;
@@ -675,7 +620,7 @@ $checked></td>
        </tr>
        <tr>
          <th align=right>| . $locale->text('Decimalplaces') . qq|</th>
-         <td><input name=decimalplaces size=3></td>
+         <td><input name=decimalplaces size=3 value="2"></td>
        </tr>
       </table>
     </td>
@@ -688,8 +633,7 @@ $checked></td>
          <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
       . $locale->text('Accrual') . qq|
          &nbsp;<input name=method class=radio type=radio value=cash $cash>|
-      . $locale->text('EUR')
-      . qq|</td>
+      . $locale->text('EUR') . qq|</td>
        </tr>
 
        <tr>
@@ -699,10 +643,9 @@ $checked></td>
          <input name=l_subtotal class=checkbox type=checkbox value=Y>&nbsp;|
       . $locale->text('Subtotal') . qq|
          <input name=l_accno class=checkbox type=checkbox value=Y>&nbsp;|
-      . $locale->text('Account Number')
-      . qq|</td>
+      . $locale->text('Account Number') . qq|</td>
        </tr>
-        
+
 $jsscript
 |;
   }
@@ -736,10 +679,9 @@ $jsscript
          <input name=l_subtotal class=checkbox type=checkbox value=Y>&nbsp;|
       . $locale->text('Subtotal') . qq|
          <input name=all_accounts class=checkbox type=checkbox value=Y>&nbsp;|
-      . $locale->text('All Accounts')
-      . qq|</td>
+      . $locale->text('All Accounts') . qq|</td>
        </tr>
-        
+
 $jsscript
 |;
   }
@@ -814,8 +756,7 @@ $jsscript
          <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
       . $locale->text('Accrual') . qq|
          &nbsp;<input name=method class=radio type=radio value=cash $cash>|
-      . $locale->text('EUR')
-      . qq|</td>
+      . $locale->text('EUR') . qq|</td>
        </tr>
       </table>
     </td>
@@ -888,8 +829,7 @@ $jsscript
          <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
       . $locale->text('Accrual') . qq|
          &nbsp;<input name=method class=radio type=radio value=cash $cash>|
-      . $locale->text('EUR')
-      . qq|</td>
+      . $locale->text('EUR') . qq|</td>
        </tr>
         <tr>
          <th align=right>| . $locale->text('Include in Report') . qq|</th>
@@ -974,7 +914,7 @@ $jsscript
 
        <input type=hidden name=nextsub value=$nextsub>
        <input type=hidden name=action value=$nextsub>
-        
+
 $jsscript
 |;
   }
@@ -1031,12 +971,11 @@ $jsscript
         <tr>
          <td align=right><input type=checkbox style=checkbox name=fx_transaction value=1 checked></td>
          <th align=left colspan=3>|
-      . $locale->text('Include Exchangerate Difference')
-      . qq|</td>
+      . $locale->text('Include Exchangerate Difference') . qq|</td>
        </tr>
 
-$jsscript 
-        
+$jsscript
+
          <input type=hidden name=db value=$form->{db}>
          <input type=hidden name=sort value=transdate>
 |;
@@ -1249,10 +1188,10 @@ sub generate_income_statement {
     $longfromdate  = $locale->date(\%myconfig, $form->{fromdate}, 1);
     $shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0);
 
-    $form->{this_period} = "$shortfromdate<br>\n$shorttodate";
+    $form->{this_period} = "$shortfromdate\n$shorttodate";
     $form->{period}      =
         $locale->text('for Period')
-      . qq|<br>\n$longfromdate |
+      . qq|\n$longfromdate |
       . $locale->text('Bis')
       . qq| $longtodate|;
   }
@@ -1266,9 +1205,9 @@ sub generate_income_statement {
     $longcomparetodate  = $locale->date(\%myconfig, $form->{comparetodate}, 1);
     $shortcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 0);
 
-    $form->{last_period} = "$shortcomparefromdate<br>\n$shortcomparetodate";
+    $form->{last_period} = "$shortcomparefromdate\n$shortcomparetodate";
     $form->{period} .=
-        "<br>\n$longcomparefromdate "
+        "\n$longcomparefromdate "
       . $locale->text('Bis')
       . qq| $longcomparetodate|;
   }
@@ -1276,7 +1215,6 @@ sub generate_income_statement {
   # setup variables for the form
   @a = qw(company address businessnumber);
   map { $form->{$_} = $myconfig{$_} } @a;
-  $form->{address} =~ s/\\n/<br>/g;
 
   $form->{templates} = $myconfig{templates};
 
@@ -1317,7 +1255,6 @@ sub generate_balance_sheet {
   # setup company variables for the form
   map { $form->{$_} = $myconfig{$_} }
     (qw(company address businessnumber nativecurr));
-  $form->{address} =~ s/\\n/<br>/g;
 
   $form->{templates} = $myconfig{templates};
 
@@ -1455,8 +1392,8 @@ sub list_accounts {
 
     $ml = ($ref->{category} =~ /(A|C|E)/) ? -1 : 1;
 
-    $debit  = $form->format_amount(\%myconfig, $ref->{debit},  2, "&nbsp;");
-    $credit = $form->format_amount(\%myconfig, $ref->{credit}, 2, "&nbsp;");
+    $debit  = ($ref->{debit} != 0) ? $form->format_amount(\%myconfig, $ref->{debit},  2, "&nbsp;") : "&nbsp;";
+    $credit = ($ref->{credit} != 0) ? $form->format_amount(\%myconfig, $ref->{credit}, 2, "&nbsp;") : "&nbsp;";
     $begbalance =
       $form->format_amount(\%myconfig, $ref->{balance} * $ml, 2, "&nbsp;");
     $endbalance =
@@ -1735,14 +1672,14 @@ sub aging {
       $i++;
 
       if ($subtotal) {
-        $c0subtotal =
-          $form->format_amount(\%myconfig, $c0subtotal, 2, "&nbsp");
-        $c30subtotal =
-          $form->format_amount(\%myconfig, $c30subtotal, 2, "&nbsp");
-        $c60subtotal =
-          $form->format_amount(\%myconfig, $c60subtotal, 2, "&nbsp");
-        $c90subtotal =
-          $form->format_amount(\%myconfig, $c90subtotal, 2, "&nbsp");
+        $c0subtotal = ($c0subtotal != 0) ? 
+          $form->format_amount(\%myconfig, $c0subtotal, 2, "&nbsp") : "";
+        $c30subtotal = ($c30subtotal != 0) ?
+          $form->format_amount(\%myconfig, $c30subtotal, 2, "&nbsp") : "";
+        $c60subtotal = ($c60subtotal != 0) ?
+          $form->format_amount(\%myconfig, $c60subtotal, 2, "&nbsp") : "";
+        $c90subtotal = ($c90subtotal != 0) ?
+          $form->format_amount(\%myconfig, $c90subtotal, 2, "&nbsp") : "";
       }
 
       $column_data{ct}        = qq|<th>&nbsp;</th>|;
@@ -1798,10 +1735,10 @@ sub aging {
     $c60total += $ref->{c60};
     $c90total += $ref->{c90};
 
-    $ref->{c0}  = $form->format_amount(\%myconfig, $ref->{c0},  2, "&nbsp;");
-    $ref->{c30} = $form->format_amount(\%myconfig, $ref->{c30}, 2, "&nbsp;");
-    $ref->{c60} = $form->format_amount(\%myconfig, $ref->{c60}, 2, "&nbsp;");
-    $ref->{c90} = $form->format_amount(\%myconfig, $ref->{c90}, 2, "&nbsp;");
+    $ref->{c0}  = ($ref->{c0} != 0) ? $form->format_amount(\%myconfig, $ref->{c0},  2, "&nbsp;") : "";
+    $ref->{c30} = ($ref->{c30} != 0) ? $form->format_amount(\%myconfig, $ref->{c30}, 2, "&nbsp;") : "";
+    $ref->{c60} = ($ref->{c60} != 0) ?  $form->format_amount(\%myconfig, $ref->{c60}, 2, "&nbsp;") : "";
+    $ref->{c90} = ($ref->{c90} != 0) ?  $form->format_amount(\%myconfig, $ref->{c90}, 2, "&nbsp;") : "";
 
     $href =
       qq|$ref->{module}.pl?path=$form->{path}&action=edit&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=|
@@ -1906,7 +1843,7 @@ sub aging {
 <input type=hidden name=path value=$form->{path}>
 <input type=hidden name=login value=$form->{login}>
 <input type=hidden name=password value=$form->{password}>
-  
+
 <br>
 <input class=submit type=submit name=action value="|
       . $locale->text('Select all') . qq|">
@@ -1944,66 +1881,6 @@ sub select_all {
   $lxdebug->leave_sub();
 }
 
-sub print_options {
-  $lxdebug->enter_sub();
-
-  $form->{sendmode} = "attachment";
-  $form->{copies}   = 2 unless $form->{copies};
-
-  $form->{PD}{ $form->{type} }     = "selected";
-  $form->{DF}{ $form->{format} }   = "selected";
-  $form->{OP}{ $form->{media} }    = "selected";
-  $form->{SM}{ $form->{sendmode} } = "selected";
-
-  $type = qq|
-           <option value=statement $form->{PD}{statement}>|
-    . $locale->text('Statement');
-
-  if ($form->{media} eq 'email') {
-    $media = qq|
-           <option value=attachment $form->{SM}{attachment}>|
-      . $locale->text('Attachment') . qq|
-           <option value=inline $form->{SM}{inline}>| . $locale->text('In-line');
-  } else {
-    $media = qq|
-           <option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
-    if ($myconfig{printer} && $latex) {
-      $media .= qq|
-            <option value=printer $form->{OP}{printer}>|
-        . $locale->text('Printer');
-    }
-  }
-
-  if ($latex) {
-    $format .= qq|
-            <option value=postscript $form->{DF}{postscript}>|
-      . $locale->text('Postscript') . qq|
-           <option value=pdf $form->{DF}{pdf}>| . $locale->text('PDF');
-  }
-
-  print qq|
-<table>
-  <tr>
-    <td><select name=type>$type</select></td>
-    <td><select name=format>$format</select></td>
-    <td><select name=media>$media</select></td>
-|;
-
-  if ($myconfig{printer} && $latex && $form->{media} ne 'email') {
-    print qq|
-      <td>| . $locale->text('Copies') . qq|
-      <input name=copies size=2 value=$form->{copies}></td>
-|;
-  }
-
-  print qq|
-  </tr>
-</table>
-|;
-
-  $lxdebug->leave_sub();
-}
-
 sub e_mail {
   $lxdebug->enter_sub();
 
@@ -2170,11 +2047,6 @@ sub print_form {
 
   $form->{templates} = "$myconfig{templates}";
 
-  # setup variables for the form
-  @a = qw(company address businessnumber tel fax);
-  map { $form->{$_} = $myconfig{$_} } @a;
-  $form->format_string(@a);
-
   $form->{IN} = "$form->{type}.html";
 
   if ($form->{format} eq 'postscript') {
@@ -2202,7 +2074,6 @@ sub print_form {
           (name, street, zipcode, city, country, contact, email,
            "$form->{ct}phone", "$form->{ct}fax");
         map { $form->{$_} = $ref->{$_} } @a;
-        $form->format_string(@a);
 
         $form->{ $form->{ct} } = $form->{name};
         $form->{"$form->{ct}_id"} = $ref->{ctid};
@@ -2755,7 +2626,6 @@ sub debug {
 
 sub winston_export {
   $lxdebug->enter_sub();
-  print(STDERR "Winston Export1\n");
 
   #create_winston();
   $form->{winston} = 1;
@@ -2767,7 +2637,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";
@@ -2791,14 +2670,14 @@ sub print_options {
   } else {
     $media = qq|
            <option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
-    if ($myconfig{printer} && $latex) {
+    if ($myconfig{printer} && $latex_templates) {
       $media .= qq|
             <option value=printer $form->{OP}{printer}>|
         . $locale->text('Printer');
     }
   }
 
-  if ($latex) {
+  if ($latex_templates) {
     $format .= qq|
             <option value=html $form->{DF}{html}>|
       . $locale->text('HTML') . qq|
@@ -2818,7 +2697,7 @@ sub print_options {
     <td><select name=media>$media</select></td>
 |;
 
-  if ($myconfig{printer} && $latex && $form->{media} ne 'email') {
+  if ($myconfig{printer} && $latex_templates && $form->{media} ne 'email') {
     print qq|
       <td>| . $locale->text('Copies') . qq|
       <input name=copies size=2 value=$form->{copies}></td>
@@ -3007,10 +2886,10 @@ sub generate_bwa {
     $longfromdate  = $locale->date(\%germandate, $form->{fromdate}, 1);
     $shortfromdate = $locale->date(\%germandate, $form->{fromdate}, 0);
 
-    $form->{this_period} = "$shortfromdate<br>\n$shorttodate";
+    $form->{this_period} = "$shortfromdate\n$shorttodate";
     $form->{period}      =
         $locale->text('for Period')
-      . qq|<br>\n$longfromdate |
+      . qq|\n$longfromdate |
       . $locale->text('bis')
       . qq| $longtodate|;
   }
@@ -3018,7 +2897,6 @@ sub generate_bwa {
   # setup variables for the form
   @a = qw(company address businessnumber);
   map { $form->{$_} = $myconfig{$_} } @a;
-  $form->{address} =~ s/\\n/<br>/g;
   $form->{templates} = $myconfig{templates};
 
   $form->{IN} = "bwa.html";
@@ -3033,7 +2911,6 @@ sub generate_ustva {
 
   # Hier Aufruf von get_config aus bin/mozilla/fa.pl zum
   # Einlesen der Finanzamtdaten
-  print(STDERR "Winston4\n");
   get_config($userspath, 'finanzamt.ini');
 
   #  &get_project(generate_bwa);
@@ -3043,7 +2920,6 @@ sub generate_ustva {
   foreach $item (@anmeldungszeitraum) {
     $form->{$item} = "";
   }
-  print(STDERR "Winston2\n");
   if ($form->{reporttype} eq "custom") {
 
     #forgotten the year --> thisyear
@@ -3189,7 +3065,7 @@ sub generate_ustva {
     $longfromdate  = $locale->date(\%myconfig, $form->{fromdate}, 1);
     $shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0);
 
-    $form->{this_period} = "$shortfromdate<br>\n$shorttodate";
+    $form->{this_period} = "$shortfromdate\n$shorttodate";
     $form->{period}      =
         $locale->text('for Period')
       . qq|<br>\n$longfromdate |
@@ -3206,9 +3082,9 @@ sub generate_ustva {
     $longcomparetodate  = $locale->date(\%myconfig, $form->{comparetodate}, 1);
     $shortcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 0);
 
-    $form->{last_period} = "$shortcomparefromdate<br>\n$shortcomparetodate";
+    $form->{last_period} = "$shortcomparefromdate\n$shortcomparetodate";
     $form->{period} .=
-        "<br>\n$longcomparefromdate "
+        "\n$longcomparefromdate "
       . $locale->text('bis')
       . qq| $longcomparetodate|;
   }
@@ -3244,7 +3120,6 @@ sub generate_ustva {
   $form->{address} =~ s/\\n/$form->{br}/g;
 
   if ($form->{winston} eq '1') {
-    print(STDERR "fast bei winston\n");
     create_winston();
 
   } else {
@@ -3261,4 +3136,3 @@ sub generate_ustva {
   }
   $lxdebug->leave_sub();
 }
-