📄 hza_ach.php
字号:
<?php////////////////////////////////////////////////////////// Author by Shuweich// Date : 2007.07.27// 建站支持: http://www.shuweich.net// 作者: Shuweich// QQ: 1502384// ICQ: 190492112// MSN: shuweich@hotmail.com// E-mail: root@shuweich.net// E-mail: shuweich@163.com// CMS交流站点: http://www.shuweich.net////////////////////////////////////////////////////////// 模块管理 by market// For 系统管理员(站长及经理)////////////////////////////////////////////////////////include '../../../include/cp_header.php';xoops_cp_header();include 'admhead.php';echo "<span style='font-size:18px;color:#8dff8d;'>重建业绩汇总</span><br />\n";if ( $_POST['Passed'] != 'sure' ) { $recre_sure = false; if ( !isset($_REQUEST['vok']) ) { echo "<form action='".$PHP_SELF."' method='post' name='c_sure'>\n"; echo "此举将清理业绩记录,再重新写入部分或全部会员的业绩记录;<br />重新写入之后须重新审核业绩,请谨慎为之!!!<br />\n"; echo "请输入您的姓名以确认此操作:<input type='text' name='cre_name' value='' />\n"; echo "<input type='hidden' name='vok' value='1' />\n"; echo "<input type='submit' value='确认' />\n"; echo "</form>\n"; xoops_cp_footer(); exit(); } else { $que = "select user_id,user_name from ".$xoopsDB->prefix("market_member")." where user_id=".$xoopsUser->uid()." limit 1"; list($u_id,$u_name) = $xoopsDB->fetchrow($xoopsDB->query($que)); if ( $_REQUEST['cre_name'] == $u_name ) $recre_sure = true; else { echo $_REQUEST['cre_name'].":请您用自己的帐户登录系统,谢谢合作!!\n"; xoops_cp_footer(); exit(); } }} else $recre_sure = true;## echo "在中途……<br />\n";if ( $recre_sure && isset($_REQUEST['cre_name']) ) { echo $_REQUEST['cre_name'].":您正在进行重新写入业绩操作,系统运行中,请不要关闭窗口。<br />\n 如系统长时间无反应,请您先联系管理员,再行处理,谢谢合作,祝工作愉快,好运常伴!!!!"; echo "\n<script language='javascript'> function rdate(rq) { if ( rq.length<1 ) { if ( !confirm('您要重新写入全部数据吗?') ) document.getElementById('rdate9').value='".date('Y-m-d',time())."'; } else if ( rq.length<5 ) { if ( !confirm('您要重新写入'+document.getElementById('rdate9').value+'年全年数据吗?') ) document.getElementById('rdate9').value='".date('Y-m-d',time())."'; } else if ( rq.length<8 ) { if ( !confirm('您要重新写入'+document.getElementById('rdate9').value+'整月数据吗?') ) document.getElementById('rdate9').value='".date('Y-m-d',time())."'; } if (rq.length >10 || (rq.length > 1 && rq.length % 3 != 1) ) { alert('日期输入错!!'); document.getElementById('rdate9').value='".date('Y-m-d',time())."'; } } </script>\n"; ## 下面这段用来处理用户输入的日期 echo "<form action='".$PHP_SELF."' method='post' name='c_sure'>\n"; echo "请输入日期(格式:[yyyy[-mm[-dd]]])<br />\n注:<br />\n"; echo "<font style='font-size:18px;color:#dd0000'>输入年月表示要处理全月数据,只输入年份表示整年,清空表示要处理所有日期段的数据</font><br />\n"; echo "<input type='text' size='10' maxlength='10' id='rdate9' name='rdate9' value='".date("Y-m-d",time())."' "; // rdate() 函数在上面用 javascript 定义过,用于提醒是否输入了整年或整月的日期段 echo " onchange='javascript:rdate(this.value);' />\n"; $que = "select store_id,user_id,user_name from ".$xoopsDB->prefix("market_member")." order by store_id,user_id"; ## echo $que."<hr />\n"; $res = $xoopsDB->query($que); echo " <select name='user_id9' size='1'>\n"; echo "<option value='member_all'>全部会员</option>\n"; while ( $row = $xoopsDB->fetchrow($res) ) { echo "<option value='".$row[1]."'>".$row[0]."=>".$row[2]."</option>\n"; } echo "</select><br />\n"; echo "<input type='hidden' name='Passed' value='sure' />\n"; echo "<hr style='width:286px;color:#0000ff;' />\n"; echo "<input type='reset' name='R01' value='重选' />\n"; echo " "; echo "<input type='submit' name='S01' value='确认' />\n"; echo "</form>\n";}if ( $recre_sure && ! isset($_REQUEST['cre_name']) ) { $rdate7 = str_replace(array('0','1','2','3','4','5','6','7','8','9','-'),array('0','1','2','3','4','5','6','7','8','9','-'),$_POST['rdate9']); $del_tj = ''; $del = "delete from ".$xoopsDB->prefix("market_achm")." where "; if ( $rdate7 == '' && $_POST['user_id9'] == 'member_all' ) $del_tj =" 1=1 "; if ( $rdate7 != '' ) { $del_date = "substring(rdate,1,".strlen($rdate7).")='".$rdate7."'"; $del_tj .= $del_date; $_hdate = true; } if ( $_hdate && $_POST['user_id9'] != "member_all" ) $del_tj .=" and "; if ( $_POST['user_id9'] != "member_all" ) { $del_member = " user_id=".$_POST['user_id9']." "; $del_tj .= $del_member; } $del .=$del_tj; ## echo $del . "<hr />"; ## echo "_".$del_tj."_"."<hr />"; $st0 = $xoopsDB->queryF($del); if ( $st0 ) echo "旧帐清理完毕<br />\n"; ## 日期格式为yyyy-mm-dd,如有其它格式,请自行处理 ## 下面的 1 为预留位,是用于统计小组人数的 $que = "select store_id,user_id,substring(rdate,1,10),count(*),1,sum(sj),sum(tcj) from ".$xoopsDB->prefix("market_seri"); $que .=" where ".$del_tj." and shbz='1' group by substring(rdate,1,10),store_id,user_id"; ## echo $que."<hr />\n"; $res = $xoopsDB->query($que); while ( $row = $xoopsDB->fetchrow($res) ) { $ins = "insert into ".$xoopsDB->prefix("market_achm")." (bh,store_id,user_id,rdate,ccust,grp_rs,yj,fd,shbz) values "; $ins .="(0,'$row[0]','$row[1]','$row[2]','$row[3]','$row[4]','$row[5]','$row[6]','0')"; ## echo "INST 业绩: ".$ins."<hr />"; $st0 = $xoopsDB->queryF($ins); if ( $st0 ) { $que = "select user_id,user_name from ".$xoopsDB->prefix("market_member")." where user_id=".$row[1]." limit 1"; list($u_id,$u_name) = $xoopsDB->fetchrow($xoopsDB->query($que)); echo $u_id."=>".$u_name.",$row[2] 之业绩已入帐,请重新审核……<br />\n"; } }}xoops_cp_footer();?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -