查看文件: body_percentpoint.php
大小: 12.46 KB
类型: application/octet-stream
<?php require_once('../Connections/BE2.php'); ?> <?php mysql_select_db($database_BE2, $BE2); $query_Rt1 = "SELECT distinct(SUBSTRING(pdate, 1, 7)) as mm FROM order_percent where 1 order by pdate desc" ; $Rt1 = mysql_query($query_Rt1, $BE2) or die(mysql_error()); $row_Rt1 = mysql_fetch_assoc($Rt1); $mm = $row_Rt1['mm']; if (isset($_GET['mm'])) { $mm = $_GET['mm']; } $currentPage = "percentpoint.html";//$_SERVER["PHP_SELF"]; $maxRows_Rt2 = 10; $pageNum_Rt2 = 0; if (isset($_GET['pageNum_Rt2'])) { $pageNum_Rt2 = $_GET['pageNum_Rt2']; } $startRow_Rt2 = $pageNum_Rt2 * $maxRows_Rt2; mysql_select_db($database_BE2, $BE2); $query_Rt2 = sprintf("SELECT a.*,b.dcode,b.p_money,b.p_count,c.p_title from order_percent as a, order_datas as b,product_data as c where a.ccid=b.ccid AND b.mem_auto=c.mem_auto AND a.pdate like '%s' AND a.puid='%s' ORDER BY a.pdate DESC",$mm.'%',$_SESSION['login_memid']); $query_limit_Rt2 = sprintf("%s LIMIT %d, %d", $query_Rt2, $startRow_Rt2, $maxRows_Rt2); $Rt2 = mysql_query($query_limit_Rt2, $BE2) or die(mysql_error()); $row_Rt2 = mysql_fetch_assoc($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, "menu") == 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); mysql_select_db($database_BE2, $BE2); $query_Rta3 = "SELECT * FROM pptname order by pt1" ; $Rta3 = mysql_query($query_Rta3, $BE2) or die(mysql_error()); $row_Rta3 = mysql_fetch_assoc($Rta3); $totalRows_Rta3 = mysql_num_rows($Rta3); $pp1=array(); $pp1[0]=""; $i=0; do { $i++; $pp1[$i]=$row_Rta3['pdoc']; } while ($row_Rta3 = mysql_fetch_assoc($Rta3)); mysql_free_result($Rta3); ?> <!-- start: Content --> <div class="main "> <div class="row"> <div class="col-lg-12"> <h3 class="page-header"><i class="fa fa-indent"></i>推廣奨金</h3> <ol class="breadcrumb"> <li><i class="fa fa-home"></i><a href="index.html">首頁</a></li> <li><i class="fa fa-list-alt"></i><a href="#">雲點數</a></li> <li><i class="fa fa-indent"></i>推廣奨金</li> </ol> </div> </div> <div class="row"> <div class="col-md-12"> <div class="panel panel-default"> <div class="panel-heading"> <h2><i class="fa fa-list red"></i><span class="break"></span><strong>奨金記錄清單</strong></h2> </div> <div class="panel-body"> <h3 class="panel-title"> </h3> <div class="clearfix"></div> <script type="text/javascript"> function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } </script> <div class="col-2"> </div> <div class="col-4"> <select name="selmoon" id="selmoon" class="form-control col-4" onchange="MM_jumpMenu('self',this,0)"> <? do{?> <option value="<?php printf("%s?mm=%s", $currentPage, $row_Rt1['mm']); ?>" <? if($mm==$row_Rt1['mm']){ ?>selected="selected" <? }?>><?= $row_Rt1['mm'] ;?> 獎金月份</option> <?php } while ($row_Rt1 = mysql_fetch_assoc($Rt1)); ?> </select> <a href="excel_percentpoint.php?sdate=<?= $mm; ?>"><button type="button" class="btn blue" > 明細下載</button></a> </div> <div style="overflow:scroll;"> <table class="table table-striped table-bordered bootstrap-datatable" style="min-width:700px;"> <thead> <tr class="replace-inputs"> <th class="center">#</th> <th align="center" nowrap="nowrap">訂單號</th> <th align="center">訂單日期</th> <th align="center">商品說明</th> <th align="center">商品金額</th> <th align="center">數量</th> <th align="center">推廣/經銷</th> <th align="center">金額</th> <th align="center">未繳商品餘額</th> <? /* <th align="center">已申請</th> */ ?> </tr> </thead> <tbody> <?php // 1 2 3 4 5 6 7 new 8 9 // $pp1=array("",'推廣獎金','經銷獎金','開發商首推獎金','商品未付餘額','開發商續推獎金','銷售獎金','獎金支付','分享獎金','推薦獎金'); new 241209 to sql tablename pptname // 1 2 分享獎金<=經銷獎金 3 4 5 6 7 8 9 10 11 12 // $pp1=array("",'推廣獎金','經銷獎金','開發商首推獎金','商品未付餘額','開發商續推獎金','銷售獎金','經銷獎金','分享獎金','推薦獎金','暫無','暫無','暫無','獎金支付'); // ($row_Rt2['pkid']==2)?'開發獎金':'推廣獎金' $pmoney=0; $demoney=0; if($totalRows_Rt2>0){ $i=0; do { $i++; $pmoney = $pmoney+$row_Rt2['pmoney']; $demoney = $demoney+$row_Rt2['depmoney']; ?> <tr> <td class="center"><?= $i ?></td> <td><?= $row_Rt2['dcode'] ?></td> <td><?= $row_Rt2['pdate'];?></td> <td><?= $row_Rt2['p_title'];?></td> <td align="right"><?= $row_Rt2['p_money'];?></td> <td align="right"><?= $row_Rt2['p_count'];?></td> <td align="right"><?= $pp1[$row_Rt2['pkid']] ;?></td> <td align="right"><?= $row_Rt2['pmoney']; ?></td> <td align="right"><?= $row_Rt2['depmoney']; ?></td> </tr> <?php } while ($row_Rt2 = mysql_fetch_assoc($Rt2)); ?> <tr> <td class="center"> </td> <td>本頁累計</td> <td> </td> <td> </td> <td align="right"> </td> <td align="right"> </td> <td align="right"> </td> <td align="right"><?= $pmoney; ?></td> <td align="right"><?= $demoney ?></td> </tr> <? } ?></tbody> </table> <div class="form-group form-actions col-md-6 "> 發放推廣獎金申請,根據申請當下幾月,會在下一個月15號錢匯入指定帳戶(例如1月申請,在1月底的時候會有總表出來,在2月15之前會匯入指定帳戶) </div> <? /* if($pmoney<0){?> <div class="form-group form-actions col-md-5 "> <input type="button" name="Sub1" value="申請提領獎金" class="btn btn-3d btn-black btn-md" onclick="location.href='percent2cash.html'"> </div> <div class="form-group form-actions col-md-5"> <input type="button" name="Sub2" value="獎金轉入雲點數" class="btn btn-3d btn-black btn-md" onclick="location.href='percent2point.html'"> 轉為雲點數將無法再轉為獎金</div> <? } */ ?> <ul class="pagination"> <? if( $totalPages_Rt2 >0){ //分頁程式 if($totalPages_Rt2<5){ $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; } } ?> <?php if ($pageNum_Rt2 > 0) { // Show if not first page ?> <li><a href="<?php printf("%s?pageNum_Rt2=%d%s", $currentPage, max(0, $pageNum_Rt2 - 1), $queryString_Rt2); ?>">上一頁</a></li><?php } // Show if not first page ?> <? for($i=$start;$i<=$end;$i++){ if($i==$pageNum_Rt2){ echo '<li class="active"><a href="#">'.($i+1).'</a></li>';} else {?> <li><a href="<?php printf("%s?pageNum_Rt2=%d%s", $currentPage, min($totalPages_Rt2, $i), $queryString_Rt2); ?>"><? echo $i+1 ;?></a></li> <? } } ?> <?php if ($pageNum_Rt2 < $totalPages_Rt2) { // Show if not last page ?> <li><a href="<?php printf("%s?pageNum_Rt2=%d%s", $currentPage, min($totalPages_Rt2, $pageNum_Rt2 + 1), $queryString_Rt2); ?>">下一頁</a></li> <?php } } ?> </ul> </div> <? //$query_Rt3 = sprintf("SELECT a.*,d.scode,d.mem_user2,d.m_bankcode,d.m_bankname,d.m_bank,d.m_bank2 from order_permoon as a, member as d where a.pall>0 AND a.pmpay ='Y' AND a.puid=d.mem_auto AND a.puid='%s' group by a.puid ORDER BY a.puid",$_SESSION['login_memid']); //$sdate $query_Rt3 = sprintf("SELECT a.*,d.scode,d.mem_user2,d.m_bankcode,d.m_bankname,d.m_bank,d.m_bank2 from order_permoon as a, member as d where a.pmpay ='Y' AND a.puid=d.mem_auto AND a.puid='%s' ",$_SESSION['login_memid']); //$sdate // $query_Rt2 = sprintf("SELECT a.*,b.dcode,b.p_money,b.p_count,d.scode,d.mem_user2,d.m_bankcode,d.m_bankname from order_percent as a, order_datas as b,member as d where a.ccid=b.ccid AND a.puid=d.mem_auto AND a.pdate like '%s' ORDER BY a.pdate DESC",$sdate.'%') ; mysql_select_db($database_BE2, $BE2); $Rt3 = mysql_query($query_Rt3, $BE2) or die(mysql_error()); $row_Rt3 = mysql_fetch_assoc($Rt3); $totalRows_Rt3 = mysql_num_rows($Rt3); //echo $query_Rt3; if($totalRows_Rt3>0){ ?> <br><br>累計已發獎金 <table class="table table-striped table-bordered bootstrap-datatable" style="min-width:700px;"> <thead> <tr class="replace-inputs"> <th class="center">單據月份</th> <th class="center">應發獎金</th> <th class="center">所得稅10% </th> <th class="center">平台服務費5%</th> <th class="center">金流服務費2.8%</th> <th class="center">實發獎金</th> </tr> </thead> <tbody> <? $payall=0; do { ?> <tr> <td class="center"><?= $row_Rt3['pmoon']; ?></td> <td align="center"> <? $payall += $row_Rt3['pall']; echo $row_Rt3['pall']; ?></td> <td align="center"> <?= ($row_Rt3['pall']>0)?($row_Rt3['pall']*0.10):'0'; ?></td> <td align="center"> <?= ($row_Rt3['pall']>0)?($row_Rt3['pall']*0.05):'0'; ?></td> <td align="center"> <?= ($row_Rt3['pall']>0)?($row_Rt3['pall']*0.028):'0'; ?></td> <td align="center"> <?= ($row_Rt3['pall']>0)? $row_Rt3['pall']-($row_Rt3['pall']*0.178):'0'; ?></td> </tr> <?php } while ($row_Rt3 = mysql_fetch_assoc($Rt3)); ?> <tr> <td class="center"> </td> <td> </td> <td align="right"> </td> <td align="right">累計已發獎金</td> <td align="right">$ <?= $payall; ?></td> <td align="right"> </td> </tr> </tbody> </table> <? } ?> </div> </div> </div><!--/col--> </div><!--/row--> </div> <!-- end: Content -->
保存
取消
返回文件列表