查看文件: dayreports.php
大小: 9.36 KB
类型: application/octet-stream
<?php require('system/login.php'); ?> <?php require_once('../Connections/BE2.php'); ?> <?php $currentPage =$_SERVER["PHP_SELF"]; // 'percents1.php' ;// $maxRows_Rt2 = 25; $pageNum_Rt2 = 0; if (isset($_GET['pageNum_Rt2'])) { $pageNum_Rt2 = $_GET['pageNum_Rt2']; } $startRow_Rt2 = $pageNum_Rt2 * $maxRows_Rt2; $colname_Rt2 = "-1"; if (isset($_GET['keyword'])) { $colname_Rt2 = $_GET['keyword']; } mysql_select_db($database_BE2, $BE2); $query_Rt1 = "SELECT distinct(ddate) as dd FROM order_datam where 1 order by ddate desc" ; $Rt1 = mysql_query($query_Rt1, $BE2) or die(mysql_error()); $row_Rt1 = mysql_fetch_assoc($Rt1); $dd = $row_Rt1['dd']; if (isset($_GET['dd'])) { $dd = $_GET['dd']; } $download='N'; if(isset($_GET['file']) && ($_GET['file']=='Y')){ $download='Y'; } mysql_select_db($database_BE2, $BE2);//完整內容 /* p_percent 推廣獎金 p_percent2 開發獎金 p_percent3 首次開店獎金 p_percent4 推廣雲點 p_percent5 開發雲點 p_percent6 開發商續推獎金 p_percent7 經銷獎金 p_percent8 分享獎金 p_percent9 推薦獎金 */ $query_Rt2 = sprintf("SELECT a.dcode,a.ddate,a.dexpess,a.dall,a.dflag,a.dsky,a.dcash,a.dpay,a.dbank,d.scode,d.mem_name,d.mem_mobile, d.mem_mail,b.p_count,b.p_money,b.p_percent,b.p_percent6,b.p_percent7,c.p_title,e.company_name,f.billcode FROM order_datam as a,order_datas as b,product_data as c,member as d,company as e,order_bill as f where a.duser=d.mem_auto AND a.coid=e.coid AND a.dcode=b.dcode AND a.dcode=f.dcode AND b.mem_auto=c.mem_auto AND a.ddate = '%s' ORDER BY a.dcode",$dd); $query_limit_Rt2 = sprintf("%s LIMIT %d, %d", $query_Rt2, $startRow_Rt2, $maxRows_Rt2); if($download=='Y'){ $Rt2 = mysql_query($query_Rt2, $BE2) or die(mysql_error()); } else{ $Rt2 = mysql_query($query_limit_Rt2, $BE2) or die(mysql_error()); } $row_Rt2 = mysql_fetch_assoc($Rt2); // echo $query_Rt2; if (isset($_GET['totalRows_Rt2'])) { $totalRows_Rt2 = $_GET['totalRows_Rt2']; } else { $all_Rt2 = mysql_query($query_Rt2); $totalRows_Rt2 = mysql_num_rows($all_Rt2); } $totalPages_Rt2 = ceil($totalRows_Rt2/$maxRows_Rt2)-1; $queryString_Rt2 = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_Rt2") == false && stristr($param, "totalRows_Rt2") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_Rt2 = "&" . htmlentities(implode("&", $newParams)); } } $queryString_Rt2 = sprintf("&totalRows_Rt2=%d%s", $totalRows_Rt2, $queryString_Rt2); if($download=='Y'){ header('Content-type:application/vnd.ms-excel'); //宣告網頁格式 header('Content-Disposition: attachment; filename='.$dd.'日報表-訂單數據.xls'); //設定檔案名稱 } ?> <div class="row"> <div class="col-md-12"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">日報表-訂單數據</h3> </div> <div style="overflow-x: scroll;"> <? if($download=='N'){ ?> 日期 <select name="selmoon" id="selmoon" onchange="MM_jumpMenu('self',this,0)"> <? do{?> <option value="<?php printf("%s?act=dayreports&dd=%s", $currentPage, $row_Rt1['dd']); ?>" <? if($dd==$row_Rt1['dd']){ ?>selected="selected" <? }?>><?= $row_Rt1['dd'] ;?></option> <?php } while ($row_Rt1 = mysql_fetch_assoc($Rt1)); ?> </select> <a href="dayreports.php?dd=<?= $dd; ?>&file=Y"><button type="button" class="btn blue" > EXCEL 明細下載</button></a> <? } ?> <table <?= ($download=='Y')?'border="1" ':''; ?>cellspacing="1" class="table table-small-font table-bordered table-striped"> <tr> <th width="76" height="28" nowrap>訂單編號</th> <th width="76" nowrap>訂單日期</th> <th width="117" nowrap> 購買人 (姓名) </th> <th width="132" nowrap>購買人 (會員ID)</th> <th width="150" nowrap>購買人(電話號碼) </th> <th width="164" nowrap> 商家名稱(商店編號)</th> <th width="76" nowrap>商品清單</th> <th width="95" nowrap>商品種類數</th> <th width="95" nowrap>訂單總金額</th> <th width="76" nowrap>物流費用</th> <th width="152" nowrap>使用點數折抵金額</th> <th width="95" nowrap>淨付款金額</th> <th width="95" nowrap>交易手續費</th> <th width="76" nowrap>付款方式</th> <th width="76" nowrap>訂單狀態</th> <th width="76" nowrap>發票號碼</th> <th width="76" nowrap>銷售獎金</th> <th width="76" nowrap>經銷獎金</th> <th width="95" nowrap>加盟回饋金</th> <th width="76" nowrap> </th> </tr> <?php if($totalRows_Rt2>0){ $pay_ar=array("","信用卡線上刷卡","超商取貨付款","臨櫃匯款","ATM轉帳"); //dpay $pp1=array("",'推廣獎金','開發獎金','開發商首推獎金','商品未付餘額','開發商續推獎金','銷售獎金'); $i=0; do { $i++; ?> <tr onMouseOver="this.style.backgroundColor='#CCC';" onMouseOut=this.style.backgroundColor="#fff"> <td height="47" align="center" nowrap="nowrap"><span style="color: #06F;"> <?= $row_Rt2['dcode']; ?> </span></td> <td height="47" align="center" nowrap="nowrap"><?= $row_Rt2['ddate']; ?></td> <td align="center" nowrap="nowrap"><?= $row_Rt2['mem_name'] ?></td> <td align="center" nowrap="nowrap"><?= $row_Rt2['scode'] ?></td> <td align="center" nowrap="nowrap"><?= $row_Rt2['mem_mobile'] ?></td> <td align="center" nowrap="nowrap"><?= $row_Rt2['company_name'] ?></td> <td align="center" nowrap="nowrap"><?= $row_Rt2['p_title'] ?></td> <td align="center" nowrap="nowrap"><?= $row_Rt2['p_count'] ?></td> <td align="center" nowrap="nowrap"><?= $row_Rt2['dall'] ?></td> <td align="center" nowrap="nowrap"><?= $row_Rt2['dexpess'] ?></td> <td align="center" nowrap="nowrap"><?= $row_Rt2['dsky'] ?></td> <td align="center" nowrap="nowrap"><?= $row_Rt2['dcash'] ?></td> <td align="center" nowrap="nowrap"><?= $row_Rt2['dall']*0.03 ?></td> <td align="center" nowrap="nowrap"><?= $pay_ar[$row_Rt2['dpay']] ?></td><? ?> <td align="center" nowrap="nowrap"><?= $row_Rt2['dflag']=='Y'?'交易完成':'未付款' ?></td> <td align="center" nowrap="nowrap"><?= $row_Rt2['billcode']; ?></td> <td align="center" nowrap="nowrap"><?= $row_Rt2['p_percent']; ?></td> <td align="center" nowrap="nowrap"><?= $row_Rt2['p_percent7']; ?></td> <td align="center" nowrap="nowrap"><?= $row_Rt2['p_percent6']; ?></td> <td align="center" nowrap="nowrap"> </td> </tr> <?php } while ($row_Rt2 = mysql_fetch_assoc($Rt2)); } //if $totalRows_Rt2 ?> <? if($download=='N'){?> <tr> <td colspan="20" > <table width="697" border="0" align="left" cellpadding="0" cellspacing="0"> <tr> <td width="34%">總筆數:<?php echo $totalRows_Rt2 ?>筆 </td> <td width="66%"><div id="font_s"> <p> <?php if ($pageNum_Rt2 > 0) { // Show if not first page ?> <a href="<?php printf("%s?pageNum_Rt2=%d%s", $currentPage, max(0, $pageNum_Rt2 - 1), $queryString_Rt2); ?>"><img src="images/First.gif" alt="上一頁" title="上一頁" width="18" height="13" border="0" /></a> <?php } // Show if not first page ?> 第 <select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu('self',this,0)"> <? for($i=0;$i<=$totalPages_Rt2;$i++){?> <option value="<?php printf("%s?pageNum_Rt2=%d%s", $currentPage, $i, $queryString_Rt2); ?>" <? if($pageNum_Rt2==$i){ ?>selected="selected" <? }?>><? echo $i+1 ;?></option> <? }?> </select> 頁 <?php //分頁程式 if($totalPages_Rt2<9){ $start=0; $end=$totalPages_Rt2; }else{ $start=$pageNum_Rt2-5; $end=$pageNum_Rt2+5; if ($start<0){ $start=0; $end=10; } else { $end=$start+10 ;} if ($end>$totalPages_Rt2){ $start = $end-$totalPages_Rt2-5; $end=$totalPages_Rt2; } if ($end-$start>10){ $start = $end-10; } } for($i=$start;$i<=$end;$i++){ if($i==$pageNum_Rt2){ echo "[".($i+1)."]";} else {?> <a href="<?php printf("%s?pageNum_Rt2=%d%s", $currentPage, min($totalPages_Rt2, $i), $queryString_Rt2); ?>"> <? echo $i+1 ;?></a> <? } } ?> <?php if ($pageNum_Rt2 < $totalPages_Rt2) { // Show if not last page ?> <a href="<?php printf("%s?pageNum_Rt2=%d%s", $currentPage, min($totalPages_Rt2, $pageNum_Rt2 + 1), $queryString_Rt2); ?>"><img src="images/Next.gif" alt="下一頁" title="下一頁" width="14" height="13" border="0" /></a> <?php } // Show if not last page ?> </p> </div></td> </tr> </table> </td> </tr> <? } ?> </table> </div> </div> </div> </div> <?php mysql_free_result($Rt1); mysql_free_result($Rt2); ?>
保存
取消
返回文件列表