[ PHPXref.com ] [ Generated: Sun Jul 20 19:19:23 2008 ] [ PBS Helpdesk 0.93 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> equipment.php3 (source)

   1  <?php ;
   2  include  "init.php3";
   3  
   4  if($users_id=="") $users_id=get_login_id();
   5  
   6  $command="select ugroup from $db_name.users where users_id=$users_id";  
   7  $res1=mysql_query_wrap($command);  
   8  $row = mysql_fetch_row($res1); 
   9  $ugroup=$row[0];
  10  
  11  Function new_equipment($ugroup) {
  12  include  "environment.php3";
  13  include "$language.php3";
  14  
  15  echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">".
  16  "<html><BODY
  17  onLoad=\"parent.frames['PBStop'].location.href='top.php3?function=init'\"background=\"$pbs_background1\">".
  18  "<head>".
  19  "<meta http-equiv=\"Content-Type\" content=\"text/html; iso-8859-1\">".
  20  "<title>PBS - Inventar</title>".
  21  "<!base target=\"PBS\">".
  22  "</head>".
  23  
  24  "<body>".
  25  "<CENTER>".
  26  "<FORM ACTION=equipment.php3?function=store METHOD=POST>
  27  ";
  28  
  29  echo "<TABLE border=1   ALIGN=CENTER >
  30          <tr>
  31          <td>$pbsl_serialnr:</td>
  32          <td>$pbsl_count:</td>
  33          <td></td>
  34          </tr>
  35          <tr>
  36          <td><input type=\"text\" name=\"snr\" value='0'></td>
  37          <td><input type=\"text\" name=\"count\" value='1'></td></tr>
  38      <tr>
  39          <td>$pbsl_model:</td>
  40          <td>$pbsl_supplier:</td>        <td>$pbsl_user:</td>
  41          </tr>
  42          <tr>
  43          <td><A href=\"model.php3?function=new\">$pbsl_model $pbsl_create</td>
  44      <td><input type=\"text\" name=\"iseller\" value=''></td>        <td>$pbsl_stock</td>
  45      </tr>       <tr>
  46      <td> <select name=\"model\" WIDTH=60 >";
  47  $res1 = mysql_query_wrap("select model_id,model from $db_name.model order by model");    
  48  $i=0;  
  49  while ($i < mysql_num_rows ($res1)) {
  50    $row = mysql_fetch_row($res1);
  51    echo "<option value=\"$row[0]\" > $row[1]";
  52     $i++;
  53  }    
  54  echo "    </select></td>
  55  <td> <select name=\"seller\" WIDTH=60 >";
  56  $res1 = mysql_query_wrap("select distributor_id,distributor from $db_name.distributor order by distributor");    
  57  $i=0;  
  58  while ($i < mysql_num_rows ($res1)) {
  59    $row = mysql_fetch_row($res1);
  60    echo "<option value=\"$row[0]\" > $row[1]";
  61     $i++;
  62  }    
  63  
  64  echo "    </select></td>";
  65  
  66  $myyear=date("Y");
  67  $mymon=date("m");    
  68  $myday=date("d");    
  69  echo "    </tr>
  70      <tr>        </tr>
  71      <tr>
  72          <td>$pbsl_purchasedate:</td>    
  73          <td>$pbsl_guaranteeinmonths:</td>
  74          <td>$pbsl_accountnr:</td>
  75          </tr>
  76          <tr>
  77  <td><input type=\"text\" name=\"kdate1\" size=2 value=$myday>.<input type=\"text\" name=\"kdate2\" size=2
  78  value=$mymon>.<input type=\"text\" name=\"kdate3\" size=4 value=$myyear><br>
  79    <br>
  80        </td>
  81          <td><input type=\"text\" name=\"guarantee\" value='6'></td>
  82      <td><input type=\"text\" name=\"rnr\" value='0'></td>
  83      </tr>
  84      <tr>        </tr>
  85      <tr>        </tr>
  86      <tr>
  87      <tr>        </tr>
  88  </TABLE>
  89  <br>
  90  <TABLE border=0   ALIGN=CENTER >        <tr>";
  91     if($ugroup>=10)      echo "<td><input type=\"submit\" name=\"action\" value=\"$pbsl_store\"></td>
  92          <td><input type=\"submit\" name=\"action\" value=\"$pbsl_store $pbsl_and $pbsl_changeuser\"></td>";
  93         echo " </tr>
  94  </TABLE>
  95  </FORM>
  96  </body>
  97  </html>";
  98  
  99  }
 100  
 101  
 102  Function change_equipment($e_id,$changeowner,$ugroup) {
 103  include  "environment.php3";
 104  include "$language.php3";
 105  
 106  echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">".
 107  "<html><BODY background=\"$pbs_background1\">".
 108  "<head>".
 109  "<meta http-equiv=\"Content-Type\" content=\"text/html; iso-8859-1\">".
 110  "<title>PBS - Inventar</title>".
 111  "<!base target=\"PBS\">".
 112  "</head>".
 113  
 114  "<body>".
 115  "<CENTER>".
 116  "<FORM ACTION=equipment.php3?function=changestore METHOD=POST>
 117  ";
 118  $command="select *,last_name,first_name from equipment left join people on owner_id=people_id where
 119  equipment_id=$e_id";
 120  
 121  $res1 = mysql_query_wrap($command);
 122  $row = mysql_fetch_array($res1);
 123  
 124    $last_name= $row["last_name"];
 125    $first_name= $row["first_name"];
 126    $manu_id= $row["manufacturer_id"];
 127    $dist_id= $row["distributor_id"];
 128    $model_id= $row["model_id"];
 129    $kdate= $row["bill_date"];
 130    $guarantee= $row["guarantee"];
 131    $la= $row["la"];
 132    $rnr= $row["rnr"];
 133    $snr= $row["serial_no"];
 134    $count= $row["count"];
 135    $owner= $row["owner_id"];
 136  
 137  if($changeowner){
 138  $command="select last_name,first_name from people where people_id=$changeowner";
 139  
 140  $res1 = mysql_query_wrap($command);
 141  $row = mysql_fetch_array($res1);
 142  $last_name= $row["last_name"];
 143  $first_name= $row["first_name"];
 144  $owner= $changeowner;
 145  }  
 146  /* echo "kdate=$kdate<p>";*/
 147  echo "<TABLE border=1   ALIGN=CENTER >
 148          <tr>
 149          <td>$pbsl_serialnr:</td>
 150          <td>$pbsl_count:</td>
 151          <td>$pbsl_model:</td>
 152          </tr>
 153          <tr>
 154          <td><input type=\"text\" name=\"snr\" value=$snr></td>
 155          <td><input type=\"text\" name=\"count\" value=$count>
 156      <input type=\"hidden\" name=\"e_id\" value=$e_id>
 157      <input type=\"hidden\" name=\"owner\" value=$owner>
 158  </td>
 159  
 160      <td> <select name=\"model\" WIDTH=60 >";
 161      
 162  $res1 = mysql_query_wrap("select model_id,model,manufacturer_id,la from $db_name.model order by model");    
 163  $i=0;  
 164  while ($i < mysql_num_rows ($res1)) {
 165    $row = mysql_fetch_row($res1);
 166    if($row[0]==$model_id) { echo "<option value=\"$row[0]\" selected>$row[1]"; $m_id=$row[2]; $la_id=$row[3];}
 167     else echo "<option value=\"$row[0]\" > $row[1]";
 168     $i++;
 169  }    
 170  echo "    </select></td></tr>
 171      <tr>        </tr>
 172      <tr>
 173          <td>LA:</td>
 174          <td>$pbsl_manufacturer:</td>
 175          <td>$pbsl_supplier:</td>
 176          </tr>
 177          <tr>";
 178  
 179  
 180  $res1 = mysql_query_wrap("select object from $db_name.callobj where la=$la_id"); 
 181  /* $res1 = mysql_query_wrap("select manufacturer from $db_name.manufacturer where manufacturer_id=10");    */
 182  
 183  $row = mysql_fetch_row($res1);
 184  
 185  echo "<td>$row[0]</td>";
 186  
 187  $res1 = mysql_query_wrap("select manufacturer from $db_name.manufacturer where manufacturer_id=$m_id"); 
 188  /* $res1 = mysql_query_wrap("select manufacturer from $db_name.manufacturer where manufacturer_id=10");    */
 189  
 190  $row = mysql_fetch_row($res1);
 191  
 192  echo "<td>$row[0]</td>";
 193  
 194  echo    "<td> <select name=\"seller\" WIDTH=60 >";
 195  $res1 = mysql_query_wrap("select distributor_id,distributor from $db_name.distributor order by distributor");    
 196  $i=0;  
 197  while ($i < mysql_num_rows ($res1)) {
 198    $row = mysql_fetch_row($res1);
 199    if($row[0]==$dist_id) echo "<option value=\"$row[0]\" selected>$row[1]";
 200     else  echo "<option value=\"$row[0]\" > $row[1]";
 201     $i++;
 202  }    
 203  
 204  $myyear=substr($kdate,0,4);
 205  $mymon=substr($kdate,5,2);    
 206  $myday=substr($kdate,8,2);    
 207  
 208  echo "    </select></td>
 209      </tr>
 210      <tr>        </tr>
 211      <tr>
 212          <td>$pbsl_purchasedate:</td>    
 213          <td>$pbsl_guaranteeinmonths:</td>
 214          <td>$pbsl_accountnr:</td>
 215          </tr>
 216          <tr>
 217  <td><input type=\"text\" name=\"kdate1\" size=2 value=$myday>.<input type=\"text\" name=\"kdate2\" size=2
 218  value=$mymon>.<input type=\"text\" name=\"kdate3\" size=4 value=$myyear><br>
 219    <br>
 220        </td>
 221          <td><input type=\"text\" name=\"guarantee\" value=$guarantee></td>
 222      <td><input type=\"text\" name=\"rnr\" value=$rnr></td>
 223      </tr>
 224      <tr>        </tr>
 225      <tr>
 226          <td>$pbsl_user:</td>
 227          <td>$last_name, $first_name</td>
 228          <td></td>
 229          </tr>
 230      <tr>        </tr>
 231      <tr>
 232      
 233  
 234  </TABLE>
 235  <br>
 236  <TABLE border=0   ALIGN=CENTER >
 237          <tr>";
 238        if($ugroup>=10)   echo "<td><input type=\"submit\" name=\"action\" value=\"$pbsl_store\"></td>
 239          <td><input type=\"submit\" name=\"action\" value=\"$pbsl_store $pbsl_and $pbsl_changeuser\"></td>";
 240        echo "  </tr>
 241  </TABLE>
 242  </FORM>
 243  </body>
 244  </html>";
 245  
 246  }
 247  
 248  
 249  
 250  Function change_equipmentall($olduser,$newuser,$ugroup)
 251  {
 252  include  "environment.php3";
 253  include "$language.php3";
 254  
 255  mysql_query_wrap("lock tables equipment write");
 256  $command="update equipment set owner_id=$newuser where owner_id=$olduser";
 257  mysql_query_wrap($command);  
 258  mysql_query_wrap("unlock tables");
 259  echo "$pbsl_changeowner - OK !! "; 
 260  }
 261  
 262  if($function=="new") new_equipment($ugroup);
 263  if($function=="change") change_equipment($e_id,0,$ugroup);
 264  if($function=="changeowner") change_equipment($e_id,$suser,$ugroup);
 265  if($function=="changeownerall") change_equipmentall($olduser,$newuser,$ugroup);
 266  
 267  if($function=="store")
 268  {
 269  /* $users_id=get_login_id(); */
 270  
 271  
 272  if($iseller>""){
 273   $command="insert into distributor values(0,".sql_str($iseller).",NULL,$users_id)";
 274   mysql_query_wrap($command);
 275   $seller=mysql_insert_id(); 
 276  }
 277  /*        <td><input type=\"text\" name=\"imanufactor\" value=''></td>
 278      <td><input type=\"text\" name=\"iseller\" value=''></td>
 279  */
 280  $kdate=$kdate3."-".$kdate2."-".$kdate1;
 281  /* Nummer Lager ist 1288 */
 282  mysql_query_wrap("lock tables  $db_name.equipment  write");
 283  $command="insert into $db_name.equipment values(0,1287, ";
 284  $command=$command.sql_str($snr).",$seller, $model,".sql_str($kdate).",".intval($guarantee).",
 285   NULL, $users_id, '$rnr', $count)"; 
 286  mysql_query_wrap($command);  
 287  if(mysql_errno()) echo $pbsl_errormsg;
 288   else if($action<>"$pbsl_store $pbsl_and $pbsl_changeuser") { 
 289         echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">".
 290      "<html><BODY background=\"$pbs_background1\">".
 291      "<head>".
 292      "<meta http-equiv=\"Content-Type\" content=\"text/html; iso-8859-1\">".
 293      "<title>PBS - User</title>".
 294      "<!base target=\"PBS\">".
 295      "</head><body>";
 296  
 297     echo "<p>$pbsl_success ! <br>";
 298   }
 299  
 300  $rec_id=mysql_insert_id();
 301  mysql_query_wrap("unlock tables"); 
 302  if($action=="$pbsl_store $pbsl_and $pbsl_changeuser") { usersearch("98",$rec_id);} 
 303  
 304  //echo"<p>$command<p>";
 305  //echo"<p>$action<p>";
 306  
 307  
 308  echo "</body>";
 309  }
 310  
 311  
 312  
 313  if($function=="changestore")
 314  {
 315  /* $users_id=get_login_id(); */
 316  $kdate=$kdate3."-".$kdate2."-".$kdate1;
 317  mysql_query_wrap("lock tables  $db_name.equipment  write");
 318  $command="update $db_name.equipment set owner_id=$owner, serial_no=";
 319  $command=$command.sql_str($snr).", distributor_id=$seller,
 320  model_id=$model, bill_date=".sql_str($kdate).", guarantee=".intval($guarantee).",
 321  modify_date=NULL, modify_by=$users_id, rnr='$rnr', count=$count where equipment_id=$e_id"; 
 322  mysql_query_wrap($command);  
 323  if(mysql_errno()) echo $pbsl_errormsg;
 324  
 325  mysql_query_wrap("unlock tables"); 
 326  if($action=="$pbsl_store $pbsl_and $pbsl_changeuser") { usersearch("98",$e_id);} 
 327  
 328  if(mysql_errno()) echo $pbsl_errormsg;
 329   else if($action<>"$pbsl_store $pbsl_and $pbsl_changeuser") { 
 330         echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">".
 331      "<html><BODY background=\"$pbs_background1\">".
 332      "<head>".
 333      "<meta http-equiv=\"Content-Type\" content=\"text/html; iso-8859-1\">".
 334      "<title>PBS - User</title>".
 335      "<!base target=\"PBS\">".
 336      "</head><body>";
 337  
 338     echo "<p>$pbsl_success ! <br>";
 339   }
 340  
 341  
 342  echo "</body>";
 343  }
 344  /**************************************************************/
 345  /**************************************************************/
 346  /**************************************************************/
 347  /**************************************************************/
 348  
 349  
 350  
 351  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]