fhiiqm/inc/func_lib.inc.php
changeset 23 a382de56a8e4
parent 22 aae5b0ecc47b
child 25 482252ff12fd
--- a/fhiiqm/inc/func_lib.inc.php	Thu Jan 12 11:41:22 2012 +0100
+++ b/fhiiqm/inc/func_lib.inc.php	Mon Feb 06 13:44:00 2012 +0100
@@ -7,7 +7,7 @@
  * 
  */
 
-    function tab_column($colnum=2,$bez,$sort,$dir,$fcol=0,$fanr=0,$filtb="",$start="",$anzds="25")
+    function tab_column($colnum=2,$bez,$sort,$dir,$fcol=0,$fanr=0,$filtb="",$start="",$anzds="25",$id="")
     {
       /** beliebige Tabellenspalte mit Sortier-/Filtersymbolen und Links generieren
         * Parameter
@@ -20,6 +20,7 @@
         * $filtb    Filterbegriff
         * $start    ab Datensatz $start+1
         * $anzds    Anzahl angezeigter Datensaetze
+        * $id       fuer spezielle ID als zusaetzl. Filter (Laser-Log))
         */
         
         if ($colnum == $sort)
@@ -43,11 +44,11 @@
         if ($fcol>0 && $fanr>0) // Filtern nach Spalte moeglich
         {
             if ($fcol == $fanr) $filt = "filter_activ"; else $filt = "filter"; 
-            $filt = "&nbsp;<a href='".$_SERVER['PHP_SELF']."?f=$fcol&s=$sort&d=$dir&st=$start&z=$anzds'><img src='/fhiiqm/img/$filt.gif' border='0' width='14' hight='11' alt='$tip' title='$tip'></a>";;
+            $filt = "&nbsp;<a href='".$_SERVER['PHP_SELF']."?f=$fcol&s=$sort&d=$dir&st=$start&z=$anzds&i=$id'><img src='/fhiiqm/img/$filt.gif' border='0' width='14' hight='11' alt='$tip' title='$tip'></a>";;
         }
         else
             $filt="";
-        if ($filtb>'!') $where = "&f=$fanr&b=$filtb"; else $where="";
+        if ($filtb>'!') $where = "&f=$fanr&b=$filtb&i=$id"; else $where="&i=$id";
         echo "<th>$bez&nbsp;<a href='".$_SERVER['PHP_SELF']."?s=$colnum$where&st=$start&z=$anzds'><img src='/fhiiqm/img/$auf.gif' border='0' width='11' hight='11' alt='sort aufsteigend' title='sort aufsteigend'></a>            
                   <a href='".$_SERVER['PHP_SELF']."?s=$colnum&d=DESC$where&st=$start&z=$anzds'><img src='/fhiiqm/img/$ab.gif' border='0' width='11' hight='11' alt='sort absteigend' title='sort absteigend'></a>$filt</th>\n";
     }
@@ -256,6 +257,51 @@
 /*
         return $query;
 */    
+    }
+    
+    function dbformat_wert($wert)
+    {
+        /** wandelt Dezimalzahl mit Komma und Tausender-Trennzeichen in Datenbankformat
+         * 
+         * Parameter
+         * $wert    -   zu konvertierende Zahl
+         */
+         
+        if (isset($wert) && $wert<>0)
+        {
+            if (strpos($wert,',') >0) 
+            {
+                $wert = str_replace(',','.',$wert);
+                $aw = explode('.',$wert);
+                if (count($aw) > 2) // mit Dezimalpunkt und Tausendertrennzeichen
+                {
+                    for ($i=0; $i<count($aw)-1; $i++)
+                    {
+                        $dbw .= $aw[$i];
+                    }    
+                    $dbw .= "." .$aw[count($aw)-1];
+                }
+                else // kein Dezimalpunkt,nur Kommastellen
+                    $dbw = $wert;
+            }
+            else
+            {
+                $aw = explode('.',$wert);
+                if (strlen($aw[count($aw)-1]) == 2)
+                {
+                    for ($i=0; $i<count($aw)-1; $i++)
+                    {
+                        $dbw .= $aw[$i];
+                    }    
+                    $dbw .= "." .$aw[count($aw)-1];
+                }
+                else
+                    $dbw = str_replace('.','',$wert);
+            }    
+            return $dbw;            
+        }
+        else
+            return 0;
     } 
        
 ?>
\ No newline at end of file