Die Margen nur bei Verkaufsmasken anzeigen, und auch nur in Zeilen, in denen schon...
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 4 Jul 2007 12:56:43 +0000 (12:56 +0000)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 4 Jul 2007 12:56:43 +0000 (12:56 +0000)
bin/mozilla/io.pl
bin/mozilla/oe.pl

index 19f8113..2c44d60 100644 (file)
@@ -91,6 +91,11 @@ sub display_row {
   $lxdebug->enter_sub();
   my $numrows = shift;
 
+  my $is_sales =
+    (substr($form->{type}, 0, 6) eq "sales_")
+    || (($form->{type} eq "invoice") && ($form->{script} eq "is.pl"))
+    || ($form->{type} eq 'credit_note');
+
   if ($lizenzen && $form->{vc} eq "customer") {
     if ($form->{type} =~ /sales_order/) {
       @column_index = (runningnumber, partnumber, description, ship, qty);
@@ -525,10 +530,14 @@ sub display_row {
           <b>|.$locale->text('Subtotal').qq|</b>&nbsp;<input type="checkbox" name="subtotal_$i" value="1" "$subtotalchecked">
 |;
 
+    if ($form->{"id_$i"} && $is_sales) {
+      print qq|
+          ${marge_font_start}<b>| . $locale->text('Ertrag') . qq|</b>&nbsp;$form->{"marge_absolut_$i"} &nbsp;$form->{"marge_percent_$i"} % ${marge_font_end}
+          &nbsp;<b>| . $locale->text('LP') . qq|</b>&nbsp;| . $form->format_amount(\%myconfig, $form->{"listprice_$i"}, 2) . qq|
+          &nbsp;<b>| . $locale->text('EK') . qq|</b>&nbsp;| . $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, 2);
+    }
+
     print qq|
-          ${marge_font_start}<b>|.$locale->text('Ertrag').qq|</b>&nbsp;$form->{"marge_absolut_$i"} &nbsp;$form->{"marge_percent_$i"} % ${marge_font_end}
-          &nbsp;<b>|.$locale->text('LP').qq|</b>&nbsp;|.$form->format_amount(\%myconfig,$form->{"listprice_$i"},2).qq|
-          &nbsp;<b>|.$locale->text('EK').qq|</b>&nbsp;|.$form->format_amount(\%myconfig,$form->{"lastcost_$i"},2).qq|
          </td>
        </tr>
 |;
index 452613c..424cf34 100644 (file)
@@ -1012,6 +1012,10 @@ sub form_footer {
          </td>
           <td>
             <table>
+|;
+
+  if ($form->{type} =~ /^sales_/) {
+    print qq|
             <tr>
               <th  align=left>| . $locale->text('Ertrag') . qq|</th>
               <td>| .  $form->format_amount(\%myconfig, $form->{marge_total}, 2, 0) . qq|</td>
@@ -1020,6 +1024,10 @@ sub form_footer {
               <th  align=left>| . $locale->text('Ertrag prozentual') . qq|</th>
               <td>| .  $form->format_amount(\%myconfig, $form->{marge_percent}, 2, 0) . qq| %</td>
             </tr>
+|;
+  }
+
+  print qq|
             <input type=hidden name="marge_total" value="$form->{"marge_total"}">
             <input type=hidden name="marge_percent" value="$form->{"marge_percent"}">
             </table>