|
|
|
script ไม่ทำงาน...ของผม script คำนวณมันไม่ทำงานอ่ะคับ ต้องไปแก้ตงไหนรึเปล่าคับ เป็น script ที่เอาไว้คำนวณเลขครับ |
|
|
|
|
|
|
|
Code (PHP)
<?
session_start();
include("config/connect.php");
//if($_SESSION["u_id"]==""){ echo "<meta http-equiv='refresh' content='0; url=index.php' > "; }
$y=date(Y);
$m=date(m);
$d=date(d);
$str_bui="SELECT * FROM plan_building INNER JOIN plan_periodwork ON (plan_building.bui_id=plan_periodwork.bui_id) WHERE plan_periodwork.period_id='$_GET[per_id]'";
$rs_bui=mysql_query($str_bui);
$arr_bui=mysql_fetch_array($rs_bui);
//echo $str_bui;
$start3_data=explode("-",$arr_bui["per_start"]);
$y3=$start3_data[0]+543;
$m3=$start3_data[1];
$d3=$start3_data[2];
$start2=$d3."/".$m3."/".$y3;
$start4_data=explode("-",$arr_bui["per_final"]);
$y4=$start4_data[0]+543;
$m4=$start4_data[1];
$d4=$start4_data[2];
$finish2=$d4."/".$m4."/".$y4;
?>
<?php
$str="SELECT * FROM plan_building WHERE bui_id=$_GET[bui] ";
$rs=mysql_query($str);
while($arr=mysql_fetch_array($rs)){
$str_n="SELECT MAX(per_number) FROM plan_periodplan WHERE bui_id='$arr[bui_id]' ";
$rs_n=mysql_query($str_n);
$num_s=mysql_fetch_array($rs_n);
//echo $str_n;
?>
<?php
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type='text/javascript'>
function checkNumber(data){
if(!data.value.match(/^\d*$/)){
alert('กรอกตัวเลขเท่านั้น');
data.value='';
}
}
</script>
<script type="text/javascript" src="script/jscalendar/calendar.js"></script>
<!-- language for the calendar -->
<script type="text/javascript" src="script/jscalendar/lang/calendar-th.js"></script>
<!-- the following script defines the Calendar.setup helper function, which makes
adding a calendar a matter of 1 or 2 lines of code. -->
<script type="text/javascript" src="script/jscalendar/calendar-setup.js"></script>
<!-- edit mask-->
<script type="text/javascript" src="script/editmark.js"></script>
<link href="bc.css" rel="stylesheet" type="text/css" />
<link href="script/jscalendar/calendar-blue.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>Untitled Document</title>
</head>
<body>
<script language="javascript">
function fncSum()
{
var tot = 0;
var sum = 0;
for(i=1;i<=document.form1.hdnLine.value;i++)
{
tot = parseInt(eval("document.form1.Vol1_"+i+".value")) * parseFloat(eval("document.form1.per_percentage_"+i+".value")) / 100
eval("document.form1.per_cost_"+i+".value="+tot);
sum = tot * sum;
document.form1.txtSum.value=sum;
}
}
</script>
<form id="form1" name="form1" method="post" action="tag_period_update_process.php">
<table width="800" border="0" align="center" class="">
<tr>
<td bgcolor="#FFFFCC"></td>
</tr>
<tr>
<td align="center"><table width="800" border="0" align="center" class="calendar">
<tr>
<td height="38" colspan="3" align="center" bgcolor="#FFFFCC"><h6><strong class="VIEWSTATE">ข้อมูลงวดงาน</strong></h6></td>
</tr>
<tr>
<td width="19%" height="29"><strong>1.ชื่ออาคาร</strong></td>
<td width="3%" align="center">:</td>
<td width="78%" align="left"><input name="bui_name" type="text" id="bui_name" size="70" value="<? echo $arr_bui["bui_name"];?>" disabled="disabled" />
<input name="per" type="hidden" id="per" value="<? echo $_GET[per_id]; ?>" /></td>
</tr>
<tr>
<td height="32" bgcolor="#FFFFCC"><strong>2.งวดงานที่</strong></td>
<td align="center" bgcolor="#FFFFCC">:</td>
<td align="left" bgcolor="#FFFFCC"><input name="textfield2" type="text" id="textfield2" size="5" maxlength="5" value="<? echo $arr_bui["per_number"]; ?>" disabled="disabled" /></td>
</tr>
<tr>
<td align="right" bgcolor="#EEEEFF"><strong>จำนวนเงิน</strong></td>
<td align="center" bgcolor="#EEEEFF">:</td>
<td align="left" bgcolor="#EEEEFF"><label for="yy1"></label>
<strong>
<?
$str="SELECT * FROM plan_building WHERE bui_id=$_GET[bui] ";
$rs=mysql_query($str);
while($arr=mysql_fetch_array($rs)){
$str_n="SELECT MAX(per_number) FROM plan_periodplan WHERE bui_id='$arr[bui_id]' ";
$rs_n=mysql_query($str_n);
$num_s=mysql_fetch_array($rs_n);
//echo $str_n;
?>
<input name="Vol1_1" id="Vol1_1" type="text" value=" <? echo number_format($arr[bui_cost],2,".",",");?>" readonly onClick=""="fncSum()" onKeyUp="if(this.value*1!=this.value) this.value='' ;">
<?php
}
?>
<input name="cost" type="text" id="code3" size="40" value="<? echo $arr_bui["per_cost_1"]; ?>" onkeyup="checkNumber(this)" />
บาท
<select name="bud_id" id="bud_id">
<? if($arr_bui["bud_id"]=="0"){ ?><option value="0" selected="selected">กรุณาเลือกงบประมาณ</option><? }else{ ?><option value="0" >กรุณาเลือกงบประมาณ</option><? } ?>
<? if($arr_bui["bud_id"]=="1"){ ?><option value="1" selected="selected">งบประมาณแผ่นดิน</option><? }else{ ?><option value="1">งบประมาณแผ่นดิน</option><? } ?>
<? if($arr_bui["bud_id"]=="2"){ ?> <option value="2" selected="selected">เงินนอกงบประมาณ</option><? }else{ ?><option value="2">เงินนอกงบประมาณ</option><? } ?>
<? if($arr_bui["bud_id"]=="3"){ ?> <option value="3" selected="selected">ผูกพันงบประมาณ</option><? }else{ ?><option value="3">ผูกพันงบประมาณ</option><? } ?>
</select>
<span class="EMAILLINK"><? echo $_GET["x"]; echo $_GET["y"]; ?></span></strong></td>
</tr>
<tr>
<td height="33" align="right" bgcolor="#FFFFCC"><strong>งบประมาณเบิกล่วงหน้า</strong></td>
<td align="center" bgcolor="#FFFFCC">:</td>
<td align="left" bgcolor="#FFFFCC"><input name="per_percentage_1" type="text" id="code3" size="5" value="<? echo $arr_bui[per_percentage_1]; ?>" />%</td>
</tr>
<tr>
<td height="117" align="right" bgcolor="#EEEEFF"><strong>รายละเอียด</strong></td>
<td align="center" bgcolor="#EEEEFF">:</td>
<td align="left" bgcolor="#EEEEFF"><textarea name="note" cols="60" rows="5" id="note"><? echo $arr_bui[per_note]; ?></textarea>
<strong><span class="EMAILLINK"><? echo $_GET["z"]; ?></span></strong></td>
</tr>
<tr>
<td height="33" align="right" bgcolor="#FFFFCC"><strong>เริ่มปฏิบัติงาน</strong></td>
<td align="center" bgcolor="#FFFFCC">:</td>
<td align="left" bgcolor="#FFFFCC"><span class="boxtitle">
<input name="start2" type="text" id="start2" onkeyup="editMaskDateTime('start2','DD/MM/YYYY','')" value="<? echo $start2;?>" size="12" />
<a href="#"><img src="script/jscalendar/calendar.gif" alt="เลือกวันที่" name="bt_start2" width="21" height="21" border="0" align="absmiddle" id="bt_start2" /></a>
<script type="text/javascript">
Calendar.setup({
inputField : "start2", // id of the input field
ifFormat : "%d/%m/%z", // format of the input field (even if hidden, this format will be honored)
displayArea : "show_e", // ID of the span where the date is to be shown
daFormat : "%A, %B %d, %z",// format of the displayed date
button : "bt_start2", // trigger button (well, IMG in our case)
//align : "Tl", // alignment (defaults to "Bl")
singleClick : true
});
</script></span></td>
</tr>
<tr>
<td height="31" align="right" bgcolor="#EEEEFF"><strong>วันที่สิ้นสุด</strong></td>
<td align="center" bgcolor="#EEEEFF">:</td>
<td align="left" bgcolor="#EEEEFF"><span class="boxtitle">
<input name="start3" type="text" id="start3" onkeyup="editMaskDateTime('start3','DD/MM/YYYY','')" value="<? echo $finish2;?>" size="12" />
<a href="#"><img src="script/jscalendar/calendar.gif" alt="เลือกวันที่" name="bt_start3" width="21" height="21" border="0" align="absmiddle" id="bt_start3" /></a>
<script type="text/javascript">
Calendar.setup({
inputField : "start3", // id of the input field
ifFormat : "%d/%m/%z", // format of the input field (even if hidden, this format will be honored)
displayArea : "show_e", // ID of the span where the date is to be shown
daFormat : "%A, %B %d, %z",// format of the displayed date
button : "bt_start3", // trigger button (well, IMG in our case)
//align : "Tl", // alignment (defaults to "Bl")
singleClick : true
});
</script>
</span></td>
</tr>
<tr>
<td height="33" align="right" bgcolor="#FFFFCC"><strong>สถานะการดำเนินงาน</strong></td>
<td align="center" bgcolor="#FFFFCC">:</td>
<td align="left" bgcolor="#FFFFCC"><select name="percen" id="percen">
<? if($arr_bui[per_percen]=="0"){?><option value="0" selected="selected">0</option><? }else{ ?><option value="0">0</option><? }?>
<? if($arr_bui[per_percen]=="10"){?><option value="10" selected="selected">10</option><? }else{ ?><option value="10">10</option><? }?>
<? if($arr_bui[per_percen]=="20"){?><option value="20" selected="selected">20</option><? }else{ ?><option value="20">20</option><? }?>
<? if($arr_bui[per_percen]=="30"){?> <option value="30" selected="selected">30</option><? }else{ ?><option value="30">30</option><? }?>
<? if($arr_bui[per_percen]=="40"){?> <option value="40" selected="selected">40</option><? }else{ ?><option value="40">40</option><? }?>
<? if($arr_bui[per_percen]=="50"){?> <option value="50" selected="selected">50</option><? }else{ ?><option value="50">50</option><? }?>
<? if($arr_bui[per_percen]=="60"){?> <option value="60" selected="selected">60</option><? }else{ ?><option value="60">60</option><? }?>
<? if($arr_bui[per_percen]=="70"){?> <option value="70" selected="selected">70</option><? }else{ ?><option value="70">70</option><? }?>
<? if($arr_bui[perpercen]=="80"){?> <option value="80" selected="selected">80</option><? }else{ ?><option value="80">80</option><? }?>
<? if($arr_bui[per_percen]=="90"){?> <option value="90" selected="selected">90</option><? }else{ ?><option value="90">90</option><? }?>
<? if($arr_bui[per_percen]=="100"){?> <option value="100" selected="selected">100</option><? }else{ ?><option value="100">100</option><? }?>
</select>
%</td>
</tr>
<tr>
<td height="53" align="right" bgcolor="#EEEEFF"><strong>ปัญหา / อุปสรรค</strong></td>
<td align="center" bgcolor="#EEEEFF">:</td>
<td align="left" bgcolor="#EEEEFF"><textarea name="comment" cols="60" id="comment"><? echo $arr_bui[per_comment];?></textarea></td>
</tr>
<tr>
<td height="19" align="right" bgcolor="#EEEEFF"> </td>
<td align="center" bgcolor="#EEEEFF"> </td>
<td align="left" bgcolor="#EEEEFF"> </td>
</tr>
</table></td>
</tr>
<tr>
<td align="center"><input type="submit" name="button" id="button" value="บันทึกข้อมูล" />
</td>
</tr>
</table>
</form>
</body>
</html>
ของผม script คำนวณมันไม่ทำงานอ่ะคับ ต้องไปแก้ตงไหนรึเปล่าคับ เป็น script ที่เอาไว้คำนวณเลขครับ รบกวนผู้รู้ด้วยครับ ขอบคุณครับ
Tag : PHP, MySQL, JavaScript, Action Script
|
ประวัติการแก้ไข 2015-01-19 10:14:22
|
|
|
|
|
Date :
2015-01-19 10:13:51 |
By :
stepartz |
View :
807 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|