现在的位置: 首页 > 综合 > 正文

php导出excel word表格 实例(一)

2013年10月10日 ⁄ 综合 ⁄ 共 3399字 ⁄ 字号 评论关闭

<? session_start();
if ($_SESSION['Company']==''){
 //exit;
}

$path = dirname(__FILE__);
require_once($path.'/../../Module/Factory.php');

$Factory = new Factory();
$BLL_Goods = $Factory->FactoryGoods();
$Goods=new Goods();
$Goods->BarCode=$_POST['GoodsID'];
$Goods->Product->BarCode=$_POST['ProductID'];
if($_SESSION['StationTitle']==''){
$Goods->Station->ID = $_SESSION['Station'];
}
else {
 $Goods->Station->ID = $_POST['StationID'];
}
$Goods->State->ID=$_POST['StateID'];
$Page=new Page();
if ($_GET['Page']=='')
{
 $Page->Page=0;
}
else
{
 $Page->Page=$_GET['Page'];
}
$Page->Pager=15;
$GoodsList=$BLL_Goods-> PageScanGoods( $Goods,$Page);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<link href="goods.css" rel="stylesheet" type="text/css" />
</head>

<body>

<div class="W500">
 <div class="Title">物品列表</div>
    <div class="ListTitle">
     <div class="Items1" style="width:100px">物品条码</div>
     <div class="Items1" style="width:200px">所属产品</div>
        <div class="Items1" style="width:100px">入库时间</div>
        <div class="Items1" style="width:50px">租金/天</div>
        <div class="Items1" style="width:100px">物品价格</div>
        <div class="Items1" style="width:70px">物品状态</div>
        <div class="Items1" style="width:80px">所在地点</div>
    </div>
    <?
    if (count($GoodsList)!=0) {
     foreach ($GoodsList as $Goods){
      $Station = new Station();
      $Station->ID = $Goods->Station->ID;
      $Station = $BLL_Goods->GetStation($Station);
      $State=new State();
      $State->ID=$Goods->State->ID;
      $State=$BLL_Goods->GetState($State);
      $Product=new Product();
      $Product->BarCode= $Goods->Product->BarCode;
      $Product=$BLL_Goods->GetProduct($Product);
 ?>
    <div class="List" onmouseover="this.className='ListB'" onmouseout="this.className='List'">
     <div class="Items1" style="width:100px"><?echo $Goods->BarCode?></div>
     <div class="Items1" style="width:200px; color:#FF0000"><?echo $Goods->Product->BarCode.'→'.$Product->Title?></div>
        <div class="Items1" style="width:100px"><?echo date('Y年m月d日',$Goods->EntTime)?></div>
        <div class="Items1" style="width:50px"><?echo $Product->Hire ?>元</div>
        <div class="Items1" style="width:100px"><?echo $Product->Price ?>元</div>
        <div class="Items1" style="width:70px"><?echo $State->Title ?></div>
        <div class="Items1" style="width:80px"><?echo $Station->Title ?></div>
    
  </div>
    <?
     }
    }
    ?>
    <div class="Page">
    <?echo $Page->Page+1?>页/<?echo $Page->MaxPage+1?>页
    <?
    if ($Page->Page==0)
    {
     echo '首页';
     
    }
    else
    {
     echo ' <a href="CheckGoodsok.php?Page=0">首页</a>';
    }
    ?>
   
  
    <?if ($Page->Page>0) {?>
     <a href="CheckGoodsok.php?Page=<?echo $Page->Page-1?>">上一页</a> 
    <?
    }
    else {
     echo '上一页';
    }
    ?>
    <?if ($Page->Page<$Page->MaxPage) {?>
    <a href="CheckGoodsok.php?Page=<?echo $Page->Page+1?>">下一页</a> 
    <?
 }
 else {
  echo '下一页';
 }
 ?>
 <?
    if ($Page->Page==$Page->MaxPage)
    {
     
     echo '尾页';
    }
    else
    {
     echo '<a href="CheckGoodsok.php?Page='.$Page->MaxPage.'">尾页</a>';
    }
   
 ?>
   
    共<?echo $Page->Sum?>条记录
    </div>
</div>
<a href="CheckGoodsToExcel.php?GoodsID=<?echo $_POST['GoodsID']?>&ProductID=<?echo $_POST['ProductID']?>&Station=<?echo $_POST['Station']?>&StateID=<?echo $_POST['StateID']?>">导出Excel表格</a>
</body>
</html>
<script language="javascript">
function Del()
{
 if(!confirm('真的要删除这个产品吗?')) {
  return false;
 }
}
</script>

抱歉!评论已关闭.