Viewing file: AddPlanIn.php (19.21 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
session_start();
/** Define Validate Access */
define( '_VALID_ACCESS', 1 );
/** Check Session User Login */
if( !session_is_registered("valid_user") && !session_is_registered("Priority") ) {
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-874\" />";
echo "<p style=padding-top:115px><p align=center><br /><font color=red><strong>กรุณาทำการ Login ก่อน</strong></font></p></p>";
echo "<meta http-equiv=\"refresh\" content=\"1; URL=../login.php\" />";
exit();
}
else {
/** Configuration */
require_once( "../configuration.php" );
require_once( $_Config_absolute_path . "/includes/framework.php" );
require_once( "../includes/Function.php" );
/** Create Database Object */
$dbObj = new DBConn;
$Username = $valid_user;
/** Config Table for This Page */
$myTable = "project_type_tb";
$myTable2 = "faculty_tb";
//$Budget_use = $_REQUEST['Budget_use'];
//echo $Budget_use;
//=== salary_repot_tb
$query = " SELECT * FROM $myTable WHERE ProjectId='$ProjectId' AND Faculty_code='$Faculty_code' AND Budget_Year='$Budget_Year' ";
$result = $dbObj->execQuery($query);
$rs = $dbObj->fetchArray($result);
$db_Budget_use = $rs['Budget_use'];
} # else
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<link href="../css/default.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="../js/utilities.js"></script>
<script type="text/javascript" src="../js/ajaxScript.js"></script>
<script language="javascript">
function checkData() {
var formObj = document.myForm;
if( ( formObj.Training_name.value == "" ) && ( formObj.Ind.value == "" ) && ( formObj.Date_start.value == "" ) && ( formObj.Budget_use.value == "" ) ) { alert("กรุณากรอกข้อมูลให้ครบด้วยค่ะ" ); formObj.Training_name.style.backgroundColor='#F1F9FC'; formObj.Training_name.focus(); return false; }
else if( formObj.Date_start.value == "" ) { alert("กรุณากรอก วัน/เดือน/ปี ที่ดำเนินการ"); formObj.Date_start.style.backgroundColor='#F1F9FC'; formObj.Date_start.focus(); return false; }
else if( formObj.Budget_use.value == "" ) { alert("กรุณากรอก จำนวนเงินที่ใช้"); formObj.Budget_use.style.backgroundColor='#F1F9FC'; formObj.Budget_use.focus(); return false; }
else if( formObj.Training_name.value == "" ) { alert("กรุณากรอก รายละเอียดของแผนดำเนินการ"); formObj.Training_name.style.backgroundColor='#F1F9FC'; formObj.Training_name.focus(); return false; }
else return true ;
}
</script>
<script language="JavaScript">
var HttPRequest = false;
function doCallAjax() {
HttPRequest = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
HttPRequest = new XMLHttpRequest();
if (HttPRequest.overrideMimeType) {
HttPRequest.overrideMimeType('text/html');
}
} else if (window.ActiveXObject) { // IE
try {
HttPRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
HttPRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!HttPRequest) {
alert('Cannot create XMLHTTP instance');
return false;
}
var url = 'AjaxAddPlanIn2.php';
//var pmeters = 'Budget_use='+document.getElementById("Budget_use").value;
var pmeters = 'Budget_use='+document.getElementById("Budget_use").value+'&ProjectId=<?=$ProjectId;?>&Faculty_code=<?=$Faculty_code;?>&Budget_Year=<?=$Budget_Year;?>'; // 2 Parameters
HttPRequest.open('POST',url,true);
HttPRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
HttPRequest.setRequestHeader("Content-length", pmeters.length);
HttPRequest.setRequestHeader("Connection", "close");
HttPRequest.send(pmeters);
HttPRequest.onreadystatechange = function()
{
if(HttPRequest.readyState == 3) // Loading Request
{
document.getElementById("mySpan").innerHTML = "Now is Loading...";
}
if(HttPRequest.readyState == 4) // Return Request
{
document.getElementById("mySpan").innerHTML = HttPRequest.responseText;
}
}
/*
HttPRequest.onreadystatechange = call function .... // Call other function
*/
}
</script>
<title>ข้อมูลแผนดำเนินงานและรายงาน : ข้อมูลแผนดำเนินการ รายปีงบประมาณ - เพิ่มข้อมูลแผน/โครงการรดำเนินงาน (ย่อย)</title>
<style type="text/css">
<!--
.style11 {font-size: 14px; color: #000000; }
.style7 {font-size: 14px}
-->
</style>
</head>
<body topmargin="0" rightmargin="0" bottommargin="0" leftmargin="0">
<?php
include("../templates/incHeader.php");
?>
<table width="1003" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="203" align="left" valign="top" style="padding:10px 0px 0px 5px"><?php include("./_incMainMenu.php");?></td>
<td width="800" align="center" valign="top" style="padding:10px 0px 5px 10px"><fieldset><table width="780" border="0" cellspacing="0" cellpadding="0">
<form id="myForm" name="myForm" method="post" action="InsertPlaningIn.php" onSubmit="return checkData();">
<tr>
<td height="5"></td>
</tr>
<tr>
<td height="30" background="../images/background/bg-head-topic-w780.gif" class="PADDING-LEFT-10"><strong><a href="index.php">หน้าหลัก</a></strong> <strong>» <a href="DetailRepPlaning.php?ProjectId=<?php echo $rs['ProjectId']; ?>&Orderlist=<?php echo $rs['Orderlist']; ?>&Project_code=<?php echo $rs['Project_code']; ?>&Faculty_code=<?=$rs['Faculty_code'];?>&Budget_Year=<?php echo $rs['Budget_Year']; ?>">รายงานการใช้เงินตามปฏิบัติการ</a> » <span class="NOTE">เพิ่มการใช้เงินตามแผนปฏิบัติการ</span></strong></td>
</tr>
<tr>
<td><table width="89%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="PADDING-TOP-10 PADDING-BOTTOM-10"><img src="../images/icons/arrow-circle-225-left.png" width="16" height="16" border="0" align="absmiddle" /> <a href="javascript:;" onclick="window.history.back();"><strong>‹ ย้อนกลับ</strong></a></td>
<td align="right" valign="bottom" class="PADDING-TOP-10 PADDING-BOTTOM-5"> </td>
</tr>
<tr>
<td width="50%" height="26" > </td>
<td width="50%" align="right" valign="bottom" class="PADDING-TOP-10 "> </td>
</tr>
</table></td>
</tr>
<tr>
<td height="350" align="center" valign="top"><table width="92%" border="0" align="center" cellpadding="0" cellspacing="0" style="border:1px solid #F0F0F0">
<tr>
<td width="17%" height="25" align="center">รหัสหน่วยงาน</td>
<td width="1%"> </td>
<td width="82%" class="TEXT-DARK-BLUE10"><?php
$Faculty_code = $rs['Faculty_code'];
$query = " SELECT * FROM faculty_tb WHERE Faculty_code='$Faculty_code' ";
$result1 = $dbObj->execQuery($query);
$rs1 = $dbObj->fetchArray($result1);
echo "$rs1[Faculty_code] - $rs1[Faculty_name]";
?></td>
</tr>
<tr>
<td height="25" align="center">รหัสแผน</td>
<td> </td>
<td class="TEXT-DARK-BLUE10"><?php echo $rs['Orderlist']; ?></td>
</tr>
<tr>
<td height="25" align="center">ชื่อโครงการ/กิจกรรม</td>
<td> </td>
<td class="TEXT-DARK-BLUE10"><?php echo htmlspecialchars_decode( nl2br( $rs['Project_plan'] ) ); ?></td>
</tr>
<tr>
<td height="25" align="center">วัตถุประสงค์</td>
<td> </td>
<td class="TEXT-DARK-BLUE10"><?php echo htmlspecialchars_decode( nl2br( $rs['Orderlist_2'] ) ); ?></td>
</tr>
<tr>
<td align="center" valign="top" style="padding-top:3px;"><span class="TEXT-RED10"><sup>*</sup></span> รายละเอียดของ<br />
แผนดำเนินการ</td>
<td> </td>
<td style="padding-top:5px;"><label>
<textarea name="Training_name" id="Training_name" cols="60" rows="3"></textarea>
</label></td>
</tr>
<tr>
<td align="center">หมวดเงิน</td>
<td align="center"> </td>
<td height="25" align="left"><select name="MoneyS_C" id="MoneyS_C">
<?php
$MoneyS_C = $rs['MoneyS_C'];
$strSQL3 = " SELECT * FROM money_source_tb WHERE MoneyS_C='$MoneyS_C' ";
$result3 = $dbObj->execQuery($strSQL3);
while( $rs3 = $dbObj->fetchArray($result3) ) {
echo "<option value=\"$rs3[MoneyS_C]\">$rs3[MoneyS_M]</option>\n";
}
?>
</select></td>
</tr>
<tr>
<td align="center">ประเภทหมวดค่าใช้จ่าย</td>
<td align="center"> </td>
<td height="25" align="left"><select name="MoneyId" id="MoneyId">
<?php
$strSQL5 = " SELECT * FROM money_tb ";
$result5 = $dbObj->execQuery($strSQL5);
while( $rs5 = $dbObj->fetchArray($result5) ) {
echo "<option value=\"$rs5[MoneyId]\" ><b>$rs5[MoneyName]</b></option>\n";
}
?>
</select></td>
</tr>
<tr>
<td align="center">วันที่ดำเนินการ</td>
<td align="center"> </td>
<td height="25" align="left">วันเริ่มต้น <span class="TEXT-DARK-BLUE10"><?php echo $rs['Date_start']; ?></span> วันสิ้นสุด <span class="TEXT-DARK-BLUE10"><?php echo $rs['Date_finish']; ?></span></td>
</tr>
<tr>
<td align="center">ปีงบประมาณ</td>
<td align="center"> </td>
<td height="25" align="left" class="TEXT-DARK-BLUE10"><?php echo $rs['Budget_Year']; ?></td>
</tr>
<tr>
<td height="18" colspan="3" align="left"><span style="padding-top:13px"> จำนวนเงินที่ตั้ง
งบประมาณรายเดือน</span></td>
</tr>
<tr>
<td height="25" colspan="3" align="right" valign="top" style="padding-top:13px"><table width="85%" border="0" align="center" cellpadding="1" cellspacing="1">
<tr bgcolor="#F8F8F8">
<td width="16%" align="right" bgcolor="#FFFFFF"><a>มกราคม</a> </td>
<td width="13%" align="left" bgcolor="#FFFFFF" class="PADDING-LEFT-10 TEXT-DARK-BLUE10"><a><?php echo number_format( $rs['January'],2,'.',',' ); ?></a></td>
<td width="12%" align="right" bgcolor="#FFFFFF"><a>กรฏาคม</a></td>
<td width="59%" align="left" bgcolor="#FFFFFF" class="PADDING-LEFT-10 TEXT-DARK-BLUE10"><a><?php echo $rs['July']; ?></a></td>
</tr>
<tr bgcolor="#F8F8F8">
<td align="right" bgcolor="#FFFFFF"><a>กุมภาพันธ์</a> </td>
<td align="left" bgcolor="#FFFFFF" class="PADDING-LEFT-10 TEXT-DARK-BLUE10"><a><?php echo $rs['February']; ?></a></td>
<td align="right" bgcolor="#FFFFFF"><a>สิงหาคม</a></td>
<td align="left" bgcolor="#FFFFFF" class="PADDING-LEFT-10 TEXT-DARK-BLUE10"><a><?php echo $rs['Augus']; ?></a></td>
</tr>
<tr bgcolor="#F8F8F8">
<td align="right" bgcolor="#FFFFFF"><a>มีนาคม</a></td>
<td align="left" bgcolor="#FFFFFF" class="PADDING-LEFT-10 TEXT-DARK-BLUE10"><a><?php echo $rs['March']; ?></a></td>
<td align="right" bgcolor="#FFFFFF"><a>กันยายน</a></td>
<td align="left" bgcolor="#FFFFFF" class="PADDING-LEFT-10 TEXT-DARK-BLUE10"><a><?php echo $rs['September']; ?></a></td>
</tr>
<tr bgcolor="#F8F8F8">
<td align="right" bgcolor="#FFFFFF"><a>เมษายน</a></td>
<td align="left" bgcolor="#FFFFFF" class="PADDING-LEFT-10 TEXT-DARK-BLUE10"><a><?php echo $rs['April']; ?></a></td>
<td align="right" bgcolor="#FFFFFF"><a>ตุลาคม</a></td>
<td align="left" bgcolor="#FFFFFF" class="PADDING-LEFT-10 TEXT-DARK-BLUE10"><a><?php echo $rs['October']; ?></a></td>
</tr>
<tr bgcolor="#F8F8F8">
<td align="right" bgcolor="#FFFFFF"><a>พฤษภาคม</a></td>
<td align="left" bgcolor="#FFFFFF" class="PADDING-LEFT-10 TEXT-DARK-BLUE10"><a><?php echo $rs['May']; ?></a></td>
<td align="right" bgcolor="#FFFFFF"><a>พฤศจิกายน</strong></td>
<td align="left" bgcolor="#FFFFFF" class="PADDING-LEFT-10 TEXT-DARK-BLUE10"><a><?php echo $rs['November']; ?></a></td>
</tr>
<tr bgcolor="#F8F8F8">
<td align="right" bgcolor="#FFFFFF"><a>มิถุนายน</a></td>
<td align="left" bgcolor="#FFFFFF" class="PADDING-LEFT-10 TEXT-DARK-BLUE10"><a><?php echo $rs['June']; ?></a></td>
<td align="right" bgcolor="#FFFFFF"><a>ธันวาคม</a></td>
<td align="left" bgcolor="#FFFFFF" class="PADDING-LEFT-10 TEXT-DARK-BLUE10"><a><?php echo $rs['December']; ?></a></td>
</tr>
</table>
<table width="85%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="25" align="left" style="padding-left:103px"><font face="Tahoma">จำนวนเงินทั้งหมดที่ใช้ตามแผน</font>
<input name="Budget_use4" type="text" id="Budget_use4" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed" value="<?php
$sql = " SELECT SUM(Budget_use) AS SumB1 FROM project_tb WHERE ProjectId='$rs[ProjectId]' " ;
$result11 = mysql_query($sql);
$rs11 = mysql_fetch_array($result11);
echo number_format($rs11['SumB1'],2,'.',','); ?> " size="10" />บาท</font></td>
</tr>
<tr>
<td height="25" align="left" style="padding-left:103px"><font face="Tahoma">จำนวนเงินทั้งหมดที่ตั้งไว้ตามแผน</font>
<input name="Budget_total" type="text" id="Budget_total" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed" value="<?php
$sql = " SELECT * FROM project_type_tb WHERE ProjectId='$rs[ProjectId]' " ;
$result22 = mysql_query($sql);
$rs22 = mysql_fetch_array($result22);
echo number_format($rs22['Budget_total'],2,'.',',');
?> " size="10" />บาท </font></td>
</tr>
<tr>
<td height="25" align="left" style="padding-left:103px"><font face="Tahoma">คงเหลือเงินทั้งหมดตามแผน</font>
<input name="Budget_use3" type="text" id="Budget_use3" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: black 1px dashed" value="<?
$Sum3 = $rs22['Budget_total'] - $rs11['SumB1'] ;
echo number_format($Sum3,2,'.',','); ?> " size="10" />
บาท </font></font></td>
</tr>
</table></td>
</tr>
<tr>
<td align="right"> </td>
<td align="center"> </td>
<td height="25" align="left"> </td>
</tr>
<tr>
<td align="right">ผู้ใช้เงิน</td>
<td align="center"> </td>
<td height="25" align="left"><span style="padding-top:15px;">
<select name="Teacher_code" id="Teacher_code">
<option value=""></option>
<?php
$sql1 = " SELECT * FROM personal_tb WHERE StatusId='1' ORDER BY Teacher_name ASC ";
$result1 = mysql_query($sql1);
while( $rs1 = mysql_fetch_array($result1) ) {
?>
<option value="<?=$rs1['Teacher_code'];?>" <?php if( $rs1['Teacher_code']==$rs['Teacher_code'] ) echo 'selected';?>>
<?=$rs1['First_name'];?>
<?=$rs1['Teacher_name'];?>
<?=$rs1['Teacher_lastname'];?>
</option>
<?php
} # while
mysql_free_result($result1);
?>
</select>
</span></td>
</tr>
<tr>
<td align="right"><span class="TEXT-RED10"><sup>*</sup></span> วัน/เดือน/ปี<br />
(ที่ดำเนินการ)</td>
<td align="center"> </td>
<td height="25" align="left"><input name="Date" type="text" id="Date" size="10" style="text-align:center" />
<script type="text/javascript" src="../includes/popcalendar.js"></script>
<script language='JavaScript'>
if (!document.layers) {
document.write("<img src='../images/ew_calendar.gif' width='16' height='15' style='cursor:hand;' onclick='popUpCalendar(this, myForm.Date, \"yyyy-mm-dd\")'>")
}
</script> <span class="TEXT-ORANGE9"><-- คลิ๊กที่นี่</span></td>
</tr>
<tr>
<td align="right"><span class="TEXT-RED10"><sup>*</sup></span> จำนวนเงินที่ใช้</td>
<td align="center"> </td>
<td height="25" align="left"><input name="Budget_use" type="text" id="Budget_use" size="8" style="text-align:center" onkeypress="return checkNumeric();" onkeyup="checkBudget()"/> บาท<span id="budgetOver"></span></td>
</tr>
<tr>
<td align="center"> </td>
<td align="center"> </td>
<td height="25" align="left"> </td>
</tr>
<tr>
<td height="29" align="center"> </td>
<td height="29" align="center"> </td>
<td height="29" align="left"><input name="ProjectId" type="hidden" id="ProjectId" value="<?php echo $rs['ProjectId']; ?>" />
<input name="Project_code" type="hidden" id="Project_code" value="<?php echo $rs['Project_code']; ?>" />
<input name="Faculty_code" type="hidden" id="Faculty_code" value="<?php echo $rs['Faculty_code']; ?>" />
<input name="Orderlist" type="hidden" id="Orderlist" value="<?php echo $rs['Orderlist']; ?>" />
<input name="Project_plan" type="hidden" id="Project_plan" value="<? echo $rs['Project_plan']; ?>" />
<input name="Budget_Year" type="hidden" id="Budget_Year" value="<? echo $rs['Budget_Year']; ?>" />
<span id="submitBtn"><input name="Submit" type="submit" class="WIDTH60 CURSOR-HAND" value="บันทึก" disabled/></span>
<input name="Reset" type="reset" class="WIDTH60 CURSOR-HAND" value="รีเซ็ต" onclick="checkBudgetReset()"/>
<input name="Button" type="button" value="ยกเลิก" class="WIDTH60 CURSOR-HAND" onclick="location.href='EditPlaningList.php?Budget_Year=<?=$Budget_Year;?>&Faculty_code=<?=$Faculty_code;?>&Project_code=<?=$rs["Project_code"];?>'" /></td>
</tr>
<tr>
<td align="center"> </td>
<td align="center"> </td>
<td align="left"> </td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
</tr></form>
</table>
</fieldset></td>
</tr>
</table>
<?php include("../templates/incFooter.php"); ?>
</body>
</html>
<?php
/** Free Resource */
$dbObj->freeresult($result);
/** Close the Database */
$dbObj->disconn();
/** Unset Class */
unset($dbObj);
?>
|