"到款","ds"=>"到色"); //$arrcc=array("1"=>"第一场","2"=>"第二场","3"=>"第三场","4"=>"第四场","5"=>"第五场","6"=>"第六场"); //$arrccs=array("1"=>"'1','2','3'","2"=>"'4','5','6'","3"=>"'7','8','9'","4"=>"'10','11','12'","5"=>"'13','14','15'","6"=>"'16','17','18'"); $arrcc=array("1"=>"10A","2"=>"10B","3"=>"10C","4"=>"11A","5"=>"11B","6"=>"12A"); $arrccs=array("1"=>"'1'","2"=>"'2'","3"=>"'3'","4"=>"'13','14','15'","5"=>"'16','17'","6"=>"'18'"); $s_type=$s_type?$s_type:"dk"; $q1="select * from ".$table_pre."kh_ty group by zsh"; $r1=$db->query($q1); $op=""; while($m1=$db->fetch_array($r1)){ $op.="{\"no\":\"".$m1["zsh"]."\",\"title\":\"".$m1["title"]."\"},"; //$op1.=""; } $select.="{\"name\":\"s_zsh\",\"title\":\"选择杆\",\"value\":\"".$s_zsh."\",\"op\":[".deel_end($op)."]},"; $op=""; foreach($arrcc as $k => $v){ $op.="{\"no\":\"".$k."\",\"title\":\"".$v."\"},"; //$op3.=""; } $select.="{\"name\":\"s_cc\",\"title\":\"选择场次\",\"value\":\"".$s_cc."\",\"op\":[".deel_end($op)."]},"; $op=""; foreach($zd_arr as $k => $v){ $op.="{\"no\":\"".$k."\",\"title\":\"".$v."\"},"; //$op2.=""; } $select.="{\"name\":\"s_type\",\"title\":\"到款到色\",\"value\":\"".$s_type."\",\"op\":[".deel_end($op)."]},"; $con=""; $content_search.=" "; $content_search.=" "; $content_search.=""; $content_search.=" "; //读取所有款号订单数据 $arr_order_kh=array(); $q="select no,sum(num) 'num',count(distinct(uid)) 'num_client' from ".$table_pre."order group by no order by num desc"; $r=$db->query($q); $arr_kh_pm=array();//款号排名数据 $arr_order_kh=array();//款号订单数据 while($m=$db->fetch_array($r)){ $arr_order_kh[$m["no"]]=array($m["num"],$m["num_client"]); $arr_kh_pm[]=$m["num"]; } $arr_kh_pm[]=0; //取得款类排行数组 $arr_kl_pm=array();//款类排名数据 $q1="select no,title from ".$table_pre."keyword where cate='".$zd1."'"; $r1=$db->query($q1); while($m1=$db->fetch_array($r1)){ $q2="select sum(num) 'num' from ".$table_pre."order where ".$zd1."='".$m1["no"]."' group by no order by num desc"; $r2=$db->query($q2); $i=0; while($m2=$db->fetch_array($r2)){ $arr_kl_pm[$m1["no"]][$i]=$m2["num"]; $i++; } } //取得款色订单数据,款色排名数组 $q="select no,color,sum(num) 'num' from ".$table_pre."order group by no,color order by num desc"; $r=$db->query($q); $arr_order_color=array();//款色 $arr_ks_pm=array();//款色排名数组 $total_num=0; $i=0; while($m=$db->fetch_array($r)){ $arr_order_color[$m["no"]][$m["color"]]=array($m["num"]); $arr_ks_pm[$i]=$m["num"]; $total_num+=$m["num"]; $i++; } $arr_ks_pm[]=0; $con1=""; if($$n){ $con1.=" and ".$zd1."='".$$n."'"; } $con_in=""; if($s_type=="dk"){ /*if($s_zsh){ //取得这个组的所有款 $q1="select dp.kh from ".$table_pre."kh_dp dp,".$table_pre."kh_ty cl where cl.zsh='".$s_zsh."' and cl.kh=dp.zsh group by kh"; $r1=$db->query($q1); $str_in=""; while($m1=$db->fetch_array($r1)){ $str_in.="'".$m1["kh"]."',"; } if($str_in) $con_in=" and no in(".substr($str_in,0,-1).")"; }*/ if($s_zsh){ $con_in=" and exists(select * from web_kh_dp,web_kh_ty where web_order.no=web_kh_dp.kh and web_kh_ty.zsh='".$s_zsh."' and web_kh_ty.kh=web_kh_dp.title)"; }elseif($s_cc){ $con_in=" and exists(select * from web_kh_dp,web_kh_ty where web_order.no=web_kh_dp.kh and (web_kh_ty.zsh in (".$arrccs[$s_cc].")) and web_kh_ty.kh=web_kh_dp.title)"; } $q="select iid,no,sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ka<>'y'".$con1.$con_in." group by iid order by num desc"; }else{ /*if($s_zsh){ //取得这个组的所有款 $q1="select dp.kh,dp.color from ".$table_pre."kh_dp dp,".$table_pre."kh_ty cl where cl.zsh='".$s_zsh."' and cl.kh=dp.zsh"; $r1=$db->query($q1); $str_in=""; while($m1=$db->fetch_array($r1)){ $str_in.="'".$m1["kh"]."|".$m1["color"]."',"; } if($str_in) $con_in=" and concat(no,'|',color) in(".substr($str_in,0,-1).")"; }*/ if($s_zsh){ $con_in=" and exists(select * from web_kh_dp,web_kh_ty where web_order.no=web_kh_dp.kh and web_order.color=web_kh_dp.color and web_kh_ty.zsh='".$s_zsh."' and web_kh_ty.kh=web_kh_dp.title)"; }elseif($s_cc){ $con_in=" and exists(select * from web_kh_dp,web_kh_ty where web_order.no=web_kh_dp.kh and web_order.color=web_kh_dp.color and (web_kh_ty.zsh in (".$arrccs[$s_cc].")) and web_kh_ty.kh=web_kh_dp.title)"; } $q="select iid,no,color,sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ka<>'y'".$con1.$con_in." group by iid,color order by num desc"; } $r=$db->query($q); $list=1; $content.="