 |
export excel จากการค้นหา วันที่ จาก PHP sql sever2014 |
|
 |
|
|
 |
 |
|
หน้า export เป็น excel
Code
<?php
$strExcelFileName="สินค้าติดลัง".date("Ymd").".xls";
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=\"$strExcelFileName\"");# ชื่อไฟล์
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<center>
<strong>แบบฟอร์มออกรายงานสินค้าติดลัง</strong><br>
<strong>แผนกจัดส่งขาเข้า</strong><br>
<strong>ประจำวันที่ <?php echo date("d/m/Y");?> </strong><br>
</center>
</head>
<body>
<?php
include('../connect/condb.php');
//include('../conn/condb2.php');
?>
<?php
session_start();
$_SESSION["datein1"] = $_GET ["datein1"];
$_SESSION["datein2"] = $_GET ["datein2"];
?>
<table class="table table-bordered">
<tr>
<th width="15%">วันเข้าสินค้า</th>
<th width="15%">รหัสสินค้า</th>
<th width="25%">ชื่อสินค้า</th>
<th width="15%">สถานะ</th>
<th width="15%">หมายเหตุ</th>
<th width="15%">ผู้ตรวจสอบ</th>
</tr>
<?php
$query =" SELECT * FROM list LEFT OUTER JOIN
[192.168.247.29].[DATA_PRODUCT].[dbo].[MY_BARCODE] on list.BARCODE = MY_BARCODE.BARCODE collate Thai_CI_AS LEFT OUTER JOIN
status ON list.statusid = status.statusid LEFT OUTER JOIN
store ON list.storeid = store.storeid LEFT OUTER JOIN
inbound ON list.inboundid = inbound.inboundid LEFT OUTER JOIN
note ON list.noteid = note.noteid LEFT OUTER JOIN
inventory ON list.inventoryid = inventory.inventoryid LEFT OUTER JOIN
returnproduct ON list.returnid = returnproduct.returnid WHERE (datein BETWEEN (echo$_SESSION["datein1"]) AND (echo$_SESSION["datein2"]))
ORDER BY list.datein DESC ";
$result = odbc_exec($conn,$query) or die(odbc_error($conn));
while($row = odbc_fetch_array($result))
{
?>
<tr>
<td><?php echo $row["datein"]; ?></td>
<td><?php echo $row["BARCODE"]; ?></td>
<td><?php echo iconv("TIS-620", "UTF-8",$row["PRODUCT_NAME"]); ?></td>
<td><?php echo iconv("TIS-620", "UTF-8",$row["statusname"]); ?></td>
<td><?php echo iconv("TIS-620", "UTF-8",$row["notename"]); ?></td>
<td><?php echo iconv("TIS-620", "UTF-8",$row["inventoryname"]); ?></td>
</tr>
<?php
}
?>
</table>
|
 |
 |
 |
 |
Date :
2019-09-20 15:09:31 |
By :
napat072 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|