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流水號(hào)", "申請(qǐng)人", "開(kāi)始時(shí)間","執(zhí)行時(shí)間","執(zhí)行月份","活動(dòng)名稱","客戶","序號(hào)","費(fèi)用名稱","申請(qǐng)金額","審批金額","使用開(kāi)始","使用結(jié)束","已執(zhí)行金額"); 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("執(zhí)行單明細(xì)列表"); $objExcel->setTitle("執(zhí)行單明細(xì)"); $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 "時(shí)間段不能為空!";}
- 1 回答
- 0 關(guān)注
- 1728 瀏覽
添加回答
舉報(bào)
0/150
提交
取消