query($q1); $arr_tmp=array(); while($m1=$db->fetch_array($r1)){ $arr_tmp[$m1["no"]]=$m1["title"]; } $$v2=$arr_tmp; } if(check_table_exist($table_pre."plugin_pitsd")=="n"){ // $code=0; $error_msg="请先导入数据!"; }else{ //店铺查询条件 $con=$con1=""; if($msg_client["face"]=="4"){ $s_username=$msg_client["username"]; $con=" and uid='".$msg_client["id"]."'"; $con1=" and cid='".$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"]."'"; $con1=" and cid='".$m2["id"]."'"; }else{ $con=" and (upath='".$m2["path"]."-".$m2["id"]."' or upath like '".$m2["path"]."-".$m2["id"]."-%')"; $con1=" and cid='0'"; } } } if($s_username){ $m1=get_db_msg("select title,path,face from ".$table_pre."client where username='".$s_username."'"); $qyid=get_qy_id($m1["path"]); $m_qy=get_db_msg("select username,title from ".$table_pre."client where id='".$qyid."'"); $kh_qy=$m_qy["title"]; if($m1["face"]=="9") $kh_qy=$m1["title"]; //-------------------------------------------layui 数据表格格式//--------------------------------表头 //支持参数field,title,width,rowspan,colspan,style(样式),sort(true|false),fixed(left,right) //------------ $thead0=""; $thead0.="{\"field\":\"cplb\",\"title\":\"产品类别\",\"width\":100},"; $thead0.="{\"field\":\"fg\",\"title\":\"各类型风格\",\"width\":100},"; $thead0.="{\"field\":\"dy_sku\",\"title\":\"带样SKU\",\"width\":90},"; $thead0.="{\"field\":\"cg_sku\",\"title\":\"采购SKU\",\"width\":90},"; $thead0.="{\"field\":\"cg_num\",\"title\":\"采购量\",\"width\":80},"; $thead0.="{\"field\":\"xs_num\",\"title\":\"销售量\",\"width\":80},"; $thead0.="{\"field\":\"xs_je\",\"title\":\"销售额\",\"width\":80},"; $thead0.="{\"field\":\"cb_je\",\"title\":\"成本额\",\"width\":80},"; $thead0.="{\"field\":\"dhl\",\"title\":\"订货量\",\"width\":80},"; $thead0.="{\"field\":\"dhe\",\"title\":\"订货金额\",\"width\":100},"; $thead0.="{\"field\":\"dh_sku\",\"title\":\"订货SKU\",\"width\":100},"; $thead0.="{\"field\":\"yp_sku\",\"title\":\"已评SKU\",\"width\":100}"; $thead="\"thead\":[{\"index\":0,\"content\":[".$thead0."]}],"; $json_data.=$thead; $tbody=""; //----------------取得款号表数据 $q="select ".$zd1.",".$zd2." from ".$table_pre."kh where ka<>'y'".$con_other.$con_sx." group by ".$zd1.",".$zd2; //echo $q."
"; $r=$db->query($q); while($m=$db->fetch_array($r)){ //取得订单数 $q2=get_db_msg("select count(distinct iid,color) 'sku',sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ka<>'y' and ".$zd1."='".$m[$zd1]."' and ".$zd2."='".$m[$zd2]."'".$con.""); if($q2["sku"]) $dh_sku=$q2["sku"];else $dh_sku=""; //取得历史数据 $ls=get_db_msg("select * from ".$table_pre."plugin_pitsd where c1='".$kh_qy."' and c2='".get_cate_title_no($zd1,$m[$zd1])."' and c3='".get_cate_title_no($zd2,$m[$zd2])."'"); //取得评价 $q3="select * from ".$table_pre."client_pj where id>0".$con1." order by id"; $r3=$db->query($q3); $yp_sku=""; while($m3=$db->fetch_array($r3)) { $q4="select * from ".$table_pre."kh where ka<>'y' and ".$zd1."='".$m[$zd1]."' and ".$zd2."='".$m[$zd2]."' and id='".$m3["khid"]."'"; $r4=$db->query($q4); while($m4=$db->fetch_array($r4)){ $yp_sku++; } } if($ls["id"]>0){ $tbody.="{\"cplb\":\"".get_cate_title_no($zd1,$m[$zd1])."\",\"glxfg\":\"".get_cate_title_no($zd2,$m[$zd2])."\",\"dy_sku\":\"".$ls["dy_sku"]."\",\"cg_sku\":\"".$ls["cg_sku"]."\",\"cg_num\":\"".$ls["cg_num"]."\",\"xs_num\":\"".$ls["xs_num"]."\",\"xs_je\":\"".$ls["xs_je"]."\",\"cb_je\":\"".$ls["cb_je"]."\",\"dhl\":\"".$q2["num"]."\",\"dhe\":\"".$q2["je"]."\",\"dh_sku\":\"".$dh_sku."\",\"yp_sku\":\"".$yp_sku."\"},"; } } } $json_data.="\"tbody\":[".deel_end($tbody)."],"; } ?>