This repository has been archived on 2026-06-20. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
EDT/ipad/module/my_client.php
T
wsh5485 7e47ce238b chore: 添加多个图片和资源文件
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
2025-06-15 13:04:37 +08:00

801 lines
30 KiB
PHP

<?php
//-------------------------------我的客户
/*
代理和区经角色
*/
header("Content-type: text/html; charset=utf-8");
$json_data="{";
if(THIS_IN!="edt_ipad")
exit("错误的访问!");
$uid=check_cookie_jxs();
$msg_login=get_db_msg("select * from ".$table_pre."client where id='".$uid."'");
$sys_size_num=get_max_size_num();
$s_key=$s_key?$s_key:$_key;
$arr_upath=explode(",",$msg_login["charge_path"]);
$is_brand=is_brand();
$sd_ms=get_set("sd_ms");
$dzqm=get_set("dzqm");
$zk_type=get_set("zk_type");
$con_brand="";
if($is_brand=="y"){
if($s_brand)
$con_brand=" and brand='".$s_brand."'";
}
$check_md=get_db_msg("select count(*) 'num' from ".$table_pre."kh_md");
$zb_type=get_set("zb_type");
$arr_zb_type=explode(",",$zb_type);
$is_spk=get_set("is_spk");
//取得选项
$arr_select_no=array();
$arr_select_title=array();
$q="select no,title from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and flag_bd='n' and no<>'sx' and no<>'zd1' and no<>'zd2' and no<>'zd3' order by ord";
$r=$db->query($q);
while($m=$db->fetch_array($r)){
$arr_select_no[]=$m["no"];
$arr_select_title[]=$m["title"];
}
//是否显示结算金额
if($zk_type || $check_md["num"]>0)
$show_jsje="y";
else
$show_jsje="n";
$is_multi_price=get_set("is_multi_price");
$qr_not_jd=get_set("qr_not_jd");
$cou_u_all=get_qj_ucon_all($msg_login["charge_path_real"]);
$face=$msg_login["face"];
if($msg_login["rfid"]=="y" && $face==2)
$json_data.="\"glkh\":\"".$msg_login["rfid"]."\",";
switch($_a){
case "mod_client":
//管理客户
$_title_="管理客户";
$content="<div style='padding:4px;line-height:200%;'><input type='button' value=' &gt;返回 ' onclick=\"window.location.href='index.php?_m=main_2&s_tab=c'\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;请输入完整的登陆账号<input type='text' name='s_dp_username' id='s_dp_username' style='width:100px;height:25px;'>&nbsp;&nbsp;请输入登陆密码<input type='password' name='s_dp_password' id='s_dp_password' style='width:100px;height:25px;'> <input type='button' value=' 添加 ' onclick=\"mod_client_add(document.getElementById('s_dp_username').value,document.getElementById('s_dp_password').value)\"></div>";
$content.="<form name=\"form1\" action=\"".$_SERVER["PHP_SELF"]."\"><input type=\"hidden\" name=\"_m\" value=\"".$_m."\"><input type=\"hidden\" name=\"_cid\" value=\"".$_cid."\"><input type=\"hidden\" name=\"_a\" value=\"save_mod_client\"><table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"4\" cellspacing=\"1\" bgcolor=\"#ffffff\"><tr bgcolor=\"#cccccc\" height='25'><td align=\"center\">店铺名</td><td align=\"center\">登陆账号</td><td align=\"center\">操作</td></tr>";
$list=0;
for($count=0;$count<count($arr_upath);$count++){
$bgcolor=($list%2==0)?"#ffffff":"#e0e0e0";
$q="select id,username,title,face from ".$table_pre."client where id='".get_parent_id($arr_upath[$count])."'";
//echo $q."<Br>";
$m=get_db_msg($q);
if($m["face"]=="4"){
$content.="<tr bgcolor=\"".$bgcolor."\"><td align=\"left\">".$m["title"]."</td><td align=\"center\">".$m["username"]."</td><td align=\"center\"><input type='button' value='移除' onclick=\"mod_client_del('".$m["id"]."','".$m["title"]."')\"></td></tr>";
$list++;
$json_data1.="[\"".$m["title"]."\",\"".$m["username"]."\",\"caozuo|'".$m["id"]."','".$m["title"]."'\"],";
}
}
echo $json_data.="\"tab_mid\":[".substr($json_data1,0,-1)."]}";
$content.="</table>";
exit;
break;
case "add_client":
//新增店铺权限
$json_data="";
$username=trim($username);
$password=trim($password);
if($username!="" && $password!=""){
$check=get_db_msg("select id from ".$table_pre."client where username='".$username."' and password='".$password."' and face='4'");
if($check["id"]>0){
//
if(trim($msg_login["charge_uid"])!="")
$arr_uid=explode(",",trim($msg_login["charge_uid"]));
else
$arr_uid=array();
if(in_array($check["id"],$arr_uid)){
echo "该用户已添加!";
}else{
$arr_uid[]=$check["id"];
$str_uid=arr_to_str($arr_uid);
$arr1=get_qj_charge($arr_uid);
$q="update ".$table_pre."client set charge_path='".$arr1[0]."',charge_path_real='".$arr1[1]."',charge_uid='".$str_uid."' where id='".$uid."'";
//echo $q."<br>";
$db->query($q);
echo "y";
}
}else{
echo "账号或者密码有误,请检查!";
}
}else{
echo "请输入完整的登录账号和登陆密码!";
}
break;
case "del_client":
//移除店铺权限
$json_data="";
$arr_uid=explode(",",$msg_login["charge_uid"]);
$arr_uid1=array();
for($i=0;$i<count($arr_uid);$i++){
if($arr_uid[$i]!=$id)
$arr_uid1[]=$arr_uid[$i];
}
$str_uid=arr_to_str($arr_uid1);
$arr1=get_qj_charge($arr_uid1);
$q="update ".$table_pre."client set charge_path='".$arr1[0]."',charge_path_real='".$arr1[1]."',charge_uid='".$str_uid."' where id='".$uid."'";
//echo $q."<br>";
$db->query($q);
echo "y";
break;
case "confirm":
if($msg_login["face"]==2 && $msg_login["qyjl_confirm"]=="n"){
echo "n|该区经没有确认权限";
exit;
}
$str="y|";
//---------确认客户订单
$m=get_db_msg("select * from ".$table_pre."client where id='".$id."'");
if($m["face"]=="4" && $m["is_checked"]!="y"){
$tmp_gz=get_db_msg("select count(*) 'num' from web_keyword where cate='dhgz' and flag_ka='y'");
if($tmp_gz["num"]){
//检查订货规则
$c1=check_dhgz_client($id,"y");
if($c1!="y"){
echo "n|请检查订货规则:".$c1;
exit;
}
//检查最高订量
$c1=check_zgdl($id,"y");
if($c1!="y"){
echo "n|请检查订货规则:".$c1;
exit;
}
}
}
if($is_brand=="y"){
//----启用多品牌
$m1=get_db_msg("select is_jd from ".$table_pre."client_brand where cid='".$id."'".$con_brand." order by is_jd limit 0,1");
if($qr_not_jd=="n" && $m1["is_jd"]!="y"){
echo "n|客户未交单,不允许确认。";
exit;
}
$m1=get_db_msg("select id,is_checked from ".$table_pre."client_brand where cid='".$id."'".$con_brand." order by is_checked limit 0,1");
if($m1["id"]){
$db->query("update ".$table_pre."client_brand set is_checked='y' where cid='".$id."'".$con_brand);
$str.="<span style=\"font-size:14px;font-weight:bold;\">√</span>|<input type=\"button\" id='b_qxconfirm_".$m["id"]."' value=\"取消确认\" onclick=\"ajax_qj_action('确定执行取消确认订单吗?','qxconfirm','".$m["id"]."','".$s_brand."','".$_m."')\" style=\"background:red;color:white;\">";
}else{
$str.="|<input type='button' id='b_confirm_".$m["id"]."' value='确认订单' onclick=\"ajax_qj_action('确定执行确认订单吗?','confirm','".$m["id"]."','".$s_brand."','".$_m."')\" style=\"background:red;color:white;\">";
}
}else{
//----不启用多品牌
if($qr_not_jd=="n" && $m["is_jd"]!="y"){
$str="";
echo "n|客户未交单,不允许确认。";
exit;
}
//如果是代理商则先检查下属店铺是否审核
if($m["face"]=="3" && $m["is_checked"]=="n"){
$t1=get_db_msg("select count(*) 'num' from ".$table_pre."client where face='4' and is_checked='n' and (path='".$m["path"]."-".$m["id"]."' or path like '".$m["path"]."-".$m["id"]."-%')");
if($t1["num"]>0){
echo "n|对不起,该代理商尚有未审核店铺!";
exit;
}
}
if($m["face"]=="4" && $m["is_checked"]=="y"){
//检查上级代理商是否确认
$dl_uid=get_dl_id($m["path"]);
if($dl_uid>0){
$t1=get_db_msg("select * from ".$table_pre."client where id='".$dl_uid."'");
if($t1["is_checked"]=="y"){
echo "n|对不起,该店铺的上级代理已经确认订单!";
exit;
}
}
}
//
$db->query("update ".$table_pre."client set is_checked='y' where id='".$id."'");
$str.="<span style=\"font-size:14px;font-weight:bold;\">√</span>|<input type=\"button\" id='b_qxconfirm_".$m["id"]."' value=\"取消确认\" onclick=\"ajax_qj_action('确定执行取消确认订单吗?','qxconfirm','".$m["id"]."','".$s_brand."','".$_m."')\" style=\"background:red;color:white;\">";
}
echo $str;
exit;
break;
case "qxconfirm":
if($msg_login["face"]==2 && $msg_login["qyjl_confirm"]=="n"){
echo "n|该区经没有确认权限";
exit;
}
$str="y|";
$m=get_db_msg("select * from ".$table_pre."client where id='".$id."'");
if($is_brand=="y"){
$m1=get_db_msg("select id,is_checked from ".$table_pre."client_brand where cid='".$id."'".$con_brand." order by is_checked limit 0,1");
if($m1["id"]){
$db->query("update ".$table_pre."client_brand set is_checked='n' where cid='".$id."'".$con_brand);
$str.="|<input type='button' id='b_confirm_".$m["id"]."' value='确认订单' onclick=\"ajax_qj_action('确定执行确认订单吗?','confirm','".$m["id"]."','".$s_brand."','".$_m."')\" style=\"background:red;color:white;\">";
}else{
$str.="|<input type='button' id='b_confirm_".$m["id"]."' value='确认订单' onclick=\"ajax_qj_action('确定执行确认订单吗?','confirm','".$m["id"]."','".$s_brand."','".$_m."')\" style=\"background:red;color:white;\">";
}
}else{
$db->query("update ".$table_pre."client set is_checked='n' where id='".$id."'");
$str.="11|<input type='button' id='b_confirm_".$m["id"]."' value='确认订单' onclick=\"ajax_qj_action('确定执行确认订单吗?','confirm','".$m["id"]."','".$s_brand."','".$_m."')\" style=\"background:red;color:white;\">";
}
echo $str;
exit;
break;
case "jd":
//---------退回交单
$str="y|";
$m=get_db_msg("select * from ".$table_pre."client where id='".$id."'");
if($is_brand=="y"){
$db->query("update ".$table_pre."client_brand set is_jd='n',is_checked='n' where cid='".$id."'".$con_brand);
}else{
$db->query("update ".$table_pre."client set is_jd='n',is_checked='n' where id='".$id."'");
}
$str.="|<input type='button' id='b_confirm_".$m["id"]."' value='确认订单' onclick=\"ajax_qj_action('确定执行确认订单吗?','confirm','".$m["id"]."','".$s_brand."','".$_m."')\" style=\"background:red;color:white;\">";
update_order_state($uid,$id,"退回交单","");
echo $str;
exit;
break;
default:
//取得代理下面所属店铺的数组
$tmp="";
$q1="select * from ".$table_pre."client where face='3'";
$r1=$db->query($q1);
while($m1=$db->fetch_array($r1)){
$tmp.="[\"".$m1["path"]."-".$m1["id"]."\"";
$q2="select * from ".$table_pre."client where face='4' and path='".$m1["path"]."-".$m1["id"]."'";
$r2=$db->query($q2);
while($m2=$db->fetch_array($r2)){
$tmp.=",\"".$m2["path"]."-".$m2["id"]."\"";
}
$tmp.="],";
}
if($tmp)
$json_data.="\"arr_dl\":[".substr($tmp,0,-1)."],";
//--
$s_split_spfs=$s_split_spfs?$s_split_spfs:"n";
$json_data.="\"is_brand\":\"".$is_brand."\",";
$json_data.="\"s_username\":\"".$s_username."\",";
$json_data.="\"s_split_spfs\":\"".$s_split_spfs."\",";
$json_data.="\"s_is_checked\":\"".$s_is_checked."\",";
$json_data.="\"s_is_jd\":\"".$s_is_jd."\",";
//品牌选项
if($is_brand=="y"){
$select_dz="";
//取得选项
$tmp="";
$r1=$db->query("select no,title from ".$table_pre."keyword where cate='brand' order by no");
while($m1=$db->fetch_array($r1)){
$tmp.="{\"no\":\"".$m1["no"]."\",\"title\":\"".$m1["title"]."\"},";
}
$tmp=deel_end($tmp);
$select_dz.="{\"no\":\"brand\",\"title\":\"".get_cate_title_no("arr_select","brand")."\",\"value\":\"".$s_brand."\",\"op\":[".$tmp."]}";
$json_data.="\"select_dz\":[".$select_dz."],";
}
//订货会标记选项
$con_f="";
if(count($arr_sys_order_flag)>1){
$show_key="y";
$json_data.="\"show_key\":\"".$show_key."\",";
//
$tmp_order_flag="";
foreach($arr_sys_order_flag as $k => $v){
$tmp_order_flag.="{\"no\":\"".$k."\",\"title\":\"".$v."\"},";
}
$tmp_order_flag.="{\"no\":\"all\",\"title\":\"所有订单\"},";
$tmp_order_flag=deel_end($tmp_order_flag);
if($s_key){
$selectf=$s_key;
}else{
$selectf=$_key;
}
$str_json="\"select_order_flag\":{\"no\":\"s_key\",\"title\":\"订货会标记\",\"value\":\"".$selectf."\",\"op\":[".$tmp_order_flag."]},";
$json_data.=$str_json;
if($s_key){
if($s_key=="all"){
$con_f="";
}else{
$con_f=" and _key='".$s_key."'";
}
}
}else{
$show_key="n";
$json_data.="\"show_key\":\"".$show_key."\",";
}
//-----------表头
$table_top="\"客户\",";
if($s_split_spfs=="y"){
$table_top.="\"".d_translate("cyk")."|订量\",\"".d_translate("cyk")."|".d_translate("dpje")."\",";
if($show_jsje=="y"){
$table_top.="\"".d_translate("cyk")."|结算金额\",";
}
$table_top.="\"".d_translate("spk")."|订量\",\"".d_translate("spk")."|".d_translate("dpje")."\",";
if($show_jsje=="y")
$table_top.="\"".d_translate("spk")."|结算金额\",";
}
$table_top.="\"小计|数量\",\"小计|".d_translate("dpje")."\",";
if($show_jsje=="y")
$table_top.="\"小计|结算金额\",";
if(in_array("js",$arr_zb_type)){
$table_top.="\"件数指标\",\"件数完成率\",";
}
if(in_array("je",$arr_zb_type)){
$table_top.="\"金额指标\",\"金额完成率\",";
}
$json_data.="\"table_top\":[".substr($table_top,0,-1)."],";
if($face==2){
if($dzqm=="y" && $sd_ms=="1"){
$json_data.="\"dzqm\":\"y\",";
}else{
$json_data.="\"dzqm\":\"n\",";
}
}
if($face==3){
if($dzqm=="y" && $sd_ms=="2"){
$json_data.="\"dzqm\":\"y\",";
}else{
$json_data.="\"dzqm\":\"n\",";
}
}
//-----------表头end
if($face==2){
//区域经理
$total_cy_num=$total_cy_je=$total_cy_jsje=0;
$total_all_num=$total_all_je=$total_all_jsje=0;
$total_zbjs=$total_zbje=0;
$total_dlzbjs=$total_dlzbje=0;
$tab_mid="";
for($count=0;$count<count($arr_upath);$count++){
$tmp_client=get_db_msg("select * from ".$table_pre."client where id='".get_parent_id($arr_upath[$count])."'");
$show_order_num=($tmp_client["face"]==4)?"y":check_qj_priv_all($tmp_client["id"]);
if($tmp_client["id"]>0){
//
$is_jd=$is_checked="null";
if($is_brand=="y"){
if($tmp_client["face"]=="4" || $tmp_client["face"]=="3"){
$m_tmp=get_db_msg("select is_jd from ".$table_pre."client_brand where cid='".$tmp_client["id"]."'".$con_brand." order by is_jd limit 0,1");
$is_jd=$m_tmp["is_jd"];
$m_tmp=get_db_msg("select is_checked from ".$table_pre."client_brand where cid='".$tmp_client["id"]."'".$con_brand." order by is_checked limit 0,1");
$is_checked=$m_tmp["is_checked"];
}
}else{
if($tmp_client["face"]=="4" || $tmp_client["face"]=="3"){
$is_jd=$tmp_client["is_jd"];
$is_checked=$tmp_client["is_checked"];
}
}
if((!$s_username || ($s_username && preg_match("/".$s_username."/i",$tmp_client["username"]))) && (!$s_is_checked || ($s_is_checked && $s_is_checked==$is_checked)) && (!$s_is_jd || ($s_is_jd && $s_is_jd==$is_jd))){
if($tmp_client["face"]=="4"){
$con_tmp=" and uid='".$tmp_client["id"]."'";
}else{
$con_tmp=" and (upath like '".$tmp_client["path"]."-".$tmp_client["id"]."-%')";
}
if($is_brand=="y"){
$con_tmp.=$con_brand;
}
//总金额
if($show_order_num=="y"){
$tmp=get_db_msg("select sum(num) 'num',sum(je) 'je',sum(jsje) 'jsje' from ".$table_pre."order where ka<>'y' ".$con_tmp.$con_f);
$tmp_num=$tmp["num"];
$tmp_money=$tmp["je"];
$tmp_money_zk=$tmp["jsje"];
}else{
$tmp_num=0;
$tmp_money=0;
$tmp_money_zk=0;
}
//
if($tmp_client["face"]=="4"){
$total_all_num+=$tmp_num;
$total_all_je+=$tmp_money;
$total_all_jsje+=$tmp_money_zk;
}
//成衣
if($show_order_num=="y"){
$tmp_cy=get_db_msg("select sum(num) 'num',sum(je) 'je',sum(jsje) 'jsje' from ".$table_pre."order where ka<>'y' and is_sp<>'y' ".$con_tmp.$con_f);
$tmp_num1=$tmp_cy["num"];
$tmp_money1=$tmp_cy["je"];
$tmp_money1_zk=$tmp_cy["jsje"];
}else{
$tmp_num1=0;
$tmp_money1=0;
$tmp_money1_zk=0;
}
if($tmp_client["face"]=="4"){
$total_cy_num+=$tmp_num1;
$total_cy_je+=$tmp_money1;
$total_cy_jsje+=$tmp_money1_zk;
}
//指标
if($show_order_num=="y"){
if($is_brand=="y"){
$tmp=get_db_msg("select sum(zb) 'zb',sum(zb_js) 'zb_js' from ".$table_pre."client_brand where cid='".$tmp_client["id"]."'".$con_brand);
$tmp_zb_je=$tmp["zb"]*10000;
$tmp_zb_js=$tmp["zb_js"];
}else{
$tmp_zb_je=$tmp_client["zb"]*10000;
$tmp_zb_js=$tmp_client["zb_js"];
}
}else{
$tmp_zb_je=0;
$tmp_zb_js=0;
}
if($tmp_client["face"]=="4"){
$total_zbjs+=$tmp_zb_js;
$total_zbje+=$tmp_zb_je;
}else if($tmp_client["face"]=="3"){
$total_dlzbjs+=$tmp_zb_js;
$total_dlzbje+=$tmp_zb_je;
}
$cz1="";
if($msg_login["face"]==2 && $msg_login["qyjl_confirm"]=="n"){
$cz1.="&&4||";
}else{
if($sd_ms=="1" && ($tmp_client["face"]==3 || $tmp_client["face"]==4)){
if($is_checked=="y"){
$cz1.="&&1&&取消确认&&确定执行取消确认订单吗?&&qxconfirm&&".$tmp_client["id"]."&&".$s_brand."&&".$_m;
}else{
$cz1.="&&1&&确认订单&&执行确认订单吗?&&confirm&&".$tmp_client["id"]."&&".$s_brand."&&".$_m;
}
if($is_jd=="y"){
$cz1.="||&&2&&退回交单&&确认退回交单吗?&&jd&&".$tmp_client["id"]."&&".$s_brand."&&".$_m;
}else{
$cz1.="||";
}
}else{
$cz1.="&&4||";
}
}
if($tmp_client["face"]==3){
$cz1.="||y&&".$tmp_client["path"]."-".$tmp_client["id"];
}else{
$cz1.="||n";
}
$tab_mid.="{\"tb_id\":\"".$tmp_client["path"]."-".$tmp_client["id"]."\",";
if($tmp_client["face"]=="9"){
$tab_mid.="\"tbdata\":[\"&nbsp;&nbsp;".$tmp_client["title"]."(".$tmp_client["username"].")".$cz1."\",";
}else if($tmp_client["face"]=="3"){
$tab_mid.="\"tbdata\":[\"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$tmp_client["title"]."(".$tmp_client["username"].")".$cz1."\",";
}else{
$tab_mid.="\"tbdata\":[\"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$tmp_client["title"]."(".$tmp_client["username"].")".$cz1."\",";
}
if($s_split_spfs=="y"){
$tab_mid.="\"".deel_td($tmp_num1)."\",\"".deel_td(deel_je_show($tmp_money1))."\",";
if($show_jsje=="y"){
$tab_mid.="\"".deel_td(deel_je_show($tmp_money1_zk))."\",";
}
$tab_mid.="\"".deel_td($tmp_num-$tmp_num1)."\",\"".deel_td(deel_je_show($tmp_money-$tmp_money1))."\",";
if($show_jsje=="y"){
$tab_mid.="\"".deel_td(deel_je_show($tmp_money_zk-$tmp_money1_zk))."\",";
}
}
$tab_mid.="\"".deel_td($tmp_num)."\",\"".deel_td(deel_je_show($tmp_money))."\",";
if($show_jsje=="y")
$tab_mid.="\"".deel_td(deel_je_show($tmp_money_zk))."\",";
if(in_array("js",$arr_zb_type)){
if($is_spk=="y")
$wcl=deel_bfb1($tmp_num1,$tmp_zb_js,1);
else
$wcl=deel_bfb1($tmp_num,$tmp_zb_js,1);
$tab_mid.="\"".deel_td($tmp_zb_js)."\",\"".deel_0($wcl)."\",";
}
if(in_array("je",$arr_zb_type)){
if($is_spk=="y"){
$tmp1=($show_jsje=="y")?$tmp_money1_zk:$tmp_money1;
}else{
$tmp1=($show_jsje=="y")?$tmp_money_zk:$tmp_money;
}
$wcl=deel_bfb1($tmp1,$tmp_zb_je,1);
$tab_mid.="\"".deel_td(deel_je_show($tmp_zb_je))."\",\"".deel_0($wcl)."\",";
}
$tab_mid=substr($tab_mid,0,-1)."]},";
}
}
}
$json_data.="\"tab_mid\":[".substr($tab_mid,0,-1)."],";
//------------------店铺合计
$dp_hj="\"店铺合计\",";
if($s_split_spfs=="y"){
$dp_hj.="\"".$total_cy_num."\",\"".deel_je_show($total_cy_je)."\",";
if($show_jsje=="y"){
$dp_hj.="\"".deel_je_show($total_cy_jsje)."\",";
}
$dp_hj.="\"".($total_all_num-$total_cy_num)."\",\"".deel_je_show($total_all_je-$total_cy_je)."\",";
if($show_jsje=="y"){
$dp_hj.="\"".deel_je_show($total_all_jsje-$total_cy_jsje)."\",";
}
}
$dp_hj.="\"".$total_all_num."\",\"".deel_je_show($total_all_je)."\",";
if($show_jsje=="y")
$dp_hj.="\"".deel_je_show($total_all_jsje)."\",";
if(in_array("js",$arr_zb_type)){
if($is_spk=="y")
$wcl=deel_bfb1($total_cy_num,$total_zbjs,1);
else
$wcl=deel_bfb1($total_all_num,$total_zbjs,1);
$dp_hj.="\"".$total_zbjs."\",\"".$wcl."\",";
}
if(in_array("je",$arr_zb_type)){
if($is_spk=="y"){
$tmp1=($show_jsje=="y")?$total_cy_jsje:$total_cy_je;
}else{
$tmp1=($show_jsje=="y")?$tmp_money_zk:$total_all_je;
}
$wcl=deel_bfb1($tmp1,$total_zbje,1);
$dp_hj.="\"".deel_je_show($total_zbje)."\",\"".$wcl."\",";
}
$json_data.="\"dp_hj\":[".substr($dp_hj,0,-1)."],";
//------------------店铺合计end
//------------------代理合计
$dl_hj="\"代理合计\",";
if($s_split_spfs=="y"){
$dl_hj.="\"".$total_cy_num."\",\"".deel_je_show($total_cy_je)."\",";
if($show_jsje=="y"){
$dl_hj.="\"".deel_je_show($total_cy_jsje)."\",";
}
$dl_hj.="\"".($total_all_num-$total_cy_num)."\",\"".deel_je_show($total_all_je-$total_cy_je)."\",";
if($show_jsje=="y"){
$dl_hj.="\"".deel_je_show($total_all_jsje-$total_cy_jsje)."\",";
}
}
$dl_hj.="\"".$total_all_num."\",\"".deel_je_show($total_all_je)."\",";
if($show_jsje=="y")
$dl_hj.="\"".deel_je_show($total_all_jsje)."\",";
if(in_array("js",$arr_zb_type)){
if($is_spk=="y")
$wcl=deel_bfb1($total_cy_num,$total_dlzbjs,1);
else
$wcl=deel_bfb1($total_all_num,$total_dlzbjs,1);
$dl_hj.="\"".$total_dlzbjs."\",\"".$wcl."\",";
}
if(in_array("je",$arr_zb_type)){
if($is_spk=="y"){
$tmp1=($show_jsje=="y")?$total_cy_jsje:$total_cy_je;
}else{
$tmp1=($show_jsje=="y")?$tmp_money_zk:$total_all_je;
}
$wcl=deel_bfb1($tmp1,$total_dlzbje,1);
$dl_hj.="\"".deel_je_show($total_dlzbje)."\",\"".$wcl."\",";
}
//$json_data.="\"dl_hj\":[".substr($dl_hj,0,-1)."],";
$json_data.="\"dl_hj\":[],";
//------------------代理合计end
}else if($face==3){
//代理商
$arr_upath=array();
$p=$msg_login["path"]."-".$msg_login["id"];
$q="select *,concat(path,'-',id) 'abspath' from ".$table_pre."client where (path='".$p."' or path like '".$p."-%') order by abspath";
$r=$db->query($q);
$li=0;
while($m=$db->fetch_array($r)){
$arr_upath[$li]=$m["id"];
$li++;
}
//
$total_cy_num=$total_cy_je=$total_cy_jsje=0;
$total_all_num=$total_all_je=$total_all_jsje=0;
$total_zbjs=$total_zbje=0;
$tab_mid="";
for($count=0;$count<count($arr_upath);$count++){
$tmp_client=get_db_msg("select * from ".$table_pre."client where id='".$arr_upath[$count]."'");
if($tmp_client["id"]>0){
//
$is_jd=$is_checked="null";
if($is_brand=="y"){
if($tmp_client["face"]=="4" || $tmp_client["face"]=="3"){
$m_tmp=get_db_msg("select is_jd from ".$table_pre."client_brand where cid='".$tmp_client["id"]."'".$con_brand." order by is_jd limit 0,1");
$is_jd=$m_tmp["is_jd"];
$m_tmp=get_db_msg("select is_checked from ".$table_pre."client_brand where cid='".$tmp_client["id"]."'".$con_brand." order by is_checked limit 0,1");
$is_checked=$m_tmp["is_checked"];
}
}else{
if($tmp_client["face"]=="4" || $tmp_client["face"]=="3"){
$is_jd=$tmp_client["is_jd"];
$is_checked=$tmp_client["is_checked"];
}
}
if((!$s_username || ($s_username && preg_match("/".$s_username."/i",$tmp_client["username"]))) && (!$s_is_checked || ($s_is_checked && $s_is_checked==$is_checked)) && (!$s_is_jd || ($s_is_jd && $s_is_jd==$is_jd))){
if($tmp_client["face"]=="4"){
$con_tmp=" and uid='".$tmp_client["id"]."'";
}else{
$con_tmp=" and (upath like '".$tmp_client["path"]."-".$tmp_client["id"]."-%')";
}
if($is_brand=="y"){
$con_tmp.=$con_brand;
}
//总金额
$tmp=get_db_msg("select sum(num) 'num',sum(je) 'je',sum(jsje) 'jsje' from ".$table_pre."order where ka<>'y' ".$con_tmp.$con_f);
$tmp_num=$tmp["num"];
$tmp_money=$tmp["je"];
$tmp_money_zk=$tmp["jsje"];
//
if($tmp_client["face"]=="4"){
$total_all_num+=$tmp_num;
$total_all_je+=$tmp_money;
$total_all_jsje+=$tmp_money_zk;
}
//成衣
$tmp_cy=get_db_msg("select sum(num) 'num',sum(je) 'je',sum(jsje) 'jsje' from ".$table_pre."order where ka<>'y' and is_sp<>'y' ".$con_tmp.$con_f);
$tmp_num1=$tmp_cy["num"];
$tmp_money1=$tmp_cy["je"];
$tmp_money1_zk=$tmp_cy["jsje"];
if($tmp_client["face"]=="4"){
$total_cy_num+=$tmp_num1;
$total_cy_je+=$tmp_money1;
$total_cy_jsje+=$tmp_money1_zk;
}
//指标
if($is_brand=="y"){
$tmp=get_db_msg("select sum(zb) 'zb',sum(zb_js) 'zb_js' from ".$table_pre."client_brand where cid='".$tmp_client["id"]."'".$con_brand);
$tmp_zb_je=$tmp["zb"]*10000;
$tmp_zb_js=$tmp["zb_js"];
}else{
$tmp_zb_je=$tmp_client["zb"]*10000;
$tmp_zb_js=$tmp_client["zb_js"];
}
if($tmp_client["face"]=="4"){
$total_zbjs+=$tmp_zb_js;
$total_zbje+=$tmp_zb_je;
}
$cz1="";
if($sd_ms=="2"){
if($is_checked=="y"){
$cz1.="&&1&&取消确认&&确定执行取消确认订单吗?&&qxconfirm&&".$tmp_client["id"]."&&".$s_brand."&&".$_m;
}else{
$cz1.="&&1&&确认订单&&执行确认订单吗?&&confirm&&".$tmp_client["id"]."&&".$s_brand."&&".$_m;
}
if($is_jd=="y"){
$cz1.="||&&2&&退回交单&&确认退回交单吗?&&jd&&".$tmp_client["id"]."&&".$s_brand."&&".$_m;
}else{
$cz1.="||";
}
}else{
$cz1.="&&4||";
}
$cz1.="||n";
$tab_mid.="{\"tb_id\":\"".$tmp_client["path"]."-".$tmp_client["id"]."\",";
$tab_mid.="\"tbdata\":[\"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$tmp_client["title"]."(".$tmp_client["username"].")".$cz1."\",";
if($s_split_spfs=="y"){
$tab_mid.="\"".$tmp_num1."\",\"".deel_je_show($tmp_money1)."\",";
if($show_jsje=="y"){
$tab_mid.="\"".deel_je_show($tmp_money1_zk)."\",";
}
$tab_mid.="\"".($tmp_num-$tmp_num1)."\",\"".deel_je_show($tmp_money-$tmp_money1)."\",";
if($show_jsje=="y"){
$tab_mid.="\"".deel_je_show($tmp_money_zk-$tmp_money1_zk)."\",";
}
}
$tab_mid.="\"".$tmp_num."\",\"".deel_je_show($tmp_money)."\",";
if($show_jsje=="y")
$tab_mid.="\"".deel_je_show($tmp_money_zk)."\",";
if(in_array("js",$arr_zb_type)){
if($is_spk=="y")
$wcl=deel_bfb1($tmp_num1,$tmp_zb_js,1);
else
$wcl=deel_bfb1($tmp_num,$tmp_zb_js,1);
$tab_mid.="\"".$tmp_zb_js."\",\"".$wcl."\",";
}
if(in_array("je",$arr_zb_type)){
if($is_spk=="y"){
$tmp1=($show_jsje=="y")?$tmp_money1_zk:$tmp_money1;
}else{
$tmp1=($show_jsje=="y")?$tmp_money_zk:$tmp_money;
}
$wcl=deel_bfb1($tmp1,$tmp_zb_je,1);
$tab_mid.="\"".deel_je_show($tmp_zb_je)."\",\"".$wcl."\",";
}
$tab_mid=substr($tab_mid,0,-1)."]},";
}
}
}
$json_data.="\"tab_mid\":[".substr($tab_mid,0,-1)."],";
//------------------店铺合计
$dp_hj="\"店铺合计\",";
if($s_split_spfs=="y"){
$dp_hj.="\"".$total_cy_num."\",\"".deel_je_show($total_cy_je)."\",";
if($show_jsje=="y"){
$dp_hj.="\"".deel_je_show($total_cy_jsje)."\",";
}
$dp_hj.="\"".($total_all_num-$total_cy_num)."\",\"".deel_je_show($total_all_je-$total_cy_je)."\",";
if($show_jsje=="y"){
$dp_hj.="\"".deel_je_show($total_all_jsje-$total_cy_jsje)."\",";
}
}
$dp_hj.="\"".$total_all_num."\",\"".deel_je_show($total_all_je)."\",";
if($show_jsje=="y")
$dp_hj.="\"".deel_je_show($total_all_jsje)."\",";
if(in_array("js",$arr_zb_type)){
if($is_spk=="y")
$wcl=deel_bfb1($total_cy_num,$total_zbjs,1);
else
$wcl=deel_bfb1($total_all_num,$total_zbjs,1);
$dp_hj.="\"".$total_zbjs."\",\"".$wcl."\",";
}
if(in_array("je",$arr_zb_type)){
if($is_spk=="y"){
$tmp1=($show_jsje=="y")?$total_cy_jsje:$total_cy_je;
}else{
$tmp1=($show_jsje=="y")?$tmp_money_zk:$total_all_je;
}
$wcl=deel_bfb1($tmp1,$total_zbje,1);
$dp_hj.="\"".deel_je_show($total_zbje)."\",\"".$wcl."\",";
}
$json_data.="\"dp_hj\":[".substr($dp_hj,0,-1)."],";
//------------------店铺合计end
//------------------代理合计
$dl_hj="\"代理合计\",";
if($s_split_spfs=="y"){
$dl_hj.="\"".$total_cy_num."\",\"".deel_je_show($total_cy_je)."\",";
if($show_jsje=="y"){
$dl_hj.="\"".deel_je_show($total_cy_jsje)."\",";
}
$dl_hj.="\"".($total_all_num-$total_cy_num)."\",\"".deel_je_show($total_all_je-$total_cy_je)."\",";
if($show_jsje=="y"){
$dl_hj.="\"".deel_je_show($total_all_jsje-$total_cy_jsje)."\",";
}
}
$dl_hj.="\"".$total_all_num."\",\"".deel_je_show($total_all_je)."\",";
if($show_jsje=="y")
$dl_hj.="\"".deel_je_show($total_all_jsje)."\",";
//指标
if($is_brand=="y"){
$tmp=get_db_msg("select sum(zb) 'zb',sum(zb_js) 'zb_js' from ".$table_pre."client_brand where cid='".$msg_login["id"]."'".$con_brand);
$tmp_zb_je=$tmp["zb"]*10000;
$tmp_zb_js=$tmp["zb_js"];
}else{
$tmp_zb_je=$msg_login["zb"]*10000;
$tmp_zb_js=$msg_login["zb_js"];
}
if(in_array("js",$arr_zb_type)){
if($is_spk=="y")
$wcl=deel_bfb1($total_cy_num,$tmp_zb_js,1);
else
$wcl=deel_bfb1($total_all_num,$tmp_zb_js,1);
$dl_hj.="\"".$tmp_zb_js."\",\"".$wcl."\",";
}
if(in_array("je",$arr_zb_type)){
if($is_spk=="y"){
$tmp1=($show_jsje=="y")?$total_cy_jsje:$total_cy_je;
}else{
$tmp1=($show_jsje=="y")?$tmp_money_zk:$total_all_je;
}
$wcl=deel_bfb1($tmp1,$tmp_zb_je,1);
$dl_hj.="\"".deel_je_show($tmp_zb_je)."\",\"".$wcl."\",";
}
$json_data.="\"dl_hj\":[".substr($dl_hj,0,-1)."],";
//------------------代理合计end
}else{
$json_data.="\"tab_mid\":[],";
$json_data.="\"dp_hj\":[],";
$json_data.="\"dl_hj\":[],";
}
break;
}
if($json_data)
$json_data=substr($json_data,0,-1)."}";
echo $json_data;
?>