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

title

Body

[close]

/ -> model.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  
  12  Function new_model($ugroup) {
  13  include  "environment.php3";
  14  include "$language.php3";
  15  
  16  echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">".
  17  "<html><BODY
  18  onLoad=\"parent.frames['PBStop'].location.href='top.php3?function=init'\"background=\"$pbs_background1\">".
  19  "<head>".
  20  "<meta http-equiv=\"Content-Type\" content=\"text/html; iso-8859-1\">".
  21  "<title>PBS - Inventar</title>".
  22  "<!base target=\"PBS\">".
  23  "</head>".
  24  
  25  "<body>".
  26  "<CENTER>".
  27  "<FORM ACTION=model.php3?function=store METHOD=POST>
  28  ";
  29  
  30  echo "<TABLE border=1   ALIGN=CENTER >
  31          <tr>
  32          <td>$pbsl_model:</td>
  33          <td>$pbsl_manufacturer:</td>
  34          <td></td>
  35          </tr>
  36          <tr>
  37          <td><input type=\"text\" name=\"model\" value=''></td>
  38          <td><input type=\"text\" name=\"manufacturer1\" value=''></td></tr>
  39          <tr>
  40          <td>$pbsl_powerkind:</td>
  41      <td> <select name=\"manufacturer\" WIDTH=60 >";
  42  $res1 = mysql_query_wrap("select manufacturer,manufacturer_id from $db_name.manufacturer order by manufacturer");    
  43  $i=0;  
  44  while ($i < mysql_num_rows ($res1)) {
  45    $row = mysql_fetch_row($res1);
  46    if($row[1]==$srow[9]) echo "<option value=\"$srow[9]\" selected>$row[0]";
  47     else echo "<option value=\"$row[1]\" > $row[0]";
  48     $i++;
  49  }    
  50  
  51  echo "    </select></td></tr><tr>
  52      <td> <select name=\"callobj\" WIDTH=60 >";
  53  $res1 = mysql_query_wrap("select object,la from $db_name.callobj order by object");    
  54  
  55  $i=0;  
  56  while ($i < mysql_num_rows ($res1)) {
  57    $row = mysql_fetch_row($res1);
  58    if($row[1]==$srow[9]) echo "<option value=\"$srow[9]\" selected>$row[0]";
  59     else echo "<option value=\"$row[1]\" > $row[0]";
  60     $i++;
  61  }    
  62  
  63  echo "    </select></td>
  64  
  65  <td>$pbsl_active:
  66  <select name=\"active\" >
  67  <option value=\"1\" selected>$pbsl_yes
  68  <option value=\"0\" >$pbsl_no
  69  </select>
  70  </td>
  71  
  72  </tr>
  73  </TABLE>
  74  <br>
  75  <TABLE border=0   ALIGN=CENTER >        <tr>";
  76     if($ugroup>=10)  echo "<td><input type=\"submit\" name=\"action\"
  77     value=\"$pbsl_store\"></td>";
  78   echo "       </tr>
  79  </TABLE>
  80  </FORM>
  81  </body>
  82  </html>";
  83  
  84  }
  85  
  86  
  87  Function change_model($m_id,$changeowner,$ugroup) {
  88  include  "environment.php3";
  89  include "$language.php3";
  90  
  91  echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">".
  92  "<html><BODY background=\"$pbs_background1\">".
  93  "<head>".
  94  "<meta http-equiv=\"Content-Type\" content=\"text/html; iso-8859-1\">".
  95  "<title>PBS - Inventar</title>".
  96  "<!base target=\"PBS\">";
  97  
  98  // parent.frames[F1].location.href=URL1;
  99  echo "<script language=\"JavaScript\">
 100  <!--
 101    function stock()
 102    {
 103     parent.frames['PBSmain'].location.href=\"reports_$pbslang.php3?db_name=$db_name&report=41&modelid=$m_id&myselection=stock\";
 104    }
 105    function inuse()
 106    {
 107     parent.frames['PBSmain'].location.href=\"reports_$pbslang.php3?db_name=$db_name&report=41&modelid=$m_id&myselection=work\";
 108    }
 109    // -->
 110  </script>";
 111  echo "</head>".
 112  
 113  "<body>".
 114  "<CENTER>".
 115  "<FORM ACTION=model.php3?function=changestore METHOD=POST>
 116  ";
 117  
 118  $command = "select model,manufacturer_id,la,active from $db_name.model where model_id=$m_id";
 119  /*echo "$command<br>";*/
 120  $res1 = mysql_query_wrap($command); 
 121  $row = mysql_fetch_array($res1);
 122  
 123    $omodel= $row[0]; 
 124    $omanufacturer_id= $row["manufacturer_id"];
 125    $ola= $row["la"];
 126    $oactive= $row["active"];
 127  
 128  echo "<TABLE border=1   ALIGN=CENTER >
 129          <tr>
 130          <td>$pbsl_model:</td>
 131          <td>$pbsl_manufacturer:</td>
 132          <td></td>
 133          </tr>
 134          <tr>
 135          <td><input type=\"text\" name=\"model\" value='$omodel'></td>
 136      <input type=\"hidden\" name=\"m_id\" value=$m_id>
 137      <input type=\"hidden\" name=\"omanufacturer_id\" value=$omanufacturer_id>
 138      <input type=\"hidden\" name=\"ola\" value=$ola>
 139          <td><input type=\"text\" name=\"manufacturer1\" value=''></td></tr>
 140          <tr>
 141          <td>$pbsl_powerkind:</td>
 142      <td> <select name=\"manufacturer\" WIDTH=60 >";
 143  $res1 = mysql_query_wrap("select manufacturer,manufacturer_id from $db_name.manufacturer order by manufacturer");    
 144  $i=0;  
 145  while ($i < mysql_num_rows ($res1)) {
 146    $row = mysql_fetch_row($res1);
 147    if($row[1]==$omanufacturer_id) echo "<option value=\"$srow[9]\" selected>$row[0]";
 148     else echo "<option value=\"$row[1]\" > $row[0]";
 149     $i++;
 150  }    
 151  
 152  echo "    </select></td></tr><tr>
 153      <td> <select name=\"callobj\" WIDTH=60 >";
 154  $res1 = mysql_query_wrap("select object,la from $db_name.callobj order by object");    
 155  
 156  $i=0;  
 157  while ($i < mysql_num_rows ($res1)) {
 158    $row = mysql_fetch_row($res1);
 159    if($row[1]==$ola) echo "<option value=\"$srow[9]\" selected>$row[0]";
 160     else echo "<option value=\"$row[1]\" > $row[0]";
 161     $i++;
 162  }    
 163  
 164  echo "    </select></td>
 165  
 166  <td>$pbsl_active:
 167  <select name=\"active\" >";
 168  
 169  if($oactive==1){ $selectedactive="selected";$selectedinactive="";}
 170    else { $selectedactive="";$selectedinactive="selected";}
 171  
 172  echo "<option value=\"1\" $selectedactive>$pbsl_yes
 173  <option value=\"0\" $selectedinactive>$pbsl_no
 174  </select>
 175  </td>
 176  
 177  </tr>
 178  </TABLE>
 179  <br>
 180  <TABLE border=0   ALIGN=CENTER >        <tr>
 181  <td><input type=\"button\" name=\"action\" value=\"$pbsl_inuse\" onClick=\"inuse()\"></td>
 182      <td><input type=\"button\" name=\"action\" value=\"$pbsl_instock\" onClick=\"stock()\"></td><td></td>";
 183  if($ugroup>=10) echo "<td><input type=\"submit\" name=\"action\"
 184      value=\"$pbsl_store\"></td>";
 185      echo "    </tr>
 186  </TABLE>
 187  </FORM>
 188  </body>
 189  </html>";
 190  
 191  
 192  }
 193  
 194  
 195  if($function=="new") new_model($ugroup);
 196  if($function=="change") change_model($m_id,0,$ugroup);
 197  
 198  
 199  
 200  
 201  if($function=="store")
 202  {
 203  /* $users_id=get_login_id(); */
 204  
 205  
 206  if($manufacturer1>""){
 207   $command="insert into manufacturer values(0,".sql_str($manufacturer1).",NULL,$users_id)";
 208   mysql_query_wrap($command);
 209  /* echo "$command<br>"; */
 210   $manufacturer=mysql_insert_id(); 
 211  }
 212  
 213  
 214  mysql_query_wrap("lock tables  $db_name.model  write");
 215  $command="insert into $db_name.model values(0,".sql_str($model).",$manufacturer,NULL,$users_id ";
 216  $command=$command.",$callobj, $active)"; 
 217  mysql_query_wrap($command); 
 218    
 219  /* echo "$command<br>"; */
 220  if(mysql_errno()) echo $pbsl_errormsg;
 221   else echo "<p>$pbsl_success !";
 222  
 223  mysql_query_wrap("unlock tables"); 
 224  
 225  echo "</body>";
 226  }
 227  
 228  
 229  
 230  
 231  if($function=="changestore")
 232  {
 233  /* $users_id=get_login_id(); */
 234  
 235  
 236  if($manufacturer1>""){
 237   $command="insert into manufacturer values(0,".sql_str($manufacturer1).",NULL,$users_id)";
 238   mysql_query_wrap($command);
 239  /* echo "$command<br>"; */
 240   $manufacturer=mysql_insert_id(); 
 241  }
 242  
 243  if($manufacturer=="") $manufacturer=$omanufacturer_id;
 244  if($callobj=="")$callobj=$ola;
 245  
 246  mysql_query_wrap("lock tables  $db_name.model  write");
 247  $command="update $db_name.model set model=".sql_str($model).",manufacturer_id=$manufacturer,
 248  modify_by=$users_id,la=$callobj,active=$active where model_id=$m_id ";
 249  mysql_query_wrap($command); 
 250    
 251  /* echo "$command<br>"; */
 252  
 253  if(mysql_errno()) echo $pbsl_errormsg;
 254   else echo "<p>$pbsl_success !";
 255  
 256  mysql_query_wrap("unlock tables"); 
 257  
 258  echo "</body>";
 259  
 260  }
 261  /**************************************************************/
 262  /**************************************************************/
 263  /**************************************************************/
 264  /**************************************************************/
 265  
 266  
 267  
 268  ?>


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