From e44cbe168d7cdaedc952a23102d8c834bd3a2993 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Stephan=20K=C3=B6hler?= <s.koehler@linet-services.de>
Date: Sat, 26 Nov 2005 16:07:11 +0000
Subject: [PATCH] =?utf8?q?Merge=20von=20639,640=20aus=20unstable:=20Rundun?=
 =?utf8?q?gsfehler=20nach=20erneuern=20-Bugfix:=20=20Angebot=20(Auch=20bei?=
 =?utf8?q?=20Rechnung):=20Menge=20mit=20Kommastelle,=20z.B=206,876,=20beim?=
 =?utf8?q?=20Erneuern=20wird=20die=20Menge=20gerundet=20und=20ohne=20Nachk?=
 =?utf8?q?ommastelle=20angezeigt.=20In=20der=20Vorgaengerversion=20ging=20?=
 =?utf8?q?das=20noch.=20Der=20Positions-Preis=20wird=20korrekt=20berechnet?=
 =?utf8?q?,=20nur=20die=20Anzeige=20der=20Menge=20scheint=20das=20Problem?=
 =?utf8?q?=20zu=20sein=20-Bugfix:=20svn=20639=20-=20Auch=20die=20entsprech?=
 =?utf8?q?enden=20Buchungen=20sind=20falsch=20gewesen.=20Angepasst=20f?=
 =?utf8?q?=C3=BCr=20Verkauf:=20Rechnungen,=20Auftr=C3=A4ge,=20Angebote=20u?=
 =?utf8?q?nd=20Einkauf:=20Einkaufsrechnung,=20Lieferantenauftrag,=20Preisa?=
 =?utf8?q?nfrage.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

---
 bin/mozilla/io.pl |  9 ++++++---
 bin/mozilla/ir.pl |  8 ++++++--
 bin/mozilla/is.pl |  7 ++++++-
 bin/mozilla/oe.pl | 22 ++++++++++++++++------
 4 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl
index 0fe78fd2a..c0ab3dc9a 100644
--- a/bin/mozilla/io.pl
+++ b/bin/mozilla/io.pl
@@ -254,10 +254,13 @@ sub display_row {
         qq|<td><input name="description_$i" size=30 value="$form->{"description_$i"}"></td>|;
     }
 
+    (my $qty_dec)     = ($form->{"qty_$i"} =~ /\.(\d+)/);
+    $qty_dec          = length $qty_dec;
+
     $column_data{qty} =
-        qq|<td align=right><input name="qty_$i" size=5 value=|
-      . $form->format_amount(\%myconfig, $form->{"qty_$i"}, 0)
-      . qq|></td>|;
+        qq|<td align=right><input name="qty_$i" size=5 value=|.
+          $form->format_amount(\%myconfig, $form->{"qty_$i"}, $qty_dec)
+       .qq|></td>|;
     $column_data{ship} =
         qq|<td align=right><input name="ship_$i" size=5 value=|
       . $form->format_amount(\%myconfig, $form->{"ship_$i"})
diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl
index caa8a0e6d..ee0e813a4 100644
--- a/bin/mozilla/ir.pl
+++ b/bin/mozilla/ir.pl
@@ -176,8 +176,12 @@ print STDERR "ir.pl-prepare_invoice\n";
       $form->{"sellprice_$i"} =
         $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
                              $decimalplaces);
+      
+      (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
+      $dec_qty      = length $dec_qty;
+      
       $form->{"qty_$i"} =
-        $form->format_amount(\%myconfig, ($form->{"qty_$i"} * -1));
+        $form->format_amount(\%myconfig, ($form->{"qty_$i"} * -1), $dec_qty);
 
       $form->{rowcount} = $i;
     }
@@ -823,7 +827,7 @@ sub update {
           $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
                                $decimalplaces);
         $form->{"qty_$i"} =
-          $form->format_amount(\%myconfig, $form->{"qty_$i"});
+          $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
       }
 
       &display_form;
diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl
index ae8c7748f..c6afe176c 100644
--- a/bin/mozilla/is.pl
+++ b/bin/mozilla/is.pl
@@ -210,7 +210,12 @@ sub prepare_invoice {
       $form->{"sellprice_$i"} =
         $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
                              $decimalplaces);
-      $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
+      
+      (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
+      $dec_qty      = length $dec_qty;
+      
+      $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"},
+        $dec_qty);
 
       map { $form->{"${_}_$i"} =~ s/\"/&quot;/g }
         qw(partnumber description unit partnotes);
diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl
index 6c410c159..cf6bd40b2 100644
--- a/bin/mozilla/oe.pl
+++ b/bin/mozilla/oe.pl
@@ -215,7 +215,11 @@ sub prepare_order {
       $form->{"sellprice_$i"} =
         $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
                              $decimalplaces);
-      $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
+
+      (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
+      $dec_qty      = length $dec_qty;
+
+      $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
 
       map { $form->{"${_}_$i"} =~ s/\"/&quot;/g }
         qw(partnumber description unit);
@@ -233,7 +237,10 @@ sub prepare_order {
       $form->{"sellprice_$i"} =
         $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
                              $decimalplaces);
-      $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
+      
+      (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
+      $dec_qty      = length $dec_qty;
+      $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
 
       map { $form->{"${_}_$i"} =~ s/\"/&quot;/g }
         qw(partnumber description unit);
@@ -973,7 +980,7 @@ sub update {
           $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
                                $decimalplaces);
         $form->{"qty_$i"} =
-          $form->format_amount(\%myconfig, $form->{"qty_$i"});
+          $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
 
         # get pricegroups for parts
         IS->get_pricegroups_for_parts(\%myconfig, \%$form);
@@ -1857,7 +1864,10 @@ sub invoice {
     $form->{"sellprice_$i"} =
       $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
                            $decimalplaces);
-    $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
+    
+    (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
+      $dec_qty      = length $dec_qty;
+    $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
 
     map { $form->{"${_}_$i"} =~ s/\"/&quot;/g }
       qw(partnumber description unit);
@@ -2356,7 +2366,7 @@ sub display_ship_receive {
       qq|<td>$description<input type=hidden name="description_$i" value="$form->{"description_$i"}"></td>|;
     $column_data{qty} =
         qq|<td align=right>|
-      . $form->format_amount(\%myconfig, $form->{"qty_$i"})
+      . $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty)
       . qq|<input type=hidden name="qty_$i" value="$form->{"qty_$i"}"></td>|;
     $column_data{ship} =
         qq|<td align=right><input name="ship_$i" size=5 value=|
@@ -2667,7 +2677,7 @@ sub list_transfer {
       qq|<td><input type=hidden name="warehouse_id_$i" value=$ref->{warehouse_id}>$ref->{warehouse}&nbsp;</td>|;
     $column_data{qty} =
         qq|<td><input type=hidden name="qty_$i" value=$ref->{qty}>|
-      . $form->format_amount(\%myconfig, $ref->{qty})
+      . $form->format_amount(\%myconfig, $ref->{qty}, $dec_qty)
       . qq|</td>|;
     $column_data{transfer} = qq|<td><input name="transfer_$i" size=4></td>|;
 
-- 
2.20.1