'y'"; $con1=" and ka<>'y'"; if($s_key){ if($s_key=="all"){ $con.=""; }else{ $con.=" and _key='".$s_key."'"; } } if($msg_client["face"]=="4"){ $s_username=$msg_client["username"]; $con.=" and uid='".$msg_client["id"]."'"; }else{ if($s_username){ $m2=get_db_msg("select id,face,path from ".$table_pre."client where username='".$s_username."'"); if($m2["face"]=="4"){ $con.=" and uid='".$m2["id"]."'"; }else{ $con.=" and (upath='".$m2["path"]."-".$m2["id"]."' or upath like '".$m2["path"]."-".$m2["id"]."-%')"; } }else if($msg_client["face"]=="2"){ //区经角色所有客户 $con.=get_qj_ucon_all($msg_client["charge_path_real"]); }else if($msg_client["face"]=="1"){ //区经角色所有客户 }else{ //代理角色所有客户 $con.=" and (upath='".$msg_client["path"]."-".$msg_client["id"]."' or upath like '".$msg_client["path"]."-".$msg_client["id"]."-%')"; } } if($zd1!="" && $zd2!=""){ //--------------------------------------二维报表 $json_data.="\"sys_bb_type\":\"bball_2w\","; // $arr_group_by_title=array(); $r1=$db->query("select no,title from ".$table_pre."keyword where cate='arr_select'"); while($m1=$db->fetch_array($r1)){ $arr_group_by_title[$m1["no"]]=$m1["title"]; } $arr_group_by_title["size"]="尺码"; $arr_group_by_title["color"]="颜色"; $arr_group_by_title["ks_size"]="款色深度"; // $s_group_by1=$zd1; $s_group_by2=$zd2; if($s_group_by2=="size"){ //取得已订总件数和金额 $tmp=get_db_msg("select sum(num) 'num',sum(je) 'je' from ".$table_pre."order where id>0".$con); $total_yd_js=$tmp["num"]; $total_yd_je=$tmp["je"]; //--------------------------------表头start $content_data=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; //--------------------------------表头end $q1="select * from ".$table_pre."keyword where cate='".$s_group_by1."' order by ord"; $r1=$db->query($q1); $count=$total_num=0; $l=0; while($m1=$db->fetch_array($r1)){ $tmp=get_db_msg("select size_group from ".$table_pre."kh where ".$s_group_by1."='".$m1["no"]."' limit 0,1"); $q="select * from ".$table_pre."size where iid='".$tmp["size_group"]."' order by iid,no"; $r=$db->query($q); // $tmp=get_db_msg("select sum(num) 'num',sum(je) 'je' from ".$table_pre."order where id>0 and ".$s_group_by1."='".$m1["no"]."'".$con); $xj_yd_js=$tmp["num"]; $xj_yd_je=$tmp["je"]; while($m=$db->fetch_array($r)){ $arr1=get_num_je_size_category($m["no"],$s_group_by1,$m1["no"]); $total_num+=$arr1[0]; $total_money+=$arr1[1]; if($arr1[0]>0){ $content_data.=""; $count++; } } $l++; } $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.="
".get_main_value($arr_group_by_title,$s_group_by1)."尺码已订件数件数占比吊牌金额金额占比
".$m1["title"]."".$m["title"]."".$arr1[0]."".deel_bfb($arr1[0],$xj_yd_js)."".$arr1[1]."".deel_bfb($arr1[1],$xj_yd_je)."
合计".$total_num."".$total_money."
"; }else if($s_group_by2=="ks_size"){ //取得已订总件数和金额 $tmp=get_db_msg("select sum(num) 'num',sum(je) 'je' from ".$table_pre."order where id>0".$con); $total_yd_js=$tmp["num"]; $total_yd_je=$tmp["je"]; //--------------------------------表头start $content_data=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; //--------------------------------表头end $q1="select * from ".$table_pre."keyword where cate='".$s_group_by1."' order by ord"; $r1=$db->query($q1); $count=$total_js=$total_kss=0; $l=0; while($m1=$db->fetch_array($r1)){ $q="select sum(num)/count(distinct iid,color) 'num',count(distinct iid,color) 'kss' from ".$table_pre."order where ".$s_group_by1."='".$m1["no"]."'".$con." group by num order by num"; $r=$db->query($q); //取得数据 $xj_js=$xj_kss=0; $arr_data=array(); $k=0; while($m=$db->fetch_array($r)){ $arr_data[deel_num($m["num"])]=$m["kss"]; $xj_js+=$m["num"]*$m["kss"]; $xj_kss+=$m["kss"]; $total_kss+=$m["kss"]; $total_js+=$m["num"]*$m["kss"]; $k++; } // foreach($arr_data as $num1 => $kss1){ $content_data.=""; $count++; } //小计 if($k>0){ $content_data.=""; $count++; } } $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.="
".get_main_value($arr_group_by_title,$s_group_by1)."件数款色数占比
".$m1["title"]."".$num1."".$kss1."".deel_bfb($kss1,$xj_kss)."
".$m1["title"]."小计".$xj_js."".$xj_kss."100%
合计".$total_js."".$total_kss."
"; }else{ $content_data=""; $content_data.=""; $content_data.=""; if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by1!="color" && $s_group_by2!="color"){ $content_data.=""; } $content_data.=""; $content_data.=""; if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by1!="color" && $s_group_by2!="color"){ $content_data.=""; } $content_data.=""; $content_data.=""; $content_data.=""; $con2=""; if($s_group_by1!="sx") $con2.=" and ".$s_group_by1."<>''"; if($s_group_by2!="sx") $con2.=" and ".$s_group_by2."<>''"; //取得总款数 $tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where no<>'' ".$con2.$con1); $total_ks=$tmp["num"]; //取得总款色数 $total_sku=0; $q2="select no,color,color_ka from ".$table_pre."kh where no<>'' ".$con2.$con1; $r2=$db->query($q2); while($m2=$db->fetch_array($r2)){ $arr1=explode(",",$m2["color"]); $arr2=explode(",",$m2["color_ka"]); for($i1=0;$i1'' ".$con2.$con1); $price_jj=keep_float($tmp["jj"],1); } //取得已订总件数和金额 $tmp=get_db_msg("select sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ".$s_group_by2."<>'' and ".$s_group_by1."<>'' ".$con); $total_yd_js=$tmp["num"]; $total_yd_je=$tmp["je"]; //取得已订总款数 $tmp=get_db_msg("select count(distinct no) 'num' from ".$table_pre."order where ".$s_group_by2."<>'' and ".$s_group_by1."<>'' ".$con); $total_yd_ks=$tmp["num"]; //取得已订总款色数 $tmp=get_db_msg("select count(distinct no,color) 'num' from ".$table_pre."order where ".$s_group_by2."<>'' and ".$s_group_by1."<>'' ".$con); $total_yd_sku=$tmp["num"]; // $q4="select * from ".$table_pre."keyword where cate='".$s_group_by1."' order by no"; $r4=$db->query($q4); $count=$l=$total_num=$total_money=0; while($m4=$db->fetch_array($r4)){ $con11=($s_group_by2=="sx" || $s_group_by2=="color")?"":" and ".$s_group_by2."<>''"; if($s_group_by1=="color"){ $tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where concat(',',color,',') like '%,".$m4["no"].",%'".$con11.$con1); $xj_z_sku=$tmp["num"]; }else if($s_group_by1=="sx"){ //取得设计款色 $tmp=get_db_msg("select * from ".$table_pre."sx where no='".$m4["no"]."'"); $arr_color=explode(",",$tmp["_v"]); $n1=0; for($i1=0;$i1query($q2); while($m2=$db->fetch_array($r2)){ $arr1=explode(",",$m2["color"]); $arr2=explode(",",$m2["color_ka"]); for($i1=0;$i1"; $r=$db->query($q); $l=0; //取得已订小计款数 $tmp=get_db_msg("select count(distinct no) 'num' from ".$table_pre."order where ".$s_group_by1."='".$m4["no"]."' and ".$s_group_by2."<>'' and ".$s_group_by1."<>'' ".$con); $xj_yd_ks=$tmp["num"]; //取得已订小计款色数 $tmp=get_db_msg("select count(distinct no,color) 'num' from ".$table_pre."order where ".$s_group_by1."='".$m4["no"]."' and ".$s_group_by1."<>'' and ".$s_group_by2."<>'' ".$con); $xj_yd_sku=$tmp["num"]; //取得已订小计件数和金额 $tmp=get_db_msg("select sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ".$s_group_by1."='".$m4["no"]."' and ".$s_group_by1."<>'' and ".$s_group_by2."<>'' ".$con); $xj_yd_js=$tmp["num"]; $xj_yd_je=$tmp["je"]; // while($m=$db->fetch_array($r)){ $list=$count+1; $gtitle=get_cate_title_no($s_group_by,$m[$s_group_by]); // if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by1!="color" && $s_group_by2!="color"){ //取得款数 $tmp=get_db_msg("select count(distinct no) 'num' from ".$table_pre."order where id>0 and ".$s_group_by1."='".$m4["no"]."' and ".$s_group_by2."='".$m["no"]."'".$con); $tmp_yd_ks=$tmp["num"]; if($s_group_by1=="color") $tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where concat(',',color,',') like '%,".$m4["no"].",%' and ".$s_group_by2."='".$m["no"]."'".$con1); else if($s_group_by2=="color") $tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ".$s_group_by1."='".$m4["no"]."' and concat(',',color,',') like '%,".$m["no"].",%'".$con1); else $tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ".$s_group_by1."='".$m4["no"]."' and ".$s_group_by2."='".$m["no"]."'".$con1); $tmp_z_ks=$tmp["num"]; } //取得款色 $tmp=get_db_msg("select count(distinct no,color) 'num' from ".$table_pre."order where id>0 and ".$s_group_by1."='".$m4["no"]."' and ".$s_group_by2."='".$m["no"]."'".$con); $tmp_yd_sku=$tmp["num"]; if($s_group_by1=="sx" || $s_group_by2=="sx"){ if($s_group_by1=="sx"){ $con11=" no='".$m4["no"]."'"; $con12=$s_group_by2."='".$m["no"]."'"; }else{ $con11=" no='".$m["no"]."'"; $con12=$s_group_by1."='".$m4["no"]."'"; } //取得设计款色 $tmp=get_db_msg("select * from ".$table_pre."sx where ".$con11); $arr_color=explode(",",$tmp["_v"]); $n1=0; for($i1=0;$i1'y' and concat(',',color,',') like '%,".$arr_color[$i1].",%' and ".$con12); $n1+=$tmp["num"]; } $tmp_z_sku=$n1; }else if($s_group_by1=="color" || $s_group_by2=="color"){ if($s_group_by1=="color"){ $con11=$m4["no"]; $con12=$s_group_by2."='".$m["no"]."'"; }else{ $con11=$m["no"]; $con12=$s_group_by1."='".$m4["no"]."'"; } //取得设计款色 $tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ".$con12." and concat(',',color,',') like '%,".$con11.",%'".$con1); $tmp_z_sku=$tmp["num"]; }else{ $tmp_z_sku=0; $q2="select no,color,color_ka from ".$table_pre."kh where ".$s_group_by1."='".$m4["no"]."' and ".$s_group_by2."='".$m["no"]."' ".$con1; $r2=$db->query($q2); while($m2=$db->fetch_array($r2)){ $n1=count(explode(",",$m2["color"])); $n2=trim($m2["color_ka"])?count(explode(",",$m2["color_ka"])):0; $tmp_z_sku+=$n1-$n2; } } //取得数量 $tmp=get_db_msg("select sum(num) 'num',sum(je) 'je' from ".$table_pre."order where id>0 and ".$s_group_by1."='".$m4["no"]."' and ".$s_group_by2."='".$m["no"]."'".$con); $tmp_yd_js=$tmp["num"]; $tmp_yd_je=$tmp["je"]; // if($tmp_z_sku>0){ $content_data.=""; $content_data.=""; $content_data.=""; if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by1!="color" && $s_group_by2!="color"){ //取得均价 $tmp=get_db_msg("select sum(price)/count(*) 'jj' from ".$table_pre."kh where ".$s_group_by1."='".$m4["no"]."' and ".$s_group_by2."='".$m["no"]."'".$con1); $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; } $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $count++; } } if($xj_z_sku>0){ $content_data.=""; $content_data.=""; if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by1!="color" && $s_group_by2!="color"){ //取得均价 $tmp=get_db_msg("select sum(price)/count(*) 'jj' from ".$table_pre."kh where ".$s_group_by1."='".$m4["no"]."' and ".$s_group_by2."<>''".$con1); $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; } $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $count++; } } $content_data.=""; // $content_data.=""; $content_data.=""; $content_data.=""; if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by1!="color" && $s_group_by2!="color"){ $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; } $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.="
".get_main_value($arr_group_by_title,$s_group_by1)."".get_main_value($arr_group_by_title,$s_group_by2)."均价设计款数已订款数设计款色已订款色已订件数吊牌金额
款数占比款数占比款数占比款数占比件数占比金额占比
".$m4["title"]."".$m["title"]."".keep_float($tmp["jj"],1)."".$tmp_z_ks."".deel_bfb($tmp_z_ks,$xj_z_ks)."".$tmp_yd_ks."".deel_bfb($tmp_yd_ks,$xj_yd_ks)."".$tmp_z_sku."".deel_bfb($tmp_z_sku,$xj_z_sku)."".$tmp_yd_sku."".deel_bfb($tmp_yd_sku,$xj_yd_sku)."".deel_01($tmp_yd_js)."".deel_bfb($tmp_yd_js,$xj_yd_js)."".deel_01($tmp_yd_je)."".deel_bfb($tmp_yd_je,$xj_yd_je)."
小计".keep_float($tmp["jj"],1)."".$xj_z_ks."".deel_bfb($xj_z_ks,$total_ks)."".$xj_yd_ks."".deel_bfb($xj_yd_ks,$total_yd_ks)."".$xj_z_sku."".deel_bfb($xj_z_sku,$total_sku)."".$xj_yd_sku."".deel_bfb($xj_yd_sku,$total_yd_sku)."".deel_num($xj_yd_js)."".deel_bfb($xj_yd_js,$total_yd_js)."".deel_num($xj_yd_je)."".deel_bfb($xj_yd_je,$total_yd_je)."
合计".$price_jj."".$total_ks."".deel_num($total_yd_ks)."".deel_num($total_sku)."".deel_num($total_yd_sku)."".deel_num($total_yd_js)."".deel_num($total_yd_je)."
"; } }else if($zd1=="" && $zd2==""){ //请求数据有误 $content_data="
请先配置参数!
"; $json_data.="\"sys_bb_type\":\"bball_null\","; }else{ //---------------------------------------一维报表 $json_data.="\"sys_bb_type\":\"bball_1w\","; if($zd1!=""){ $s_group_by=$zd1; }else{ $s_group_by=$zd2; } if($s_group_by=="ks_size"){ //取得已订款色数 $tmp=get_db_msg("select count(distinct iid,color) 'num' from ".$table_pre."order where id>0 ".$con); $total_kss=$tmp["num"]; // $content_data=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; // $tb_data_x=""; $tb_data_y=","; $q="select sum(num)/count(distinct iid,color) 'num',count(distinct iid,color) 'kss' from (select sum(num) 'num',iid,color from ".$table_pre."order where id>0".$con." group by iid,color) as t1 group by num order by num"; $r=$db->query($q); $count=0; $l=0; while($m=$db->fetch_array($r)){ // $tb_data_x.=deel_num($m["num"])."件,"; $tb_data_y.=str_replace("%","",deel_bfb($m["kss"],$total_kss)).","; // $content_data.=""; $count++; $l+=$m["num"]*$m["kss"]; } // $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.="
件数款色数占比
".deel_num($m["num"])."".$m["kss"]."".deel_bfb($m["kss"],$total_kss)."
合计(".$l.")".$total_kss."100%
"; }else if($s_group_by=="size"){ //取得已订总件数和金额 $tmp=get_db_msg("select sum(num) 'num',sum(je) 'je' from ".$table_pre."order where id>0".$con); $total_yd_js=$tmp["num"]; $total_yd_je=$tmp["je"]; // $content_data=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; // $tb_data_x=""; $tb_data_y=","; // $tbody_str=""; $q1="select * from ".$table_pre."keyword where cate='size' order by ord"; $r1=$db->query($q1); $count=$total_num=0; $l=0; while($m1=$db->fetch_array($r1)){ $q="select * from ".$table_pre."size where iid='".$m1["id"]."' order by iid,no"; $r=$db->query($q); // $tmp=get_db_msg("select sum(num) 'num',sum(je) 'je' from ".$table_pre."order where id>0 and size_group_id='".$m1["id"]."'".$con); $xj_yd_js=$tmp["num"]; $xj_yd_je=$tmp["je"]; while($m=$db->fetch_array($r)){ $arr1=get_num_je_size($m["no"],$m["iid"]); $total_num+=$arr1[0]; $total_money+=$arr1[1]; $content_data.=""; $count++; // $tb_data_x.=$m["title"].","; $tb_data_y.=str_replace("%","",deel_bfb($arr1[0],$total_yd_js)).","; } $l++; } $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.="
尺码组尺码已订件数件数占比吊牌金额金额占比
".$m1["title"]."".$m["title"]."".$arr1[0]."".deel_bfb($arr1[0],$total_yd_js)."".$arr1[1]."".deel_bfb($arr1[1],$total_yd_je)."
".$total_num."".$total_money."
"; }else if($s_group_by=="color"){ //取得总款数 $tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where no<>''".$con1); $total_ks=$tmp["num"]; //取得总款色数 $total_sku=0; $q2="select no,color,color_ka from ".$table_pre."kh where no<>''".$con1; $r2=$db->query($q2); while($m2=$db->fetch_array($r2)){ $arr1=explode(",",$m2["color"]); $arr2=explode(",",$m2["color_ka"]); for($i1=0;$i10".$con); $total_yd_js=$tmp["num"]; $total_yd_je=$tmp["je"]; //取得已订总款色数 $tmp1=get_db_msg("select count(distinct no,color) 'num' from ".$table_pre."order where ".$s_group_by."<>'' ".$con); $total_yd_sku=$tmp1["num"]; // $content_data=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; // $tb_data_x=""; $tb_data_y=","; // $q="select * from ".$table_pre."keyword where cate='".$s_group_by."' order by no"; $r=$db->query($q); $count=$total_num=$total_money=0; while($m=$db->fetch_array($r)){ $list=$count+1; //取得数量 $m1=get_db_msg("select sum(num) 'num',sum(je) 'je' from ".$table_pre."order where id>0 and ".$s_group_by."='".$m["no"]."'".$con); $total_num+=$m1["num"]; $total_money+=$m1["je"]; //取得款色 $tmp=get_db_msg("select count(distinct no,color) 'num' from ".$table_pre."order where ".$s_group_by."='".$m["no"]."'".$con); $tmp_yd_sku=$tmp["num"]; $tmp_z_sku=0; $q2="select no,color,color_ka from ".$table_pre."kh where no<>''".$con1; $r2=$db->query($q2); while($m2=$db->fetch_array($r2)){ $tmp1=explode(",",$m2["color"]); $tmp2=explode(",",$m2["color_ka"]); if(in_array($m["no"],$tmp1) && !in_array($m["no"],$tmp2)){ $tmp_z_sku++; } } // $content_data.=""; // $tb_data_x.=$m["title"].","; $tb_data_y.=str_replace("%","",deel_bfb($m1["num"],$total_yd_js)).","; } $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.="
颜色设计款色已订款色已订件数吊牌金额
款数占比款数占比件数占比金额占比
".$m["title"]."".$tmp_z_sku."".deel_bfb($tmp_z_sku,$total_sku)."".$tmp_yd_sku."".deel_bfb($tmp_yd_sku,$total_yd_sku)."".deel_01($m1["num"])."".deel_bfb($m1["num"],$total_yd_js)."".deel_01($m1["je"])."".deel_bfb($m1["je"],$total_yd_je)."
合计".$total_sku."".$total_yd_sku."".$total_num."".$total_money."
"; }else if($s_group_by=="sx"){ //取得总款色数 $total_sku=0; $q2="select no,color,color_ka from ".$table_pre."kh where no<>''".$con1; $r2=$db->query($q2); while($m2=$db->fetch_array($r2)){ $arr1=explode(",",$m2["color"]); $arr2=explode(",",$m2["color_ka"]); for($i1=0;$i1'' ".$con; $tmp=get_db_msg($q); $total_yd_js=$tmp["num"]; $total_yd_je=$tmp["je"]; //取得已订总款色数 $tmp1=get_db_msg("select count(distinct no,color) 'num' from ".$table_pre."order where ".$s_group_by."<>'' ".$con); $total_yd_sku=$tmp1["num"]; // $content_data=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; // $tb_data_x=""; $tb_data_y=","; // $tbody_str=""; $q="select * from ".$table_pre."keyword where cate='".$s_group_by."' order by no"; $r=$db->query($q); $count=$total_num=$total_money=0; while($m=$db->fetch_array($r)){ $list=$count+1; $gtitle=get_cate_title_no($s_group_by,$m[$s_group_by]); //取得设计款色 $tmp=get_db_msg("select * from ".$table_pre."sx where no='".$m["no"]."'"); $arr_color=explode(",",$tmp["_v"]); $n1=0; for($i1=0;$i10 and ".$s_group_by."='".$m["no"]."'".$con); $tmp_yd_js=$tmp["num"]; $tmp_yd_je=$tmp["je"]; // $content_data.=""; $count++; // $tb_data_x.=$m["title"].","; $tb_data_y.=str_replace("%","",deel_bfb($tmp_yd_js,$total_yd_js)).","; } $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.="
色系设计款色已订款色已订件数吊牌金额
款数占比款数占比件数占比金额占比
".$m["title"]."".deel_01($tmp_sku)."".deel_bfb($tmp_sku,$total_sku)."".deel_01($tmp_yd_sku)."".deel_bfb($tmp_yd_sku,$total_yd_sku)."".deel_01($tmp_yd_js)."".deel_bfb($tmp_yd_js,$total_yd_js)."".deel_01($tmp_yd_je)."".deel_bfb($tmp_yd_je,$total_yd_je)."
合计".$total_sku."".$total_yd_sku."".$total_yd_js."".$total_yd_je."
"; }else{ //取得总款数 $tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ".$s_group_by."<>''".$con1); $total_ks=$tmp["num"]; //取得总款色数 $total_sku=0; $q2="select no,color,color_ka from ".$table_pre."kh where ".$s_group_by."<>''".$con1; $r2=$db->query($q2); while($m2=$db->fetch_array($r2)){ $arr1=explode(",",$m2["color"]); $arr2=explode(",",$m2["color_ka"]); for($i1=0;$i1''".$con1); $price_jj=keep_float($tmp["jj"],1); //取得已订总件数和金额 $q="select sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ".$s_group_by."<>'' ".$con; $tmp=get_db_msg($q); $total_yd_js=$tmp["num"]; $total_yd_je=$tmp["je"]; //取得已订总款数 $tmp1=get_db_msg("select count(distinct no) 'num' from ".$table_pre."order where ".$s_group_by."<>'' ".$con); $total_yd_ks=$tmp1["num"]; //取得已订总款色数 $tmp1=get_db_msg("select count(distinct no,color) 'num' from ".$table_pre."order where ".$s_group_by."<>'' ".$con); $total_yd_sku=$tmp1["num"]; // $content_data=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; // $tb_data_x=""; $tb_data_y=","; // $tbody_str=""; $q="select * from ".$table_pre."keyword where cate='".$s_group_by."' order by no"; $r=$db->query($q); $count=$total_num=$total_money=0; while($m=$db->fetch_array($r)){ $list=$count+1; if($s_group_by=="color"){ $gtitle=get_cate_title_no("color",$m["color"]); }else{ $gtitle=get_cate_title_no($s_group_by,$m[$s_group_by]); } //------取得款数 $tmp=get_db_msg("select count(distinct no) 'num' from ".$table_pre."order where ".$s_group_by."='".$m["no"]."'".$con); $tmp_yd_ks=$tmp["num"]; $tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ".$s_group_by."='".$m["no"]."'".$con1); $tmp_z_ks=$tmp["num"]; //取得款色 $tmp=get_db_msg("select count(distinct no,color) 'num' from ".$table_pre."order where ".$s_group_by."='".$m["no"]."'".$con); $tmp_yd_sku=$tmp["num"]; $tmp_z_sku=0; $q2="select no,color,color_ka from ".$table_pre."kh where ".$s_group_by."='".$m["no"]."'".$con1; $r2=$db->query($q2); while($m2=$db->fetch_array($r2)){ $n1=count(explode(",",$m2["color"])); $n2=trim($m2["color_ka"])?count(explode(",",$m2["color_ka"])):0; $tmp_z_sku+=$n1-$n2; } //取得数量 $tmp=get_db_msg("select sum(num) 'num',sum(je) 'je' from ".$table_pre."order where id>0 and ".$s_group_by."='".$m["no"]."'".$con); $tmp_yd_js=$tmp["num"]; $tmp_yd_je=$tmp["je"]; if($tmp_z_ks>0){ //取得均价 $tmp=get_db_msg("select sum(price)/count(*) 'jj' from ".$table_pre."kh where ".$s_group_by."='".$m["no"]."'".$con1); // $tb_data_x.=$m["title"].","; $tb_data_y.=str_replace("%","",deel_bfb($tmp_yd_js,$total_yd_js)).","; $content_data.=""; $count++; } } $content_data.=""; $content_data.=""; $content_data.=""; $content_data.=""; $content_data.="
".get_cate_title_no("arr_select",$s_group_by)."均价设计款数已订款数设计款色已订款色已订件数吊牌金额
款数占比款数占比款数占比款数占比件数占比金额占比
".$m["title"]."".keep_float($tmp["jj"],1)."".$tmp_z_ks."".deel_bfb($tmp_z_ks,$total_ks)."".$tmp_yd_ks."".deel_bfb($tmp_yd_ks,$total_yd_ks)."".$tmp_z_sku."".deel_bfb($tmp_z_sku,$total_sku)."".$tmp_yd_sku."".deel_bfb($tmp_yd_sku,$total_yd_sku)."".deel_01($tmp_yd_js)."".deel_bfb($tmp_yd_js,$total_yd_js)."".deel_01($tmp_yd_je)."".deel_bfb($tmp_yd_je,$total_yd_je)."
合计".$price_jj."".$total_ks."".$total_yd_ks."".$total_sku."".$total_yd_sku."".$total_yd_js."".$total_yd_je."
"; } //图 $tb_data_y=deel_end($tb_data_y); $tb_data_x=deel_end($tb_data_x); $json_data.="\"chart_title\":\"\","; $json_data.="\"chart_type\":\"pie\","; $json_data.="\"chart_data_x\":\"".$tb_data_x."\","; $json_data.="\"chart_data_y\":\"".$tb_data_y."\","; } $json_data.="\"table_html\":\"".$content_data."\","; ?>