|
|
|
php สอบถามเรื่องการทำ Report ให้ลงค่าที่เบิกกับราคาให้ตรงกับการขอเบิกจริง และการทำ scollbar ให้เลื่อนด้านล่างตารางของรายงานได้ |
|
|
|
|
|
|
|
ต้องการความช่วยเหลือคะ คือไม่ทราบวิธีจะแทรกการขอเบิกได้ ตามหน่วยงานได้ยังไงอ่ะคะ และการทำ scollbar ให้เลื่อนในตารางรายงานอะคะ
Code (PHP)
<? include "../conn2/session.php";
include "../conn2/session_secure.php";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>INVENTORY ADMINISTEATION MANAGEMENT SYSTEM</title>
<!-- Bootstrap Core CSS -->
<link href="../administrator/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="../administrator/css/business-frontpage.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" media="all" type="text/css" href="../administrator/js/jquery-ui.css" />
<link rel="stylesheet" media="all" type="text/css" href="../administrator/js/jquery-ui-timepicker-addon.css" />
<script type="text/javascript" src="../administrator/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="../administrator/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="../administrator/js/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="../administrator/js/jquery-ui-sliderAccess.js"></script>
<script src="../administrator/js/jquery.form.validator.min.js"></script>
<script src="../administrator/js/security.js"></script>
<script src="../administrator/js/file.js"></script>
<link href="../administrator/css/font-awesome.min.css" rel="stylesheet" />
</head>
<body>
<!-- Navigation -->
<? include("../menu.php"); ?>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<!-- Image Background Page Header -->
<!-- Note: The background image is set within the business-casual.css file. -->
<header class="business-header">
<div class="container">
<div class="row">
</div>
</div>
</header>
<!-- Page Content -->
<div class="container">
<hr>
<div class="row">
<div class="col-sm-9" align="right">
</div>
<div class="col-sm-3" align="left">
<img src="../administrator/images/icon/admin.png" width="30" height="30"> : <?=$_SESSION["user_typeName"];?> <?=$_SESSION["name_user"];?></div></div>
<br>
<br>
<div class="row">
<div class="col-sm-12" align="left">
<form class="form-inline" method="get" action="<?php echo $_SERVER['../administrator/SCRIPT_NAME'];?>" >
<?
include("../conn2/connect_db_server.php");
$strSQL = "select * from tb_type ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<div class="table-responsive">
<table class="table" align="center">
<tr>
<td class="info" colspan="3" align="center"><div class="form-group">
<b> ค้นหาข้อมูลรายงานรายละเอียดการสั่งซื้อ - เบิกใช้เครื่องเขียน</b>
</div></td>
</tr>
<tr>
<td class="danger" colspan="3" align="center"></td>
</tr>
<tr align="center">
<td class="success" ><div class="form-group">
<label for="exampleInputName2">ปี :</label>
<select name="year" class="form-control" id="year" required>
<option value="">กรุณาเลือกปี</option>
<option value="2015">2015</option>
<option value="2016">2016</option>
<option value="2017">2017</option>
</select>
</div></td>
<td class="success"> <div class="form-group">
<label for="exampleInputName2">เดือน :</label>
<select name="month" id="month" class="form-control">
<option value=" ">กรุณาเลือกเดือน</option>
<?PHP $month = array("มกราคม ","กุมภาพันธ์ ","มีนาคม ","เมษายน ","พฤษภาคม ","มิถุนายน ","กรกฎาคม ","สิงหาคม ","กันยายน ","ตุลาคม ","พฤศจิกายน ","ธันวาคม ");?>
<?PHP $month_id = array("1 ","2 ","3 ","4 ","5 ","6 ","7 ","8 ","9 ","10 ","11 ","12 ");?>
<?PHP for($i=0; $i<sizeof($month_id); $i++) {?>
<option value="<?PHP echo $month_id[$i]?>" >
<?PHP echo $month[$i]?></option>
<?PHP }?>
</select>
</div></td>
<td class="success" ><div class="form-group">
<label for="exampleInputName2">ประเภท :</label>
<select name="categories_id" class="form-control" id="categories_id" required>
<option value="">กรุณาเลือกประเภท</option>
<option value="1">เครื่องเขียน</option>
<option value="2">ของใช้สิ้นเปลือง</option>
</select>
</div></td>
</tr>
<tr>
<td class="danger" colspan="3" align="center"></td>
</tr>
<tr class="warning">
<td class="success" align="center" colspan="3"><div class="form-group">
<input type="submit" class="btn btn-success" value="ค้นหา">
<input type="hidden" class="btn btn-success" value="1" id="search" name="search">
</div></td>
</tr>
</table>
</div>
</form>
</div>
</div>
<form action="../administrator/add_admin.php?add_adv=2" method="post" id="form1" name="form1" >
<table class="table table-bordered">
<tr class="success">
<td> <div align="left"><B>ลำดับ</B></div></td>
<td> <div align="left"><B>รหัสสินค้า</B></div></td>
<td> <div align="left"><B>รายการ</B></div></td>
<td> <div align="left"><B>หน่วย</B></div></td>
<td> <div align="center"><B>คงเหลือนับจริงปัจจุบัน</B></div></td>
<td colspan="2"> <div align="center"><B>ยอดรวมทั้งหมด-ซื้อ</B></div></td>
<? $strSQL1 = "select * from tb_department ORDER BY department_id ASC ";
$objQuery1 = mysql_query($strSQL1);
$i=0;
while($objResult1 = mysql_fetch_array($objQuery1))
{
?>
<td colspan="2"> <div align="center"><? echo $objResult1[department_name]; ?></div></td>
<? }?>
</tr>
<tr class="success">
<td> </td>
<td> </td>
<td > </td>
<td> </td>
<td> </td>
<td> <div align="center"><B>สั่งซื้อ</B></div></td>
<td> <div align="center"><B>ราคา</B></div></td>
<?
$strSQL2 = "select * from tb_department ORDER BY department_id ASC ";
$objQuery2 = mysql_query($strSQL2);
$k=0;
while($objResult2 = mysql_fetch_array($objQuery2))
{
?>
<td> <div align="center"><B>เบิก</B></div></td>
<td> <div align="center"><B>ราคา</B></div></td>
<? } ?>
</tr>
<? include("../conn2/connect_db_server.php");
#var_dump($_REQUEST);
$date_today=date("Y-m-d H:i:s");
#echo"$strSQL";
#echo"<br>$strSQL2";
$year=$_GET[year];
$month=$_GET[month];
$timeno=$_GET[timeno];
$search=$_GET[search];
if ($year =='')
{ $year =0;
}
if ($month =='')
{ $month =0;
}
if ($categories_id =='')
{ $categories_id =0;
}
if ($search =='')
{ $search =0;
}
$strSQL = "SELECT t1.department_id,
t1.department_name,
t1.year,
t1.month,
t1.item_id,
i.item_code,
i.item_all_name,
u.unit_name,
IFNULL(r.stock_amount,0) as stock_amount,/*คงเหลือ*/
SUM(t1.number) as number, /*เบิก*/
IFNULL(r.stock_price_Unit,0) as price_Unit,/*ราคาต่อหน่วย*/
CAST((SUM(t1.number)*IFNULL(r.stock_price_Unit,0)) as DECIMAL(12,2)) as total /*ราคารวม*/
FROM uv_order as t1
LEFT JOIN tb_item_all i on i.item_id = t1.item_id
LEFT JOIN tb_unit u on u.unit_id = i.unit_id
LEFT JOIN tb_item_remain r on t1.item_id = r.item_id and t1.Listno = r.Listno
WHERE t1.year = $year and t1.month = $month
/*เครื่องเเขียน =1 , สิ้นเปลือง = 2 */
and i.categories_id = $categories_id and 1= $search
GROUP BY t1.department_id,t1.year,t1.month,t1.item_id ";
#echo"$strSQL<br>";
#echo"<br>$k";
#var_dump($_GET);
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);
#echo"$strSQL";
#echo"$strSQL";
$Per_Page = 50; // Per Page
$Page = $_GET["Page"];
if(!$_GET["Page"])
{
$Page=1;
}
$Prev_Page = $Page-1;
$Next_Page = $Page+1;
$Page_Start = (($Per_Page*$Page)-$Per_Page);
if($Num_Rows<=$Per_Page)
{
$Num_Pages =1;
}
else if(($Num_Rows % $Per_Page)==0)
{
$Num_Pages =($Num_Rows/$Per_Page) ;
}
else
{
$Num_Pages =($Num_Rows/$Per_Page)+1;
$Num_Pages = (int)$Num_Pages;
}
$strSQL .=" ORDER BY t1.department_id ASC LIMIT $Page_Start , $Per_Page";/* LIMIT $Page_Start , $Per_Page";*/
#$strSQL .=" order by CustomerID ASC LIMIT $Page_Start , $Per_Page";
$objQuery = mysql_query($strSQL);
?>
<div class="row">
<div class="col-sm-12">
<font color="#000000" size="+3">รายงานรายละเอียดการสั่งซื้อ - เบิกใช้</font> <font color="#0099FF" size="+2">รอบที่ <? echo $categories_id;?> /<? echo $month;?> /<? echo $year;?></font>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<? /*
$strSQL10 = "select * from tb_item_all where type_id = '".$_REQUEST["type_id"]."'";
$objQuery10 = mysql_query($strSQL10);*/
?>
<b> Total <font color="#0099FF"><?= $Num_Rows;?></font> รายการ Record : <?=$Num_Pages;?> Page : </b>
<?
if($Prev_Page)
{
echo "<a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&condition=$condition'><div class='btn-group' role='group' aria-label='...'><button type='button' class='btn btn-info'><<</button></div></a> ";
}
for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{
echo "<div class='btn-group' role='group' aria-label='...'><button type='button' class='btn btn-info'><a href='$_SERVER[SCRIPT_NAME]?Page=$i&condition=$condition'>$i</a></button></div>";
}
else
{
echo "<b> $i </b>";
}
}
if($Page!=$Num_Pages)
{
echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&condition=$condition'><div class='btn-group' role='group' aria-label='...'><button type='button' class='btn btn-info'>>></button></div></a> ";
}
#mysql_close($objConnect);
?>
<?php
$j=0;
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr "<? echo $j++ ;?>" >
<td><? echo $j ;?> </td>
<td> <? echo $objResult['item_code'];?></td>
<td ><? echo $objResult['item_all_name'];?> </td>
<td><? echo $objResult['unit_name'];?> </td>
<td> <? echo $objResult['item_code'];?></td>
<td> <div align="center"><B><? echo $objResult['number'];?></B></div></td>
<td> <div align="center"><B><? echo $objResult['total'];?></B></div></td>
<?
$strSQL2 = "select * from tb_department ";
$objQuery2 = mysql_query($strSQL2);
$c=0;
while($objResult2 = mysql_fetch_array($objQuery2))
{
?>
<td> <div align="center"><B></B></div></td>
<td> <div align="center"><B></B></div></td>
<? } ?>
</tr>
<?php
}
?>
<!--<tr>
<td align="center" colspan="<?=$j + $k;?>"> <button type="submit" class="btn btn-info" value="submit">บันทึกข้อมูล</button>
<input type="hidden" name="hdnLine" value="<?=$j;?>">
</div></td>
</tr>-->
</table>
</form>
<br>
</div>
<div class="col-sm-2">
</div> </div>
<!-- /.row -->
<!-- /.row -->
<hr>
<!-- Footer -->
<? include("../footer.php"); ?>
<!-- /.container -->
<!-- jQuery -->
<!-- Bootstrap Core JavaScript -->
<script src="../administrator/js/bootstrap.min.js"></script>
<script>
$.validate({
modules: 'security, file',
onModulesLoaded: function () {
$('input[name="pass_confirmation"]').displayPasswordStrength();
}
});
</script>
</body>
</html>
หน้าแสดงผล
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2015-10-12 12:06:40 |
By :
gungging302 |
View :
977 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|