查看文件: excel_precent.php
大小: 2.88 KB
类型: application/octet-stream
<?php require('system/login.php'); ?> <?php require_once('../Connections/BE2.php'); ?> <?php $sdate=date('Y-m'); if (isset($_GET['sdate'])) { $sdate = $_GET['sdate']; } $sdate0=$sdate.'-15'; $y=substr($sdate0,0,4); $m=substr($sdate0,5,2); $sdatex=date("Y-m", mktime(0,0,0,$m-1,1,$y)); //$sdate2=date("Y-m-d", mktime(0,0,0,$m-1,31,$y)); $query_Rt2 = sprintf("SELECT a.*,b.dcode,b.p_money,b.p_count,c.p_title,d.scode,d.mem_user2,d.m_bankcode,d.m_bankname from order_percent as a, order_datas as b,product_data as c,member as d where a.ccid=b.ccid AND b.mem_auto=c.mem_auto AND a.puid=d.mem_auto AND a.pdate like '%s' ORDER BY a.pdate DESC",$sdate.'%') ; mysql_select_db($database_BE2, $BE2); $Rt2 = mysql_query($query_Rt2, $BE2) or die(mysql_error()); $row_Rt2 = mysql_fetch_assoc($Rt2); header('Content-type:application/vnd.ms-excel'); //宣告網頁格式 header('Content-Disposition: attachment; filename='.$sdate.'會員獎金報表.xls'); //設定檔案名稱 ?> <html> <head> <meta charset="UTF-8"> </head> <body> <? echo '獎金交易日期為: '.$sdate .'月份'; ?> <table border="0" cellpadding="2" cellspacing="2"> <tr> <th height="28" nowrap>會員</th> <th nowrap>會員姓名</th> <th nowrap>訂單編號</th> <th nowrap>交易日期</th> <th nowrap>推廣/開發</th> <th nowrap>商品金額</th> <th nowrap>商品數量</th> <th nowrap>獎金金額</th> <th nowrap>未繳商品餘額</th> <th nowrap>支付月份</th> <th nowrap>入帳銀行</th> <th nowrap>入帳戶名</th> </tr> <?php $pp1=array("",'推廣獎金','開發獎金','開發商首推獎金','商品未付餘額','開發商續推獎金','銷售獎金'); $i=0; do { $i++; ?> <tr> <td height="27">'<?= $row_Rt2['scode']; ?> </td> <td height="27"><?= $row_Rt2['mem_user2']; ?></td> <td>'<?= $row_Rt2['dcode']; ?></td> <td><?= $row_Rt2['pdate']; ?></td> <td><?= $pp1[$row_Rt2['pkid']] ?></td> <td><?= $row_Rt2['p_money']; ?></td> <td nowrap="nowrap"><?= $row_Rt2['p_count']; ?></td> <td align="center"><?= $row_Rt2['pmoney']; ?></td> <td align="center"><?= $row_Rt2['depmoney']; ?></td> <td align="center"><? $ndate=strtotime($row_Rt2['pdate']); $pndate=date('Y-m-d' , mktime(0, 0, 0, date('m') + 1, 15, date('Y'))); echo $pndate; ?></td> <td align="center"><? $row_Rt2['m_bankcode']; ?></td> <td align="center"><? $row_Rt2['m_bankname']; ?></td> </tr> <?php } while ($row_Rt2 = mysql_fetch_assoc($Rt2)); ?> <tr> <td colspan="12"></td> </tr> </table> </body> </html> <?php mysql_free_result($Rt2); ?>
保存
取消
返回文件列表