查看文件: percentall.php
大小: 12.41 KB
类型: application/octet-stream
<?php require('system/login.php'); ?> <?php require_once('../Connections/BE2.php'); ?> <?php if (isset($_GET['check_id'])) { // $deleteSQL = sprintf("DELETE FROM member WHERE mem_auto = %s",$_GET['check_id']); // mysql_select_db($database_BE2, $BE2); // $Result1 = mysql_query($deleteSQL, $BE2) or die(mysql_error()); } if(isset($_POST['mmsend'])&& $_POST['mmsend']=='form1'){ $ar=array(); $ar1=array(); $a=explode(',',$_POST['ostate']); $b=explode(',',$_POST['idval']); for($i=0;$i<count($a);$i++){ $ar[$i][1]=$b[$i]; $ar[$i][2]=$a[$i]; $ar[$i][3]=$a[$i]; $ar1[$i]=$b[$i]; } if(isset($_POST['ck'])){ if (is_array($_POST['ck'])) { foreach($_POST['ck'] as $value){ // echo $value.","; $key = array_search($value, $ar1); $ar[$key][3]='Y'; } } } else{ for($i=0;$i<count($a);$i++){ $ar[$i][3]='N'; } } for($i=0;$i<count($a);$i++){ //echo $i.'>'.$ar[$i][2].'>'.$ar[$i][3].'<br>'; if($ar[$i][2]<>$ar[$i][3]){ if($ar[$i][3]=='Y'){ $pbank='pall';}else{$pbank='0'; } $update1=sprintf("update order_permoon set pmpay='%s',pbank=%s WHERE pmid='%s'",$ar[$i][3],$pbank,$ar[$i][1]); mysql_select_db($database_BE2, $BE2); mysql_query($update1, $BE2) or die(mysql_error()); // echo $update1.'<br><br>'; } } } if(isset($_POST['d1'])&& $_POST['d1']=='formnext'){ include "premoon_up.php"; } if(isset($_POST['d2'])&& $_POST['d2']=='formclean'){ include "premoon_up.php"; } $currentPage = $_SERVER["PHP_SELF"]; $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(pmoon) as mm FROM order_permoon where 1 order by pmoon desc" ; $Rt1 = mysql_query($query_Rt1, $BE2) or die(mysql_error()); $row_Rt1 = mysql_fetch_assoc($Rt1); $totalRows_Rt1=mysql_num_rows($Rt1); if($row_Rt1==0){ $mm_now='2024-02'; $mm_new='2024-02'; $mm = '2024-02'; }else{ $mm_now=$row_Rt1['mm']; $y=substr($mm_now,0,4); $m=substr($mm_now,5,2); $mm_new=date("Y-m", mktime(0,0,0,$m+1,1,$y)); // $mm_last=date("Y-m", mktime(0,0,0,$m-+1,1,$y)); } $mm=$mm_now; if (isset($_GET['mm'])) { $mm = $_GET['mm']; } /* mysql_select_db($database_BE2, $BE2); $query_Rt2 = sprintf("SELECT a.*,b.dcode,b.p_money,b.p_count,c.p_title,d.scode,d.mem_user2,d.m_bankname,d.m_bankcode,d.m_bank,d.m_bank2 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",$mm.'%') ; $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); */ //echo $query_Rt2; $sdate=$mm; //$sdate2=date("Y-m-d", mktime(0,0,0,$m-1,31,$y)); //$query_Rt2 = sprintf("SELECT a.pmoon,a.puid,a.pmoney,a.pnow,a.pall,a.pall,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.puid=d.mem_auto AND a.pmoon='%s' group by a.puid ORDER BY a.puid",$sdate); $query_Rt2 = 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.puid=d.mem_auto AND a.pmoon='%s' group by a.puid ORDER BY a.puid",$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); $Rt2 = mysql_query($query_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); ?> <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> <table border="0" cellpadding="1"> <tr> <td>月份<select name="selmoon" id="selmoon" onchange="MM_jumpMenu('self',this,0)"> <? $ostate=''; $idval=''; do{?> <option value="<?php printf("%s?act=percentall&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></td> <td><a href="excel_precent.php?sdate=<?= $mm; ?>"><button type="button" class="btn blue" > 明細下載</button></a></td> <td><a href="excel_precent2.php?sdate=<?= $mm; ?>"><button type="button" class="btn blue" > 加總下載</button></a></td> <td> </td> <td><form action="" method="post" name="formup" ><input name="i1" type="submit" value="結轉<?= $mm_now ?>資料"> <input name="d" id="d" type="hidden" value="<?= $mm_new; ?>" /> <input name="d1" id="d1" type="hidden" value="formnext" /> </form> </td> <td> </td> <td><form action="" method="post" name="formclean" ><input name="il1" type="submit" value="重整<?= $mm_now ?>資料"> <input name="d" id="d" type="hidden" value="<?= $mm_now; ?>" /> <input name="d2" id="d2" type="hidden" value="formclean" /> </form> </td> <td> </td> </tr> </table><strong><strong><strong><strong></strong></strong></strong></strong> <form action="" method="post" name="form1" > <table border="0" cellpadding="2" cellspacing="2" style="font-size:14px"> <tr> <th height="28" nowrap>會員</th> <th nowrap>會員姓名</th> <th nowrap>上月餘額</th> <th nowrap>本月金額</th> <th nowrap>金額</th> <th nowrap>所得稅10%</th> <th nowrap>平台服務費5%</th> <th nowrap>金流服務費2.8%</th> <th nowrap>應發獎金</th> <th nowrap>單據月份</th> <th nowrap>匯款戶名</th> <th nowrap>匯款銀行</th> <th nowrap>銀行代碼</th> <th nowrap>匯款帳號</th> <th nowrap>證件資料</th> <th nowrap>全選 <input name="ckall" id="ckall" type="checkbox" value="Y" onclick="check_all(this,'ck[]')" /></th> </tr> <tr> <td height="3" colspan="21" background="images/dot3.gif"></td> </tr> <?php // $pp1=array("",'推廣獎金','開發獎金','首次開店獎金'); 直銷獎金 $pp1=array("",'推廣獎金','開發獎金','開發商首推獎金','商品未付餘額','開發商續推獎金','直銷獎金'); $i=0; do { $i++; ?> <tr onMouseOver="this.style.backgroundColor='#2172A1';" onMouseOut=this.style.backgroundColor="#fff"> <td height="27"><a href="/ecard/<?= $row_Rt2['scode']; ?>" target="_blank"><?= $row_Rt2['scode']; ?></a></td> <td height="27"><?= $row_Rt2['mem_user2']; ?></td> <td align="center"><?= $row_Rt2['pmoney']; ?></td> <td align="center"><?= $row_Rt2['pnow']; ?></td> <td align="center"><?= $row_Rt2['pall']; ?></td> <td align="center"><?= ($row_Rt2['pall']>0)?($row_Rt2['pall']*0.10):'0'; ?></td> <td align="center"><?= ($row_Rt2['pall']>0)?($row_Rt2['pall']*0.05):'0'; ?></td> <td align="center"><?= ($row_Rt2['pall']>0)?($row_Rt2['pall']*0.028):'0'; ?></td> <td align="center"><?= ($row_Rt2['pall']>0)? $row_Rt2['pall']-($row_Rt2['pall']*0.178):'0'; ?></td> <td align="center"><?= $row_Rt2['pmoon']; ?></td> <td align="center"><?= $row_Rt2['m_bankname']; ?></td> <td align="center"><?= $row_Rt2['m_bank']; ?></td> <td align="center"><?= $row_Rt2['m_bank2']; ?></td> <td align="center"><?= $row_Rt2['m_bankcode']; ?></td> <td align="center"><a href="https://www.skybni.com/guest/profiledoc.php?id=<?= $row_Rt2['scode']; ?>">證件資料</a></td> <td align="center"> 已結清 <? $ostate .= $row_Rt2['pmpay'].','; $idval .= $row_Rt2['pmid'].','; ?> <input name="ck[]" id="ck<?= $i ?>" type="checkbox" value="<?= $row_Rt2['pmid']; ?>" <?= ($row_Rt2['pmpay']=='Y')?'checked="checked"':'';?> /> <input name="ckid<?= $i; ?>" id="ckid<?= $i; ?>" type="hidden" value="<?= $row_Rt2['pmid']; ?>" /> <input name="oldck<?= $i; ?>" id="oldck<?= $i; ?>" type="hidden" value="<?= $row_Rt2['pmpay']; ?>" /> </td> </tr> <tr> <td height="2" colspan="16" background="images/dot3.gif"></td> </tr> <?php } while ($row_Rt2 = mysql_fetch_assoc($Rt2)); $rowcount=$i; ?> <tr> <td colspan="16" align="center"><? ; if($mm_now==$mm){ ?><input name="" type="submit" /><? }else{ echo '本月份不可結清';}?></td> </tr> <tr> <td colspan="16"> <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> <input name="ostate" type="hidden" value="<?= substr($ostate,0,-1); ?>" /> <input name="idval" type="hidden" value="<?= substr($idval,0,-1); ?>" /> <input name="mmsend" type="hidden" value="form1" /> </form> <script type="text/javascript"> function check_all(obj,cName) { var checkboxs = document.getElementsByName(cName); for(var i=0;i<checkboxs.length;i++){checkboxs[i].checked = obj.checked;} } </script> <?php mysql_free_result($Rt2); ?>
保存
取消
返回文件列表