| Server IP : 61.19.30.66 / Your IP : 216.73.216.15 Web Server : Apache/2.2.22 (Ubuntu) System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 User : www-data ( 33) PHP Version : 5.3.10-1ubuntu3.48 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /var/www/cooperative/sell/ |
Upload File : |
<?
ob_start();
session_start();
if($_SESSION["adminlogin"]=="")
{
header('location:index.php');
exit();
}
//============ Start Session และทำการเรียก Function ติดต่อฐานข้อมูล
require_once('../connect/connect.php');
require_once('../connect/function.php');
//=========== กรณีลบรายการสินค้า
if($_GET["Action"]=="Delete")
{
//=========== ลบข้อมูล
$sql_del= "delete from gen_stock where GenStockID='".$_GET["GenStockID"]."'";
$dbquery_del = mysql_query($sql_del);
echo"<script language='JavaScript'>";
echo"alert('ลบข้อมูลเรียบร้อยแล้ว');";
echo"window.location='gen_stock.php';";
echo"</script>";
}
if($_GET["FromYY"] == "")
{
$_GET["FromYY"] = date("Y");
$_GET["FromMM"] = date("m");
$_GET["FromDD"] = date("d");
$_GET["ToYY"] = date("Y");
$_GET["ToMM"] = date("m");
$_GET["ToDD"] = date("d");
}
?>
<html>
<title>..:: ระบบจัดการฐานข้อมูล ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../css/styles.css" type="text/css">
<div align="center"><br>
<table cellspacing=1 cellpadding=4 width="68%" bgcolor=#CCCCCC border=0 align="center" height="10">
<tbody>
<tr bgcolor=#e5e5e5>
<td width="100%" bgcolor="#FFFFFF"> <div align="center"></div>
<table cellspacing=1 cellpadding=4 width="100%" border=0 align="center" height="10">
<tbody>
<tr bgcolor=#e5e5e5>
<td width="35%" bgcolor="#FFFFFF"> <div align="left"><b><img src="../image/allrowto.gif" width="11" height="11" align="absbottom">
เบิกวัตุดิบ</b></div></td>
<td width="22%" align=middle bgcolor="#FFFFFF"> <div align="left">
</div></td>
<td width="43%" bgcolor="#FFFFFF"> <div align="right"><a href="head.php">กลับไปหน้าหลัก</a></div></td>
</tr>
</tbody>
</table></td>
</tr>
</tbody>
</table>
</div>
<form name="frm" method="get" action="<?=$_SERVER['PHP_SELF'];?>" enctype="multipart/form-data">
<table width="68%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="79%">ช่วงเวลาู
<select name="FromDD" id="FromDD" class="txtbox">
<?
for($i=1;$i<=31;$i++)
{
if($_GET["FromDD"] == $i)
{
$sel = "selected";
}
else
{
$sel = "";
}
?>
<option value="<?=$i;?>" <?=$sel;?>>
<?=substr("0$i",-2);?>
</option>
<?
}
?>
</select>
-
<select name="FromMM" id="FromMM" class="txtbox">
<?
for($i=1;$i<=12;$i++)
{
if($_GET["FromMM"] == $i)
{
$sel = "selected";
}
else
{
$sel = "";
}
?>
<option value="<?=$i;?>" <?=$sel;?>>
<?=substr("0$i",-2);?>
</option>
<?
}
?>
</select>
-
<select name="FromYY" id="FromYY" class="txtbox">
<?
for($i=date("Y");$i>=date("Y")-4;$i--)
{
if($_GET["FromYY"] == $i)
{
$sel = "selected";
}
else
{
$sel = "";
}
?>
<option value="<?=$i;?>" <?=$sel;?>>
<?=$i+543;?>
</option>
<?
}
?>
</select>
ถึง <select name="ToDD" id="ToDD" class="txtbox">
<?
for($i=1;$i<=31;$i++)
{
if($_GET["ToDD"] == $i)
{
$sel = "selected";
}
else
{
$sel = "";
}
?>
<option value="<?=$i;?>" <?=$sel;?>>
<?=substr("0$i",-2);?>
</option>
<?
}
?>
</select>
-
<select name="ToMM" id="ToMM" class="txtbox">
<?
for($i=1;$i<=12;$i++)
{
if($_GET["ToMM"] == $i)
{
$sel = "selected";
}
else
{
$sel = "";
}
?>
<option value="<?=$i;?>" <?=$sel;?>>
<?=substr("0$i",-2);?>
</option>
<?
}
?>
</select>
-
<select name="ToYY" id="ToYY" class="txtbox">
<?
for($i=date("Y");$i>=date("Y")-4;$i--)
{
if($_GET["ToYY"] == $i)
{
$sel = "selected";
}
else
{
$sel = "";
}
?>
<option value="<?=$i;?>" <?=$sel;?>>
<?=$i+543;?>
</option>
<?
}
?>
</select>
<input type="submit" class="button" value="View">
<input name="View" type="hidden" id="View" value="Y"> </td>
<td width="21%"><div align="right"><img src="../image/edit_icon.gif" width="15" height="15">
<a href="add_gen_stock.php">เพิ่มเบิกวัตถุดิบ</a></div></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
<table cellspacing=1 cellpadding=3 width="68%" bgcolor=#CCCCCC border=0 align="center" height="10">
<tbody>
<tr bgcolor=#e5e5e5>
<td bgcolor="#FFFFFF"><div align="center">ลำัดัับ</div></td>
<td bgcolor="#FFFFFF"><div align="center">วันที่</div></td>
<td bgcolor="#FFFFFF"><div align="center">รหัสวัตถุดิบ</div></td>
<td bgcolor="#FFFFFF">ชื่อวัตถุดิบ</td>
<td bgcolor="#FFFFFF"><div align="center">เบอร์</div></td>
<td bgcolor="#FFFFFF"><div align="center">สี</div></td>
<td bgcolor="#FFFFFF"><div align="center">จำนวนที่สั่งเบิก</div></td>
<td bgcolor="#FFFFFF"><div align="center">ลบ</div></td>
</tr>
<?
$i=0;
$Per_Page =10;
//=========== นำข้อมูลมาแสดงทั้งหมด
if($_GET["View"] == "Y")
{
$strCondition = " and Date between '$_GET[FromYY]-$_GET[FromMM]-$_GET[FromDD]' and '$_GET[ToYY]-$_GET[ToMM]-$_GET[ToDD]' ";
$Per_Page =1000;
}
$sql = "select * From gen_stock where 1 $strCondition ";
/* ตั้งค่า แสดงผลต่อหน้า $Per_Page */
if(!$Page)
$Page=1;
$Prev_Page = $Page-1;
$Next_Page = $Page+1;
$result = mysql_query($sql);
$Page_start = ($Per_Page*$Page)-$Per_Page;
$Num_Rows = mysql_num_rows($result);
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;
if(($Page>$Num_Pages) || ($Page<0))
print "<center><b>จำนวน $Page มากกว่า $Num_Pages ยังไม่มีข้อความ<b></center>";
$sql .= " order by GenStockID desc LIMIT $Page_start , $Per_Page";
//ส่วนแสดงผล
$i=0;
$query = mysql_query($sql);
While($result= mysql_fetch_array($query)){
$i++;
$resultStock=select("stock","where 1=1 and StockID='".$result["StockID"]."'");
?>
<tr bgcolor=#e5e5e5>
<td width="36" bgcolor="#FFFFFF"> <div align="center">
<?=$i;?>
</div></td>
<td width="64" bgcolor="#FFFFFF"> <div align="center">
<?=$result["Date"];?>
</div></td>
<td width="92" bgcolor="#FFFFFF"><div align="center">
<?=$resultStock["StockCode"];?>
</div></td>
<td width="166" bgcolor="#FFFFFF">
<?=$resultStock["StockName"];?>
</td>
<td width="86" bgcolor="#FFFFFF"> <div align="center">
<?=$resultStock["Number"];?>
</div></td>
<td width="67" bgcolor="#FFFFFF"><div align="center">
<?=$resultStock["Color"];?>
</div></td>
<td width="79" bgcolor="#FFFFFF"><div align="center"> <font color="#FF0000">
<?=$result["Quantity"];?>
<?
$quo = $quo + $result["Quantity"];
?>
</font></div></td>
<script language="JavaScript">
function Conf<?=$result["GenStockID"]; ?>(object) {
if (confirm("ยืนยันการลบ [ <?=$result["GenStockID"]; ?> ] ") ==true) {
return true;
}
return false;
}
</script>
<td width="28" bgcolor="#FFFFFF"><div align="center"><a href="<?=$_SERVER['PHP_SELF'];?>?Action=Delete&GenStockID=<?=$result["GenStockID"];?>&file1=<?=$result["PictureSmall"];?>&file2=<?=$result["PictureBig"];?>" onClick="return Conf<?=$result["GenStockID"]; ?>(this)"><img src="../image/delete.gif" width="16" height="16" border="0"></a></div></td>
</tr>
<?
}
?>
<tr bgcolor=#e5e5e5>
<td colspan="6" bgcolor="#FFFFFF"><div align="right">รวม</div></td>
<td bgcolor="#FFFFFF"><div align="center"><font color="#FF0000">
<?
echo $quo;
?>
</font></div></td>
<td bgcolor="#FFFFFF"> </td>
</tr>
</tbody>
</table>
<br>
<table width="69%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> จำนวน
<?= $Num_Rows;?>
แบ่งเป็น : <b>
<?=$Num_Pages;?>
</b> ไปยัง :
<?/* สร้างปุ่มย้อนกลับ */
if($Prev_Page)
echo " <a href='$PHP_SELF?Page=$Prev_Page'><< Back </a> ";
for($i=1; $i<$Num_Pages; $i++){
if($i != $Page)
echo " [ <a href='$PHP_SELF?Page=$i'>$i</a> ]";
else
echo "<b> $i </b>";
}
/*สร้างปุ่มเดินหน้า */
if($Page!=$Num_Pages)
echo " <a href ='$PHP_SELF?Page=$Next_Page'> Next >> </a>";
?>
</td>
</tr>
</table>
</form>