public function exportDayInner(){
$start_date = input('start');
$end_date = input('end');
$innerdata = Db::table('inner')
->whereTime('add_date', 'between', [$start_date,$end_date])
->where('inner.depart_id',session('depart_id'))
->join('goods','inner.goods_id = goods.id')
->join('storage','storage.id = inner.storage_id')
->join('supplier','supplier.id = inner.supplier_id')
->join('user','user.id = inner.user_id')
//->limit(5)
->order('inner.id desc')
->field('goods_name,add_date,storage_name,supplier_name,real_name,num,inner.price')
->select();
$table = '';
$table .= "<table>
<thead>
<tr>
<th class='name'>名稱</th>
<th class='name'>入庫日期</th>
<th class='name'>入庫庫位</th>
<th class='name'>供貨商</th>
<th class='name'>入庫人</th>
<th class='name'>數(shù)量</th>
<th class='name'>單價</th>
</tr>
</thead>
<tbody>";
foreach ($innerdata as $v) {
$table .= "<tr>
<td class='name'>{$v['goods_name']}</td>
<td class='name'>{$v['add_date']}</td>
<td class='name'>{$v['storage_name']}</td>
<td class='name'>{$v['supplier_name']}</td>
<td class='name'>{$v['real_name']}</td>
<td class='name'>{$v['num']}</td>
<td class='name'>{$v['price']}</td>
</tr>";
}
$table .= "</tbody>
</table>";
//通過header頭控制輸出excel表格
header("Pragma: public");
header("Expires: 0");
header("Cache-Control:must-revalidate, post-check=0, pre-check=0");
header("Content-Type:application/force-download");
header("Content-Type:application/vnd.ms-execl");
header("Content-Type:application/octet-stream");
header("Content-Type:application/download");;
header('Content-Disposition:attachment;filename="入庫明細表.xls"');
header("Content-Transfer-Encoding:binary");
echo $table;
}