<?php include("connect2.php"); include("connect1.php"); session_start(); if($_SESSION["Username"] == "" ) { echo"<meta http-equiv='refresh' content='0;URL=login.php'>"; } else if ($_SESSION["level"] !="1" and $_SESSION["level"] !="0") { echo"<script> alert('คุณไม่มีสิทธิ์ใช้งานหน้านี้');</script>"; echo "<meta http-equiv='refresh' content='0;URL=index.php'>"; } $regdate2 = date("Y-m-d"); $strSQL = "SELECT * FROM sskhdata.product"; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $Num_Rows = mysql_num_rows($objQuery); $objQuery = mysql_query($strSQL); ?> <table width="1021" border="1" cellpadding="1" cellspacing="1"> <tr> <th width="70"> <div align="center">รหัสยา</div></th> <th width="416"> <div align="center">ชื่อยา </div></th> <th width="111"> <div align="center">จำนวนที่จะเบิก </div></th> <th width="60"> <div align="center">ราคา</div></th> <th width="65"> <div align="center">ราคารวม</div></th> <th width="91"> <div align="center">วันที่เบิก </div></th> <th width="137"> <div align="center">ผู้เบิก </div></th> </tr> <? $i=0; while($objResult = mysql_fetch_array($objQuery)) { ?> <tr> <td><div align="center"><?=$objResult["id"];?></div></td> <td><?=$objResult["name"];?></td> <td> <label> <input name="bamount[$i]" type="text" id="bamount[$i]" onkeypress="numonly();code(this)" onchange="sum()" size="12"/> </label> </td> <? $str="select hos.itemlist.UnitPrice from hos.itemlist where hos.itemlist.ItemCode = '".$objResult["id"]."'"; $a=mysql_query($str); while($objResult1 = mysql_fetch_array($a)) { $b[$i]=$objResult1["UnitPrice"]; } ?> <td><div align="center"> <input name="cost[$i]" type="text" id="cost[$i]" value="<?=$b[$i]?>" size="10" readonly="readonly" /> </div></td> <td><div align="center"> <input name="bcost[$i]" type="text" id="bcost[$i]" size="10" readonly="readonly" /> </div></td> <td align="center"><?=$regdate2?></td> <? $a="SELECT sskhdata.member.name from sskhdata.member where sskhdata.member.user='".$_SESSION["Username"]."'"; $d=mysql_query($a); while($objResult = mysql_fetch_array($d)) { $c[]=$objResult["name"]; } ?> <td align="center"><?=$c[0]?></td> </tr> <? $i++; } ?> <tr> <td colspan="5">รวม:</td> <td colspan="6"></td> </tr> </table> <br> <? mysql_close($objConnect); ?>
จำนวนที่เบิก <input name="bamount[<?=$i;?>]" type="text" id="bamount[<?=$i;?>]" onkeypress="numonly();code(this)" onkeyup="cal_price('bamount[<?=$i;?>]','cost[<?=$i;?>]','bcost[<?=$i;?>]')" size="12"/> ราคา <input name="cost[<?=$i;?>]" type="text" id="cost[<?=$i;?>]" value="<?=$b[$i]?>" size="10" readonly="readonly" /> ราคารวม <input name="bcost[<?=$i;?>]" type="text" id="bcost[<?=$i;?>]" size="10" readonly="readonly" />
<script language='javascript'> function cal(obj_price,obj_total){ document.getElementById(obj_total).value=parseFloat(document.getElementById(obj_total).value+document.getElementById(obj_price).value); } </script>
<td> <label> <input name="bamount[<?=$i;?>]" type="text" id="bamount[<?=$i;?>]" onkeypress="numonly();code(this)" onkeyup="cal_price('bamount[<?=$i;?>]','cost[<?=$i;?>]','bcost[<?=$i;?>]')" onchange="cal('bcost[<?=$i;?>]','total')" size="12"/> </label> </td> <td colspan="5"><div align="right">รวม<input name="total" type="text" id="total" size="10" readonly="readonly" /></div></td>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง