if($_POST['Q_User']!="") $sqlWhere.=" and a2.data_19 like '%".$_POST['Q_User']."%'";if($_POST['Q_Run_OA']!="") $sqlWhere.=" and a1.run_id=".$_POST['Q_Run_OA']."";if($_POST['Q_CostName']!="") $sqlWhere.=" and a1.CostName like '%".$_POST['Q_CostName']."%'";$OperateTime1 = $_POST['OperateTime1'];$OperateTime2 = $_POST['OperateTime2'];if($OperateTime1 !="" && $OperateTime2 !=""){ $EXCEL_OUT = array("OA流水号", "申请人", "开始时间","执行时间","执行月份","活动名称","客户","序号","费用名称","申请金额","审批金额","使用开始","使用结束","已执行金额"); if($_GET['Type'] =='2003') include_once( "../OX/PHPExcel/ExcelWriter2003.php" ); if($_GET['Type'] =='2007') include_once( "../OX/PHPExcel/ExcelWriter2007.php" ); $objExcel = new ExcelWriter(); $objExcel->setFileName("执行单明细列表"); $objExcel->setTitle("执行单明细"); $objExcel->addHead( $EXCEL_OUT ); $COUNT=0; $sqlStr=" select a1.run_id,a1.FID,a1.OperateTime,a1.RunMonth,a1.OperateNum,a2.run_name,a2.begin_time,a2.data_5,a2.data_19,a2.data_38,a2.data_49,T1.CostMxIndex,T1.CostNum,T1.CostCheckNum,T1.CostName,T1.BeginDate,T1.EndDate from dbo.CS_SaleCostOperate a1 left join dbo.CS_SaleCostInfo a2 on a1.run_ID =a2.run_id left join dbo.CS_SaleCostMx T1 on a1.run_ID=T1.run_id and a1.FID=T1.ID where a1.OperateTime between '$OperateTime1 00:00:00' and '$OperateTime2 23:59:00' $sqlWhere order by a1.OperateTime"; $rs=$conn->execute($sqlStr); while(! $rs->eof) { ++$COUNT; $run_id=$rs->Fields['run_id']->Value; $SupplyName=$rs->Fields['data_19']->Value; $begin_time=$rs->Fields['begin_time']->Value; if(is_null($rs->Fields['OperateTime']->Value)) { $OperateTime=''; } else { $OperateTime=$rs->Fields['OperateTime']->Value; } if(is_null($rs->Fields['RunMonth']->Value)) { $RunMonth=''; } else { $RunMonth=$rs->Fields['RunMonth']->Value; } if(is_null($rs->Fields['run_name']->Value)) { $run_name=''; } else { $run_name=$rs->Fields['run_name']->Value; } if(is_null($rs->Fields['data_5']->Value)) { $ShopName=''; } else { $ShopName=$rs->Fields['data_5']->Value; } if(is_null($rs->Fields['CostMxIndex']->Value)) { $CostMxIndex=''; } else { $CostMxIndex=$rs->Fields['CostMxIndex']->Value; } if(is_null($rs->Fields['CostName']->Value)) { $CostMxName=''; } else { $CostMxName=$rs->Fields['CostName']->Value; } if(is_null($rs->Fields['CostNum']->Value)) { $CostNum=''; } else { $CostNum=$rs->Fields['CostNum']->Value; } if(is_null($rs->Fields['CostCheckNum']->Value)) { $CostCheckNum=''; } else { $CostCheckNum=$rs->Fields['CostCheckNum']->Value; } if(is_null($rs->Fields['BeginDate']->Value)) { $BeginDate=''; } else { $BeginDate=$rs->Fields['BeginDate']->Value; } if(is_null($rs->Fields['EndDate']->Value)) { $EndDate=''; } else { $EndDate=$rs->Fields['EndDate']->Value; } if(is_null($rs->Fields['OperateNum']->Value)) { $OperateNum=''; } else { $OperateNum=$rs->Fields['OperateNum']->Value; } $EXCEL_OUT ="{$run_id},{$SupplyName},{$begin_time},{$OperateTime},{$RunMonth},{$run_name},{$ShopName},{$CostMxIndex},{$CostMxName},{$CostNum},{$CostCheckNum},{$BeginDate},{$EndDate},{$OperateNum}"; $objExcel->addRow( $EXCEL_OUT ); $rs->MoveNext(); } $rs->close(); unset($EXCEL_OUT); $objExcel->Save();}else{ echo "时间段不能为空!";}
添加回答
举报
0/150
提交
取消