'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"]; } $con=""; if($s_ka){ if($s_ka=="n") $con.=" and ka<>'y'"; else $con.=" and ka='".$s_ka."'"; } $con_u=""; if($s_uid){ if($s_uid=="_ALL_"){ $con.=$cou_u_all; $con_u.=$cou_u_all; }else{ $m1=get_db_msg("select * from ".$table_pre."client where id='".$s_uid."'"); if($m1["face"]=="4"){ $con.=" and uid='".$s_uid."'"; $con_u.=" and uid='".$s_uid."'"; }else{ $con.=" and (upath='".$m1["path"]."-".$m1["id"]."' or upath like '".$m1["path"]."-".$m1["id"]."-%')"; $con_u.=" and (upath='".$m1["path"]."-".$m1["id"]."' or upath like '".$m1["path"]."-".$m1["id"]."-%')"; } } }else{ $con.=" and uid=0"; $con_u.=" and uid=0"; } for($i=0;$i $v){ $tmp_order_flag.="{\"no\":\"".$k."\",\"title\":\"".$v."\"},"; } $show_key=""; if(count($arr_sys_order_flag)>1){ $tmp_order_flag.="{\"no\":\"all\",\"title\":\"所有订单\"},"; $show_key="y"; $json_data.="\"show_key\":\"".$show_key."\","; $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; $con_f=""; if($s_key){ if($s_key=="all"){ $con_f=""; }else{ $con_f=" and _key='".$s_key."'"; } $json_data.="\"s_key\":\"".$s_key."\","; } } $json_data.="\"con_f\":\"".$con_f."\","; switch($face){ case "1": break; case "2": $s_ph_ms=$s_ph_ms?$s_ph_ms:"ph_dk"; $arr_op_ph_ms=array("ph_dk"=>d_translate("ph_dk"),"ph_ds"=>d_translate("ph_ds")); if($s_ph_ms=="ph_ds"){ $con_group_by="no,color"; $hj_colspan=5; }else{ $con_group_by="no"; $hj_colspan=4; } $s_order=$s_order?$s_order:"num"; // //排行模式 if(count($arr_ph_ms)>1){ $content_search.=" "; } $op_client=""; $i1=0; $search_select_no[$i1]="s_ph_ms"; $search_select_op[$i1]["ph_dk"]="到款"; $search_select_op[$i1]["ph_ds"]="到色"; $i1++; $search_select_no[$i1]="s_uid"; $search_select_op[$i1][""]="选择客户"; $search_select_op[$i1]["_ALL_"]="所有客户"; for($i=0;$i0) $this_js="-".$m1["order_num"]."件"; $op_client.=">".$m1["title"]."(".$m1["username"].")".$this_js.""; $search_select_op[$i1][$v]="".$m1["title"]."(".$m1["username"].")".$this_js.""; } } //选项前面 $select_qm=""; $arr_sz=array(); for($i=0;$i$value){ $tmp.="{\"no\":\"".$key."\",\"title\":\"".$value."\"},"; $arr_sz[$i]=$value; } $tmp=deel_end($tmp); $var=$search_select_no[$i]; $select_qm.="{\"no\":\"".$search_select_no[$i]."\",\"title\":\"".$search_select_op[$i][0]."\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},"; } $select_qm=deel_end($select_qm); //取得定制选项 $select_dz=""; for($i=0;$iquery("select no,title from ".$table_pre."keyword where cate='".$arr_select_no[$i]."' order by no"); while($m1=$db->fetch_array($r1)){ $tmp.="{\"no\":\"".$m1["no"]."\",\"title\":\"".$m1["title"]."\"},"; } $tmp=deel_end($tmp); $var="s_".$arr_select_no[$i]; $select_dz.="{\"no\":\"".$arr_select_no[$i]."\",\"title\":\"".$arr_select_title[$i]."\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},"; } $select_dz=deel_end($select_dz); $json_data.="\"select_dz\":[".$select_dz."],"; $search_select_op=$search_select_no=array(); $i1=0; $search_select_no[$i1]="s_order"; $search_select_op[$i1]=array("num"=>"数量排序","je"=>"金额排序"); $i1++; //选项后 $select_hm=""; $arr_sz=array(); for($i=0;$i$value){ $tmp.="{\"no\":\"".$key."\",\"title\":\"".$value."\"},"; $arr_sz[$i]=$value; } $tmp=deel_end($tmp); $var=$search_select_no[$i]; $select_hm.="{\"no\":\"".$search_select_no[$i]."\",\"title\":\"".$search_select_op[$i][0]."\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},"; } $select_hm=deel_end($select_hm); $json_data.="\"s_kh\":\"".$s_kh."\",\"select_qm\":[".$select_qm."],\"select_hm\":[".$select_hm."],"; $json_data.="\"table_top\":[\"排名\",\"this|款号\","; if($s_ph_ms=="ph_ds") $json_data.="\"颜色\","; $json_data.="\"".d_translate("dpj")."\",\"件数\",\"".d_translate("dpje")."\"],"; // //取得我的排名数组 $arr_ph=array(); $q1="select sum(num) 'num',sum(je) 'je' from ".$table_pre."order where id<>'0'".$con_u.$con_f." group by ".$con_group_by." order by ".$s_order." desc "; $r1=$db->query($q1); while($m1=$db->fetch_array($r1)){ $arr_ph[]=$m1[$s_order]; } if($s_kh){ $con.=" and no like '%".$s_kh."%'"; } $q1="select iid,color,sum(num) 'num',sum(je) 'je' from ".$table_pre."order where id<>'0' and ka<>'y'".$con.$con_f." group by ".$con_group_by." order by ".$s_order." desc "; //echo $q1."
"; $r1=$db->query($q1); while($m1=$db->fetch_array($r1)){ $page_total_num++; } $pages=ceil($page_total_num/$page_num); $limit_con=($page-1)*$page_num; $q="select iid,color,sum(num) 'num',sum(je) 'je' from ".$table_pre."order where id<>'0' and ka<>'y'".$con.$con_f." group by ".$con_group_by." order by ".$s_order." desc limit ".$limit_con.",".$page_num.""; //echo $q."
"; $r=$db->query($q); $total_num=$total_money=$count=0; while($m=$db->fetch_array($r)){ $c1=($count%2)?"td1":"td2"; $list=$count+1; $m1=get_db_msg("select * from ".$table_pre."kh where id='".$m["iid"]."'"); $num=$m["num"]; $total_num+=$num; $money=$m["je"]; $total_money+=$money; //图片获取规则 if($s_ph_ms=="ph_ds") $pic=get_kh_color_picture($m1["no"],$m["color"],$flag_pad_offline); else $pic=get_kh_picture($m1["no"],$m1["main_pic"],$m1["color"],$flag_pad_offline); $pic="'".$pic."' ".str_replace("\"","'",out_good_pic_set($pic,80,80))." border=0"; $pm=(get_main_key($arr_ph,$m[$s_order])+1); if($s_ph_ms=="ph_ds"){ $td_color="\"".$m["color"]."-".get_cate_title_no("color",$m["color"])."\","; $href_color="&color=".$m["color"]; if($msg_login["qyjl_order"]!="n"){ $link1=""; }else{ $link1=""; } }else{ $td_color=$href_color=""; if($msg_login["qyjl_order"]!="n"){ $link1=""; }else{ $link1=""; } } $content.="".$pm."".get_kh_xh($m1,$m["color"])."".$link1.$m1["no"]."".$td_color; $json_data1.="[\"pma|".$pm."\",\"this|".get_kh_xh($m1,$m["color"])."|".$m1["id"]."|".$pic."|".$m1["no"]."\",".$td_color.""; if($s_ph_ms=="ph_ds") $colors=$m["color"]; else $colors=""; $json_data1.="\"".get_price_dp($uid,$m1["id"])."\",\"jianshu2|".$num."|".$m1["no"]."|".$colors."\",\"".deel_num($money)."\"],"; $content.="".get_price_dp($uid,$m1["id"])."".$num."".deel_num($money).""; $count++; } $json_data.="\"table_mid\":[".substr($json_data1,0,-1)."],"; $content.="合计".$total_num."".deel_num($total_money).""; $json_data.="\"pages\":\"".$pages."\","; break; case "3": $con=""; if($s_ka){ if($s_ka=="n") $con.=" and ka<>'y'"; else $con.=" and ka='".$s_ka."'"; } $con_u=""; if($s_uid){ $m1=get_db_msg("select * from ".$table_pre."client where id='".$s_uid."'"); if($m1["face"]=="4"){ $con.=" and uid='".$s_uid."'"; $con_u.=" and uid='".$s_uid."'"; }else{ $con.=" and (upath='".$m1["path"]."-".$m1["id"]."' or upath like '".$m1["path"]."-".$m1["id"]."-%')"; $con_u.=" and (upath='".$m1["path"]."-".$m1["id"]."' or upath like '".$m1["path"]."-".$m1["id"]."-%')"; } }else{ $con.=" and (upath='".$p."' or upath like '".$p."-%')"; $con_u.=" and (upath='".$p."' or upath like '".$p."-%')"; } for($i=0;$id_translate("ph_dk"),"ph_ds"=>d_translate("ph_ds")); if($s_ph_ms=="ph_ds"){ $con_group_by="no,color"; $hj_colspan=5; }else{ $con_group_by="no"; $hj_colspan=4; } $s_order=$s_order?$s_order:"num"; // //排行模式 if(count($arr_ph_ms)>1){ $content_search.=" "; } $op_client=""; $i1=0; $search_select_no[$i1]="s_ph_ms"; $search_select_op[$i1]["ph_dk"]="到款"; $search_select_op[$i1]["ph_ds"]="到色"; $i1++; $search_select_no[$i1]="s_uid"; $search_select_op[$i1][""]="选择客户"; //$search_select_op[$i1]["_ALL_"]="所有客户"; $op_client=""; $r=$db->query("select id,title,username,order_num from ".$table_pre."client where path='".$p."' or path like '".$p."-%' order by path,ord"); while($m=$db->fetch_array($r)){ $v=$m["id"]; $op_client.="