Viewing file: GrapDura.php (25.13 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/** Define Validate Access */
define( '_VALID_ACCESS', 1 );
/** Configuration */
require_once( "./configuration.php" );
require_once( $_Config_absolute_path . "/includes/framework.php" );
require_once( "./includes/Function.php" );
/** Chart */
include ("./includes/charts.php");
/** Create Database Object */
$dbObj = new DBConn;
/** Config Table for This Page */
$myTable1 = "personal_tb";
$myTable2 = "research_tb";
$param = "&";
/** Query เพื่อหา Numrows ก่อน */
//$query = " SELECT * FROM $myTable2 GROUP BY Year_prop ";
//$result = $dbObj->execQuery($query);
//$numrows = $dbObj->_numrows
?>
<!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="./charts/charts.js"></script>
<title><?=$_Config_sitename;?></title>
</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( "templates/incMainMenuLeft.php" );?></td>
<td width="800" height="440" align="center" valign="top" style="padding:10px 0px 5px 10px"><fieldset>
<table width="780" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="5" colspan="2"></td>
</tr>
<tr>
<td width="575" height="25" background="./images/background/bg-head-topic.gif" class="PADDING-LEFT-10"><strong><a href="index.php">หน้าหลัก</a></strong> <strong>» <a href="AccByname.php">ข้อมูลครุภัณฑ์</a></strong> <strong>» <span class="NOTE">กราฟแสดงข้อมูลครุภัณฑ์</span></strong></td>
<td width="205" style="padding-left:15px;"> </td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><span class="PADDING-TOP-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></span></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2" align="center"> </td>
</tr>
<tr>
<td colspan="2" align="center">
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" height="64" align="center" style="padding-bottom:5px;"><form id="form1" name="form1" method="post" action="<?=$PHP_SELF;?>">
<label for="setdata">มิติในการดูกราฟแสดงผล</label>
<select name="setdata" id="setdata">
<option value="0">เลือกมิติในการดูข้อมูล</option>
<option value="A">จำนวนครุภัณฑ์ที่ใช้งานอยู่จำแนกตามประเภท</option>
<option value="B">จำนวนการแจ้งซ่อมแยกตามประเภทครุภัณฑ์</option>
<option value="C">จำนวนประเภทการแจ้งซ่อมครุภัณฑ์</option>
<option value="D">จำนวนครุภัณฑ์ที่หมดอายุการใช้งานแยกตามประเภท</option>
<option value="E">จำนวนเงินครุภัณฑ์จำแนกตามปีงบประมาณ</option>
<option value="F">จำนวนเงินวัสดุจำแนกตามปีงบประมาณ</option>
<option value="G">จำนวนวัสดุที่ใช้งานอยู่จำแนกตามประเภท</option>
<option value="H">จำนวน</option>
<option value="T">จำนวนครุภัณฑ์จำแนกรายหน่วยงาน</option>
</select>
<input type="submit" name="multi" class="TEXT-GREEN10 WIDTH150" id="multi" value="เลือกมิติของการดูข้อมูล" />
</form>
</td>
</tr>
<tr>
<td align="center" style="padding-bottom:5px;"> </td>
</tr>
<tr>
<td align="center" style="padding-bottom:5px;">
<?
$setdata=$_POST[setdata];
$multi=$_POST[multi];
if($multi==TRUE){
if($setdata=="A"){
?>
<?php
$animateChart = "1";
//$strXML will be used to store the entire XML document generated
//Generate the chart element
$strXML = "<chart caption='กราฟแสดงจำนวนครุภัณฑ์ที่ใช้งานอยู่จำแนกตามประเภท' subCaption='' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' รายการ' animation=' " . $animateChart . "'>";
// Fetch all factory records
$strQuery = "SELECT * FROM accessories_type_tb ";
$result1 = mysql_query($strQuery);
//Iterate through each factory
if ($result1) {
while( $rs1 = mysql_fetch_array($result1) ) {
$error_id = $rs1['id'];
$strQuery = " SELECT * FROM accessories_tb at, accessories_type_tb att WHERE at.Dura='Y' and at.Status='Y' and at.Acc_type_code = att.Acc_type_code and at.Acc_type_code !='0' and at.Acc_type_code='$rs1[Acc_type_code]' ";
$result2 = mysql_query($strQuery);
$numAmt = mysql_num_rows($result2);
$strXML .= "<set label=' " . $rs1['Acc_type'] . "' value='" . $numAmt . "' />";
} # while
} # if
//Finally, close <chart> element
$strXML .= "</chart>";
//Create the chart - Pie 3D Chart with data from strXML
echo renderChart("./charts/Pie3D.swf", "", $strXML, "", 750, 375, false, false);
?>
<?
}
if($setdata=="B"){
?>
<?php
$animateChart = "1";
//$strXML will be used to store the entire XML document generated
//Generate the chart element
$strXML = "<chart caption='กราฟแสดงการแจ้งซ่อมแยกตามประเภทครุภัณฑ์' subCaption='' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' รายการ' animation=' " . $animateChart . "'>";
// Fetch all factory records
$strQuery = "SELECT * FROM durable_tb dt, accessories_type_tb att , accessories_tb at WHERE at.Dura='Y' and at.Acc_type_code = att.Acc_type_code and dt.AccId = at.AccId and at.Acc_type_code !='0' GROUP BY dt.Acc_type_code ";
$result2= mysql_query($strQuery);
//Iterate through each factory
if ($result2) {
while( $rs2 = mysql_fetch_array($result2) ) {
$error_id = $rs2['id'];
$strQuery = "SELECT * FROM durable_tb dt, accessories_type_tb att , accessories_tb at WHERE at.Dura='Y' and at.Acc_type_code = att.Acc_type_code and dt.AccId = at.AccId and at.Acc_type_code !='0' and at.Acc_type_code='$rs2[Acc_type_code]' ";
$result3 = mysql_query($strQuery);
$numAmt = mysql_num_rows($result3);
$strXML .= "<set label=' " . $rs2['Acc_type'] . "' value='" . $numAmt . "' />";
} # while
} # if
//Finally, close <chart> element
$strXML .= "</chart>";
//Create the chart - Pie 3D Chart with data from strXML
echo renderChart("./charts/Pie3D.swf", "", $strXML, "", 750, 375, false, false);
?>
<?
}
if($setdata=="C"){
?>
<?php
$animateChart = "1";
//$strXML will be used to store the entire XML document generated
//Generate the chart element
$strXML = "<chart caption='กราฟแสดงจำนวนประเภทการแจ้งซ่อมครุภัณฑ' subCaption='' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' รายการ' animation=' " . $animateChart . "'>";
// Fetch all factory records
$strQuery = " SELECT * FROM durable_type_tb ";
$result1 = mysql_query($strQuery);
//Iterate through each factory
if ($result1) {
while( $rs1 = mysql_fetch_array($result1) ) {
$error_id = $rs1['id'];
$strQuery = "Select * From durable_tb WHERE durableCode='$rs1[durableCode]' ";
$result2 = mysql_query($strQuery);
$numAmt = mysql_num_rows($result2);
$strXML .= "<set label=' " . $rs1['durableName'] . "' value='" . $numAmt . "' />";
} # while
} # if
//Finally, close <chart> element
$strXML .= "</chart>";
//Create the chart - Pie 3D Chart with data from strXML
echo renderChart("./charts/Pie3D.swf", "", $strXML, "", 750, 375, false, false);
?>
<?
}
if($setdata=="D"){
?>
<?php
$animateChart = "1";
//$strXML will be used to store the entire XML document generated
//Generate the chart element
$strXML = "<chart caption='กราฟแสดงจำนวนเงินครุภัณฑ์ที่หมดอายุการใช้งานแยกตามประเภท' subCaption='' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' รายการ' animation=' " . $animateChart . "'>";
// Fetch all factory records
$strQuery = " SELECT * FROM accessories_type_tb ";
$result1 = mysql_query($strQuery);
//Iterate through each factory
if ($result1) {
while( $rs1 = mysql_fetch_array($result1) ) {
$error_id = $rs1['id'];
$strQuery = " SELECT * FROM accessories_tb at, accessories_type_tb att WHERE Fund='หมดอายุการใช้งาน' and at.Acc_type_code = att.Acc_type_code and at.Acc_type_code !='0' and at.Acc_type_code='$rs1[Acc_type_code]' ";
$result2 = mysql_query($strQuery);
$numAmt = mysql_num_rows($result2);
$strXML .= "<set label=' " . $rs1['Acc_type'] . "' value='" . $numAmt . "' />";
} # while
} # if
//Finally, close <chart> element
$strXML .= "</chart>";
//Create the chart - Pie 3D Chart with data from strXML
echo renderChart("./charts/Pie3D.swf", "", $strXML, "", 750, 375, false, false);
?>
<?
}
if($setdata=="E"){
?>
<?php
$animateChart = "1";
//$strXML will be used to store the entire XML document generated
//Generate the chart element
$strXML = "<chart caption='กราฟแสดงจำนวนเงินครุภัณฑ์จำแนกตามปีงบประมาณ' subCaption='' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' บาท' animation=' " . $animateChart . "'>";
// Fetch all factory records
$strQuery = " SELECT * FROM accessories_tb WHERE Year !=' ' and Dura='Y' GROUP BY Year ";
$result1 = mysql_query($strQuery);
//Iterate through each factory
if ($result1) {
while( $rs1 = mysql_fetch_array($result1) ) {
$error_id = $rs1['id'];
$strQuery = " SELECT SUM(Price) AS SumB1 FROM accessories_tb WHERE Year='$rs1[Year]' and Dura='Y' ";
$result3 = $dbObj->execQuery($strQuery);
$rs3 = $dbObj->fetchArray($result3);
$strXML .= "<set label=' " . $rs1['Year'] . "' value='".$rs3['SumB1'] . "' />";
} # while
} # if
//Finally, close <chart> element
$strXML .= "</chart>";
//Create the chart - Pie 3D Chart with data from strXML
echo renderChart("./charts/Column2D.swf", "", $strXML, "", 750, 375, false, false);
?>
<?
}
if($setdata=="F"){
?>
<?php
$animateChart = "1";
//$strXML will be used to store the entire XML document generated
//Generate the chart element
$strXML = "<chart caption='กราฟแสดงจำนวนเงินวัสดุจำแนกตามปีงบประมาณ' subCaption='' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' บาท' animation=' " . $animateChart . "'>";
// Fetch all factory records
$strQuery = " SELECT * FROM accessories_tb WHERE Year !=' ' and Dura='N' GROUP BY Year ";
$result1 = mysql_query($strQuery);
//Iterate through each factory
if ($result1) {
while( $rs1 = mysql_fetch_array($result1) ) {
$error_id = $rs1['id'];
$strQuery = " SELECT SUM(Price) AS SumB1 FROM accessories_tb WHERE Year='$rs1[Year]' and Dura='N' ";
$result2 = mysql_query($strQuery);
$rs2 = $dbObj->fetchArray($result2);
$strXML .= "<set label=' " . $rs1['Year'] . "' value='".$rs2['SumB1'] . "' />";
} # while
} # if
//Finally, close <chart> element
$strXML .= "</chart>";
//Create the chart - Pie 3D Chart with data from strXML
echo renderChart("./charts/Column2D.swf", "", $strXML, "", 750, 375, false, false);
?>
<?
}
if($setdata=="G"){
?>
<?php
$animateChart = "1";
//$strXML will be used to store the entire XML document generated
//Generate the chart element
$strXML = "<chart caption='กราฟแสดงจำนวนวัสดุที่ใช้งานอยู่จำแนกตามประเภท' subCaption='' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' รายการ' animation=' " . $animateChart . "'>";
// Fetch all factory records
$strQuery = "SELECT * FROM accessories_type_tb ";
$result1 = mysql_query($strQuery);
//Iterate through each factory
if ($result1) {
while( $rs1 = mysql_fetch_array($result1) ) {
$error_id = $rs1['id'];
$strQuery = " SELECT * FROM accessories_tb at, accessories_type_tb att WHERE at.Dura='N' and at.Status='Y' and at.Acc_type_code = att.Acc_type_code and at.Acc_type_code !='0' and at.Acc_type_code='$rs1[Acc_type_code]' ";
$result2 = mysql_query($strQuery);
$numAmt = mysql_num_rows($result2);
$strXML .= "<set label=' " . $rs1['Acc_Etype'] . "' value='" . $numAmt . "' />";
} # while
} # if
//Finally, close <chart> element
$strXML .= "</chart>";
//Create the chart - Pie 3D Chart with data from strXML
echo renderChart("./charts/Pie3D.swf", "", $strXML, "", 750, 375, false, false);
?> <?
}
if($setdata=="H"){
?>
<?php
$animateChart = "1";
//$strXML will be used to store the entire XML document generated
//Generate the chart element
$strXML = "<chart caption='แผนภูมิแสดงรายการแผนการใช้เงินและแผนการจ่ายเงินรายปีงบประมาณ' subCaption='' pieSliceDepth='30' showBorder='0' formatNumberScale='0' numberSuffix=' ' animation=' " . $animateChart . "'>";
/*
$strQuery = " SELECT * FROM project_type_tb Where Budget_Year !=' ' and Budget_Year !='0' GROUP BY Budget_Year ";
$result111 = $dbObj->execQuery($strQuery);
//Iterate through each factory
if ($result111) {
while( $rs111 = $dbObj->fetchArray($result111) ) {
$sql3 = " SELECT SUM(Budget_total) AS SumB1 FROM $myTable2 WHERE Budget_Year='$rs111[Budget_Year]' ";
$result3 = $dbObj->execQuery($sql3);
$rs3 = $dbObj->fetchArray($result3);
$sql4 = " SELECT SUM(Budget_use) AS SumB2 FROM $myTable3 WHERE Budget_Year='$rs111[Budget_Year]' ";
$result4 = $dbObj->execQuery($sql4);
$rs4 = $dbObj->fetchArray($result4);
$strXML .= "<set label=' " . $rs111['Budget_Year'] . "' value='" .$rs3['SumB1'] . "' />";
$strXML .= "<set label=' " . $rs111['Budget_Year'] . "' value='" .$rs4['SumB2'] . "' />";
} # while
} # if
//Finally, close <chart> element
$strXML .= "</chart>";
//Create the chart - Pie 3D Chart with data from strXML
echo renderChart("charts/Line.swf", "", $strXML, "", 750, 375, false, false);
*/
// Fetch all factory records
$strQuery = "SELECT * FROM project_type_tb Where Budget_Year !=' ' and Budget_Year !='0' GROUP BY Budget_Year ";
$result1 = mysql_query($strQuery);
//Iterate through each factory
if( $result1 ) {
$strXML .= "<categories>";
while( $rs1 = mysql_fetch_array($result1) ) {
$Budget_Year = $rs1['Budget_Year'];
$strXML .= "<category label='".$Budget_Year."' />";
} # while
$strXML .= "</categories>";
}# if
mysql_free_result($result1);
// Fetch all factory records
$strQuery = "SELECT * FROM project_type_tb Where Budget_Year !=' ' and Budget_Year !='0' GROUP BY Budget_Year ";
$result1 = mysql_query($strQuery);
//Iterate through each factory
if( $result1 ) {
$strXML .= "<dataset seriesName='[จำนวนเงินที่ขอใช้]'>";
while( $rs1 = mysql_fetch_array($result1) ) {
$Budget_Year = $rs1['Budget_Year'];
$strQuery2 = "SELECT SUM(Budget_total) AS numAmt2 FROM project_type_tb WHERE Budget_Year='$Budget_Year' ";
$result2 = mysql_query($strQuery2);
$rs2 = mysql_fetch_array($result2);
mysql_free_result($result2);
$strXML .= "<set label=' " . $Budget_Year . " (Dr)' value='" . $rs2['numAmt2'] . "' />";
} # while
$strXML .= "</dataset>";
} # if
mysql_free_result($result1);
// Fetch all factory records
$strQuery = "SELECT * FROM project_type_tb Where Budget_Year !=' ' and Budget_Year !='0' GROUP BY Budget_Year ";
$result1 = mysql_query($strQuery);
//Iterate through each factory
if( $result1 ) {
$strXML .= "<dataset seriesName='[จำนวนเงินที่ใช้]'>";
while( $rs1 = mysql_fetch_array($result1) ) {
$Budget_Year = $rs1['Budget_Year'];
$strQuery3 = " SELECT SUM(Budget_use) AS numAmt3 FROM project_tb WHERE Budget_Year='$Budget_Year'";
$result3 = mysql_query($strQuery3);
$rs3 = mysql_fetch_array($result3);
$numAmt3 = mysql_num_rows($result3);
mysql_free_result($result3);
$strXML .= "<set label=' " . $Budget_Year . " (Cr)' value='" . $rs3['numAmt3'] . "' />";
} # while
$strXML .= "</dataset>";
} # if
mysql_free_result($result1);
//Finally, close <chart> element
$strXML .= "</chart>";
//Create the Multi-series Line Chart with data from strXML
echo renderChart("./charts/MSLine.swf", "", $strXML, "", 750, 375, false, false);
?>
<?
}
if($setdata=="T"){
?>
<?php
$animateChart = "1";
//$strXML will be used to store the entire XML document generated
//Generate the chart element
$strXML = "<chart caption='ฐานข้อมูลครุภัณฑ์' subCaption='จำแนกรายหน่วยงาน' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' รายการ' animation=' " . $animateChart . "'>";
// Fetch all factory records
$strQuery111 = " SELECT * FROM faculty_tb GROUP BY Faculty_code ";
$result111 = $dbObj->execQuery($strQuery111);
//Iterate through each factory
if( $result111 ) {
while( $rs111 = $dbObj->fetchArray($result111) ) {
$Faculty_code = $rs111['Faculty_code'];
$strQuery222 = " SELECT * FROM accessories_tb WHERE Faculty_code='$rs111[Faculty_code]' ";
$result222 = $dbObj->execQuery($strQuery222);
$numAmt222 = $dbObj->_numrows;
$dbObj->freeresult($result222);
// $strXML .= "<set label='" . $Faculty_name . "' value='" . $numAmt222 . "' />";
$strXML .= "<set label='" . $rs111['Faculty_name'] . "' value='" . $numAmt222 . "' />";
} # while
} # if
$dbObj->freeresult($result111);
//Finally, close <chart> element
$strXML .= "</chart>";
//Create the chart - Pie 3D or Column3D Chart with data from strXML
echo renderChart("./charts/Pie3D.swf", "", $strXML, "", 750,375, false, false);
?> <?
}
}
?></td>
</tr>
<tr>
<td align="center" style="padding-bottom:5px;"> </td>
</tr>
</table>
<table width="750" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"></td>
</tr>
</table></td>
</tr>
</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);
?>
|