占比\",\"width\":100}";
$thead="\"thead\":[{\"index\":0,\"content\":[".$thead0."]}],";
$json_data.=$thead;
$tbody="";
//取得已订总件数和金额
$q="select sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ".$s_group_by."<>'' ".$con;
//echo $q."
";
$tmp=get_db_msg($q);
$total_yd_js=$tmp["num"];
$total_yd_je=$tmp["je"];
//取得总款色数
$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'y' and ".$s_group_by."<>'' ".$con);
$total_yd_sku=$tmp1["num"];
$q="select * from ".$table_pre."keyword where cate='".$s_group_by."' order by no";
//echo $q."
";
$r=$db->query($q);
while($m=$db->fetch_array($r)){
//------取得款数
$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"];
//if($is_dkds!="y"){
//取得款色
$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 ".$s_group_by."='".$m["no"]."'".$con);
$tmp_yd_js=$tmp["num"];
$tmp_yd_je=$tmp["je"];
//取得区域指标
$qy_zb=get_db_msg("select * from web_plugin_pcqyzb where c1='".$m["title"]."' and c2='".$m_qy["title"]."'");
if($qy_zb["zb"]) $zba=deel_bfb($qy_zb["zb"],1);else $zba="";
$tbody.="{\"bc\":\"".$m["title"]."\",\"sj_ks\":\"".$tmp_z_sku."\",\"sj_ks_zb\":\"".deel_bfb($tmp_z_sku,$total_sku)."\",\"yd_ks\":\"".$tmp_yd_sku."\",\"yd_ks_zb\":\"".deel_bfb($tmp_yd_sku,$total_yd_sku)."\",\"je\":\"".deel_01(deel_num($tmp_yd_je))."\",\"je_zb\":\"".deel_bfb($tmp_yd_je,$total_yd_je)."\",\"qy_zb\":\"".$zba."\"},";
}
$tbody.="{\"bc\":\"合计\",\"sj_ks\":\"".$total_sku."\",\"sj_ks_zb\":\"100%\",\"yd_ks\":\"".$total_yd_sku."\",\"yd_ks_zb\":\"100%\",\"je\":\"".deel_01(deel_num($total_yd_je))."\",\"je_zb\":\"100%\",\"qy_zb\":\"100%\"},";
}
$json_data.="\"tbody\":[".deel_end($tbody)."],";
}
?>