'y'":""; $json_data.="\"show_jd\":\"".$show_jd."\","; $json_data.="\"is_brand\":\"".$is_brand."\","; $s_key=$_key; $sys_size_num=get_max_size_num(); if($is_brand<>"y"){ $tmp=$msg_login1; $is_jd=$msg_login1["is_jd"]; $is_checked=$msg_login1["is_checked"]; }else{ $tmp=get_db_msg("select is_jd from ".$table_pre."client_brand where cid='".$uid."'".$con_brand." order by is_jd limit 0,1"); $is_jd=$tmp["is_jd"]; $tmp=get_db_msg("select is_checked from ".$table_pre."client_brand where cid='".$uid."'".$con_brand." order by is_checked limit 0,1"); $is_checked=$tmp["is_checked"]; } $xsnr=""; if($show_jd=="y"){ $tmp=$msg_login1; if($is_jd=="y"){ //$jd_button="经理审单|go_url('".$_SERVER[PHP_SELF]."?_m=jd')"; $xsnr="jd"; } if($is_checked=="y"){ $m1=get_db_msg("select * from ".$table_pre."order_state where cid='".$uid."' and action<>'订单打印' order by add_date desc limit 0,1"); if($m1["action"]=="客户签字"){ //$str_sign="我的订单|go_url('".$_SERVER[PHP_SELF]."?_m=my_detail&window=new\')"; $xsnr="wddd"; }else{ //$str_sign="经理签字|go_url('".$_SERVER[PHP_SELF]."?_m=sign')"; $xsnr="jlqz"; } $jd_button=$str_sign; } if($is_jd!="y" && $is_checked!="y"){ //$jd_button="交单|go_url('".$_SERVER[PHP_SELF]."?_m=jd&_m2=".$_m."')"; $xsnr="jd"; } } $json_data.="\"is_jd\":\"".$is_jd."\","; $json_data.="\"_m\":\"".$_m."\","; $json_data.="\"_a\":\"".$_a."\","; if(!$_a){ $_a=$xsnr; } $json_data.="\"xsnr\":\"".$_a."\","; switch($_a){ case "qjsd": //经理审单 if($cz=="thjd" || $cz=="qjqr"){ $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.="
请输入店铺上级账号
登录账号
登录密码
"; } $json_data.="\"cz\":\"".$cz."\","; $json_data.="\"tb\":\"".$tb."\","; break; case "qjsd_do": //经理审单-账号密码输入 $arr_path=explode("-",$msg_login1["path"]); $sj_id=end($arr_path); $tmp_sj=get_db_msg("select id,face,title,username,password from ".$table_pre."client where id='".$sj_id."'"); if($tmp_sj["face"]=='3'){ $str_sj="代理商"; }else{ $str_sj="区经"; } $login_sj=get_db_msg("select id,title,face,charge_uid,charge_path from ".$table_pre."client where username='".$qj_username."' and password='".$qj_password."' limit 0,1"); $arr_charge_path=explode(",",$login_sj["charge_path"]); $check_sj='false'; if($msg_login1["face"]=="4"){ if($tmp_sj["id"]==$login_sj["id"] && $tmp_sj["face"]=='3'){ $check_sj='true'; }else{ if($login_sj["face"]=="2" && in_array($upath,$arr_charge_path)){ $check_sj='true'; } } }else if($msg_login1["face"]=="3"){ if($login_sj["face"]=="2" && in_array($upath,$arr_charge_path)){ $check_sj='true'; } } //echo $login_sj["face"];exit; //$arr_charge_uid=explode(",",$m_qj["charge_uid"]); //if($m_qj["face"]=="2" && in_array($uid,$arr_charge_uid)){ if($check_sj=='true'){ //------------验证成功 if($cz=="shtg"){ if($is_brand=="y"){ //---------------------审核通过 $q="update ".$table_pre."client_brand set is_checked='y' where cid='".$uid."'".$con_brand; $db->query($q); }else{ //---------------------审核通过 $q="update ".$table_pre."client set is_checked='y' where id='".$uid."'".$con_brand; $db->query($q); } //加入客户订单操作日志表 $add_date=date("Y-m-d H:i:s"); $q1="insert into ".$table_pre."order_state (uid,cid,brand,action,attachments,add_date) values ('".$login_sj["id"]."','".$uid."','".$s_brand."','".$str_sj."确认','','".$add_date."')"; $db->query($q1); //alert_and_redirect("审核成功,请双方签字","?_m=sign&_m2=".$_m2."&s_brand=".$s_brand.""); $json_data.="\"msg\":\"审核成功,请双方签字\","; $json_data.="\"qz\":\"qz\","; $json_data.="\"code\":101,"; $json_data.="\"refresh\":\"y\","; }else if($cz=="thjd"){ if($is_brand=="y"){ //---------------------退回修改 $q="update ".$table_pre."client_brand set is_jd='n' where cid='".$uid."'".$con_brand; $db->query($q); }else{ //---------------------退回修改 $q="update ".$table_pre."client set is_jd='n' where id='".$uid."'".$con_brand; $db->query($q); } //加入客户订单操作日志表 $add_date=date("Y-m-d H:i:s"); $q1="insert into ".$table_pre."order_state (uid,cid,brand,action,attachments,add_date) values ('".$login_sj["id"]."','".$uid."','".$s_brand."','".$str_sj."退回','','".$add_date."')"; $db->query($q1); $json_data.="\"msg\":\"操作成功\","; $json_data.="\"code\":101,"; $json_data.="\"refresh\":\"y\","; } }else{ //身份验证失败 //alert_and_back("对不起,账号或者权限有误!"); $json_data.="\"msg\":\"对不起,账号或者权限有误!\","; $json_data.="\"code\":101,"; } $json_data.="\"cz\":\"".$cz."\","; $json_data=substr($json_data,0,-1)."}"; echo $json_data; exit; break; case "wddd": //我的订单 include THIS_FILE_ROOT.'/include/phpqrcode/phpqrcode.php'; $value = $msg_login1["username"]; $errorCorrectionLevel = 'L';//容错级别 $matrixPointSize = 16;//生成图片大小 //$str = str_replace(PHP_EOL, '', $str); //生成二维码图片 //$tmp=QRcode::png($value, "qrcode.png", $errorCorrectionLevel, $matrixPointSize, 2); //var_dump($value); //$pic=base64EncodeImage(QRcode::png($value, false, $errorCorrectionLevel, $matrixPointSize, 2)); ob_start(); QRcode::png($value, false, $errorCorrectionLevel, $matrixPointSize, 2); $data =ob_get_contents(); ob_end_clean(); $pic="data:image/png;base64,".base64_encode($data); //$cache_file="qrcode.png"; //var_dump($cache_file); //imagepng($png_qj,$cache_file); //imagedestroy($png_qj); //$png_qj=read_file1($cache_file); //del_file($cache_file); //$pic="data:image/png;base64,".chunk_split(base64_encode($png_qj)); $json_data.="\"ewmsrc\":\"".$pic."\","; $wddd=get_db_msg("select * from ".$table_pre."plugin_print where uid='".$uid."'"); $url="../admin/debug/".$wddd["file_name"]; $json_data.="\"url\":\"".$url."\","; break; case "show_ewm": //显示二维码 include THIS_FILE_ROOT.'/include/phpqrcode/phpqrcode.php'; $value = $username; $errorCorrectionLevel = 'L';//容错级别 $matrixPointSize = 16;//生成图片大小 ob_start(); QRcode::png($value, false, $errorCorrectionLevel, $matrixPointSize, 2); $data =ob_get_contents(); ob_end_clean(); $pic="data:image/png;base64,".base64_encode($data); $json_data.="\"ewmsrc\":\"".$pic."\","; break; case "jlqz": //经理签字 $arr_zd=array("brand"=>get_cate_title_no("arr_select","brand"),"no"=>"款号","bc"=>get_cate_title_no("arr_select","bc"),"category"=>get_cate_title_no("arr_select","category"),"category1"=>get_cate_title_no("arr_select","category1")); //-------------------处理尺码表头 //取得合并尺码 $arr_size_merged=get_size_merged(); $num_size_total=count($arr_size_merged); //取得尺码合计sql $sql_sum_num=""; for($k=0;$k<$num_size_total;$k++){ $sql_sum_num.="sum(num_".$arr_size_merged[$k].") 'num_".$arr_size_merged[$k]."',"; } //取得尺码表头内容 $num_size_group=0; $size_tr=array(); $r1=$db->query("select * from ".$table_pre."keyword where cate='size' order by ord"); while($m1=$db->fetch_array($r1)){ $size_tr[$num_size_group]=""; for($i=1;$i<=$num_size_total;$i++){ $tmp=get_db_msg("select title from ".$table_pre."size where iid='".$m1["id"]."' and no='".$i."'"); $t=$tmp["title"]?$tmp["title"]:" "; $size_tr[$num_size_group].="".$t.""; } $arr_size_merged[]=$m1["no"]; $num_size_group++; } //-------------------/处理尺码表头结束 $tb=""; $tb.=""; foreach($arr_zd as $k1 => $v1){ $tb.=""; } $tb.="".$size_tr[0]; $tb.=""; $tb.=""; $tb.=""; for($i=1;$i<$num_size_group;$i++){ $tb.="".$size_tr[$i].""; } $tb.=""; $q="select iid,no from ".$table_pre."order where _key='".$s_key."' and ka<>'y'".$con_path." group by no order by brand,bc,no"; //echo $q."
"; $r=$db->query($q); $total_num=$total_money=$total_money_zk=0; $count=0; $arr_kh=$arr_kh_color=array(); $arr_tmp=array(); while($m=$db->fetch_array($r)){ $bg=($count%2)?"#f0f0f0":"#ffffff"; $m1=get_db_msg("select * from ".$table_pre."kh where id='".$m["iid"]."'"); $price_zk=get_price_zk($m1["id"],$m_client["id"]); //取得颜色,杯型 $q2="select color,bx,".get_size_sql("sum1")." from ".$table_pre."order where _key='".$s_key."' and ka<>'y' ".$con_path." and no='".$m["no"]."' group by no,color order by color,bx"; //echo $q2."
"; $r2=$db->query($q2); // $j=0; $je1=$num1=0; while($m2=$db->fetch_array($r2)){ $td_size1=""; $num_color_hj=0; $xj_num=0; for($k=0;$k<$num_size_total;$k++){ $ck_md=check_md($m1["no"],$m2["color"],$m2["bx"],$arr_size_merged[$k]); if($s_md=="n"){ if($ck_md!="n"){ $tmp_num=0; }else{ $tmp_num=$m2["num_".$arr_size_merged[$k]]; } }else{ $tmp_num=$m2["num_".$arr_size_merged[$k]]; } if($ck_md!="n"){ $price_zk1=$ck_md>0?$ck_md:$price_zk; $sty1="#999900"; }else{ $sty1=$bg; $price_zk1=$price_zk; } if($s_md=="n") $sty1=$bg; $je1+=$tmp_num*$price_zk1; $num1+=$tmp_num; $num_color_hj+=$tmp_num; //计算尺码合计 $v11="hj_num_".$k; $$v11+=$tmp_num; $xj_num+=$tmp_num; // $td_size1.=""; } if($num_color_hj>0){ $arr_tmp[$m["no"]]=$num_color_hj; $arr_kh_color[$count][$j]=""; if($bx_sizegroup_id>0) $arr_kh_color[$count][$j].=""; $arr_kh_color[$count][$j].=$td_size1; //小计 $arr_kh_color[$count][$j].=""; $arr_kh_color[$count][$j].=""; $arr_kh_color[$count][$j].=""; if($is_show_je=="y"){ //吊牌金额小计 #$arr_kh_color[$count][$j].=""; //结算金额小计 #if(trim($zk_type) || $check_md["num"]>0) #$arr_kh_color[$count][$j].=""; } $j++; } } $total_num+=$num1; $total_money+=$num1*$m1["price"]; $total_money_zk+=$je1; // if($num1>0){ $arr_kh[$count]["id"]=$m1["id"]; $arr_kh[$count]["no"]=$m1["no"]; $xh=get_kh_xh($m1); $xh=$xh>0?$xh."#":""; $arr_kh[$count]["xh"]=$xh; $arr_kh[$count]["title"]=$m1["title"]; $arr_kh[$count]["series"]=get_cate_title_no("series",$m1["series"]); $arr_kh[$count]["brand"]=get_cate_title_no("brand",$m1["brand"]); $arr_kh[$count]["season"]=get_cate_title_no("season",$m1["season"]); $arr_kh[$count]["bc"]=get_cate_title_no("bc",$m1["bc"]); $arr_kh[$count]["category"]=get_cate_title_no("category",$m1["category"]); $arr_kh[$count]["category1"]=get_cate_title_no("category1",$m1["category1"]); $arr_kh[$count]["num"]=$num1; $arr_kh[$count]["price"]=$m1["price"]; $arr_kh[$count]["je"]=$je1; $count++; } } //组合输出内容 $count=0; for($i=0;$i $v1){ $tmp_zd.=""; } $tb.="".$tmp_zd.$arr_kh_color[$i][$j]; $tb.=""; $count++; } } $td_size1=""; for($k=0;$k<$num_size_total;$k++){ $v1="hj_num_".$k; $td_size1.=""; } if($bx_sizegroup_id>0){ $colspan1=count($arr_zd)+2; $colspan_all=count($arr_zd)+3; }else{ $colspan1=count($arr_zd)+1; $colspan_all=count($arr_zd)+2; } $tb.="".$td_size1.""; $tb.="
".$v1."颜色小计吊牌价吊牌总额
".deel_td(deel_0($tmp_num))."".$m2["color"]."-".get_cate_title_no("color",$m2["color"])."".deel_td($m2["bx"])."".$xj_num."".$m1["price"]."".$xj_num*$m1["price"]."".$xj_num*$m1["price"]."".$xj_num*$price_zk1."".deel_td($arr_kh[$i][$k1])."
".deel_td($$v1)."
合计".$total_num."".$total_money."

"; $json_data.="\"tb\":\"".$tb."\","; break; case "jlqz_save": //经理签字 //$qy_id=get_qy_id($msg_login1["path"]."-".$msg_login1["id"]); $arr_path=explode("-",$msg_login1["path"]); $sj_id=end($arr_path); $png_qj= sigJsonToImage($sign_qj,array('imageSize'=>array(600,300),"penWidth"=>4)); $cache_file="../admin/debug/sign/sign_".$msg_login1["id"].".png"; imagepng($png_qj,$cache_file); imagedestroy($png_qj); $png_qj=read_file1($cache_file); del_file($cache_file); $png_base64_qj="data:image/png;base64,".chunk_split(base64_encode($png_qj)); //print_r($png_base64_qj); $png_sp= sigJsonToImage($sign_sp,array('imageSize'=>array(600,300),"penWidth"=>4)); $cache_file1="../admin/debug/sign/sign_".$msg_login1["id"]."_sp.png"; imagepng($png_sp,$cache_file1); imagedestroy($png_sp); $png_sp=read_file1($cache_file1); del_file($cache_file1); $png_base64_sp="data:image/png;base64,".chunk_split(base64_encode($png_sp)); //print_r($png_base64_sp); // $png_client= sigJsonToImage($sign_client,array('imageSize'=>array(600,300),"penWidth"=>4)); $cache_file2="../admin/debug/sign/sign_".$msg_login1["id"]."_qj.png"; imagepng($png_client,$cache_file2); imagedestroy($png_client); $png_client=read_file1($cache_file2); del_file($cache_file2); $png_base64_client="data:image/png;base64,".chunk_split(base64_encode($png_client)); //print_r($png_base64_client); $check_client=get_db_msg("select id from ".$table_pre."order_qm where uid='".$msg_login1["id"]."'"); if(!$check_client["id"]){ $db->query("insert into ".$table_pre."order_qm (uid,qm_kh,qm_qj,qm_sp) values ('".$msg_login1["id"]."','".$png_base64_client."','".$png_base64_qj."','".$png_base64_sp."')"); }else{ $db->query("update ".$table_pre."order_qm set qm_kh='".$png_base64_client."',qm_qj='".$png_base64_qj."',qm_sp='".$png_base64_sp."' where uid='".$msg_login1["id"]."'"); } $html=" "; $m_client=$msg_login1; $zbTmp=get_db_msg("select sum(zb) zb from web_client_brand where cid='".$m_client['id']."'"); $p_title=$m_client["title"]."(".$m_client["username"].") "; //------------订单明细 $sys_client_title=get_set("sys_client_title"); $dl_id=get_dl_id($m_client["path"]); $dl_title=get_db_msg("select title from ".$table_pre."client where id='".$dl_id."'"); $title_dl=$$dl_title["title"]?$dl_title["title"]."-":""; if($title_exp) $title_exp=",不含".substr($title_exp,0,-1); $html.="
"; $html.=""; } $arr_size_merged[]=$m1["no"]; $num_size_group++; } //-------------------/处理尺码表头结束 $tb=""; $tb.="
".$sys_client_title."
".$title_dl.substr($p_title,0,-1).$title_exp."明细单 ".date("Y年m月d日 H点i分")."
"; $arr_zd=array("brand"=>get_cate_title_no("arr_select","brand"),"no"=>"款号","bc"=>get_cate_title_no("arr_select","bc"),"category"=>get_cate_title_no("arr_select","category"),"category1"=>get_cate_title_no("arr_select","category1")); //-------------------处理尺码表头 //取得合并尺码 $arr_size_merged=get_size_merged(); $num_size_total=count($arr_size_merged); //取得尺码合计sql $sql_sum_num=""; for($k=0;$k<$num_size_total;$k++){ $sql_sum_num.="sum(num_".$arr_size_merged[$k].") 'num_".$arr_size_merged[$k]."',"; } //取得尺码表头内容 $num_size_group=0; $size_tr=array(); $r1=$db->query("select * from ".$table_pre."keyword where cate='size' order by ord"); while($m1=$db->fetch_array($r1)){ $size_tr[$num_size_group]=""; for($i=1;$i<=$num_size_total;$i++){ $tmp=get_db_msg("select title from ".$table_pre."size where iid='".$m1["id"]."' and no='".$i."'"); $t=$tmp["title"]?$tmp["title"]:" "; $size_tr[$num_size_group].="
".$t."
"; foreach($arr_zd as $k1 => $v1){ $tb.=""; } $tb.="".$size_tr[0]; $tb.=""; $tb.=""; $tb.=""; for($i=1;$i<$num_size_group;$i++){ $tb.="".$size_tr[$i].""; } $tb.=""; $q="select iid,no from ".$table_pre."order where _key='".$s_key."' and ka<>'y'".$con_path." group by no order by brand,bc,no"; //echo $q."
"; $r=$db->query($q); $total_num=$total_money=$total_money_zk=0; $count=0; $arr_kh=$arr_kh_color=array(); $arr_tmp=array(); while($m=$db->fetch_array($r)){ $bg=($count%2)?"#f0f0f0":"#ffffff"; $m1=get_db_msg("select * from ".$table_pre."kh where id='".$m["iid"]."'"); $price_zk=get_price_zk($m1["id"],$m_client["id"]); //取得颜色,杯型 $q2="select color,bx,".get_size_sql("sum1")." from ".$table_pre."order where _key='".$s_key."' and ka<>'y' ".$con_path." and no='".$m["no"]."' group by no,color order by color,bx"; //echo $q2."
"; $r2=$db->query($q2); // $j=0; $je1=$num1=0; while($m2=$db->fetch_array($r2)){ $td_size1=""; $num_color_hj=0; $xj_num=0; for($k=0;$k<$num_size_total;$k++){ $ck_md=check_md($m1["no"],$m2["color"],$m2["bx"],$arr_size_merged[$k]); if($s_md=="n"){ if($ck_md!="n"){ $tmp_num=0; }else{ $tmp_num=$m2["num_".$arr_size_merged[$k]]; } }else{ $tmp_num=$m2["num_".$arr_size_merged[$k]]; } if($ck_md!="n"){ $price_zk1=$ck_md>0?$ck_md:$price_zk; $sty1="#999900"; }else{ $sty1=$bg; $price_zk1=$price_zk; } if($s_md=="n") $sty1=$bg; $je1+=$tmp_num*$price_zk1; $num1+=$tmp_num; $num_color_hj+=$tmp_num; //计算尺码合计 $v11="hj_num_".$k; $$v11+=$tmp_num; $xj_num+=$tmp_num; // $td_size1.=""; } if($num_color_hj>0){ $arr_tmp[$m["no"]]=$num_color_hj; $arr_kh_color[$count][$j]=""; if($bx_sizegroup_id>0) $arr_kh_color[$count][$j].=""; $arr_kh_color[$count][$j].=$td_size1; //小计 $arr_kh_color[$count][$j].=""; $arr_kh_color[$count][$j].=""; $arr_kh_color[$count][$j].=""; if($is_show_je=="y"){ //吊牌金额小计 #$arr_kh_color[$count][$j].=""; //结算金额小计 #if(trim($zk_type) || $check_md["num"]>0) #$arr_kh_color[$count][$j].=""; } $j++; } } $total_num+=$num1; $total_money+=$num1*$m1["price"]; $total_money_zk+=$je1; // if($num1>0){ $arr_kh[$count]["id"]=$m1["id"]; $arr_kh[$count]["no"]=$m1["no"]; $xh=get_kh_xh($m1); $xh=$xh>0?$xh."#":""; $arr_kh[$count]["xh"]=$xh; $arr_kh[$count]["title"]=$m1["title"]; $arr_kh[$count]["series"]=get_cate_title_no("series",$m1["series"]); $arr_kh[$count]["brand"]=get_cate_title_no("brand",$m1["brand"]); $arr_kh[$count]["season"]=get_cate_title_no("season",$m1["season"]); $arr_kh[$count]["bc"]=get_cate_title_no("bc",$m1["bc"]); $arr_kh[$count]["category"]=get_cate_title_no("category",$m1["category"]); $arr_kh[$count]["category1"]=get_cate_title_no("category1",$m1["category1"]); $arr_kh[$count]["num"]=$num1; $arr_kh[$count]["price"]=$m1["price"]; $arr_kh[$count]["je"]=$je1; $count++; } } //组合输出内容 $count=0; for($i=0;$i $v1){ $tmp_zd.=""; } $tb.="".$tmp_zd.$arr_kh_color[$i][$j]; $tb.=""; $count++; } } $td_size1=""; for($k=0;$k<$num_size_total;$k++){ $v1="hj_num_".$k; $td_size1.=""; } if($bx_sizegroup_id>0){ $colspan1=count($arr_zd)+2; $colspan_all=count($arr_zd)+3; }else{ $colspan1=count($arr_zd)+1; $colspan_all=count($arr_zd)+2; } $tb.="".$td_size1.""; $tb.="
".$v1."颜色小计吊牌价吊牌总额
".deel_td(deel_0($tmp_num))."".$m2["color"]."-".get_cate_title_no("color",$m2["color"])."".deel_td($m2["bx"])."".$xj_num."".$m1["price"]."".$xj_num*$m1["price"]."".$xj_num*$m1["price"]."".$xj_num*$price_zk1."".deel_td($arr_kh[$i][$k1])."
".deel_td($$v1)."
合计".$total_num."".$total_money."
"; $html.=$tb; $html.=""; //------------签名 $html.="
客户签字 区域经理签字 商品经理签字
"; $html.="
"; //建立目录结构 $str_files=""; $dir=""; $arr_path=explode("-",$msg_login1["path"]); for($j=0;$j0){ $m1=get_db_msg("select username,title from ".$table_pre."client where id='".$arr_path[$j]."'"); $dir.="/".$m1["username"]; make_dir("../admin/debug/sign".$dir); } } $arr_file = scandir("../admin/debug/sign".$dir); foreach($arr_file as $v){ $tmp=explode("_",$v); if($msg_login1["username"]==$tmp[0] && count($tmp)>1) unlink("../admin/debug/sign".$dir."/".$v); if($msg_login1["title"]."(".$msg_login1["username"].")"==$tmp[0] && count($tmp)>1) unlink("../admin/debug/sign".$dir."/".$v); } //------------写入 //中文名文件 $file_name=$msg_login1["title"]."(".$msg_login1["username"].")_".date("Y-m-d-H-i-s").".html"; $file_name=iconv("utf-8","gb2312",$file_name); $file_state=file_put_contents("../admin/debug/sign".$dir."/".$file_name,$html); //用户名文件 $file_name_sign=$msg_login1["username"]."_".date("Y-m-d-H-i-s").".html"; $file_state_sign=file_put_contents("../admin/debug/sign".$dir."/".$file_name_sign,$html); $str_filename_sign="sign".$dir."/".$file_name_sign."|"; // $con_str_filename.=$str_filename_sign; $con_str_filename=substr($con_str_filename,0,-1); //加入客户订单操作日志表 //var_dump($file_state); if($file_state_sign){ $add_date=date("Y-m-d H:i:s"); $q1="insert into ".$table_pre."order_state (uid,cid,brand,action,attachments,add_date) values ('".$uid."','".$uid."','".$s_brand."','客户签字','".$con_str_filename."','".$add_date."')"; $db->query($q1); $check=get_db_msg("select id from ".$table_pre."plugin_print where uid='".$uid."' "); if(!$check["id"]) $q2="insert into ".$table_pre."plugin_print (uid,brand,file_name,ip) values ('".$uid."','".$s_brand."','".$con_str_filename."','".$_SERVER['HTTP_HOST']."')"; else $q2="update ".$table_pre."plugin_print set file_name='".$con_str_filename."',ip='".$_SERVER['HTTP_HOST']."' where uid='".$uid."' "; $db->query($q2); } $json_data.="\"msg\":\"操作成功!\","; $json_data.="\"code\":101,"; $json_data.="\"refresh\":\"y\","; $json_data=substr($json_data,0,-1)."}"; echo $json_data; exit; break; case "jd": //交单 //横向维度 $zd1="brand"; //服配鞋品 $zd2="gender"; //性别 $zd3="category"; //大类 $fp="11"; //Q3 $xp="12"; //Q4 // for($i=1;$i<4;$i++){ $v="zd".$i; $v1="zd_title".$i; $v2="arr_zd".$i; //取得对应字段的名称 $$v1=get_cate_title_no("arr_select",$$v); //取得字段的选项值 $q1="select no,title from ".$table_pre."keyword where cate='".$$v."' order by no"; $r1=$db->query($q1); $arr_tmp=array(); while($m1=$db->fetch_array($r1)){ $arr_tmp[$m1["no"]]=$m1["title"]; } $$v2=$arr_tmp; } $tb=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; foreach($arr_zd1 as $n1 => $t1){ $tb.=""; $tb.=""; $tmp_zb=get_db_msg("select * from web_client_brand where cid='".$msg_login1["id"]."' and brand='".$n1."'"); $tmp_order=get_db_msg("select sum(num) js,sum(je) je from web_order where brand='".$n1."' and ka<>'y'".$con_path); $tb.=""; $tb.=""; $tb.=""; $je=keep_float($tmp_order["je"]/10000,2); $tb.=""; $tb.=""; $tb.=""; } $tb.="
服配鞋品指标完成情况
件数吊牌额
指标完成完成率指标完成完成率
".$t1."".$tmp_zb["zb_js"]."".$tmp_order["js"]."".deel_bfb1($tmp_order["js"],$tmp_zb["zb_js"],1)."".$tmp_zb["zb"]."".$je."".deel_bfb1($je,$tmp_zb["zb"],1)."

"; $tb.="Q3服装-性别"; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $q3="select * from ".$table_pre."kh where ka<>'y' and brand='".$fp."'"; $r3=$db->query($q3); $fp_ks_total=$fp_skc_total=0; $arr_xb_ks=$arr_xb_skc=array(); while($m3=$db->fetch_array($r3)){ $arr_kh_color=array_diff(explode(",",$m3["color"]),explode(",",$m3["color_ka"])); $fp_skc_total+=count($arr_kh_color); $fp_ks_total++; $arr_xb_ks[$m3[$zd2]]++; $arr_xb_skc[$m3[$zd2]]+=count($arr_kh_color); } $order_total=get_db_msg("select count(distinct no) 'ks',count(distinct no,color) 'skc',sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ka<>'y' and brand='".$fp."'".$con_path); foreach($arr_zd2 as $n2 => $t2){ $order=get_db_msg("select count(distinct no) 'ks',count(distinct no,color) 'skc',sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ka<>'y' and brand='".$fp."' and ".$zd2."='".$n2."'".$con_path); $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; } $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.="
性别设计款数已订款数设计款色数已订款色数已订件数已订吊牌额
款数占比款数占比款色数占比款色数占比件数占比吊牌额占比
".$t2."".$arr_xb_ks[$n2]."".deel_bfb1($arr_xb_ks[$n2],$fp_ks_total,1)."".$order["ks"]."".deel_bfb1($order["ks"],$order_total["ks"],1)."".$arr_xb_skc[$n2]."".deel_bfb1($arr_xb_skc[$n2],$fp_skc_total,1)."".$order["skc"]."".deel_bfb1($order["skc"],$order_total["skc"],1)."".$order["num"]."".deel_bfb1($order["num"],$order_total["num"],1)."".$order["je"]."".deel_bfb1($order["je"],$order_total["je"],1)."
总计".$fp_ks_total."100%".$order_total["ks"]."100%".$fp_skc_total."100%".$order_total["skc"]."100%".$order_total["num"]."100%".$order_total["je"]."100%

"; $tb.="Q4服装-性别"; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $q3="select * from ".$table_pre."kh where ka<>'y' and brand='".$xp."'"; $r3=$db->query($q3); $fp_ks_total=$fp_skc_total=0; $arr_xb_ks=$arr_xb_skc=array(); while($m3=$db->fetch_array($r3)){ $arr_kh_color=array_diff(explode(",",$m3["color"]),explode(",",$m3["color_ka"])); $fp_skc_total+=count($arr_kh_color); $fp_ks_total++; $arr_xb_ks[$m3[$zd2]]++; $arr_xb_skc[$m3[$zd2]]+=count($arr_kh_color); } $order_total=get_db_msg("select count(distinct no) 'ks',count(distinct no,color) 'skc',sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ka<>'y' and brand='".$xp."'".$con_path); foreach($arr_zd2 as $n2 => $t2){ $order=get_db_msg("select count(distinct no) 'ks',count(distinct no,color) 'skc',sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ka<>'y' and brand='".$xp."' and ".$zd2."='".$n2."'".$con_path); $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; } $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.="
性别设计款数已订款数设计款色数已订款色数已订件数已订吊牌额
款数占比款数占比款色数占比款色数占比件数占比吊牌额占比
".$t2."".$arr_xb_ks[$n2]."".deel_bfb1($arr_xb_ks[$n2],$fp_ks_total,1)."".$order["ks"]."".deel_bfb1($order["ks"],$order_total["ks"],1)."".$arr_xb_skc[$n2]."".deel_bfb1($arr_xb_skc[$n2],$fp_skc_total,1)."".$order["skc"]."".deel_bfb1($order["skc"],$order_total["skc"],1)."".$order["num"]."".deel_bfb1($order["num"],$order_total["num"],1)."".$order["je"]."".deel_bfb1($order["je"],$order_total["je"],1)."
总计".$fp_ks_total."100%".$order_total["ks"]."100%".$fp_skc_total."100%".$order_total["skc"]."100%".$order_total["num"]."100%".$order_total["je"]."100%

"; $tb.="Q3服装-大类"; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $q3="select * from ".$table_pre."kh where ka<>'y' and brand='".$fp."'"; $r3=$db->query($q3); $fp_ks_total=$fp_skc_total=0; $arr_xb_ks=$arr_xb_skc=array(); while($m3=$db->fetch_array($r3)){ $arr_kh_color=array_diff(explode(",",$m3["color"]),explode(",",$m3["color_ka"])); $fp_skc_total+=count($arr_kh_color); $fp_ks_total++; $arr_xb_ks[$m3[$zd3]]++; $arr_xb_skc[$m3[$zd3]]+=count($arr_kh_color); } $order_total=get_db_msg("select count(distinct no) 'ks',count(distinct no,color) 'skc',sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ka<>'y' and brand='".$fp."'".$con_path); foreach($arr_zd3 as $n2 => $t2){ $order=get_db_msg("select count(distinct no) 'ks',count(distinct no,color) 'skc',sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ka<>'y' and brand='".$fp."' and ".$zd2."='".$n2."'".$con_path); $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; } $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.="
大类设计款数已订款数设计款色数已订款色数已订件数已订吊牌额
款数占比款数占比款色数占比款色数占比件数占比吊牌额占比
".$t2."".$arr_xb_ks[$n2]."".deel_bfb1($arr_xb_ks[$n2],$fp_ks_total,1)."".$order["ks"]."".deel_bfb1($order["ks"],$order_total["ks"],1)."".$arr_xb_skc[$n2]."".deel_bfb1($arr_xb_skc[$n2],$fp_skc_total,1)."".$order["skc"]."".deel_bfb1($order["skc"],$order_total["skc"],1)."".$order["num"]."".deel_bfb1($order["num"],$order_total["num"],1)."".$order["je"]."".deel_bfb1($order["je"],$order_total["je"],1)."
总计".$fp_ks_total."100%".$order_total["ks"]."100%".$fp_skc_total."100%".$order_total["skc"]."100%".$order_total["num"]."100%".$order_total["je"]."100%

"; $tb.="Q4服装-大类"; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $q3="select * from ".$table_pre."kh where ka<>'y' and brand='".$xp."'"; $r3=$db->query($q3); $fp_ks_total=$fp_skc_total=0; $arr_xb_ks=$arr_xb_skc=array(); while($m3=$db->fetch_array($r3)){ $arr_kh_color=array_diff(explode(",",$m3["color"]),explode(",",$m3["color_ka"])); $fp_skc_total+=count($arr_kh_color); $fp_ks_total++; $arr_xb_ks[$m3[$zd3]]++; $arr_xb_skc[$m3[$zd3]]+=count($arr_kh_color); } $order_total=get_db_msg("select count(distinct no) 'ks',count(distinct no,color) 'skc',sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ka<>'y' and brand='".$xp."'".$con_path); foreach($arr_zd3 as $n2 => $t2){ $order=get_db_msg("select count(distinct no) 'ks',count(distinct no,color) 'skc',sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ka<>'y' and brand='".$xp."' and ".$zd2."='".$n2."'".$con_path); $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; } $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.=""; $tb.="
大类设计款数已订款数设计款色数已订款色数已订件数已订吊牌额
款数占比款数占比款色数占比款色数占比件数占比吊牌额占比
".$t2."".$arr_xb_ks[$n2]."".deel_bfb1($arr_xb_ks[$n2],$fp_ks_total,1)."".$order["ks"]."".deel_bfb1($order["ks"],$order_total["ks"],1)."".$arr_xb_skc[$n2]."".deel_bfb1($arr_xb_skc[$n2],$fp_skc_total,1)."".$order["skc"]."".deel_bfb1($order["skc"],$order_total["skc"],1)."".$order["num"]."".deel_bfb1($order["num"],$order_total["num"],1)."".$order["je"]."".deel_bfb1($order["je"],$order_total["je"],1)."
总计".$fp_ks_total."100%".$order_total["ks"]."100%".$fp_skc_total."100%".$order_total["skc"]."100%".$order_total["num"]."100%".$order_total["je"]."100%

"; $json_data.="\"tb\":\"".$tb."\","; break; case "jd_do": //交单 if($is_brand=="y"){ $msg=check_dhgz_client($uid); if($msg!="y"){ $json_data.="\"code\":0,\"msg\":\"".$msg."\","; }else{ $con_brand=""; if($s_brand){ $arr_s_brand=explode(",",$s_brand); for($i=0;$iquery($q); $url=$_SERVER["PHP_SELF"]."?_m=".$_m."&_a=o&s_tab=wcl"; //记录订单操作日志 update_order_state($uid,$uid,"交单",""); $json_data.="\"msg\":\"订单提交成功,请等待客户经理确认!\","; $json_data.="\"code\":101,"; } }else{ //检查订货规则 $msg=check_dhgz_client($uid); if($msg!="y"){ $json_data.="\"code\":0,\"msg\":\"".$msg."\","; }else{ $q="update ".$table_pre."client set is_jd='y' where id='".$uid."'"; $db->query($q); $url=$_SERVER[PHP_SELF]."?_m=".$_m.$link_var_brand; //记录订单操作日志 update_order_state($uid,$uid,"交单",""); $json_data.="\"msg\":\"订单提交成功,请等待客户经理确认!\","; $json_data.="\"code\":101,"; } //alert_and_redirect("订单提交成功,请等待客户经理确认!",$url); } $json_data.="\"refresh\":\"y\","; $json_data=substr($json_data,0,-1)."}"; echo $json_data; exit; break; } $json_data.="\"code\":100,"; $json_data=substr($json_data,0,-1)."}"; echo $json_data; ?>