?
Path : /home/admin/domains/happytokorea.com/public_html_bk/promice/Admin/ |
Current File : /home/admin/domains/happytokorea.com/public_html_bk/promice/Admin/ReportSalepermonthNowPrint.php |
<? @session_start(); ob_start(); $useradmin = $_SESSION["useradmin"]; if(empty($useradmin)) { echo "<script>alert('หน้านี้จำกัดเฉพาะ Admin เท่านั้น');history.back();</script>"; exit(); } require_once "../include/tdate.php"; require_once "../include/connect.php"; require_once "../include/connectdb.php"; $sql="select * from useradmin where useradmin='$useradmin'"; $db_query=mysql_db_query($db,$sql); $result=mysql_fetch_array($db_query); $id=$result[id]; $adminname=$result[name]; $user_admin=$result[useradmin]; $pass_admin=$result[passadmin]; ?> <html> <head> <title><? echo "$headtxt"; ?></title> <meta http-equiv="Content-Type" content="text/html; charset=tis-620"> </head> <body bgcolor="#ffffff" onLoad="window.print()" > <div align="center"> <table width="98%" border="0" align="center" cellpadding="1" cellspacing="1"> <tr> <td><table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr> <td width="938"><strong><? echo "$headtxt"; ?></strong></td> <td width="262"><div align="right">วันที่ : <? echo "$e_date"; ?></div></td> </tr> </table></td> </tr> <tr> <td><div align="center"> <strong>รายงาน</strong><strong>ยอดการขายรายเดือน<br> ประจำเดือน : <? echo "$_POST[monthreport]"; ?></strong></div></td> </tr> <tr> <td><table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr> <td><div align="center"> <table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr> <td><div align="center"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#000000"><table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr bgcolor="#FFFFFF"> <td width="7%"><div align="center"><strong>ลำดับ</strong></div></td> <td width="11%"><div align="center"><strong>เลขสั่งซื้อ</strong></div></td> <td width="12%"><div align="center"><strong>รหัสสินค้า</strong></div></td> <td width="19%"><div align="center"><strong>ชื่อสินค้า</strong></div></td> <td width="19%"><div align="center"><strong>ชื่อลูกค้า</strong></div></td> <td width="8%"><div align="center"><strong>จำนวน</strong></div></td> <td width="11%"><div align="center"><strong>ราคา/บาท</strong></div></td> <td width="13%"><div align="center"><strong>ชำระโดย</strong></div></td> </tr> </table></td> </tr> </table> <? $number = 1; $page = $_GET['page']; $number_job = 1; $select_type="select * from tb_order order by id desc"; $query_select=mysql_query($select_type); $num_rows=mysql_num_rows($query_select); if($num_rows<1){ echo "<br><br><center><b>ไม่พบรายการนี้ในระบบ</b></center>"; }else{ $select="select * from tb_order order by id desc"; $q_ry = mysql_query($select); $num_rows=mysql_num_rows($q_ry); $pagesize=100; $rt=$num_rows%$pagesize; if($rt!=0) { $totalpage=floor($num_rows/$pagesize)+1; } else { $totalpage=floor($num_rows/$pagesize); $toppic_id=1; } if(empty($page)) { $page=1; } mysql_free_result($q_ry); $goto=($page-1)*$pagesize; $sql_select_mem="Select * From tb_order where date LIKE '%$_POST[monthreport]%' and paystatus = '11111' order by id desc limit $goto,$pagesize"; $fect=mysql_query($sql_select_mem); if(!$fect) { ("ติดต่อฐานข้อมูลไม่ได้".mysql_error()); exit; } $bgcount=0; while($rows=mysql_fetch_array($fect)) { $idxx =$rows['id']; $refid =$rows['refid']; $pNum =$rows['pNum']; $pPrice =$rows['pPrice']; $id_cus =$rows['id_cus']; $pId = $rows['pId']; $paystatus = $rows['paystatus']; $statusnow = $rows['statusnow']; $payby = $rows['payby']; $products_price=number_format($pPrice,2,'.',',') ; $bgcount=$bgcount+1; $bgmod=$bgcount%2; if($bgmod==0){ $bgcolor="#D7E5E7"; $bg_count = "#1B7DD8"; }else{ $bgcolor=""; $bg_count = ""; } ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#000000"><table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr bgcolor="#FFFFFF"> <td width="7%"><div align="center"><? echo "$number"; ?></div></td> <td width="11%"><div align="center"><? echo "$refid"; ?></div></td> <td width="12%"><div align="center"><? echo "$pId"; ?></div></td> <td width="19%"><div align="center"> <? $sqlprd="select * from products where productscode='$pId'"; $db_query=mysql_db_query($db,$sqlprd); $resultprd=mysql_fetch_array($db_query); $products_name=$resultprd[productsname]; echo "$products_name"; ?> </div></td> <td width="19%"><div align="center"> <div align="left"> <? $sqlmember="select * from member where usermem='$id_cus'"; $db_query=mysql_db_query($db,$sqlmember); $resultmem=mysql_fetch_array($db_query); $membername=$resultmem[name]; echo "$membername"; ?> </div> </div></td> <td width="8%"><div align="center"><? echo "$pNum"; ?></div></td> <td width="11%"><div align="right"><? echo "$products_price"; ?></div></td> <td width="13%"><div align="center"> <? if ($payby == "by_bank") { echo "ทางธนาคาร"; }else if ($payby == "by_paysbuy") { echo "ทาง Paysbuy"; } ?> </div></td> </tr> </table></td> </tr> </table> <? $number = $number+1; $sumprice = $sumprice+$pPrice; } } ?> <table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr bgcolor="#FFFFFF"> <td width="7%"><div align="center"></div></td> <td width="11%"><div align="center"></div></td> <td width="12%"><div align="center"></div></td> <td width="19%"><div align="center"></div></td> <td width="19%"><div align="center"> <div align="left"></div> </div></td> <td width="8%"><div align="center"><strong>รวม</strong></div></td> <td width="11%"><div align="right"> <? $sum_price=number_format($sumprice,2,'.',',') ; echo "<b>$sum_price</b>"; ?> </div></td> <td width="13%"><div align="center"><strong>บาท </strong> </div></td> </tr> </table> </div></td> </tr> </table> </div></td> </tr> </table> <map name="Map"> <area shape="rect" coords="116,2,226,34" href="#" onClick="window.print()"> </map></td> </tr> <tr> <td><div align="center"><br> <br> <table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr valign="top"> <td width="454" height="87"> </td> <td width="438"><strong>ลงชื่อ</strong> .....................................................................<br> (ผู้พริ๊นรายงาน) <br> <br> <br> <strong>ลงชื่อ</strong> .....................................................................<br> (ผู้จัดการ) </td> </tr> </table> <br> </div></td> </tr> </table> </div> </body> </html>