|
 |
|
ช่วยดูให้หน่อยครับว่าทำไม onfocus ไม่ไปที่ต้องการ ไม่รู้ว่าจะต้องแก้ไขอย่างไรครับ |
|
 |
|
|
 |
 |
|
Code (PHP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<link href="../fontTahoma.css" rel="stylesheet" type="text/css">
<title>ข้อมูลการรับ - จ่ายยาราคาแพง</title>
<table border="0">
<tr>
<td rowspan="4"><img src="../images/Logo/PCK.jpg" width=60px; height=80px;></td>
<td class="FontSize13B"></td>
</tr>
<tr>
<td class="FontSize11B">การจ่ายยาราคาแพง</td>
<td> </td>
</tr>
</table>
<?php
require_once('../_connections/conHomc.php');
require_once('../_connections/conPG.php');
include('../_function/phpFunction.php');
$ward_id='';
if(isset($_GET['inv_code'])){$inv_code=trim($_GET['inv_code']);}
$qry="SELECT code,gen_name,unit ";
$qry.="FROM Med_inv ";
$qry.="WHERE code='$inv_code' and site='1' ";
//echo $qry;
$rsHomc=mssql_query($qry,$conHomc);
while ($rowHomc = mssql_fetch_array($rsHomc)) {
$gen_name =$rowHomc['gen_name'];
$unit =$rowHomc['unit'];
$newunit=iconv('TIS-620','UTF-8',$unit);
$newname=iconv('TIS-620','UTF-8',$gen_name);
}
$original =date("Ymd");
$timm=date("His");
$qrysm="select * from receive ";
$qrysm.="where inv_code='$inv_code' and status='A' ";
//echo $qrysm;
$rssm=$conPG->Execute($qrysm) or die ($conPG->ErrorMSG());
$re_sm=pg_query($qrysm);
$num=pg_num_rows($re_sm);
if($num!=0){
while(!$rssm->EOF){
$date_receive =$rssm->Fields('date_receive');
$time_receive =$rssm->Fields('time_receive');
$total_amt =$rssm->Fields('total_amt');
$rssm->MoveNext();
}
}
?>
<form name="pay" method="POST" action="save_pay.php">
<table border="1">
<tr>
<td class="FontSize11B">รหัสยา</td>
<td colspan="3" class="FontSize10"><?php echo $inv_code ?></td>
</tr>
<tr>
<td class="FontSize11B">ชื่อยา</td>
<td colspan="3" class="FontSize10"><?php echo $newname ?></td>
</tr>
<tr>
<td class="FontSize11B">หน่วย</td>
<td colspan="3" class="FontSize10"><?php echo $newunit ?></td>
</tr>
<tr>
<td class="FontSize11B">TEST</td>
<td colspan="3" class="FontSize10"><input type="text" name="aaa"></td>
</tr>
<tr>
<td class="FontSize11B" width="160px">เลือกวอร์ดที่จ่ายยา</td>
<td>
<select name="ward_id" id="ward_id" style="width :205px">
<option value="000" selected>---เลือกหอผู้ป่วย---</option>
<?php
$sqll = "SELECT ward_id,ward_name, ward_id + ' ' + ward_name ";
$sqll.=" AS fullward FROM Ward ORDER BY ward_id";
$rsPGG = mssql_query($sqll,$conHomc);
$numc=mssql_num_rows($rsPGG);
//echo $sqll;
for ($i=1;$i<=$numc;$i++)
{
$roww=mssql_fetch_array($rsPGG);
$n_fullward=iconv('TIS-620','UTF-8',$roww['fullward']);
?>
<option value="<?php echo $roww['ward_id']?>"<?php
if (trim($ward_id)==trim($roww['ward_id'])) echo " selected"; ?>><?php
echo $n_fullward?></option>
<?php
}
?>
</select></td>
<td class="FontSize11B">จำนวนที่่จ่าย</td>
<td class="FontSize10"><input type="text" name="pay_ward" onchange="chkamt('sVal')"></td>
</tr>
<tr>
<td class="FontSize11B">จ่ายยาผู้ป่วยในจำนวน</td>
<td colspan="3" class="FontSize10"><input type="text" name="pay_ipd"></td>
</tr>
<tr>
<td class="FontSize11B">จ่ายยาผู้ป่วยนอกจำนวน</td>
<td colspan="3" class="FontSize10"><input type="text" name="pay_opd"></td>
</tr>
<tr>
<td class="FontSize11B">ยอดทั้งหมด</td>
<td colspan="3" class="FontSize10"><input type="text" name="total_amt" value="<?php echo $total_amt; ?>" readonly></td>
</tr>
<tr>
<td class="FontSize11B">หมายเหตุ</td>
<td colspan="3"><input type="text" name="remark_receive"></td>
</tr>
<tr>
<td class="FontSize11B">วันที่ปรับปรุง</td>
<td colspan="3" class="FontSize10"><?php echo iconv('TIS-620','UTF-8',thaidate($original))." เวลา ". date("Hi")." น."?></td>
</tr>
</table>
<table>
<tr>
<td><input type="button" onclick="chkData();" value="บันทึก"><td>
<td><input type="button" onclick="window.history.go(-1);" value="ย้อนกลับ"><td>
</tr>
</table>
</form>
<script language="javascript">
var dForm=self.document.pay;
function chkamt(sVal){
var a1=parseFloat(dForm.pay_ward.value);
var a2=parseFloat(dForm.total_amt.value);
if(a1>a2){
alert('ยอดในสต๊อกไม่พอที่จะจ่าย!!!!');
dForm.pay_ward.value=0;
document.pay.pay_ward.focus();
return false;
}
}
function chkData(){
var myMSG="";
}
</script>
Tag : PHP

|
ประวัติการแก้ไข 2012-02-07 14:05:02
|
 |
 |
 |
 |
Date :
2012-02-07 13:52:05 |
By :
nirut_i |
View :
910 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตรง function chkamt(sVal)
ผมต้องการเช็คว่า ค่าที่กรอกไปใน pay_ward มันมากกว่า total_amt หรือไม่ คือถ้ามากกว่า ก็ให้กรอกใหม่ โดยเคลียค่า pay_ward ให้เป็น 0 แล้วให้เคอเซอร์รอตรง pay_ward แต่มันไม่ได้นะครับ ดูให้หน่อยนะครับ
|
 |
 |
 |
 |
Date :
2012-02-07 13:54:12 |
By :
nirut_i |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|