Location: PHPKode > projects > WebETB > auftraege/logging.php4
<?php
/******************************************************************************/
/*	MODUL:	auftraege/logging.php4  														*/
/*																										*/
/* DATUM:	27.03.2006, Version 0.1															*/
/* BESCHR.: Auflisten aller Einsatzauftraege inkl. Seitennavigation           */
/*																										*/
/*	AUTOR:   Marcus Groh																			*/
/*	LIZENZ:  GPL v2 vom Juni 1991 															*/
/*																										*/
/*	AENDERUNGEN:	01.07.2004        -initiale Version								   */
/*                27.03.2006 v 0.1, -Versionskennzeichnung eingefuehrt        */
/*                                  -Code unter GPL v2 gestellt               */
/*                                  -Tabellenname dynamisiert                 */
/*																										*/
/******************************************************************************/
$allowed_groups=array("elw");
include ('../_include/header_1.php4');

if ( ( $writemode == "TRUE" ) && ( $isclosed == "FALSE" ) )
{
   // Datensatz aendern
   if ( isset($mod) )
   {
       $close_auftrag="update $T_auftrag set erledigt='Y' where aid=$cl_aid and eid=$eid";
       mysql_db_query($database["database"],$close_auftrag,$db);
 
      // Calc. new lfdnr for etb
      $select_etb="select lfdnr from $T_etb where eid=$eid";
      $result_etb=@mysql_db_query($database["database"],$select_etb,$db);
      $lfd=mysql_num_rows($result_etb);
      $lfd++;
      $zeit=date("H:i:s");
      $datum=date("y-m-d");
      $insert_etb="insert into $T_etb values ('$lfd','NULL','NULL',' ',' ','$datum','$zeit','Auftrag:<BR>Meldung: $cl_meld','Auftrag geschlossen','NULL','$uid','$eid')";
      mysql_db_query($database["database"],$insert_etb,$db);
 
       $close="";
       $mod="";
   }
}

?> 
   <br>
   <center>
   <table border="0" cellpadding="0" cellspacing="0" width="950">
   <tr>
      <th colspan="8">Einsatzauftr&auml;ge - Verlauf</th>
   </tr>
   <tr>
      <td width="30"  align="middle"><p id="GR07">&nbsp;</p></td>
      <td width="70"  align="middle"><p id="GR07">Datum</p></td>
      <td width="60"  align="middle"><p id="GR07">Zeit</p></td>
      <td width="130" align="left"><p id="GR07">Auftraggeber</p></td>
      <td width="60"  align="left"><p id="GR07">Auftragn.</p></td>      
      <td width="200" align="left"><p id="GR07">Meldung</p></td>
      <td width="200" align="left"><p id="GR07">Ort</p></td>
      <td width="200" align="middle"><p id="GR07">Bemerkung</p></td>
   </tr>
   <tr>
      <td colspan="8" height="1" width="950" style="background-color: #000000;"><img src="../_img/spacer.gif" height="1" width="950" border="0"></td>
   </tr>  
   
   <?
   // how many records do we have
   $select_auftrag="select * from $T_auftrag where eid=$eid";
   $result=@mysql_db_query($database["database"],$select_auftrag,$db);
   $max_auftr_rec=mysql_num_rows($result);
   
   // initial startvalue should be last entry
   if ( ! isset($ASTART))
   {
      $ASTART=$max_auftr_rec - 19;
      if ($ASTART <= "20" )
         { $ASTART=0; }
   } 
   
   $select_auftr_log="select * from $T_auftrag where eid=$eid order by datum, zeit limit $ASTART, 20";
   $result_auftr_log=@mysql_db_query($database["database"],$select_auftr_log,$db);
   while ( $row=mysql_fetch_array($result_auftr_log) )
   {
       // sort fields
      $db_aid=$row['aid'];
      $db_meldung=$row['meldung'];
      $db_ort=$row['ort'];
      $db_bemerk=$row['bemerkung'];
      $db_erledigt=$row['erledigt'];
      $db_datum=gmdate("d.m.y", strtotime ($row['datum']));
      $db_zeit=$row['zeit'];
      $db_von=$row['von'];
      $db_kid=$row['kid'];
      $db_pid=$row['parent_id'];

      // check if auftrag is done and set a depending image
      if ( $db_erledigt == "Y" )
      {
         $bullet="../_img/ball_gr.gif";
         $modit="../_img/spacer.gif";
      }
      else
      {
        $bullet="../_img/ball_rt.gif";
        $modit="../_img/props.png";
      }
      
      // set readable text for field "AUFTRAGNEHMER" 
      $select_an="select rufname from $T_kraefte where eid=$eid and kid=$db_kid";     
      $result_an=@mysql_db_query($database["database"],$select_an,$db);            

      while ( $row=mysql_fetch_array($result_an) )                                 
      {                                                                            
         $frm_an=$row['rufname'];                                                  
      }                                                                                                                                                

        // print values
        ?>
           <tr>
           <?
           if ( $db_erledigt == "Y" )
           {
               ?>
               <td              align="middle" valign="middle"><img src="<? echo $bullet; ?>" border="0" width="20" height="22"></td>
               <?           
           }
           else
           {
              if ( ( $writemode == "TRUE" ) && ( $isclosed == "FALSE" ) )
              {
                  echo "<td align=\"middle\" valign=\"middle\"><a href=\"?mod=true&cl_aid=$db_aid&cl_von=$db_von&cl_kid=$db_kid&cl_meld=$db_meldung\" onFocus=blur(); style=\"text-decoration: none;\"><img src=\"$bullet\" border=\"0\" width=\"20\" height=\"22\" title=\"Auftrag abschlie&szlig;en\"></a></td>\n";
              }
              else
              {
                  echo "<td align=\"middle\" valign=\"middle\"><img src=\"$bullet\" border=\"0\" width=\"20\" height=\"22\"></td>\n";
              }
           }
            ?>  
              <td width="70"   align="left"   valign="top"><p id="sw10_s"><? echo $db_datum; ?></p></td>
              <td width="60"   align="left"   valign="top"><p id="sw10_s"><? echo $db_zeit; ?></p></td>
              <td width="130"  align="left"   valign="top"><p id="sw10_s"><? echo $db_von; ?></p></td>
              <td width="60"  align="left"   valign="top"><p id="sw10_s"><? echo $frm_an; ?></p></td>              
              <td width="200"  align="left"   valign="top"><p id="sw10_s"><? echo $db_meldung; ?></p></td>
              <td width="200"  align="left"   valign="top"><p id="sw10_s"><? echo $db_ort; ?></p></td>
              <td width="200"  align="left"   valign="top"><p id="sw10_s"><? echo $db_bemerk; ?></p></td>
           </tr>
            <tr>
               <td colspan="8" height="1" width="950" style="background-color: #999999;"><img src="../_img/spacer.gif" height="1" width="950" border="0"></td>
            </tr> 
        <?   
   }    
   
   ?>
     </table>
   <br>  
   <form action="" method=post name="print_auftr">
   <input type="hidden" name="ASTART" value="<? echo $ASTART; ?>">   
   <input type="submit" name="beg" value="|<" title="An den Anfang springen"         style="width: 20px; border: 1px solid silver; background-color: #CCCCCC;" onClick="fixed_auftr_pos(<? echo "1"; ?>);">&nbsp;&nbsp;
   <input type="submit" name="for" value="<"  title="20 Datens&auml;tze zur&uuml;ck" style="width: 20px; border: 1px solid silver; background-color: #CCCCCC;" onClick="backward_auftr_step(<? echo $ASTART . ", 1"; ?>);">&nbsp;
   <input type="submit" name="bck" value=">"  title="20 Datens&auml;tze vor"         style="width: 20px; border: 1px solid silver; background-color: #CCCCCC;" onClick="forward_auftr_step(<? echo $ASTART . "," . $max_auftr_rec; ?>);">&nbsp;&nbsp;
   <input type="submit" name="lst" value=">|" title="Ans Ende springen"              style="width: 20px; border: 1px solid silver; background-color: #CCCCCC;" onClick="fixed_auftr_pos(<? echo $max_auftr_rec - 19; ?>);">&nbsp;&nbsp;
   </form>   
   </center>
<?
include ('../_include/footer_1.php4');

?>
Return current item: WebETB