Viewing file: FrmEditAcc.php (14.76 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
session_start();
if (session_is_registered("valid_user"))
{
$Username = $valid_user;
include("../include/FunctionDB.php");
include("../include/Function.php");
include("admin_menu.php");
ConnectDB();
$sql ="SELECT * FROM accessories_tb WHERE code='$code'";
$result = mysql_query($sql) or die("Cannot Select").mysql_error();
$rs = mysql_fetch_array($result);
?>
<script language="JavaScript" type="text/JavaScript">
<!--
function browse()
{
form1.Imag1.src = form1.Img1.value;
}
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
function chk(c){
if (c.checked){
document.all.Prob1.disabled=false;
document.all.Prob2.disabled=false;
document.all.Prob3.disabled=false;
document.all.Prob4.disabled=false;
}
else{
document.all.Problem.disabled=false;
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=TIS-620">
<link rel="stylesheet" href="../css/cart4.css" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function browse()
{
form1.Imag1.src = form1.Img1.value;
}
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
function chk(c){
if (c.checked){
document.all.Prob1.disabled=false;
document.all.Prob2.disabled=false;
document.all.Prob3.disabled=false;
document.all.Prob4.disabled=false;
}
else{
document.all.Problem.disabled=false;
}
}
</script>
<style type="text/css">
<!--
.style1 {font-size: 14px}
-->
</style>
<table width="813" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="813" ><br>
<fieldset>
<legend><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>"><a href="menu_teacher.php">หน้าหลัก</a> <img src="../picture/ico3.gif" width="10" height="10" border="0" align="absmiddle"><a href="AccByname.php?Faculty_code=<?php echo $rs[Faculty_code]?>">ข้อมูลครุภัณฑ์หน่วยงาน</a> <img src="../picture/ico3.gif" width="10" height="10" border="0" align="absmiddle" /> <a href="AddAcc.php?Faculty_code=<?php echo $rs[Faculty_code]?>">เพิ่มรายการครุภัณฑ์</a> <img src="../picture/ico3.gif" width="10" height="10" border="0" align="absmiddle" />แก้ไขข้อมูลครุภัณฑ์</font></legend>
<label>
<div align="center">
<form id="form1" name="form1" method="post" action="EditAcc.php" enctype="multipart/form-data">
<table width="81%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC" style="border:0px solid gray">
<tr bgcolor="#CCCCFF" >
<td height="25" colspan="3" bgcolor="#FFFFFF"><font size="2" face="Tahoma"><img src="../picture/previous.gif" onclick="window.history.back()" width="85" height="22" border="0" /></font></td>
</tr>
<tr bgcolor="#CCCCFF" >
<td height="25" colspan="3" bgcolor="#FFFFFF"><div align="center"><font color="#000000" face="Tahoma"><strong><span class="style1"><font color="#FF0000">แก้ไข</font> ข้อมูล</span></strong></font></div></td>
</tr>
<tr bgcolor="#EEEEEE">
<td width="26%" height="20" bgcolor="#FFFFFF"><div align="center"><font size="2" face="Tahoma">รหัส</font></div></td>
<td width="1%" bgcolor="#FFFFFF"><span class="style1"></span></td>
<td width="73%" bgcolor="#FFFFFF"><font color="#003366" size="2" face="Tahoma">
<input name="Acc_code" type="text" class="input1" id="Acc_code" value="<? echo $rs[Acc_code]?>" size="30" />
</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td bgcolor="#FFFFFF"><div align="center"><font size="2" face="Tahoma">ชื่ออุปกรณ์/ยี่ห้อ</font></div></td>
<td bgcolor="#FFFFFF"><span class="style1"></span></td>
<td bgcolor="#FFFFFF"><font color="#003366" size="2" face="Tahoma">
<input name="Acc_name" type="text" class="input1" id="Acc_name" value="<? echo $rs[Acc_name]?>" size="50" />
</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td bgcolor="#FFFFFF"><div align="center"><font size="2" face="Tahoma">ชนิด</font></div></td>
<td bgcolor="#FFFFFF"><div align="center" class="style1"><font color="#FF0000" face="Tahoma">*</font></div></td>
<td bgcolor="#FFFFFF"><font color="#003366" size="2" face="Tahoma">
<select name="Acc_type_code" class="input1" id="Acc_type_code">
<?php
$Acc_type_code = $rs[Acc_type_code];
$strSQL3 = "SELECT * FROM accessories_type_tb Where Acc_type_code='$Acc_type_code'";
$result3= mysql_query($strSQL3) or die("Error".mysql_error());
$strSQL4 = "SELECT * FROM accessories_type_tb Order By Acc_type_code";
$result4= mysql_query($strSQL4);
while( $rs3 = mysql_fetch_array($result3))
{
echo"<option value=\"$rs3[Acc_type_code]\"><b>$rs3[Acc_type] - $rs3[Acc_Etype]</b></option>\n";
while( $rs4 = mysql_fetch_array($result4))
{
echo"<option value=\"$rs4[Acc_type_code]\"><b>$rs4[Acc_type] - $rs4[Acc_Etype]</b></option>\n";
}
}
?>
</select>
</font></td>
</tr>
<tr bgcolor="#EEEEEE">
<td height="22" bgcolor="#FFFFFF"><div align="center"><font size="2" face="Tahoma">หน่วยงานที่รับผิดชอบ</font></div></td>
<td bgcolor="#FFFFFF"><span class="style1"></span></td>
<td bgcolor="#FFFFFF"><strong><font color="#003366" size="2" face="Tahoma">
<select name="Faculty_code" id="Faculty_code" class="d">
<?php
$Faculty_code = $rs[Faculty_code];
$strSQL3 = "SELECT * FROM faculty_tb Where Faculty_code='$Faculty_code' ";
$result3 = mysql_query($strSQL3);
$strSQL4 = "SELECT * FROM faculty_tb Order By Faculty_code ";
$result4 = mysql_query($strSQL4);
while( $rs3 = mysql_fetch_array($result3))
{
echo"<option value=\"$rs3[Faculty_code]\" ><b>$rs3[Faculty_name]</b></option>\n";
while( $rs4 = mysql_fetch_array($result4))
{
echo"<option value=\"$rs4[Faculty_code]\" ><b>$rs4[Faculty_name]</b></option>\n";
}
}
?>
</select>
</font></strong></td>
</tr>
<tr bgcolor="#EEEEEE">
<td height="22" bgcolor="#FFFFFF"><div align="center"><font size="2" face="Tahoma">ที่จัดเก็บ</font></div></td>
<td bgcolor="#FFFFFF"><div align="center" class="style1"><font color="#FF0000" face="Tahoma">*</font></div></td>
<td bgcolor="#FFFFFF"><input name="Store" type="text" class="input1" id="Store" value="<? echo $rs[Store]?>" size="50" /> </td>
</tr>
<tr bgcolor="#eeeeee">
<td bgcolor="#FFFFFF"><div align="center"><font size="2" face="Tahoma">บริษัท Contact</font></div></td>
<td bgcolor="#FFFFFF"><span class="style1"></span></td>
<td bgcolor="#FFFFFF"><textarea name="Contact" cols="40" rows="5" id="Contact" class="input1"><? echo $rs[Contact]?></textarea> </td>
</tr>
<tr bgcolor="#EEEEEE">
<td height="22" bgcolor="#FFFFFF"><div align="center"><font size="2" face="Tahoma">ปี
พ.ศ.ที่ซื้อ</font></div></td>
<td bgcolor="#FFFFFF"><span class="style1"></span></td>
<td bgcolor="#FFFFFF"><font color="#000000" size="2" face="Tahoma">วันที่
<select name="mDate" id="mDate" class="select" >
<?php
$Date_buy = $rs[Date_buy];
$yearthai = explode("-",$Date_buy);
$mDate = intval($yearthai[2]);
$mMonth = intval($yearthai[1]);
$mYear = intval($yearthai[0]);
for($i=0;$i<=31;$i++)
{
if( $i == 0)
echo"\n\t<option value=\"$mDate\" selected>$mDate</option>\n ";
else
echo"\n\t<option value=\"$i\">$i</option>\n ";
}
// getDay1to31();
?>
</select>
เดือน
<select name="mMonth" id="mMonth" class="select" >
<?php
$Date_buy = $rs[Date_buy];
$yearthai = explode("-",$Date_buy);
$mDate= intval($yearthai[2]);
$Month = intval($yearthai[1]);
$mYear = intval($yearthai[0]);
$mMonth = $Month;
$CMonth = TxtThaiMonth($Month);
for($i=-1;$i<=11;$i++)
{
$a = $i+1;
if( $a == 0)
echo"\n\t<option value=\"$mMonth\" selected>$CMonth</option>\n ";
else
echo"\n\t<option value=\"$a\">$ThaiMonth[$i]</option>\n ";
}
// getThaiMonth();
?>
</select>
ปี พ.ศ.
<input name="mYear" type="text" class="input" id="mYear" value="<? echo $mYear ?>" size="10" />
</font></td>
</tr>
<tr bgcolor="#EEEEEE">
<td height="22" bgcolor="#FFFFFF"><div align="center"><font size="2" face="Tahoma">ราคา</font></div></td>
<td bgcolor="#FFFFFF"><span class="style1"></span></td>
<td bgcolor="#FFFFFF"><input name="Price" type="text" class="input1" id="Price" value="<? echo $rs[Price]?>" size="20" />
<font size="2" face="Tahoma">บาท</font></td>
</tr>
<tr bgcolor="#eeeeee">
<td bgcolor="#FFFFFF"><div align="center"><font size="2" face="Tahoma">ประวัติการซ่อม</font></div></td>
<td bgcolor="#FFFFFF"><span class="style1"></span></td>
<td bgcolor="#FFFFFF"><font size="2" face="Tahoma">
<textarea name="Fix_History" cols="40" rows="5" class="input1" id="Fix_History"><? echo $rs[Fix_History]?></textarea>
</font></td>
</tr>
<tr bgcolor="#EEEEEE">
<td height="22" bgcolor="#FFFFFF"><div align="center"><font size="2" face="Tahoma">งบประมาณการซ่อมแซม</font></div></td>
<td bgcolor="#FFFFFF"><span class="style1"></span></td>
<td bgcolor="#FFFFFF"><input name="Fix_budget" type="text" class="input1" id="Fix_budget" value="<? echo $rs[Fix_budget]?>" size="20" />
<font size="2" face="Tahoma"> บาท</font></td>
</tr>
<tr bgcolor="#EEEEEE">
<td bgcolor="#FFFFFF"><div align="center"><font size="2" face="Tahoma"> สถานะการใช้งาน</font></div></td>
<td bgcolor="#FFFFFF"><span class="style1"><font color="#FF0000" face="Tahoma">*</font></span></td>
<td bgcolor="#FFFFFF"><font size="2" face="Tahoma">
<input type="radio" name="Status" <?php if (!(strcmp("$rs[Status]","ใช้งาน"))){echo "checked";} ?> value="ใช้งาน" />
ใช้งาน
<input type="radio" name="Status" <?php if (!(strcmp("$rs[Status]","ว่าง"))){echo "checked";} ?> value="ว่าง" />
ว่าง
<input type="radio" name="Status" <?php if (!(strcmp("$rs[Status]","ชำรุด"))){echo "checked";} ?> value="ชำรุด" />
ชำรุด
<input type="radio" name="Status" <?php if (!(strcmp("$rs[Status]","จำหน่ายออก"))){echo "checked";} ?> value="จำหน่ายออก" />
จำหน่ายออก </font></td>
</tr>
<tr bgcolor="#EEEEEE">
<td bgcolor="#FFFFFF"><div align="center"><font size="2" face="Tahoma">สถิติการใช้งาน</font> </div></td>
<td bgcolor="#FFFFFF"><span class="style1"></span></td>
<td bgcolor="#FFFFFF"><textarea name="Statistic" cols="40" id="Statistic" class="input1"><? echo $rs[Statistic]?></textarea></td>
</tr>
<tr bgcolor="#EEEEEE">
<td bgcolor="#FFFFFF"><div align="center"><font size="2" face="Tahoma">บันทึกซ่วยจำ</font></div></td>
<td bgcolor="#FFFFFF"><span class="style1"></span></td>
<td bgcolor="#FFFFFF"><textarea name="Description" cols="50" rows="5" id="Description" class="input1"><? echo $rs[Description]?></textarea></td>
</tr>
<tr bordercolor="#99CCFF">
<td bgcolor="#FFFFFF"><div align="center"><font size="2" face="Tahoma">รูปภาพ</font></div></td>
<td bgcolor="#FFFFFF"><span class="style1"></span></td>
<td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="73%"><div align="center">
<input name="Img1" type="file" id="Img1" onchange="browse()" />
</div></td>
<td width="27%"><div align="center"><img src=" " name="Imag1" width="100" height="100" id="Imag1" /></div></td>
</tr>
</table></td>
</tr>
<tr bgcolor="#CCCCFF" >
<td height="25" colspan="3" bgcolor="#FFFFFF"><div align="center">
<input name="code" type="hidden" id="code" value="<? echo $rs[code]?>" />
<input type="submit" name="Submit" value=" บันทึก " class="button" />
</div></td>
</tr>
</table>
</form>
</div>
</label>
</fieldset><br>
<font color="<?php echo $GLOBALS["COLOR_FONT_3"];?>" size="2"><b>หมายเหตุ :</b> ใช้เมาส์คลิกที่</font></td>
</tr>
</table>
<?php
}
else
{
echo"<body bgcolor=\"#CCCCCC\">";
echo"<meta http-equiv=\"refresh\" content=\"3;URL=../logout.php\" target=\"mainFrame\">\n";
echo"<center>";
echo"<br><br><br><b><font face=\"Tahoma\" size=\"4\" color=\"#FF0000\">Please Login</font> </b><br>";
echo"<br><br><font face=\"Tahoma\" size=\"10\" color=\"#000000\"> ERROR 404 PERMISION DENY</font><br>";
echo"<br><font face=\"Tahoma\" size=\"4\" color=\"#000000\"> คุณไม่มสิทธ์ใช้งาน</font>";
echo"</center>";
echo"</body>";
}
?>
|