header('Content-type: application/ms-word'); header('Content-Disposition: attachment; filename="report_part1.doc"');
<? include("connect.php"); include("function.php"); mysql_connect('localhost','root','1234'); mysql_select_db('charter_db') or die('ไม่พบฐานข้อมูล'); $setthai=mysql_query("SET NAMES UTF8"); $sql = 'SELECT * FROM product AS t1 INNER JOIN pawn AS t2 ON t1.id_pawn = t2.id_pawn INNER JOIN product_type AS t3 ON t1.id_ptype = t3.id_ptype INNER JOIN repayment_type AS t4 ON t4.id_paytype = t1.id_paytype INNER JOIN branch AS t5 ON t5.id_branch = t1.id_branch WHERE YEAR( t2.date_pawn ) =2013 and t5.id_branch =1 ORDER BY `t1`.`id_pro` ASC LIMIT 0 , 30'; } echo"<br>"; echo "<table width=\"716\" border = \"1\" bgcolor=\"#CCFF99\" bordercolor=\"#CCCCCC\" align=\"center\">"; echo"<tr bgcolor=\"#99FF33\">"; echo "<th>เดือน</th>"; echo "<th>เลขที่สัญญา</th>"; echo "<th>ประเภทสินค้า</th>"; echo "<th>สาขา</th>"; echo "<th>ยอดเงิน</th>"; echo "</tr>"; $datasearch=mysql_query($sql) or die(mysql_error()); $count=mysql_num_rows($datasearch); //while($field=mysql_fetch_array($datasearch)) while($fild=mysql_fetch_array($datasearch)) { $date_pawn=thaidate($fild[date_pawn]); $date_pay=thaidate($fild[date_pay]); //$date_pawn=thaidate($fiield[date_pawn]); $id_pawn=$fild[id_pawn]; $name_branch=$fild[name_branch]; $name_ptype=$fild[name_ptype]; $price_pawn=number_format($fild[price_pawn],2); $amount_pay=number_format($fild[amount_pay],2); if ($status == '1') { $totalAll = 0; $sql_in = 'select price_pawn from pawn'; $result = mysql_query($sql); while($resultarray = mysql_fetch_array($result)){ $totalAll += (int)$resultarray['price_pawn']; //$totalAll += (int)$resultarray['amount_pay']; } echo "<tr align=\"center\" >"; echo "<td>$date_pawn</td>"; echo "<td>$id_pawn</td>"; echo "<td>$name_ptype</td>"; echo "<td>$name_branch</td>"; echo "<td align=\"right\">$price_pawn</td>"; //echo "<td align=\"right\">$amount_pay</td>"; echo "</tr>"; } if ($status == '2') { $totalAll = 0; $sql_in = 'select amount_pay from repayment'; $result = mysql_query($sql); while($resultarray = mysql_fetch_array($result)){ $totalAll += (int)$resultarray['amount_pay']; //$totalAll += (int)$resultarray['amount_pay']; } echo "<tr align=\"center\" >"; echo "<td>$date_pay</td>"; echo "<td>$id_pawn</td>"; echo "<td>$name_ptype</td>"; echo "<td>$name_branch</td>"; //echo "<td align=\"right\">$price_pawn</td>"; echo "<td align=\"right\">$amount_pay</td>"; echo "</tr>"; } } echo "</table>"; mysql_close(); ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง