chore: 添加多个图片和资源文件
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
//款数5维分析报表
|
||||
//可配置参数:zd1|bc|横向维度1,zd2|series|横向维度2,zd3|category|横向维度3,zd4|theme|纵向维度1,zd5|jgd|纵向维度2
|
||||
//2018-12-10 by hehe
|
||||
//------横向维度:zd1,zd2,zd3;纵向维度:zd4,zd5。
|
||||
//-----参数配置
|
||||
//横向维度
|
||||
$zd1=get_plugin_set("zd1","bc");
|
||||
$zd2=get_plugin_set("zd2","series");
|
||||
$zd3=get_plugin_set("zd3","category");
|
||||
//纵向维度
|
||||
$zd4=get_plugin_set("zd4","theme");
|
||||
$zd5=get_plugin_set("zd5","jgd");
|
||||
//
|
||||
$json_data.="\"use_layui\":1,";//使用layui表格
|
||||
$select_client_type="y";//dp:开启店铺查询框
|
||||
//$select="{\"name\":\"s_s1\",\"title\":\"条件1\",\"value\":\"".$s_s1."\",\"op\":[{\"no\":\"1\",\"title\":\"第一个\"},{\"no\":\"2\",\"title\":\"第二个\"}]}";//筛选条件
|
||||
for($i=1;$i<6;$i++){
|
||||
$v="zd".$i;
|
||||
$v1="zd_title".$i;
|
||||
$v2="arr_zd".$i;
|
||||
//取得对应字段的名称
|
||||
$$v1=get_cate_title_no("arr_select",$$v);
|
||||
//取得字段的选项值
|
||||
$q1="select no,title from ".$table_pre."keyword where cate='".$$v."' order by no";
|
||||
$r1=$db->query($q1);
|
||||
$arr_tmp=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_tmp[$m1["no"]]=$m1["title"];
|
||||
}
|
||||
$$v2=$arr_tmp;
|
||||
}
|
||||
//表头第一行
|
||||
$thead0="";
|
||||
$thead0.="{\"field\":\"row11\",\"title\":\"".$zd_title1."\",\"rowspan\":2,\"fixed\":\"left\",\"width\":80},";
|
||||
$thead0.="{\"field\":\"row12\",\"title\":\"".$zd_title2."\",\"rowspan\":2,\"width\":80},";
|
||||
$thead0.="{\"field\":\"row13\",\"title\":\"".$zd_title3."\",\"rowspan\":2,\"width\":80},";
|
||||
$thead0.="{\"field\":\"row14\",\"title\":\"设计款量\",\"rowspan\":2,\"width\":80},";
|
||||
$i=5;
|
||||
foreach($arr_zd4 as $n1 => $t1){
|
||||
$thead0.="{\"field\":\"row1".$i."\",\"title\":\"".$t1.$zd_title5."\",\"colspan\":".count($arr_zd5)."},";
|
||||
$i++;
|
||||
}
|
||||
$thead0.="{\"field\":\"row1".$i."\",\"title\":\"整体".$zd_title5."\",\"colspan\":".count($arr_zd5)."},";
|
||||
//表头第二行
|
||||
$thead1="";
|
||||
$i=1;
|
||||
foreach($arr_zd4 as $n1 => $t1){
|
||||
foreach($arr_zd5 as $n2 => $t2){
|
||||
$thead1.="{\"field\":\"row2".$i."\",\"title\":\"".$t2."\",\"width\":80},";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
foreach($arr_zd5 as $n2 => $t2){
|
||||
$thead1.="{\"field\":\"row2".$i."\",\"title\":\"".$t2."\",\"width\":80},";
|
||||
$i++;
|
||||
}
|
||||
$thead="\"thead\":[{\"index\":0,\"content\":[".deel_end($thead0)."]},{\"index\":1,\"content\":[".deel_end($thead1)."]}],";
|
||||
$json_data.=$thead;
|
||||
//-----------取得报表数据
|
||||
//查询条件
|
||||
$con="";
|
||||
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"]."-%')";
|
||||
}
|
||||
}
|
||||
//订单数据
|
||||
$q1="select ".$zd1.",".$zd2.",".$zd3.",".$zd4.",".$zd5.",count(distinct no) 'ks' from ".$table_pre."order where ka<>'y'".$con." group by ".$zd1.",".$zd2.",".$zd3.",".$zd4.",".$zd5;
|
||||
$r1=$db->query($q1);
|
||||
$arr_data=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_data[$m1[$zd1]][$m1[$zd2]][$m1[$zd3]][$m1[$zd4]][$m1[$zd5]]=$m1["ks"];
|
||||
}
|
||||
//款号数据
|
||||
$q1="select ".$zd1.",".$zd2.",".$zd3.",count(*) 'ks' from ".$table_pre."kh where ka<>'y' group by ".$zd1.",".$zd2.",".$zd3;
|
||||
$r1=$db->query($q1);
|
||||
$arr_data1=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_data1[$m1[$zd1]][$m1[$zd2]][$m1[$zd3]]=$m1["ks"];
|
||||
}
|
||||
//-----------计算rowspan
|
||||
$arr_rowspan_zd1=$arr_rowspan_zd2=array();
|
||||
$i1=$i2=0;
|
||||
foreach($arr_zd1 as $n1 => $t1){
|
||||
$xj1=0;
|
||||
foreach($arr_zd2 as $n2 => $t2){
|
||||
$xj2=0;
|
||||
foreach($arr_zd3 as $n3 => $t3){
|
||||
if($arr_data1[$n1][$n2][$n3]>0){
|
||||
$xj1++;
|
||||
$xj2++;
|
||||
}
|
||||
}
|
||||
$arr_rowspan_zd2[$i2]=$xj2;
|
||||
$xj1++;
|
||||
$i2++;
|
||||
}
|
||||
$arr_rowspan_zd1[$i1]=$xj1;
|
||||
$i1++;
|
||||
}
|
||||
//-----------输出报表
|
||||
$tbody="";
|
||||
$i1=$i2=$i3=0;
|
||||
foreach($arr_zd1 as $n1 => $t1){
|
||||
foreach($arr_zd2 as $n2 => $t2){
|
||||
$var_hj_zd2="hj_".$n1."_".$n2;
|
||||
foreach($arr_zd3 as $n3 => $t3){
|
||||
if($arr_data1[$n1][$n2][$n3]>0){
|
||||
$col=1;
|
||||
$row="";
|
||||
$row.="\"row".$col."\":\"".$t1."\",";
|
||||
$col++;
|
||||
$row.="\"row".$col."\":\"".$t2."\",";
|
||||
$col++;
|
||||
$row.="\"row".$col."\":\"".$t3."\",";
|
||||
$col++;
|
||||
//小计
|
||||
$row.="\"row".$col."\":\"".$arr_data1[$n1][$n2][$n3]."\",";
|
||||
$col++;
|
||||
$$var_hj_zd2+=$arr_data1[$n1][$n2][$n3];
|
||||
foreach($arr_zd4 as $n4 => $t4){
|
||||
foreach($arr_zd5 as $n5 => $t5){
|
||||
$var1="zt_".$n1."_".$n2."_".$n3."_".$n5;
|
||||
$var2="zt_".$n1."_".$n2."_".$n5;
|
||||
$var3="zt1_".$n1."_".$n2."_".$n4."_".$n5;
|
||||
$row.="\"row".$col."\":\"".deel_0($arr_data[$n1][$n2][$n3][$n4][$n5])."\",";
|
||||
$col++;
|
||||
$$var1+=$arr_data[$n1][$n2][$n3][$n4][$n5];
|
||||
$$var2+=$arr_data[$n1][$n2][$n3][$n4][$n5];
|
||||
$$var3+=$arr_data[$n1][$n2][$n3][$n4][$n5];
|
||||
}
|
||||
}
|
||||
//整体
|
||||
foreach($arr_zd5 as $n5 => $t5){
|
||||
$var1="zt_".$n1."_".$n2."_".$n3."_".$n5;
|
||||
$row.="\"row".$col."\":\"".deel_0($$var1)."\",";
|
||||
$col++;
|
||||
}
|
||||
$tbody.="{".deel_end($row)."},";
|
||||
$i3++;
|
||||
}
|
||||
}
|
||||
//---------------zd2合计
|
||||
$col=1;
|
||||
$row="";
|
||||
$row.="\"row".$col."\":\" \",";
|
||||
$col++;
|
||||
$row.="\"row".$col."\":\" \",";
|
||||
$col++;
|
||||
$row.="\"row".$col."\":\"小计\",";
|
||||
$col++;
|
||||
//小计
|
||||
$row.="\"row".$col."\":\"".$$var_hj_zd2."\",";
|
||||
$col++;
|
||||
foreach($arr_zd4 as $n4 => $t4){
|
||||
foreach($arr_zd5 as $n5 => $t5){
|
||||
$var1="zt1_".$n1."_".$n2."_".$n4."_".$n5;
|
||||
$row.="\"row".$col."\":\"".deel_0($$var1)."\",";
|
||||
$col++;
|
||||
}
|
||||
}
|
||||
//整体
|
||||
foreach($arr_zd5 as $n5 => $t5){
|
||||
$var1="zt_".$n1."_".$n2."_".$n5;
|
||||
$row.="\"row".$col."\":\"".deel_0($$var1)."\",";
|
||||
$col++;
|
||||
}
|
||||
$tbody.="{".deel_end($row)."},";
|
||||
$i3++;
|
||||
$i2++;
|
||||
}
|
||||
$i1++;
|
||||
}
|
||||
$json_data.="\"tbody\":[".deel_end($tbody)."],";
|
||||
?>
|
||||
@@ -0,0 +1,743 @@
|
||||
<?php
|
||||
//字段一二维度报表
|
||||
//可配置参数:zd1|category|字段1,zd2|brand|字段2,icon|menu_icon_bb_xw_ms|菜单图标
|
||||
//2020-07-10 by hzz
|
||||
//-----参数配置start
|
||||
//菜单图标
|
||||
$icon=get_plugin_set("icon","menu_icon_bb_xw_ms");//支持以下目录的图标ipad/images/menu_icon_*.png
|
||||
//字段
|
||||
$zd1=get_plugin_set("zd1","category");
|
||||
$zd2=get_plugin_set("zd2","brand");
|
||||
//
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
//end
|
||||
$s_key=$s_key?$s_key:$_key;
|
||||
$s_ka=$s_ka?$s_ka:"n";
|
||||
//-------------------------条件
|
||||
//-------con为web_order
|
||||
//-------con1为web_kh
|
||||
|
||||
//店铺查询条件
|
||||
$con=" and ka<>'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.="<table id='tabledetail' class='cell-border nowrap' width='100%' lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' class='layui-table'>";
|
||||
$content_data.="<thead><tr style='background-color:#f2f2f2' align=center><td>".get_main_value($arr_group_by_title,$s_group_by1)."</td><td>尺码</td><td>已订件数</td><td>件数占比</td><td>吊牌金额</td><td>金额占比</td></tr>";
|
||||
$content_data.="</thead>";
|
||||
$content_data.="<tbody>";
|
||||
//--------------------------------表头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.="<tr align=center><td>".$m1["title"]."</td><td>".$m["title"]."</td><td>".$arr1[0]."</td><td>".deel_bfb($arr1[0],$xj_yd_js)."</td><td>".$arr1[1]."</td><td>".deel_bfb($arr1[1],$xj_yd_je)."</td></tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
$l++;
|
||||
}
|
||||
|
||||
$content_data.="</tbody>";
|
||||
$content_data.="<tfoot>";
|
||||
$content_data.="<tr style='background-color:#f2f2f2' align=center><td colspan=2>合计</td><td>".$total_num."</td><td></td><td>".$total_money."</td><td></td></tr>";
|
||||
$content_data.="</tfoot>";
|
||||
$content_data.="</table>";
|
||||
}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.="<table id='tabledetail' class='cell-border nowrap' width='100%' lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' class='layui-table'>";
|
||||
$content_data.="<thead><tr style='background-color:#f2f2f2' align=center><td>".get_main_value($arr_group_by_title,$s_group_by1)."</td><td>件数</td><td>款色数</td><td>占比</td></tr>";
|
||||
$content_data.="</thead>";
|
||||
$content_data.="<tbody>";
|
||||
//--------------------------------表头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.="<tr align=center><td>".$m1["title"]."</td><td>".$num1."</td><td>".$kss1."</td><td>".deel_bfb($kss1,$xj_kss)."</td></tr>";
|
||||
$count++;
|
||||
}
|
||||
//小计
|
||||
if($k>0){
|
||||
$content_data.="<tr align=center><td>".$m1["title"]."小计</td><td>".$xj_js."</td><td>".$xj_kss."</td><td>100%</td></tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
$content_data.="</tbody>";
|
||||
$content_data.="<tfoot>";
|
||||
$content_data.="<tr style='background-color:#f2f2f2' align=center><td>合计</td><td>".$total_js."</td><td>".$total_kss."</td><td></td></tr>";
|
||||
$content_data.="</tfoot>";
|
||||
$content_data.="</table>";
|
||||
}else{
|
||||
$content_data="";
|
||||
$content_data.="<table id='tabledetail' class='cell-border nowrap' width='100%' lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' class='layui-table'>";
|
||||
$content_data.="<thead><tr style='background-color:#f2f2f2' align=center><td rowspan=2>".get_main_value($arr_group_by_title,$s_group_by1)."</td><td rowspan=2>".get_main_value($arr_group_by_title,$s_group_by2)."</td>";
|
||||
if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by1!="color" && $s_group_by2!="color"){
|
||||
$content_data.="<td rowspan=2>均价</td><td colspan=2>设计款数</td><td colspan=2>已订款数</td>";
|
||||
}
|
||||
$content_data.="<td colspan=2>设计款色</td><td colspan=2>已订款色</td><td colspan=2>已订件数</td><td colspan=2>吊牌金额</td></tr>";
|
||||
$content_data.="<tr style='background-color:#f2f2f2' align=center>";
|
||||
if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by1!="color" && $s_group_by2!="color"){
|
||||
$content_data.="<td>款数</td><td>占比</td><td>款数</td><td>占比</td>";
|
||||
}
|
||||
$content_data.="<td>款数</td><td>占比</td><td>款数</td><td>占比</td><td>件数</td><td>占比</td><td>金额</td><td>占比</td></tr>";
|
||||
$content_data.="</thead>";
|
||||
$content_data.="<tbody>";
|
||||
$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<count($arr1);$i1++){
|
||||
if(!in_array($arr1[$i1],$arr2))
|
||||
$total_sku++;
|
||||
}
|
||||
}
|
||||
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 no<>'' ".$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;$i1<count($arr_color);$i1++){
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where concat(',',color,',') like '%,".$arr_color[$i1].",%'".$con11.$con1);
|
||||
$n1+=$tmp["num"];
|
||||
}
|
||||
$xj_z_sku=$n1;
|
||||
}else{
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ".$s_group_by1."='".$m4["no"]."'".$con11.$con1);
|
||||
$xj_z_ks=$tmp["num"];
|
||||
//取得小计设计款色数
|
||||
$xj_z_sku=0;
|
||||
$q2="select no,color,color_ka from ".$table_pre."kh where ".$s_group_by1."='".$m4["no"]."'".$con11.$con1;
|
||||
$r2=$db->query($q2);
|
||||
while($m2=$db->fetch_array($r2)){
|
||||
$arr1=explode(",",$m2["color"]);
|
||||
$arr2=explode(",",$m2["color_ka"]);
|
||||
for($i1=0;$i1<count($arr1);$i1++){
|
||||
if(!in_array($arr1[$i1],$arr2))
|
||||
$xj_z_sku++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
$q="select * from ".$table_pre."keyword where cate='".$s_group_by2."' order by no";
|
||||
//echo $q."<br>";
|
||||
$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<count($arr_color);$i1++){
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ka<>'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.="<tr align=center>";
|
||||
$content_data.="<td>".$m4["title"]."</td>";
|
||||
$content_data.="<td>".$m["title"]."</td>";
|
||||
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.="<td>".keep_float($tmp["jj"],1)."</td>";
|
||||
$content_data.="<td>".$tmp_z_ks."</td>";
|
||||
$content_data.="<td>".deel_bfb($tmp_z_ks,$xj_z_ks)."</td>";
|
||||
$content_data.="<td>".$tmp_yd_ks."</td>";
|
||||
$content_data.="<td>".deel_bfb($tmp_yd_ks,$xj_yd_ks)."</td>";
|
||||
}
|
||||
$content_data.="<td>".$tmp_z_sku."</td>";
|
||||
$content_data.="<td>".deel_bfb($tmp_z_sku,$xj_z_sku)."</td>";
|
||||
$content_data.="<td>".$tmp_yd_sku."</td>";
|
||||
$content_data.="<td>".deel_bfb($tmp_yd_sku,$xj_yd_sku)."</td>";
|
||||
$content_data.="<td>".deel_01($tmp_yd_js)."</td>";
|
||||
$content_data.="<td>".deel_bfb($tmp_yd_js,$xj_yd_js)."</td>";
|
||||
$content_data.="<td>".deel_01($tmp_yd_je)."</td>";
|
||||
$content_data.="<td>".deel_bfb($tmp_yd_je,$xj_yd_je)."</td>";
|
||||
$content_data.="</tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
if($xj_z_sku>0){
|
||||
$content_data.="<tr align=center>";
|
||||
$content_data.="<td colspan=2>小计</td>";
|
||||
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.="<td>".keep_float($tmp["jj"],1)."</td>";
|
||||
$content_data.="<td>".$xj_z_ks."</td>";
|
||||
$content_data.="<td>".deel_bfb($xj_z_ks,$total_ks)."</td>";
|
||||
$content_data.="<td>".$xj_yd_ks."</td>";
|
||||
$content_data.="<td>".deel_bfb($xj_yd_ks,$total_yd_ks)."</td>";
|
||||
}
|
||||
$content_data.="<td>".$xj_z_sku."</td>";
|
||||
$content_data.="<td>".deel_bfb($xj_z_sku,$total_sku)."</td>";
|
||||
$content_data.="<td>".$xj_yd_sku."</td>";
|
||||
$content_data.="<td>".deel_bfb($xj_yd_sku,$total_yd_sku)."</td>";
|
||||
$content_data.="<td>".deel_num($xj_yd_js)."</td>";
|
||||
$content_data.="<td>".deel_bfb($xj_yd_js,$total_yd_js)."</td>";
|
||||
$content_data.="<td>".deel_num($xj_yd_je)."</td>";
|
||||
$content_data.="<td>".deel_bfb($xj_yd_je,$total_yd_je)."</td>";
|
||||
$content_data.="</tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
$content_data.="</tbody>";
|
||||
//
|
||||
$content_data.="<tfoot>";
|
||||
$content_data.="<tr style='background-color:#f2f2f2' align=center>";
|
||||
$content_data.="<td colspan=2>合计</td>";
|
||||
|
||||
if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by1!="color" && $s_group_by2!="color"){
|
||||
$content_data.="<td>".$price_jj."</td>";
|
||||
$content_data.="<td>".$total_ks."</td>";
|
||||
$content_data.="<td></td>";
|
||||
$content_data.="<td>".deel_num($total_yd_ks)."</td>";
|
||||
$content_data.="<td></td>";
|
||||
}
|
||||
$content_data.="<td>".deel_num($total_sku)."</td>";
|
||||
$content_data.="<td></td>";
|
||||
$content_data.="<td>".deel_num($total_yd_sku)."</td>";
|
||||
$content_data.="<td></td>";
|
||||
$content_data.="<td>".deel_num($total_yd_js)."</td>";
|
||||
$content_data.="<td></td>";
|
||||
$content_data.="<td>".deel_num($total_yd_je)."</td>";
|
||||
$content_data.="<td></td>";
|
||||
$content_data.="</tr>";
|
||||
$content_data.="</tfoot>";
|
||||
$content_data.="</table>";
|
||||
}
|
||||
}else if($zd1=="" && $zd2==""){
|
||||
//请求数据有误
|
||||
$content_data="<div align='center'>请先配置参数!</div>";
|
||||
$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.="<table id='tabledetail' class='cell-border nowrap' width='100%' lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' class='layui-table'>";
|
||||
$content_data.="<thead><tr style='background-color:#f2f2f2' align=center><td>件数</td><td>款色数</td><td>占比</td></tr>";
|
||||
$content_data.="</thead>";
|
||||
$content_data.="<tbody>";
|
||||
//
|
||||
$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.="<tr align=center><td>".deel_num($m["num"])."</td><td>".$m["kss"]."</td><td>".deel_bfb($m["kss"],$total_kss)."</td></tr>";
|
||||
$count++;
|
||||
$l+=$m["num"]*$m["kss"];
|
||||
}
|
||||
|
||||
//
|
||||
$content_data.="</tbody>";
|
||||
$content_data.="<tfoot>";
|
||||
$content_data.="<tr align=center style='background-color:#f2f2f2'><td>合计(".$l.")</td><td>".$total_kss."</td><td>100%</td></tr>";
|
||||
$content_data.="</tfoot>";
|
||||
$content_data.="</table>";
|
||||
}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.="<table id='tabledetail' class='cell-border nowrap' width='100%' lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' class='layui-table'>";
|
||||
$content_data.="<thead><tr style='background-color:#f2f2f2' align=center><td>尺码组</td><td>尺码</td><td>已订件数</td><td>件数占比</td><td>吊牌金额</td><td>金额占比</td></tr>";
|
||||
$content_data.="</thead>";
|
||||
$content_data.="<tbody>";
|
||||
//
|
||||
$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.="<tr align=center><td>".$m1["title"]."</td><td>".$m["title"]."</td><td>".$arr1[0]."</td><td>".deel_bfb($arr1[0],$total_yd_js)."</td><td>".$arr1[1]."</td><td>".deel_bfb($arr1[1],$total_yd_je)."</td></tr>";
|
||||
$count++;
|
||||
//
|
||||
$tb_data_x.=$m["title"].",";
|
||||
$tb_data_y.=str_replace("%","",deel_bfb($arr1[0],$total_yd_js)).",";
|
||||
}
|
||||
$l++;
|
||||
}
|
||||
$content_data.="</tbody>";
|
||||
$content_data.="<tfoot>";
|
||||
$content_data.="<tr align=center style='background-color:#f2f2f2'><td></td><td></td><td>".$total_num."</td><td></td><td>".$total_money."</td><td></td></tr>";
|
||||
$content_data.="</tfoot>";
|
||||
$content_data.="</table>";
|
||||
}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;$i1<count($arr1);$i1++){
|
||||
if($s_ka=="y"){
|
||||
if(in_array($arr1[$i1],$arr2))
|
||||
$total_sku++;
|
||||
}else{
|
||||
if(!in_array($arr1[$i1],$arr2))
|
||||
$total_sku++;
|
||||
}
|
||||
}
|
||||
}
|
||||
//取得已订总件数和金额
|
||||
$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"];
|
||||
//取得已订总款色数
|
||||
$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.="<table id='tabledetail' class='cell-border nowrap' width='100%' lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' class='layui-table'>";
|
||||
$content_data.="<thead><tr style='background-color:#f2f2f2' align=center><td rowspan=2>颜色</td><td colspan=2>设计款色</td><td colspan=2>已订款色</td><td colspan=2>已订件数</td><td colspan=2>吊牌金额</td></tr>";
|
||||
$content_data.="<tr style='background-color:#f2f2f2' align=center><td>款数</td><td>占比</td><td>款数</td><td>占比</td><td>件数</td><td>占比</td><td>金额</td><td>占比</td></tr>";
|
||||
$content_data.="</thead>";
|
||||
$content_data.="<tbody>";
|
||||
//
|
||||
$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.="<tr align=center><td>".$m["title"]."</td><td>".$tmp_z_sku."</td><td>".deel_bfb($tmp_z_sku,$total_sku)."</td><td>".$tmp_yd_sku."</td><td>".deel_bfb($tmp_yd_sku,$total_yd_sku)."</td><td>".deel_01($m1["num"])."</td><td>".deel_bfb($m1["num"],$total_yd_js)."</td><td>".deel_01($m1["je"])."</td><td>".deel_bfb($m1["je"],$total_yd_je)."</td></tr>";
|
||||
//
|
||||
$tb_data_x.=$m["title"].",";
|
||||
$tb_data_y.=str_replace("%","",deel_bfb($m1["num"],$total_yd_js)).",";
|
||||
}
|
||||
$content_data.="</tbody>";
|
||||
$content_data.="<tfoot>";
|
||||
$content_data.="<tr align=center style='background-color:#f2f2f2'><td>合计</td><td>".$total_sku."</td><td></td><td>".$total_yd_sku."</td><td></td><td>".$total_num."</td><td></td><td>".$total_money."</td><td></td></tr>";
|
||||
$content_data.="</tfoot>";
|
||||
$content_data.="</table>";
|
||||
|
||||
}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<count($arr1);$i1++){
|
||||
if($s_ka=="y"){
|
||||
if(in_array($arr1[$i1],$arr2))
|
||||
$total_sku++;
|
||||
}else{
|
||||
if(!in_array($arr1[$i1],$arr2))
|
||||
$total_sku++;
|
||||
}
|
||||
}
|
||||
}
|
||||
//取得已订总件数和金额
|
||||
$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,color) 'num' from ".$table_pre."order where ".$s_group_by."<>'' ".$con);
|
||||
$total_yd_sku=$tmp1["num"];
|
||||
//
|
||||
$content_data="";
|
||||
$content_data.="<table id='tabledetail' class='cell-border nowrap' width='100%' lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' class='layui-table'>";
|
||||
$content_data.="<thead><tr style='background-color:#f2f2f2' align=center><td rowspan=2>色系</td><td colspan=2>设计款色</td><td colspan=2>已订款色</td><td colspan=2>已订件数</td><td colspan=2>吊牌金额</td></tr>";
|
||||
$content_data.="<tr style='background-color:#f2f2f2' align=center><td>款数</td><td>占比</td><td>款数</td><td>占比</td><td>件数</td><td>占比</td><td>金额</td><td>占比</td></tr>";
|
||||
$content_data.="</thead>";
|
||||
$content_data.="<tbody>";
|
||||
//
|
||||
$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;$i1<count($arr_color);$i1++){
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where concat(',',color,',') like '%,".$arr_color[$i1].",%'".$con1);
|
||||
$n1+=$tmp["num"];
|
||||
}
|
||||
$tmp_sku=$n1;
|
||||
//取得款色
|
||||
$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=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"];
|
||||
//
|
||||
$content_data.="<tr align=center><td>".$m["title"]."</td><td>".deel_01($tmp_sku)."</td><td>".deel_bfb($tmp_sku,$total_sku)."</td><td>".deel_01($tmp_yd_sku)."</td><td>".deel_bfb($tmp_yd_sku,$total_yd_sku)."</td><td>".deel_01($tmp_yd_js)."</td><td>".deel_bfb($tmp_yd_js,$total_yd_js)."</td><td>".deel_01($tmp_yd_je)."</td><td>".deel_bfb($tmp_yd_je,$total_yd_je)."</td></tr>";
|
||||
|
||||
$count++;
|
||||
//
|
||||
$tb_data_x.=$m["title"].",";
|
||||
$tb_data_y.=str_replace("%","",deel_bfb($tmp_yd_js,$total_yd_js)).",";
|
||||
}
|
||||
$content_data.="</tbody>";
|
||||
$content_data.="<tfoot>";
|
||||
$content_data.="<tr align=center style='background-color:#f2f2f2'><td>合计</td><td>".$total_sku."</td><td></td><td>".$total_yd_sku."</td><td></td><td>".$total_yd_js."</td><td></td><td>".$total_yd_je."</td><td></td></tr>";
|
||||
$content_data.="</tfoot>";
|
||||
$content_data.="</table>";
|
||||
}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<count($arr1);$i1++){
|
||||
if(!in_array($arr1[$i1],$arr2))
|
||||
$total_sku++;
|
||||
}
|
||||
}
|
||||
//取得总均价
|
||||
$tmp=get_db_msg("select sum(price)/count(*) 'jj' from ".$table_pre."kh where ".$s_group_by."<>''".$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.="<table id='tabledetail' class='cell-border nowrap' width='100%' lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' class='layui-table'>";
|
||||
$content_data.="<thead><tr style='background-color:#f2f2f2' align=center><td rowspan=2>".get_cate_title_no("arr_select",$s_group_by)."</td><td rowspan=2>均价</td><td colspan=2>设计款数</td><td colspan=2>已订款数</td><td colspan=2>设计款色</td><td colspan=2>已订款色</td><td colspan=2>已订件数</td><td colspan=2>吊牌金额</td></tr>";
|
||||
$content_data.="<tr style='background-color:#f2f2f2' align=center><td>款数</td><td>占比</td><td>款数</td><td>占比</td><td>款数</td><td>占比</td><td>款数</td><td>占比</td><td>件数</td><td>占比</td><td>金额</td><td>占比</td></tr>";
|
||||
$content_data.="</thead>";
|
||||
$content_data.="<tbody>";
|
||||
//
|
||||
$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.="<tr align=center><td>".$m["title"]."</td><td>".keep_float($tmp["jj"],1)."</td><td>".$tmp_z_ks."</td><td>".deel_bfb($tmp_z_ks,$total_ks)."</td><td>".$tmp_yd_ks."</td><td>".deel_bfb($tmp_yd_ks,$total_yd_ks)."</td><td>".$tmp_z_sku."</td><td>".deel_bfb($tmp_z_sku,$total_sku)."</td><td>".$tmp_yd_sku."</td><td>".deel_bfb($tmp_yd_sku,$total_yd_sku)."</td><td>".deel_01($tmp_yd_js)."</td><td>".deel_bfb($tmp_yd_js,$total_yd_js)."</td><td>".deel_01($tmp_yd_je)."</td><td>".deel_bfb($tmp_yd_je,$total_yd_je)."</td></tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
$content_data.="</tbody>";
|
||||
$content_data.="<tfoot>";
|
||||
$content_data.="<tr align=center style='background-color:#f2f2f2'><td>合计</td><td>".$price_jj."</td><td>".$total_ks."</td><td></td><td>".$total_yd_ks."</td><td></td><td>".$total_sku."</td><td></td><td>".$total_yd_sku."</td><td></td><td>".$total_yd_js."</td><td></td><td>".$total_yd_je."</td><td></td></tr>";
|
||||
$content_data.="</tfoot>";
|
||||
$content_data.="</table>";
|
||||
}
|
||||
|
||||
//图
|
||||
$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."\",";
|
||||
?>
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
//陈列分析报表
|
||||
//安装sql:INSERT INTO web_plugin (cate,file_name,title) VALUES('admin_bb','cl','陈列分析报表');
|
||||
//2017、10、13 by hehe
|
||||
//$f1=get_file_name(dir_cutc(__FILE__));
|
||||
//if("plugin_".$f1==$s_group_by){
|
||||
//echo "<pre>";
|
||||
//print_r($_SERVER["HTTP_REFERER"]);
|
||||
$zd_arr=array("num"=>"订量","je"=>"金额");
|
||||
if($s_order)
|
||||
$order_by=$s_order." desc";
|
||||
else
|
||||
$order_by="zsh";
|
||||
$op="";
|
||||
foreach($zd_arr as $k => $v){
|
||||
$op.="{\"no\":\"".$k."\",\"title\":\"".$v."\"},";
|
||||
//$op.="<option value='".$k."'";
|
||||
//if($s_order==$k)
|
||||
//$op.=" selected";
|
||||
//$op.=">".$v."</option>";
|
||||
}
|
||||
$select.="{\"name\":\"s_order\",\"title\":\"排序方式\",\"value\":\"".$s_order."\",\"op\":[".deel_end($op)."]},";
|
||||
//$search_content.=" <select name='s_order'><option value=''>默认</option>".$op."</select>";
|
||||
//取得款色订单数据
|
||||
$q="select no,color,sum(num) 'num',sum(je) 'je' from ".$table_pre."order group by no,color";
|
||||
$r=$db->query($q);
|
||||
$arr_order=array();
|
||||
$total_num=$total_je=0;
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_order[$m["no"]][$m["color"]]=array($m["num"],$m["je"]);
|
||||
$total_num+=$m["num"];
|
||||
$total_je+=$m["je"];
|
||||
}
|
||||
//取得数据
|
||||
$total_cl_num=0;
|
||||
$q1="select zsh,pic,title from ".$table_pre."kh_ty group by zsh order by zsh";
|
||||
$r1=$db->query($q1);
|
||||
$arr_cl=array();
|
||||
$i=0;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_cl[$i]["zsh"]=$m1["zsh"];
|
||||
$arr_cl[$i]["pic"]=$m1["pic"];
|
||||
$arr_cl[$i]["title"]=$m1["title"];
|
||||
$tmp_num=$tmp_je=0;
|
||||
//取得搭配
|
||||
$q2="select kh from ".$table_pre."kh_ty where zsh='".$m1["zsh"]."' order by kh";
|
||||
$r2=$db->query($q2);
|
||||
$arr_ks_tmp=array();
|
||||
while($m2=$db->fetch_array($r2)){
|
||||
//取得款号
|
||||
$q3="select kh,color from ".$table_pre."kh_dp where title='".$m2["kh"]."'";
|
||||
$r3=$db->query($q3);
|
||||
while($m3=$db->fetch_array($r3)){
|
||||
if(!in_array($m3["kh"]."|".$m3["color"],$arr_ks_tmp))
|
||||
$arr_ks_tmp[]=$m3["kh"]."|".$m3["color"];
|
||||
}
|
||||
}
|
||||
for($i1=0;$i1<count($arr_ks_tmp);$i1++){
|
||||
$arr_tmp=explode("|",$arr_ks_tmp[$i1]);
|
||||
$num1=$arr_order[$arr_tmp[0]][$arr_tmp[1]][0]>0?$arr_order[$arr_tmp[0]][$arr_tmp[1]][0]:0;
|
||||
$tmp_num+=$num1;
|
||||
$je1=$arr_order[$arr_tmp[0]][$arr_tmp[1]][1]>0?$arr_order[$arr_tmp[0]][$arr_tmp[1]][1]:0;
|
||||
$tmp_je+=$je1;
|
||||
}
|
||||
$arr_cl[$i]["num"]=$tmp_num;
|
||||
$arr_cl[$i]["je"]=$tmp_je;
|
||||
$total_cl_num++;
|
||||
$i++;
|
||||
}
|
||||
$content.="<table border='0' cellspacing='1' cellpadding='4' bgcolor='#000000' width='100%' id='tabledetail' class='cell-border nowrap' class='layui-table' style='color:#000000;'><thead>";
|
||||
$content.="<tr><th align='center' bgcolor='#DDEBF7' width='80' nowrap='nowrap'>序号</th><th align='center' bgcolor='#DDEBF7' width='80' nowrap='nowrap'>陈列号</th><th align='center' bgcolor='#DDEBF7' width='80' nowrap='nowrap'>陈列图</th><th align='center' bgcolor='#DDEBF7' width='80' nowrap='nowrap'>陈列名称</th><th align='center' bgcolor='#DDEBF7' width='80' nowrap='nowrap'>订量</th><th align='center' bgcolor='#DDEBF7' width='80' nowrap='nowrap'>订货金额</th><th align='center' bgcolor='#DDEBF7' width='80' nowrap='nowrap'>款数</th><th align='center' bgcolor='#DDEBF7' width='80' nowrap='nowrap'>款色数</th>";
|
||||
$content.="</tr>";
|
||||
$content.="<tr><td align='center' bgcolor='#DDEBF7' nowrap='nowrap'>合计</td><td align='center' bgcolor='#DDEBF7'>共".$total_cl_num."组</td><td align='center' bgcolor='#DDEBF7'> </td><td align='center' bgcolor='#DDEBF7'> </td><td align='right' bgcolor='#DDEBF7'>".$total_num."</td><td align='right' bgcolor='#DDEBF7'>".$total_je."</td><td align='center' bgcolor='#DDEBF7'> </td><td align='center' bgcolor='#DDEBF7'> </td>";
|
||||
$content.="</tr></thead><tbody>";
|
||||
//
|
||||
$list=1;
|
||||
for($i=0;$i<count($arr_cl);$i++){
|
||||
$pic=get_kh_ty_mini($arr_cl[$i]["pic"]);
|
||||
$tmp_ks=get_db_msg("select count(distinct kh) ks,count(distinct kh,color) skc from ".$table_pre."kh_dp where title in (select kh from web_kh_ty where zsh='".$arr_cl[$i]["zsh"]."')");
|
||||
$content.="<tr><td align='center' class='td1' nowrap='nowrap'>".$list."</td><td align='center' class='td1'>".$arr_cl[$i]["zsh"]."</td><td align='center' class='td1'><a href='plugin.htm?file_name=dgph&cate=client_bb&s_zsh=".$arr_cl[$i]["zsh"]."'><img src='".$pic."' width='100px'/></a></td><td align='center' class='td1'>".$arr_cl[$i]["title"]."</td><td align='right' class='td1'>".$arr_cl[$i]["num"]."</td><td align='right' class='td1'>".$arr_cl[$i]["je"]."</td><td align='center' class='td1'>".$tmp_ks["ks"]."</td><td align='center' class='td1'>".$tmp_ks["skc"]."</td>";
|
||||
$content.="</tr>";
|
||||
$list++;
|
||||
}
|
||||
$content.="</tbody></table>";
|
||||
$json_data.="\"table_html\":\"".$content."\",";
|
||||
//echo $content;
|
||||
//include template("order_list_js");
|
||||
//exit;
|
||||
//}
|
||||
function get_kh_ty_mini($clh){
|
||||
global $order_session;
|
||||
$s_dir=$order_session?$order_session."/":"";
|
||||
$pic="../attachments/ty/mini/".$clh.".jpg";
|
||||
if(!is_file($pic)){
|
||||
$pic="images/no_pic.png";
|
||||
}
|
||||
return $pic;
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
//色系1维报表
|
||||
//可配置参数:color_zd1|zd1|到色字段,icon|menu_icon_bb_xw_ms|菜单图标
|
||||
//2018-12-11 by hehe
|
||||
//-----参数配置
|
||||
//菜单图标
|
||||
$icon=get_plugin_set("icon","menu_icon_bb_xw_ms");//支持以下目录的图标ipad/images/menu_icon_*.png
|
||||
//到色字段
|
||||
$zd1=get_plugin_set("color_zd1","zd1");
|
||||
//
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
if(count($sys_color_zd)>0){
|
||||
//店铺查询条件
|
||||
$con="";
|
||||
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{
|
||||
//代理角色所有客户
|
||||
$con=" and (upath='".$msg_client["path"]."-".$msg_client["id"]."' or upath like '".$msg_client["path"]."-".$msg_client["id"]."-%')";
|
||||
}
|
||||
}
|
||||
$zd_title1=get_main_value($sys_color_zd,$zd1);
|
||||
$content_data.="<table border='0' cellspacing='1' cellpadding='4' class='layui-table'><thead>";
|
||||
//表头第一行
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<th align='center' rowspan='2'><strong>".$zd_title1."</strong></th><th align='center' colspan='2'><strong>设计款数</strong></th><th align='center' colspan='2'><strong>已订款数</strong></th><th align='center' colspan='2'><strong>已订件数</strong></th><th align='center' colspan='2'><strong>已订金额</strong></th>";
|
||||
$content_data.="</tr>";
|
||||
//表头第二行
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<th align='center'><strong>款数</strong></th><th align='center'><strong>占比</strong></th><th align='center'><strong>款数</strong></th><th align='center'><strong>占比</strong></th><th align='center'><strong>件数</strong></th><th align='center'><strong>占比</strong></th><th align='center'><strong>金额</strong></th><th align='center'><strong>占比</strong></th>";
|
||||
$content_data.="</tr>";
|
||||
$content_data.="</thead>";
|
||||
//-----------取得报表数据
|
||||
//取得总设计款色数
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh_color where ka<>'y'");
|
||||
$total_sj_kss=$tmp["num"];
|
||||
//取得订单总数
|
||||
$tmp=get_db_msg("select sum(num) 'js',sum(je) 'je',count(distinct iid,color) 'kss' from ".$table_pre."order where ka<>'y' ".$con);
|
||||
$total_yd_kss=$tmp["kss"];
|
||||
$total_yd_js=$tmp["js"];
|
||||
$total_yd_je=$tmp["je"];
|
||||
//--------------------输出报表-----------------------------------------------
|
||||
$content_data.="<tbody>";
|
||||
$q1="select a.".$zd1.",count(*) 'ks',a.iid,a.color from ".$table_pre."kh_color a,".$table_pre."kh b where a.iid=b.id group by a.".$zd1." order by a.".$zd1;
|
||||
//echo $q1."<br>";
|
||||
$r1=$db->query($q1);
|
||||
$tb_data="";
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
//取得订单数据
|
||||
$m2=get_db_msg("select sum(num) 'js', sum(je) 'je',count(distinct iid,color) 'kss' from ".$table_pre."order where concat(iid,'-',color) in (select concat(a.iid,'-',a.color) from ".$table_pre."kh_color a,".$table_pre."kh b where a.iid=b.id and a.".$zd1."='".$m1[$zd1]."') ".$con);
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<td align='center'>".$m1[$zd1]."</td><td align='center'>".deel_td(deel_0($m1["ks"]))."</td><td align='center'>".deel_bfb($m1["ks"],$total_sj_kss)."</td><td align='center'>".deel_td(deel_0($m2["kss"]))."</td><td align='center'>".deel_bfb($m2["kss"],$total_yd_kss)."</td><td align='center'>".deel_td(deel_0($m2["js"]))."</td><td align='center'>".deel_bfb($m2["js"],$total_yd_js)."</td><td align='center'>".deel_td(deel_0(deel_num($m2["je"])))."</td><td align='center'>".deel_bfb($m2["je"],$total_yd_je)."</td>";
|
||||
$content_data.="</tr>";
|
||||
//记录图表数据
|
||||
$tb_data.=$m1[$zd1]."|".str_replace("%","",deel_bfb($m2["js"],$total_yd_js)).",";
|
||||
}
|
||||
$content_data.="<tr><td align='center'>合计</td><td align='center'>".deel_td(deel_0($total_sj_kss))."</td><td align='center'>100%</td><td align='center'>".deel_td(deel_0($total_yd_kss))."</td><td align='center'>100%</td><td align='center'>".deel_td(deel_0($total_yd_js))."</td><td align='center'>100%</td><td align='center'>".deel_td(deel_0(deel_num($total_yd_je)))."</td><td align='center'>100%</td></tr>";
|
||||
$content_data.="</tbody>";
|
||||
$content_data.="</table>";
|
||||
}else{
|
||||
$content_data="<div align='center'>请先配置tmpl/config.php中的sys_color_zd参数!</div>";
|
||||
}
|
||||
$json_data.="\"table_html\":\"".$content_data."\",";
|
||||
?>
|
||||
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
//色系2维报表
|
||||
//可配置参数:keyword_zd1|category|款号属性字段,color_zd1|zd1|到色字段,icon|menu_icon_bb|菜单图标
|
||||
//2018-12-11 by hehe
|
||||
//-----参数配置
|
||||
//菜单图标
|
||||
$icon=get_plugin_set("icon","menu_icon_bb");//支持以下目录的图标ipad/images/menu_icon_*.png
|
||||
//横向维度:款号属性字段
|
||||
$zd1=get_plugin_set("keyword_zd1","category");
|
||||
//横向维度:到色字段
|
||||
$zd2=get_plugin_set("color_zd1","zd1");
|
||||
//
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
if(count($sys_color_zd)>0){
|
||||
//店铺查询条件
|
||||
$con="";
|
||||
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{
|
||||
//代理角色所有客户
|
||||
$con=" and (upath='".$msg_client["path"]."-".$msg_client["id"]."' or upath like '".$msg_client["path"]."-".$msg_client["id"]."-%')";
|
||||
}
|
||||
}
|
||||
$zd_title1=get_cate_title_no("arr_select",$zd1);
|
||||
$zd_title2=get_main_value($sys_color_zd,$zd2);
|
||||
//取得选项
|
||||
$arr_zd1=array();
|
||||
$q="select * from ".$table_pre."keyword where cate='".$zd1."' order by no";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_zd1[$m["no"]]=$m["title"];
|
||||
}
|
||||
$content_data.="<table border='0' cellspacing='1' cellpadding='4' class='layui-table'><thead>";
|
||||
//表头第一行
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<th align='center' rowspan='2'><strong>".$zd_title1."</strong></th><th align='center' rowspan='2'><strong>".$zd_title2."</strong></th><th align='center' colspan='2'><strong>设计款数</strong></th><th align='center' colspan='2'><strong>已订款数</strong></th><th align='center' colspan='2'><strong>已订件数</strong></th><th align='center' colspan='2'><strong>已订金额</strong></th>";
|
||||
$content_data.="</tr>";
|
||||
//表头第二行
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<th align='center'><strong>款数</strong></th><th align='center'><strong>占比</strong></th><th align='center'><strong>款数</strong></th><th align='center'><strong>占比</strong></th><th align='center'><strong>件数</strong></th><th align='center'><strong>占比</strong></th><th align='center'><strong>金额</strong></th><th align='center'><strong>占比</strong></th>";
|
||||
$content_data.="</tr>";
|
||||
$content_data.="</thead>";
|
||||
//-----------取得报表数据
|
||||
//取得总设计款色数
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh_color where ka<>'y'");
|
||||
$total_sj_kss=$tmp["num"];
|
||||
//取得小计设计款色数
|
||||
$arr_design_data=array();
|
||||
$q1="select b.".$zd1.",count(a.color) as num from ".$table_pre."kh b,".$table_pre."kh_color a where b.ka<>'y' and b.id=a.iid group by b.".$zd1;
|
||||
$r1=$db->query($q1);
|
||||
$arr_design_data=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_design_data[$m1[$zd1]]=$m1["num"];
|
||||
}
|
||||
//取得订单总数
|
||||
$tmp=get_db_msg("select sum(num) 'js',sum(je) 'je',count(distinct iid,color) 'kss' from ".$table_pre."order where ka<>'y' ".$con);
|
||||
$total_yd_kss=$tmp["kss"];
|
||||
$total_yd_js=$tmp["js"];
|
||||
$total_yd_je=$tmp["je"];
|
||||
//取得小计订单数据
|
||||
$arr_order_data=array();
|
||||
$q3="select sum(num) 'js', sum(je) 'je',count(distinct iid,color) 'kss',".$zd1." from ".$table_pre."order where ka<>'y' ".$con." group by ".$zd1;
|
||||
$r3=$db->query($q3);
|
||||
$arr_order_ksdata=array();
|
||||
while($m3=$db->fetch_array($r3)){
|
||||
$arr_order_data[$m3[$zd1]]=array($m3["kss"],$m3["js"],$m3["je"]);
|
||||
}
|
||||
//--------------------输出报表-----------------------------------------------
|
||||
$content_data.="<tbody>";
|
||||
foreach($arr_zd1 as $k1 => $v1){
|
||||
$q1="select a.".$zd2.",count(*) 'ks',a.iid,a.color from ".$table_pre."kh_color a,".$table_pre."kh b where a.iid=b.id and b.".$zd1."='".$k1."' group by a.".$zd2." order by a.".$zd2;
|
||||
//echo $q1."<br>";
|
||||
$r1=$db->query($q1);
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
//取得订单数据
|
||||
$m2=get_db_msg("select sum(num) 'js', sum(je) 'je',count(distinct iid,color) 'kss' from ".$table_pre."order where concat(iid,'-',color) in (select concat(a.iid,'-',a.color) from ".$table_pre."kh_color a,".$table_pre."kh b where a.iid=b.id and b.".$zd1."='".$k1."' and a.".$zd2."='".$m1[$zd2]."') ".$con);
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<td align='center'>".$v1."</td><td align='center'>".$m1[$zd2]."</td><td align='center'>".deel_td(deel_0($m1["ks"]))."</td><td align='center'>".deel_bfb($m1["ks"],$arr_design_data[$k1])."</td><td align='center'>".deel_td(deel_0($m2["kss"]))."</td><td align='center'>".deel_bfb($m2["kss"],$arr_order_data[$k1][0])."</td><td align='center'>".deel_td(deel_0($m2["js"]))."</td><td align='center'>".deel_bfb($m2["js"],$arr_order_data[$k1][1])."</td><td align='center'>".deel_td(deel_0(deel_num($m2["je"])))."</td><td align='center'>".deel_bfb($m2["je"],$arr_order_data[$k1][2])."</td>";
|
||||
$content_data.="</tr>";
|
||||
}
|
||||
//小计
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<td align='center' colspan='2'>".$v1."小计</td><td align='center'>".deel_td(deel_0($arr_design_data[$k1]))."</td><td align='center'>".deel_bfb($arr_design_data[$k1],$total_sj_kss)."</td><td align='center'>".deel_td(deel_0($arr_order_data[$k1][0]))."</td><td align='center'>".deel_bfb($arr_order_data[$k1][0],$total_yd_kss)."</td><td align='center'>".deel_td(deel_0($arr_order_data[$k1][1]))."</td><td align='center'>".deel_bfb($arr_order_data[$k1][1],$total_yd_js)."</td><td align='center'>".deel_td(deel_0(deel_num($arr_order_data[$k1][2])))."</td><td align='center'>".deel_bfb($arr_order_data[$k1][2],$total_yd_je)."</td>";
|
||||
$content_data.="</tr>";
|
||||
}
|
||||
$content_data.="<tr><td align='center' class='td3' colspan='2'>合计</td><td align='center' class='td3'>".deel_td(deel_0($total_sj_kss))."</td><td align='center' class='td3'>100%</td><td align='center' class='td3'>".deel_td(deel_0($total_yd_kss))."</td><td align='center' class='td3'>100%</td><td align='center' class='td3'>".deel_td(deel_0($total_yd_js))."</td><td align='center' class='td3'>100%</td><td align='center' class='td3'>".deel_td(deel_0(deel_num($total_yd_je)))."</td><td align='center' class='td3'>100%</td></tr>";
|
||||
$content_data.="</tbody>";
|
||||
$content_data.="</table>";
|
||||
}else{
|
||||
$content_data="<div align='center'>请先配置tmpl/config.php中的sys_color_zd参数!</div>";
|
||||
}
|
||||
$json_data.="\"table_html\":\"".$content_data."\",";
|
||||
?>
|
||||
@@ -0,0 +1,246 @@
|
||||
<?php
|
||||
//单场排行报表
|
||||
//安装sql:INSERT INTO web_plugin (cate,file_name,title) VALUES('admin_bb','dgph','单场排行报表');
|
||||
//$f1=get_file_name(dir_cutc(__FILE__));
|
||||
//if("plugin_".$f1==$s_group_by){
|
||||
$zd1="category";//大类
|
||||
$n="s_".$zd1;
|
||||
$zd_arr=array("dk"=>"到款","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.="<option value='".$m1["zsh"]."'";
|
||||
//if($s_zsh==$m1["zsh"])
|
||||
//$op1.=" selected";
|
||||
//$op1.=">".$m1["title"]."</option>";
|
||||
}
|
||||
$select.="{\"name\":\"s_zsh\",\"title\":\"选择杆\",\"value\":\"".$s_zsh."\",\"op\":[".deel_end($op)."]},";
|
||||
|
||||
|
||||
|
||||
$op="";
|
||||
foreach($arrcc as $k => $v){
|
||||
$op.="{\"no\":\"".$k."\",\"title\":\"".$v."\"},";
|
||||
//$op3.="<option value='".$k."'";
|
||||
//if($s_cc==$k)
|
||||
//$op3.=" selected";
|
||||
//$op3.=">".$v."</option>";
|
||||
}
|
||||
$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.="<option value='".$k."'";
|
||||
//if($s_type==$k)
|
||||
//$op2.=" selected";
|
||||
//$op2.=">".$v."</option>";
|
||||
}
|
||||
$select.="{\"name\":\"s_type\",\"title\":\"到款到色\",\"value\":\"".$s_type."\",\"op\":[".deel_end($op)."]},";
|
||||
|
||||
$con="";
|
||||
$content_search.=" <select name='s_zsh' onchange='tj.submit();'><option value=''>-选择-</option>".$op1."</select>";
|
||||
$content_search.=" <select name='s_cc' onchange='tj.submit();'><option value=''>-选择场次-</option>".$op3."</select>";
|
||||
$content_search.="<select name='".$n."' onchange='tj.submit();'><option value=''>-所有".get_cate_title_no("arr_select",$zd1)."-</option>".op_select_cate1($zd1,$$n)."</select>";
|
||||
$content_search.=" <select name='s_type' onchange='tj.submit();'>".$op2."</select>";
|
||||
//读取所有款号订单数据
|
||||
$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.="<table border='0' cellspacing='1' cellpadding='4' bgcolor='#000000' width='100%' id='tabledetail' class='cell-border nowrap' class='layui-table' style='color:#000000;'><thead>";
|
||||
$content.="<tr><th align='center' bgcolor='#DDEBF7' width='60' nowrap='nowrap'>编号</th><th align='center' bgcolor='#DDEBF7' width='90' nowrap='nowrap'>图片</th><th align='center' bgcolor='#DDEBF7' nowrap='nowrap' width='160'>商品信息</th>";
|
||||
$content.="<th align='center' bgcolor='#DDEBF7' nowrap='nowrap'>订货信息</th>";
|
||||
$content.="<th align='center' bgcolor='#DDEBF7' nowrap='nowrap'>排名信息</th>";
|
||||
$content.="</tr></thead><tbody>";
|
||||
//echo $q."<br>";
|
||||
while($m=$db->fetch_array($r)){
|
||||
$m_kh=get_db_msg("select no,xh,color,main_pic,".$zd1." from ".$table_pre."kh where id='".$m["iid"]."'");
|
||||
if($s_type=="dk"){
|
||||
//图片
|
||||
$img=get_kh_picture($m_kh["no"],$m_kh["main_pic"],$m_kh["color"]);
|
||||
$img_big=get_kh_picture_big($m_kh["no"],$m_kh["main_pic"],$m_kh["color"]);
|
||||
$str_sp_color="";
|
||||
//搭配信息
|
||||
$str_sp_dp="搭配号:";
|
||||
$q1="select zsh,title from ".$table_pre."kh_dp where kh='".$m["no"]."'";
|
||||
$r1=$db->query($q1);
|
||||
$i=0;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$str_sp_dp.=$m1["title"].",";
|
||||
$i++;
|
||||
}
|
||||
if($i>0)
|
||||
$str_sp_dp=substr($str_sp_dp,0,-1);
|
||||
//陈列信息
|
||||
$str_sp_cl="陈列号:";
|
||||
$q1="select cl.zsh,cl.title from ".$table_pre."kh_dp dp,".$table_pre."kh_ty cl where dp.kh='".$m["no"]."' and dp.zsh=cl.kh group by cl.zsh order by cl.zsh";
|
||||
$r1=$db->query($q1);
|
||||
$i=0;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$str_sp_cl.=$m1["title"].",";
|
||||
$i++;
|
||||
}
|
||||
if($i>0)
|
||||
$str_sp_cl=substr($str_sp_cl,0,-1);
|
||||
//订货信息
|
||||
$str_dh="款订量:".$arr_order_kh[$m["no"]][0]."件<br>";
|
||||
$str_dh.="订店数:".$arr_order_kh[$m["no"]][1]."<Br>";
|
||||
$arr_color=explode(",",$m_kh["color"]);
|
||||
$str_dh_color="";
|
||||
for($i=0;$i<count($arr_color);$i++){
|
||||
$str_dh_color.=$arr_color[$i].get_cate_title_no("color",$arr_color[$i]).":".$arr_order_color[$m["no"]][$arr_color[$i]][0]."件/色排名:".(get_main_key($arr_ks_pm,$arr_order_color[$m["no"]][$arr_color[$i]][0])+1)."<br>";
|
||||
}
|
||||
$str_dh.=$str_dh_color;
|
||||
//排名信息
|
||||
$str_pm="款排名:".(get_main_key($arr_kh_pm,$arr_order_kh[$m["no"]][0])+1)."<br>";
|
||||
$str_pm.="类排名:".(get_main_key($arr_kl_pm[$m_kh[$zd1]],$arr_order_kh[$m["no"]][0])+1)."<br>";
|
||||
$href_color="";
|
||||
}else{
|
||||
//图片
|
||||
$img=get_kh_color_picture($m_kh["no"],$m["color"]);
|
||||
$img_big=get_kh_color_picture_big($m_kh["no"],$m["color"]);
|
||||
$str_sp_color="颜色:".$m["color"].get_cate_title_no("color",$m["color"])."<br>";
|
||||
//搭配信息
|
||||
$str_sp_dp="搭配号:";
|
||||
$q1="select zsh,title from ".$table_pre."kh_dp where kh='".$m["no"]."' and color='".$m["color"]."'";
|
||||
$r1=$db->query($q1);
|
||||
$i=0;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$str_sp_dp.=$m1["title"].",";
|
||||
$i++;
|
||||
}
|
||||
if($i>0)
|
||||
$str_sp_dp=substr($str_sp_dp,0,-1);
|
||||
//陈列信息
|
||||
$str_sp_cl="陈列号:";
|
||||
$q1="select cl.zsh,cl.title from ".$table_pre."kh_dp dp,".$table_pre."kh_ty cl where dp.kh='".$m["no"]."' and dp.color='".$m["color"]."' and dp.zsh=cl.kh group by cl.zsh order by cl.zsh";
|
||||
$r1=$db->query($q1);
|
||||
$i=0;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$str_sp_cl.=$m1["title"].",";
|
||||
$i++;
|
||||
}
|
||||
if($i>0)
|
||||
$str_sp_cl=substr($str_sp_cl,0,-1);
|
||||
//订货信息
|
||||
$str_dh="款订量:".$arr_order_kh[$m["no"]][0]."件<br>";
|
||||
$str_dh.="订店数:".$arr_order_kh[$m["no"]][1]."<Br>";
|
||||
$arr_color=explode(",",$m_kh["color"]);
|
||||
$str_dh_color="";
|
||||
for($i=0;$i<count($arr_color);$i++){
|
||||
$str_dh_color.=$arr_color[$i].get_cate_title_no("color",$arr_color[$i]).":".$arr_order_color[$m["no"]][$arr_color[$i]][0]."件/色排名:".(get_main_key($arr_ks_pm,$arr_order_color[$m["no"]][$arr_color[$i]][0])+1)."<br>";
|
||||
}
|
||||
$str_dh.=$str_dh_color;
|
||||
//排名信息
|
||||
$str_pm="款排名:".(get_main_key($arr_kh_pm,$arr_order_kh[$m["no"]][0])+1)."<br>";
|
||||
$str_pm.="类排名:".(get_main_key($arr_kl_pm[$m_kh[$zd1]],$arr_order_kh[$m["no"]][0])+1)."<br>";
|
||||
$href_color="&color=".$m["color"];
|
||||
}
|
||||
$content.="<tr>";
|
||||
$content.="<td align='center' class='td1' nowrap='nowrap'>".$list."</td>";
|
||||
$content.="<td align='center' class='td1'><a href='order_report_openDetail.htm?kh=".$m["no"].$href_color."&s_group_by=1&window=new' target='_blank'><img src='".$img."' height='80px' border=0 /></a></td>";
|
||||
//商品信息
|
||||
$str_sp="款号:".$m_kh["no"]."<br>".$str_sp_color;
|
||||
$str_sp.="圆牌号:".get_kh_xh($m_kh,$m["color"])."<br>";
|
||||
$str_sp.="大类:".get_cate_title_no($zd1,$m_kh[$zd1])."<br>";
|
||||
$str_sp.=$str_sp_dp."<br>";
|
||||
$str_sp.=$str_sp_cl."<br>";
|
||||
$content.="<td align='left' class='td1'>".$str_sp."</td>";
|
||||
//订货信息
|
||||
$content.="<td align='left' class='td1'>".$str_dh."</td>";
|
||||
//排名信息
|
||||
$content.="<td align='left' class='td1'>".$str_pm."</td>";
|
||||
$content.="</tr>";
|
||||
$list++;
|
||||
}
|
||||
$content.="</tbody></table>";
|
||||
$json_data.="\"table_html\":\"".$content."\",";
|
||||
//include template("order_list_js");
|
||||
//exit;
|
||||
//}
|
||||
?>
|
||||
@@ -0,0 +1,274 @@
|
||||
<?php
|
||||
//3维订货分析
|
||||
//可配置参数:zd1|sxz|横向维度1,zd2|category|横向维度2,zd3|brand|纵向维度
|
||||
//2018-12-11 by hehe
|
||||
//横向维度:zd1,zd2;纵向维度:zd3。
|
||||
//-----参数配置
|
||||
//横向维度
|
||||
$zd1=get_plugin_set("zd1","sxz");
|
||||
$zd2=get_plugin_set("zd2","category");
|
||||
//纵向维度
|
||||
$zd3=get_plugin_set("zd3","brand");
|
||||
//
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
//店铺查询条件
|
||||
$con="";
|
||||
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{
|
||||
//代理角色所有客户
|
||||
$con=" and (upath='".$msg_client["path"]."-".$msg_client["id"]."' or upath like '".$msg_client["path"]."-".$msg_client["id"]."-%')";
|
||||
}
|
||||
}
|
||||
$total_js=$msg_client["order_num"];
|
||||
$total_money=$msg_client["order_money"];
|
||||
for($i=1;$i<4;$i++){
|
||||
$v="zd".$i;
|
||||
$v1="zd_title".$i;
|
||||
$v2="arr_zd".$i;
|
||||
//取得对应字段的名称
|
||||
$$v1=get_cate_title_no("arr_select",$$v);
|
||||
//取得字段的选项值
|
||||
$q1="select no,title from ".$table_pre."keyword where cate='".$$v."' order by no";
|
||||
$r1=$db->query($q1);
|
||||
$arr_tmp=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_tmp[$m1["no"]]=$m1["title"];
|
||||
}
|
||||
$$v2=$arr_tmp;
|
||||
}
|
||||
$content_data="<table border='0' cellspacing='1' cellpadding='4' class='layui-table'><thead>";
|
||||
//表头第一行
|
||||
$content_data.="<tr><th align='center' rowspan='2'><strong>".$zd_title1."</strong></th><th align='center' rowspan='2'><strong>".$zd_title2."</strong></th>";
|
||||
foreach($arr_zd3 as $n1 => $t1){
|
||||
$content_data.="<th align='center' colspan='8'><strong>".$t1."</strong></th>";
|
||||
}
|
||||
$content_data.="<th align='center' colspan='8'><strong>总计</strong></th>";
|
||||
$content_data.="</tr>";
|
||||
//表头第二行
|
||||
$arr_zd5=array(1=>"订货会款量",2=>"订货款量",3=>"款占比",4=>"订量",5=>"订量占比",6=>"订货额",7=>"订额占比",8=>"均价");
|
||||
$content_data.="<tr>";
|
||||
foreach($arr_zd3 as $n1 => $t1){
|
||||
foreach($arr_zd5 as $n2 => $t2){
|
||||
$content_data.="<th align='center' width='30'><strong>".$t2."</strong></th>";
|
||||
}
|
||||
}
|
||||
foreach($arr_zd5 as $n2 => $t2){
|
||||
$content_data.="<th align='center' width='30'><strong>".$t2."</strong></th>";
|
||||
}
|
||||
$content_data.="</tr></thead>";
|
||||
//
|
||||
$content_data.="<tbody>";
|
||||
//-----------取得报表数据
|
||||
$total_js=$msg_login["order_num"];
|
||||
$total_je=$msg_login["order_money"];
|
||||
$c1=get_db_msg("select count(distinct no) 'ks' from ".$table_pre."order where _key='".$s_key."'".$con."");
|
||||
$total_ks=$c1["ks"];
|
||||
//订货款数,件数,金额
|
||||
$q1="select ".$zd1.",".$zd2.",".$zd3.",count(distinct no) 'ks',sum(num) 'js',sum(je) 'je' from ".$table_pre."order where _key='".$s_key."'".$con." group by ".$zd1.",".$zd2.",".$zd3;
|
||||
$r1=$db->query($q1);
|
||||
$arr_data_ks=$arr_data_js=$arr_data_je=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_data_ks[$m1[$zd1]][$m1[$zd2]][$m1[$zd3]]=$m1["ks"];
|
||||
$arr_data_js[$m1[$zd1]][$m1[$zd2]][$m1[$zd3]]=$m1["js"];
|
||||
$arr_data_je[$m1[$zd1]][$m1[$zd2]][$m1[$zd3]]=$m1["je"];
|
||||
}
|
||||
//订货会款数
|
||||
$q1="select ".$zd1.",".$zd2.",".$zd3.",count(*) 'ks' from ".$table_pre."kh where ka<>'y' group by ".$zd1.",".$zd2.",".$zd3;
|
||||
$r1=$db->query($q1);
|
||||
$arr_data_all_ks=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_data_all_ks[$m1[$zd1]][$m1[$zd2]][$m1[$zd3]]=$m1["ks"];
|
||||
}
|
||||
//小计款数
|
||||
$q1="select ".$zd1.",".$zd2.",count(*) 'ks' from ".$table_pre."kh where ka<>'y' group by ".$zd1.",".$zd2;
|
||||
$r1=$db->query($q1);
|
||||
$arr_data_xj_ks=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_data_xj_ks[$m1[$zd1]][$m1[$zd2]]=$m1["ks"];
|
||||
}
|
||||
//小计款数1
|
||||
$q1="select ".$zd1.",count(*) 'ks' from ".$table_pre."kh where ka<>'y' group by ".$zd1;
|
||||
$r1=$db->query($q1);
|
||||
$arr_data_xj_ks1=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_data_xj_ks1[$m1[$zd1]]=$m1["ks"];
|
||||
}
|
||||
//均价
|
||||
$q1="select ".$zd1.",".$zd2.",".$zd3.",sum(price)/count(*) 'jj' from ".$table_pre."kh where ka<>'y' group by ".$zd1.",".$zd2.",".$zd3;
|
||||
$r1=$db->query($q1);
|
||||
$arr_data_jj=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_data_jj[$m1[$zd1]][$m1[$zd2]][$m1[$zd3]]=$m1["jj"];
|
||||
}
|
||||
//整体均价
|
||||
$q1="select ".$zd1.",".$zd3.",sum(price)/count(*) 'jj' from ".$table_pre."kh where ka<>'y' group by ".$zd1.",".$zd3;
|
||||
$r1=$db->query($q1);
|
||||
$arr_data_zt_jj=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_data_zt_jj[$m1[$zd1]][$m1[$zd3]]=$m1["jj"];
|
||||
}
|
||||
//小计均价
|
||||
$q1="select ".$zd1.",".$zd2.",sum(price)/count(*) 'jj' from ".$table_pre."kh where ka<>'y' group by ".$zd1.",".$zd2;
|
||||
$r1=$db->query($q1);
|
||||
$arr_data_xj_jj=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_data_xj_jj[$m1[$zd1]][$m1[$zd2]]=$m1["jj"];
|
||||
}
|
||||
//合计均价
|
||||
$q1="select ".$zd1.",sum(price)/count(*) 'jj' from ".$table_pre."kh where ka<>'y' group by ".$zd1;
|
||||
$r1=$db->query($q1);
|
||||
$arr_data_hj_jj=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_data_hj_jj[$m1[$zd1]]=$m1["jj"];
|
||||
}
|
||||
//-----------计算rowspan
|
||||
$arr_rowspan_zd1=$arr_rowspan_zd2=array();
|
||||
$i1=0;
|
||||
foreach($arr_zd1 as $n1 => $t1){
|
||||
$xj1=0;
|
||||
foreach($arr_zd2 as $n2 => $t2){
|
||||
if($arr_data_xj_ks[$n1][$n2]>0){
|
||||
$xj1++;
|
||||
}
|
||||
}
|
||||
$arr_rowspan_zd1[$i1]=$xj1;
|
||||
$i1++;
|
||||
}
|
||||
//-----------输出报表
|
||||
$i1=$i2=0;
|
||||
foreach($arr_zd1 as $n1 => $t1){
|
||||
$var_hj_all_ks="hj_all_ks_".$n1;
|
||||
$var_hj_ks="hj_ks_".$n1;
|
||||
$var_hj_js="hj_js_".$n1;
|
||||
$var_hj_je="hj_je_".$n1;
|
||||
foreach($arr_zd2 as $n2 => $t2){
|
||||
$var_xj_all_ks="zj_all_ks_".$n1."_".$n2;
|
||||
$var_xj_ks="zj_ks_".$n1."_".$n2;
|
||||
$var_xj_js="zj_js_".$n1."_".$n2;
|
||||
$var_xj_je="zj_je_".$n1."_".$n2;
|
||||
if($arr_data_xj_ks[$n1][$n2]>0){
|
||||
$content_data.="<tr>";
|
||||
if($i2==count_arr_num_before($arr_rowspan_zd1,$i1)+$i1)
|
||||
$content_data.="<td align='center' rowspan='".$arr_rowspan_zd1[$i1]."'>".$t1."</td>";
|
||||
$content_data.="<td align='center'>".$t2."</td>";
|
||||
foreach($arr_zd3 as $n3 => $t3){
|
||||
$var_all_ks="all_ks_".$n1."_".$n3;
|
||||
$var_ks="ks_".$n1."_".$n3;
|
||||
$var_js="js_".$n1."_".$n3;
|
||||
$var_je="je_".$n1."_".$n3;
|
||||
//订货会款数
|
||||
$content_data.="<td align='center'>".deel_0($arr_data_all_ks[$n1][$n2][$n3])."</td>";
|
||||
//已订款数
|
||||
$content_data.="<td align='center'>".deel_0($arr_data_ks[$n1][$n2][$n3])."</td>";
|
||||
//款数占比
|
||||
$content_data.="<td align='center'>".deel_bfb($arr_data_ks[$n1][$n2][$n3],$total_ks)."</td>";
|
||||
//已订件数
|
||||
$content_data.="<td align='center'>".deel_0($arr_data_js[$n1][$n2][$n3])."</td>";
|
||||
//件数占比
|
||||
$content_data.="<td align='center'>".deel_bfb($arr_data_js[$n1][$n2][$n3],$total_js)."</td>";
|
||||
//已订金额
|
||||
$content_data.="<td align='center'>".deel_0(deel_num($arr_data_je[$n1][$n2][$n3]))."</td>";
|
||||
//金额占比
|
||||
$content_data.="<td align='center'>".deel_bfb($arr_data_je[$n1][$n2][$n3],$total_money)."</td>";
|
||||
//均价
|
||||
$content_data.="<td align='center'>".keep_float($arr_data_jj[$n1][$n2][$n3],1)."</td>";
|
||||
$$var_all_ks+=$arr_data_all_ks[$n1][$n2][$n3];
|
||||
$$var_ks+=$arr_data_ks[$n1][$n2][$n3];
|
||||
$$var_js+=$arr_data_js[$n1][$n2][$n3];
|
||||
$$var_je+=$arr_data_je[$n1][$n2][$n3];
|
||||
//
|
||||
$$var_xj_all_ks+=$arr_data_all_ks[$n1][$n2][$n3];
|
||||
$$var_xj_ks+=$arr_data_ks[$n1][$n2][$n3];
|
||||
$$var_xj_js+=$arr_data_js[$n1][$n2][$n3];
|
||||
$$var_xj_je+=$arr_data_je[$n1][$n2][$n3];
|
||||
//
|
||||
$$var_hj_ks+=$arr_data_ks[$n1][$n2][$n3];
|
||||
$$var_hj_js+=$arr_data_js[$n1][$n2][$n3];
|
||||
$$var_hj_je+=$arr_data_je[$n1][$n2][$n3];
|
||||
$$var_hj_all_ks+=$arr_data_all_ks[$n1][$n2][$n3];
|
||||
}
|
||||
//------------整体
|
||||
//订货会款数
|
||||
$content_data.="<td align='center'>".deel_0($arr_data_xj_ks[$n1][$n2])."</td>";
|
||||
//已订款数
|
||||
$content_data.="<td align='center'>".deel_0($$var_xj_ks)."</td>";
|
||||
//款数占比
|
||||
$content_data.="<td align='center'>".deel_bfb($$var_xj_ks,$total_ks)."</td>";
|
||||
//已订件数
|
||||
$content_data.="<td align='center'>".deel_0($$var_xj_js)."</td>";
|
||||
//件数占比
|
||||
$content_data.="<td align='center'>".deel_bfb($$var_xj_js,$total_js)."</td>";
|
||||
//已订金额
|
||||
$content_data.="<td align='center'>".deel_0(deel_num($$var_xj_je))."</td>";
|
||||
//金额占比
|
||||
$content_data.="<td align='center'>".deel_bfb($$var_xj_je,$total_money)."</td>";
|
||||
//均价
|
||||
$content_data.="<td align='center'>".keep_float($arr_data_xj_jj[$n1][$n2],1)."</td>";
|
||||
$content_data.="</tr>";
|
||||
$i2++;
|
||||
}
|
||||
}
|
||||
if($arr_data_xj_ks1[$n1]>0){
|
||||
//---------------zd1合计
|
||||
$content_data.="<tr><td align='center' colspan='2'><b>".$t1."合计</b></td>";
|
||||
foreach($arr_zd3 as $n3 => $t3){
|
||||
$var_all_ks="all_ks_".$n1."_".$n3;
|
||||
$var_ks="ks_".$n1."_".$n3;
|
||||
$var_js="js_".$n1."_".$n3;
|
||||
$var_je="je_".$n1."_".$n3;
|
||||
//订货会款数
|
||||
$content_data.="<td align='center'>".deel_0($$var_all_ks)."</td>";
|
||||
//已订款数
|
||||
$content_data.="<td align='center'>".deel_0($$var_ks)."</td>";
|
||||
//款数占比
|
||||
$content_data.="<td align='center'>".deel_bfb($$var_ks,$total_ks)."</td>";
|
||||
//已订件数
|
||||
$content_data.="<td align='center'>".deel_0($$var_js)."</td>";
|
||||
//件数占比
|
||||
$content_data.="<td align='center'>".deel_bfb($$var_js,$total_js)."</td>";
|
||||
//已订金额
|
||||
$content_data.="<td align='center'>".deel_0(deel_num($$var_je))."</td>";
|
||||
//金额占比
|
||||
$content_data.="<td align='center'>".deel_bfb($$var_je,$total_money)."</td>";
|
||||
//均价
|
||||
$content_data.="<td align='center'>".keep_float($arr_data_zt_jj[$n1][$n3],1)."</td>";
|
||||
}
|
||||
//------------整体
|
||||
//订货会款数
|
||||
$content_data.="<td align='center'>".deel_0($$var_hj_all_ks)."</td>";
|
||||
//已订款数
|
||||
$content_data.="<td align='center'>".deel_0($$var_hj_ks)."</td>";
|
||||
//款数占比
|
||||
$content_data.="<td align='center'>".deel_bfb($$var_hj_ks,$total_ks)."</td>";
|
||||
//已订件数
|
||||
$content_data.="<td align='center'>".deel_0($$var_hj_js)."</td>";
|
||||
//件数占比
|
||||
$content_data.="<td align='center'>".deel_bfb($$var_hj_js,$total_js)."</td>";
|
||||
//已订金额
|
||||
$content_data.="<td align='center'>".deel_0(deel_num($$var_hj_je))."</td>";
|
||||
//金额占比
|
||||
$content_data.="<td align='center'>".deel_bfb($$var_hj_je,$total_money)."</td>";
|
||||
//均价
|
||||
$content_data.="<td align='center'>".keep_float($arr_data_hj_jj[$n1],1)."</td>";
|
||||
$content_data.="</tr>";
|
||||
$i2++;
|
||||
}
|
||||
$i1++;
|
||||
}
|
||||
$content_data.="</tbody></table>";
|
||||
$json_data.="\"table_html\":\"".$content_data."\",";
|
||||
?>
|
||||
@@ -0,0 +1,287 @@
|
||||
<?php
|
||||
//4维订货分析
|
||||
//可配置参数:zd1|sxz|横向维度1,zd2|bc|横向维度2,zd3|category|横向维度3,zd4|brand|纵向维度
|
||||
//2018-12-11 by hehe
|
||||
//-----参数配置
|
||||
//横向维度
|
||||
$zd1=get_plugin_set("zd1","sxz");
|
||||
$zd2=get_plugin_set("zd2","bc");
|
||||
$zd3=get_plugin_set("zd3","category");
|
||||
//纵向维度
|
||||
$zd4=get_plugin_set("zd4","brand");
|
||||
//
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
//
|
||||
//店铺查询条件
|
||||
$con="";
|
||||
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{
|
||||
//代理角色所有客户
|
||||
$con=" and (upath='".$msg_client["path"]."-".$msg_client["id"]."' or upath like '".$msg_client["path"]."-".$msg_client["id"]."-%')";
|
||||
}
|
||||
}
|
||||
$total_js=$msg_client["order_num"];
|
||||
$total_money=$msg_client["order_money"];
|
||||
for($i=1;$i<5;$i++){
|
||||
$v="zd".$i;
|
||||
$v1="zd_title".$i;
|
||||
$v2="arr_zd".$i;
|
||||
//取得对应字段的名称
|
||||
$$v1=get_cate_title_no("arr_select",$$v);
|
||||
//取得字段的选项值
|
||||
$q1="select no,title from ".$table_pre."keyword where cate='".$$v."' order by no";
|
||||
$r1=$db->query($q1);
|
||||
$arr_tmp=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_tmp[$m1["no"]]=$m1["title"];
|
||||
}
|
||||
$$v2=$arr_tmp;
|
||||
}
|
||||
$content_data="<table border='0' cellspacing='1' cellpadding='4' class='layui-table'><thead>";
|
||||
//表头第一行
|
||||
$content_data.="<tr><th align='center' rowspan='2'><strong>".$zd_title1."</strong></th><th align='center' rowspan='2'><strong>".$zd_title2."</strong></th><th align='center' rowspan='2'><strong>".$zd_title3."</strong></th>";
|
||||
foreach($arr_zd4 as $n1 => $t1){
|
||||
$content_data.="<th align='center' colspan='8'><strong>".$t1."</strong></th>";
|
||||
}
|
||||
$content_data.="<th align='center' colspan='8'><strong>总计</strong></th>";
|
||||
$content_data.="</tr>";
|
||||
//表头第二行
|
||||
$arr_zd5=array(1=>"订货会款量",2=>"订货款量",3=>"款占比",4=>"订量",5=>"订量占比",6=>"订货额",7=>"订额占比",8=>"均价");
|
||||
$content_data.="<tr>";
|
||||
foreach($arr_zd4 as $n1 => $t1){
|
||||
foreach($arr_zd5 as $n2 => $t2){
|
||||
$content_data.="<th align='center' width='30'><strong>".$t2."</strong></th>";
|
||||
}
|
||||
}
|
||||
foreach($arr_zd5 as $n2 => $t2){
|
||||
$content_data.="<th align='center' width='30'><strong>".$t2."</strong></th>";
|
||||
}
|
||||
$content_data.="</tr></thead>";
|
||||
//
|
||||
$content_data.="<tbody>";
|
||||
//-----------取得报表数据
|
||||
$total_js=$msg_login["order_num"];
|
||||
$total_je=$msg_login["order_money"];
|
||||
$c1=get_db_msg("select count(distinct no) 'ks' from ".$table_pre."order where _key='".$s_key."'".$con."");
|
||||
$total_ks=$c1["ks"];
|
||||
//订货款数,件数,金额
|
||||
$q1="select ".$zd1.",".$zd2.",".$zd3.",".$zd4.",count(distinct no) 'ks',sum(num) 'js',sum(je) 'je' from ".$table_pre."order where _key='".$s_key."'".$con." group by ".$zd1.",".$zd2.",".$zd3.",".$zd4;
|
||||
$r1=$db->query($q1);
|
||||
$arr_data_ks=$arr_data_js=$arr_data_je=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_data_ks[$m1[$zd1]][$m1[$zd2]][$m1[$zd3]][$m1[$zd4]]=$m1["ks"];
|
||||
$arr_data_js[$m1[$zd1]][$m1[$zd2]][$m1[$zd3]][$m1[$zd4]]=$m1["js"];
|
||||
$arr_data_je[$m1[$zd1]][$m1[$zd2]][$m1[$zd3]][$m1[$zd4]]=$m1["je"];
|
||||
}
|
||||
//订货会款数
|
||||
$q1="select ".$zd1.",".$zd2.",".$zd3.",".$zd4.",count(*) 'ks' from ".$table_pre."kh where ka<>'y' group by ".$zd1.",".$zd2.",".$zd3.",".$zd4;
|
||||
$r1=$db->query($q1);
|
||||
$arr_data_all_ks=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_data_all_ks[$m1[$zd1]][$m1[$zd2]][$m1[$zd3]][$m1[$zd4]]=$m1["ks"];
|
||||
}
|
||||
//小计款数
|
||||
$q1="select ".$zd1.",".$zd2.",".$zd3.",count(*) 'ks' from ".$table_pre."kh where ka<>'y' group by ".$zd1.",".$zd2.",".$zd3;
|
||||
$r1=$db->query($q1);
|
||||
$arr_data_xj_ks=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_data_xj_ks[$m1[$zd1]][$m1[$zd2]][$m1[$zd3]]=$m1["ks"];
|
||||
}
|
||||
//小计款数1
|
||||
$q1="select ".$zd1.",".$zd2.",count(*) 'ks' from ".$table_pre."kh where ka<>'y' group by ".$zd1.",".$zd2;
|
||||
$r1=$db->query($q1);
|
||||
$arr_data_xj_ks1=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_data_xj_ks1[$m1[$zd1]][$m1[$zd2]]=$m1["ks"];
|
||||
}
|
||||
//均价
|
||||
$q1="select ".$zd1.",".$zd2.",".$zd3.",".$zd4.",sum(price)/count(*) 'jj' from ".$table_pre."kh where ka<>'y' group by ".$zd1.",".$zd2.",".$zd3.",".$zd4;
|
||||
$r1=$db->query($q1);
|
||||
$arr_data_jj=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_data_jj[$m1[$zd1]][$m1[$zd2]][$m1[$zd3]][$m1[$zd4]]=$m1["jj"];
|
||||
}
|
||||
//小计均价
|
||||
$q1="select ".$zd1.",".$zd2.",".$zd3.",sum(price)/count(*) 'jj' from ".$table_pre."kh where ka<>'y' group by ".$zd1.",".$zd2.",".$zd3;
|
||||
$r1=$db->query($q1);
|
||||
$arr_data_xj_jj=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_data_xj_jj[$m1[$zd1]][$m1[$zd2]][$m1[$zd3]]=$m1["jj"];
|
||||
}
|
||||
//整体均价
|
||||
$q1="select ".$zd1.",".$zd2.",".$zd4.",sum(price)/count(*) 'jj' from ".$table_pre."kh where ka<>'y' group by ".$zd1.",".$zd2.",".$zd4;
|
||||
$r1=$db->query($q1);
|
||||
$arr_data_zt_jj=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_data_zt_jj[$m1[$zd1]][$m1[$zd2]][$m1[$zd4]]=$m1["jj"];
|
||||
}
|
||||
//合计均价
|
||||
$q1="select ".$zd1.",".$zd2.",sum(price)/count(*) 'jj' from ".$table_pre."kh where ka<>'y' group by ".$zd1.",".$zd2;
|
||||
$r1=$db->query($q1);
|
||||
$arr_data_hj_jj=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_data_hj_jj[$m1[$zd1]][$m1[$zd2]]=$m1["jj"];
|
||||
}
|
||||
//-----------计算rowspan
|
||||
$arr_rowspan_zd1=$arr_rowspan_zd2=array();
|
||||
$i1=$i2=0;
|
||||
foreach($arr_zd1 as $n1 => $t1){
|
||||
$xj1=0;
|
||||
foreach($arr_zd2 as $n2 => $t2){
|
||||
$xj2=0;
|
||||
foreach($arr_zd3 as $n3 => $t3){
|
||||
if($arr_data_xj_ks[$n1][$n2][$n3]>0){
|
||||
$xj1++;
|
||||
$xj2++;
|
||||
}
|
||||
}
|
||||
$arr_rowspan_zd2[$i2]=$xj2;
|
||||
if($arr_data_xj_ks1[$n1][$n2]>0){
|
||||
$xj1++;
|
||||
$i2++;
|
||||
}
|
||||
}
|
||||
$arr_rowspan_zd1[$i1]=$xj1;
|
||||
$i1++;
|
||||
}
|
||||
//-----------输出报表
|
||||
$i1=$i2=$i3=0;
|
||||
foreach($arr_zd1 as $n1 => $t1){
|
||||
foreach($arr_zd2 as $n2 => $t2){
|
||||
$var_hj_all_ks="hj_all_ks_".$n1."_".$n2;
|
||||
$var_hj_ks="hj_ks_".$n1."_".$n2;
|
||||
$var_hj_js="hj_js_".$n1."_".$n2;
|
||||
$var_hj_je="hj_je_".$n1."_".$n2;
|
||||
foreach($arr_zd3 as $n3 => $t3){
|
||||
$var_xj_ks="xj_ks_".$n1."_".$n2."_".$n3;
|
||||
$var_xj_js="xj_js_".$n1."_".$n2."_".$n3;
|
||||
$var_xj_je="xj_je_".$n1."_".$n2."_".$n3;
|
||||
if($arr_data_xj_ks[$n1][$n2][$n3]>0){
|
||||
$content_data.="<tr>";
|
||||
if($i3==count_arr_num_before($arr_rowspan_zd1,$i1))
|
||||
$content_data.="<td align='center' rowspan='".$arr_rowspan_zd1[$i1]."'>".$t1."</td>";
|
||||
if($i3==(count_arr_num_before($arr_rowspan_zd2,$i2)+$i2))
|
||||
$content_data.="<td align='center' rowspan='".$arr_rowspan_zd2[$i2]."'>".$t2."</td>";
|
||||
$content_data.="<td align='center'>".$t3."</td>";
|
||||
foreach($arr_zd4 as $n4 => $t4){
|
||||
$var_all_ks="all_ks_".$n1."_".$n2."_".$n4;
|
||||
$var_ks="ks_".$n1."_".$n2."_".$n4;
|
||||
$var_js="js_".$n1."_".$n2."_".$n4;
|
||||
$var_je="je_".$n1."_".$n2."_".$n4;
|
||||
//订货会款数
|
||||
$content_data.="<td align='center'>".deel_0($arr_data_all_ks[$n1][$n2][$n3][$n4])."</td>";
|
||||
//已订款数
|
||||
$content_data.="<td align='center'>".deel_0($arr_data_ks[$n1][$n2][$n3][$n4])."</td>";
|
||||
//款数占比
|
||||
$content_data.="<td align='center'>".deel_bfb($arr_data_ks[$n1][$n2][$n3][$n4],$total_ks)."</td>";
|
||||
//已订件数
|
||||
$content_data.="<td align='center'>".deel_0($arr_data_js[$n1][$n2][$n3][$n4])."</td>";
|
||||
//件数占比
|
||||
$content_data.="<td align='center'>".deel_bfb($arr_data_js[$n1][$n2][$n3][$n4],$total_js)."</td>";
|
||||
//已订金额
|
||||
$content_data.="<td align='center'>".deel_0(deel_num($arr_data_je[$n1][$n2][$n3][$n4]))."</td>";
|
||||
//金额占比
|
||||
$content_data.="<td align='center'>".deel_bfb($arr_data_je[$n1][$n2][$n3][$n4],$total_money)."</td>";
|
||||
//均价
|
||||
$content_data.="<td align='center'>".keep_float($arr_data_jj[$n1][$n2][$n3][$n4],1)."</td>";
|
||||
$$var_all_ks+=$arr_data_all_ks[$n1][$n2][$n3][$n4];
|
||||
$$var_ks+=$arr_data_ks[$n1][$n2][$n3][$n4];
|
||||
$$var_js+=$arr_data_js[$n1][$n2][$n3][$n4];
|
||||
$$var_je+=$arr_data_je[$n1][$n2][$n3][$n4];
|
||||
//
|
||||
$$var_xj_ks+=$arr_data_ks[$n1][$n2][$n3][$n4];
|
||||
$$var_xj_js+=$arr_data_js[$n1][$n2][$n3][$n4];
|
||||
$$var_xj_je+=$arr_data_je[$n1][$n2][$n3][$n4];
|
||||
//
|
||||
$$var_hj_ks+=$arr_data_ks[$n1][$n2][$n3][$n4];
|
||||
$$var_hj_js+=$arr_data_js[$n1][$n2][$n3][$n4];
|
||||
$$var_hj_je+=$arr_data_je[$n1][$n2][$n3][$n4];
|
||||
$$var_hj_all_ks+=$arr_data_all_ks[$n1][$n2][$n3][$n4];
|
||||
}
|
||||
//------------整体
|
||||
//订货会款数
|
||||
$content_data.="<td align='center'>".deel_0($arr_data_xj_ks[$n1][$n2][$n3])."</td>";
|
||||
//已订款数
|
||||
$content_data.="<td align='center'>".deel_0($$var_xj_ks)."</td>";
|
||||
//款数占比
|
||||
$content_data.="<td align='center'>".deel_bfb($$var_xj_ks,$total_ks)."</td>";
|
||||
//已订件数
|
||||
$content_data.="<td align='center'>".deel_0($$var_xj_js)."</td>";
|
||||
//件数占比
|
||||
$content_data.="<td align='center'>".deel_bfb($$var_xj_js,$total_js)."</td>";
|
||||
//已订金额
|
||||
$content_data.="<td align='center'>".deel_0(deel_num($$var_xj_je))."</td>";
|
||||
//金额占比
|
||||
$content_data.="<td align='center'>".deel_bfb($$var_xj_je,$total_money)."</td>";
|
||||
//均价
|
||||
$content_data.="<td align='center'>".keep_float($arr_data_xj_jj[$n1][$n2][$n3],1)."</td>";
|
||||
$content_data.="</tr>";
|
||||
$i3++;
|
||||
}
|
||||
}
|
||||
if($arr_data_xj_ks1[$n1][$n2]>0){
|
||||
//---------------zd2合计
|
||||
$content_data.="<tr><td align='center' colspan='2'><b>".$t2."合计</b></td>";
|
||||
foreach($arr_zd4 as $n4 => $t4){
|
||||
$var_all_ks="all_ks_".$n1."_".$n2."_".$n4;
|
||||
$var_ks="ks_".$n1."_".$n2."_".$n4;
|
||||
$var_js="js_".$n1."_".$n2."_".$n4;
|
||||
$var_je="je_".$n1."_".$n2."_".$n4;
|
||||
//订货会款数
|
||||
$content_data.="<td align='center'>".deel_0($$var_all_ks)."</td>";
|
||||
//已订款数
|
||||
$content_data.="<td align='center'>".deel_0($$var_ks)."</td>";
|
||||
//款数占比
|
||||
$content_data.="<td align='center'>".deel_bfb($$var_ks,$total_ks)."</td>";
|
||||
//已订件数
|
||||
$content_data.="<td align='center'>".deel_0($$var_js)."</td>";
|
||||
//件数占比
|
||||
$content_data.="<td align='center'>".deel_bfb($$var_js,$total_js)."</td>";
|
||||
//已订金额
|
||||
$content_data.="<td align='center'>".deel_0(deel_num($$var_je))."</td>";
|
||||
//金额占比
|
||||
$content_data.="<td align='center'>".deel_bfb($$var_je,$total_money)."</td>";
|
||||
//均价
|
||||
$content_data.="<td align='center'>".keep_float($arr_data_zt_jj[$n1][$n2][$n4],1)."</td>";
|
||||
}
|
||||
//------------整体
|
||||
//订货会款数
|
||||
$content_data.="<td align='center'>".deel_0($$var_hj_all_ks)."</td>";
|
||||
//已订款数
|
||||
$content_data.="<td align='center'>".deel_0($$var_hj_ks)."</td>";
|
||||
//款数占比
|
||||
$content_data.="<td align='center'>".deel_bfb($$var_hj_ks,$total_ks)."</td>";
|
||||
//已订件数
|
||||
$content_data.="<td align='center'>".deel_0($$var_hj_js)."</td>";
|
||||
//件数占比
|
||||
$content_data.="<td align='center'>".deel_bfb($$var_hj_js,$total_js)."</td>";
|
||||
//已订金额
|
||||
$content_data.="<td align='center'>".deel_0(deel_num($$var_hj_je))."</td>";
|
||||
//金额占比
|
||||
$content_data.="<td align='center'>".deel_bfb($$var_hj_je,$total_money)."</td>";
|
||||
//均价
|
||||
$content_data.="<td align='center'>".keep_float($arr_data_hj_jj[$n1][$n2],1)."</td>";
|
||||
$content_data.="</tr>";
|
||||
$i3++;
|
||||
$i2++;
|
||||
}
|
||||
}
|
||||
$i1++;
|
||||
}
|
||||
$content_data.="</tbody></table>";
|
||||
$json_data.="\"table_html\":\"".$content_data."\",";
|
||||
?>
|
||||
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
//件数、金额4维报表
|
||||
//可配置参数:zd1|sxz|横向维度1,zd2|category|横向维度2,zd3|brand|纵向维度1,zd4|theme|纵向维度2
|
||||
//2018-12-11 by hehe
|
||||
//-----参数配置
|
||||
//横向维度
|
||||
$zd1=get_plugin_set("zd1","sxz");
|
||||
$zd2=get_plugin_set("zd2","category");
|
||||
//纵向维度
|
||||
$zd3=get_plugin_set("zd3","brand");
|
||||
$zd4=get_plugin_set("zd4","theme");
|
||||
//
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
//店铺查询条件
|
||||
$con="";
|
||||
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{
|
||||
//代理角色所有客户
|
||||
$con=" and (upath='".$msg_client["path"]."-".$msg_client["id"]."' or upath like '".$msg_client["path"]."-".$msg_client["id"]."-%')";
|
||||
}
|
||||
}
|
||||
//
|
||||
for($i=1;$i<5;$i++){
|
||||
$v="zd".$i;
|
||||
$v1="zd_title".$i;
|
||||
$v2="arr_zd".$i;
|
||||
//取得对应字段的名称
|
||||
$$v1=get_cate_title_no("arr_select",$$v);
|
||||
//取得字段的选项值
|
||||
$q1="select no,title from ".$table_pre."keyword where cate='".$$v."' order by no";
|
||||
$r1=$db->query($q1);
|
||||
$arr_tmp=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_tmp[$m1["no"]]=$m1["title"];
|
||||
}
|
||||
$$v2=$arr_tmp;
|
||||
}
|
||||
$content_data="<table border='0' cellspacing='1' cellpadding='4' class='layui-table'><thead>";
|
||||
//表头第一行
|
||||
$content_data.="<tr><th align='center'> </th><th align='center'><strong>".$zd_title3."</strong></th>";
|
||||
foreach($arr_zd3 as $n1 => $t1){
|
||||
$content_data.="<th align='center' colspan='".(count($arr_zd4)*2)."'><strong>".$t1."</strong></th>";
|
||||
}
|
||||
$content_data.="<th align='center' colspan='2' rowspan='2'><strong>总计</strong></th>";
|
||||
$content_data.="</tr>";
|
||||
//表头第二行
|
||||
$content_data.="<tr><th align='center'> </th><th align='center'><strong>".$zd_title4."</strong></th>";
|
||||
foreach($arr_zd3 as $n1 => $t1){
|
||||
foreach($arr_zd4 as $n2 => $t2){
|
||||
$content_data.="<th align='center' colspan='2'><strong>".$t2."</strong></th>";
|
||||
}
|
||||
}
|
||||
$content_data.="</tr>";
|
||||
//表头第三行
|
||||
$content_data.="<tr><th align='center'>".$zd_title1."</th><th align='center'><strong>".$zd_title2."</strong></th>";
|
||||
$i=1;
|
||||
foreach($arr_zd3 as $n1 => $t1){
|
||||
foreach($arr_zd4 as $n2 => $t2){
|
||||
$content_data.="<th align='center'><strong>件数</strong></th><th align='center'><strong>金额</strong></th>";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$content_data.="<th align='center'><strong>件数</strong></th><th align='center'><strong>金额</strong></th>";
|
||||
$content_data.="</tr>";
|
||||
//
|
||||
$content_data.="</thead><tbody>";
|
||||
//-----------取得报表数据
|
||||
//订单数据
|
||||
$q1="select ".$zd1.",".$zd2.",".$zd3.",".$zd4.",sum(je) 'je',sum(num) 'js' from ".$table_pre."order where ka<>'y' ".$con." group by ".$zd1.",".$zd2.",".$zd3.",".$zd4;
|
||||
$r1=$db->query($q1);
|
||||
$arr_data=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_data_je[$m1[$zd1]][$m1[$zd2]][$m1[$zd3]][$m1[$zd4]]=$m1["je"];
|
||||
$arr_data_js[$m1[$zd1]][$m1[$zd2]][$m1[$zd3]][$m1[$zd4]]=$m1["js"];
|
||||
}
|
||||
//款号数据
|
||||
$q1="select ".$zd1.",".$zd2.",count(*) 'ks' from ".$table_pre."kh where ka<>'y' group by ".$zd1.",".$zd2;
|
||||
$r1=$db->query($q1);
|
||||
$arr_data1=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_data_ks[$m1[$zd1]][$m1[$zd2]]=$m1["ks"];
|
||||
}
|
||||
//-----------计算rowspan
|
||||
$arr_rowspan_zd1=$arr_rowspan_zd2=array();
|
||||
$i1=0;
|
||||
foreach($arr_zd1 as $n1 => $t1){
|
||||
$xj1=0;
|
||||
foreach($arr_zd2 as $n2 => $t2){
|
||||
if($arr_data_ks[$n1][$n2]>0)
|
||||
$xj1++;
|
||||
}
|
||||
$arr_rowspan_zd1[$i1]=$xj1;
|
||||
$i1++;
|
||||
}
|
||||
//-----------输出报表
|
||||
$i1=$i2=0;
|
||||
$total_js=$total_je=0;
|
||||
foreach($arr_zd1 as $n1 => $t1){
|
||||
foreach($arr_zd2 as $n2 => $t2){
|
||||
$var_hj_zd2="hj_".$n1."_".$n2;
|
||||
if($arr_data_ks[$n1][$n2]>0){
|
||||
$content_data.="<tr>";
|
||||
if($i2==count_arr_num_before($arr_rowspan_zd1,$i1))
|
||||
$content_data.="<td align='center' rowspan='".$arr_rowspan_zd1[$i1]."'>".$t1."</th>";
|
||||
$content_data.="<td align='center'>".$t2."</th>";
|
||||
foreach($arr_zd3 as $n3 => $t3){
|
||||
foreach($arr_zd4 as $n4 => $t4){
|
||||
$var1="hj_je_".$n3."_".$n4;
|
||||
$var2="hj_js_".$n3."_".$n4;
|
||||
$var3="xj_je_".$n1."_".$n2;
|
||||
$var4="xj_js_".$n1."_".$n2;
|
||||
$content_data.="<td align='center'>".deel_0($arr_data_js[$n1][$n2][$n3][$n4])."</th><td align='center'>".deel_num($arr_data_je[$n1][$n2][$n3][$n4])."</th>";
|
||||
$$var1+=$arr_data_je[$n1][$n2][$n3][$n4];
|
||||
$$var2+=$arr_data_js[$n1][$n2][$n3][$n4];
|
||||
$$var3+=$arr_data_je[$n1][$n2][$n3][$n4];
|
||||
$$var4+=$arr_data_js[$n1][$n2][$n3][$n4];
|
||||
$total_je+=$arr_data_je[$n1][$n2][$n3][$n4];
|
||||
$total_js+=$arr_data_js[$n1][$n2][$n3][$n4];
|
||||
}
|
||||
}
|
||||
//小计
|
||||
$var1="xj_je_".$n1."_".$n2;
|
||||
$var2="xj_js_".$n1."_".$n2;
|
||||
$content_data.="<td align='center'>".deel_0($$var2)."</th><td align='center'>".deel_0($$var1)."</th>";
|
||||
$content_data.="</tr>";
|
||||
}
|
||||
$i2++;
|
||||
}
|
||||
$i1++;
|
||||
}
|
||||
//---------------zd2合计
|
||||
$content_data.="<tr><td align='center' colspan='2'><b>合计</b></th>";
|
||||
foreach($arr_zd3 as $n3 => $t3){
|
||||
foreach($arr_zd4 as $n4 => $t4){
|
||||
$var1="hj_je_".$n3."_".$n4;
|
||||
$var2="hj_js_".$n3."_".$n4;
|
||||
$content_data.="<td align='center'>".deel_0($$var2)."</th><td align='center'>".deel_0($$var1)."</th>";
|
||||
}
|
||||
}
|
||||
//总计合计
|
||||
$content_data.="<td align='center'>".deel_0($total_js)."</th><td align='center'>".deel_0($total_je)."</th>";
|
||||
$content_data.="</tr>";
|
||||
$content_data.="</tbody></table>";
|
||||
$json_data.="\"table_html\":\"".$content_data."\",";
|
||||
?>
|
||||
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
//自定义1维报表
|
||||
//可配置参数:keyword_zd1|category|横向纬度,keyword_zd2|brand|筛选项,icon|menu_icon_table|菜单图标
|
||||
//2019-12-23 by hehe
|
||||
//-----参数配置
|
||||
//菜单图标
|
||||
$icon=get_plugin_set("icon","menu_icon_table");//支持以下目录的图标ipad/images/menu_icon_*.png
|
||||
//横向纬度
|
||||
$zd1=get_plugin_set("keyword_zd1","category");
|
||||
//筛选项
|
||||
$zd2=get_plugin_set("keyword_zd2","brand");
|
||||
//
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
//店铺查询条件
|
||||
$con=" ka<>'y'";
|
||||
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{
|
||||
//代理角色所有客户
|
||||
$con=" and (upath='".$msg_client["path"]."-".$msg_client["id"]."' or upath like '".$msg_client["path"]."-".$msg_client["id"]."-%')";
|
||||
}
|
||||
}
|
||||
//----选项
|
||||
if($zd2){
|
||||
$zd_title2=get_cate_title_no("arr_select",$zd2);
|
||||
$var="s_".$zd2;
|
||||
$q="select * from ".$table_pre."keyword where cate='".$zd2."' order by no";
|
||||
$r=$db->query($q);
|
||||
$op="";
|
||||
while($m=$db->fetch_array($r)){
|
||||
$op.="{\"no\":\"".$m["no"]."\",\"title\":\"".$m["title"]."\"},";
|
||||
}
|
||||
$select="{\"name\":\"s_".$zd2."\",\"title\":\"".$zd_title2."\",\"value\":\"".$$var."\",\"op\":[".deel_end($op)."]},";
|
||||
}
|
||||
if($zd1){
|
||||
$zd_title1=get_cate_title_no("arr_select",$zd1);
|
||||
$con_kh=" and ka<>'y'";
|
||||
$var="s_".$zd2;
|
||||
if($$var){
|
||||
$con_kh.=" and ".$zd2."='".$$var."'";
|
||||
$con.=" and ".$zd2."='".$$var."'";
|
||||
}
|
||||
$content_data.="<table id='tabledetail' class='cell-border nowrap' width='100%' lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' class='layui-table'><thead>";
|
||||
//表头第一行
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<th align='center' rowspan='2'><strong>".$zd_title1."</strong></th>";
|
||||
$content_data.="<th align='center' rowspan='2'><strong>均价</strong></th>";
|
||||
$content_data.="<th align='center' colspan='2'><strong>设计款数</strong></th>";
|
||||
$content_data.="<th align='center' colspan='2'><strong>已订款数</strong></th>";
|
||||
$content_data.="<th align='center' colspan='2'><strong>已订件数</strong></th>";
|
||||
$content_data.="<th align='center' colspan='2'><strong>吊牌金额</strong></th>";
|
||||
$content_data.="<th align='center' colspan='2'><strong>结算金额</strong></th>";
|
||||
$content_data.="</tr>";
|
||||
//表头第二行
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<th align='center'><strong>款数</strong></th><th align='center'><strong>占比</strong></th><th align='center'><strong>款数</strong></th><th align='center'><strong>占比</strong></th><th align='center'><strong>件数</strong></th><th align='center'><strong>占比</strong></th><th align='center'><strong>金额</strong></th><th align='center'><strong>占比</strong></th><th align='center'><strong>金额</strong></th><th align='center'><strong>占比</strong></th>";
|
||||
$content_data.="</tr>";
|
||||
$content_data.="</thead>";
|
||||
//取得总款数
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ".$zd1."<>''".$con_kh);
|
||||
$total_ks=$tmp["num"];
|
||||
//取得总款色数
|
||||
$total_sku=0;
|
||||
$q2="select no,color,color_ka from ".$table_pre."kh where ".$zd1."<>''".$con_kh;
|
||||
$r2=$db->query($q2);
|
||||
while($m2=$db->fetch_array($r2)){
|
||||
$arr1=explode(",",$m2["color"]);
|
||||
$arr2=explode(",",$m2["color_ka"]);
|
||||
for($i1=0;$i1<count($arr1);$i1++){
|
||||
if(!in_array($arr1[$i1],$arr2))
|
||||
$total_sku++;
|
||||
}
|
||||
}
|
||||
//取得总均价
|
||||
$tmp=get_db_msg("select sum(price)/count(*) 'jj' from ".$table_pre."kh where ".$zd1."<>''".$con_kh);
|
||||
$price_jj=keep_float($tmp["jj"],1);
|
||||
//取得已订总件数和金额
|
||||
$q="select sum(num) 'num',sum(je) 'je',sum(jsje) 'jsje' from ".$table_pre."order where ".$zd1."<>'' ".$con;
|
||||
$tmp=get_db_msg($q);
|
||||
$total_yd_js=$tmp["num"];
|
||||
$total_yd_je=$tmp["je"];
|
||||
$total_yd_jsje=$tmp["jsje"];
|
||||
//取得已订总款数
|
||||
$tmp1=get_db_msg("select count(distinct no) 'num' from ".$table_pre."order where ".$zd1."<>'' ".$con);
|
||||
$total_yd_ks=$tmp1["num"];
|
||||
//取得已订总款色数
|
||||
$tmp1=get_db_msg("select count(distinct no,color) 'num' from ".$table_pre."order where ".$zd1."<>'' ".$con);
|
||||
$total_yd_sku=$tmp1["num"];
|
||||
//
|
||||
$tb_data_x="";
|
||||
$tb_data_y=",";
|
||||
//
|
||||
$tbody_str="";
|
||||
$q="select * from ".$table_pre."keyword where cate='".$zd1."' order by no";
|
||||
$r=$db->query($q);
|
||||
$count=0;
|
||||
while($m=$db->fetch_array($r)){
|
||||
$list=$count+1;
|
||||
//------取得款数
|
||||
$tmp=get_db_msg("select count(distinct no) 'num' from ".$table_pre."order where ".$zd1."='".$m["no"]."'".$con);
|
||||
$tmp_yd_ks=$tmp["num"];
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ".$zd1."='".$m["no"]."'".$con_kh);
|
||||
$tmp_z_ks=$tmp["num"];
|
||||
//取得款色
|
||||
$tmp=get_db_msg("select count(distinct no,color) 'num' from ".$table_pre."order where ".$zd1."='".$m["no"]."'".$con);
|
||||
$tmp_yd_sku=$tmp["num"];
|
||||
$tmp_z_sku=0;
|
||||
$q2="select no,color,color_ka from ".$table_pre."kh where ".$zd1."='".$m["no"]."'".$con_kh;
|
||||
$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',sum(jsje) 'jsje' from ".$table_pre."order where id>0 and ".$zd1."='".$m["no"]."'".$con);
|
||||
$tmp_yd_js=$tmp["num"];
|
||||
$tmp_yd_je=$tmp["je"];
|
||||
$tmp_yd_jsje=$tmp["jsje"];
|
||||
if($tmp_z_ks>0){
|
||||
//取得均价
|
||||
$tmp=get_db_msg("select sum(price)/count(*) 'jj' from ".$table_pre."kh where ".$zd1."='".$m["no"]."'".$con_kh);
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<td align='center'>".$m["title"]."</td>";
|
||||
$content_data.="<td align='center'>".keep_float($tmp["jj"],1)."</td>";//均价
|
||||
$content_data.="<td align='center'>".$tmp_z_ks."</td>";//设计款数
|
||||
$content_data.="<td align='center'>".deel_bfb($tmp_z_ks,$total_ks)."</td>";//设计款数占比
|
||||
$content_data.="<td align='center'>".$tmp_yd_ks."</td>";//已订款数
|
||||
$content_data.="<td align='center'>".deel_bfb($tmp_yd_ks,$total_yd_ks)."</td>";//已订款数占比
|
||||
$content_data.="<td align='center'>".$tmp_yd_js."</td>";//已订件数
|
||||
$content_data.="<td align='center'>".deel_bfb($tmp_yd_js,$total_yd_js)."</td>";//已订件数占比
|
||||
$content_data.="<td align='center'>".deel_num($tmp_yd_je)."</td>";//吊牌金额
|
||||
$content_data.="<td align='center'>".deel_bfb($tmp_yd_je,$total_yd_je)."</td>";//吊牌金额占比
|
||||
$content_data.="<td align='center'>".deel_num($tmp_yd_jsje)."</td>";//结算金额
|
||||
$content_data.="<td align='center'>".deel_bfb($tmp_yd_jsje,$total_yd_jsje)."</td>";//结算金额占比
|
||||
$content_data.="</tr>";
|
||||
|
||||
$count++;
|
||||
//
|
||||
$tb_data_x.=$m["title"].",";
|
||||
$tb_data_y.=str_replace("%","",deel_bfb($tmp_yd_js,$total_yd_js)).",";
|
||||
}
|
||||
}
|
||||
//合计
|
||||
$content_data.="<tr bgcolor='#f0f0f0'>";
|
||||
$content_data.="<td align='center'>合计</td>";//均价
|
||||
$content_data.="<td align='center'>".$price_jj."</td>";//均价
|
||||
$content_data.="<td align='center'>".$total_ks."</td>";//设计款数
|
||||
$content_data.="<td align='center'> </td>";//设计款数占比
|
||||
$content_data.="<td align='center'>".$total_yd_ks."</td>";//已订款数
|
||||
$content_data.="<td align='center'> </td>";//已订款数占比
|
||||
$content_data.="<td align='center'>".$total_yd_js."</td>";//已订件数
|
||||
$content_data.="<td align='center'> </td>";//已订件数占比
|
||||
$content_data.="<td align='center'>".deel_num($total_yd_je)."</td>";//吊牌金额
|
||||
$content_data.="<td align='center'> </td>";//吊牌金额占比
|
||||
$content_data.="<td align='center'>".deel_num($total_yd_jsje)."</td>";//结算金额
|
||||
$content_data.="<td align='center'> </td>";//结算金额占比
|
||||
$content_data.="</tr>";
|
||||
//图
|
||||
$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."\",";
|
||||
*/
|
||||
$content_data.="</tbody>";
|
||||
$content_data.="</table>";
|
||||
$content_data1="<table width='100%' cellspacing='0' cellpadding='0' border='0'>";
|
||||
$content_data1.="<tr><td><iframe id='frame_chart' src='chart.php?t=pie&data_x=".$tb_data_x."&data_y=".$tb_data_y."&title=' width='100%' style='height:400px;position:static;'></iframe></td></tr>";
|
||||
$content_data1.="<tr><td>".$content_data."</td></tr>";
|
||||
$content_data1.="</table>";
|
||||
$json_data.="\"table_html\":\"".$content_data1."\",";
|
||||
}else{
|
||||
$json_data.="\"table_html\":\"请定义字段值!\",";
|
||||
}
|
||||
//echo $con."<br>";
|
||||
//echo $con_kh."<Br>";
|
||||
?>
|
||||
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
//款数5维报表
|
||||
//可配置参数:zd1|bc|横向维度1,zd2|sxz|横向维度2,zd3|category|横向维度3,zd4|brand|纵向维度1,zd5|theme|纵向维度2,tjs|ks|支持ks(款数)js(件数)je(金额)
|
||||
//2018-12-11 by hehe
|
||||
//-----参数配置
|
||||
//横向维度
|
||||
$zd1=get_plugin_set("zd1","bc");
|
||||
$zd2=get_plugin_set("zd2","sxz");
|
||||
$zd3=get_plugin_set("zd3","category");
|
||||
//纵向维度
|
||||
$zd4=get_plugin_set("zd4","brand");
|
||||
$zd5=get_plugin_set("zd5","theme");
|
||||
$tjs=get_plugin_set("tjs","ks");
|
||||
//
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
//店铺查询条件
|
||||
$con="";
|
||||
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{
|
||||
//代理角色所有客户
|
||||
$con=" and (upath='".$msg_client["path"]."-".$msg_client["id"]."' or upath like '".$msg_client["path"]."-".$msg_client["id"]."-%')";
|
||||
}
|
||||
}
|
||||
//
|
||||
for($i=1;$i<6;$i++){
|
||||
$v="zd".$i;
|
||||
$v1="zd_title".$i;
|
||||
$v2="arr_zd".$i;
|
||||
//取得对应字段的名称
|
||||
$$v1=get_cate_title_no("arr_select",$$v);
|
||||
//取得字段的选项值
|
||||
$q1="select no,title from ".$table_pre."keyword where cate='".$$v."' order by no";
|
||||
$r1=$db->query($q1);
|
||||
$arr_tmp=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_tmp[$m1["no"]]=$m1["title"];
|
||||
}
|
||||
$$v2=$arr_tmp;
|
||||
}
|
||||
$content_data="<table border='0' cellspacing='1' cellpadding='4' class='layui-table'><thead>";
|
||||
//表头第一行
|
||||
$content_data.="<tr><th align='center' rowspan='2'><strong>".$zd_title1."</strong></th><th align='center' rowspan='2'><strong>".$zd_title2."</strong></th><th align='center' rowspan='2'><strong>".$zd_title3."</strong></th><th align='center' rowspan='2'><strong>参与订货<br>款量</strong></th>";
|
||||
foreach($arr_zd4 as $n1 => $t1){
|
||||
$content_data.="<th align='center' colspan='".count($arr_zd5)."'><strong>".$t1.$zd_title5."</strong></th>";
|
||||
}
|
||||
$content_data.="<th align='center' colspan='".count($arr_zd5)."'><strong>整体".$zd_title5."</strong></th>";
|
||||
$content_data.="</tr>";
|
||||
//表头第二行
|
||||
$content_data.="<tr>";
|
||||
foreach($arr_zd4 as $n1 => $t1){
|
||||
foreach($arr_zd5 as $n2 => $t2){
|
||||
$content_data.="<th align='center' width='50'><strong>".$t2."</strong></th>";
|
||||
}
|
||||
}
|
||||
foreach($arr_zd5 as $n2 => $t2){
|
||||
$content_data.="<th align='center' width='50'><strong>".$t2."</strong></th>";
|
||||
}
|
||||
$content_data.="</tr></thead>";
|
||||
//
|
||||
$content_data.="<tbody>";
|
||||
//-----------取得报表数据
|
||||
if($tjs=="ks"){
|
||||
$str1="count(distinct no)";
|
||||
}else if($tjs=="je"){
|
||||
$str1="sum(jsje)";
|
||||
}else{
|
||||
$str1="sum(num)";
|
||||
}
|
||||
//订单数据
|
||||
$q1="select ".$zd1.",".$zd2.",".$zd3.",".$zd4.",".$zd5.",".$str1." 'ks' from ".$table_pre."order where ka<>'y' ".$con." group by ".$zd1.",".$zd2.",".$zd3.",".$zd4.",".$zd5;
|
||||
$r1=$db->query($q1);
|
||||
$arr_data=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_data[$m1[$zd1]][$m1[$zd2]][$m1[$zd3]][$m1[$zd4]][$m1[$zd5]]=$m1["ks"];
|
||||
}
|
||||
//款号数据
|
||||
$q1="select ".$zd1.",".$zd2.",".$zd3.",count(*) 'ks' from ".$table_pre."kh where ka<>'y' group by ".$zd1.",".$zd2.",".$zd3;
|
||||
$r1=$db->query($q1);
|
||||
$arr_data1=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_data1[$m1[$zd1]][$m1[$zd2]][$m1[$zd3]]=$m1["ks"];
|
||||
}
|
||||
//-----------计算rowspan
|
||||
$arr_rowspan_zd1=$arr_rowspan_zd2=array();
|
||||
$i1=$i2=0;
|
||||
foreach($arr_zd1 as $n1 => $t1){
|
||||
$xj1=0;
|
||||
foreach($arr_zd2 as $n2 => $t2){
|
||||
$xj2=0;
|
||||
foreach($arr_zd3 as $n3 => $t3){
|
||||
if($arr_data1[$n1][$n2][$n3]>0){
|
||||
$xj1++;
|
||||
$xj2++;
|
||||
}
|
||||
}
|
||||
$arr_rowspan_zd2[$i2]=$xj2;
|
||||
$xj1++;
|
||||
$i2++;
|
||||
}
|
||||
$arr_rowspan_zd1[$i1]=$xj1;
|
||||
$i1++;
|
||||
}
|
||||
//-----------输出报表
|
||||
$i1=$i2=$i3=0;
|
||||
foreach($arr_zd1 as $n1 => $t1){
|
||||
foreach($arr_zd2 as $n2 => $t2){
|
||||
$var_hj_zd2="hj_".$n1."_".$n2;
|
||||
foreach($arr_zd3 as $n3 => $t3){
|
||||
if($arr_data1[$n1][$n2][$n3]>0){
|
||||
$content_data.="<tr>";
|
||||
if($i3==count_arr_num_before($arr_rowspan_zd1,$i1))
|
||||
$content_data.="<td align='center' rowspan='".$arr_rowspan_zd1[$i1]."'>".$t1."</th>";
|
||||
if($i3==(count_arr_num_before($arr_rowspan_zd2,$i2)+$i2))
|
||||
$content_data.="<td align='center' rowspan='".$arr_rowspan_zd2[$i2]."'>".$t2."</th>";
|
||||
$content_data.="<td align='center'>".$t3."</th>";
|
||||
//小计
|
||||
$content_data.="<td align='center'>".deel_num($arr_data1[$n1][$n2][$n3])."</th>";
|
||||
$$var_hj_zd2+=$arr_data1[$n1][$n2][$n3];
|
||||
foreach($arr_zd4 as $n4 => $t4){
|
||||
foreach($arr_zd5 as $n5 => $t5){
|
||||
$var1="zt_".$n1."_".$n2."_".$n3."_".$n5;
|
||||
$var2="zt_".$n1."_".$n2."_".$n5;
|
||||
$var3="zt1_".$n1."_".$n2."_".$n4."_".$n5;
|
||||
$content_data.="<td align='center'>".deel_num($arr_data[$n1][$n2][$n3][$n4][$n5])."</th>";
|
||||
$$var1+=$arr_data[$n1][$n2][$n3][$n4][$n5];
|
||||
$$var2+=$arr_data[$n1][$n2][$n3][$n4][$n5];
|
||||
$$var3+=$arr_data[$n1][$n2][$n3][$n4][$n5];
|
||||
}
|
||||
}
|
||||
//整体
|
||||
foreach($arr_zd5 as $n5 => $t5){
|
||||
$var1="zt_".$n1."_".$n2."_".$n3."_".$n5;
|
||||
$content_data.="<td align='center'>".deel_num($$var1)."</th>";
|
||||
}
|
||||
$content_data.="</tr>";
|
||||
$i3++;
|
||||
}
|
||||
}
|
||||
//---------------zd2合计
|
||||
$content_data.="<tr><td align='center' colspan='2'><b>".$t2."合计</b></th>";
|
||||
//小计
|
||||
$content_data.="<td align='center'>".deel_num($$var_hj_zd2)."</th>";
|
||||
foreach($arr_zd4 as $n4 => $t4){
|
||||
foreach($arr_zd5 as $n5 => $t5){
|
||||
$var1="zt1_".$n1."_".$n2."_".$n4."_".$n5;
|
||||
$content_data.="<td align='center'>".deel_num($$var1)."</th>";
|
||||
}
|
||||
}
|
||||
//整体
|
||||
foreach($arr_zd5 as $n5 => $t5){
|
||||
$var1="zt_".$n1."_".$n2."_".$n5;
|
||||
$content_data.="<td align='center'>".deel_num($$var1)."</th>";
|
||||
}
|
||||
$content_data.="</tr>";
|
||||
$i3++;
|
||||
$i2++;
|
||||
}
|
||||
$i1++;
|
||||
}
|
||||
$content_data.="</tbody></table>";
|
||||
$json_data.="\"table_html\":\"".$content_data."\",";
|
||||
?>
|
||||
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
//1维历史数据分析
|
||||
//可配置参数:keyword_zd1|category|维度
|
||||
//2018-12-12 by hehe
|
||||
//------横向维度:zd1,zd2
|
||||
//-----参数配置
|
||||
//横向维度
|
||||
$zd1=get_plugin_set("keyword_zd1","category");
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
//其他条件
|
||||
//$con_other=" and brand='11'";
|
||||
//
|
||||
if(check_table_exist($table_pre."plugin_ls1")=="n"){
|
||||
//
|
||||
$code=0;
|
||||
$error_msg="请先导入历史数据!";
|
||||
}else{
|
||||
//店铺查询条件
|
||||
$con="";
|
||||
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{
|
||||
//代理角色所有客户
|
||||
$con=" and (upath='".$msg_client["path"]."-".$msg_client["id"]."' or upath like '".$msg_client["path"]."-".$msg_client["id"]."-%')";
|
||||
}
|
||||
}
|
||||
//
|
||||
$con_this=$con;
|
||||
for($i=1;$i<2;$i++){
|
||||
$v="zd".$i;
|
||||
$v1="zd_title".$i;
|
||||
$v2="arr_zd".$i;
|
||||
//取得对应字段的名称
|
||||
$$v1=get_cate_title_no("arr_select",$$v);
|
||||
//取得字段的选项值
|
||||
$q1="select no,title from ".$table_pre."keyword where cate='".$$v."' order by no";
|
||||
$r1=$db->query($q1);
|
||||
$arr_tmp=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_tmp[$m1["no"]]=$m1["title"];
|
||||
}
|
||||
$$v2=$arr_tmp;
|
||||
}
|
||||
$content_data.="<table border='0' cellspacing='1' cellpadding='4' class='layui-table'><thead>";
|
||||
//第一行
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<th align='center' rowspan='2'><strong>".$zd_title1."</strong></th><th align='center' colspan='3'><strong>往年销售</strong></th><th align='center' colspan='4'><strong>实际订单</strong></th><th align='center' colspan='3'><strong>差异</strong></th>";
|
||||
$content_data.="</tr>";
|
||||
$content_data.="<tr><th align='center'><strong>销售款数</strong></th><th align='center'><strong>销售件数</strong></th><th align='center'><strong>销售金额</strong></th><th align='center'><strong>订单款数</strong></th><th align='center'><strong>订单件数</strong></th><th align='center'><strong>订单金额</strong></th><th align='center'><strong>金额占%</strong></th><th align='center'><strong>款数差异</strong></th><th align='center'><strong>件数差异</strong></th><th align='center'><strong>金额差异</strong></th>";
|
||||
$content_data.="</tr>";
|
||||
$content_data.="</thead>";
|
||||
//-----------取得报表数据
|
||||
$total_yd_je=$total_yd_js=$total_yd_ks=0;
|
||||
//订单表数据
|
||||
$q3="select ".$zd1.",count(distinct iid) 'ks',sum(num) 'js',sum(jsje) 'je' from ".$table_pre."order where ka<>'y'".$con_other.$con_this." group by ".$zd1;
|
||||
$r3=$db->query($q3);
|
||||
$arr_data_je=$arr_data_js=$arr_data_ks=array();
|
||||
while($m3=$db->fetch_array($r3)){
|
||||
$arr_data_je[$m3[$zd1]]=deel_num($m3["je"]);
|
||||
$arr_data_js[$m3[$zd1]]=$m3["js"];
|
||||
$arr_data_ks[$m3[$zd1]]=$m3["ks"];
|
||||
$total_yd_je+=$m3["je"];
|
||||
$total_yd_js+=$m3["js"];
|
||||
$total_yd_ks+=$m3["ks"];
|
||||
}
|
||||
//sku
|
||||
$q3="select ".$zd1.",color,color_ka from ".$table_pre."kh where ka<>'y'";
|
||||
$r3=$db->query($q3);
|
||||
$arr_data_sku=array();
|
||||
while($m3=$db->fetch_array($r3)){
|
||||
if(trim($m3["color_ka"]))
|
||||
$num1=count(explode(",",$m3["color_ka"]));
|
||||
else
|
||||
$num1=0;
|
||||
$arr_data_sku[$m3[$zd1]]+=count(explode(",",$m3["color"]))-$num1;
|
||||
}
|
||||
//总历史数据
|
||||
$tmp=get_db_msg("select sum(js) 'js',sum(je) 'je',sum(ks) 'ks' from ".$table_pre."plugin_ls1 where c1<>''".$con_this);
|
||||
$total_ls_je=$tmp["je"];
|
||||
$total_ls_js=$tmp["js"];
|
||||
$total_ls_ks=$tmp["ks"];
|
||||
//--------------------输出报表-----------------------------------------------
|
||||
$content_data.="<tbody>";
|
||||
foreach($arr_zd1 as $key1=>$value1){
|
||||
//取得指标数据
|
||||
$m_ls=get_db_msg("select sum(js) 'js',sum(je) 'je',sum(ks) 'ks' from ".$table_pre."plugin_ls1 where c1='".$value1."'".$con_this);
|
||||
if($arr_data_sku[$key1]>0){
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<td align='center'>".$value1."</td><td align='center'>".deel_0($m_ls["ks"])."</td><td align='center'>".deel_0($m_ls["js"])."</td><td align='center'>".deel_0($m_ls["je"])."</td><td align='center'>".deel_0($arr_data_ks[$key1])."</td><td align='center'>".deel_0($arr_data_js[$key1])."</td><td align='center'>".deel_0($arr_data_je[$key1])."</td><td align='center'>".deel_bfb($arr_data_je[$key1],$total_yd_je)."</td><td align='center'>".deel_0($m_ls["ks"]-$arr_data_ks[$key1])."</td><td align='center'>".deel_0($m_ls["js"]-$arr_data_js[$key1])."</td><td align='center'>".deel_0($m_ls["je"]-$arr_data_je[$key1])."</td>";
|
||||
$total_1+=$m_ls["ks"];
|
||||
$total_2+=$m_ls["js"];
|
||||
$total_3+=$m_ls["je"];
|
||||
$total_4+=$arr_data_ks[$key1];
|
||||
$total_5+=$arr_data_js[$key1];
|
||||
$total_6+=$arr_data_je[$key1];
|
||||
$content_data.="</tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
$content_data.="<tr><td align='center'><b>合计</b></td><td align='center'><b>".deel_0($total_1)."</b></td><td align='center'><b>".deel_0($total_2)."</b></td><td align='center'><b>".deel_0($total_3)."</b></td><td align='center'><b>".deel_0($total_4)."</b></td><td align='center'><b>".deel_0($total_5)."</b></td><td align='center'><b>".deel_0($total_6)."</b></td><td align='center'><b>100%</b></td><td align='center'><b>".deel_0($total_1-$total_4)."</b></td><td align='center'><b>".deel_0($total_2-$total_5)."</b></td><td align='center'><b>".deel_0($total_3-$total_6)."</b></td></tr>";
|
||||
$content_data.="</tbody></table>";
|
||||
}
|
||||
$json_data.="\"table_html\":\"".$content_data."\",";
|
||||
?>
|
||||
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
//2维历史数据分析
|
||||
//可配置参数:zd1|bc|维度1,zd2|category|维度2
|
||||
//2018-12-04 by hehe
|
||||
//-----参数配置
|
||||
//横向维度
|
||||
$zd1=get_plugin_set("zd1","bc");
|
||||
$zd2=get_plugin_set("zd2","category");
|
||||
//
|
||||
$use_layui_datatable="y";//使用标准layui datatable格式数据
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
//其他条件
|
||||
//$con_other=" and brand='11'";
|
||||
//
|
||||
if(check_table_exist($table_pre."plugin_ls2")=="n"){
|
||||
//
|
||||
$code=0;
|
||||
$error_msg="请先导入历史数据!";
|
||||
}else{
|
||||
//店铺查询条件
|
||||
$con="";
|
||||
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{
|
||||
//代理角色所有客户
|
||||
$con=" and (upath='".$msg_client["path"]."-".$msg_client["id"]."' or upath like '".$msg_client["path"]."-".$msg_client["id"]."-%')";
|
||||
}
|
||||
}
|
||||
//
|
||||
$con_this=$con;
|
||||
for($i=1;$i<3;$i++){
|
||||
$v="zd".$i;
|
||||
$v1="zd_title".$i;
|
||||
$v2="arr_zd".$i;
|
||||
//取得对应字段的名称
|
||||
$$v1=get_cate_title_no("arr_select",$$v);
|
||||
//取得字段的选项值
|
||||
$q1="select no,title from ".$table_pre."keyword where cate='".$$v."' order by no";
|
||||
$r1=$db->query($q1);
|
||||
$arr_tmp=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_tmp[$m1["no"]]=$m1["title"];
|
||||
}
|
||||
$$v2=$arr_tmp;
|
||||
}
|
||||
//--------------------------------表头
|
||||
//支持参数field,title,width,rowspan,colspan,style(样式),sort(true|false),fixed(left,right)
|
||||
//第一行
|
||||
$thead0="";
|
||||
$thead0.="{\"field\":\"row11\",\"title\":\"".$zd_title1."\",\"rowspan\":2,\"fixed\":\"left\",\"width\":80},";
|
||||
$thead0.="{\"field\":\"row12\",\"title\":\"".$zd_title2."\",\"rowspan\":2,\"width\":80},";
|
||||
$thead0.="{\"field\":\"row13\",\"title\":\"往年销售\",\"colspan\":3},";
|
||||
$thead0.="{\"field\":\"row14\",\"title\":\"实际订单\",\"colspan\":4},";
|
||||
$thead0.="{\"field\":\"row15\",\"title\":\"差异\",\"colspan\":3}";
|
||||
//第二行
|
||||
$thead1="";
|
||||
$thead1.="{\"field\":\"row201\",\"title\":\"销售款数\",\"width\":80},";
|
||||
$thead1.="{\"field\":\"row202\",\"title\":\"销售件数\",\"width\":80},";
|
||||
$thead1.="{\"field\":\"row203\",\"title\":\"销售金额\",\"width\":80},";
|
||||
$thead1.="{\"field\":\"row204\",\"title\":\"订单款数\",\"width\":80},";
|
||||
$thead1.="{\"field\":\"row205\",\"title\":\"订单件数\",\"width\":80},";
|
||||
$thead1.="{\"field\":\"row206\",\"title\":\"订单金额\",\"width\":100},";
|
||||
$thead1.="{\"field\":\"row207\",\"title\":\"金额占%\",\"width\":80},";
|
||||
$thead1.="{\"field\":\"row208\",\"title\":\"款数差异\",\"width\":80},";
|
||||
$thead1.="{\"field\":\"row209\",\"title\":\"件数差异\",\"width\":80},";
|
||||
$thead1.="{\"field\":\"row210\",\"title\":\"金额差异\",\"width\":100}";
|
||||
//
|
||||
$thead="\"thead\":[{\"index\":0,\"content\":[".$thead0."]},{\"index\":1,\"content\":[".$thead1."]}],";
|
||||
$json_data.=$thead;
|
||||
//-----------取得报表数据
|
||||
$total_yd_je=$total_yd_js=$total_yd_ks=0;
|
||||
//订单表数据
|
||||
$q3="select ".$zd1.",".$zd2.",count(distinct iid) 'ks',sum(num) 'js',sum(jsje) 'je' from ".$table_pre."order where ka<>'y'".$con_other.$con_this." group by ".$zd1.",".$zd2;
|
||||
$r3=$db->query($q3);
|
||||
$arr_data_je=$arr_data_js=$arr_data_ks=array();
|
||||
while($m3=$db->fetch_array($r3)){
|
||||
$arr_data_je[$m3[$zd1]][$m3[$zd2]]=deel_num($m3["je"]);
|
||||
$arr_data_js[$m3[$zd1]][$m3[$zd2]]=$m3["js"];
|
||||
$arr_data_ks[$m3[$zd1]][$m3[$zd2]]=$m3["ks"];
|
||||
$total_yd_je+=$m3["je"];
|
||||
$total_yd_js+=$m3["js"];
|
||||
$total_yd_ks+=$m3["ks"];
|
||||
}
|
||||
//sku
|
||||
$q3="select ".$zd1.",".$zd2.",color,color_ka from ".$table_pre."kh where ka<>'y'";
|
||||
$r3=$db->query($q3);
|
||||
$arr_data_sku=array();
|
||||
while($m3=$db->fetch_array($r3)){
|
||||
if(trim($m3["color_ka"]))
|
||||
$num1=count(explode(",",$m3["color_ka"]));
|
||||
else
|
||||
$num1=0;
|
||||
$arr_data_sku[$m3[$zd1]][$m3[$zd2]]+=count(explode(",",$m3["color"]))-$num1;
|
||||
}
|
||||
//总历史数据
|
||||
$tmp=get_db_msg("select sum(js) 'js',sum(je) 'je',sum(ks) 'ks' from ".$table_pre."plugin_ls2 where c1<>'' and c2<>''".$con_this);
|
||||
$total_ls_je=$tmp["je"];
|
||||
$total_ls_js=$tmp["js"];
|
||||
$total_ls_ks=$tmp["ks"];
|
||||
//合并单元格
|
||||
$arr_colspan=array();
|
||||
foreach($arr_zd1 as $key1=>$value1){
|
||||
foreach($arr_zd2 as $key2=>$value2){
|
||||
if($arr_data_sku[$key1][$key2]>0)
|
||||
$arr_colspan[$key1]++;
|
||||
}
|
||||
}
|
||||
//--------------------输出报表-----------------------------------------------
|
||||
$tbody="";
|
||||
foreach($arr_zd1 as $key1=>$value1){
|
||||
$xj_1=$xj_2=$xj_3=$xj_4=$xj_5=0;
|
||||
$count=0;
|
||||
foreach($arr_zd2 as $key2=>$value2){
|
||||
//取得指标数据
|
||||
$m_ls=get_db_msg("select sum(js) 'js',sum(je) 'je',sum(ks) 'ks' from ".$table_pre."plugin_ls2 where c1='".$value1."' and c2='".$value2."'".$con_this);
|
||||
if($arr_data_sku[$key1][$key2]>0){
|
||||
$tbody.="{\"row201\":\"".$value1."\",\"row202\":\"".$value2."\",\"row203\":\"".deel_0($m_ls["ks"])."\",\"row204\":\"".deel_0($m_ls["js"])."\",\"row205\":\"".deel_0($m_ls["je"])."\",\"row206\":\"".deel_0($arr_data_ks[$key1][$key2])."\",\"row207\":\"".deel_0($arr_data_js[$key1][$key2])."\",\"row208\":\"".deel_0($arr_data_je[$key1][$key2])."\",\"row209\":\"".deel_bfb($arr_data_je[$key1][$key2],$total_yd_je)."\",\"row210\":\"".deel_0($m_ls["ks"]-$arr_data_ks[$key1][$key2])."\",\"row211\":\"".deel_0($m_ls["js"]-$arr_data_js[$key1][$key2])."\",\"row212\":\"".deel_0($m_ls["je"]-$arr_data_je[$key1][$key2])."\"},";
|
||||
$xj_1+=$m_ls["ks"];
|
||||
$xj_2+=$m_ls["js"];
|
||||
$xj_3+=$m_ls["je"];
|
||||
$xj_4+=$arr_data_ks[$key1][$key2];
|
||||
$xj_5+=$arr_data_js[$key1][$key2];
|
||||
$xj_6+=$arr_data_je[$key1][$key2];
|
||||
$total_1+=$m_ls["ks"];
|
||||
$total_2+=$m_ls["js"];
|
||||
$total_3+=$m_ls["je"];
|
||||
$total_4+=$arr_data_ks[$key1][$key2];
|
||||
$total_5+=$arr_data_js[$key1][$key2];
|
||||
$total_6+=$arr_data_je[$key1][$key2];
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
//小计
|
||||
$tbody.="{\"row201\":\"\",\"row202\":\"小计\",\"row203\":\"".deel_0($xj_1)."\",\"row204\":\"".deel_0($xj_2)."\",\"row205\":\"".deel_0($xj_3)."\",\"row206\":\"".deel_0($xj_4)."\",\"row207\":\"".deel_0($xj_5)."\",\"row208\":\"".deel_0($xj_6)."\",\"row209\":\"".deel_bfb($xj_6,$total_yd_je)."\",\"row210\":\"".deel_0($xj_1-$xj_4)."\",\"row211\":\"".deel_0($xj_2-$xj_5)."\",\"row212\":\"".deel_0($xj_3-$xj_6)."\"},";
|
||||
}
|
||||
//合计
|
||||
$tbody.="{\"row201\":\"\",\"row202\":\"合计\",\"row203\":\"".deel_0($total_1)."\",\"row204\":\"".deel_0($total_2)."\",\"row205\":\"".deel_0($total_3)."\",\"row206\":\"".deel_0($total_4)."\",\"row207\":\"".deel_0($total_5)."\",\"row208\":\"".deel_0($total_6)."\",\"row209\":\"100%\",\"row210\":\"".deel_0($total_1-$total_4)."\",\"row211\":\"".deel_0($total_2-$total_5)."\",\"row212\":\"".deel_0($total_3-$total_6)."\"},";
|
||||
}
|
||||
$json_data.="\"tbody\":[".deel_end($tbody)."],";
|
||||
?>
|
||||
@@ -0,0 +1,234 @@
|
||||
<?php
|
||||
//2维上下装比历史数据分析
|
||||
//可配置参数:zd1|sxz|横向维度1,zd2|category|横向维度2,zd3|brand|纵向维度,zd1_v1|11-上装|上装编号,zd1_v2|12-下装|下装编号,zd1_v3|13-饰品|其他编号
|
||||
//2018-12-12 by hehe
|
||||
//横向维度:zd1,zd2
|
||||
//----------------------------------------函数定义
|
||||
//转换成100%
|
||||
function to_bfb($num){
|
||||
if($num>0){
|
||||
$r=(keep_float($num,3)*100)."%";
|
||||
}else{
|
||||
$r="";
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
//计算除法
|
||||
function deel_cf1($num1,$num2){
|
||||
if($num1>0 && $num2>0){
|
||||
$r=keep_float($num1/$num2,1);
|
||||
}else{
|
||||
$r="";
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
//去除0%
|
||||
function deel_bfb0($bfb){
|
||||
if($bfb=="0%"){
|
||||
$r="";
|
||||
}else{
|
||||
$r=$bfb;
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
//----------------------------------------参数配置
|
||||
//横向维度
|
||||
$zd1="sxz";
|
||||
$zd2="category";
|
||||
$zd1_v1="11-上装";
|
||||
$zd1_v2="12-下装";
|
||||
$zd1_v3="13-饰品";
|
||||
//----------------------------------------
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
//
|
||||
$arr1=explode("-",$zd1_v1);
|
||||
$arr2=explode("-",$zd1_v2);
|
||||
$arr3=explode("-",$zd1_v3);
|
||||
$arr_zd1_px=array($arr1[0]=>$arr1[1],$arr2[0]=>$arr2[1],$arr3[0]=>$arr3[1]);
|
||||
if(check_table_exist($table_pre."plugin_ls2sxz")=="n"){
|
||||
//
|
||||
$code=0;
|
||||
$error_msg="请先导入历史数据!";
|
||||
}else{
|
||||
//店铺查询条件
|
||||
$con="";
|
||||
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{
|
||||
//代理角色所有客户
|
||||
$con=" and (upath='".$msg_client["path"]."-".$msg_client["id"]."' or upath like '".$msg_client["path"]."-".$msg_client["id"]."-%')";
|
||||
}
|
||||
}
|
||||
$con_this=$con;
|
||||
//排除饰品
|
||||
//$con_other=" and category<>'15'";
|
||||
//
|
||||
$con_this=str_replace(" and ka<>'y'","",$con);
|
||||
for($i=1;$i<3;$i++){
|
||||
$v="zd".$i;
|
||||
$v1="zd_title".$i;
|
||||
$v2="arr_zd".$i;
|
||||
//取得对应字段的名称
|
||||
$$v1=get_cate_title_no("arr_select",$$v);
|
||||
//取得字段的选项值
|
||||
$q1="select no,title from ".$table_pre."keyword where cate='".$$v."' order by no";
|
||||
$r1=$db->query($q1);
|
||||
$arr_tmp=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_tmp[$m1["no"]]=$m1["title"];
|
||||
}
|
||||
$$v2=$arr_tmp;
|
||||
}
|
||||
$content_data.="<table border='0' cellspacing='1' cellpadding='4' class='layui-table'><thead>";
|
||||
//第一行
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<th align='center' rowspan='2'><strong>装别</strong></th><th align='center' rowspan='2'><strong>大类</strong></th><th align='center' rowspan='2'><strong>上次订货SKC</strong></th><th align='center' colspan='5'><strong>实际订货</strong></th><th align='center' colspan='4'><strong>历史销售数据</strong></th>";
|
||||
$content_data.="</tr>";
|
||||
$content_data.="<tr><th align='center'><strong>订货SKC</strong></th><th align='center'><strong>订货量</strong></th><th align='center'><strong>量占比</strong></th><th align='center'><strong>订货额</strong></th><th align='center'><strong>订货额占比</strong></th><th align='center'><strong>销售量</strong></th><th align='center'><strong>销比</strong></th><th align='center'><strong>销售额</strong></th><th align='center'><strong>金额占比</strong></th>";
|
||||
$content_data.="</tr>";
|
||||
$content_data.="</thead>";
|
||||
//-----------取得报表数据
|
||||
$total_yd_je=$total_yd_js=$total_yd_ks=0;
|
||||
//订单表数据,zd1
|
||||
$q3="select ".$zd1.",sum(num) 'num',sum(je) 'je',count(distinct iid,color) 'skc' from ".$table_pre."order where ka<>'y'".$con_other.$con_this." group by ".$zd1;
|
||||
$r3=$db->query($q3);
|
||||
$arr_data_order1=array();
|
||||
while($m3=$db->fetch_array($r3)){
|
||||
$arr_data_order1[$m3[$zd1]]=array("num"=>$m3["num"],"je"=>$m3["je"],"skc"=>$m3["skc"]);
|
||||
}
|
||||
//订单表数据,zd1,zd2
|
||||
$q3="select ".$zd1.",".$zd2.",sum(num) 'num',sum(jsje) 'je',count(distinct iid,color) 'skc' from ".$table_pre."order where ka<>'y'".$con_other.$con_this." group by ".$zd1.",".$zd2;
|
||||
//echo $q3."<br>";
|
||||
$r3=$db->query($q3);
|
||||
$arr_data_order2=array();
|
||||
$total_yd_num=$total_yd_je=$total_yd_skc=0;
|
||||
while($m3=$db->fetch_array($r3)){
|
||||
$arr_data_order2[$m3[$zd1]][$m3[$zd2]]=array("num"=>$m3["num"],"je"=>$m3["je"],"skc"=>$m3["skc"]);
|
||||
$total_yd_num+=$m3["num"];
|
||||
$total_yd_je+=$m3["je"];
|
||||
$total_yd_skc+=$m3["skc"];
|
||||
}
|
||||
//订单表数据小计
|
||||
$q3="select ".$zd1.",sum(num) 'num' from ".$table_pre."order where ka<>'y'".$con_other.$con_this." group by ".$zd1;
|
||||
//echo $q3."<br>";
|
||||
$r3=$db->query($q3);
|
||||
$arr_data_order_xj=array();
|
||||
$sz_ydnum=$xz_ydnum=0;
|
||||
while($m3=$db->fetch_array($r3)){
|
||||
$arr_data_order_xj[$m3[$zd1]]=array("num"=>$m3["num"]);
|
||||
if(get_cate_title_no($zd1,$m3[$zd1])=="上装"){
|
||||
$sz_ydnum+=$m3["num"];
|
||||
}else if(get_cate_title_no($zd1,$m3[$zd1])=="下装"){
|
||||
$xz_ydnum+=$m3["num"];
|
||||
}
|
||||
}
|
||||
//款号表数据
|
||||
$q3="select ".$zd1.",".$zd2.",count(*) 'num' from ".$table_pre."kh where ka<>'y' group by ".$zd1.",".$zd2;
|
||||
$r3=$db->query($q3);
|
||||
$arr_data_kh=array();
|
||||
while($m3=$db->fetch_array($r3)){
|
||||
$arr_data_kh[$m3[$zd1]][$m3[$zd2]]=$m3["num"];
|
||||
}
|
||||
//sku
|
||||
$total_skc=0;
|
||||
$arr_data_sku=array();
|
||||
$q3="select ".$zd2.",color,color_ka from ".$table_pre."kh where ka<>'y'";
|
||||
$r3=$db->query($q3);
|
||||
$arr_data_sku=array();
|
||||
while($m3=$db->fetch_array($r3)){
|
||||
if(trim($m3["color_ka"]))
|
||||
$num1=count(explode(",",$m3["color_ka"]));
|
||||
else
|
||||
$num1=0;
|
||||
$arr_data_sku[$m3[$zd2]]+=count(explode(",",$m3["color"]))-$num1;
|
||||
$total_skc+=count(explode(",",$m3["color"]))-$num1;
|
||||
}
|
||||
//--------------------输出报表1
|
||||
$content_data.="<tbody>";
|
||||
$hj_skc_sc=$hj_ls_xsnum=$hj_ls_numzb=$hj_ls_xsje=$hj_ls_jezb=0;
|
||||
foreach($arr_zd1_px as $k1=>$v1){
|
||||
$xj_skc_sc=$xj_yd_skc=$xj_yd_num=$xj_yd_je=$xj_ls_xsnum=$xj_ls_numzb=$xj_ls_xsje=$xj_ls_jezb=0;
|
||||
foreach($arr_zd2 as $k=>$v){
|
||||
if($arr_data_kh[$k1][$k]>0){
|
||||
//取得历史数据
|
||||
$m_ls=get_db_msg("select sum(skc_sc) 'skc_sc',sum(ls_xsnum) 'ls_xsnum',sum(ls_numzb) 'ls_numzb',sum(ls_xsje) 'ls_xsje',sum(ls_jezb) 'ls_jezb' from ".$table_pre."plugin_ls2sxz where c1='".$v1."' and c2='".$v."'".$con_this." group by c2");
|
||||
$content_data.="<tr>";
|
||||
//订货计划
|
||||
$content_data.="<td align='center'>".$v1."</td><td align='center'>".$v."</td>";
|
||||
//上次SKC
|
||||
$content_data.="<td align='center'>".deel_0($m_ls["skc_sc"])."</td>";
|
||||
//本次订货
|
||||
$content_data.="<td align='center'>".deel_0($arr_data_order2[$k1][$k]["skc"])."</td><td align='center'>".deel_0($arr_data_order2[$k1][$k]["num"])."</td><td align='center'>".deel_bfb0(deel_bfb1($arr_data_order2[$k1][$k]["num"],$total_yd_num,1))."</td><td align='center'>".deel_0(deel_num($arr_data_order2[$k1][$k]["je"]))."</td><td align='center'>".deel_bfb0(deel_bfb1($arr_data_order2[$k1][$k]["je"],$total_yd_je,1))."</td>";
|
||||
//历史数据
|
||||
$content_data.="<td align='center'>".deel_0($m_ls["ls_xsnum"])."</td><td align='center'>".deel_bfb0(to_bfb($m_ls["ls_numzb"]))."</td><td align='center'>".deel_0(deel_num($m_ls["ls_xsje"]))."</td><td align='center'>".deel_bfb0(to_bfb($m_ls["ls_jezb"]))."</td>";
|
||||
$content_data.="</tr>";
|
||||
$xj_skc_sc+=$m_ls["skc_sc"];
|
||||
$xj_yd_skc+=$arr_data_order2[$k1][$k]["skc"];
|
||||
$xj_yd_num+=$arr_data_order2[$k1][$k]["num"];
|
||||
$xj_yd_je+=$arr_data_order2[$k1][$k]["je"];
|
||||
$xj_ls_xsnum+=$m_ls["ls_xsnum"];
|
||||
$xj_ls_numzb+=$m_ls["ls_numzb"];
|
||||
$xj_ls_xsje+=$m_ls["ls_xsje"];
|
||||
$xj_ls_jezb+=$m_ls["ls_jezb"];
|
||||
//合计
|
||||
$hj_skc_sc+=$m_ls["skc_sc"];
|
||||
$hj_ls_xsnum+=$m_ls["ls_xsnum"];
|
||||
$hj_ls_numzb+=$m_ls["ls_numzb"];
|
||||
$hj_ls_xsje+=$m_ls["ls_xsje"];
|
||||
$hj_ls_jezb+=$m_ls["ls_jezb"];
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
//小计
|
||||
$content_data.="<tr>";
|
||||
//订货计划
|
||||
$content_data.="<td align='center' colspan='2'>".$v1."小计</td>";
|
||||
//上次SKC
|
||||
$content_data.="<td align='center'>".deel_0($xj_skc_sc)."</td>";
|
||||
//本次订货
|
||||
$content_data.="<td align='center'>".deel_0($xj_yd_skc)."</td><td align='center'>".deel_0($xj_yd_num)."</td><td align='center'>".deel_bfb1($xj_yd_num,$total_yd_num,1)."</td><td align='center'>".deel_0(deel_num($xj_yd_je))."</td><td align='center'>".deel_bfb1($xj_yd_je,$total_yd_je,1)."</td>";
|
||||
//历史数据
|
||||
$content_data.="<td align='center'>".deel_0($xj_ls_xsnum)."</td><td align='center'>".to_bfb($xj_ls_numzb)."</td><td align='center'>".deel_0(deel_num($xj_ls_xsje))."</td><td align='center'>".to_bfb($xj_ls_jezb)."</td>";
|
||||
$content_data.="</tr>";
|
||||
}
|
||||
//合计
|
||||
$content_data.="<tr><td align='center' colspan='2'><b>合计</b></td><td align='center'><b>".deel_0($hj_skc_sc)."</b></td><td align='center'><b>".deel_0($total_yd_skc)."</b></td><td align='center'><b>".deel_0($total_yd_num)."</b></td><td align='center'><b>100%</b></td><td align='center'><b>".deel_0(deel_num($total_yd_je))."</b></td><td align='center'><b>100%</b></td>";
|
||||
//历史数据
|
||||
$content_data.="<td align='center'>".deel_0($hj_ls_xsnum)."</td><td align='center'>".to_bfb($hj_ls_numzb)."</td><td align='center'>".deel_0(deel_num($hj_ls_xsje))."</td><td align='center'>".to_bfb($hj_ls_jezb)."</td>";
|
||||
$content_data.="</tr>";
|
||||
//--------------------输出报表2
|
||||
$sz_lsnum=$xz_lsnum=0;
|
||||
foreach($arr_zd1_px as $k=>$v){
|
||||
//取得历史数据
|
||||
$q1="select sum(ls_xsnum) 'ls_xsnum',sum(ls_numzb) 'ls_numzb' from ".$table_pre."plugin_ls2sxz where c1='".$v."'".$con_this." group by c1";
|
||||
$m_ls=get_db_msg($q1);
|
||||
//记录上下装数据
|
||||
if($v=="上装"){
|
||||
$sz_lsnum+=$m_ls["ls_xsnum"];
|
||||
}else if($v=="下装"){
|
||||
$xz_lsnum+=$m_ls["ls_xsnum"];
|
||||
}
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<td align='center'>".$v."</td><td align='center'> </td><td align='center'> </td><td align='center'> </td><td align='center'>".deel_0($arr_data_order_xj[$k]["num"])."</td><td align='center'>".deel_bfb1($arr_data_order_xj[$k]["num"],$total_yd_num,1)."</td><td align='center'> </td><td align='center'> </td><td align='center'>".deel_0($m_ls["ls_xsnum"])."</td><td align='center'>".deel_bfb0(to_bfb($m_ls["ls_numzb"]))."</td><td align='center'> </td><td align='center'> </td>";
|
||||
$content_data.="</tr>";
|
||||
$count++;
|
||||
}
|
||||
$content_data.="<tr><td align='center'><b>上下装比</b></td><td align='center'> </td><td align='center'> </td><td align='center'> </td><td align='center'><b>".deel_cf1($sz_ydnum,$xz_ydnum)."</b></td><td align='center'> </td><td align='center'> </td><td align='center'> </td><td align='center'><b>".deel_cf1($sz_lsnum,$xz_lsnum)."</b></td><td align='center'> </td><td align='center'> </td><td align='center'> </td></tr>";
|
||||
//
|
||||
$content_data.="</tbody></table>";
|
||||
}
|
||||
$json_data.="\"table_html\":\"".$content_data."\",";
|
||||
?>
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
//批次区域占比
|
||||
//可配置参数:s_group_by|bc|批次字段
|
||||
//2019-03-26 by hehe for 温州拍普儿
|
||||
//------批次字段:s_group_by
|
||||
//-----参数配置
|
||||
//批次字段
|
||||
$s_group_by=get_plugin_set("s_group_by","bc");
|
||||
$use_layui_datatable="y";//使用标准layui datatable格式数据
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
//--------------------------------内容
|
||||
if(check_table_exist($table_pre."plugin_pcqyzb")=="n"){
|
||||
//
|
||||
$code=0;
|
||||
$error_msg="请先导入数据!";
|
||||
}else{
|
||||
//店铺查询条件
|
||||
$con="";
|
||||
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"]."-%')";
|
||||
}
|
||||
}
|
||||
}
|
||||
if($s_username){
|
||||
$m1=get_db_msg("select path 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."'");
|
||||
//-------------------------------------------layui 数据表格格式//--------------------------------表头
|
||||
//支持参数field,title,width,rowspan,colspan,style(样式),sort(true|false),fixed(left,right)
|
||||
//------------
|
||||
$thead0="";
|
||||
$thead0.="{\"field\":\"pc\",\"title\":\"批次\",\"sort\":true},";
|
||||
$thead0.="{\"field\":\"sj_ks\",\"title\":\"设计款色\",\"width\":120},";
|
||||
$thead0.="{\"field\":\"sj_ks_zb\",\"title\":\"占比\",\"width\":100},";
|
||||
$thead0.="{\"field\":\"yd_ks\",\"title\":\"已定款色\",\"width\":120},";
|
||||
$thead0.="{\"field\":\"yd_ks_zb\",\"title\":\"占比\",\"width\":100},";
|
||||
$thead0.="{\"field\":\"je\",\"title\":\"吊牌金额\",\"width\":120},";
|
||||
$thead0.="{\"field\":\"je_zb\",\"title\":\"占比\",\"width\":100},";
|
||||
$thead0.="{\"field\":\"qy_je_zb\",\"title\":\"".$m_qy["title"]."<br>占比\",\"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."<br>";
|
||||
$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<count($arr1);$i1++){
|
||||
if(!in_array($arr1[$i1],$arr2))
|
||||
$total_sku++;
|
||||
}
|
||||
}
|
||||
//取得已订总款色数
|
||||
$tmp1=get_db_msg("select count(distinct no,color) 'num' from ".$table_pre."order where ka<>'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."<br>";
|
||||
$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)."],";
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
//区域类别类型
|
||||
//可配置参数:zd1|sxz|产品类别,zd2|bc|各类型风格
|
||||
//2019-03-29 by clc for pit审单
|
||||
//------批次字段:s_group_by
|
||||
//-----参数配置
|
||||
//批次字段
|
||||
$zd1=get_plugin_set("zd1","sxz");
|
||||
$zd2=get_plugin_set("zd2","bc");
|
||||
$use_layui_datatable="y";//使用标准layui datatable格式数据
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
//--------------------------------内容
|
||||
for($i=1;$i<3;$i++){
|
||||
$v="zd".$i;
|
||||
$v1="zd_title".$i;
|
||||
$v2="arr_zd".$i;
|
||||
//取得对应字段的名称
|
||||
$$v1=get_cate_title_no("arr_select",$$v);
|
||||
//取得字段的选项值
|
||||
$q1="select no,title from ".$table_pre."keyword where cate='".$$v."' order by no";
|
||||
$r1=$db->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."<br>";
|
||||
$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)."],";
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
//我的文字评价
|
||||
//by hehe 2018-12-3
|
||||
//----------------------------------------------------------插件参数设置
|
||||
$use_layui_datatable="y";//使用标准layui datatable格式数据
|
||||
//-------------------------------------------layui 数据表格格式
|
||||
//--------------------------------表头
|
||||
//支持参数field,title,width,rowspan,colspan,style(样式),sort(true|false),fixed(left,right)
|
||||
$thead0="";
|
||||
$thead0.="{\"field\":\"ord\",\"title\":\"次序\",\"width\":80,\"sort\":true,\"fixed\":\"left\"},";
|
||||
$thead0.="{\"field\":\"kh\",\"title\":\"款号\",\"width\":150},";
|
||||
$thead0.="{\"field\":\"content\",\"title\":\"评价内容\",\"style\":\"text-align:left\"}";
|
||||
$thead="\"thead\":[{\"index\":0,\"content\":[".$thead0."]}],";
|
||||
$json_data.=$thead;
|
||||
//--------------------------------内容
|
||||
$tbody="";
|
||||
$q="select a.khid,a.remark,k.no from ".$table_pre."client_pj a,".$table_pre."kh k where a.khid=k.id and a.cid='".$uid."' and a.remark<>'' order by k.no";
|
||||
$r=$db->query($q);
|
||||
$list=1;
|
||||
while($m=$db->fetch_array($r)){
|
||||
$tbody.="{\"ord\":\"".$list."\",\"kh\":\"".$m["no"]."\",\"content\":\"".$m["remark"]."\"},";
|
||||
$list++;
|
||||
}
|
||||
$json_data.="\"tbody\":[".deel_end($tbody)."],";
|
||||
?>
|
||||
@@ -0,0 +1,272 @@
|
||||
<?php
|
||||
//标准一维报表
|
||||
//可配置参数:keyword_zd1|category|字段1,icon|menu_icon_bb_xw_ms|菜单图标,select_zd1||搜索1,select_zd2||搜索2,select_zd3||搜索3,head_zd1|y|均价,head_zd2|y|设计款数,head_zd3|y|已订款数,head_zd4|y|设计款色,head_zd5|y|已订款色,head_zd6|y|已订件数,head_zd7|y|吊牌金额,head_zd8|n|结算金额
|
||||
//2020-07-10 by hzz
|
||||
//-----参数配置start
|
||||
//菜单图标
|
||||
$icon=get_plugin_set("icon","menu_icon_bb_xw_ms");//支持以下目录的图标ipad/images/menu_icon_*.png
|
||||
//字段
|
||||
$zd1=get_plugin_set("keyword_zd1","category");
|
||||
|
||||
//表头
|
||||
$head_zd1=get_plugin_set("head_zd1","y");
|
||||
$head_zd2=get_plugin_set("head_zd2","y");
|
||||
$head_zd3=get_plugin_set("head_zd3","y");
|
||||
$head_zd4=get_plugin_set("head_zd4","y");
|
||||
$head_zd5=get_plugin_set("head_zd5","y");
|
||||
$head_zd6=get_plugin_set("head_zd6","y");
|
||||
$head_zd7=get_plugin_set("head_zd7","y");
|
||||
$head_zd8=get_plugin_set("head_zd8","n");
|
||||
//
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
|
||||
$s_key=$s_key?$s_key:$_key;
|
||||
//搜索
|
||||
$search_arr=array();
|
||||
$searh_select1=get_plugin_set("select_zd1","");
|
||||
$searh_select2=get_plugin_set("select_zd2","");
|
||||
$searh_select3=get_plugin_set("select_zd3","");
|
||||
array_push($search_arr,$searh_select1,$searh_select2,$searh_select3);
|
||||
|
||||
//
|
||||
$str_select="";
|
||||
for($i=0;$i<count($search_arr);$i++){
|
||||
$arr_val=$search_arr[$i];
|
||||
if($arr_val){
|
||||
if($arr_val=="s_spk"){
|
||||
$str_select.="{\"name\":\"s_spk\",\"title\":\"是否饰品款\",\"value\":\"".$s_spk."\",\"op\":[{\"no\":\"y\",\"title\":\"是\"},{\"no\":\"n\",\"title\":\"否\"}]},";
|
||||
}else if($arr_val=="s_ka"){
|
||||
$str_select.="{\"name\":\"s_ka\",\"title\":\"是否删除款\",\"value\":\"".$s_ka."\",\"op\":[{\"no\":\"y\",\"title\":\"是\"},{\"no\":\"n\",\"title\":\"否\"}]},";
|
||||
}else{
|
||||
$str_op="";
|
||||
$sql_select="select no,title from web_keyword where cate='".$arr_val."' order by ord";
|
||||
$res_select=$db->query($sql_select);
|
||||
while($msg_select=$db->fetch_array($res_select)){
|
||||
$str_op.="{\"no\":\"".$msg_select["no"]."\",\"title\":\"".$msg_select["title"]."\"},";
|
||||
}
|
||||
$str_select.="{\"name\":\"".$arr_val."\",\"title\":\"".get_cate_title_no("arr_select",$arr_val)."\",\"value\":\"".$$arr_val."\",\"op\":[".substr($str_op,0,-1)."]},";
|
||||
}
|
||||
}
|
||||
}
|
||||
$json_data.="\"select_report\":[".substr($str_select,0,-1)."],";
|
||||
//end
|
||||
|
||||
//-------------------------条件
|
||||
//-------con为web_order
|
||||
//-------con1为web_kh
|
||||
$con=$con1="";
|
||||
if($searh_select1!="s_ka" && $searh_select2!="s_ka" && $searh_select3!="s_ka"){
|
||||
//没有删除款搜索时
|
||||
$con.=" and ka<>'y' ";
|
||||
$con1.=" and ka<>'y' ";
|
||||
}else{
|
||||
if($s_ka){
|
||||
$con.=" and ka='".$s_ka."' ";
|
||||
$con1.=" and ka='".$s_ka."' ";
|
||||
}
|
||||
}
|
||||
if($searh_select1!="s_spk" && $searh_select2!="s_spk" && $searh_select3!="s_spk"){
|
||||
//没有饰品款搜索时
|
||||
$con.=" and is_sp<>'y' ";
|
||||
$con1.=" and is_sp<>'y' ";
|
||||
}else{
|
||||
if($s_spk){
|
||||
$con.=" and is_sp='".$s_spk."' ";
|
||||
$con1.=" and is_sp='".$s_spk."' ";
|
||||
}
|
||||
}
|
||||
if($s_key){
|
||||
if($s_key=="all"){
|
||||
$con.="";
|
||||
}else{
|
||||
$con.=" and _key='".$s_key."'";
|
||||
}
|
||||
}
|
||||
//其他
|
||||
for($i=0;$i<count($search_arr);$i++){
|
||||
$arr_val=$search_arr[$i];
|
||||
if($arr_val && $arr_val!="s_spk" && $arr_val!="s_ka"){
|
||||
if($$arr_val){
|
||||
$con.=" and ".$arr_val."='".$$arr_val."' ";
|
||||
$con1.=" and ".$arr_val."='".$$arr_val."' ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//店铺查询条件
|
||||
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==""){
|
||||
//请求数据有误
|
||||
$content_data="<div align='center'>请先配置参数!</div>";
|
||||
$json_data.="\"sys_bb_type\":\"report_null\",";
|
||||
}else{
|
||||
//---------------------------------------一维报表
|
||||
$json_data.="\"sys_bb_type\":\"report_1w\",";
|
||||
$s_group_by=$zd1;
|
||||
|
||||
//取得总款数
|
||||
$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<count($arr1);$i1++){
|
||||
if(!in_array($arr1[$i1],$arr2))
|
||||
$total_sku++;
|
||||
}
|
||||
}
|
||||
//取得总均价
|
||||
$tmp=get_db_msg("select sum(price)/count(*) 'jj' from ".$table_pre."kh where ".$s_group_by."<>''".$con1);
|
||||
$price_jj=keep_float($tmp["jj"],1);
|
||||
//取得已订总件数和金额
|
||||
$q="select sum(num) 'num',sum(je) 'je',sum(jsje) 'jsje' from ".$table_pre."order where ".$s_group_by."<>'' ".$con;
|
||||
$tmp=get_db_msg($q);
|
||||
$total_yd_js=$tmp["num"];
|
||||
$total_yd_je=$tmp["je"];
|
||||
$total_yd_jsje=$tmp["jsje"];
|
||||
//取得已订总款数
|
||||
$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.="<table id='tabledetail' class='cell-border nowrap' width='100%' lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' class='layui-table'>";
|
||||
$content_data.="<thead><tr style='background-color:#f2f2f2' align=center><td rowspan=2>".get_cate_title_no("arr_select",$s_group_by)."</td>";
|
||||
$content_data.=($head_zd1=="y")?"<td rowspan=2>均价</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td colspan=2>设计款数</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td colspan=2>已订款数</td>":"";
|
||||
$content_data.=($head_zd4=="y")?"<td colspan=2>设计款色</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td colspan=2>已订款色</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td colspan=2>已订件数</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td colspan=2>吊牌金额</td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td colspan=2>结算金额</td>":"";
|
||||
$content_data.="</tr>";
|
||||
|
||||
$content_data.="<tr style='background-color:#f2f2f2' align=center>";
|
||||
$content_data.=($head_zd2=="y")?"<td>款数</td><td>占比</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>款数</td><td>占比</td>":"";
|
||||
$content_data.=($head_zd4=="y")?"<td>款数</td><td>占比</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>款数</td><td>占比</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>件数</td><td>占比</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>金额</td><td>占比</td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td>金额</td><td>占比</td>":"";
|
||||
$content_data.="</tr>";
|
||||
|
||||
$content_data.="</thead>";
|
||||
$content_data.="<tbody>";
|
||||
//
|
||||
$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',sum(jsje) 'jsje' from ".$table_pre."order where id>0 and ".$s_group_by."='".$m["no"]."'".$con);
|
||||
$tmp_yd_js=$tmp["num"];
|
||||
$tmp_yd_je=$tmp["je"];
|
||||
$tmp_yd_jsje=$tmp["jsje"];
|
||||
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)).",";
|
||||
if($msg_client["face"]=="4"){
|
||||
$content_data.="<tr align=center><td><a style='color:blue;' href='javascript:void(0);' onclick=go_dkhtml({'s_".$s_group_by."':'".$m["no"]."'})>".$m["title"]."</a></td>";
|
||||
}else{
|
||||
$content_data.="<tr align=center><td>".$m["title"]."</td>";
|
||||
}
|
||||
//
|
||||
$content_data.=($head_zd1=="y")?"<td>".keep_float($tmp["jj"],1)."</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td>".$tmp_z_ks."</td><td>".deel_bfb($tmp_z_ks,$total_ks)."</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>".$tmp_yd_ks."</td><td>".deel_bfb($tmp_yd_ks,$total_yd_ks)."</td>":"";
|
||||
$content_data.=($head_zd4=="y")?"<td>".$tmp_z_sku."</td><td>".deel_bfb($tmp_z_sku,$total_sku)."</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>".$tmp_yd_sku."</td><td>".deel_bfb($tmp_yd_sku,$total_yd_sku)."</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>".deel_01(deel_num($tmp_yd_js))."</td><td>".deel_bfb($tmp_yd_js,$total_yd_js)."</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>".deel_01(deel_num($tmp_yd_je))."</td><td>".deel_bfb($tmp_yd_je,$total_yd_je)."</td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td>".deel_01(deel_num($tmp_yd_jsje))."</td><td>".deel_bfb($tmp_yd_jsje,$total_yd_jsje)."</td>":"";
|
||||
$content_data.="</tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
$content_data.="</tbody>";
|
||||
$content_data.="<tfoot>";
|
||||
$content_data.="<tr align=center style='background-color:#f2f2f2'><td>合计</td>";
|
||||
$content_data.=($head_zd1=="y")?"<td>".$price_jj."</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td>".$total_ks."</td><td></td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>".$total_yd_ks."</td><td></td>":"";
|
||||
$content_data.=($head_zd4=="y")?"<td>".$total_sku."</td><td></td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>".$total_yd_sku."</td><td></td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>".deel_01(deel_num($total_yd_js))."</td><td></td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>".deel_01(deel_num($total_yd_je))."</td><td></td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td>".deel_01(deel_num($total_yd_jsje))."</td><td></td>":"";
|
||||
$content_data.="</tr>";
|
||||
$content_data.="</tfoot>";
|
||||
$content_data.="</table>";
|
||||
|
||||
//图
|
||||
$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."\",";
|
||||
?>
|
||||
@@ -0,0 +1,383 @@
|
||||
<?php
|
||||
//标准二维报表
|
||||
//可配置参数:keyword_zd1|category|字段1,keyword_zd2|bc|字段2,icon|menu_icon_bb_xw_ms|菜单图标,select_zd1||搜索1,select_zd2||搜索2,select_zd3||搜索3,head_zd1|y|均价,head_zd2|y|设计款数,head_zd3|y|已订款数,head_zd4|y|设计款色,head_zd5|y|已订款色,head_zd6|y|已订件数,head_zd7|y|吊牌金额,head_zd8|n|结算金额
|
||||
//2020-07-10 by hzz
|
||||
//-----参数配置start
|
||||
//菜单图标
|
||||
$icon=get_plugin_set("icon","menu_icon_bb_xw_ms");//支持以下目录的图标ipad/images/menu_icon_*.png
|
||||
//字段
|
||||
$zd1=get_plugin_set("keyword_zd1","category");
|
||||
$zd2=get_plugin_set("keyword_zd2","bc");
|
||||
//表头
|
||||
$head_zd1=get_plugin_set("head_zd1","y");
|
||||
$head_zd2=get_plugin_set("head_zd2","y");
|
||||
$head_zd3=get_plugin_set("head_zd3","y");
|
||||
$head_zd4=get_plugin_set("head_zd4","y");
|
||||
$head_zd5=get_plugin_set("head_zd5","y");
|
||||
$head_zd6=get_plugin_set("head_zd6","y");
|
||||
$head_zd7=get_plugin_set("head_zd7","y");
|
||||
$head_zd8=get_plugin_set("head_zd8","n");
|
||||
//
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
|
||||
$s_key=$s_key?$s_key:$_key;
|
||||
//搜索
|
||||
$search_arr=array();
|
||||
$searh_select1=get_plugin_set("select_zd1","");
|
||||
$searh_select2=get_plugin_set("select_zd2","");
|
||||
$searh_select3=get_plugin_set("select_zd3","");
|
||||
array_push($search_arr,$searh_select1,$searh_select2,$searh_select3);
|
||||
|
||||
//
|
||||
$str_select="";
|
||||
for($i=0;$i<count($search_arr);$i++){
|
||||
$arr_val=$search_arr[$i];
|
||||
if($arr_val){
|
||||
if($arr_val=="s_spk"){
|
||||
$str_select.="{\"name\":\"s_spk\",\"title\":\"是否饰品款\",\"value\":\"".$s_spk."\",\"op\":[{\"no\":\"y\",\"title\":\"是\"},{\"no\":\"n\",\"title\":\"否\"}]},";
|
||||
}else if($arr_val=="s_ka"){
|
||||
$str_select.="{\"name\":\"s_ka\",\"title\":\"是否删除款\",\"value\":\"".$s_ka."\",\"op\":[{\"no\":\"y\",\"title\":\"是\"},{\"no\":\"n\",\"title\":\"否\"}]},";
|
||||
}else{
|
||||
$str_op="";
|
||||
$sql_select="select no,title from web_keyword where cate='".$arr_val."' order by ord";
|
||||
$res_select=$db->query($sql_select);
|
||||
while($msg_select=$db->fetch_array($res_select)){
|
||||
$str_op.="{\"no\":\"".$msg_select["no"]."\",\"title\":\"".$msg_select["title"]."\"},";
|
||||
}
|
||||
$str_select.="{\"name\":\"".$arr_val."\",\"title\":\"".get_cate_title_no("arr_select",$arr_val)."\",\"value\":\"".$$arr_val."\",\"op\":[".substr($str_op,0,-1)."]},";
|
||||
}
|
||||
}
|
||||
}
|
||||
$json_data.="\"select_report\":[".substr($str_select,0,-1)."],";
|
||||
//end
|
||||
|
||||
//-------------------------条件
|
||||
//-------con为web_order
|
||||
//-------con1为web_kh
|
||||
$con=$con1="";
|
||||
if($searh_select1!="s_ka" && $searh_select2!="s_ka" && $searh_select3!="s_ka"){
|
||||
//没有删除款搜索时
|
||||
$con.=" and ka<>'y' ";
|
||||
$con1.=" and ka<>'y' ";
|
||||
}else{
|
||||
if($s_ka){
|
||||
$con.=" and ka='".$s_ka."' ";
|
||||
$con1.=" and ka='".$s_ka."' ";
|
||||
}
|
||||
}
|
||||
if($searh_select1!="s_spk" && $searh_select2!="s_spk" && $searh_select3!="s_spk"){
|
||||
//没有饰品款搜索时
|
||||
$con.=" and is_sp<>'y' ";
|
||||
$con1.=" and is_sp<>'y' ";
|
||||
}else{
|
||||
if($s_spk){
|
||||
$con.=" and is_sp='".$s_spk."' ";
|
||||
$con1.=" and is_sp='".$s_spk."' ";
|
||||
}
|
||||
}
|
||||
if($s_key){
|
||||
if($s_key=="all"){
|
||||
$con.="";
|
||||
}else{
|
||||
$con.=" and _key='".$s_key."'";
|
||||
}
|
||||
}
|
||||
//其他
|
||||
for($i=0;$i<count($search_arr);$i++){
|
||||
$arr_val=$search_arr[$i];
|
||||
if($arr_val && $arr_val!="s_spk" && $arr_val!="s_ka"){
|
||||
if($$arr_val){
|
||||
$con.=" and ".$arr_val."='".$$arr_val."' ";
|
||||
$con1.=" and ".$arr_val."='".$$arr_val."' ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//店铺查询条件
|
||||
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==""){
|
||||
//请求数据有误
|
||||
$content_data="<div align='center'>请先配置参数!</div>";
|
||||
$json_data.="\"sys_bb_type\":\"report_null\",";
|
||||
}else{
|
||||
//---------------------------------------一维报表
|
||||
$json_data.="\"sys_bb_type\":\"report_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"];
|
||||
}
|
||||
//
|
||||
$s_group_by1=$zd1;
|
||||
$s_group_by2=$zd2;
|
||||
|
||||
$content_data="";
|
||||
$content_data.="<table id='tabledetail' class='cell-border nowrap' width='100%' lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' class='layui-table'>";
|
||||
$content_data.="<thead><tr style='background-color:#f2f2f2' align=center><td rowspan=2>".get_main_value($arr_group_by_title,$s_group_by1)."</td><td rowspan=2>".get_main_value($arr_group_by_title,$s_group_by2)."</td>";
|
||||
if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by1!="color" && $s_group_by2!="color"){
|
||||
$content_data.=($head_zd1=="y")?"<td rowspan=2>均价</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td colspan=2>设计款数</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td colspan=2>已订款数</td>":"";
|
||||
}
|
||||
$content_data.=($head_zd4=="y")?"<td colspan=2>设计款色</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td colspan=2>已订款色</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td colspan=2>已订件数</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td colspan=2>吊牌金额</td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td colspan=2>结算金额</td>":"";
|
||||
$content_data.="</tr>";
|
||||
$content_data.="<tr style='background-color:#f2f2f2' align=center>";
|
||||
if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by1!="color" && $s_group_by2!="color"){
|
||||
$content_data.=($head_zd2=="y")?"<td>款数</td><td>占比</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>款数</td><td>占比</td>":"";
|
||||
}
|
||||
$content_data.=($head_zd4=="y")?"<td>款数</td><td>占比</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>款数</td><td>占比</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>件数</td><td>占比</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>金额</td><td>占比</td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td>金额</td><td>占比</td>":"";
|
||||
$content_data.="</tr>";
|
||||
$content_data.="</thead>";
|
||||
$content_data.="<tbody>";
|
||||
$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<count($arr1);$i1++){
|
||||
if(!in_array($arr1[$i1],$arr2))
|
||||
$total_sku++;
|
||||
}
|
||||
}
|
||||
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 no<>'' ".$con2.$con1);
|
||||
$price_jj=keep_float($tmp["jj"],1);
|
||||
}
|
||||
|
||||
//取得已订总件数和金额
|
||||
$tmp=get_db_msg("select sum(num) 'num',sum(je) 'je',sum(jsje) 'jsje' from ".$table_pre."order where ".$s_group_by2."<>'' and ".$s_group_by1."<>'' ".$con);
|
||||
$total_yd_js=$tmp["num"];
|
||||
$total_yd_je=$tmp["je"];
|
||||
$total_yd_jsje=$tmp["jsje"];
|
||||
//取得已订总款数
|
||||
$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;$i1<count($arr_color);$i1++){
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where concat(',',color,',') like '%,".$arr_color[$i1].",%'".$con11.$con1);
|
||||
$n1+=$tmp["num"];
|
||||
}
|
||||
$xj_z_sku=$n1;
|
||||
}else{
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ".$s_group_by1."='".$m4["no"]."'".$con11.$con1);
|
||||
$xj_z_ks=$tmp["num"];
|
||||
//取得小计设计款色数
|
||||
$xj_z_sku=0;
|
||||
$q2="select no,color,color_ka from ".$table_pre."kh where ".$s_group_by1."='".$m4["no"]."'".$con11.$con1;
|
||||
$r2=$db->query($q2);
|
||||
while($m2=$db->fetch_array($r2)){
|
||||
$arr1=explode(",",$m2["color"]);
|
||||
$arr2=explode(",",$m2["color_ka"]);
|
||||
for($i1=0;$i1<count($arr1);$i1++){
|
||||
if(!in_array($arr1[$i1],$arr2))
|
||||
$xj_z_sku++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
$q="select * from ".$table_pre."keyword where cate='".$s_group_by2."' order by no";
|
||||
//echo $q."<br>";
|
||||
$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',sum(jsje) 'jsje' 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"];
|
||||
$xj_yd_jsje=$tmp["jsje"];
|
||||
//
|
||||
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<count($arr_color);$i1++){
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ka<>'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',sum(jsje) 'jsje' 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"];
|
||||
$tmp_yd_jsje=$tmp["jsje"];
|
||||
//
|
||||
if($tmp_z_sku>0){
|
||||
$content_data.="<tr align=center>";
|
||||
$content_data.="<td>".$m4["title"]."</td>";
|
||||
$content_data.="<td>".$m["title"]."</td>";
|
||||
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.=($head_zd1=="y")?"<td>".keep_float($tmp["jj"],1)."</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td>".$tmp_z_ks."</td><td>".deel_bfb($tmp_z_ks,$xj_z_ks)."</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>".$tmp_yd_ks."</td><td>".deel_bfb($tmp_yd_ks,$xj_yd_ks)."</td>":"";
|
||||
}
|
||||
$content_data.=($head_zd4=="y")?"<td>".$tmp_z_sku."</td><td>".deel_bfb($tmp_z_sku,$xj_z_sku)."</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>".$tmp_yd_sku."</td><td>".deel_bfb($tmp_yd_sku,$xj_yd_sku)."</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>".deel_01(deel_num($tmp_yd_js))."</td><td>".deel_bfb($tmp_yd_js,$xj_yd_js)."</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>".deel_01(deel_num($tmp_yd_je))."</td><td>".deel_bfb($tmp_yd_je,$xj_yd_je)."</td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td>".deel_01(deel_num($tmp_yd_jsje))."</td><td>".deel_bfb($tmp_yd_jsje,$xj_yd_jsje)."</td>":"";
|
||||
$content_data.="</tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
if($xj_z_sku>0){
|
||||
$content_data.="<tr align=center style='background-color:#f2f2f2'>";
|
||||
$content_data.="<td>小计</td><td></td>";
|
||||
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.=($head_zd1=="y")?"<td>".keep_float($tmp["jj"],1)."</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td>".$xj_z_ks."</td><td>".deel_bfb($xj_z_ks,$total_ks)."</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>".$xj_yd_ks."</td><td>".deel_bfb($xj_yd_ks,$total_yd_ks)."</td>":"";
|
||||
}
|
||||
$content_data.=($head_zd4=="y")?"<td>".$xj_z_sku."</td><td>".deel_bfb($xj_z_sku,$total_sku)."</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>".$xj_yd_sku."</td><td>".deel_bfb($xj_yd_sku,$total_yd_sku)."</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>".deel_num($xj_yd_js)."</td><td>".deel_bfb($xj_yd_js,$total_yd_js)."</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>".deel_num($xj_yd_je)."</td><td>".deel_bfb($xj_yd_je,$total_yd_je)."</td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td>".deel_num($xj_yd_jsje)."</td><td>".deel_bfb($xj_yd_jsje,$total_yd_jsje)."</td>":"";
|
||||
$content_data.="</tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
$content_data.="</tbody>";
|
||||
//
|
||||
$content_data.="<tfoot>";
|
||||
$content_data.="<tr style='background-color:#f2f2f2' align=center>";
|
||||
$content_data.="<td colspan=2>合计</td>";
|
||||
|
||||
if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by1!="color" && $s_group_by2!="color"){
|
||||
$content_data.=($head_zd1=="y")?"<td>".$price_jj."</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td>".$total_ks."</td><td></td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>".deel_num($total_yd_ks)."</td><td></td>":"";
|
||||
}
|
||||
|
||||
$content_data.=($head_zd4=="y")?"<td>".deel_num($total_sku)."</td><td></td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>".deel_num($total_yd_sku)."</td><td></td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>".deel_num($total_yd_js)."</td><td></td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>".deel_num($total_yd_je)."</td><td></td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td>".deel_num($total_yd_jsje)."</td><td></td>":"";
|
||||
|
||||
$content_data.="</tr>";
|
||||
$content_data.="</tfoot>";
|
||||
$content_data.="</table>";
|
||||
}
|
||||
$json_data.="\"table_html\":\"".$content_data."\",";
|
||||
?>
|
||||
@@ -0,0 +1,488 @@
|
||||
<?php
|
||||
//标准三维报表
|
||||
//可配置参数:keyword_zd1|category|字段1,keyword_zd2|bc|字段2,keyword_zd3|gender|字段3,icon|menu_icon_bb_xw_ms|菜单图标,select_zd1||搜索1,select_zd2||搜索2,select_zd3||搜索3,head_zd1|y|均价,head_zd2|y|设计款数,head_zd3|y|已订款数,head_zd4|y|设计款色,head_zd5|y|已订款色,head_zd6|y|已订件数,head_zd7|y|吊牌金额,head_zd8|n|结算金额
|
||||
//2020-07-27 by zc
|
||||
//-----参数配置start
|
||||
//菜单图标
|
||||
$icon=get_plugin_set("icon","menu_icon_bb_xw_ms");//支持以下目录的图标ipad/images/menu_icon_*.png
|
||||
//字段
|
||||
$zd1=get_plugin_set("keyword_zd1","category");
|
||||
$zd2=get_plugin_set("keyword_zd2","bc");
|
||||
$zd3=get_plugin_set("keyword_zd3","gender");
|
||||
//表头
|
||||
$head_zd1=get_plugin_set("head_zd1","y");
|
||||
$head_zd2=get_plugin_set("head_zd2","y");
|
||||
$head_zd3=get_plugin_set("head_zd3","y");
|
||||
$head_zd4=get_plugin_set("head_zd4","y");
|
||||
$head_zd5=get_plugin_set("head_zd5","y");
|
||||
$head_zd6=get_plugin_set("head_zd6","y");
|
||||
$head_zd7=get_plugin_set("head_zd7","y");
|
||||
$head_zd8=get_plugin_set("head_zd8","n");
|
||||
//
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
|
||||
$s_key=$s_key?$s_key:$_key;
|
||||
//搜索
|
||||
$search_arr=array();
|
||||
$searh_select1=get_plugin_set("select_zd1","");
|
||||
$searh_select2=get_plugin_set("select_zd2","");
|
||||
$searh_select3=get_plugin_set("select_zd3","");
|
||||
array_push($search_arr,$searh_select1,$searh_select2,$searh_select3);
|
||||
|
||||
//
|
||||
$str_select="";
|
||||
for($i=0;$i<count($search_arr);$i++){
|
||||
$arr_val=$search_arr[$i];
|
||||
if($arr_val){
|
||||
if($arr_val=="s_spk"){
|
||||
$str_select.="{\"name\":\"s_spk\",\"title\":\"是否饰品款\",\"value\":\"".$s_spk."\",\"op\":[{\"no\":\"y\",\"title\":\"是\"},{\"no\":\"n\",\"title\":\"否\"}]},";
|
||||
}else if($arr_val=="s_ka"){
|
||||
$str_select.="{\"name\":\"s_ka\",\"title\":\"是否删除款\",\"value\":\"".$s_ka."\",\"op\":[{\"no\":\"y\",\"title\":\"是\"},{\"no\":\"n\",\"title\":\"否\"}]},";
|
||||
}else{
|
||||
$str_op="";
|
||||
$sql_select="select no,title from web_keyword where cate='".$arr_val."' order by ord";
|
||||
$res_select=$db->query($sql_select);
|
||||
while($msg_select=$db->fetch_array($res_select)){
|
||||
$str_op.="{\"no\":\"".$msg_select["no"]."\",\"title\":\"".$msg_select["title"]."\"},";
|
||||
}
|
||||
$str_select.="{\"name\":\"".$arr_val."\",\"title\":\"".get_cate_title_no("arr_select",$arr_val)."\",\"value\":\"".$$arr_val."\",\"op\":[".substr($str_op,0,-1)."]},";
|
||||
}
|
||||
}
|
||||
}
|
||||
$json_data.="\"select_report\":[".substr($str_select,0,-1)."],";
|
||||
//end
|
||||
|
||||
//-------------------------条件
|
||||
//-------con为web_order
|
||||
//-------con1为web_kh
|
||||
$con=$con1="";
|
||||
if($searh_select1!="s_ka" && $searh_select2!="s_ka" && $searh_select3!="s_ka"){
|
||||
//没有删除款搜索时
|
||||
$con.=" and ka<>'y' ";
|
||||
$con1.=" and ka<>'y' ";
|
||||
}else{
|
||||
if($s_ka){
|
||||
$con.=" and ka='".$s_ka."' ";
|
||||
$con1.=" and ka='".$s_ka."' ";
|
||||
}
|
||||
}
|
||||
if($searh_select1!="s_spk" && $searh_select2!="s_spk" && $searh_select3!="s_spk"){
|
||||
//没有饰品款搜索时
|
||||
$con.=" and is_sp<>'y' ";
|
||||
$con1.=" and is_sp<>'y' ";
|
||||
}else{
|
||||
if($s_spk){
|
||||
$con.=" and is_sp='".$s_spk."' ";
|
||||
$con1.=" and is_sp='".$s_spk."' ";
|
||||
}
|
||||
}
|
||||
if($s_key){
|
||||
if($s_key=="all"){
|
||||
$con.="";
|
||||
}else{
|
||||
$con.=" and _key='".$s_key."'";
|
||||
}
|
||||
}
|
||||
//其他
|
||||
for($i=0;$i<count($search_arr);$i++){
|
||||
$arr_val=$search_arr[$i];
|
||||
if($arr_val && $arr_val!="s_spk" && $arr_val!="s_ka"){
|
||||
if($$arr_val){
|
||||
$con.=" and ".$arr_val."='".$$arr_val."' ";
|
||||
$con1.=" and ".$arr_val."='".$$arr_val."' ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//店铺查询条件
|
||||
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==""){
|
||||
//请求数据有误
|
||||
$content_data="<div align='center'>请先配置参数!</div>";
|
||||
$json_data.="\"sys_bb_type\":\"report_null\",";
|
||||
}else{
|
||||
//---------------------------------------一维报表
|
||||
$json_data.="\"sys_bb_type\":\"report_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"];
|
||||
}
|
||||
//
|
||||
$s_group_by1=$zd1;
|
||||
$s_group_by2=$zd2;
|
||||
$s_group_by3=$zd3;
|
||||
|
||||
$content_data="";
|
||||
$content_data.="<table id='tabledetail' class='cell-border nowrap' width='100%' lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' class='layui-table'>";
|
||||
$content_data.="<thead><tr style='background-color:#f2f2f2' align=center><td rowspan=2>".get_main_value($arr_group_by_title,$s_group_by1)."</td><td rowspan=2>".get_main_value($arr_group_by_title,$s_group_by2)."</td><td rowspan=2>".get_main_value($arr_group_by_title,$s_group_by3)."</td>";
|
||||
if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by3!="sx" && $s_group_by1!="color" && $s_group_by2!="color" && $s_group_by3!="color"){
|
||||
$content_data.=($head_zd1=="y")?"<td rowspan=2>均价</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td colspan=2>设计款数</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td colspan=2>已订款数</td>":"";
|
||||
}
|
||||
$content_data.=($head_zd4=="y")?"<td colspan=2>设计款色</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td colspan=2>已订款色</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td colspan=2>已订件数</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td colspan=2>吊牌金额</td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td colspan=2>结算金额</td>":"";
|
||||
$content_data.="</tr>";
|
||||
$content_data.="<tr style='background-color:#f2f2f2' align=center>";
|
||||
if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by3!="sx" && $s_group_by1!="color" && $s_group_by2!="color" && $s_group_by3!="color"){
|
||||
$content_data.=($head_zd2=="y")?"<td>款数</td><td>占比</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>款数</td><td>占比</td>":"";
|
||||
}
|
||||
$content_data.=($head_zd4=="y")?"<td>款数</td><td>占比</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>款数</td><td>占比</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>件数</td><td>占比</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>金额</td><td>占比</td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td>金额</td><td>占比</td>":"";
|
||||
$content_data.="</tr>";
|
||||
$content_data.="</thead>";
|
||||
$content_data.="<tbody>";
|
||||
$con2="";
|
||||
if($s_group_by1!="sx")
|
||||
$con2.=" and ".$s_group_by1."<>''";
|
||||
if($s_group_by2!="sx")
|
||||
$con2.=" and ".$s_group_by2."<>''";
|
||||
if($s_group_by3!="sx")
|
||||
$con2.=" and ".$s_group_by3."<>''";
|
||||
|
||||
//取得总款数
|
||||
$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<count($arr1);$i1++){
|
||||
if(!in_array($arr1[$i1],$arr2))
|
||||
$total_sku++;
|
||||
}
|
||||
}
|
||||
if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by3!="sx" && $s_group_by1!="color" && $s_group_by2!="color" && $s_group_by3!="color"){
|
||||
//取得总均价
|
||||
$tmp=get_db_msg("select sum(price)/count(*) 'jj' from ".$table_pre."kh where no<>'' ".$con2.$con1);
|
||||
$price_jj=keep_float($tmp["jj"],1);
|
||||
}
|
||||
|
||||
//取得已订总件数和金额
|
||||
$tmp=get_db_msg("select sum(num) 'num',sum(je) 'je',sum(jsje) 'jsje' from ".$table_pre."order where ".$s_group_by2."<>'' and ".$s_group_by1."<>'' and ".$s_group_by3."<>'' ".$con);
|
||||
$total_yd_js=$tmp["num"];
|
||||
$total_yd_je=$tmp["je"];
|
||||
$total_yd_jsje=$tmp["jsje"];
|
||||
//取得已订总款数
|
||||
$tmp=get_db_msg("select count(distinct no) 'num' from ".$table_pre."order where ".$s_group_by2."<>'' and ".$s_group_by1."<>'' and ".$s_group_by3."<>'' ".$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."<>'' and ".$s_group_by3."<>'' ".$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;$i1<count($arr_color);$i1++){
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where concat(',',color,',') like '%,".$arr_color[$i1].",%'".$con11.$con1);
|
||||
$n1+=$tmp["num"];
|
||||
}
|
||||
$xj_z_sku=$n1;
|
||||
}else{
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ".$s_group_by1."='".$m4["no"]."'".$con11.$con1);
|
||||
$xj_z_ks=$tmp["num"];
|
||||
//取得小计设计款色数
|
||||
$xj_z_sku=0;
|
||||
$q2="select no,color,color_ka from ".$table_pre."kh where ".$s_group_by1."='".$m4["no"]."'".$con11.$con1;
|
||||
$r2=$db->query($q2);
|
||||
while($m2=$db->fetch_array($r2)){
|
||||
$arr1=explode(",",$m2["color"]);
|
||||
$arr2=explode(",",$m2["color_ka"]);
|
||||
for($i1=0;$i1<count($arr1);$i1++){
|
||||
if(!in_array($arr1[$i1],$arr2))
|
||||
$xj_z_sku++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
$q="select * from ".$table_pre."keyword where cate='".$s_group_by2."' order by no";
|
||||
//echo $q."<br>";
|
||||
$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',sum(jsje) 'jsje' 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"];
|
||||
$xj_yd_jsje=$tmp["jsje"];
|
||||
//
|
||||
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);
|
||||
$hj_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);
|
||||
$hj_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);
|
||||
$hj_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<count($arr_color);$i1++){
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ka<>'y' and concat(',',color,',') like '%,".$arr_color[$i1].",%' and ".$con12);
|
||||
$n1+=$tmp["num"];
|
||||
}
|
||||
$hj_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);
|
||||
$hj_z_sku=$tmp["num"];
|
||||
}else{
|
||||
$hj_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;
|
||||
$hj_z_sku+=$n1-$n2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$q1="select * from ".$table_pre."keyword where cate='".$s_group_by3."' order by no";
|
||||
//echo $q1."<br>";
|
||||
$r1=$db->query($q1);
|
||||
$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."='".$m["no"]."' and ".$s_group_by1."<>'' and ".$s_group_by2."<>'' and ".$s_group_by3."<>'' ".$con);
|
||||
$hj_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_by2."='".$m["no"]."' and ".$s_group_by1."<>'' and ".$s_group_by2."<>'' and ".$s_group_by3."<>'' ".$con);
|
||||
$hj_yd_sku=$tmp["num"];
|
||||
//取得已订小计件数和金额
|
||||
$tmp=get_db_msg("select sum(num) 'num',sum(je) 'je',sum(jsje) 'jsje' from ".$table_pre."order where ".$s_group_by1."='".$m4["no"]."' and ".$s_group_by2."='".$m["no"]."' and ".$s_group_by1."<>'' and ".$s_group_by2."<>'' and ".$s_group_by3."<>'' ".$con);
|
||||
$hj_yd_js=$tmp["num"];
|
||||
$hj_yd_je=$tmp["je"];
|
||||
$hj_yd_jsje=$tmp["jsje"];
|
||||
//
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by3!="sx" && $s_group_by1!="color" && $s_group_by2!="color" && $s_group_by3!="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"]."' and ".$s_group_by3."='".$m1["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"]."' and ".$s_group_by3."='".$m1["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 ".$s_group_by3."='".$m1["no"]."' and concat(',',color,',') like '%,".$m["no"].",%'".$con1);
|
||||
else if($s_group_by3=="color")
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ".$s_group_by1."='".$m4["no"]."' and ".$s_group_by2."='".$m["no"]."' and concat(',',color,',') like '%,".$m1["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"]."' and ".$s_group_by3."='".$m1["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"]."' and ".$s_group_by3."='".$m1["no"]."'".$con);
|
||||
$tmp_yd_sku=$tmp["num"];
|
||||
if($s_group_by1=="sx" || $s_group_by2=="sx" || $s_group_by3=="sx"){
|
||||
if($s_group_by1=="sx"){
|
||||
$con11=" no='".$m4["no"]."'";
|
||||
$con12=$s_group_by2."='".$m["no"]."' and ".$s_group_by3."='".$m1["no"]."'";
|
||||
}else if($s_group_by2=="sx"){
|
||||
$con11=" no='".$m["no"]."'";
|
||||
$con12=$s_group_by1."='".$m4["no"]."' and ".$s_group_by3."='".$m1["no"]."'";
|
||||
}else{
|
||||
$con11=" no='".$m1["no"]."'";
|
||||
$con12=$s_group_by1."='".$m4["no"]."' and ".$s_group_by2."='".$m["no"]."'";
|
||||
}
|
||||
//取得设计款色
|
||||
$tmp=get_db_msg("select * from ".$table_pre."sx where ".$con11);
|
||||
$arr_color=explode(",",$tmp["_v"]);
|
||||
$n1=0;
|
||||
for($i1=0;$i1<count($arr_color);$i1++){
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ka<>'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" || $s_group_by3=="color"){
|
||||
if($s_group_by1=="color"){
|
||||
$con11=$m4["no"];
|
||||
$con12=$s_group_by2."='".$m["no"]."' and ".$s_group_by3."='".$m1["no"]."'";
|
||||
}else if($s_group_by2=="color"){
|
||||
$con11=$m["no"];
|
||||
$con12=$s_group_by1."='".$m4["no"]."' and ".$s_group_by3."='".$m1["no"]."'";
|
||||
}else{
|
||||
$con11=$m1["no"];
|
||||
$con12=$s_group_by1."='".$m4["no"]."' and ".$s_group_by2."='".$m["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"]."' and ".$s_group_by3."='".$m1["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',sum(jsje) 'jsje' from ".$table_pre."order where id>0 and ".$s_group_by1."='".$m4["no"]."' and ".$s_group_by2."='".$m["no"]."' and ".$s_group_by3."='".$m1["no"]."'".$con);
|
||||
$tmp_yd_js=$tmp["num"];
|
||||
$tmp_yd_je=$tmp["je"];
|
||||
$tmp_yd_jsje=$tmp["jsje"];
|
||||
//
|
||||
if($tmp_z_sku>0){
|
||||
$content_data.="<tr align=center>";
|
||||
$content_data.="<td>".$m4["title"]."</td>";
|
||||
$content_data.="<td>".$m["title"]."</td>";
|
||||
$content_data.="<td>".$m1["title"]."</td>";
|
||||
if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by3!="sx" && $s_group_by1!="color" && $s_group_by2!="color" && $s_group_by3!="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"]."' and ".$s_group_by3."='".$m1["no"]."'".$con1);
|
||||
$content_data.=($head_zd1=="y")?"<td>".keep_float($tmp["jj"],1)."</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td>".$tmp_z_ks."</td><td>".deel_bfb($tmp_z_ks,$hj_z_ks)."</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>".$tmp_yd_ks."</td><td>".deel_bfb($tmp_yd_ks,$hj_yd_ks)."</td>":"";
|
||||
}
|
||||
$content_data.=($head_zd4=="y")?"<td>".$tmp_z_sku."</td><td>".deel_bfb($tmp_z_sku,$hj_z_sku)."</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>".$tmp_yd_sku."</td><td>".deel_bfb($tmp_yd_sku,$hj_yd_sku)."</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>".deel_01(deel_num($tmp_yd_js))."</td><td>".deel_bfb($tmp_yd_js,$hj_yd_js)."</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>".deel_01(deel_num($tmp_yd_je))."</td><td>".deel_bfb($tmp_yd_je,$hj_yd_je)."</td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td>".deel_01(deel_num($tmp_yd_jsje))."</td><td>".deel_bfb($tmp_yd_jsje,$hj_yd_jsje)."</td>":"";
|
||||
$content_data.="</tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
if($hj_z_sku>0){
|
||||
$content_data.="<tr align=center style='background-color:#f2f2f2'>";
|
||||
$content_data.="<td></td><td>".$m["title"]."小计</td><td></td>";
|
||||
if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by3!="sx" && $s_group_by1!="color" && $s_group_by2!="color" && $s_group_by3!="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"]."' and ".$s_group_by3."<>''".$con1);
|
||||
$content_data.=($head_zd1=="y")?"<td>".keep_float($tmp["jj"],1)."</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td>".$hj_z_ks."</td><td>".deel_bfb($hj_z_ks,$total_ks)."</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>".$hj_yd_ks."</td><td>".deel_bfb($hj_yd_ks,$total_yd_ks)."</td>":"";
|
||||
}
|
||||
$content_data.=($head_zd4=="y")?"<td>".$hj_z_sku."</td><td>".deel_bfb($hj_z_sku,$total_sku)."</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>".$hj_yd_sku."</td><td>".deel_bfb($hj_yd_sku,$total_yd_sku)."</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>".deel_num($hj_yd_js)."</td><td>".deel_bfb($hj_yd_js,$total_yd_js)."</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>".deel_num($hj_yd_je)."</td><td>".deel_bfb($hj_yd_je,$total_yd_je)."</td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td>".deel_num($hj_yd_jsje)."</td><td>".deel_bfb($hj_yd_jsje,$total_yd_jsje)."</td>":"";
|
||||
$content_data.="</tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
if($xj_z_sku>0){
|
||||
$content_data.="<tr align=center style='background-color:#f2f2f2'>";
|
||||
$content_data.="<td>".$m4["title"]."小计</td><td></td><td></td>";
|
||||
if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by3!="sx" && $s_group_by1!="color" && $s_group_by2!="color" && $s_group_by3!="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.=($head_zd1=="y")?"<td>".keep_float($tmp["jj"],1)."</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td>".$xj_z_ks."</td><td>".deel_bfb($xj_z_ks,$total_ks)."</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>".$xj_yd_ks."</td><td>".deel_bfb($xj_yd_ks,$total_yd_ks)."</td>":"";
|
||||
}
|
||||
$content_data.=($head_zd4=="y")?"<td>".$xj_z_sku."</td><td>".deel_bfb($xj_z_sku,$total_sku)."</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>".$xj_yd_sku."</td><td>".deel_bfb($xj_yd_sku,$total_yd_sku)."</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>".deel_num($xj_yd_js)."</td><td>".deel_bfb($xj_yd_js,$total_yd_js)."</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>".deel_num($xj_yd_je)."</td><td>".deel_bfb($xj_yd_je,$total_yd_je)."</td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td>".deel_num($xj_yd_jsje)."</td><td>".deel_bfb($xj_yd_jsje,$total_yd_jsje)."</td>":"";
|
||||
$content_data.="</tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
$content_data.="</tbody>";
|
||||
//
|
||||
$content_data.="<tfoot>";
|
||||
$content_data.="<tr style='background-color:#f2f2f2' align=center>";
|
||||
$content_data.="<td colspan=3>合计</td>";
|
||||
|
||||
if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by3!="sx" && $s_group_by1!="color" && $s_group_by2!="color" && $s_group_by3!="color"){
|
||||
$content_data.=($head_zd1=="y")?"<td>".$price_jj."</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td>".$total_ks."</td><td></td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>".deel_num($total_yd_ks)."</td><td></td>":"";
|
||||
}
|
||||
|
||||
$content_data.=($head_zd4=="y")?"<td>".deel_num($total_sku)."</td><td></td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>".deel_num($total_yd_sku)."</td><td></td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>".deel_num($total_yd_js)."</td><td></td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>".deel_num($total_yd_je)."</td><td></td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td>".deel_num($total_yd_jsje)."</td><td></td>":"";
|
||||
|
||||
$content_data.="</tr>";
|
||||
$content_data.="</tfoot>";
|
||||
$content_data.="</table>";
|
||||
}
|
||||
$json_data.="\"table_html\":\"".$content_data."\",";
|
||||
?>
|
||||
@@ -0,0 +1,206 @@
|
||||
<?php
|
||||
//颜色报表
|
||||
//可配置参数:zd1|color|字段1,icon|menu_icon_bb_xw_ms|菜单图标,select_zd1||搜索1,select_zd2||搜索2,select_zd3||搜索3
|
||||
//2020-07-10 by hzz
|
||||
//-----参数配置start
|
||||
//菜单图标
|
||||
$icon=get_plugin_set("icon","menu_icon_bb_xw_ms");//支持以下目录的图标ipad/images/menu_icon_*.png
|
||||
//字段
|
||||
$zd1=get_plugin_set("zd1","color");
|
||||
|
||||
//
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
|
||||
$s_key=$s_key?$s_key:$_key;
|
||||
//搜索
|
||||
$search_arr=array();
|
||||
$searh_select1=get_plugin_set("select_zd1","");
|
||||
$searh_select2=get_plugin_set("select_zd2","");
|
||||
$searh_select3=get_plugin_set("select_zd3","");
|
||||
array_push($search_arr,$searh_select1,$searh_select2,$searh_select3);
|
||||
|
||||
//
|
||||
$str_select="";
|
||||
for($i=0;$i<count($search_arr);$i++){
|
||||
$arr_val=$search_arr[$i];
|
||||
if($arr_val){
|
||||
if($arr_val=="s_spk"){
|
||||
$str_select.="{\"name\":\"s_spk\",\"title\":\"是否饰品款\",\"value\":\"".$s_spk."\",\"op\":[{\"no\":\"y\",\"title\":\"是\"},{\"no\":\"n\",\"title\":\"否\"}]},";
|
||||
}else if($arr_val=="s_ka"){
|
||||
$str_select.="{\"name\":\"s_ka\",\"title\":\"是否删除款\",\"value\":\"".$s_ka."\",\"op\":[{\"no\":\"y\",\"title\":\"是\"},{\"no\":\"n\",\"title\":\"否\"}]},";
|
||||
}else{
|
||||
$str_op="";
|
||||
$sql_select="select no,title from web_keyword where cate='".$arr_val."' order by ord";
|
||||
$res_select=$db->query($sql_select);
|
||||
while($msg_select=$db->fetch_array($res_select)){
|
||||
$str_op.="{\"no\":\"".$msg_select["no"]."\",\"title\":\"".$msg_select["title"]."\"},";
|
||||
}
|
||||
$str_select.="{\"name\":\"".$arr_val."\",\"title\":\"".get_cate_title_no("arr_select",$arr_val)."\",\"value\":\"".$$arr_val."\",\"op\":[".substr($str_op,0,-1)."]},";
|
||||
}
|
||||
}
|
||||
}
|
||||
$json_data.="\"select_report\":[".substr($str_select,0,-1)."],";
|
||||
//end
|
||||
|
||||
//-------------------------条件
|
||||
//-------con为web_order
|
||||
//-------con1为web_kh
|
||||
$con=$con1="";
|
||||
if($searh_select1!="s_ka" && $searh_select2!="s_ka" && $searh_select3!="s_ka"){
|
||||
//没有删除款搜索时
|
||||
$con.=" and ka<>'y' ";
|
||||
$con1.=" and ka<>'y' ";
|
||||
}else{
|
||||
if($s_ka){
|
||||
$con.=" and ka='".$s_ka."' ";
|
||||
$con1.=" and ka='".$s_ka."' ";
|
||||
}
|
||||
}
|
||||
if($searh_select1!="s_spk" && $searh_select2!="s_spk" && $searh_select3!="s_spk"){
|
||||
//没有饰品款搜索时
|
||||
$con.=" and is_sp<>'y' ";
|
||||
$con1.=" and is_sp<>'y' ";
|
||||
}else{
|
||||
if($s_spk){
|
||||
$con.=" and is_sp='".$s_spk."' ";
|
||||
$con1.=" and is_sp='".$s_spk."' ";
|
||||
}
|
||||
}
|
||||
if($s_key){
|
||||
if($s_key=="all"){
|
||||
$con.="";
|
||||
}else{
|
||||
$con.=" and _key='".$s_key."'";
|
||||
}
|
||||
}
|
||||
//其他
|
||||
for($i=0;$i<count($search_arr);$i++){
|
||||
$arr_val=$search_arr[$i];
|
||||
if($arr_val && $arr_val!="s_spk" && $arr_val!="s_ka"){
|
||||
if($$arr_val){
|
||||
$con.=" and ".$arr_val."='".$$arr_val."' ";
|
||||
$con1.=" and ".$arr_val."='".$$arr_val."' ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//店铺查询条件
|
||||
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==""){
|
||||
//请求数据有误
|
||||
$content_data="<div align='center'>请先配置参数!</div>";
|
||||
$json_data.="\"sys_bb_type\":\"report_null\",";
|
||||
}else{
|
||||
//---------------------------------------一维报表
|
||||
$json_data.="\"sys_bb_type\":\"report_1w\",";
|
||||
$s_group_by=$zd1;
|
||||
|
||||
//取得总款数
|
||||
$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;$i1<count($arr1);$i1++){
|
||||
if($s_ka=="y"){
|
||||
if(in_array($arr1[$i1],$arr2))
|
||||
$total_sku++;
|
||||
}else{
|
||||
if(!in_array($arr1[$i1],$arr2))
|
||||
$total_sku++;
|
||||
}
|
||||
}
|
||||
}
|
||||
//取得已订总件数和金额
|
||||
$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"];
|
||||
//取得已订总款色数
|
||||
$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.="<table id='tabledetail' class='cell-border nowrap' width='100%' lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' class='layui-table'>";
|
||||
$content_data.="<thead><tr style='background-color:#f2f2f2' align=center><td rowspan=2>颜色</td><td colspan=2>设计款色</td><td colspan=2>已订款色</td><td colspan=2>已订件数</td><td colspan=2>吊牌金额</td></tr>";
|
||||
$content_data.="<tr style='background-color:#f2f2f2' align=center><td>款数</td><td>占比</td><td>款数</td><td>占比</td><td>件数</td><td>占比</td><td>金额</td><td>占比</td></tr>";
|
||||
$content_data.="</thead>";
|
||||
$content_data.="<tbody>";
|
||||
//
|
||||
$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++;
|
||||
}
|
||||
}
|
||||
//
|
||||
if($msg_client["face"]=="4"){
|
||||
$content_data.="<tr align=center><td><a style='color:blue;' href='javascript:void(0);' onclick=go_dkhtml({'s_".$s_group_by."':'".$m["no"]."'})>".$m["title"]."</a></td><td>".$tmp_z_sku."</td><td>".deel_bfb($tmp_z_sku,$total_sku)."</td><td>".$tmp_yd_sku."</td><td>".deel_bfb($tmp_yd_sku,$total_yd_sku)."</td><td>".deel_01($m1["num"])."</td><td>".deel_bfb($m1["num"],$total_yd_js)."</td><td>".deel_01($m1["je"])."</td><td>".deel_bfb($m1["je"],$total_yd_je)."</td></tr>";
|
||||
}else{
|
||||
$content_data.="<tr align=center><td>".$m["title"]."</td><td>".$tmp_z_sku."</td><td>".deel_bfb($tmp_z_sku,$total_sku)."</td><td>".$tmp_yd_sku."</td><td>".deel_bfb($tmp_yd_sku,$total_yd_sku)."</td><td>".deel_01($m1["num"])."</td><td>".deel_bfb($m1["num"],$total_yd_js)."</td><td>".deel_01($m1["je"])."</td><td>".deel_bfb($m1["je"],$total_yd_je)."</td></tr>";
|
||||
}
|
||||
//
|
||||
$tb_data_x.=$m["title"].",";
|
||||
$tb_data_y.=str_replace("%","",deel_bfb($m1["num"],$total_yd_js)).",";
|
||||
}
|
||||
$content_data.="</tbody>";
|
||||
$content_data.="<tfoot>";
|
||||
$content_data.="<tr align=center style='background-color:#f2f2f2'><td>合计</td><td>".$total_sku."</td><td></td><td>".$total_yd_sku."</td><td></td><td>".$total_num."</td><td></td><td>".$total_money."</td><td></td></tr>";
|
||||
$content_data.="</tfoot>";
|
||||
$content_data.="</table>";
|
||||
|
||||
//图
|
||||
$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."\",";
|
||||
?>
|
||||
@@ -0,0 +1,299 @@
|
||||
<?php
|
||||
//1维指标分析
|
||||
//可配置参数:keyword_zd1|category|字段1,icon|menu_icon_bb_xw_ms|菜单图标,select_zd1||搜索1,select_zd2||搜索2,select_zd3||搜索3,head_zd1|y|数量,head_zd2|y|吊牌金额,head_zd3|y|结算金额,head_zd4|y|款色数,head_zd5|y|金额指标,head_zd6|n|件数指标,head_zd7|n|款色指标
|
||||
//-----参数配置start
|
||||
//菜单图标
|
||||
$icon=get_plugin_set("icon","menu_icon_bb_xw_ms");//支持以下目录的图标ipad/images/menu_icon_*.png
|
||||
//字段
|
||||
$zd1=get_plugin_set("keyword_zd1","category");
|
||||
//指标数据指向表
|
||||
$data_name=$table_pre."plugin_report_khzb_1w";
|
||||
//区域代理指标合计店铺
|
||||
$count_by_dp="y";
|
||||
//表头
|
||||
$head_zd1=get_plugin_set("head_zd1","y");
|
||||
$head_zd2=get_plugin_set("head_zd2","y");
|
||||
$head_zd3=get_plugin_set("head_zd3","y");
|
||||
$head_zd4=get_plugin_set("head_zd4","y");
|
||||
$head_zd5=get_plugin_set("head_zd5","y");
|
||||
$head_zd6=get_plugin_set("head_zd6","n");
|
||||
$head_zd7=get_plugin_set("head_zd7","n");
|
||||
|
||||
$arr_sx=array("3"=>"代理","4"=>"店铺","9"=>"区域");
|
||||
//
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
|
||||
$s_key=$s_key?$s_key:$_key;
|
||||
//搜索
|
||||
$search_arr=array();
|
||||
$searh_select1=get_plugin_set("select_zd1","");
|
||||
$searh_select2=get_plugin_set("select_zd2","");
|
||||
$searh_select3=get_plugin_set("select_zd3","");
|
||||
array_push($search_arr,$searh_select1,$searh_select2,$searh_select3);
|
||||
|
||||
//
|
||||
$str_select="";
|
||||
for($i=0;$i<count($search_arr);$i++){
|
||||
$arr_val=$search_arr[$i];
|
||||
if($arr_val){
|
||||
if($arr_val=="s_spk"){
|
||||
$str_select.="{\"name\":\"s_spk\",\"title\":\"是否饰品款\",\"value\":\"".$s_spk."\",\"op\":[{\"no\":\"y\",\"title\":\"是\"},{\"no\":\"n\",\"title\":\"否\"}]},";
|
||||
}else if($arr_val=="s_ka"){
|
||||
$str_select.="{\"name\":\"s_ka\",\"title\":\"是否删除款\",\"value\":\"".$s_ka."\",\"op\":[{\"no\":\"y\",\"title\":\"是\"},{\"no\":\"n\",\"title\":\"否\"}]},";
|
||||
}else{
|
||||
$str_op="";
|
||||
$sql_select="select no,title from web_keyword where cate='".$arr_val."' order by ord";
|
||||
$res_select=$db->query($sql_select);
|
||||
while($msg_select=$db->fetch_array($res_select)){
|
||||
$str_op.="{\"no\":\"".$msg_select["no"]."\",\"title\":\"".$msg_select["title"]."\"},";
|
||||
}
|
||||
$str_select.="{\"name\":\"".$arr_val."\",\"title\":\"".get_cate_title_no("arr_select",$arr_val)."\",\"value\":\"".$$arr_val."\",\"op\":[".substr($str_op,0,-1)."]},";
|
||||
}
|
||||
}
|
||||
}
|
||||
$json_data.="\"select_report\":[".substr($str_select,0,-1)."],";
|
||||
//end
|
||||
|
||||
//-------------------------条件
|
||||
//-------con为web_order
|
||||
//-------con1为web_kh
|
||||
$con=$con1=$con_zb=$con_u="";
|
||||
if($searh_select1!="s_ka" && $searh_select2!="s_ka" && $searh_select3!="s_ka"){
|
||||
//没有删除款搜索时
|
||||
$con.=" and ka<>'y' ";
|
||||
$con1.=" and ka<>'y' ";
|
||||
}else{
|
||||
if($s_ka){
|
||||
$con.=" and ka='".$s_ka."' ";
|
||||
$con1.=" and ka='".$s_ka."' ";
|
||||
}
|
||||
}
|
||||
if($searh_select1!="s_spk" && $searh_select2!="s_spk" && $searh_select3!="s_spk"){
|
||||
//没有饰品款搜索时
|
||||
$con.=" and is_sp<>'y' ";
|
||||
$con1.=" and is_sp<>'y' ";
|
||||
}else{
|
||||
if($s_spk){
|
||||
$con.=" and is_sp='".$s_spk."' ";
|
||||
$con1.=" and is_sp='".$s_spk."' ";
|
||||
}
|
||||
}
|
||||
if($s_key){
|
||||
if($s_key=="all"){
|
||||
$con.="";
|
||||
}else{
|
||||
$con.=" and _key='".$s_key."'";
|
||||
}
|
||||
}
|
||||
//其他
|
||||
for($i=0;$i<count($search_arr);$i++){
|
||||
$arr_val=$search_arr[$i];
|
||||
if($arr_val && $arr_val!="s_spk" && $arr_val!="s_ka"){
|
||||
if($$arr_val){
|
||||
$con.=" and ".$arr_val."='".$$arr_val."' ";
|
||||
$con1.=" and ".$arr_val."='".$$arr_val."' ";
|
||||
$con_zb.=" and zd1='".get_cate_title_no($zd1,$$arr_val)."'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//店铺查询条件
|
||||
if($msg_client["face"]=="4"){
|
||||
$s_username=$msg_client["username"];
|
||||
$con.=" and uid='".$msg_client["id"]."'";
|
||||
$con_u.=" and id='".$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"]."'";
|
||||
$con_u.=" and id='".$m2["id"]."'";
|
||||
}else{
|
||||
$con.=" and (upath='".$m2["path"]."-".$m2["id"]."' or upath like '".$m2["path"]."-".$m2["id"]."-%')";
|
||||
$con_u.=" and (id='".$m2["id"]."' or path='".$m2["path"]."-".$m2["id"]."' or path like '".$m2["path"]."-".$m2["id"]."-%')";
|
||||
}
|
||||
}else if($msg_client["face"]=="2"){
|
||||
//区经角色所有客户
|
||||
$con.=get_qj_ucon_all($msg_client["charge_path_real"]);
|
||||
$con_u.="";
|
||||
}else if($msg_client["face"]=="1"){
|
||||
//区经角色所有客户
|
||||
$con_u.="";
|
||||
}else{
|
||||
//代理角色所有客户
|
||||
$con.=" and (upath='".$msg_client["path"]."-".$msg_client["id"]."' or upath like '".$msg_client["path"]."-".$msg_client["id"]."-%')";
|
||||
$con_u.=" and (id='".$msg_client["id"]."' or path='".$msg_client["path"]."-".$msg_client["id"]."' or path like '".$msg_client["path"]."-".$msg_client["id"]."-%')";
|
||||
}
|
||||
}
|
||||
//---------------------------------------------
|
||||
if($zd1==""){
|
||||
//请求数据有误
|
||||
$content_data="<div align='center'>请先配置参数!</div>";
|
||||
$json_data.="\"sys_bb_type\":\"report_null\",";
|
||||
}else{
|
||||
//---------------------------------------一维报表
|
||||
$json_data.="\"sys_bb_type\":\"nochart\",";
|
||||
$s_group_by=$zd1;
|
||||
|
||||
//
|
||||
$content_data="";
|
||||
$content_data.="<table id='tabledetail' class='cell-border nowrap' width='100%' lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' class='layui-table'>";
|
||||
$content_data.="<thead><tr style='background-color:#f2f2f2' align=center><td>客户代码</td>";
|
||||
$content_data.="<td>客户名称</td>";
|
||||
$content_data.=($head_zd1=="y")?"<td>数量</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td>吊牌金额</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>结算金额</td>":"";
|
||||
$content_data.=($head_zd4=="y")?"<td>款色数</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>金额指标</td><td>金额完成率</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>件数指标</td><td>件数完成率</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>款色指标</td><td>款色完成率</td>":"";
|
||||
$content_data.="</tr>";
|
||||
|
||||
$content_data.="</thead>";
|
||||
$content_data.="<tbody>";
|
||||
//
|
||||
$tb_data_x="";
|
||||
$tb_data_y=",";
|
||||
if($s_username){
|
||||
$m3=get_db_msg("select id,face,path from ".$table_pre."client where username='".$s_username."'");
|
||||
$uface=$m3["face"];
|
||||
$uface2=$m3["face"];
|
||||
}else{
|
||||
$uface=$msg_client["face"];
|
||||
}
|
||||
$arr_uid=$arr_qy=$arr_dl=$arr_dp=array();
|
||||
if($uface=="2"){
|
||||
$arr_path=explode(",",$msg_client["charge_path"]);
|
||||
}else{
|
||||
$q="select id,path from ".$table_pre."client where available='y'".$con_u;
|
||||
//echo $q;
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_path[]=$m["path"]."-".$m["id"];
|
||||
}
|
||||
}
|
||||
foreach($arr_path as $key => $value){
|
||||
$arr_id=explode("-",$value);
|
||||
$tmp_client=get_db_msg("select id,face from ".$table_pre."client where id='".end($arr_id)."'");
|
||||
if($tmp_client["face"]=='4'){
|
||||
$arr_dp[$tmp_client["id"]]=$value;
|
||||
}
|
||||
}
|
||||
foreach($arr_dp as $key1 => $value1){
|
||||
$arr_id_tmp=explode("-",$value1);
|
||||
$check_dl=$check_qy=0;
|
||||
foreach($arr_id_tmp as $key2 => $value2){
|
||||
$m1=get_db_msg("select id,face from ".$table_pre."client where id='".$value2."'");
|
||||
if($m1["face"]=="3"){
|
||||
$dlid=$value2;
|
||||
$check_dl++;
|
||||
}
|
||||
}
|
||||
foreach($arr_id_tmp as $key2 => $value2){
|
||||
$m1=get_db_msg("select id,face from ".$table_pre."client where id='".$value2."'");
|
||||
if($m1["face"]=="9"){
|
||||
$qyid=$value2;
|
||||
$check_qy++;
|
||||
}
|
||||
}
|
||||
if($uface=="3"){
|
||||
$check_qy=0;
|
||||
}
|
||||
if($uface=="4"){
|
||||
$check_qy=0;
|
||||
$check_dl=0;
|
||||
}
|
||||
if($check_dl!=0 && $check_qy!=0){
|
||||
$arr_uid_tmp[$qyid][$dlid][$key1]=$value1;
|
||||
}else if($check_dl!=0 && $check_qy==0){
|
||||
$arr_uid_tmp["0"][$dlid][$key1]=$value1;
|
||||
}else if($check_dl==0 && $check_qy!=0){
|
||||
$arr_uid_tmp[$qyid]["0"][$key1]=$value1;
|
||||
}else if($check_dl==0 && $check_qy==0){
|
||||
$arr_uid_tmp["0"]["0"][$key1]=$value1;
|
||||
}
|
||||
}
|
||||
$arr_uid=$arr_uid_tmp;
|
||||
$tbody_str="";
|
||||
foreach($arr_uid as $k1 => $v1){
|
||||
$tmp_client1=get_db_msg("select * from ".$table_pre."client where id='".$k1."'");
|
||||
$upath1=" and (upath='".$tmp_client1["path"]."-".$tmp_client1["id"]."' or upath like '".$tmp_client1["path"]."-".$tmp_client1["id"]."-%')";
|
||||
if($count_by_dp=="y"){
|
||||
$count_con1=$upath1;
|
||||
}else{
|
||||
$count_con1=" and uid='".$k1."'";
|
||||
}
|
||||
if($tmp_client1["id"]){
|
||||
$tmp_zb1=get_db_msg("select sum(zb) zb,sum(zb_js) zb_js,sum(zb_skc) zb_skc from ".$data_name." where id>0".$count_con1.$con_zb);
|
||||
$tmp_order1=get_db_msg("select sum(num) num,sum(je) je,sum(jsje) jsje,count(distinct no,color) skc from ".$table_pre."order where id>0".$upath1.$con1);
|
||||
$content_data.="<td>".$tmp_client1["username"]."</td><td>".$tmp_client1["title"]."<span style='color:red;'>(".$arr_sx[$tmp_client1["face"]].")</span>"."</td>";
|
||||
$content_data.=($head_zd1=="y")?"<td>".$tmp_order1["num"]."</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td>".$tmp_order1["je"]."</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>".$tmp_order1["jsje"]."</td>":"";
|
||||
$content_data.=($head_zd4=="y")?"<td>".$tmp_order1["skc"]."</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>".$tmp_zb1["zb"]."</td><td>".deel_bfb($tmp_order1["je"],$tmp_zb1["zb"])."</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>".deel_01($tmp_zb1["zb_js"])."</td><td>".deel_bfb($tmp_order1["num"],$tmp_zb1["zb_js"])."</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>".deel_01($tmp_zb1["zb_skc"])."</td><td>".deel_bfb($tmp_order1["skc"],$tmp_zb1["skc"])."</td>":"";
|
||||
$content_data.="</tr>";
|
||||
}
|
||||
foreach($v1 as $k2 => $v2){
|
||||
$tmp_client2=get_db_msg("select * from ".$table_pre."client where id='".$k2."'");
|
||||
$upath2=" and (upath='".$tmp_client2["path"]."-".$tmp_client2["id"]."' or upath like '".$tmp_client2["path"]."-".$tmp_client2["id"]."-%')";
|
||||
if($count_by_dp=="y"){
|
||||
$count_con2=$upath2;
|
||||
}else{
|
||||
$count_con2=" and uid='".$k2."'";
|
||||
}
|
||||
if($tmp_client2["id"]){
|
||||
$tmp_zb2=get_db_msg("select sum(zb) zb,sum(zb_js) zb_js,sum(zb_skc) zb_skc from ".$data_name." where id>0".$count_con2.$con_zb);
|
||||
$tmp_order2=get_db_msg("select sum(num) num,sum(je) je,sum(jsje) jsje,count(distinct no,color) skc from ".$table_pre."order where id>0".$upath2.$con1);
|
||||
$content_data.="<td>".$tmp_client2["username"]."</td><td>".$tmp_client2["title"]."<span style='color:red;'>(".$arr_sx[$tmp_client2["face"]].")</span>"."</td>";
|
||||
$content_data.=($head_zd1=="y")?"<td>".$tmp_order2["num"]."</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td>".$tmp_order2["je"]."</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>".$tmp_order2["jsje"]."</td>":"";
|
||||
$content_data.=($head_zd4=="y")?"<td>".$tmp_order2["skc"]."</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>".$tmp_zb2["zb"]."</td><td>".deel_bfb($tmp_order2["je"],$tmp_zb2["zb"])."</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>".deel_01($tmp_zb2["zb_js"])."</td><td>".deel_bfb($tmp_order2["num"],$tmp_zb2["zb_js"])."</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>".deel_01($tmp_zb2["zb_skc"])."</td><td>".deel_bfb($tmp_order2["skc"],$tmp_zb2["skc"])."</td>":"";
|
||||
$content_data.="</tr>";
|
||||
}
|
||||
foreach($v2 as $k3 => $v3){
|
||||
$tmp_client3=get_db_msg("select * from ".$table_pre."client where id='".$k3."'");
|
||||
$upath3=" and (upath='".$tmp_client3["path"]."-".$tmp_client3["id"]."' or upath like '".$tmp_client3["path"]."-".$tmp_client3["id"]."-%')";
|
||||
if($count_by_dp=="y"){
|
||||
$count_con3=$upath3;
|
||||
}else{
|
||||
$count_con3=" and uid='".$k3."'";
|
||||
}
|
||||
if($tmp_client3["id"]){
|
||||
$tmp_zb3=get_db_msg("select sum(zb) zb,sum(zb_js) zb_js,sum(zb_skc) zb_skc from ".$data_name." where id>0".$count_con3.$con_zb);
|
||||
//echo "select sum(zb) zb,sum(zb_js) zb_js,sum(zb_skc) zb_skc from ".$data_name." where id>0".$count_con3.$con_zb.";<br>";
|
||||
$tmp_order3=get_db_msg("select sum(num) num,sum(je) je,sum(jsje) jsje,count(distinct no,color) skc from ".$table_pre."order where id>0".$upath3.$con1);
|
||||
$content_data.="<td>".$tmp_client3["username"]."</td><td>".$tmp_client3["title"]."<span style='color:red;'>(".$arr_sx[$tmp_client3["face"]].")</span>"."</td>";
|
||||
$content_data.=($head_zd1=="y")?"<td>".$tmp_order3["num"]."</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td>".$tmp_order3["je"]."</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>".$tmp_order3["jsje"]."</td>":"";
|
||||
$content_data.=($head_zd4=="y")?"<td>".$tmp_order3["skc"]."</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>".$tmp_zb3["zb"]."</td><td>".deel_bfb($tmp_order3["je"],$tmp_zb3["zb"])."</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>".deel_01($tmp_zb3["zb_js"])."</td><td>".deel_bfb($tmp_order3["num"],$tmp_zb3["zb_js"])."</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>".deel_01($tmp_zb3["zb_skc"])."</td><td>".deel_bfb($tmp_order3["skc"],$tmp_zb3["skc"])."</td>":"";
|
||||
$content_data.="</tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$content_data.="</tbody>";
|
||||
$content_data.="</table>";
|
||||
|
||||
//图
|
||||
$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."\",";
|
||||
?>
|
||||
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
//款色深度报表
|
||||
//可配置参数:zd1|ks_size|字段1,icon|menu_icon_bb_xw_ms|菜单图标,select_zd1||搜索1,select_zd2||搜索2,select_zd3||搜索3
|
||||
//2020-07-10 by hzz
|
||||
//-----参数配置start
|
||||
//菜单图标
|
||||
$icon=get_plugin_set("icon","menu_icon_bb_xw_ms");//支持以下目录的图标ipad/images/menu_icon_*.png
|
||||
//字段
|
||||
$zd1=get_plugin_set("zd1","ks_size");
|
||||
|
||||
//
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
|
||||
$s_key=$s_key?$s_key:$_key;
|
||||
//搜索
|
||||
$search_arr=array();
|
||||
$searh_select1=get_plugin_set("select_zd1","");
|
||||
$searh_select2=get_plugin_set("select_zd2","");
|
||||
$searh_select3=get_plugin_set("select_zd3","");
|
||||
array_push($search_arr,$searh_select1,$searh_select2,$searh_select3);
|
||||
|
||||
//
|
||||
$str_select="";
|
||||
for($i=0;$i<count($search_arr);$i++){
|
||||
$arr_val=$search_arr[$i];
|
||||
if($arr_val){
|
||||
if($arr_val=="s_spk"){
|
||||
$str_select.="{\"name\":\"s_spk\",\"title\":\"是否饰品款\",\"value\":\"".$s_spk."\",\"op\":[{\"no\":\"y\",\"title\":\"是\"},{\"no\":\"n\",\"title\":\"否\"}]},";
|
||||
}else if($arr_val=="s_ka"){
|
||||
$str_select.="{\"name\":\"s_ka\",\"title\":\"是否删除款\",\"value\":\"".$s_ka."\",\"op\":[{\"no\":\"y\",\"title\":\"是\"},{\"no\":\"n\",\"title\":\"否\"}]},";
|
||||
}else{
|
||||
$str_op="";
|
||||
$sql_select="select no,title from web_keyword where cate='".$arr_val."' order by ord";
|
||||
$res_select=$db->query($sql_select);
|
||||
while($msg_select=$db->fetch_array($res_select)){
|
||||
$str_op.="{\"no\":\"".$msg_select["no"]."\",\"title\":\"".$msg_select["title"]."\"},";
|
||||
}
|
||||
$str_select.="{\"name\":\"".$arr_val."\",\"title\":\"".get_cate_title_no("arr_select",$arr_val)."\",\"value\":\"".$$arr_val."\",\"op\":[".substr($str_op,0,-1)."]},";
|
||||
}
|
||||
}
|
||||
}
|
||||
$json_data.="\"select_report\":[".substr($str_select,0,-1)."],";
|
||||
//end
|
||||
|
||||
//-------------------------条件
|
||||
//-------con为web_order
|
||||
//-------con1为web_kh
|
||||
$con=$con1="";
|
||||
if($searh_select1!="s_ka" && $searh_select2!="s_ka" && $searh_select3!="s_ka"){
|
||||
//没有删除款搜索时
|
||||
$con.=" and ka<>'y' ";
|
||||
$con1.=" and ka<>'y' ";
|
||||
}else{
|
||||
if($s_ka){
|
||||
$con.=" and ka='".$s_ka."' ";
|
||||
$con1.=" and ka='".$s_ka."' ";
|
||||
}
|
||||
}
|
||||
if($searh_select1!="s_spk" && $searh_select2!="s_spk" && $searh_select3!="s_spk"){
|
||||
//没有饰品款搜索时
|
||||
$con.=" and is_sp<>'y' ";
|
||||
$con1.=" and is_sp<>'y' ";
|
||||
}else{
|
||||
if($s_spk){
|
||||
$con.=" and is_sp='".$s_spk."' ";
|
||||
$con1.=" and is_sp='".$s_spk."' ";
|
||||
}
|
||||
}
|
||||
if($s_key){
|
||||
if($s_key=="all"){
|
||||
$con.="";
|
||||
}else{
|
||||
$con.=" and _key='".$s_key."'";
|
||||
}
|
||||
}
|
||||
//其他
|
||||
for($i=0;$i<count($search_arr);$i++){
|
||||
$arr_val=$search_arr[$i];
|
||||
if($arr_val && $arr_val!="s_spk" && $arr_val!="s_ka"){
|
||||
if($$arr_val){
|
||||
$con.=" and ".$arr_val."='".$$arr_val."' ";
|
||||
$con1.=" and ".$arr_val."='".$$arr_val."' ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//店铺查询条件
|
||||
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==""){
|
||||
//请求数据有误
|
||||
$content_data="<div align='center'>请先配置参数!</div>";
|
||||
$json_data.="\"sys_bb_type\":\"report_null\",";
|
||||
}else{
|
||||
//---------------------------------------一维报表
|
||||
$json_data.="\"sys_bb_type\":\"report_1w\",";
|
||||
$s_group_by=$zd1;
|
||||
|
||||
//取得已订款色数
|
||||
$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.="<table id='tabledetail' class='cell-border nowrap' width='100%' lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' class='layui-table'>";
|
||||
$content_data.="<thead><tr style='background-color:#f2f2f2' align=center><td>件数</td><td>款色数</td><td>占比</td></tr>";
|
||||
$content_data.="</thead>";
|
||||
$content_data.="<tbody>";
|
||||
//
|
||||
$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.="<tr align=center><td>".deel_num($m["num"])."</td><td>".$m["kss"]."</td><td>".deel_bfb($m["kss"],$total_kss)."</td></tr>";
|
||||
$count++;
|
||||
$l+=$m["num"]*$m["kss"];
|
||||
}
|
||||
|
||||
//
|
||||
$content_data.="</tbody>";
|
||||
$content_data.="<tfoot>";
|
||||
$content_data.="<tr align=center style='background-color:#f2f2f2'><td>合计(".$l.")</td><td>".$total_kss."</td><td>100%</td></tr>";
|
||||
$content_data.="</tfoot>";
|
||||
$content_data.="</table>";
|
||||
|
||||
//图
|
||||
$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."\",";
|
||||
?>
|
||||
@@ -0,0 +1,181 @@
|
||||
<?php
|
||||
//款色深度二维报表
|
||||
//可配置参数:keyword_zd1|category|字段1,zd2|ks_size|字段2(不变),icon|menu_icon_bb_xw_ms|菜单图标,select_zd1||搜索1,select_zd2||搜索2,select_zd3||搜索3
|
||||
//2020-07-10 by hzz
|
||||
//-----参数配置start
|
||||
//菜单图标
|
||||
$icon=get_plugin_set("icon","menu_icon_bb_xw_ms");//支持以下目录的图标ipad/images/menu_icon_*.png
|
||||
//字段
|
||||
$zd1=get_plugin_set("keyword_zd1","category");
|
||||
$zd2=get_plugin_set("zd2","ks_size");
|
||||
//
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
|
||||
$s_key=$s_key?$s_key:$_key;
|
||||
//搜索
|
||||
$search_arr=array();
|
||||
$searh_select1=get_plugin_set("select_zd1","");
|
||||
$searh_select2=get_plugin_set("select_zd2","");
|
||||
$searh_select3=get_plugin_set("select_zd3","");
|
||||
array_push($search_arr,$searh_select1,$searh_select2,$searh_select3);
|
||||
|
||||
//
|
||||
$str_select="";
|
||||
for($i=0;$i<count($search_arr);$i++){
|
||||
$arr_val=$search_arr[$i];
|
||||
if($arr_val){
|
||||
if($arr_val=="s_spk"){
|
||||
$str_select.="{\"name\":\"s_spk\",\"title\":\"是否饰品款\",\"value\":\"".$s_spk."\",\"op\":[{\"no\":\"y\",\"title\":\"是\"},{\"no\":\"n\",\"title\":\"否\"}]},";
|
||||
}else if($arr_val=="s_ka"){
|
||||
$str_select.="{\"name\":\"s_ka\",\"title\":\"是否删除款\",\"value\":\"".$s_ka."\",\"op\":[{\"no\":\"y\",\"title\":\"是\"},{\"no\":\"n\",\"title\":\"否\"}]},";
|
||||
}else{
|
||||
$str_op="";
|
||||
$sql_select="select no,title from web_keyword where cate='".$arr_val."' order by ord";
|
||||
$res_select=$db->query($sql_select);
|
||||
while($msg_select=$db->fetch_array($res_select)){
|
||||
$str_op.="{\"no\":\"".$msg_select["no"]."\",\"title\":\"".$msg_select["title"]."\"},";
|
||||
}
|
||||
$str_select.="{\"name\":\"".$arr_val."\",\"title\":\"".get_cate_title_no("arr_select",$arr_val)."\",\"value\":\"".$$arr_val."\",\"op\":[".substr($str_op,0,-1)."]},";
|
||||
}
|
||||
}
|
||||
}
|
||||
$json_data.="\"select_report\":[".substr($str_select,0,-1)."],";
|
||||
//end
|
||||
|
||||
//-------------------------条件
|
||||
//-------con为web_order
|
||||
//-------con1为web_kh
|
||||
$con=$con1="";
|
||||
if($searh_select1!="s_ka" && $searh_select2!="s_ka" && $searh_select3!="s_ka"){
|
||||
//没有删除款搜索时
|
||||
$con.=" and ka<>'y' ";
|
||||
$con1.=" and ka<>'y' ";
|
||||
}else{
|
||||
if($s_ka){
|
||||
$con.=" and ka='".$s_ka."' ";
|
||||
$con1.=" and ka='".$s_ka."' ";
|
||||
}
|
||||
}
|
||||
if($searh_select1!="s_spk" && $searh_select2!="s_spk" && $searh_select3!="s_spk"){
|
||||
//没有饰品款搜索时
|
||||
$con.=" and is_sp<>'y' ";
|
||||
$con1.=" and is_sp<>'y' ";
|
||||
}else{
|
||||
if($s_spk){
|
||||
$con.=" and is_sp='".$s_spk."' ";
|
||||
$con1.=" and is_sp='".$s_spk."' ";
|
||||
}
|
||||
}
|
||||
if($s_key){
|
||||
if($s_key=="all"){
|
||||
$con.="";
|
||||
}else{
|
||||
$con.=" and _key='".$s_key."'";
|
||||
}
|
||||
}
|
||||
//其他
|
||||
for($i=0;$i<count($search_arr);$i++){
|
||||
$arr_val=$search_arr[$i];
|
||||
if($arr_val && $arr_val!="s_spk" && $arr_val!="s_ka"){
|
||||
if($$arr_val){
|
||||
$con.=" and ".$arr_val."='".$$arr_val."' ";
|
||||
$con1.=" and ".$arr_val."='".$$arr_val."' ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//店铺查询条件
|
||||
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==""){
|
||||
//请求数据有误
|
||||
$content_data="<div align='center'>请先配置参数!</div>";
|
||||
$json_data.="\"sys_bb_type\":\"report_null\",";
|
||||
}else{
|
||||
//---------------------------------------一维报表
|
||||
$json_data.="\"sys_bb_type\":\"report_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;
|
||||
|
||||
//取得已订总件数和金额
|
||||
$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.="<table id='tabledetail' class='cell-border nowrap' width='100%' lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' class='layui-table'>";
|
||||
$content_data.="<thead><tr style='background-color:#f2f2f2' align=center><td>".get_main_value($arr_group_by_title,$s_group_by1)."</td><td>件数</td><td>款色数</td><td>占比</td></tr>";
|
||||
$content_data.="</thead>";
|
||||
$content_data.="<tbody>";
|
||||
//--------------------------------表头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.="<tr align=center><td>".$m1["title"]."</td><td>".$num1."</td><td>".$kss1."</td><td>".deel_bfb($kss1,$xj_kss)."</td></tr>";
|
||||
$count++;
|
||||
}
|
||||
//小计
|
||||
if($k>0){
|
||||
$content_data.="<tr align=center><td>".$m1["title"]."小计</td><td>".$xj_js."</td><td>".$xj_kss."</td><td>100%</td></tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
$content_data.="</tbody>";
|
||||
$content_data.="<tfoot>";
|
||||
$content_data.="<tr style='background-color:#f2f2f2' align=center><td>合计</td><td>".$total_js."</td><td>".$total_kss."</td><td></td></tr>";
|
||||
$content_data.="</tfoot>";
|
||||
$content_data.="</table>";
|
||||
}
|
||||
$json_data.="\"table_html\":\"".$content_data."\",";
|
||||
?>
|
||||
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
//尺码报表
|
||||
//可配置参数:zd1|size|字段1,icon|menu_icon_bb_xw_ms|菜单图标,select_zd1||搜索1,select_zd2||搜索2,select_zd3||搜索3
|
||||
//2020-07-10 by hzz
|
||||
//-----参数配置start
|
||||
//菜单图标
|
||||
$icon=get_plugin_set("icon","menu_icon_bb_xw_ms");//支持以下目录的图标ipad/images/menu_icon_*.png
|
||||
//字段
|
||||
$zd1=get_plugin_set("zd1","size");
|
||||
|
||||
//
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
|
||||
$s_key=$s_key?$s_key:$_key;
|
||||
//搜索
|
||||
$search_arr=array();
|
||||
$searh_select1=get_plugin_set("select_zd1","");
|
||||
$searh_select2=get_plugin_set("select_zd2","");
|
||||
$searh_select3=get_plugin_set("select_zd3","");
|
||||
array_push($search_arr,$searh_select1,$searh_select2,$searh_select3);
|
||||
|
||||
//
|
||||
$str_select="";
|
||||
for($i=0;$i<count($search_arr);$i++){
|
||||
$arr_val=$search_arr[$i];
|
||||
if($arr_val){
|
||||
if($arr_val=="s_spk"){
|
||||
$str_select.="{\"name\":\"s_spk\",\"title\":\"是否饰品款\",\"value\":\"".$s_spk."\",\"op\":[{\"no\":\"y\",\"title\":\"是\"},{\"no\":\"n\",\"title\":\"否\"}]},";
|
||||
}else if($arr_val=="s_ka"){
|
||||
$str_select.="{\"name\":\"s_ka\",\"title\":\"是否删除款\",\"value\":\"".$s_ka."\",\"op\":[{\"no\":\"y\",\"title\":\"是\"},{\"no\":\"n\",\"title\":\"否\"}]},";
|
||||
}else{
|
||||
$str_op="";
|
||||
$sql_select="select no,title from web_keyword where cate='".$arr_val."' order by ord";
|
||||
$res_select=$db->query($sql_select);
|
||||
while($msg_select=$db->fetch_array($res_select)){
|
||||
$str_op.="{\"no\":\"".$msg_select["no"]."\",\"title\":\"".$msg_select["title"]."\"},";
|
||||
}
|
||||
$str_select.="{\"name\":\"".$arr_val."\",\"title\":\"".get_cate_title_no("arr_select",$arr_val)."\",\"value\":\"".$$arr_val."\",\"op\":[".substr($str_op,0,-1)."]},";
|
||||
}
|
||||
}
|
||||
}
|
||||
$json_data.="\"select_report\":[".substr($str_select,0,-1)."],";
|
||||
//end
|
||||
|
||||
//-------------------------条件
|
||||
//-------con为web_order
|
||||
//-------con1为web_kh
|
||||
$con=$con1="";
|
||||
if($searh_select1!="s_ka" && $searh_select2!="s_ka" && $searh_select3!="s_ka"){
|
||||
//没有删除款搜索时
|
||||
$con.=" and ka<>'y' ";
|
||||
$con1.=" and ka<>'y' ";
|
||||
}else{
|
||||
if($s_ka){
|
||||
$con.=" and ka='".$s_ka."' ";
|
||||
$con1.=" and ka='".$s_ka."' ";
|
||||
}
|
||||
}
|
||||
if($searh_select1!="s_spk" && $searh_select2!="s_spk" && $searh_select3!="s_spk"){
|
||||
//没有饰品款搜索时
|
||||
$con.=" and is_sp<>'y' ";
|
||||
$con1.=" and is_sp<>'y' ";
|
||||
}else{
|
||||
if($s_spk){
|
||||
$con.=" and is_sp='".$s_spk."' ";
|
||||
$con1.=" and is_sp='".$s_spk."' ";
|
||||
}
|
||||
}
|
||||
if($s_key){
|
||||
if($s_key=="all"){
|
||||
$con.="";
|
||||
}else{
|
||||
$con.=" and _key='".$s_key."'";
|
||||
}
|
||||
}
|
||||
//其他
|
||||
for($i=0;$i<count($search_arr);$i++){
|
||||
$arr_val=$search_arr[$i];
|
||||
if($arr_val && $arr_val!="s_spk" && $arr_val!="s_ka"){
|
||||
if($$arr_val){
|
||||
$con.=" and ".$arr_val."='".$$arr_val."' ";
|
||||
$con1.=" and ".$arr_val."='".$$arr_val."' ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//店铺查询条件
|
||||
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==""){
|
||||
//请求数据有误
|
||||
$content_data="<div align='center'>请先配置参数!</div>";
|
||||
$json_data.="\"sys_bb_type\":\"report_null\",";
|
||||
}else{
|
||||
//---------------------------------------一维报表
|
||||
$json_data.="\"sys_bb_type\":\"report_1w\",";
|
||||
$s_group_by=$zd1;
|
||||
|
||||
//取得已订总件数和金额
|
||||
$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.="<table id='tabledetail' class='cell-border nowrap' width='100%' lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' class='layui-table'>";
|
||||
$content_data.="<thead><tr style='background-color:#f2f2f2' align=center><td>尺码组</td><td>尺码</td><td>已订件数</td><td>件数占比</td><td>吊牌金额</td><td>金额占比</td></tr>";
|
||||
$content_data.="</thead>";
|
||||
$content_data.="<tbody>";
|
||||
//
|
||||
$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.="<tr align=center><td>".$m1["title"]."</td><td>".$m["title"]."</td><td>".$arr1[0]."</td><td>".deel_bfb($arr1[0],$total_yd_js)."</td><td>".$arr1[1]."</td><td>".deel_bfb($arr1[1],$total_yd_je)."</td></tr>";
|
||||
$count++;
|
||||
//
|
||||
$tb_data_x.=$m["title"].",";
|
||||
$tb_data_y.=str_replace("%","",deel_bfb($arr1[0],$total_yd_js)).",";
|
||||
}
|
||||
$l++;
|
||||
}
|
||||
$content_data.="</tbody>";
|
||||
$content_data.="<tfoot>";
|
||||
$content_data.="<tr align=center style='background-color:#f2f2f2'><td></td><td></td><td>".$total_num."</td><td></td><td>".$total_money."</td><td></td></tr>";
|
||||
$content_data.="</tfoot>";
|
||||
$content_data.="</table>";
|
||||
|
||||
//图
|
||||
$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."\",";
|
||||
?>
|
||||
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
//尺码二维报表
|
||||
//可配置参数:keyword_zd1|category|字段1,zd2|size|字段2(不变),icon|menu_icon_bb_xw_ms|菜单图标,select_zd1||搜索1,select_zd2||搜索2,select_zd3||搜索3
|
||||
//2020-07-10 by hzz
|
||||
//-----参数配置start
|
||||
//菜单图标
|
||||
$icon=get_plugin_set("icon","menu_icon_bb_xw_ms");//支持以下目录的图标ipad/images/menu_icon_*.png
|
||||
//字段
|
||||
$zd1=get_plugin_set("keyword_zd1","category");
|
||||
$zd2=get_plugin_set("zd2","size");
|
||||
//
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
|
||||
$s_key=$s_key?$s_key:$_key;
|
||||
//搜索
|
||||
$search_arr=array();
|
||||
$searh_select1=get_plugin_set("select_zd1","");
|
||||
$searh_select2=get_plugin_set("select_zd2","");
|
||||
$searh_select3=get_plugin_set("select_zd3","");
|
||||
array_push($search_arr,$searh_select1,$searh_select2,$searh_select3);
|
||||
|
||||
//
|
||||
$str_select="";
|
||||
for($i=0;$i<count($search_arr);$i++){
|
||||
$arr_val=$search_arr[$i];
|
||||
if($arr_val){
|
||||
if($arr_val=="s_spk"){
|
||||
$str_select.="{\"name\":\"s_spk\",\"title\":\"是否饰品款\",\"value\":\"".$s_spk."\",\"op\":[{\"no\":\"y\",\"title\":\"是\"},{\"no\":\"n\",\"title\":\"否\"}]},";
|
||||
}else if($arr_val=="s_ka"){
|
||||
$str_select.="{\"name\":\"s_ka\",\"title\":\"是否删除款\",\"value\":\"".$s_ka."\",\"op\":[{\"no\":\"y\",\"title\":\"是\"},{\"no\":\"n\",\"title\":\"否\"}]},";
|
||||
}else{
|
||||
$str_op="";
|
||||
$sql_select="select no,title from web_keyword where cate='".$arr_val."' order by ord";
|
||||
$res_select=$db->query($sql_select);
|
||||
while($msg_select=$db->fetch_array($res_select)){
|
||||
$str_op.="{\"no\":\"".$msg_select["no"]."\",\"title\":\"".$msg_select["title"]."\"},";
|
||||
}
|
||||
$str_select.="{\"name\":\"".$arr_val."\",\"title\":\"".get_cate_title_no("arr_select",$arr_val)."\",\"value\":\"".$$arr_val."\",\"op\":[".substr($str_op,0,-1)."]},";
|
||||
}
|
||||
}
|
||||
}
|
||||
$json_data.="\"select_report\":[".substr($str_select,0,-1)."],";
|
||||
//end
|
||||
|
||||
//-------------------------条件
|
||||
//-------con为web_order
|
||||
//-------con1为web_kh
|
||||
$con=$con1="";
|
||||
if($searh_select1!="s_ka" && $searh_select2!="s_ka" && $searh_select3!="s_ka"){
|
||||
//没有删除款搜索时
|
||||
$con.=" and ka<>'y' ";
|
||||
$con1.=" and ka<>'y' ";
|
||||
}else{
|
||||
if($s_ka){
|
||||
$con.=" and ka='".$s_ka."' ";
|
||||
$con1.=" and ka='".$s_ka."' ";
|
||||
}
|
||||
}
|
||||
if($searh_select1!="s_spk" && $searh_select2!="s_spk" && $searh_select3!="s_spk"){
|
||||
//没有饰品款搜索时
|
||||
$con.=" and is_sp<>'y' ";
|
||||
$con1.=" and is_sp<>'y' ";
|
||||
}else{
|
||||
if($s_spk){
|
||||
$con.=" and is_sp='".$s_spk."' ";
|
||||
$con1.=" and is_sp='".$s_spk."' ";
|
||||
}
|
||||
}
|
||||
if($s_key){
|
||||
if($s_key=="all"){
|
||||
$con.="";
|
||||
}else{
|
||||
$con.=" and _key='".$s_key."'";
|
||||
}
|
||||
}
|
||||
//其他
|
||||
for($i=0;$i<count($search_arr);$i++){
|
||||
$arr_val=$search_arr[$i];
|
||||
if($arr_val && $arr_val!="s_spk" && $arr_val!="s_ka"){
|
||||
if($$arr_val){
|
||||
$con.=" and ".$arr_val."='".$$arr_val."' ";
|
||||
$con1.=" and ".$arr_val."='".$$arr_val."' ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//店铺查询条件
|
||||
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==""){
|
||||
//请求数据有误
|
||||
$content_data="<div align='center'>请先配置参数!</div>";
|
||||
$json_data.="\"sys_bb_type\":\"report_null\",";
|
||||
}else{
|
||||
//---------------------------------------一维报表
|
||||
$json_data.="\"sys_bb_type\":\"report_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;
|
||||
|
||||
//取得已订总件数和金额
|
||||
$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.="<table id='tabledetail' class='cell-border nowrap' width='100%' lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' class='layui-table'>";
|
||||
$content_data.="<thead><tr style='background-color:#f2f2f2' align=center><td>".get_main_value($arr_group_by_title,$s_group_by1)."</td><td>尺码</td><td>已订件数</td><td>件数占比</td><td>吊牌金额</td><td>金额占比</td></tr>";
|
||||
$content_data.="</thead>";
|
||||
$content_data.="<tbody>";
|
||||
//--------------------------------表头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.="<tr align=center><td>".$m1["title"]."</td><td>".$m["title"]."</td><td>".$arr1[0]."</td><td>".deel_bfb($arr1[0],$xj_yd_js)."</td><td>".$arr1[1]."</td><td>".deel_bfb($arr1[1],$xj_yd_je)."</td></tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
$l++;
|
||||
}
|
||||
|
||||
$content_data.="</tbody>";
|
||||
$content_data.="<tfoot>";
|
||||
$content_data.="<tr style='background-color:#f2f2f2' align=center><td colspan=2>合计</td><td>".$total_num."</td><td></td><td>".$total_money."</td><td></td></tr>";
|
||||
$content_data.="</tfoot>";
|
||||
$content_data.="</table>";
|
||||
}
|
||||
$json_data.="\"table_html\":\"".$content_data."\",";
|
||||
?>
|
||||
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
//色系报表
|
||||
//可配置参数:zd1|sx|字段1,icon|menu_icon_bb_xw_ms|菜单图标,select_zd1||搜索1,select_zd2||搜索2,select_zd3||搜索3
|
||||
//2020-07-10 by hzz
|
||||
//-----参数配置start
|
||||
//菜单图标
|
||||
$icon=get_plugin_set("icon","menu_icon_bb_xw_ms");//支持以下目录的图标ipad/images/menu_icon_*.png
|
||||
//字段
|
||||
$zd1=get_plugin_set("zd1","sx");
|
||||
|
||||
//
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
|
||||
$s_key=$s_key?$s_key:$_key;
|
||||
//搜索
|
||||
$search_arr=array();
|
||||
$searh_select1=get_plugin_set("select_zd1","");
|
||||
$searh_select2=get_plugin_set("select_zd2","");
|
||||
$searh_select3=get_plugin_set("select_zd3","");
|
||||
array_push($search_arr,$searh_select1,$searh_select2,$searh_select3);
|
||||
|
||||
//
|
||||
$str_select="";
|
||||
for($i=0;$i<count($search_arr);$i++){
|
||||
$arr_val=$search_arr[$i];
|
||||
if($arr_val){
|
||||
if($arr_val=="s_spk"){
|
||||
$str_select.="{\"name\":\"s_spk\",\"title\":\"是否饰品款\",\"value\":\"".$s_spk."\",\"op\":[{\"no\":\"y\",\"title\":\"是\"},{\"no\":\"n\",\"title\":\"否\"}]},";
|
||||
}else if($arr_val=="s_ka"){
|
||||
$str_select.="{\"name\":\"s_ka\",\"title\":\"是否删除款\",\"value\":\"".$s_ka."\",\"op\":[{\"no\":\"y\",\"title\":\"是\"},{\"no\":\"n\",\"title\":\"否\"}]},";
|
||||
}else{
|
||||
$str_op="";
|
||||
$sql_select="select no,title from web_keyword where cate='".$arr_val."' order by ord";
|
||||
$res_select=$db->query($sql_select);
|
||||
while($msg_select=$db->fetch_array($res_select)){
|
||||
$str_op.="{\"no\":\"".$msg_select["no"]."\",\"title\":\"".$msg_select["title"]."\"},";
|
||||
}
|
||||
$str_select.="{\"name\":\"".$arr_val."\",\"title\":\"".get_cate_title_no("arr_select",$arr_val)."\",\"value\":\"".$$arr_val."\",\"op\":[".substr($str_op,0,-1)."]},";
|
||||
}
|
||||
}
|
||||
}
|
||||
$json_data.="\"select_report\":[".substr($str_select,0,-1)."],";
|
||||
//end
|
||||
|
||||
//-------------------------条件
|
||||
//-------con为web_order
|
||||
//-------con1为web_kh
|
||||
$con=$con1="";
|
||||
if($searh_select1!="s_ka" && $searh_select2!="s_ka" && $searh_select3!="s_ka"){
|
||||
//没有删除款搜索时
|
||||
$con.=" and ka<>'y' ";
|
||||
$con1.=" and ka<>'y' ";
|
||||
}else{
|
||||
if($s_ka){
|
||||
$con.=" and ka='".$s_ka."' ";
|
||||
$con1.=" and ka='".$s_ka."' ";
|
||||
}
|
||||
}
|
||||
if($searh_select1!="s_spk" && $searh_select2!="s_spk" && $searh_select3!="s_spk"){
|
||||
//没有饰品款搜索时
|
||||
$con.=" and is_sp<>'y' ";
|
||||
$con1.=" and is_sp<>'y' ";
|
||||
}else{
|
||||
if($s_spk){
|
||||
$con.=" and is_sp='".$s_spk."' ";
|
||||
$con1.=" and is_sp='".$s_spk."' ";
|
||||
}
|
||||
}
|
||||
if($s_key){
|
||||
if($s_key=="all"){
|
||||
$con.="";
|
||||
}else{
|
||||
$con.=" and _key='".$s_key."'";
|
||||
}
|
||||
}
|
||||
//其他
|
||||
for($i=0;$i<count($search_arr);$i++){
|
||||
$arr_val=$search_arr[$i];
|
||||
if($arr_val && $arr_val!="s_spk" && $arr_val!="s_ka"){
|
||||
if($$arr_val){
|
||||
$con.=" and ".$arr_val."='".$$arr_val."' ";
|
||||
$con1.=" and ".$arr_val."='".$$arr_val."' ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//店铺查询条件
|
||||
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==""){
|
||||
//请求数据有误
|
||||
$content_data="<div align='center'>请先配置参数!</div>";
|
||||
$json_data.="\"sys_bb_type\":\"report_null\",";
|
||||
}else{
|
||||
//---------------------------------------一维报表
|
||||
$json_data.="\"sys_bb_type\":\"report_1w\",";
|
||||
$s_group_by=$zd1;
|
||||
|
||||
//取得总款色数
|
||||
$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<count($arr1);$i1++){
|
||||
if($s_ka=="y"){
|
||||
if(in_array($arr1[$i1],$arr2))
|
||||
$total_sku++;
|
||||
}else{
|
||||
if(!in_array($arr1[$i1],$arr2))
|
||||
$total_sku++;
|
||||
}
|
||||
}
|
||||
}
|
||||
//取得已订总件数和金额
|
||||
$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,color) 'num' from ".$table_pre."order where ".$s_group_by."<>'' ".$con);
|
||||
$total_yd_sku=$tmp1["num"];
|
||||
//
|
||||
$content_data="";
|
||||
$content_data.="<table id='tabledetail' class='cell-border nowrap' width='100%' lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' class='layui-table'>";
|
||||
$content_data.="<thead><tr style='background-color:#f2f2f2' align=center><td rowspan=2>色系</td><td colspan=2>设计款色</td><td colspan=2>已订款色</td><td colspan=2>已订件数</td><td colspan=2>吊牌金额</td></tr>";
|
||||
$content_data.="<tr style='background-color:#f2f2f2' align=center><td>款数</td><td>占比</td><td>款数</td><td>占比</td><td>件数</td><td>占比</td><td>金额</td><td>占比</td></tr>";
|
||||
$content_data.="</thead>";
|
||||
$content_data.="<tbody>";
|
||||
//
|
||||
$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;$i1<count($arr_color);$i1++){
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where concat(',',color,',') like '%,".$arr_color[$i1].",%'".$con1);
|
||||
$n1+=$tmp["num"];
|
||||
}
|
||||
$tmp_sku=$n1;
|
||||
//取得款色
|
||||
$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=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"];
|
||||
//
|
||||
$content_data.="<tr align=center><td>".$m["title"]."</td><td>".deel_01($tmp_sku)."</td><td>".deel_bfb($tmp_sku,$total_sku)."</td><td>".deel_01($tmp_yd_sku)."</td><td>".deel_bfb($tmp_yd_sku,$total_yd_sku)."</td><td>".deel_01($tmp_yd_js)."</td><td>".deel_bfb($tmp_yd_js,$total_yd_js)."</td><td>".deel_01($tmp_yd_je)."</td><td>".deel_bfb($tmp_yd_je,$total_yd_je)."</td></tr>";
|
||||
|
||||
$count++;
|
||||
//
|
||||
$tb_data_x.=$m["title"].",";
|
||||
$tb_data_y.=str_replace("%","",deel_bfb($tmp_yd_js,$total_yd_js)).",";
|
||||
}
|
||||
$content_data.="</tbody>";
|
||||
$content_data.="<tfoot>";
|
||||
$content_data.="<tr align=center style='background-color:#f2f2f2'><td>合计</td><td>".$total_sku."</td><td></td><td>".$total_yd_sku."</td><td></td><td>".$total_yd_js."</td><td></td><td>".$total_yd_je."</td><td></td></tr>";
|
||||
$content_data.="</tfoot>";
|
||||
$content_data.="</table>";
|
||||
|
||||
//图
|
||||
$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."\",";
|
||||
?>
|
||||
@@ -0,0 +1,954 @@
|
||||
<?php
|
||||
//可选三维报表(带导入)
|
||||
//可配置参数:tbname|plugin_3w1|额外数据表名,keyword_zd1|category|字段1,keyword_zd2|bc|字段2,keyword_zd3|gender|字段3,icon|menu_icon_bb_xw_ms|菜单图标,select_zd1||搜索1,select_zd2||搜索2,select_zd3||搜索3,head_zd1|y|均价,head_zd2|y|设计款数,head_zd3|y|已订款数,head_zd4|y|设计款色,head_zd5|y|已订款色,head_zd6|y|已订件数,head_zd7|y|吊牌金额,head_zd8|n|结算金额,dr_zd1|导入字段1_文本|导入字段1,dr_zd2|导入字段2_数字|导入字段2,dr_zd3|导入字段3_百分比|导入字段3,dr_zd4||导入字段4,dr_zd5||导入字段5,dr_zd6||导入字段6,dr_zd7||导入字段7,dr_zd8||导入字段8
|
||||
//2020-07-27 by zc
|
||||
//-----参数配置start
|
||||
//额外数据表名
|
||||
$tbname="plugin_zdy_".get_plugin_set("tbname","plugin_3w1");
|
||||
//菜单图标
|
||||
$icon=get_plugin_set("icon","menu_icon_bb_xw_ms");//支持以下目录的图标ipad/images/menu_icon_*.png
|
||||
//字段
|
||||
$zd1=get_plugin_set("keyword_zd1","category");
|
||||
$zd2=get_plugin_set("keyword_zd2","bc");
|
||||
$zd3=get_plugin_set("keyword_zd3","gender");
|
||||
//表头
|
||||
$head_zd1=get_plugin_set("head_zd1","y");
|
||||
$head_zd2=get_plugin_set("head_zd2","y");
|
||||
$head_zd3=get_plugin_set("head_zd3","y");
|
||||
$head_zd4=get_plugin_set("head_zd4","y");
|
||||
$head_zd5=get_plugin_set("head_zd5","y");
|
||||
$head_zd6=get_plugin_set("head_zd6","y");
|
||||
$head_zd7=get_plugin_set("head_zd7","y");
|
||||
$head_zd8=get_plugin_set("head_zd8","n");
|
||||
|
||||
//导入数据
|
||||
$dr_zd1=get_plugin_set("dr_zd1","导入字段1_文本");
|
||||
$dr_zd2=get_plugin_set("dr_zd2","导入字段2_数字");
|
||||
$dr_zd3=get_plugin_set("dr_zd3","导入字段3_百分比");
|
||||
$dr_zd4=get_plugin_set("dr_zd4","");
|
||||
$dr_zd5=get_plugin_set("dr_zd5","");
|
||||
$dr_zd6=get_plugin_set("dr_zd6","");
|
||||
$dr_zd7=get_plugin_set("dr_zd7","");
|
||||
$dr_zd8=get_plugin_set("dr_zd8","");
|
||||
|
||||
//
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
|
||||
$s_key=$s_key?$s_key:$_key;
|
||||
//搜索
|
||||
$search_arr=array();
|
||||
$searh_select1=get_plugin_set("select_zd1","");
|
||||
$searh_select2=get_plugin_set("select_zd2","");
|
||||
$searh_select3=get_plugin_set("select_zd3","");
|
||||
array_push($search_arr,$searh_select1,$searh_select2,$searh_select3);
|
||||
|
||||
//
|
||||
$str_select="";
|
||||
for($i=0;$i<count($search_arr);$i++){
|
||||
$arr_val=$search_arr[$i];
|
||||
if($arr_val){
|
||||
if($arr_val=="s_spk"){
|
||||
$str_select.="{\"name\":\"s_spk\",\"title\":\"是否饰品款\",\"value\":\"".$s_spk."\",\"op\":[{\"no\":\"y\",\"title\":\"是\"},{\"no\":\"n\",\"title\":\"否\"}]},";
|
||||
}else if($arr_val=="s_ka"){
|
||||
$str_select.="{\"name\":\"s_ka\",\"title\":\"是否删除款\",\"value\":\"".$s_ka."\",\"op\":[{\"no\":\"y\",\"title\":\"是\"},{\"no\":\"n\",\"title\":\"否\"}]},";
|
||||
}else{
|
||||
$str_op="";
|
||||
$sql_select="select no,title from web_keyword where cate='".$arr_val."' order by ord";
|
||||
$res_select=$db->query($sql_select);
|
||||
while($msg_select=$db->fetch_array($res_select)){
|
||||
$str_op.="{\"no\":\"".$msg_select["no"]."\",\"title\":\"".$msg_select["title"]."\"},";
|
||||
}
|
||||
$str_select.="{\"name\":\"".$arr_val."\",\"title\":\"".get_cate_title_no("arr_select",$arr_val)."\",\"value\":\"".$$arr_val."\",\"op\":[".substr($str_op,0,-1)."]},";
|
||||
}
|
||||
}
|
||||
}
|
||||
$json_data.="\"select_report\":[".substr($str_select,0,-1)."],";
|
||||
//end
|
||||
|
||||
//-------------------------条件
|
||||
//-------con为web_order
|
||||
//-------con1为web_kh
|
||||
$con=$con1=$con_dr="";
|
||||
if($searh_select1!="s_ka" && $searh_select2!="s_ka" && $searh_select3!="s_ka"){
|
||||
//没有删除款搜索时
|
||||
$con.=" and ka<>'y' ";
|
||||
$con1.=" and ka<>'y' ";
|
||||
}else{
|
||||
if($s_ka){
|
||||
$con.=" and ka='".$s_ka."' ";
|
||||
$con1.=" and ka='".$s_ka."' ";
|
||||
}
|
||||
}
|
||||
if($searh_select1!="s_spk" && $searh_select2!="s_spk" && $searh_select3!="s_spk"){
|
||||
//没有饰品款搜索时
|
||||
$con.=" and is_sp<>'y' ";
|
||||
$con1.=" and is_sp<>'y' ";
|
||||
}else{
|
||||
if($s_spk){
|
||||
$con.=" and is_sp='".$s_spk."' ";
|
||||
$con1.=" and is_sp='".$s_spk."' ";
|
||||
}
|
||||
}
|
||||
if($s_key){
|
||||
if($s_key=="all"){
|
||||
$con.="";
|
||||
}else{
|
||||
$con.=" and _key='".$s_key."'";
|
||||
}
|
||||
}
|
||||
//其他
|
||||
for($i=0;$i<count($search_arr);$i++){
|
||||
$arr_val=$search_arr[$i];
|
||||
if($arr_val && $arr_val!="s_spk" && $arr_val!="s_ka"){
|
||||
if($$arr_val){
|
||||
$con.=" and ".$arr_val."='".$$arr_val."' ";
|
||||
$con1.=" and ".$arr_val."='".$$arr_val."' ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//店铺查询条件
|
||||
if($msg_client["face"]=="4"){
|
||||
$s_username=$msg_client["username"];
|
||||
$con.=" and uid='".$msg_client["id"]."'";
|
||||
$con_dr.=" 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"]."'";
|
||||
$con_dr.=" and uid='".$m2["id"]."'";
|
||||
}else{
|
||||
$con.=" and (upath='".$m2["path"]."-".$m2["id"]."' or upath like '".$m2["path"]."-".$m2["id"]."-%')";
|
||||
$con_dr.=" 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"]);
|
||||
$con_dr.=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"]."-%')";
|
||||
$con_dr.=" and (upath='".$msg_client["path"]."-".$msg_client["id"]."' or upath like '".$msg_client["path"]."-".$msg_client["id"]."-%')";
|
||||
}
|
||||
}
|
||||
//---------------------------------------------
|
||||
$arr_dr_zd=array("dr_zd1"=>"dr_zd1","dr_zd2"=>"dr_zd2","dr_zd3"=>"dr_zd3","dr_zd4"=>"dr_zd4","dr_zd5"=>"dr_zd5","dr_zd6"=>"dr_zd6","dr_zd7"=>"dr_zd7","dr_zd8"=>"dr_zd8");
|
||||
$str_sql="";
|
||||
foreach($arr_dr_zd as $k => $v){
|
||||
if($$v){
|
||||
$tmp=explode("_",$$v);
|
||||
if($tmp[1]=="文本"){
|
||||
$str_sql.="".$v.",";
|
||||
}else{
|
||||
$str_sql.="sum(".$v.") ".$v.",";
|
||||
}
|
||||
}
|
||||
}
|
||||
if($str_sql){
|
||||
$str_sql=deel_end($str_sql);
|
||||
}
|
||||
if($zd1=="" || !$str_sql){
|
||||
//请求数据有误
|
||||
$content_data="<div align='center'>请先配置参数!</div>";
|
||||
$json_data.="\"sys_bb_type\":\"report_null\",";
|
||||
}else{
|
||||
//---------------------------------------一维报表
|
||||
|
||||
//
|
||||
$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"];
|
||||
}
|
||||
//
|
||||
$s_group_by1=$zd1;
|
||||
$s_group_by2=$zd2;
|
||||
$s_group_by3=$zd3;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$content_data="";
|
||||
$content_data.="<table id='tabledetail' class='cell-border nowrap' width='100%' lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' class='layui-table'>";
|
||||
$content_data.="<thead><tr style='background-color:#f2f2f2' align=center><td rowspan=2>".get_main_value($arr_group_by_title,$s_group_by1)."</td>";
|
||||
$sp=1;
|
||||
if($s_group_by2){
|
||||
$content_data.="<td rowspan=2>".get_main_value($arr_group_by_title,$s_group_by2)."</td>";
|
||||
$sp++;
|
||||
}
|
||||
if($s_group_by3){
|
||||
$content_data.="<td rowspan=2>".get_main_value($arr_group_by_title,$s_group_by3)."</td>";
|
||||
$sp++;
|
||||
}
|
||||
|
||||
if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by3!="sx" && $s_group_by1!="color" && $s_group_by2!="color" && $s_group_by3!="color"){
|
||||
$content_data.=($head_zd1=="y")?"<td rowspan=2>均价</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td colspan=2>设计款数</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td colspan=2>已订款数</td>":"";
|
||||
}
|
||||
$content_data.=($head_zd4=="y")?"<td colspan=2>设计款色</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td colspan=2>已订款色</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td colspan=2>已订件数</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td colspan=2>吊牌金额</td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td colspan=2>结算金额</td>":"";
|
||||
|
||||
$content_data.=($dr_zd1)?"<td rowspan=2>".get_dr_title($dr_zd1)."</td>":"";
|
||||
$content_data.=($dr_zd2)?"<td rowspan=2>".get_dr_title($dr_zd2)."</td>":"";
|
||||
$content_data.=($dr_zd3)?"<td rowspan=2>".get_dr_title($dr_zd3)."</td>":"";
|
||||
$content_data.=($dr_zd4)?"<td rowspan=2>".get_dr_title($dr_zd4)."</td>":"";
|
||||
$content_data.=($dr_zd5)?"<td rowspan=2>".get_dr_title($dr_zd5)."</td>":"";
|
||||
$content_data.=($dr_zd6)?"<td rowspan=2>".get_dr_title($dr_zd6)."</td>":"";
|
||||
$content_data.=($dr_zd7)?"<td rowspan=2>".get_dr_title($dr_zd7)."</td>":"";
|
||||
$content_data.=($dr_zd8)?"<td rowspan=2>".get_dr_title($dr_zd8)."</td>":"";
|
||||
|
||||
$content_data.="</tr>";
|
||||
$content_data.="<tr style='background-color:#f2f2f2' align=center>";
|
||||
if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by3!="sx" && $s_group_by1!="color" && $s_group_by2!="color" && $s_group_by3!="color"){
|
||||
$content_data.=($head_zd2=="y")?"<td>款数</td><td>占比</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>款数</td><td>占比</td>":"";
|
||||
}
|
||||
$content_data.=($head_zd4=="y")?"<td>款数</td><td>占比</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>款数</td><td>占比</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>件数</td><td>占比</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>金额</td><td>占比</td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td>金额</td><td>占比</td>":"";
|
||||
|
||||
$content_data.="</tr>";
|
||||
$content_data.="</thead>";
|
||||
$content_data.="<tbody>";
|
||||
$con2="";
|
||||
if($s_group_by1!="sx" && $s_group_by1)
|
||||
$con2.=" and ".$s_group_by1."<>''";
|
||||
if($s_group_by2!="sx" && $s_group_by2)
|
||||
$con2.=" and ".$s_group_by2."<>''";
|
||||
if($s_group_by3!="sx" && $s_group_by3)
|
||||
$con2.=" and ".$s_group_by3."<>''";
|
||||
|
||||
if($zd3){
|
||||
$json_data.="\"sys_bb_type\":\"report_2w\",";
|
||||
//取得总款数
|
||||
$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<count($arr1);$i1++){
|
||||
if(!in_array($arr1[$i1],$arr2))
|
||||
$total_sku++;
|
||||
}
|
||||
}
|
||||
if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by3!="sx" && $s_group_by1!="color" && $s_group_by2!="color" && $s_group_by3!="color"){
|
||||
//取得总均价
|
||||
$tmp=get_db_msg("select sum(price)/count(*) 'jj' from ".$table_pre."kh where no<>'' ".$con2.$con1);
|
||||
$price_jj=keep_float($tmp["jj"],1);
|
||||
}
|
||||
|
||||
//取得已订总件数和金额
|
||||
$tmp=get_db_msg("select sum(num) 'num',sum(je) 'je',sum(jsje) 'jsje' from ".$table_pre."order where ".$s_group_by2."<>'' and ".$s_group_by1."<>'' and ".$s_group_by3."<>'' ".$con);
|
||||
$total_yd_js=$tmp["num"];
|
||||
$total_yd_je=$tmp["je"];
|
||||
$total_yd_jsje=$tmp["jsje"];
|
||||
//取得已订总款数
|
||||
$tmp=get_db_msg("select count(distinct no) 'num' from ".$table_pre."order where ".$s_group_by2."<>'' and ".$s_group_by1."<>'' and ".$s_group_by3."<>'' ".$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."<>'' and ".$s_group_by3."<>'' ".$con);
|
||||
$total_yd_sku=$tmp["num"];
|
||||
|
||||
$total_dr=get_db_msg("select ".$str_sql." from ".$table_pre.$tbname." where id<>0 ".$con_dr);
|
||||
|
||||
//
|
||||
$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;$i1<count($arr_color);$i1++){
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where concat(',',color,',') like '%,".$arr_color[$i1].",%'".$con11.$con1);
|
||||
$n1+=$tmp["num"];
|
||||
}
|
||||
$xj_z_sku=$n1;
|
||||
}else{
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ".$s_group_by1."='".$m4["no"]."'".$con11.$con1);
|
||||
$xj_z_ks=$tmp["num"];
|
||||
//取得小计设计款色数
|
||||
$xj_z_sku=0;
|
||||
$q2="select no,color,color_ka from ".$table_pre."kh where ".$s_group_by1."='".$m4["no"]."'".$con11.$con1;
|
||||
$r2=$db->query($q2);
|
||||
while($m2=$db->fetch_array($r2)){
|
||||
$arr1=explode(",",$m2["color"]);
|
||||
$arr2=explode(",",$m2["color_ka"]);
|
||||
for($i1=0;$i1<count($arr1);$i1++){
|
||||
if(!in_array($arr1[$i1],$arr2))
|
||||
$xj_z_sku++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
$q="select * from ".$table_pre."keyword where cate='".$s_group_by2."' order by no";
|
||||
//echo $q."<br>";
|
||||
$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',sum(jsje) 'jsje' 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"];
|
||||
$xj_yd_jsje=$tmp["jsje"];
|
||||
$xj_dr=get_db_msg("select ".$str_sql." from ".$table_pre.$tbname." where zd1='".$m4["title"]."' ".$con_dr);
|
||||
//
|
||||
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);
|
||||
$hj_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);
|
||||
$hj_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);
|
||||
$hj_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<count($arr_color);$i1++){
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ka<>'y' and concat(',',color,',') like '%,".$arr_color[$i1].",%' and ".$con12);
|
||||
$n1+=$tmp["num"];
|
||||
}
|
||||
$hj_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);
|
||||
$hj_z_sku=$tmp["num"];
|
||||
}else{
|
||||
$hj_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;
|
||||
$hj_z_sku+=$n1-$n2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$q1="select * from ".$table_pre."keyword where cate='".$s_group_by3."' order by no";
|
||||
//echo $q1."<br>";
|
||||
$r1=$db->query($q1);
|
||||
$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."='".$m["no"]."' and ".$s_group_by1."<>'' and ".$s_group_by2."<>'' and ".$s_group_by3."<>'' ".$con);
|
||||
$hj_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_by2."='".$m["no"]."' and ".$s_group_by1."<>'' and ".$s_group_by2."<>'' and ".$s_group_by3."<>'' ".$con);
|
||||
$hj_yd_sku=$tmp["num"];
|
||||
//取得已订小计件数和金额
|
||||
$tmp=get_db_msg("select sum(num) 'num',sum(je) 'je',sum(jsje) 'jsje' from ".$table_pre."order where ".$s_group_by1."='".$m4["no"]."' and ".$s_group_by2."='".$m["no"]."' and ".$s_group_by1."<>'' and ".$s_group_by2."<>'' and ".$s_group_by3."<>'' ".$con);
|
||||
$hj_yd_js=$tmp["num"];
|
||||
$hj_yd_je=$tmp["je"];
|
||||
$hj_yd_jsje=$tmp["jsje"];
|
||||
$hj_dr=get_db_msg("select ".$str_sql." from ".$table_pre.$tbname." where zd1='".$m4["title"]."' and zd2='".$m["title"]."' ".$con_dr);
|
||||
//
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by3!="sx" && $s_group_by1!="color" && $s_group_by2!="color" && $s_group_by3!="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"]."' and ".$s_group_by3."='".$m1["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"]."' and ".$s_group_by3."='".$m1["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 ".$s_group_by3."='".$m1["no"]."' and concat(',',color,',') like '%,".$m["no"].",%'".$con1);
|
||||
else if($s_group_by3=="color")
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ".$s_group_by1."='".$m4["no"]."' and ".$s_group_by2."='".$m["no"]."' and concat(',',color,',') like '%,".$m1["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"]."' and ".$s_group_by3."='".$m1["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"]."' and ".$s_group_by3."='".$m1["no"]."'".$con);
|
||||
$tmp_yd_sku=$tmp["num"];
|
||||
if($s_group_by1=="sx" || $s_group_by2=="sx" || $s_group_by3=="sx"){
|
||||
if($s_group_by1=="sx"){
|
||||
$con11=" no='".$m4["no"]."'";
|
||||
$con12=$s_group_by2."='".$m["no"]."' and ".$s_group_by3."='".$m1["no"]."'";
|
||||
}else if($s_group_by2=="sx"){
|
||||
$con11=" no='".$m["no"]."'";
|
||||
$con12=$s_group_by1."='".$m4["no"]."' and ".$s_group_by3."='".$m1["no"]."'";
|
||||
}else{
|
||||
$con11=" no='".$m1["no"]."'";
|
||||
$con12=$s_group_by1."='".$m4["no"]."' and ".$s_group_by2."='".$m["no"]."'";
|
||||
}
|
||||
//取得设计款色
|
||||
$tmp=get_db_msg("select * from ".$table_pre."sx where ".$con11);
|
||||
$arr_color=explode(",",$tmp["_v"]);
|
||||
$n1=0;
|
||||
for($i1=0;$i1<count($arr_color);$i1++){
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ka<>'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" || $s_group_by3=="color"){
|
||||
if($s_group_by1=="color"){
|
||||
$con11=$m4["no"];
|
||||
$con12=$s_group_by2."='".$m["no"]."' and ".$s_group_by3."='".$m1["no"]."'";
|
||||
}else if($s_group_by2=="color"){
|
||||
$con11=$m["no"];
|
||||
$con12=$s_group_by1."='".$m4["no"]."' and ".$s_group_by3."='".$m1["no"]."'";
|
||||
}else{
|
||||
$con11=$m1["no"];
|
||||
$con12=$s_group_by1."='".$m4["no"]."' and ".$s_group_by2."='".$m["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"]."' and ".$s_group_by3."='".$m1["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',sum(jsje) 'jsje' from ".$table_pre."order where id>0 and ".$s_group_by1."='".$m4["no"]."' and ".$s_group_by2."='".$m["no"]."' and ".$s_group_by3."='".$m1["no"]."'".$con);
|
||||
$tmp_yd_js=$tmp["num"];
|
||||
$tmp_yd_je=$tmp["je"];
|
||||
$tmp_yd_jsje=$tmp["jsje"];
|
||||
|
||||
$tmp_dr=get_db_msg("select ".$str_sql." from ".$table_pre.$tbname." where id>0 and zd1='".$m4["title"]."' and zd2='".$m["title"]."' and zd3='".$m1["title"]."'".$con_dr);
|
||||
//
|
||||
if($tmp_z_sku>0){
|
||||
$content_data.="<tr align=center>";
|
||||
$content_data.="<td>".$m4["title"]."</td>";
|
||||
$content_data.="<td>".$m["title"]."</td>";
|
||||
$content_data.="<td>".$m1["title"]."</td>";
|
||||
if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by3!="sx" && $s_group_by1!="color" && $s_group_by2!="color" && $s_group_by3!="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"]."' and ".$s_group_by3."='".$m1["no"]."'".$con1);
|
||||
$content_data.=($head_zd1=="y")?"<td>".keep_float($tmp["jj"],1)."</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td>".$tmp_z_ks."</td><td>".deel_bfb($tmp_z_ks,$hj_z_ks)."</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>".$tmp_yd_ks."</td><td>".deel_bfb($tmp_yd_ks,$hj_yd_ks)."</td>":"";
|
||||
}
|
||||
$content_data.=($head_zd4=="y")?"<td>".$tmp_z_sku."</td><td>".deel_bfb($tmp_z_sku,$hj_z_sku)."</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>".$tmp_yd_sku."</td><td>".deel_bfb($tmp_yd_sku,$hj_yd_sku)."</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>".deel_01(deel_num($tmp_yd_js))."</td><td>".deel_bfb($tmp_yd_js,$hj_yd_js)."</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>".deel_01(deel_num($tmp_yd_je))."</td><td>".deel_bfb($tmp_yd_je,$hj_yd_je)."</td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td>".deel_01(deel_num($tmp_yd_jsje))."</td><td>".deel_bfb($tmp_yd_jsje,$hj_yd_jsje)."</td>":"";
|
||||
|
||||
$content_data.=($dr_zd1)?"<td>".deel_dr($dr_zd1,$tmp_dr["dr_zd1"])."</td>":"";
|
||||
$content_data.=($dr_zd2)?"<td>".deel_dr($dr_zd2,$tmp_dr["dr_zd2"])."</td>":"";
|
||||
$content_data.=($dr_zd3)?"<td>".deel_dr($dr_zd3,$tmp_dr["dr_zd3"])."</td>":"";
|
||||
$content_data.=($dr_zd4)?"<td>".deel_dr($dr_zd4,$tmp_dr["dr_zd4"])."</td>":"";
|
||||
$content_data.=($dr_zd5)?"<td>".deel_dr($dr_zd5,$tmp_dr["dr_zd5"])."</td>":"";
|
||||
$content_data.=($dr_zd6)?"<td>".deel_dr($dr_zd6,$tmp_dr["dr_zd6"])."</td>":"";
|
||||
$content_data.=($dr_zd7)?"<td>".deel_dr($dr_zd7,$tmp_dr["dr_zd7"])."</td>":"";
|
||||
$content_data.=($dr_zd8)?"<td>".deel_dr($dr_zd8,$tmp_dr["dr_zd8"])."</td>":"";
|
||||
|
||||
$content_data.="</tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
if($hj_z_sku>0){
|
||||
$content_data.="<tr align=center style='background-color:#f2f2f2'>";
|
||||
$content_data.="<td></td><td>".$m["title"]."小计</td><td></td>";
|
||||
if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by3!="sx" && $s_group_by1!="color" && $s_group_by2!="color" && $s_group_by3!="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"]."' and ".$s_group_by3."<>''".$con1);
|
||||
$content_data.=($head_zd1=="y")?"<td>".keep_float($tmp["jj"],1)."</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td>".$hj_z_ks."</td><td>".deel_bfb($hj_z_ks,$total_ks)."</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>".$hj_yd_ks."</td><td>".deel_bfb($hj_yd_ks,$total_yd_ks)."</td>":"";
|
||||
}
|
||||
$content_data.=($head_zd4=="y")?"<td>".$hj_z_sku."</td><td>".deel_bfb($hj_z_sku,$total_sku)."</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>".$hj_yd_sku."</td><td>".deel_bfb($hj_yd_sku,$total_yd_sku)."</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>".deel_num($hj_yd_js)."</td><td>".deel_bfb($hj_yd_js,$total_yd_js)."</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>".deel_num($hj_yd_je)."</td><td>".deel_bfb($hj_yd_je,$total_yd_je)."</td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td>".deel_num($hj_yd_jsje)."</td><td>".deel_bfb($hj_yd_jsje,$total_yd_jsje)."</td>":"";
|
||||
|
||||
$content_data.=($dr_zd1)?"<td>".deel_dr_hj($dr_zd1,$hj_dr["dr_zd1"])."</td>":"";
|
||||
$content_data.=($dr_zd2)?"<td>".deel_dr_hj($dr_zd2,$hj_dr["dr_zd2"])."</td>":"";
|
||||
$content_data.=($dr_zd3)?"<td>".deel_dr_hj($dr_zd3,$hj_dr["dr_zd3"])."</td>":"";
|
||||
$content_data.=($dr_zd4)?"<td>".deel_dr_hj($dr_zd4,$hj_dr["dr_zd4"])."</td>":"";
|
||||
$content_data.=($dr_zd5)?"<td>".deel_dr_hj($dr_zd5,$hj_dr["dr_zd5"])."</td>":"";
|
||||
$content_data.=($dr_zd6)?"<td>".deel_dr_hj($dr_zd6,$hj_dr["dr_zd6"])."</td>":"";
|
||||
$content_data.=($dr_zd7)?"<td>".deel_dr_hj($dr_zd7,$hj_dr["dr_zd7"])."</td>":"";
|
||||
$content_data.=($dr_zd8)?"<td>".deel_dr_hj($dr_zd8,$hj_dr["dr_zd8"])."</td>":"";
|
||||
|
||||
|
||||
$content_data.="</tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
if($xj_z_sku>0){
|
||||
$content_data.="<tr align=center style='background-color:#f2f2f2'>";
|
||||
$content_data.="<td>".$m4["title"]."小计</td><td></td><td></td>";
|
||||
if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by3!="sx" && $s_group_by1!="color" && $s_group_by2!="color" && $s_group_by3!="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.=($head_zd1=="y")?"<td>".keep_float($tmp["jj"],1)."</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td>".$xj_z_ks."</td><td>".deel_bfb($xj_z_ks,$total_ks)."</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>".$xj_yd_ks."</td><td>".deel_bfb($xj_yd_ks,$total_yd_ks)."</td>":"";
|
||||
}
|
||||
$content_data.=($head_zd4=="y")?"<td>".$xj_z_sku."</td><td>".deel_bfb($xj_z_sku,$total_sku)."</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>".$xj_yd_sku."</td><td>".deel_bfb($xj_yd_sku,$total_yd_sku)."</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>".deel_num($xj_yd_js)."</td><td>".deel_bfb($xj_yd_js,$total_yd_js)."</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>".deel_num($xj_yd_je)."</td><td>".deel_bfb($xj_yd_je,$total_yd_je)."</td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td>".deel_num($xj_yd_jsje)."</td><td>".deel_bfb($xj_yd_jsje,$total_yd_jsje)."</td>":"";
|
||||
|
||||
$content_data.=($dr_zd1)?"<td>".deel_dr_hj($dr_zd1,$xj_dr["dr_zd1"])."</td>":"";
|
||||
$content_data.=($dr_zd2)?"<td>".deel_dr_hj($dr_zd2,$xj_dr["dr_zd2"])."</td>":"";
|
||||
$content_data.=($dr_zd3)?"<td>".deel_dr_hj($dr_zd3,$xj_dr["dr_zd3"])."</td>":"";
|
||||
$content_data.=($dr_zd4)?"<td>".deel_dr_hj($dr_zd4,$xj_dr["dr_zd4"])."</td>":"";
|
||||
$content_data.=($dr_zd5)?"<td>".deel_dr_hj($dr_zd5,$xj_dr["dr_zd5"])."</td>":"";
|
||||
$content_data.=($dr_zd6)?"<td>".deel_dr_hj($dr_zd6,$xj_dr["dr_zd6"])."</td>":"";
|
||||
$content_data.=($dr_zd7)?"<td>".deel_dr_hj($dr_zd7,$xj_dr["dr_zd7"])."</td>":"";
|
||||
$content_data.=($dr_zd8)?"<td>".deel_dr_hj($dr_zd8,$xj_dr["dr_zd8"])."</td>":"";
|
||||
|
||||
$content_data.="</tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
$content_data.="</tbody>";
|
||||
}else if($zd2){
|
||||
$json_data.="\"sys_bb_type\":\"report_2w\",";
|
||||
//取得总款数
|
||||
$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<count($arr1);$i1++){
|
||||
if(!in_array($arr1[$i1],$arr2))
|
||||
$total_sku++;
|
||||
}
|
||||
}
|
||||
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 no<>'' ".$con2.$con1);
|
||||
$price_jj=keep_float($tmp["jj"],1);
|
||||
}
|
||||
|
||||
//取得已订总件数和金额
|
||||
$tmp=get_db_msg("select sum(num) 'num',sum(je) 'je',sum(jsje) 'jsje' from ".$table_pre."order where ".$s_group_by2."<>'' and ".$s_group_by1."<>'' ".$con);
|
||||
$total_yd_js=$tmp["num"];
|
||||
$total_yd_je=$tmp["je"];
|
||||
$total_yd_jsje=$tmp["jsje"];
|
||||
//取得已订总款数
|
||||
$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"];
|
||||
|
||||
$total_dr=get_db_msg("select ".$str_sql." from ".$table_pre.$tbname." where id<>0 ".$con_dr);
|
||||
|
||||
//
|
||||
$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;$i1<count($arr_color);$i1++){
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where concat(',',color,',') like '%,".$arr_color[$i1].",%'".$con11.$con1);
|
||||
$n1+=$tmp["num"];
|
||||
}
|
||||
$xj_z_sku=$n1;
|
||||
}else{
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ".$s_group_by1."='".$m4["no"]."'".$con11.$con1);
|
||||
$xj_z_ks=$tmp["num"];
|
||||
//取得小计设计款色数
|
||||
$xj_z_sku=0;
|
||||
$q2="select no,color,color_ka from ".$table_pre."kh where ".$s_group_by1."='".$m4["no"]."'".$con11.$con1;
|
||||
$r2=$db->query($q2);
|
||||
while($m2=$db->fetch_array($r2)){
|
||||
$arr1=explode(",",$m2["color"]);
|
||||
$arr2=explode(",",$m2["color_ka"]);
|
||||
for($i1=0;$i1<count($arr1);$i1++){
|
||||
if(!in_array($arr1[$i1],$arr2))
|
||||
$xj_z_sku++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
$q="select * from ".$table_pre."keyword where cate='".$s_group_by2."' order by no";
|
||||
//echo $q."<br>";
|
||||
$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',sum(jsje) 'jsje' 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"];
|
||||
$xj_yd_jsje=$tmp["jsje"];
|
||||
$xj_dr=get_db_msg("select ".$str_sql." from ".$table_pre.$tbname." where zd1='".$m4["title"]."' ".$con_dr);
|
||||
//
|
||||
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<count($arr_color);$i1++){
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ka<>'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',sum(jsje) 'jsje' 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"];
|
||||
$tmp_yd_jsje=$tmp["jsje"];
|
||||
$tmp_dr=get_db_msg("select ".$str_sql." from ".$table_pre.$tbname." where id>0 and zd1='".$m4["title"]."' and zd2='".$m["title"]."'".$con_dr);
|
||||
//
|
||||
if($tmp_z_sku>0){
|
||||
$content_data.="<tr align=center>";
|
||||
$content_data.="<td>".$m4["title"]."</td>";
|
||||
$content_data.="<td>".$m["title"]."</td>";
|
||||
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.=($head_zd1=="y")?"<td>".keep_float($tmp["jj"],1)."</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td>".$tmp_z_ks."</td><td>".deel_bfb($tmp_z_ks,$xj_z_ks)."</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>".$tmp_yd_ks."</td><td>".deel_bfb($tmp_yd_ks,$xj_yd_ks)."</td>":"";
|
||||
}
|
||||
$content_data.=($head_zd4=="y")?"<td>".$tmp_z_sku."</td><td>".deel_bfb($tmp_z_sku,$xj_z_sku)."</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>".$tmp_yd_sku."</td><td>".deel_bfb($tmp_yd_sku,$xj_yd_sku)."</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>".deel_01(deel_num($tmp_yd_js))."</td><td>".deel_bfb($tmp_yd_js,$xj_yd_js)."</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>".deel_01(deel_num($tmp_yd_je))."</td><td>".deel_bfb($tmp_yd_je,$xj_yd_je)."</td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td>".deel_01(deel_num($tmp_yd_jsje))."</td><td>".deel_bfb($tmp_yd_jsje,$xj_yd_jsje)."</td>":"";
|
||||
|
||||
$content_data.=($dr_zd1)?"<td>".deel_dr($dr_zd1,$tmp_dr["dr_zd1"])."</td>":"";
|
||||
$content_data.=($dr_zd2)?"<td>".deel_dr($dr_zd2,$tmp_dr["dr_zd2"])."</td>":"";
|
||||
$content_data.=($dr_zd3)?"<td>".deel_dr($dr_zd3,$tmp_dr["dr_zd3"])."</td>":"";
|
||||
$content_data.=($dr_zd4)?"<td>".deel_dr($dr_zd4,$tmp_dr["dr_zd4"])."</td>":"";
|
||||
$content_data.=($dr_zd5)?"<td>".deel_dr($dr_zd5,$tmp_dr["dr_zd5"])."</td>":"";
|
||||
$content_data.=($dr_zd6)?"<td>".deel_dr($dr_zd6,$tmp_dr["dr_zd6"])."</td>":"";
|
||||
$content_data.=($dr_zd7)?"<td>".deel_dr($dr_zd7,$tmp_dr["dr_zd7"])."</td>":"";
|
||||
$content_data.=($dr_zd8)?"<td>".deel_dr($dr_zd8,$tmp_dr["dr_zd8"])."</td>":"";
|
||||
|
||||
$content_data.="</tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
if($xj_z_sku>0){
|
||||
$content_data.="<tr align=center style='background-color:#f2f2f2'>";
|
||||
$content_data.="<td>小计</td><td></td>";
|
||||
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.=($head_zd1=="y")?"<td>".keep_float($tmp["jj"],1)."</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td>".$xj_z_ks."</td><td>".deel_bfb($xj_z_ks,$total_ks)."</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>".$xj_yd_ks."</td><td>".deel_bfb($xj_yd_ks,$total_yd_ks)."</td>":"";
|
||||
}
|
||||
$content_data.=($head_zd4=="y")?"<td>".$xj_z_sku."</td><td>".deel_bfb($xj_z_sku,$total_sku)."</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>".$xj_yd_sku."</td><td>".deel_bfb($xj_yd_sku,$total_yd_sku)."</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>".deel_num($xj_yd_js)."</td><td>".deel_bfb($xj_yd_js,$total_yd_js)."</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>".deel_num($xj_yd_je)."</td><td>".deel_bfb($xj_yd_je,$total_yd_je)."</td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td>".deel_num($xj_yd_jsje)."</td><td>".deel_bfb($xj_yd_jsje,$total_yd_jsje)."</td>":"";
|
||||
|
||||
$content_data.=($dr_zd1)?"<td>".deel_dr_hj($dr_zd1,$xj_dr["dr_zd1"])."</td>":"";
|
||||
$content_data.=($dr_zd2)?"<td>".deel_dr_hj($dr_zd2,$xj_dr["dr_zd2"])."</td>":"";
|
||||
$content_data.=($dr_zd3)?"<td>".deel_dr_hj($dr_zd3,$xj_dr["dr_zd3"])."</td>":"";
|
||||
$content_data.=($dr_zd4)?"<td>".deel_dr_hj($dr_zd4,$xj_dr["dr_zd4"])."</td>":"";
|
||||
$content_data.=($dr_zd5)?"<td>".deel_dr_hj($dr_zd5,$xj_dr["dr_zd5"])."</td>":"";
|
||||
$content_data.=($dr_zd6)?"<td>".deel_dr_hj($dr_zd6,$xj_dr["dr_zd6"])."</td>":"";
|
||||
$content_data.=($dr_zd7)?"<td>".deel_dr_hj($dr_zd7,$xj_dr["dr_zd7"])."</td>":"";
|
||||
$content_data.=($dr_zd8)?"<td>".deel_dr_hj($dr_zd8,$xj_dr["dr_zd8"])."</td>":"";
|
||||
|
||||
$content_data.="</tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
$content_data.="</tbody>";
|
||||
}else{
|
||||
//取得总款数
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ".$s_group_by1."<>''".$con1);
|
||||
$total_ks=$tmp["num"];
|
||||
//取得总款色数
|
||||
$total_sku=0;
|
||||
$q2="select no,color,color_ka from ".$table_pre."kh where ".$s_group_by1."<>''".$con1;
|
||||
$r2=$db->query($q2);
|
||||
while($m2=$db->fetch_array($r2)){
|
||||
$arr1=explode(",",$m2["color"]);
|
||||
$arr2=explode(",",$m2["color_ka"]);
|
||||
for($i1=0;$i1<count($arr1);$i1++){
|
||||
if(!in_array($arr1[$i1],$arr2))
|
||||
$total_sku++;
|
||||
}
|
||||
}
|
||||
//取得总均价
|
||||
$tmp=get_db_msg("select sum(price)/count(*) 'jj' from ".$table_pre."kh where ".$s_group_by1."<>''".$con1);
|
||||
$price_jj=keep_float($tmp["jj"],1);
|
||||
//取得已订总件数和金额
|
||||
$q="select sum(num) 'num',sum(je) 'je',sum(jsje) 'jsje' from ".$table_pre."order where ".$s_group_by1."<>'' ".$con;
|
||||
$tmp=get_db_msg($q);
|
||||
$total_yd_js=$tmp["num"];
|
||||
$total_yd_je=$tmp["je"];
|
||||
$total_yd_jsje=$tmp["jsje"];
|
||||
//取得已订总款数
|
||||
$tmp1=get_db_msg("select count(distinct no) 'num' from ".$table_pre."order where ".$s_group_by1."<>'' ".$con);
|
||||
$total_yd_ks=$tmp1["num"];
|
||||
//取得已订总款色数
|
||||
$tmp1=get_db_msg("select count(distinct no,color) 'num' from ".$table_pre."order where ".$s_group_by1."<>'' ".$con);
|
||||
$total_yd_sku=$tmp1["num"];
|
||||
|
||||
$total_dr=get_db_msg("select ".$str_sql." from ".$table_pre.$tbname." where id<>0 ".$con_dr);
|
||||
$json_data.="\"sys_bb_type\":\"report_1w\",";
|
||||
$tb_data_x="";
|
||||
$tb_data_y=",";
|
||||
//
|
||||
$tbody_str="";
|
||||
$q="select * from ".$table_pre."keyword where cate='".$s_group_by1."' 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_by1."='".$m["no"]."'".$con);
|
||||
$tmp_yd_ks=$tmp["num"];
|
||||
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ".$s_group_by1."='".$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_by1."='".$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_by1."='".$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',sum(jsje) 'jsje' from ".$table_pre."order where id>0 and ".$s_group_by1."='".$m["no"]."'".$con);
|
||||
$tmp_yd_js=$tmp["num"];
|
||||
$tmp_yd_je=$tmp["je"];
|
||||
$tmp_yd_jsje=$tmp["jsje"];
|
||||
$tmp_dr=get_db_msg("select ".$str_sql." from ".$table_pre.$tbname." where id>0 and zd1='".$m4["title"]."' ".$con_dr);
|
||||
if($tmp_z_ks>0){
|
||||
//取得均价
|
||||
$tmp=get_db_msg("select sum(price)/count(*) 'jj' from ".$table_pre."kh where ".$s_group_by1."='".$m["no"]."'".$con1);
|
||||
//
|
||||
$tb_data_x.=$m["title"].",";
|
||||
$tb_data_y.=str_replace("%","",deel_bfb($tmp_yd_js,$total_yd_js)).",";
|
||||
if($msg_client["face"]=="4"){
|
||||
$content_data.="<tr align=center><td><a style='color:blue;' href='javascript:void(0);' onclick=go_dkhtml({'s_".$s_group_by1."':'".$m["no"]."'})>".$m["title"]."</a></td>";
|
||||
}else{
|
||||
$content_data.="<tr align=center><td>".$m["title"]."</td>";
|
||||
}
|
||||
//
|
||||
$content_data.=($head_zd1=="y")?"<td>".keep_float($tmp["jj"],1)."</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td>".$tmp_z_ks."</td><td>".deel_bfb($tmp_z_ks,$total_ks)."</td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>".$tmp_yd_ks."</td><td>".deel_bfb($tmp_yd_ks,$total_yd_ks)."</td>":"";
|
||||
$content_data.=($head_zd4=="y")?"<td>".$tmp_z_sku."</td><td>".deel_bfb($tmp_z_sku,$total_sku)."</td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>".$tmp_yd_sku."</td><td>".deel_bfb($tmp_yd_sku,$total_yd_sku)."</td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>".deel_01(deel_num($tmp_yd_js))."</td><td>".deel_bfb($tmp_yd_js,$total_yd_js)."</td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>".deel_01(deel_num($tmp_yd_je))."</td><td>".deel_bfb($tmp_yd_je,$total_yd_je)."</td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td>".deel_01(deel_num($tmp_yd_jsje))."</td><td>".deel_bfb($tmp_yd_jsje,$total_yd_jsje)."</td>":"";
|
||||
|
||||
$content_data.=($dr_zd1)?"<td>".deel_dr($dr_zd1,$tmp_dr["dr_zd1"])."</td>":"";
|
||||
$content_data.=($dr_zd2)?"<td>".deel_dr($dr_zd2,$tmp_dr["dr_zd2"])."</td>":"";
|
||||
$content_data.=($dr_zd3)?"<td>".deel_dr($dr_zd3,$tmp_dr["dr_zd3"])."</td>":"";
|
||||
$content_data.=($dr_zd4)?"<td>".deel_dr($dr_zd4,$tmp_dr["dr_zd4"])."</td>":"";
|
||||
$content_data.=($dr_zd5)?"<td>".deel_dr($dr_zd5,$tmp_dr["dr_zd5"])."</td>":"";
|
||||
$content_data.=($dr_zd6)?"<td>".deel_dr($dr_zd6,$tmp_dr["dr_zd6"])."</td>":"";
|
||||
$content_data.=($dr_zd7)?"<td>".deel_dr($dr_zd7,$tmp_dr["dr_zd7"])."</td>":"";
|
||||
$content_data.=($dr_zd8)?"<td>".deel_dr($dr_zd8,$tmp_dr["dr_zd8"])."</td>":"";
|
||||
|
||||
$content_data.="</tr>";
|
||||
$count++;
|
||||
}
|
||||
|
||||
}
|
||||
$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."\",";
|
||||
$content_data.="</tbody>";
|
||||
|
||||
}
|
||||
//
|
||||
$content_data.="<tfoot>";
|
||||
$content_data.="<tr style='background-color:#f2f2f2' align=center>";
|
||||
$content_data.="<td colspan=".$sp.">合计</td>";
|
||||
|
||||
if($s_group_by1!="sx" && $s_group_by2!="sx" && $s_group_by3!="sx" && $s_group_by1!="color" && $s_group_by2!="color" && $s_group_by3!="color"){
|
||||
$content_data.=($head_zd1=="y")?"<td>".$price_jj."</td>":"";
|
||||
$content_data.=($head_zd2=="y")?"<td>".$total_ks."</td><td></td>":"";
|
||||
$content_data.=($head_zd3=="y")?"<td>".deel_num($total_yd_ks)."</td><td></td>":"";
|
||||
}
|
||||
|
||||
$content_data.=($head_zd4=="y")?"<td>".deel_num($total_sku)."</td><td></td>":"";
|
||||
$content_data.=($head_zd5=="y")?"<td>".deel_num($total_yd_sku)."</td><td></td>":"";
|
||||
$content_data.=($head_zd6=="y")?"<td>".deel_num($total_yd_js)."</td><td></td>":"";
|
||||
$content_data.=($head_zd7=="y")?"<td>".deel_num($total_yd_je)."</td><td></td>":"";
|
||||
$content_data.=($head_zd8=="y")?"<td>".deel_num($total_yd_jsje)."</td><td></td>":"";
|
||||
|
||||
$content_data.=($dr_zd1)?"<td>".deel_dr_hj($dr_zd1,$total_dr["dr_zd1"])."</td>":"";
|
||||
$content_data.=($dr_zd2)?"<td>".deel_dr_hj($dr_zd2,$total_dr["dr_zd2"])."</td>":"";
|
||||
$content_data.=($dr_zd3)?"<td>".deel_dr_hj($dr_zd3,$total_dr["dr_zd3"])."</td>":"";
|
||||
$content_data.=($dr_zd4)?"<td>".deel_dr_hj($dr_zd4,$total_dr["dr_zd4"])."</td>":"";
|
||||
$content_data.=($dr_zd5)?"<td>".deel_dr_hj($dr_zd5,$total_dr["dr_zd5"])."</td>":"";
|
||||
$content_data.=($dr_zd6)?"<td>".deel_dr_hj($dr_zd6,$total_dr["dr_zd6"])."</td>":"";
|
||||
$content_data.=($dr_zd7)?"<td>".deel_dr_hj($dr_zd7,$total_dr["dr_zd7"])."</td>":"";
|
||||
$content_data.=($dr_zd8)?"<td>".deel_dr_hj($dr_zd8,$total_dr["dr_zd8"])."</td>":"";
|
||||
|
||||
$content_data.="</tr>";
|
||||
$content_data.="</tfoot>";
|
||||
$content_data.="</table>";
|
||||
}
|
||||
$json_data.="\"table_html\":\"".$content_data."\",";
|
||||
|
||||
|
||||
function deel_dr($dr,$v){
|
||||
$tmp=explode("_",$dr);
|
||||
if($tmp[1]=="百分比"){
|
||||
$tmp1=$v*100;
|
||||
return $tmp1."%";
|
||||
}else if($tmp[1]=="数字"){
|
||||
return deel_num($v);
|
||||
}else{
|
||||
return $v;
|
||||
}
|
||||
}
|
||||
function deel_dr_hj($dr,$v){
|
||||
$tmp=explode("_",$dr);
|
||||
if($tmp[1]=="百分比"){
|
||||
$tmp1=$v*100;
|
||||
return $tmp1."%";
|
||||
}else if($tmp[1]=="数字"){
|
||||
return deel_num($v);
|
||||
}else{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
function get_dr_title($dr){
|
||||
$tmp=explode("_",$dr);
|
||||
return $tmp[0];
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
//2维订货深度分析
|
||||
//可配置参数:zd1|series|维度1,zd2|category|维度2
|
||||
//20181211 by hehe
|
||||
//-----参数配置
|
||||
//横向维度
|
||||
$zd1=get_plugin_set("zd1","series");
|
||||
$zd2=get_plugin_set("zd2","category");
|
||||
//查询条件
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
$con_other=" and ka<>'y'";//排除条件
|
||||
//店铺查询条件
|
||||
$con="";
|
||||
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{
|
||||
//代理角色所有客户
|
||||
$con=" and (upath='".$msg_client["path"]."-".$msg_client["id"]."' or upath like '".$msg_client["path"]."-".$msg_client["id"]."-%')";
|
||||
}
|
||||
}
|
||||
}
|
||||
//取得选项的值
|
||||
$tmp_arr=array($zd1,$zd2);
|
||||
for($i=0;$i<count($tmp_arr);$i++){
|
||||
$v1=$tmp_arr[$i]."_title";
|
||||
$v2=$tmp_arr[$i]."_arr";
|
||||
//取得对应字段的名称
|
||||
$$v1=get_cate_title_no("arr_select",$tmp_arr[$i]);
|
||||
//取得字段的选项值
|
||||
$q1="select no,title from ".$table_pre."keyword where cate='".$tmp_arr[$i]."' order by no";
|
||||
$r1=$db->query($q1);
|
||||
$arr_tmp1=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_tmp1[$m1["no"]]=$m1["title"];
|
||||
}
|
||||
$$v2=$arr_tmp1;
|
||||
}
|
||||
//
|
||||
$content_data.="<table border='0' width='100%' id='tabledetail' class='cell-border nowrap' cellspacing='1' cellpadding='4' class='layui-table'><thead>";
|
||||
//----------------取得款号表数据
|
||||
$arr_kh_data=array();
|
||||
$q="select ".$zd1.",".$zd2.",count(*) 'ks',sum(price)/count(*) 'jj' from ".$table_pre."kh where ka<>'y'".$con_other.$con_sx." group by ".$zd1.",".$zd2;
|
||||
//echo $q."<br>";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
//取得sku
|
||||
$q1="select color,color_ka from ".$table_pre."kh where ka<>'y'".$con_other.$con_sx." and ".$zd1."='".$m[$zd1]."' and ".$zd2."='".$m[$zd2]."'";
|
||||
//echo $q1."<br>";
|
||||
$r1=$db->query($q1);
|
||||
$tmp_sku=0;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
if(trim($m1["color_ka"]))
|
||||
$num1=count(explode(",",$m1["color_ka"]));
|
||||
else
|
||||
$num1=0;
|
||||
$tmp_sku+=count(explode(",",$m1["color"]))-$num1;
|
||||
}
|
||||
//
|
||||
$arr_kh_data[$m[$zd1]][$m[$zd2]]=array($m["ks"],$tmp_sku,$m["jj"]);
|
||||
}
|
||||
//----------------取得订单表数据
|
||||
$arr_order_data=array();
|
||||
$q="select ".$zd1.",".$zd2.",count(distinct iid,color) 'sku',max(num) 'num_max',min(num) 'num_min',sum(num)/count(distinct iid,color) 'num_pj' from ".$table_pre."order where id<>'0'".$con_other.$con_sx.$con." group by ".$zd1.",".$zd2;
|
||||
//echo $q."<br>";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_order_data[$m[$zd1]][$m[$zd2]]=array($m["sku"],deel_num(keep_float($m["num_pj"],1)),deel_num($m["num_max"]),deel_num($m["num_min"]));
|
||||
}
|
||||
//计算第一维度小计,用于计算占比
|
||||
$var1=$zd1."_arr";
|
||||
$var2=$zd2."_arr";
|
||||
$arr_kh_data_xj=array();
|
||||
$arr_order_date_xj=array();
|
||||
$total_yd_sku=0;
|
||||
$total_ks=$total_sku=0;
|
||||
foreach($$var1 as $k1=>$v1){
|
||||
$xj1=$xj2=0;
|
||||
$xj11=$xj12=$xj13=$xj14=$xj15=0;
|
||||
foreach($$var2 as $k2=>$v2){
|
||||
$xj1+=$arr_kh_data[$k1][$k2][0];
|
||||
$xj2+=$arr_kh_data[$k1][$k2][1];
|
||||
$total_ks+=$arr_kh_data[$k1][$k2][0];
|
||||
$total_sku+=$arr_kh_data[$k1][$k2][1];
|
||||
$xj11+=$arr_order_data[$k1][$k2][0];
|
||||
$total_yd_sku+=$arr_order_data[$k1][$k2][0];
|
||||
}
|
||||
$arr_kh_data_xj[$k1]=array($xj1,$xj2);
|
||||
$arr_order_data_xj[$k1]=array($xj11);
|
||||
}
|
||||
//-----------------------------表头第一行
|
||||
$var_t1=$zd1."_title";
|
||||
$var_t2=$zd2."_title";
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<th align='center'><strong>".$$var_t1."</strong></th><th align='center'><strong>".$$var_t2."</strong></th><th align='center'><strong>开发SKU</strong></th><th align='center'><strong>开发SKU占比</strong></th><th align='center'><strong>订货SKU</strong></th><th align='center'><strong>平均值</strong></th><th align='center'><strong>最大值</strong></th><th align='center'><strong>最小值</strong></th>";
|
||||
$content_data.="</tr>";
|
||||
$content_data.="</thead>";
|
||||
//--------------------输出报表-----------------------------------------------
|
||||
$content_data.="<tbody>";
|
||||
$var1=$zd1."_arr";
|
||||
$var2=$zd2."_arr";
|
||||
$count=0;
|
||||
foreach($$var1 as $k1 => $v1){
|
||||
foreach($$var2 as $k2 => $v2){
|
||||
if($arr_kh_data[$k1][$k2][0]>0){
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<td align='center'>".$v1."</td><td align='center'>".$v2."</td><td align='center'>".deel_0($arr_kh_data[$k1][$k2][1])."</td><td align='center'>".deel_bfb($arr_kh_data[$k1][$k2][1],$total_sku)."</td><td align='center'>".deel_0($arr_order_data[$k1][$k2][0])."</td><td align='center'>".deel_0($arr_order_data[$k1][$k2][1])."</td><td align='center'>".deel_0($arr_order_data[$k1][$k2][2])."</td><td align='center'>".deel_0($arr_order_data[$k1][$k2][3])."</td>";
|
||||
$content_data.="</tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$content_data.="</tbody>";
|
||||
$content_data.="</table>";
|
||||
$json_data.="\"table_html\":\"".$content_data."\",";
|
||||
?>
|
||||
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
//3维订货深度分析
|
||||
//可配置参数:zd1|series|维度1,zd2|category|维度2,zd3|bc|维度3
|
||||
//20181211 by hehe
|
||||
//-----参数配置
|
||||
//横向维度
|
||||
$zd1=get_plugin_set("zd1","series");
|
||||
$zd2=get_plugin_set("zd2","category");
|
||||
$zd3=get_plugin_set("zd3","bc");
|
||||
//查询条件
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
$con_other=" and ka<>'y'";//排除条件
|
||||
//店铺查询条件
|
||||
$con="";
|
||||
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{
|
||||
//代理角色所有客户
|
||||
$con=" and (upath='".$msg_client["path"]."-".$msg_client["id"]."' or upath like '".$msg_client["path"]."-".$msg_client["id"]."-%')";
|
||||
}
|
||||
}
|
||||
//取得选项的值
|
||||
$tmp_arr=array($zd1,$zd2,$zd3);
|
||||
for($i=0;$i<count($tmp_arr);$i++){
|
||||
$v1=$tmp_arr[$i]."_title";
|
||||
$v2=$tmp_arr[$i]."_arr";
|
||||
//取得对应字段的名称
|
||||
$$v1=get_cate_title_no("arr_select",$tmp_arr[$i]);
|
||||
//取得字段的选项值
|
||||
$q1="select no,title from ".$table_pre."keyword where cate='".$tmp_arr[$i]."' order by no";
|
||||
$r1=$db->query($q1);
|
||||
$arr_tmp1=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_tmp1[$m1["no"]]=$m1["title"];
|
||||
}
|
||||
$$v2=$arr_tmp1;
|
||||
}
|
||||
//
|
||||
$content_data.="<table border='0' cellspacing='1' cellpadding='4' class='layui-table'><thead>";
|
||||
//----------------取得款号表数据
|
||||
$arr_kh_data=array();
|
||||
$q="select ".$zd1.",".$zd2.",".$zd3.",count(*) 'ks',sum(price)/count(*) 'jj' from ".$table_pre."kh where ka<>'y'".$con_other.$con_sx." group by ".$zd1.",".$zd2.",".$zd3;
|
||||
//echo $q."<br>";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
//取得sku
|
||||
$q1="select color,color_ka from ".$table_pre."kh where ka<>'y'".$con_other.$con_sx." and ".$zd1."='".$m[$zd1]."' and ".$zd2."='".$m[$zd2]."' and ".$zd3."='".$m[$zd3]."'";
|
||||
//echo $q1."<br>";
|
||||
$r1=$db->query($q1);
|
||||
$tmp_sku=0;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
if(trim($m1["color_ka"]))
|
||||
$num1=count(explode(",",$m1["color_ka"]));
|
||||
else
|
||||
$num1=0;
|
||||
$tmp_sku+=count(explode(",",$m1["color"]))-$num1;
|
||||
}
|
||||
//
|
||||
$arr_kh_data[$m[$zd1]][$m[$zd2]][$m[$zd3]]=array($m["ks"],$tmp_sku,$m["jj"]);
|
||||
}
|
||||
//----------------取得订单表数据
|
||||
$arr_order_data=array();
|
||||
$q="select ".$zd1.",".$zd2.",".$zd3.",count(distinct iid,color) 'sku',max(num) 'num_max',min(num) 'num_min',sum(num)/count(distinct iid,color) 'num_pj' from ".$table_pre."order where id<>'0'".$con_other.$con_sx.$con." group by ".$zd1.",".$zd2.",".$zd3;
|
||||
//echo $q."<br>";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_order_data[$m[$zd1]][$m[$zd2]][$m[$zd3]]=array($m["sku"],deel_num(keep_float($m["num_pj"],1)),deel_num($m["num_max"]),deel_num($m["num_min"]));
|
||||
}
|
||||
//计算第一维度小计,用于计算占比
|
||||
$var1=$zd1."_arr";
|
||||
$var2=$zd2."_arr";
|
||||
$var3=$zd3."_arr";
|
||||
$arr_kh_data_xj=array();
|
||||
$arr_order_date_xj=array();
|
||||
$total_yd_sku=0;
|
||||
$total_ks=$total_sku=0;
|
||||
foreach($$var1 as $k1=>$v1){
|
||||
$xj1=$xj2=0;
|
||||
$xj11=$xj12=$xj13=$xj14=$xj15=0;
|
||||
foreach($$var2 as $k2=>$v2){
|
||||
foreach($$var3 as $k3=>$v3){
|
||||
$xj1+=$arr_kh_data[$k1][$k2][$k3][0];
|
||||
$xj2+=$arr_kh_data[$k1][$k2][$k3][1];
|
||||
$total_ks+=$arr_kh_data[$k1][$k2][$k3][0];
|
||||
$total_sku+=$arr_kh_data[$k1][$k2][$k3][1];
|
||||
$xj11+=$arr_order_data[$k1][$k2][$k3][0];
|
||||
$total_yd_sku+=$arr_order_data[$k1][$k2][$k3][0];
|
||||
}
|
||||
}
|
||||
$arr_kh_data_xj[$k1]=array($xj1,$xj2);
|
||||
$arr_order_data_xj[$k1]=array($xj11);
|
||||
}
|
||||
//-----------------------------表头第一行
|
||||
$var_t1=$zd1."_title";
|
||||
$var_t2=$zd2."_title";
|
||||
$var_t3=$zd3."_title";
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<th align='center'><strong>".$$var_t1."</strong></th><th align='center'><strong>".$$var_t2."</strong></th><th align='center'><strong>".$$var_t3."</strong></th><th align='center'><strong>开发SKU</strong></th><th align='center'><strong>开发SKU占比</strong></th><th align='center'><strong>订货SKU</strong></th><th align='center'><strong>平均值</strong></th><th align='center'><strong>最大值</strong></th><th align='center'><strong>最小值</strong></th>";
|
||||
$content_data.="</tr>";
|
||||
$content_data.="</thead>";
|
||||
//--------------------输出报表-----------------------------------------------
|
||||
$content_data.="<tbody>";
|
||||
$var1=$zd1."_arr";
|
||||
$var2=$zd2."_arr";
|
||||
$var3=$zd3."_arr";
|
||||
$count=0;
|
||||
foreach($$var1 as $k1 => $v1){
|
||||
foreach($$var2 as $k2 => $v2){
|
||||
foreach($$var3 as $k3 => $v3){
|
||||
if($arr_kh_data[$k1][$k2][$k3][0]>0){
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<td align='center'>".$v1."</td><td align='center'>".$v2."</td><td align='center'>".$v3."</td><td align='center'>".deel_0($arr_kh_data[$k1][$k2][$k3][1])."</td><td align='center'>".deel_bfb($arr_kh_data[$k1][$k2][$k3][1],$total_sku)."</td><td align='center'>".deel_0($arr_order_data[$k1][$k2][$k3][0])."</td><td align='center'>".deel_0($arr_order_data[$k1][$k2][$k3][1])."</td><td align='center'>".deel_0($arr_order_data[$k1][$k2][$k3][2])."</td><td align='center'>".deel_0($arr_order_data[$k1][$k2][$k3][3])."</td>";
|
||||
$content_data.="</tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$content_data.="</tbody>";
|
||||
$content_data.="</table>";
|
||||
$json_data.="\"table_html\":\"".$content_data."\",";
|
||||
?>
|
||||
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
//2维尺码占比分析
|
||||
//可配置参数:zd1|sxz|横向维度1,zd2|category|横向维度2
|
||||
//20181211 by hehe
|
||||
//-----参数配置
|
||||
//横向维度
|
||||
$zd1=get_plugin_set("zd1","sxz");
|
||||
$zd2=get_plugin_set("zd2","category");
|
||||
//查询条件
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
//尺码组
|
||||
$arr_size_group=array("衣服","鞋子");
|
||||
//
|
||||
$con_other=" and ka<>'y'";//排除条件
|
||||
$sys_size_num=get_max_size_num();
|
||||
//
|
||||
$tmp_arr=array();
|
||||
for($i=0;$i<count($arr_sx);$i++){
|
||||
$tmp_arr[$i]=$arr_sx[$i];
|
||||
}
|
||||
$tmp_arr[$i]=$zd1;
|
||||
$i++;
|
||||
$tmp_arr[$i]=$zd2;
|
||||
//取得选项的值
|
||||
for($i=0;$i<count($tmp_arr);$i++){
|
||||
$v1=$tmp_arr[$i]."_title";
|
||||
$v2=$tmp_arr[$i]."_arr";
|
||||
//取得对应字段的名称
|
||||
$$v1=get_cate_title_no("arr_select",$tmp_arr[$i]);
|
||||
//取得字段的选项值
|
||||
$q1="select no,title from ".$table_pre."keyword where cate='".$tmp_arr[$i]."' order by no";
|
||||
$r1=$db->query($q1);
|
||||
$arr_tmp1=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_tmp1[$m1["no"]]=$m1["title"];
|
||||
}
|
||||
$$v2=$arr_tmp1;
|
||||
}
|
||||
//店铺查询条件
|
||||
$con="";
|
||||
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{
|
||||
//代理角色所有客户
|
||||
$con=" and (upath='".$msg_client["path"]."-".$msg_client["id"]."' or upath like '".$msg_client["path"]."-".$msg_client["id"]."-%')";
|
||||
}
|
||||
}
|
||||
//----------------构建筛选条件
|
||||
$q="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y'";
|
||||
$r=$db->query($q);
|
||||
$con_sx="";
|
||||
while($m=$db->fetch_array($r)){
|
||||
$var1="s_".$m["no"];
|
||||
if($$var1)
|
||||
$con_sx.=" and ".$m["no"]."='".$$var1."'";
|
||||
}
|
||||
if($s_is_sp)
|
||||
$con_sx.=" and is_sp='".$s_is_sp."'";
|
||||
//
|
||||
//----------------取得款号表数据
|
||||
$arr_kh_data=array();
|
||||
$q="select ".$zd1.",".$zd2.",count(*) 'ks',sum(price)/count(*) 'jj' from ".$table_pre."kh where ka<>'y'".$con_other.$con_sx." group by ".$zd1.",".$zd2;
|
||||
//echo $q."<br>";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_kh_data[$m[$zd1]][$m[$zd2]]=array($m["ks"]);
|
||||
}
|
||||
for($i1=0;$i1<count($arr_size_group);$i1++){
|
||||
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$arr_size_group[$i1]."'");
|
||||
$this_size_group_id=$tmp["id"];
|
||||
$q="select no,title from ".$table_pre."size where iid='".$this_size_group_id."' order by no";
|
||||
$arr_size=array();
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_size[$m["no"]]=$m["title"];
|
||||
}
|
||||
if(count($arr_size)>0){
|
||||
//----------------取得订单表数据
|
||||
$max_size=get_max_size_num();
|
||||
$arr_order_data=array();
|
||||
$q="select ".get_size_sql("sum1").",size_group_id,".$zd1.",".$zd2.",sum(num) 'num' from ".$table_pre."order where size_group_id='".$this_size_group_id."'".$con_other.$con_sx.$con." group by ".$zd1.",".$zd2;
|
||||
//echo $q."<br>";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$tmp_arr=array();
|
||||
for($i=1;$i<=$max_size;$i++){
|
||||
$tmp_arr[$i]=$m["num_".$i];
|
||||
}
|
||||
$tmp_arr["num"]=$m["num"];
|
||||
$arr_order_data[$m[$zd1]][$m[$zd2]]=$tmp_arr;
|
||||
}
|
||||
//计算第一维度小计,用于计算占比
|
||||
$var1=$zd1."_arr";
|
||||
$var2=$zd2."_arr";
|
||||
$arr_kh_data_xj=array();
|
||||
$arr_order_date_xj=array();
|
||||
$total_yd_sku=$total_yd_js=0;
|
||||
$total_ks=$total_sku=0;
|
||||
for($i=1;$i<=$max_size;$i++){
|
||||
$var="total_".$i;
|
||||
$$var=0;
|
||||
}
|
||||
foreach($$var1 as $k1=>$v1){
|
||||
$xj1=0;
|
||||
for($i=1;$i<=$max_size;$i++){
|
||||
$var="xj1".$i;
|
||||
$$var=0;
|
||||
}
|
||||
$xj_num=0;
|
||||
foreach($$var2 as $k2=>$v2){
|
||||
$xj1+=$arr_kh_data[$k1][$k2][0];
|
||||
$total_ks+=$arr_kh_data[$k1][$k2][0];
|
||||
for($i=1;$i<=$max_size;$i++){
|
||||
$var="xj1".$i;
|
||||
$$var+=$arr_order_data[$k1][$k2][$i];
|
||||
$var="total_".$i;
|
||||
$$var+=$arr_order_data[$k1][$k2][$i];
|
||||
$total_yd_js+=$arr_order_data[$k1][$k2][$i];
|
||||
}
|
||||
$xj_num+=$arr_order_data[$k1][$k2]["num"];
|
||||
}
|
||||
$arr_kh_data_xj[$k1]=array($xj1);
|
||||
$arr_tmp=array();
|
||||
for($i=1;$i<=$max_size;$i++){
|
||||
$var="xj1".$i;
|
||||
$arr_tmp[$i]=$$var;
|
||||
}
|
||||
$arr_tmp["xj_num"]=$xj_num;
|
||||
$arr_order_data_xj[$k1]=$arr_tmp;
|
||||
}
|
||||
//print_r($arr_order_data);
|
||||
//print_r($arr_order_data_xj);
|
||||
//echo "<br><br>";
|
||||
$content_data.="<p align='left' style='font-size:16px;font-weight:bold;'>".$arr_size_group[$i1]."尺码</p>";
|
||||
if($total_yd_js>0){
|
||||
$content_data.="<table border='0' cellspacing='1' cellpadding='4' class='layui-table'><thead>";
|
||||
//-----------------------------表头第一行
|
||||
$var_t1=$zd1."_title";
|
||||
$var_t2=$zd2."_title";
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<th align='center'><strong>".$$var_t1."</strong></th><th align='center'><strong>".$$var_t2."</strong></th>";
|
||||
foreach($arr_size as $k1 => $v1){
|
||||
$content_data.="<th align='center'><strong>".$v1."占比</strong></th>";
|
||||
}
|
||||
$content_data.="</tr>";
|
||||
$content_data.="</thead>";
|
||||
//--------------------输出报表-----------------------------------------------
|
||||
$content_data.="<tbody>";
|
||||
$var1=$zd1."_arr";
|
||||
$var2=$zd2."_arr";
|
||||
$count=0;
|
||||
foreach($$var1 as $k1 => $v1){
|
||||
foreach($$var2 as $k2 => $v2){
|
||||
if($arr_kh_data[$k1][$k2][0]>0){
|
||||
if($arr_order_data_xj[$k1]["xj_num"]>0){
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<td align='center'>".$v1."</td><td align='center'>".$v2."</td>";
|
||||
foreach($arr_size as $size1 => $s_title1){
|
||||
$content_data.="<td align='center'>".deel_bfb($arr_order_data[$k1][$k2][$size1],$arr_order_data[$k1][$k2]["num"])."</td>";
|
||||
}
|
||||
$content_data.="</tr>";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($arr_order_data_xj[$k1]["xj_num"]>0){
|
||||
//小计
|
||||
$content_data.="<tr><td align='center' colspan=2>".$v1."小计</td>";
|
||||
foreach($arr_size as $size1 => $s_title1){
|
||||
$content_data.="<td align='center'>".deel_bfb($arr_order_data_xj[$k1][$size1],$arr_order_data_xj[$k1]["xj_num"])."</td>";
|
||||
}
|
||||
$content_data.="</tr>";
|
||||
}
|
||||
}
|
||||
$content_data.="<tr><td align='center' colspan='2'>合计</td>";
|
||||
foreach($arr_size as $k1 => $v1){
|
||||
$var="total_".$k1;
|
||||
$content_data.="<td align='center'>".deel_bfb($$var,$total_yd_js)."</td>";
|
||||
}
|
||||
$content_data.="</tr>";
|
||||
$content_data.="</tbody>";
|
||||
$content_data.="</table><br><br>";
|
||||
}else{
|
||||
$content_data.="<p align='left'> 无订量!</p>";
|
||||
}
|
||||
}else{
|
||||
$content_data.="<p align='left'>".$arr_size_group[$i1].",无尺码数据!</p>";
|
||||
}
|
||||
}
|
||||
$json_data.="\"table_html\":\"".$content_data."\",";
|
||||
?>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
//未订色
|
||||
//by hehe 2014-08-12//
|
||||
$use_layui_datatable="y";//使用标准layui datatable格式数据
|
||||
$select_client_type="n";//dp:允许筛选店铺
|
||||
//-------------------------------------------layui 数据表格格式
|
||||
//--------------------------------表头
|
||||
//支持参数field,title,width,rowspan,colspan,style(样式),sort(true|false),fixed(left,right)
|
||||
$thead0="";
|
||||
$thead0.="{\"field\":\"ord\",\"title\":\"次序\",\"width\":80,\"sort\":true},";
|
||||
$thead0.="{\"field\":\"kh\",\"title\":\"款号\",\"width\":200},";
|
||||
$thead0.="{\"field\":\"color\",\"title\":\"颜色\",\"width\":100}";
|
||||
$thead="\"thead\":[{\"index\":0,\"content\":[".$thead0."]}],";
|
||||
$json_data.=$thead;
|
||||
//--------------------------------内容
|
||||
//店铺查询条件
|
||||
$con="";
|
||||
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"]."-%')";
|
||||
}
|
||||
}
|
||||
}
|
||||
if($s_username){
|
||||
$tbody="";
|
||||
$q="select id,no,color,color_ka from ".$table_pre."kh where ka<>'y'";
|
||||
$r=$db->query($q);
|
||||
$list=1;
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_color=explode(",",$m["color"]);
|
||||
$arr_color_ka=explode(",",$m["color_ka"]);
|
||||
for($i=0;$i<count($arr_color);$i++){
|
||||
if(!in_array($arr_color[$i],$arr_color_ka)){
|
||||
$check=get_db_msg("select count(*) 'num' from ".$table_pre."order where iid='".$m["id"]."' and color='".$arr_color[$i]."' ".$con);
|
||||
if($check["num"]>0){
|
||||
//已订
|
||||
}else{
|
||||
//未订
|
||||
$tbody.="{\"ord\":\"".$list."\",\"kh\":\"<a href=javascript:dk_single(".$m["id"].")>".$m["no"]."</a>\",\"color\":\"".$arr_color[$i]."-".get_cate_title_no("color",$arr_color[$i])."\"},";
|
||||
$list++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$json_data.="\"tbody\":[".deel_end($tbody)."],";
|
||||
?>
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
//1维指标分析
|
||||
//可配置参数:zd1|bc|维度
|
||||
//by hehe 2081211
|
||||
//-----参数配置
|
||||
//横向维度
|
||||
$zd1=get_plugin_set("zd1","bc");
|
||||
//
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
if(check_table_exist($table_pre."plugin_zbxf1")=="n"){
|
||||
//
|
||||
$code=0;
|
||||
$error_msg="请先设置指标数据!";
|
||||
}else{
|
||||
//店铺查询条件
|
||||
$con="";
|
||||
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{
|
||||
//代理角色所有客户
|
||||
$con=" and (upath='".$msg_client["path"]."-".$msg_client["id"]."' or upath like '".$msg_client["path"]."-".$msg_client["id"]."-%')";
|
||||
}
|
||||
}
|
||||
//
|
||||
$con_this=$con;
|
||||
$i=1;
|
||||
$v="zd".$i;
|
||||
$v1="zd_title".$i;
|
||||
$v2="arr_zd".$i;
|
||||
//取得对应字段的名称
|
||||
$$v1=get_cate_title_no("arr_select",$$v);
|
||||
//取得字段的选项值
|
||||
$q1="select no,title from ".$table_pre."keyword where cate='".$$v."' order by no";
|
||||
$r1=$db->query($q1);
|
||||
$arr_tmp=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_tmp[$m1["no"]]=$m1["title"];
|
||||
}
|
||||
$$v2=$arr_tmp;
|
||||
$content_data.="<table border='0' cellspacing='1' cellpadding='4' class='layui-table'><thead>";
|
||||
//第一行
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<th align='center'><strong>".$zd_title1."</strong></th><th align='center'><strong>指标金额</strong></th><th align='center'><strong>订货金额</strong></th><th align='center'><strong>金额完成率</strong></th><th align='center'><strong>指标数量</strong></th><th align='center'><strong>订货数量</strong></th><th align='center'><strong>数量完成率</strong></th><th align='center'><strong>指标款数</strong></th><th align='center'><strong>订货款数</strong></th><th align='center'><strong>款数完成率</strong></th>";
|
||||
$content_data.="</tr>";
|
||||
$content_data.="</thead>";
|
||||
//-----------取得款号数据
|
||||
//订单表数据
|
||||
$q3="select ".$zd1.",count(*) 'ks' from ".$table_pre."kh where ka<>'y' group by ".$zd1;
|
||||
$r3=$db->query($q3);
|
||||
$arr_data_kh=array();
|
||||
while($m3=$db->fetch_array($r3)){
|
||||
$arr_data_kh[$m3[$zd1]]=array($m3["ks"]);
|
||||
}
|
||||
//-----------取得订单数据
|
||||
$q3="select ".$zd1.",count(distinct iid) 'ks',sum(num) 'js',sum(jsje) 'je' from ".$table_pre."order where ka<>'y'".$con_other.$con_this." group by ".$zd1;
|
||||
$r3=$db->query($q3);
|
||||
$arr_data_order=array();
|
||||
while($m3=$db->fetch_array($r3)){
|
||||
$arr_data_order[$m3[$zd1]]=array($m3["je"],$m3["js"],$m3["ks"]);
|
||||
}
|
||||
//--------------------输出报表-----------------------------------------------
|
||||
$content_data.="<tbody>";
|
||||
foreach($arr_zd1 as $key1=>$value1){
|
||||
$xj1=$xj2=$xj3=$xj4=$xj5=$xj6=0;
|
||||
//取得指标数据
|
||||
$m_zbxf=get_db_msg("select sum(js) 'js',sum(je) 'je',sum(ks) 'ks' from ".$table_pre."plugin_zbxf1 where key1='".$value1."'".$con_this);
|
||||
if($arr_data_kh[$key1][0]>0){
|
||||
$str_zbje=$str_jewcl=$str_zbjs=$str_jswcl=$str_zbks=$str_kswcl=" ";
|
||||
if($m_zbxf["je"]>0){
|
||||
$str_zbje=deel_num($m_zbxf["je"]);
|
||||
$str_jewcl=deel_bfb1($arr_data_order[$key1][0],$m_zbxf["je"],1);
|
||||
}
|
||||
if($m_zbxf["js"]>0){
|
||||
$str_zbjs=deel_num($m_zbxf["js"]);
|
||||
$str_jswcl=deel_bfb1($arr_data_order[$key1][1],$m_zbxf["js"],1);
|
||||
}
|
||||
if($m_zbxf["ks"]>0){
|
||||
$str_zbks=deel_num($m_zbxf["ks"]);
|
||||
$str_kswcl=deel_bfb1($arr_data_order[$key1][2],$m_zbxf["ks"],1);
|
||||
}
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<td align='center'>".$value1."</td><td align='center'>".$str_zbje."</td><td align='center'>".deel_0(deel_num($arr_data_order[$key1][0]))."</td><td align='center'>".$str_jewcl."</td><td align='center'>".$str_zbjs."</td><td align='center'>".deel_0($arr_data_order[$key1][1])."</td><td align='center'>".$str_jswcl."</td><td align='center'>".$str_zbks."</td><td align='center'>".deel_0($arr_data_order[$key1][2])."</td><td align='center'>".$str_kswcl."</td>";
|
||||
$xj1+=$m_zbxf["je"];
|
||||
$xj2+=$arr_data_order[$key1][0];
|
||||
$xj3+=$m_zbxf["js"];
|
||||
$xj4+=$arr_data_order[$key1][1];
|
||||
$xj5+=$m_zbxf["ks"];
|
||||
$xj6+=$arr_data_order[$key1][2];
|
||||
//
|
||||
$total_1+=$m_zbxf["je"];
|
||||
$total_2+=$arr_data_order[$key1][0];
|
||||
$total_3+=$m_zbxf["js"];
|
||||
$total_4+=$arr_data_order[$key1][1];
|
||||
$total_5+=$m_zbxf["ks"];
|
||||
$total_6+=$arr_data_order[$key1][2];
|
||||
$content_data.="</tr>";
|
||||
}
|
||||
}
|
||||
$content_data.="<tr><td align='center'>合计</td><td align='center'>".deel_0($total_1)."</td><td align='center'>".deel_0($total_2)."</td><td align='center'>".deel_bfb1($total_2,$total_1,1)."</td><td align='center'>".deel_0($total_3)."</td><td align='center'>".deel_0($total_4)."</td><td align='center'>".deel_bfb1($total_4,$total_3,1)."</td><td align='center'>".deel_0($total_5)."</td><td align='center'>".deel_0($total_6)."</td><td align='center'>".deel_bfb1($total_6,$total_5,1)."</td></tr>";
|
||||
$content_data.="</tbody></table>";
|
||||
}
|
||||
$json_data.="\"table_html\":\"".$content_data."\",";
|
||||
?>
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
//2维指标分析
|
||||
//可配置参数:zd1|bc|维度1,zd2|category|维度2
|
||||
//by hehe 2081211
|
||||
//-----参数配置
|
||||
//横向维度
|
||||
$zd1=get_plugin_set("zd1","bc");
|
||||
$zd2=get_plugin_set("zd2","category");
|
||||
//
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
if(check_table_exist($table_pre."plugin_zbxf2")=="n"){
|
||||
//
|
||||
$code=0;
|
||||
$error_msg="请先设置指标数据!";
|
||||
}else{
|
||||
//店铺查询条件
|
||||
$con="";
|
||||
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{
|
||||
//代理角色所有客户
|
||||
$con=" and (upath='".$msg_client["path"]."-".$msg_client["id"]."' or upath like '".$msg_client["path"]."-".$msg_client["id"]."-%')";
|
||||
}
|
||||
}
|
||||
//
|
||||
$con_this=$con;
|
||||
for($i=1;$i<3;$i++){
|
||||
$v="zd".$i;
|
||||
$v1="zd_title".$i;
|
||||
$v2="arr_zd".$i;
|
||||
//取得对应字段的名称
|
||||
$$v1=get_cate_title_no("arr_select",$$v);
|
||||
//取得字段的选项值
|
||||
$q1="select no,title from ".$table_pre."keyword where cate='".$$v."' order by no";
|
||||
$r1=$db->query($q1);
|
||||
$arr_tmp=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_tmp[$m1["no"]]=$m1["title"];
|
||||
}
|
||||
$$v2=$arr_tmp;
|
||||
}
|
||||
$content_data.="<table border='0' cellspacing='1' cellpadding='4' class='layui-table'><thead>";
|
||||
//第一行
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<th align='center'><strong>".$zd_title1."</strong></th><th align='center'><strong>".$zd_title2."</strong></th><th align='center'><strong>指标金额</strong></th><th align='center'><strong>订货金额</strong></th><th align='center'><strong>金额完成率</strong></th><th align='center'><strong>指标数量</strong></th><th align='center'><strong>订货数量</strong></th><th align='center'><strong>数量完成率</strong></th><th align='center'><strong>指标款数</strong></th><th align='center'><strong>订货款数</strong></th><th align='center'><strong>款数完成率</strong></th>";
|
||||
$content_data.="</tr>";
|
||||
$content_data.="</thead>";
|
||||
//-----------取得款号数据
|
||||
//订单表数据
|
||||
$q3="select ".$zd1.",".$zd2.",count(*) 'ks' from ".$table_pre."kh where ka<>'y' group by ".$zd1.",".$zd2;
|
||||
$r3=$db->query($q3);
|
||||
$arr_data_kh=array();
|
||||
while($m3=$db->fetch_array($r3)){
|
||||
$arr_data_kh[$m3[$zd1]][$m3[$zd2]]=array($m3["ks"]);
|
||||
}
|
||||
//-----------取得订单数据
|
||||
$q3="select ".$zd1.",".$zd2.",count(distinct iid) 'ks',sum(num) 'js',sum(jsje) 'je' from ".$table_pre."order where ka<>'y'".$con_other.$con_this." group by ".$zd1.",".$zd2;
|
||||
$r3=$db->query($q3);
|
||||
$arr_data_order=array();
|
||||
while($m3=$db->fetch_array($r3)){
|
||||
$arr_data_order[$m3[$zd1]][$m3[$zd2]]=array($m3["je"],$m3["js"],$m3["ks"]);
|
||||
}
|
||||
//--------------------输出报表-----------------------------------------------
|
||||
$content_data.="<tbody>";
|
||||
foreach($arr_zd1 as $key1=>$value1){
|
||||
$xj1=$xj2=$xj3=$xj4=$xj5=$xj6=0;
|
||||
foreach($arr_zd2 as $key2=>$value2){
|
||||
//取得指标数据
|
||||
$m_zbxf=get_db_msg("select sum(js) 'js',sum(je) 'je',sum(ks) 'ks' from ".$table_pre."plugin_zbxf2 where key1='".$value1."' and key2='".$value2."'".$con_this);
|
||||
if($arr_data_kh[$key1][$key2][0]>0){
|
||||
$str_zbje=$str_jewcl=$str_zbjs=$str_jswcl=$str_zbks=$str_kswcl=" ";
|
||||
if($m_zbxf["je"]>0){
|
||||
$str_zbje=deel_num($m_zbxf["je"]);
|
||||
$str_jewcl=deel_bfb1($arr_data_order[$key1][$key2][0],$m_zbxf["je"],1);
|
||||
}
|
||||
if($m_zbxf["js"]>0){
|
||||
$str_zbjs=deel_num($m_zbxf["js"]);
|
||||
$str_jswcl=deel_bfb1($arr_data_order[$key1][$key2][1],$m_zbxf["js"],1);
|
||||
}
|
||||
if($m_zbxf["ks"]>0){
|
||||
$str_zbks=deel_num($m_zbxf["ks"]);
|
||||
$str_kswcl=deel_bfb1($arr_data_order[$key1][$key2][2],$m_zbxf["ks"],1);
|
||||
}
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<td align='center'>".$value1."</td><td align='center'>".$value2."</td><td align='center'>".$str_zbje."</td><td align='center'>".deel_0(deel_num($arr_data_order[$key1][$key2][0]))."</td><td align='center'>".$str_jewcl."</td><td align='center'>".$str_zbjs."</td><td align='center'>".deel_0($arr_data_order[$key1][$key2][1])."</td><td align='center'>".$str_jswcl."</td><td align='center'>".$str_zbks."</td><td align='center'>".deel_0($arr_data_order[$key1][$key2][2])."</td><td align='center'>".$str_kswcl."</td>";
|
||||
$xj1+=$m_zbxf["je"];
|
||||
$xj2+=$arr_data_order[$key1][$key2][0];
|
||||
$xj3+=$m_zbxf["js"];
|
||||
$xj4+=$arr_data_order[$key1][$key2][1];
|
||||
$xj5+=$m_zbxf["ks"];
|
||||
$xj6+=$arr_data_order[$key1][$key2][2];
|
||||
//
|
||||
$total_1+=$m_zbxf["je"];
|
||||
$total_2+=$arr_data_order[$key1][$key2][0];
|
||||
$total_3+=$m_zbxf["js"];
|
||||
$total_4+=$arr_data_order[$key1][$key2][1];
|
||||
$total_5+=$m_zbxf["ks"];
|
||||
$total_6+=$arr_data_order[$key1][$key2][2];
|
||||
$content_data.="</tr>";
|
||||
}
|
||||
}
|
||||
//小计
|
||||
$content_data.="<tr><td align='center' colspan='2'>".$value1."小计</td><td align='center'>".deel_0($xj1)."</td><td align='center'>".deel_0($xj2)."</td><td align='center'>".deel_bfb1($xj2,$xj1,1)."</td><td align='center'>".deel_0($xj3)."</td><td align='center'>".deel_0($xj4)."</td><td align='center'>".deel_bfb1($xj4,$xj3,1)."</td><td align='center'>".deel_0($xj5)."</td><td align='center'>".deel_0($xj6)."</td><td align='center'>".deel_bfb1($xj6,$xj5,1)."</td></tr>";
|
||||
}
|
||||
$content_data.="<tr><td align='center' colspan='2'>合计</td><td align='center'>".deel_0($total_1)."</td><td align='center'>".deel_0($total_2)."</td><td align='center'>".deel_bfb1($total_2,$total_1,1)."</td><td align='center'>".deel_0($total_3)."</td><td align='center'>".deel_0($total_4)."</td><td align='center'>".deel_bfb1($total_4,$total_3,1)."</td><td align='center'>".deel_0($total_5)."</td><td align='center'>".deel_0($total_6)."</td><td align='center'>".deel_bfb1($total_6,$total_5,1)."</td></tr>";
|
||||
$content_data.="</tbody></table>";
|
||||
}
|
||||
$json_data.="\"table_html\":\"".$content_data."\",";
|
||||
?>
|
||||
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
//主推款订货完成分析
|
||||
//可配置参数:zd1|sxz|横向维度,ztk_zd|brand|推荐款字段,ztk_value|11|推荐款值
|
||||
//by hehe 20161211
|
||||
//横向维度
|
||||
$zd1=get_plugin_set("zd1","sxz");
|
||||
$ztk_zd=get_plugin_set("tjk","brand");
|
||||
$ztk_value=get_plugin_set("tjk_value","11");
|
||||
//查询条件
|
||||
$select_client_type="y";//dp:允许筛选店铺
|
||||
$use_layui_datatable="n";//使用标准layui datatable格式数据
|
||||
//-----推荐款条件
|
||||
$con_kh_dj=" and (".$ztk_zd."='".$ztk_value."')";
|
||||
//店铺查询条件
|
||||
$con="";
|
||||
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{
|
||||
//代理角色所有客户
|
||||
$con=" and (upath='".$msg_client["path"]."-".$msg_client["id"]."' or upath like '".$msg_client["path"]."-".$msg_client["id"]."-%')";
|
||||
}
|
||||
}
|
||||
//
|
||||
for($i=1;$i<3;$i++){
|
||||
$v="zd".$i;
|
||||
$v1="zd_title".$i;
|
||||
$v2="arr_zd".$i;
|
||||
//取得对应字段的名称
|
||||
$$v1=get_cate_title_no("arr_select",$$v);
|
||||
//取得字段的选项值
|
||||
$q1="select no,title from ".$table_pre."keyword where cate='".$$v."' order by no";
|
||||
$r1=$db->query($q1);
|
||||
$arr_tmp=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_tmp[$m1["no"]]=$m1["title"];
|
||||
}
|
||||
$$v2=$arr_tmp;
|
||||
}
|
||||
$content_data.="<table border='0' cellspacing='1' cellpadding='4' class='layui-table'><thead>";
|
||||
//表头第一行
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<th align='center' rowspan='2'><strong>".$zd_title1."</strong></th><th align='center' colspan='3'><strong>设计款数</strong></th><th align='center' colspan='3'><strong>订单款数</strong></th><th align='center'><strong>主推款订货完成</strong></th><th align='center' colspan='3'><strong>已订件数</strong></th>";
|
||||
$content_data.="</tr>";
|
||||
//表头第二行
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<th align='center'><strong>总款数</strong></th><th align='center'><strong>主推款数</strong></th><th align='center'><strong>占比</strong></th><th align='center'><strong>总款数</strong></th><th align='center'><strong>主推款数</strong></th><th align='center'><strong>占比</strong></th><th align='center'><strong>占比</strong></th><th align='center'><strong>总件数</strong></th><th align='center'><strong>主推款件数</strong></th><th align='center'><strong>占比</strong></th>";
|
||||
$content_data.="</tr>";
|
||||
$content_data.="</thead>";
|
||||
|
||||
//-----------取得报表数据
|
||||
//款号表货品数据
|
||||
$q1="select ".$zd1.",count(*) as num from ".$table_pre."kh where ka<>'y' group by ".$zd1;
|
||||
$r1=$db->query($q1);
|
||||
$arr_design_data=array();
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$arr_design_data[$m1[$zd1]]=$m1["num"];//款号表中每一大类的设计款数
|
||||
}
|
||||
|
||||
$q2="select ".$zd1.",count(*) as num from ".$table_pre."kh where ka<>'y'".$con_kh_dj." group by ".$zd1;
|
||||
$r2=$db->query($q2);
|
||||
$arr_design_kh_dj_data=array();
|
||||
while($m2=$db->fetch_array($r2)){
|
||||
$arr_design_kh_dj_data[$m2[$zd1]]=$m2["num"];//款号表中每一大类内的SA款数
|
||||
}
|
||||
//订单表数据
|
||||
$q3="select ".$zd1.",count(distinct iid) as num from ".$table_pre."order where ka<>'y'".$con." group by ".$zd1;
|
||||
$r3=$db->query($q3);
|
||||
$arr_order_ksdata=array();
|
||||
while($m3=$db->fetch_array($r3)){
|
||||
$arr_order_ksdata[$m3[$zd1]]=$m3["num"];//订单表内每一大类的款数
|
||||
}
|
||||
|
||||
$q4="select ".$zd1.",count(distinct iid) as num from ".$table_pre."order where ka<>'y'".$con.$con_kh_dj." group by ".$zd1;
|
||||
$r4=$db->query($q4);
|
||||
$arr_order_kh_dj_ksdata=array();
|
||||
while($m4=$db->fetch_array($r4)){
|
||||
$arr_order_kh_dj_ksdata[$m4[$zd1]]=$m4["num"];//订单表内每一大类的SA款数
|
||||
}
|
||||
|
||||
$q5="select ".$zd1.",sum(num) as num from ".$table_pre."order where ka<>'y'".$con." group by ".$zd1;
|
||||
$r5=$db->query($q5);
|
||||
$arr_order_data=array();
|
||||
while($m5=$db->fetch_array($r5)){
|
||||
$arr_order_data[$m5[$zd1]]=$m5["num"];//订单表中每一大类的订单总数
|
||||
}
|
||||
$q6="select ".$zd1.",sum(num) as num from ".$table_pre."order where ka<>'y'".$con.$con_kh_dj." group by ".$zd1;
|
||||
$r6=$db->query($q6);
|
||||
$arr_order_kh_dj_data=array();
|
||||
while($m6=$db->fetch_array($r6)){
|
||||
$arr_order_kh_dj_data[$m6[$zd1]]=$m6["num"];//订单表中每一大类SA订单总数
|
||||
}
|
||||
//--------------------输出报表-----------------------------------------------
|
||||
$content_data.="<tbody>";
|
||||
foreach($arr_zd1 as $key=>$value){
|
||||
$content_data.="<tr>";
|
||||
$content_data.="<td align='center'>".$value."</td><td align='center'>".$arr_design_data[$key]."</td><td align='center'>".$arr_design_kh_dj_data[$key]."</td><td align='center'>".deel_bfb($arr_design_kh_dj_data[$key],$arr_design_data[$key])."</td><td align='center'>".$arr_order_ksdata[$key]."</td><td align='center'>".$arr_order_kh_dj_ksdata[$key]."</td><td align='center'>".deel_bfb($arr_order_kh_dj_ksdata[$key],$arr_order_ksdata[$key])."</td><td align='center'>".deel_bfb($arr_order_kh_dj_ksdata[$key],$arr_design_kh_dj_data[$key])."</td><td align='center'>".$arr_order_data[$key]."</td><td align='center'>".$arr_order_kh_dj_data[$key]."</td><td align='center'>".deel_bfb($arr_order_kh_dj_data[$key],$arr_order_data[$key])."</td>";
|
||||
$total_1+=$arr_design_data[$key];
|
||||
$total_2+=$arr_design_kh_dj_data[$key];
|
||||
$total_3+=$arr_order_ksdata[$key];
|
||||
$total_4+=$arr_order_kh_dj_ksdata[$key];
|
||||
$total_5+=$arr_order_data[$key];
|
||||
$total_6+=$arr_order_kh_dj_data[$key];
|
||||
$content_data.="</tr>";
|
||||
}
|
||||
$content_data.="<tr><td align='center'>合计</td><td align='center'>".$total_1."</td><td align='center'>".$total_2."</td><td align='center'>".deel_bfb($total_2,$total_1)."</td><td align='center'>".$total_3."</td><td align='center'>".$total_4."</td><td align='center'>".deel_bfb($total_4,$total_3)."</td><td align='center'>".deel_bfb($total_4,$total_2)."</td><td align='center'>".$total_5."</td><td align='center'>".$total_6."</td><td align='center'>".deel_bfb($total_6,$total_5)."</td></tr>";
|
||||
$content_data.="</tbody>";
|
||||
$content_data.="</table>";
|
||||
$json_data.="\"table_html\":\"".$content_data."\",";
|
||||
?>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
$this_path=str_replace("/plugin","",dirname(__FILE__));
|
||||
$this_path=str_replace("\\plugin","",$this_path);
|
||||
define("THIS_FILE_ROOT",$this_path."/ipad");
|
||||
define("THIS_COOKIE","edt_".date("Ymd")."_cookie");
|
||||
?>
|
||||
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
/*门禁表
|
||||
DROP TABLE IF EXISTS MW_EntryList;
|
||||
CREATE TABLE `MW_EntryList` (
|
||||
`PKID` int(10) unsigned NOT NULL auto_increment,
|
||||
`DevCode` varchar(250) NOT NULL default '',
|
||||
`EPCCode` varchar(250) NOT NULL default '',
|
||||
`ReadTime` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`Status` varchar(20) NOT NULL default '',
|
||||
PRIMARY KEY (`PKID`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
insert into MW_EntryList (DevCode) values ('111');
|
||||
insert into MW_EntryList (DevCode) values ('123');
|
||||
*/
|
||||
function _mysql_connect_mj(){
|
||||
global $dbmj_host,$dbmj_user,$dbmj_pw,$dbmj_name;
|
||||
$db_mj=new DB_Sql;
|
||||
$db_mj->connect($dbmj_host,$dbmj_user,$dbmj_pw,$dbmj_name);
|
||||
return $db_mj;
|
||||
}
|
||||
//------------------------------------------门禁执行页面,RFID方式
|
||||
////////////////////////////////////定义门禁数据库
|
||||
$dbmj_host='localhost';
|
||||
$dbmj_user='hehe';
|
||||
$dbmj_pw='hehe';
|
||||
$dbmj_name='edt';
|
||||
$dbmj_table_name='MW_EntryList';
|
||||
////////////////////////////////////
|
||||
include "../tmpl/config.php";
|
||||
require "../ipad/include/function.php";
|
||||
require "../ipad/include/db_mysql.php";
|
||||
define("THIS_FILE_ROOT",dir_cutb(dirname(__FILE__),1)."/ipad");
|
||||
error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
||||
date_default_timezone_set('Asia/Shanghai');
|
||||
//-------------------------------register global
|
||||
$magic_quotes_gpc = get_magic_quotes_gpc();
|
||||
$register_globals = @ini_get('register_globals');
|
||||
if(!$register_globals || !$magic_quotes_gpc) {
|
||||
@extract(daddslashes($_POST));
|
||||
@extract(daddslashes($_GET));
|
||||
}
|
||||
if(!@mysql_connect($dbmj_host,$dbmj_user,$dbmj_pw)) {
|
||||
echo "Can not connect to MJ MySQL server";
|
||||
exit;
|
||||
}
|
||||
if($_a=="tb"){
|
||||
header("Content-type: text/html;charset=GB2312");
|
||||
$db=_mysql_connect_mj();
|
||||
$q="select * from ".$dbmj_table_name." where status<>'y' order by ReadTime";
|
||||
$r=$db->query($q);
|
||||
$arr_mj=array();
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_mj[]=$m["DevCode"];
|
||||
$db->query("update ".$dbmj_table_name." set status='y' where PKID='".$m["PKID"]."'");
|
||||
}
|
||||
if(count($arr_mj)>0){
|
||||
$db=_mysql_connect();
|
||||
$tip="";
|
||||
for($i=0;$i<count($arr_mj);$i++){
|
||||
$m1=get_db_msg("select id,username,title,available from ".$table_pre."client where rfid='".$arr_mj[$i]."'");
|
||||
if($m1["id"]>0){
|
||||
$tip.="<span class='right'>".$m1["title"]."(".$m1["username"].")";
|
||||
if($m1["available"]=="y"){
|
||||
$tip.="禁用";
|
||||
$db->query("update ".$table_pre."client set available='n' where id='".$m1["id"]."'");
|
||||
}else{
|
||||
$tip.="启用";
|
||||
$db->query("update ".$table_pre."client set available='y' where id='".$m1["id"]."'");
|
||||
}
|
||||
$tip.="成功!</span><br>";
|
||||
}else{
|
||||
$tip.="<span class='wrong'>".$arr_mj[$i].",操作失败!<br></span>";
|
||||
}
|
||||
}
|
||||
echo "y|".$tip;
|
||||
}else{
|
||||
echo "n|";
|
||||
}
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>e订通-门禁</title>
|
||||
<style>
|
||||
BODY{
|
||||
font-family:宋体;FONT-SIZE:16px;margin:0px;padding:0px;
|
||||
}
|
||||
a,a:link,a:visited,a:active {
|
||||
text-decoration:none;COLOR: #0000ff;FONT-SIZE:16px;
|
||||
}
|
||||
a:hover {
|
||||
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:16px;
|
||||
}
|
||||
body,input,td,select,div,li,ul,textarea,form {
|
||||
font-family:宋体;
|
||||
FONT-SIZE:16px;
|
||||
}
|
||||
.wrong{
|
||||
color:#ff0000;font-weight:bold;
|
||||
}
|
||||
.right{
|
||||
color:#0000ff;font-weight:bold;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
//ajax
|
||||
function ajaxinit()
|
||||
{
|
||||
var xmlhttp;
|
||||
try {
|
||||
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (E) {
|
||||
xmlhttp=false;
|
||||
}
|
||||
}
|
||||
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
|
||||
try {
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
} catch (e) {
|
||||
xmlhttp=false;
|
||||
}
|
||||
}
|
||||
if (!xmlhttp && window.createRequest) {
|
||||
try {
|
||||
xmlhttp = window.createRequest();
|
||||
} catch (e) {
|
||||
xmlhttp=false;
|
||||
}
|
||||
}
|
||||
return xmlhttp;
|
||||
}
|
||||
//
|
||||
function tb(){
|
||||
var xmlhttp=ajaxinit();
|
||||
var url="mjrfid.php?_a=tb";
|
||||
var obj=document.getElementById("div_tip");
|
||||
xmlhttp.open("POST",url,true);
|
||||
xmlhttp.setRequestHeader("Cache-Control","no-cache");
|
||||
xmlhttp.onreadystatechange=function(){
|
||||
if(xmlhttp.readyState==4 && xmlhttp.status==200){
|
||||
var arr_tmp=xmlhttp.responseText.split("|");
|
||||
if(arr_tmp[0]=="y"){
|
||||
obj.innerHTML=arr_tmp[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
xmlhttp.send(null);
|
||||
}
|
||||
//
|
||||
function auto_tb(){
|
||||
tb();
|
||||
setTimeout("auto_tb()",3000);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="auto_tb();">
|
||||
<br />
|
||||
<form name="form1" action="mj.php" method="post">
|
||||
<table width="50%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
|
||||
<input type="hidden" name="is_submit" value="y">
|
||||
<tr>
|
||||
<td align="center" bgcolor="#f0f0f0" style="font-size:18px" height="40"><b>e订通-门禁系统</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" bgcolor="#ffffff" valign="top" style="line-height:150%;" height="100px"><div id="div_tip">系统等待中......</div></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
//------------------------------------------门禁执行页面,条码扫描
|
||||
//定义条码对应内容
|
||||
$tm_zd="username";//一般是username,rfid
|
||||
//
|
||||
include "../tmpl/config.php";
|
||||
require "../ipad/include/function.php";
|
||||
require "../ipad/include/db_mysql.php";
|
||||
define("THIS_FILE_ROOT",dir_cutb(dirname(__FILE__),1)."/ipad");
|
||||
error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
||||
date_default_timezone_set('Asia/Shanghai');
|
||||
//-------------------------------register global
|
||||
$magic_quotes_gpc = get_magic_quotes_gpc();
|
||||
$register_globals = @ini_get('register_globals');
|
||||
if(!$register_globals || !$magic_quotes_gpc) {
|
||||
@extract(daddslashes($_POST));
|
||||
@extract(daddslashes($_GET));
|
||||
}
|
||||
$db=_mysql_connect();
|
||||
if($rfid){
|
||||
$m1=get_db_msg("select id,username,title,available from ".$table_pre."client where ".$tm_zd."='".$rfid."' order by id limit 0,1");
|
||||
if($m1["id"]>0){
|
||||
if($m1["available"]=="y"){
|
||||
//
|
||||
$db->query("update ".$table_pre."client set available='n' where id='".$m1["id"]."'");
|
||||
$msg="<span class=\"right\">".$m1["title"]."(".$m1["username"]."),禁用成功!</span>";
|
||||
}else{
|
||||
$db->query("update ".$table_pre."client set available='y' where id='".$m1["id"]."'");
|
||||
$msg="<span class=\"right\">".$m1["title"]."(".$m1["username"]."),启用成功!</span>";
|
||||
}
|
||||
}else{
|
||||
$msg="<span class=\"wrong\">对不起,改用户不存在!</span>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>e订通-门禁</title>
|
||||
<style>
|
||||
BODY{
|
||||
font-family:宋体;FONT-SIZE:16px;margin:0px;padding:0px;
|
||||
}
|
||||
a,a:link,a:visited,a:active {
|
||||
text-decoration:none;COLOR: #0000ff;FONT-SIZE:16px;
|
||||
}
|
||||
a:hover {
|
||||
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:16px;
|
||||
}
|
||||
body,input,td,select,div,li,ul,textarea,form {
|
||||
font-family:宋体;
|
||||
FONT-SIZE:16px;
|
||||
}
|
||||
.wrong{
|
||||
color:#ff0000;font-weight:bold;
|
||||
}
|
||||
.right{
|
||||
color:#0000ff;font-weight:bold;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="document.getElementById('rfid').focus();">
|
||||
<br />
|
||||
<form name="form1" action="mjtm.php" method="post">
|
||||
<table width="50%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
|
||||
<input type="hidden" name="is_submit" value="y">
|
||||
<tr>
|
||||
<td align="center" bgcolor="#f0f0f0" style="font-size:18px" height="40"><b>e订通-门禁系统</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" bgcolor="#ffffff" height="40"><input type="text" name="rfid" id="rfid" value="" style="width:200px;height:25px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" bgcolor="#f0f0f0" height="40"><input type="submit" value=" 提 交 "></td>
|
||||
</tr>
|
||||
<?php
|
||||
if($msg){
|
||||
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 357 KiB |
|
After Width: | Height: | Size: 353 KiB |
|
After Width: | Height: | Size: 136 KiB |
|
After Width: | Height: | Size: 293 KiB |
|
After Width: | Height: | Size: 262 KiB |
|
After Width: | Height: | Size: 216 KiB |
|
After Width: | Height: | Size: 263 KiB |
|
After Width: | Height: | Size: 197 KiB |
|
After Width: | Height: | Size: 248 KiB |
|
After Width: | Height: | Size: 222 KiB |
|
After Width: | Height: | Size: 286 KiB |
|
After Width: | Height: | Size: 254 KiB |
|
After Width: | Height: | Size: 145 KiB |
@@ -0,0 +1,18 @@
|
||||
BODY {
|
||||
margin:0px;padding:8px;background-color:#ffffff;
|
||||
}
|
||||
a,a:link,a:visited,a:active {
|
||||
text-decoration:none;COLOR: #000000;FONT-SIZE:13px;
|
||||
}
|
||||
a:hover {
|
||||
TEXT-DECORATION: none;COLOR: #999999;FONT-SIZE:13px;
|
||||
}
|
||||
input,select,option{
|
||||
height:30px;
|
||||
}
|
||||
body,input,td,select,div,li,ul,textarea,form {
|
||||
font-family:宋体;FONT-SIZE:13px;
|
||||
}
|
||||
.button1{
|
||||
height:40px;
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
<?php
|
||||
error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
||||
date_default_timezone_set('Asia/Shanghai');
|
||||
function deel_0($num){
|
||||
if($num<10)
|
||||
return "0".$num;
|
||||
else
|
||||
return $num;
|
||||
}
|
||||
$t=$_GET["t"];
|
||||
// $p=$_GET["p"];
|
||||
$rurl=$_GET["rurl"];
|
||||
$title=$_GET["title"];
|
||||
$max_p=array("1"=>13);//图片目录=>图片数量
|
||||
//$max_p=array("1"=>13,"2"=>5);
|
||||
//$arr_menu=array("1"=>"订货手册","2"=>"客户须知");
|
||||
$arr_menu=array("1"=>"订货手册","2"=>"客户须知");//图片目录=>标题
|
||||
$t=$t?$t:1;
|
||||
// $p=$p?$p:"1";
|
||||
//echo $max_p[$t]."--<Br>";
|
||||
// if($p>$max_p[$t])
|
||||
// echo "<script> alert('wrong number!'); history.back(); </script>";
|
||||
// $menu="";
|
||||
// foreach($arr_menu as $k => $v){
|
||||
// $menu.="<td height=\"25\"";
|
||||
// if($t==$k)
|
||||
// $menu.=" class=\"tab_click\"";
|
||||
// else
|
||||
// $menu.=" class=\"tab_normal\"";
|
||||
// $menu.=" onclick=\"location.href='".$_SERVER[PHP_SELF]."?t=".$k."&rurl=".urlencode($rurl)."'\">".$v."</td>";
|
||||
// }
|
||||
//pre_page
|
||||
// $pre_page=$p-1;
|
||||
// if($pre_page==0)
|
||||
// $button_pre_page="<input type=\"button\" value=\" 上一页 \" class=\"button1\" onclick=\"alert('已经是第一页了!')\">";
|
||||
// else
|
||||
// $button_pre_page="<input type=\"button\" value=\" 上一页 \" class=\"button1\" onclick=\"location.href='".$_SERVER[PHP_SELF]."?t=".$t."&p=".$pre_page."&rurl=".urlencode($rurl)."'\">";
|
||||
//next_page
|
||||
// $next_page=$p+1;
|
||||
// if($next_page>$max_p[$t])
|
||||
// $button_next_page="<input type=\"button\" value=\" 下一页 \" class=\"button1\" onclick=\"alert('已经是最后一页了!')\">";
|
||||
// else
|
||||
// $button_next_page="<input type=\"button\" value=\" 下一页 \" class=\"button1\" onclick=\"location.href='".$_SERVER[PHP_SELF]."?t=".$t."&p=".$next_page."&rurl=".urlencode($rurl)."'\">";
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width,height=device-height,user-scalable=yes,initial-scale=1,maximum-scale=3.0,minimum-scale=1" />
|
||||
<title>PPT文稿</title>
|
||||
<link rel="stylesheet" media="all" href="index.css" />
|
||||
<style>
|
||||
.tab_normal{
|
||||
border:1px solid #cccccc;cursor:pointer;font-weight:normal;background-color:#ffffff;font-size:14px;
|
||||
}
|
||||
.tab_click{
|
||||
border:1px solid #000000;cursor:pointer;font-weight:bold;background-color:#cccccc;font-size:14px;
|
||||
}
|
||||
.viewer-container {background-color: white !important;}
|
||||
.state_bar {
|
||||
height: 45px;
|
||||
line-height: 45px;
|
||||
background-color: #f8f8f8;
|
||||
border: 1px solid #eee;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.state_bar .text_title {
|
||||
width: 100px;
|
||||
float: left;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
}
|
||||
.state_bar .btn_close {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
float: right;
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="../../ipad/layuiadmin/layui/css/layui.css">
|
||||
<script src="../../ipad/layuiadmin/layui/layui.js"></script>
|
||||
<link rel="stylesheet" href="../../ipad/js/viewer/viewer.min.css">
|
||||
<script src="../../ipad/js/viewer/viewer.min.js"></script>
|
||||
<!-- <link href="../jquery-mobile/jquery.mobile-1.1.0.css" rel="stylesheet" type="text/css"/>
|
||||
<script src="../jquery-mobile/jquery.js" type="text/javascript"></script>
|
||||
<script src="../jquery-mobile/jquery.mobile-1.1.0.min.js" type="text/javascript"></script> -->
|
||||
<script>
|
||||
// layui.use(["jquery"], function() {
|
||||
// var $ = layui.jquery
|
||||
|
||||
// $(document).ready(function() {
|
||||
// $("#home").live("swipeleft",function(){
|
||||
// go_next();
|
||||
// });
|
||||
// $("#home").live("swiperight",function(){
|
||||
// go_pre();
|
||||
// });
|
||||
// });
|
||||
|
||||
// var p=<?php echo $p; ?>;
|
||||
// var max_p=<?php echo $max_p[$t]; ?>;
|
||||
|
||||
// function go_pre(){
|
||||
// var p_pre=p-1;
|
||||
// if(p_pre==0)
|
||||
// p_pre=max_p;
|
||||
// window.location.href='<?php echo $_SERVER[PHP_SELF]."?rurl=".urlencode($rurl)."&t=".$t; ?>&p='+p_pre;
|
||||
// }
|
||||
// function go_next(){
|
||||
// var p_next=p+1;
|
||||
// if(p_next>max_p)
|
||||
// p_next=1;
|
||||
// window.location.href='<?php echo $_SERVER[PHP_SELF]."?rurl=".urlencode($rurl)."&t=".$t; ?>&p='+p_next;
|
||||
// }
|
||||
// })
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="home">
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
$menu = '<div class="layui-btn-group" style="padding: 16px;">';
|
||||
foreach($arr_menu as $k => $v){
|
||||
$menu .= '';
|
||||
if($t==$k)
|
||||
$menu .= '<button type="button" class="layui-btn layui-btn-normal layui-btn-sm">'.$v.'</button>';
|
||||
else
|
||||
$menu .= '<button type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="location.href=\''.$_SERVER[PHP_SELF].'?t='.$k.'&rurl='.urlencode($rurl).'&title='.$title.'\'">'.$v.'</button>';
|
||||
}
|
||||
$menu .= '</div>';
|
||||
echo $menu;
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="pic" align="center">
|
||||
<?php
|
||||
for ($i = 1; $i <= $max_p[$t]; $i++) {
|
||||
echo '<img id="pic-'.$i.'" src="images/'.$t.'/'.deel_0($i).'.jpg'.'" data-origina="images/'.$t.'/'.deel_0($i).'.jpg'.'" width="90%" '.($i == 1 ? 'class="pic-active layui-anim layui-anim-scale"' : 'class="layui-anim layui-anim-scale" style="display: none;"').'/>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" height="50" valign="middle">
|
||||
<div id="page"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
layui.use(["laypage", "jquery"], function() {
|
||||
var laypage = layui.laypage
|
||||
,$ = layui.jquery
|
||||
|
||||
new Viewer(document.getElementById("pic"), {
|
||||
url: "data-original"
|
||||
,toolbar: false
|
||||
,title: false
|
||||
,rotatable: false
|
||||
,backdrop: false // 点击非图片层关闭
|
||||
,container: $("body", top.document)[0]
|
||||
})
|
||||
|
||||
laypage.render({
|
||||
elem: 'page'
|
||||
,count: <?php echo $max_p[$t]?$max_p[$t]:0; ?>
|
||||
,limit: 1
|
||||
,curr: 1
|
||||
,layout: ['prev', 'page', 'next', 'skip']
|
||||
,theme: '#1E9FFF'
|
||||
,jump: function(obj, first){
|
||||
if(!first){
|
||||
$("#pic .pic-active").removeClass("pic-active").hide()
|
||||
$("#pic-"+obj.curr).addClass("pic-active").show()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
$(".layui-layer-iframe", parent.document).css({
|
||||
top: 0
|
||||
,left: 0
|
||||
,width: "100%"
|
||||
,height: "100%"
|
||||
})
|
||||
$(".layui-layer-iframe .layui-layer-content", parent.document).css({
|
||||
top: 0
|
||||
,left: 0
|
||||
,width: "100%"
|
||||
,height: "100%"
|
||||
})
|
||||
$(".layui-layer-iframe .layui-layer-content iframe", parent.document).css({
|
||||
height: "100%"
|
||||
})
|
||||
|
||||
})
|
||||
function u_close_this_div(){
|
||||
layui.use('layer', function(){
|
||||
var index = parent.layer.getFrameIndex(window.name)
|
||||
parent.layer.close(index)
|
||||
})
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,253 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="viewport" content="user-scalable=yes,initial-scale=1,maximum-scale=3.0,minimum-scale=1" />
|
||||
<meta http-equive="Cache-Control" content="max-age=3153600"/>
|
||||
<title>问卷调查-E订通</title>
|
||||
<style>
|
||||
BODY {
|
||||
margin:0px;padding:10px;background-color:#ffffff;
|
||||
}
|
||||
a,a:link,a:visited,a:active {
|
||||
text-decoration:none;COLOR: #ffffff;FONT-SIZE:14px;
|
||||
}
|
||||
a:hover {
|
||||
TEXT-DECORATION: none;COLOR: #cccccc;FONT-SIZE:14px;
|
||||
}
|
||||
input,select,option{
|
||||
height:30px;
|
||||
}
|
||||
td,select,div,li,ul,textarea,form {
|
||||
font-family:宋体;FONT-SIZE:14px;background-color:#f0f0f0;line-height:100%;
|
||||
}
|
||||
.selection{
|
||||
vertical-align:middle; margin-top:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
function answer_check_submit(num){
|
||||
var answer_str='';
|
||||
var pass=true;
|
||||
for(var i=0;i<=num;i++){
|
||||
var num_checked=0;
|
||||
var tmp_0=document.getElementsByName('answer_'+i);
|
||||
for(var j=0;j<tmp_0.length;j++){
|
||||
var tmp_1=document.getElementById(i+"_"+j);
|
||||
if(tmp_1.type=='text'){
|
||||
tmp_1.value=tmp_1.value?tmp_1.value:'客户未回答此问题.'
|
||||
var text_id=document.getElementById('text_'+i+'_'+j).value;
|
||||
answer_str+=','+text_id+'|'+tmp_1.value;
|
||||
num_checked++;
|
||||
}else{
|
||||
if(tmp_1.checked){
|
||||
answer_str+=','+tmp_1.value;
|
||||
num_checked++;
|
||||
}
|
||||
if(tmp_1.disabled==true){
|
||||
num_checked++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(num_checked==0 && tmp_0.length>0){
|
||||
pass=false;
|
||||
alert('第 '+(i)+' 题未作答,请返回第 '+(i)+' 题答题.');
|
||||
document.getElementById(i).focus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(num>0 && pass){
|
||||
answer_str=answer_str.substring(1);
|
||||
document.getElementById('answer_str').value=answer_str;
|
||||
document.form_answer.submit();
|
||||
}
|
||||
}
|
||||
function answerAction(id){
|
||||
var actionObj=document.getElementById(id);
|
||||
var aid=actionObj.name.split('_');
|
||||
str=actionObj.value
|
||||
var url='../plugin/survey_gl.php?str='+str;
|
||||
var xmlhttp;
|
||||
if(window.XMLHttpRequest){
|
||||
xmlhttp=new XMLHttpRequest();
|
||||
}else{
|
||||
xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
|
||||
}
|
||||
xmlhttp.open('POST',url,true);
|
||||
xmlhttp.setRequestHeader('Cache-Control','no-cache');
|
||||
xmlhttp.onreadystatechange=function(){
|
||||
if(xmlhttp.readyState==4 && xmlhttp.status==200){
|
||||
var res=xmlhttp.responseText;
|
||||
arr=res.split(',');
|
||||
for (var i=0;i<arr.length;i++){
|
||||
for(var j=0;j<8;j++){
|
||||
inputSta=arr[i].split('|');
|
||||
var obj=document.getElementById(inputSta[1]+"_"+j);
|
||||
if(obj){
|
||||
if(inputSta[0]=='1'){
|
||||
obj.disabled=false;
|
||||
}else{
|
||||
obj.disabled=true;
|
||||
obj.checked=false;
|
||||
}
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
xmlhttp.send(null);
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" name="form_answer" method="get">
|
||||
|
||||
<table width="100%" border="0" align="center" cellpadding="4" cellspacing="0">
|
||||
|
||||
<?php
|
||||
require "../admin/config.php";
|
||||
require "../tmpl/config.php";
|
||||
require "../admin/include/function.php";
|
||||
require "../admin/include/db_mysql.php";
|
||||
|
||||
error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
||||
|
||||
$uid=$_COOKIE["edt_".date("Ymd")."_cookie"];
|
||||
|
||||
$db=_mysql_connect();
|
||||
|
||||
if($uid==""){
|
||||
alert("无法采集到当前用户身份信息,请尝试重新登录!");
|
||||
exit();
|
||||
}
|
||||
$msg_login=get_db_msg("select title from ".$table_pre."client where id='".$uid."'");
|
||||
|
||||
class question{
|
||||
public $ques_id;
|
||||
public $ques_num;
|
||||
public $ques_type;
|
||||
public $ques_desc;
|
||||
public $ques_selection;
|
||||
public $ques_selection_exist=array();
|
||||
|
||||
function question_output(){
|
||||
if($this->ques_desc){
|
||||
echo "<tr><td id=\"".$this->ques_num."\" valign=\"top\" style=\"background-color:#f0f0f0;padding:10px;line-height:150%;\"><b>".($this->ques_num+1)."</b> . ".$this->ques_desc."</td></tr>";
|
||||
}else return;
|
||||
return;
|
||||
}
|
||||
|
||||
function selection_output(){
|
||||
if($this->ques_type){
|
||||
$type=$this->ques_type;
|
||||
if($type=="t") {$this->selection_output_text();}
|
||||
if($type=="y"||$type=="n") {$this->selection_output_radio_checkbox();}
|
||||
}else return;
|
||||
return;
|
||||
}
|
||||
|
||||
private function selection_output_text(){
|
||||
$i=0;
|
||||
$disable=$this->ques_gl?"disabled=\"disabled\"":"";
|
||||
echo "<tr><td><input type=\"text\" name=\"answer_".$this->ques_id."\" id=\"".$this->ques_id."_".$i."\" value=\"".$this->ques_selection_exist[0]."\" style=\"width:400px;\" $disable /><input type=\"hidden\" id=\"text_".$this->ques_id."_".$i."\" value=".$this->ques_id."><hr></td></tr>";
|
||||
return;
|
||||
}
|
||||
|
||||
private function selection_output_radio_checkbox(){
|
||||
if($this->ques_selection==""){
|
||||
echo "<tr><td>该问题无备选项,请至后台管理系统将该问题完善.</td></tr>";
|
||||
return;
|
||||
}
|
||||
if($this->ques_type=="y"){
|
||||
$input_type="radio";
|
||||
}if($this->ques_type=="n"){
|
||||
$input_type="checkbox";
|
||||
}
|
||||
$i=0;
|
||||
$arr_selection=explode("|",$this->ques_selection);
|
||||
foreach($arr_selection as $value){
|
||||
$tmp=explode(":",$value);
|
||||
$checked="";
|
||||
if(in_array($tmp[0],$this->ques_selection_exist)){
|
||||
$checked="checked";
|
||||
}
|
||||
$disable=$this->ques_gl?"disabled=\"disabled\"":"";
|
||||
echo "<tr><td><label><input class=\"selection\" ".$checked." type=\"".$input_type."\" name=\"answer_".$this->ques_id."\" id=\"".$this->ques_id."_".$i++."\" onchange='javascript:answerAction(this.id);' value=\"".$this->ques_id."|".$tmp[0]."\" $disable /><b>".$tmp[0]."</b> : ".$tmp[1]."</label></td></tr>";
|
||||
}
|
||||
echo "<tr><td><hr></td></tr>";
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
switch($_GET[_a]){
|
||||
default:
|
||||
$rurl=$_GET["rurl"];
|
||||
echo "<tr><td height=\"40\" valign=\"middle\" style=\"background-color:#cccccc;font-size:20px;font-weight:bold;\" align=\"center\">问卷调查</td></tr>";
|
||||
echo "<tr><td height=\"30\" valign=\"middle\" style=\"font-size:14px;font-weight:bold;line-height:25px;padding:20px;\" align=\"left\">尊敬的客户(".$msg_login["title"]."):<br> 亲爱的经销商朋友,感谢您参与定制调查问卷。此问卷不记名,所填信息也会严格保密,您的宝贵意见是我们改进产品的方向,感谢您的参与!</td></tr>";
|
||||
$ques_num=0;
|
||||
$abc=new question();
|
||||
$result=$db->query("select * from ".$table_pre."plugin_surveyques order by id");
|
||||
while($msg=$db->fetch_array($result)){
|
||||
$res=$db->query("select selected from ".$table_pre."plugin_surveyanswer where uid='".$uid."'and qid='".$msg["id"]."'");
|
||||
$arr_selected_exist=array();
|
||||
while($msg1=$db->fetch_array($res)){
|
||||
$arr_selected_exist[]=$msg1["selected"];
|
||||
}
|
||||
$abc->ques_id=$msg["id"];
|
||||
$abc->ques_num=$ques_num;
|
||||
$abc->ques_type=$msg["single"];
|
||||
$abc->ques_desc=$msg["question"];
|
||||
$abc->ques_selection=$msg["selection"];
|
||||
$abc->ques_gl=$msg["gl"];
|
||||
$abc->ques_selection_exist=$arr_selected_exist;
|
||||
$abc->question_output();
|
||||
$abc->selection_output();
|
||||
$ques_num++;
|
||||
$maxid=$msg["id"];
|
||||
}
|
||||
echo "<input type=\"hidden\" name=\"_a\" value=\"save_answer\"/>";
|
||||
echo "<input type=\"hidden\" name=\"ques_num\" value=\"".$maxid."\"/>";
|
||||
echo "<input type=\"hidden\" id=\"answer_str\" name=\"answer_str\" value=\"\"/>";
|
||||
echo "<tr><td align=\"center\" style=\"background-color:#f0f0f0;padding:10px;line-height:100%;\"><input type=\"button\" onclick=\"answer_check_submit(".$maxid.")\"
|
||||
value=\"提交问卷\"></td></tr>";
|
||||
break;
|
||||
case "save_answer":
|
||||
$answer_arr=explode(",",$_GET[answer_str]);
|
||||
//print_r($answer_arr);
|
||||
//exit;
|
||||
//修改问卷时先删除原答案
|
||||
$msg=get_db_msg("select count(*) as count from web_plugin_surveyanswer where uid='".$uid."'");
|
||||
if($msg["count"]>0)
|
||||
$db->query("delete from web_plugin_surveyanswer where uid='".$uid."'");
|
||||
//---------------------
|
||||
foreach($answer_arr as $value_tmp){
|
||||
$answer_info=explode("|",$value_tmp);
|
||||
$db->query("insert into web_plugin_surveyanswer (uid,qid,selected) values ('".$uid."','".$answer_info[0]."','".$answer_info[1]."')");
|
||||
}
|
||||
alert_and_back("问卷已保存.");
|
||||
break;
|
||||
case "gl_answer":
|
||||
$glstr=$_GET[str];
|
||||
$arrStr="";
|
||||
$q="select * from web_plugin_surveyques where gl='$glstr'";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arrStr.=$m["id"].",";
|
||||
}
|
||||
$arrStr=substr($arrStr,0,strlen($arrStr)-1);
|
||||
echo $arrStr;
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
//------------------------------------------同步执行页面,RFID方式
|
||||
/*门禁表
|
||||
DROP TABLE IF EXISTS MW_EntryList;
|
||||
CREATE TABLE `MW_EntryList` (
|
||||
`PKID` int(10) unsigned NOT NULL auto_increment,
|
||||
`DevCode` varchar(250) NOT NULL default '',
|
||||
`EPCCode` varchar(250) NOT NULL default '',
|
||||
`ReadTime` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`Status` varchar(20) NOT NULL default '',
|
||||
PRIMARY KEY (`PKID`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
insert into MW_EntryList (DevCode,EPCCode) values ('12W110223','1');
|
||||
insert into MW_EntryList (DevCode,EPCCode) values ('12W110391','1');
|
||||
*/
|
||||
function _mysql_connect_mj(){
|
||||
global $dbmj_host,$dbmj_user,$dbmj_pw,$dbmj_name;
|
||||
$db_mj=new DB_Sql;
|
||||
$db_mj->connect($dbmj_host,$dbmj_user,$dbmj_pw,$dbmj_name);
|
||||
return $db_mj;
|
||||
}
|
||||
////////////////////////////////////定义门禁数据库
|
||||
$dbmj_host='localhost';
|
||||
$dbmj_user='hehe';
|
||||
$dbmj_pw='hehe';
|
||||
$dbmj_name='edt';
|
||||
$dbmj_table_name='MW_EntryList';
|
||||
//定义进出门ID
|
||||
$enter_door="1";
|
||||
$out_door="2";
|
||||
//定义展厅
|
||||
$zt="";
|
||||
////////////////////////////////////
|
||||
include "../tmpl/config.php";
|
||||
require "../ipad/include/function.php";
|
||||
require "../ipad/include/db_mysql.php";
|
||||
define("THIS_FILE_ROOT",dir_cutb(dirname(__FILE__),1)."/ipad");
|
||||
error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
||||
date_default_timezone_set('Asia/Shanghai');
|
||||
//-------------------------------register global
|
||||
$magic_quotes_gpc = get_magic_quotes_gpc();
|
||||
$register_globals = @ini_get('register_globals');
|
||||
if(!$register_globals || !$magic_quotes_gpc) {
|
||||
@extract(daddslashes($_POST));
|
||||
@extract(daddslashes($_GET));
|
||||
}
|
||||
if(!@mysql_connect($dbmj_host,$dbmj_user,$dbmj_pw)) {
|
||||
echo "Can not connect to MJ MySQL server";
|
||||
exit;
|
||||
}
|
||||
if($_a=="tb"){
|
||||
header("Content-type: text/html;charset=GB2312");
|
||||
$db=_mysql_connect_mj();
|
||||
$q="select * from ".$dbmj_table_name." where status<>'y' order by ReadTime";
|
||||
$r=$db->query($q);
|
||||
$arr_mj=array();
|
||||
while($m=$db->fetch_array($r)){
|
||||
$arr_mj[$m["EPCCode"]][]=$m["DevCode"];
|
||||
$db->query("update ".$dbmj_table_name." set status='y' where PKID='".$m["PKID"]."'");
|
||||
}
|
||||
if(count($arr_mj)>0){
|
||||
$db=_mysql_connect();
|
||||
$tip="";
|
||||
//
|
||||
for($i=0;$i<count($arr_mj);$i++){
|
||||
$m1=get_db_msg("select * from ".$table_pre."kh_rfid where rfid='".$arr_mj[$i]."'");
|
||||
if($m1["id"]>0){
|
||||
$tip.="<span class='right'>".$m1["kh"]."-".$m1["color"]."-".get_cate_title_no("color",$m1["color"]);
|
||||
if($arr_mj_door==$enter_door){
|
||||
$tip.="展示";
|
||||
$check=get_db_msg("select * from ".$table_pre."kh_tb where ");
|
||||
$db->query("update ".$table_pre."client set available='n' where id='".$m1["id"]."'");
|
||||
}else{
|
||||
$tip.="退出";
|
||||
$db->query("update ".$table_pre."client set available='y' where id='".$m1["id"]."'");
|
||||
}
|
||||
$tip.="成功!</span><br>";
|
||||
}else{
|
||||
$tip.="<span class='wrong'>".$arr_mj[$i].",操作失败!<br></span>";
|
||||
}
|
||||
}
|
||||
echo "y|".$tip;
|
||||
}else{
|
||||
echo "n|";
|
||||
}
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>e订通-门禁</title>
|
||||
<style>
|
||||
BODY{
|
||||
font-family:宋体;FONT-SIZE:16px;margin:0px;padding:0px;
|
||||
}
|
||||
a,a:link,a:visited,a:active {
|
||||
text-decoration:none;COLOR: #0000ff;FONT-SIZE:16px;
|
||||
}
|
||||
a:hover {
|
||||
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:16px;
|
||||
}
|
||||
body,input,td,select,div,li,ul,textarea,form {
|
||||
font-family:宋体;
|
||||
FONT-SIZE:16px;
|
||||
}
|
||||
.wrong{
|
||||
color:#ff0000;font-weight:bold;
|
||||
}
|
||||
.right{
|
||||
color:#0000ff;font-weight:bold;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
//ajax
|
||||
function ajaxinit()
|
||||
{
|
||||
var xmlhttp;
|
||||
try {
|
||||
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (E) {
|
||||
xmlhttp=false;
|
||||
}
|
||||
}
|
||||
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
|
||||
try {
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
} catch (e) {
|
||||
xmlhttp=false;
|
||||
}
|
||||
}
|
||||
if (!xmlhttp && window.createRequest) {
|
||||
try {
|
||||
xmlhttp = window.createRequest();
|
||||
} catch (e) {
|
||||
xmlhttp=false;
|
||||
}
|
||||
}
|
||||
return xmlhttp;
|
||||
}
|
||||
//
|
||||
function tb(){
|
||||
var xmlhttp=ajaxinit();
|
||||
var url="mjrfid.php?_a=tb";
|
||||
var obj=document.getElementById("div_tip");
|
||||
xmlhttp.open("POST",url,true);
|
||||
xmlhttp.setRequestHeader("Cache-Control","no-cache");
|
||||
xmlhttp.onreadystatechange=function(){
|
||||
if(xmlhttp.readyState==4 && xmlhttp.status==200){
|
||||
var arr_tmp=xmlhttp.responseText.split("|");
|
||||
if(arr_tmp[0]=="y"){
|
||||
obj.innerHTML=arr_tmp[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
xmlhttp.send(null);
|
||||
}
|
||||
//
|
||||
function auto_tb(){
|
||||
tb();
|
||||
setTimeout("auto_tb()",3000);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="auto_tb();">
|
||||
<br />
|
||||
<form name="form1" action="mj.php" method="post">
|
||||
<table width="50%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
|
||||
<input type="hidden" name="is_submit" value="y">
|
||||
<tr>
|
||||
<td align="center" bgcolor="#f0f0f0" style="font-size:18px" height="40"><b>e订通-门禁系统</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" bgcolor="#ffffff" valign="top" style="line-height:150%;" height="100px"><div id="div_tip">系统等待中......</div></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,383 @@
|
||||
<?
|
||||
//------------------------------------------投影,到款
|
||||
define("THIS_FILE_ROOT",dirname(__FILE__));
|
||||
define("THIS_IN","edt_ipad");
|
||||
$flag_pad_offline="";
|
||||
include "../tmpl/config.php";
|
||||
require "../ipad/include/function.php";
|
||||
require "../ipad/include/db_mysql.php";
|
||||
error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
||||
date_default_timezone_set('Asia/Shanghai');
|
||||
$ip=$_SERVER["REMOTE_ADDR"];
|
||||
$http_root="http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
|
||||
$http_root=str_replace("/index.php","",$http_root);
|
||||
//-------------------------------register global
|
||||
$v1="category";//投影规则
|
||||
$v2="bc";
|
||||
$v3="sxz";
|
||||
$v4="brand";
|
||||
$magic_quotes_gpc = get_magic_quotes_gpc();
|
||||
$register_globals = @ini_get('register_globals');
|
||||
if(!$register_globals || !$magic_quotes_gpc) {
|
||||
@extract(daddslashes($_POST));
|
||||
@extract(daddslashes($_GET));
|
||||
}
|
||||
$db=_mysql_connect();
|
||||
$page_size=$page_size?$page_size:20;
|
||||
$s_time=$s_time?$s_time:3;
|
||||
$s_refresh_time=$s_refresh_time?$s_refresh_time:30;
|
||||
$s_reload_time=$s_reload_time?$s_reload_time:10;
|
||||
$xh_ms=get_set("xh_ms");
|
||||
if($s_time<=0 || $page_size<=0){
|
||||
alert_and_back("请输入数字!");
|
||||
}
|
||||
$sql_qy="";
|
||||
$url_var="s_time=".$s_time."&s_refresh_time=".$s_refresh_time."&page_size=".$page_size;
|
||||
//取得排行款号
|
||||
if($s_qy || $s_brand || $s_sxz || $s_series || $s_theme || $s_category || $s_category1 || $s_season || $s_bc){
|
||||
$sql_con="where ";
|
||||
if($s_qy){
|
||||
$sql_con.="qy='".$s_qy."' and ";
|
||||
$sql_qy.=" and qy='".$s_qy."'";
|
||||
$url_var.="&s_qy=".$s_qy;
|
||||
}
|
||||
if($s_brand){
|
||||
$sql_con.="brand='".$s_brand."' and ";
|
||||
$url_var.="&s_brand=".$s_brand;
|
||||
}
|
||||
if($s_sxz){
|
||||
$sql_con.="sxz='".$s_sxz."' and ";
|
||||
$url_var.="&s_sxz=".$s_sxz;
|
||||
}
|
||||
if($s_series){
|
||||
$sql_con.="series='".$s_series."' and ";
|
||||
$url_var.="&s_series=".$s_series;
|
||||
}
|
||||
if($s_theme){
|
||||
$sql_con.="theme='".$s_theme."' and ";
|
||||
$url_var.="&s_theme=".$s_theme;
|
||||
}
|
||||
if($s_category){
|
||||
$sql_con.="category='".$s_category."' and ";
|
||||
$url_var.="&s_category=".$s_category;
|
||||
}
|
||||
if($s_category1){
|
||||
$sql_con.="category1='".$s_category1."' and ";
|
||||
$url_var.="&s_category1=".$s_category1;
|
||||
}
|
||||
if($s_bc){
|
||||
$sql_con.="bc='".$s_bc."' and ";
|
||||
$url_var.="&s_bc=".$s_bc;
|
||||
}
|
||||
$sql_con=substr($sql_con,0,-4);
|
||||
}
|
||||
$q="select sum(num) 'num',sum(je) 'je',iid 'id' from ".$table_pre."order ".$sql_con." group by iid order by num desc limit 0,".$page_size;
|
||||
$r=$db->query($q);
|
||||
$i=1;
|
||||
$content=$content_div=array();
|
||||
while($m=$db->fetch_array($r)){
|
||||
$m_kh=get_db_msg("select * from ".$table_pre."kh where id='".$m["id"]."'");
|
||||
$xh=get_kh_xh($m_kh);
|
||||
$content[$i][]=$xh;
|
||||
$content[$i][]=$m_kh["no"];
|
||||
$content[$i][]=get_cate_title_no("bc",$m_kh["bc"]);
|
||||
$content[$i][]=get_cate_title_no("category",$m_kh["category"]);
|
||||
|
||||
//取得下单客户量
|
||||
$m_num_client=get_db_msg("select count(distinct uid) 'num' from ".$table_pre."order where iid='".$m_kh["id"]."'".$sql_qy);
|
||||
|
||||
//取得定制选项
|
||||
$select_dz=array();
|
||||
$q1="select no,title from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no<>'jgd' and no<>'sx' and no<>'color' order by ord";
|
||||
$r1=$db->query($q1);
|
||||
$j=0;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$select_dz[$j][0]=$m1["title"].":";
|
||||
$select_dz[$j][1]=get_cate_title_no($m1["no"],$m_kh[$m1["no"]]);
|
||||
$j++;
|
||||
}
|
||||
$dzHTML = '';
|
||||
$dzCount = 0;
|
||||
for($k=0;$k<ceil(count($select_dz)/2);$k++){
|
||||
$dzHTML.="<div><span>".$select_dz[$k*2][0]."</span><span>".$select_dz[$k*2][1]."</span></div>";
|
||||
if ($select_dz[$k*2][0]) $dzCount++;
|
||||
$dzHTML.="<div><span>".$select_dz[$k*2+1][0]."</span><span>".$select_dz[$k*2+1][1]."</span></div>";
|
||||
if ($select_dz[$k*2+1][0]) $dzCount++;
|
||||
}
|
||||
//
|
||||
$pic=get_kh_picture_big($m_kh["no"],$m_kh["main_pic"],$m_kh["color"]);
|
||||
$content_div[$i]="
|
||||
<div id=\"div_".$i."\" style=\"display:none; width: 100%; height: 100%;\">
|
||||
<div style=\"width: 50%;\">
|
||||
<div style=\"background: white; text-align: center; width: calc(80% - 32px); margin: 32px auto; padding: 16px; max-width: 200px; border-radius: 12px;\">
|
||||
<span style=\"display: block; font-size: 30px;\">NO.".$i."</span>
|
||||
<span style=\"display: block; font-size: 20px;\">第".$i."名</span>
|
||||
</div>
|
||||
<div style=\"background: white; text-align: left; width: calc(80% - 32px); margin: 32px auto; padding: 16px; max-width: 200px; border-radius: 12px;\">
|
||||
<div><span>款号:</span><span>".$m_kh["no"]."</span></div>
|
||||
<div><span>序号:</span><span>".get_kh_xh($m_kh)."</span></div>
|
||||
".$dzHTML."
|
||||
<div><span>款式名:</span><span>".$m_kh["title"]."</span></div>
|
||||
<div><span>下单客户:</span><span>".$m_num_client["num"]."个</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div style=\"width: 50%; position: relative;\">
|
||||
<div style=\"text-align: center; width: calc(80% - 32px); height: ".(($dzCount+4)*22+16*2+102+32-54)."px; padding-top: 54px; background: white; overflow: hidden; margin: 32px auto; border-radius: 12px;\">".out_good_pic($pic,280,300)."</div>
|
||||
</div>
|
||||
</div>";
|
||||
$i++;
|
||||
}
|
||||
$num2=count($content)>20?count($content):20;
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="refresh" content="<?php echo $s_refresh_time*60; ?>;url=<?php echo $http_root."?".$url_var; ?>" />
|
||||
<title>排行榜</title>
|
||||
<style>
|
||||
.tab_hlight{
|
||||
background-color:#cccccc;border:1px solid #000000;font-weight:bold;
|
||||
}
|
||||
.tab_normal{
|
||||
background-color:#ffffff;border:1px solid #000000;font-weight:normal;
|
||||
}
|
||||
.list_th{
|
||||
font-size:18px;font-weight:bold;height:30px;
|
||||
}
|
||||
.list_td{
|
||||
font-size:18px;height:25px;
|
||||
}
|
||||
.list_hlight{
|
||||
background-color:#cccccc;
|
||||
}
|
||||
.list_normal{
|
||||
background-color: white;
|
||||
}
|
||||
.arrow_hlight{
|
||||
background-color:#cccccc;
|
||||
}
|
||||
.arrow_normal{
|
||||
background-color:#f0f0f0;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var l=1;
|
||||
var num=<?php echo count($content); ?>;
|
||||
function dhlight(i1){
|
||||
var obj_list={},obj_div={},obj_arrow={};
|
||||
for(var i=1;i<=num;i++){
|
||||
obj_list=document.getElementById("list_"+i);
|
||||
obj_div=document.getElementById("div_"+i);
|
||||
obj_arrow=document.getElementById("arrow_"+i);
|
||||
if(i==i1){
|
||||
obj_div.style.display="flex";
|
||||
obj_list.className="list_hlight";
|
||||
obj_arrow.className="arrow_hlight";
|
||||
}else{
|
||||
obj_div.style.display="none";
|
||||
obj_list.className="list_normal";
|
||||
obj_arrow.className="arrow_normal";
|
||||
}
|
||||
}
|
||||
l=i1;
|
||||
}
|
||||
//function autochangecategory(){
|
||||
// var v1="<?php echo $v1; ?>";
|
||||
// var name="s_"+v1;
|
||||
// v1=document.getElementsByName(name)[0];
|
||||
// var submit=document.getElementsByName('s')[0];
|
||||
// var index=v1.selectedIndex+1;
|
||||
// if (index==v1.length) {
|
||||
// index=0;
|
||||
// }
|
||||
// v1.options[index].selected=true;
|
||||
// console.log(submit);
|
||||
// submit.submit();
|
||||
//}
|
||||
function autochangecategory(){
|
||||
var v1="<?php echo $v1; ?>";
|
||||
var v2="<?php echo $v2; ?>";
|
||||
var v3="<?php echo $v3; ?>";
|
||||
var v4="<?php echo $v4; ?>";
|
||||
var name1="s_"+v1;
|
||||
var name2="s_"+v2;
|
||||
var name3="s_"+v3;
|
||||
var name4="s_"+v4;
|
||||
v1=document.getElementsByName(name1)[0];
|
||||
v2=document.getElementsByName(name2)[0];
|
||||
v3=document.getElementsByName(name3)[0];
|
||||
v4=document.getElementsByName(name4)[0];
|
||||
//alert(v3);
|
||||
var submit=document.getElementsByName('s')[0];
|
||||
var index=v1.selectedIndex+1;
|
||||
//alert(v2.selectedIndex);
|
||||
if (index==v1.length) {
|
||||
index=0;
|
||||
var index2=v2.selectedIndex+1;
|
||||
if(index2==v2.length){
|
||||
index2=0;
|
||||
var index3=v3.selectedIndex+1;
|
||||
if(index3==v3.length){
|
||||
index3=0;
|
||||
var index4=v4.selectedIndex+1;
|
||||
if(index4==v4.length){
|
||||
index4=0;
|
||||
}
|
||||
v4.options[index4].selected=true;
|
||||
}
|
||||
v3.options[index3].selected=true;
|
||||
}
|
||||
v2.options[index2].selected=true;
|
||||
}
|
||||
v1.options[index].selected=true;
|
||||
console.log(submit);
|
||||
submit.submit();
|
||||
}
|
||||
function dauto(){
|
||||
dhlight(l);
|
||||
if(l==num)
|
||||
l=1;
|
||||
else
|
||||
l++;
|
||||
window.setTimeout('dauto()',<?php echo $s_time*1000; ?>);
|
||||
}
|
||||
function sub_ph(){
|
||||
var f=document.s;
|
||||
var f1=window.parent.document.s1;
|
||||
if(f.s_qy){
|
||||
var s_qy=f.s_qy.options[f.s_qy.selectedIndex].value;
|
||||
f1.s_qy.value=s_qy;
|
||||
}
|
||||
if(f.s_brand){
|
||||
var s_brand=f.s_brand.options[f.s_brand.selectedIndex].value;
|
||||
f1.s_brand.value=s_brand;
|
||||
}
|
||||
if(f.s_gender){
|
||||
var s_gender=f.s_gender.options[f.s_gender.selectedIndex].value;
|
||||
f1.s_gender.value=s_gender;
|
||||
}
|
||||
if(f.s_sxz){
|
||||
var s_sxz=f.s_sxz.options[f.s_sxz.selectedIndex].value;
|
||||
f1.s_sxz.value=s_sxz;
|
||||
}
|
||||
if(f.s_series){
|
||||
var s_series=f.s_series.options[f.s_series.selectedIndex].value;
|
||||
f1.s_series.value=s_series;
|
||||
}
|
||||
if(f.s_theme){
|
||||
var s_theme=f.s_theme.options[f.s_theme.selectedIndex].value;
|
||||
f1.s_theme.value=s_theme;
|
||||
}
|
||||
if(f.s_season){
|
||||
var s_season=f.s_season.options[f.s_season.selectedIndex].value;
|
||||
f1.s_season.value=s_season;
|
||||
}
|
||||
if(f.s_bc){
|
||||
var s_bc=f.s_bc.options[f.s_bc.selectedIndex].value;
|
||||
f1.s_bc.value=s_bc;
|
||||
}
|
||||
if(f.s_category){
|
||||
var s_category=f.s_category.options[f.s_category.selectedIndex].value;
|
||||
f1.s_category.value=s_category;
|
||||
}
|
||||
if(f.s_category1){
|
||||
var s_category1=f.s_category1.options[f.s_category1.selectedIndex].value;
|
||||
f1.s_category1.value=s_category1;
|
||||
}
|
||||
f1.s_time.value=f.s_time.value;
|
||||
f1.page_size.value=f.page_size.value;
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body style="padding:0;margin:0; background: white;" onload="dauto();">
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
|
||||
<tr>
|
||||
<td style="width: 40%;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td width="40" align="center" class="list_th">排名</td>
|
||||
<td width="80" align="center" class="list_th">序号</td>
|
||||
<td align="center" class="list_th">款号</td>
|
||||
<td align="center" class="list_th"><?php echo get_cate_title_no("arr_select","bc"); ?></td>
|
||||
<td align="center" class="list_th"><?php echo get_cate_title_no("arr_select","category"); ?></td>
|
||||
<td height="25"> </td>
|
||||
</tr>
|
||||
<?
|
||||
for($i=1;$i<=$num2;$i++){
|
||||
if($content[$i][0]){ ?>
|
||||
<tr id="list_<?php echo $i; ?>" onclick="dhlight(<?php echo $i; ?>)" style="cursor:pointor;" class="list_normal">
|
||||
<td align="center" class="list"><?php echo $i; ?></td>
|
||||
<td class="list_td" align="center" ><?php echo $content[$i][0] ?></td>
|
||||
<td class="list_td" align="center" ><?php echo $content[$i][1] ?></td>
|
||||
<td class="list_td" align="center" ><?php echo $content[$i][2] ?></td>
|
||||
<td class="list_td" align="center" ><?php echo $content[$i][3] ?></td>
|
||||
<td class="list_td" id="arrow_<?php echo $i; ?>" class="arrow_normal"> </td>
|
||||
</tr>
|
||||
<?php }else{ ?>
|
||||
<tr style="cursor:pointor;" class="list_normal">
|
||||
<td align="center" class="list"> </td>
|
||||
<td class="list_td"> </td>
|
||||
<td class="list_td"> </td>
|
||||
<td class="list_td"> </td>
|
||||
<td class="list_td"> </td>
|
||||
<td class="list_td" class="arrow_normal"> </td>
|
||||
</tr>
|
||||
<?php } } ?>
|
||||
</table></td><td style="background-image: url(ty_right.jpg); background-repeat: no-repeat; width: 60%;">
|
||||
<?php
|
||||
for($i=1;$i<=count($content_div);$i++){
|
||||
echo $content_div[$i];
|
||||
}
|
||||
?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<form name="s" action="<?php echo $_SERVER[PHP_SELF]; ?>" method="post" onsubmit="return sub_ph();">
|
||||
<td><table border="0" cellspacing="2" cellpadding="1"><tr>
|
||||
<?php
|
||||
//区域条件
|
||||
$check=get_db_msg("select count(*) 'num' from ".$table_pre."client where face='9'");
|
||||
if($check["num"]>0){
|
||||
echo "<td><select name=\"s_qy\" style=\"width:80px;height:29px;\" onchange=\"do_s();\"><option value=''>-区域-</option>";
|
||||
$q="select id,title from ".$table_pre."client where face='9' order by id";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
echo "<option value=\"".$m["id"]."\"";
|
||||
if($m["id"]==$s_qy)
|
||||
echo " selected";
|
||||
echo ">".$m["title"]."</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php if(check_arr_select_show("brand")){ ?>
|
||||
<td><select name="s_brand" style="width:80px;height:29px;" onchange="do_s();"><option value=''>-<?php echo get_cate_title_no("arr_select","brand"); ?>-</option><?php echo op_select_cate2("brand",$s_brand); ?></select></td>
|
||||
<?php } ?>
|
||||
<?php if(check_arr_select_show("sxz")){ ?>
|
||||
<td><select name="s_sxz" style="width:80px;height:29px;" onchange="do_s();"><option value=''>-<?php echo get_cate_title_no("arr_select","sxz"); ?>-</option><?php echo op_select_cate2("sxz",$s_sxz); ?></select></td>
|
||||
<?php } ?>
|
||||
<?php if(check_arr_select_show("series")){ ?>
|
||||
<td><select name="s_series" style="width:80px;height:29px;" onchange="do_s();"><option value=''>-<?php echo get_cate_title_no("arr_select","series"); ?>-</option><?php echo op_select_cate2("series",$s_series); ?></select></td>
|
||||
<?php } ?>
|
||||
<?php if(check_arr_select_show("theme")){ ?>
|
||||
<td><select name="s_theme" style="width:80px;height:29px;" onchange="do_s();"><option value=''>-<?php echo get_cate_title_no("arr_select","theme"); ?>-</option><?php echo op_select_cate2("theme",$s_theme); ?></select></td>
|
||||
<?php } ?>
|
||||
<?php if(check_arr_select_show("season")){ ?>
|
||||
<td><select name="s_season" style="width:80px;height:29px;" onchange="do_s();"><option value=''>-<?php echo get_cate_title_no("arr_select","season"); ?>-</option><?php echo op_select_cate2("season",$s_season); ?></select></td>
|
||||
<?php } ?>
|
||||
<td><select name="s_bc" style="width:80px;height:29px;" onchange="do_s();"><option value=''>-<?php echo get_cate_title_no("arr_select","bc"); ?>-</option><?php echo op_select_cate2("bc",$s_bc); ?></select></td>
|
||||
<td><select name="s_category" style="width:80px;height:29px;" onchange="do_s();"><option value=''>-<?php echo get_cate_title_no("arr_select","category"); ?>-</option><?php echo op_select_cate2("category",$s_category); ?></select></td>
|
||||
<td>滚动间隔<input type="text" name="s_time" value="<?php echo $s_time; ?>" style="width:20px;">秒 刷新时间<input type="text" name="s_refresh_time" value="<?php echo $s_refresh_time; ?>" style="width:20px;">分钟 显示前<input type="text" name="page_size" value="<?php echo $page_size; ?>" style="width:20px;">名</td>
|
||||
<td><input type="submit" value=" 执 行 "></td>
|
||||
</tr></table></td>
|
||||
</tr>
|
||||
</form>
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
var time=1000*num*document.getElementsByName('s_time')[0].value>0?1000*num*document.getElementsByName('s_time')[0].value:3000;
|
||||
//window.setInterval('autochangecategory()',1000*num*document.getElementsByName('s_time')[0].value);
|
||||
window.setInterval('autochangecategory()',time);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,325 @@
|
||||
<?
|
||||
//------------------------------------------投影,到色
|
||||
define("THIS_FILE_ROOT",dirname(__FILE__));
|
||||
define("THIS_IN","edt_ipad");
|
||||
$flag_pad_offline="";
|
||||
include "../tmpl/config.php";
|
||||
require "../ipad/include/function.php";
|
||||
require "../ipad/include/db_mysql.php";
|
||||
error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
||||
date_default_timezone_set('Asia/Shanghai');
|
||||
$ip=$_SERVER["REMOTE_ADDR"];
|
||||
$http_root="http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
|
||||
$http_root=str_replace("/index.php","",$http_root);
|
||||
//-------------------------------register global
|
||||
$magic_quotes_gpc = get_magic_quotes_gpc();
|
||||
$register_globals = @ini_get('register_globals');
|
||||
if(!$register_globals || !$magic_quotes_gpc) {
|
||||
@extract(daddslashes($_POST));
|
||||
@extract(daddslashes($_GET));
|
||||
}
|
||||
$db=_mysql_connect();
|
||||
$page_size=$page_size?$page_size:20;
|
||||
$s_time=$s_time?$s_time:3;
|
||||
$s_refresh_time=$s_refresh_time?$s_refresh_time:30;
|
||||
$s_reload_time=$s_reload_time?$s_reload_time:10;
|
||||
$xh_ms=get_set("xh_ms");
|
||||
if($s_time<=0 || $page_size<=0){
|
||||
alert_and_back("请输入数字!");
|
||||
}
|
||||
$sql_qy="";
|
||||
$url_var="s_time=".$s_time."&s_refresh_time=".$s_refresh_time."&page_size=".$page_size;
|
||||
//取得排行款号
|
||||
if($s_qy || $s_brand || $s_sxz || $s_series || $s_theme || $s_category || $s_category1 || $s_season || $s_bc){
|
||||
$sql_con="where ";
|
||||
if($s_qy){
|
||||
$sql_con.="qy='".$s_qy."' and ";
|
||||
$sql_qy.=" and qy='".$s_qy."'";
|
||||
$url_var.="&s_qy=".$s_qy;
|
||||
}
|
||||
if($s_brand){
|
||||
$sql_con.="brand='".$s_brand."' and ";
|
||||
$url_var.="&s_brand=".$s_brand;
|
||||
}
|
||||
if($s_sxz){
|
||||
$sql_con.="sxz='".$s_sxz."' and ";
|
||||
$url_var.="&s_sxz=".$s_sxz;
|
||||
}
|
||||
if($s_series){
|
||||
$sql_con.="series='".$s_series."' and ";
|
||||
$url_var.="&s_series=".$s_series;
|
||||
}
|
||||
if($s_theme){
|
||||
$sql_con.="theme='".$s_theme."' and ";
|
||||
$url_var.="&s_theme=".$s_theme;
|
||||
}
|
||||
if($s_category){
|
||||
$sql_con.="category='".$s_category."' and ";
|
||||
$url_var.="&s_category=".$s_category;
|
||||
}
|
||||
if($s_category1){
|
||||
$sql_con.="category1='".$s_category1."' and ";
|
||||
$url_var.="&s_category1=".$s_category1;
|
||||
}
|
||||
if($s_bc){
|
||||
$sql_con.="bc='".$s_bc."' and ";
|
||||
$url_var.="&s_bc=".$s_bc;
|
||||
}
|
||||
$sql_con=substr($sql_con,0,-4);
|
||||
}
|
||||
$q="select sum(num) 'num',sum(je) 'je',iid 'id',color from ".$table_pre."order ".$sql_con." group by iid,color order by num desc limit 0,".$page_size;
|
||||
$r=$db->query($q);
|
||||
$i=1;
|
||||
$content=$content_div=array();
|
||||
while($m=$db->fetch_array($r)){
|
||||
$m_kh=get_db_msg("select * from ".$table_pre."kh where id='".$m["id"]."'");
|
||||
$xh=get_kh_xh($m_kh,$m["color"]);
|
||||
$content[$i][]=$xh;
|
||||
$content[$i][]=$m_kh["no"];
|
||||
$content[$i][]=$m["color"]."-".get_cate_title_no("color",$m["color"]);
|
||||
$content[$i][]=get_cate_title_no("bc",$m_kh["bc"]);
|
||||
$content[$i][]=get_cate_title_no("category",$m_kh["category"]);
|
||||
//取得下单客户量
|
||||
$m_num_client=get_db_msg("select count(distinct uid) 'num' from ".$table_pre."order where iid='".$m_kh["id"]."'".$sql_qy);
|
||||
//
|
||||
//取得定制选项
|
||||
$select_dz=array();
|
||||
$q1="select no,title from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no<>'jgd' and no<>'sx' and no<>'color' order by ord";
|
||||
$r1=$db->query($q1);
|
||||
$j=0;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$select_dz[$j][0]=$m1["title"].":";
|
||||
$select_dz[$j][1]=get_cate_title_no($m1["no"],$m_kh[$m1["no"]]);
|
||||
$j++;
|
||||
}
|
||||
$dzHTML = '';
|
||||
$dzCount = 0;
|
||||
for($k=0;$k<ceil(count($select_dz)/2);$k++){
|
||||
$dzHTML.="<div><span>".$select_dz[$k*2][0]."</span><span>".$select_dz[$k*2][1]."</span></div>";
|
||||
if ($select_dz[$k*2][0]) $dzCount++;
|
||||
$dzHTML.="<div><span>".$select_dz[$k*2+1][0]."</span><span>".$select_dz[$k*2+1][1]."</span></div>";
|
||||
if ($select_dz[$k*2+1][0]) $dzCount++;
|
||||
}
|
||||
//
|
||||
$pic=get_kh_picture_big($m_kh["no"],$m_kh["main_pic"],$m_kh["color"]);
|
||||
$content_div[$i]="
|
||||
<div id=\"div_".$i."\" style=\"display:none; width: 100%; height: 100%;\">
|
||||
<div style=\"width: 50%;\">
|
||||
<div style=\"background: white; text-align: center; width: calc(80% - 32px); margin: 32px auto; padding: 16px; max-width: 200px; border-radius: 12px;\">
|
||||
<span style=\"display: block; font-size: 30px;\">NO.".$i."</span>
|
||||
<span style=\"display: block; font-size: 20px;\">第".$i."名</span>
|
||||
</div>
|
||||
<div style=\"background: white; text-align: left; width: calc(80% - 32px); margin: 32px auto; padding: 16px; max-width: 200px; border-radius: 12px;\">
|
||||
<div><span>款号:</span><span>".$m_kh["no"]."</span></div>
|
||||
<div><span>序号:</span><span>".get_kh_xh($m_kh)."</span></div>
|
||||
".$dzHTML."
|
||||
<div><span>款式名:</span><span>".$m_kh["title"]."</span></div>
|
||||
<div><span>下单客户:</span><span>".$m_num_client["num"]."个</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div style=\"width: 50%; position: relative;\">
|
||||
<div style=\"text-align: center; width: calc(80% - 32px); height: ".(($dzCount+4)*22+16*2+102+32-54)."px; padding-top: 54px; background: white; overflow: hidden; margin: 32px auto; border-radius: 12px;\">".out_good_pic($pic,280,300)."</div>
|
||||
</div>
|
||||
</div>";
|
||||
$i++;
|
||||
}
|
||||
$num2=count($content)>20?count($content):20;
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="refresh" content="<?php echo $s_refresh_time*60; ?>;url=<?php echo $http_root."?".$url_var; ?>" />
|
||||
<title>排行榜</title>
|
||||
<style>
|
||||
.tab_hlight{
|
||||
background-color:#cccccc;border:1px solid #000000;font-weight:bold;
|
||||
}
|
||||
.tab_normal{
|
||||
background-color:#ffffff;border:1px solid #000000;font-weight:normal;
|
||||
}
|
||||
.list_th{
|
||||
font-size:18px;font-weight:bold;height:30px;
|
||||
}
|
||||
.list_td{
|
||||
font-size:18px;height:25px;
|
||||
}
|
||||
.list_hlight{
|
||||
background-color:#cccccc;
|
||||
}
|
||||
.list_normal{
|
||||
background-color: white;
|
||||
}
|
||||
.arrow_hlight{
|
||||
background-color:#cccccc;
|
||||
}
|
||||
.arrow_normal{
|
||||
background-color:#f0f0f0;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var l=1;
|
||||
var num=<?php echo count($content); ?>;
|
||||
function dhlight(i1){
|
||||
var obj_list={},obj_div={},obj_arrow={};
|
||||
for(var i=1;i<=num;i++){
|
||||
obj_list=document.getElementById("list_"+i);
|
||||
obj_div=document.getElementById("div_"+i);
|
||||
obj_arrow=document.getElementById("arrow_"+i);
|
||||
if(i==i1){
|
||||
obj_div.style.display="flex";
|
||||
obj_list.className="list_hlight";
|
||||
obj_arrow.className="arrow_hlight";
|
||||
}else{
|
||||
obj_div.style.display="none";
|
||||
obj_list.className="list_normal";
|
||||
obj_arrow.className="arrow_normal";
|
||||
}
|
||||
}
|
||||
l=i1;
|
||||
}
|
||||
function dauto(){
|
||||
dhlight(l);
|
||||
if(l==num)
|
||||
l=1;
|
||||
else
|
||||
l++;
|
||||
window.setTimeout('dauto()',<?php echo $s_time*1000; ?>);
|
||||
}
|
||||
function sub_ph(){
|
||||
var f=document.s;
|
||||
var f1=window.parent.document.s1;
|
||||
if(f.s_qy){
|
||||
var s_qy=f.s_qy.options[f.s_qy.selectedIndex].value;
|
||||
f1.s_qy.value=s_qy;
|
||||
}
|
||||
if(f.s_brand){
|
||||
var s_brand=f.s_brand.options[f.s_brand.selectedIndex].value;
|
||||
f1.s_brand.value=s_brand;
|
||||
}
|
||||
if(f.s_gender){
|
||||
var s_gender=f.s_gender.options[f.s_gender.selectedIndex].value;
|
||||
f1.s_gender.value=s_gender;
|
||||
}
|
||||
if(f.s_sxz){
|
||||
var s_sxz=f.s_sxz.options[f.s_sxz.selectedIndex].value;
|
||||
f1.s_sxz.value=s_sxz;
|
||||
}
|
||||
if(f.s_series){
|
||||
var s_series=f.s_series.options[f.s_series.selectedIndex].value;
|
||||
f1.s_series.value=s_series;
|
||||
}
|
||||
if(f.s_theme){
|
||||
var s_theme=f.s_theme.options[f.s_theme.selectedIndex].value;
|
||||
f1.s_theme.value=s_theme;
|
||||
}
|
||||
if(f.s_season){
|
||||
var s_season=f.s_season.options[f.s_season.selectedIndex].value;
|
||||
f1.s_season.value=s_season;
|
||||
}
|
||||
if(f.s_bc){
|
||||
var s_bc=f.s_bc.options[f.s_bc.selectedIndex].value;
|
||||
f1.s_bc.value=s_bc;
|
||||
}
|
||||
if(f.s_category){
|
||||
var s_category=f.s_category.options[f.s_category.selectedIndex].value;
|
||||
f1.s_category.value=s_category;
|
||||
}
|
||||
if(f.s_category1){
|
||||
var s_category1=f.s_category1.options[f.s_category1.selectedIndex].value;
|
||||
f1.s_category1.value=s_category1;
|
||||
}
|
||||
f1.s_time.value=f.s_time.value;
|
||||
f1.page_size.value=f.page_size.value;
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body style="padding:0;margin:0; background: white;" onload="dauto();">
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
|
||||
<tr>
|
||||
<td style="width: 40%;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td width="40" align="center" class="list_th">排名</td>
|
||||
<td width="80" align="center" class="list_th">序号</td>
|
||||
<td width="80" align="center" class="list_th">款号</td>
|
||||
<td align="center" class="list_th">颜色</td>
|
||||
<td align="center" class="list_th"><?php echo get_cate_title_no("arr_select","bc"); ?></td>
|
||||
<td align="center" class="list_th"><?php echo get_cate_title_no("arr_select","category"); ?></td>
|
||||
<td height="25"> </td>
|
||||
</tr>
|
||||
<?
|
||||
for($i=1;$i<=$num2;$i++){
|
||||
if($content[$i][0]){ ?>
|
||||
<tr id="list_<?php echo $i; ?>" onclick="dhlight(<?php echo $i; ?>)" style="cursor:pointor;" class="list_normal">
|
||||
<td align="center" class="list"><?php echo $i; ?></td>
|
||||
<td class="list_td" align="center" ><?php echo $content[$i][0] ?></td>
|
||||
<td class="list_td" align="center" ><?php echo $content[$i][1] ?></td>
|
||||
<td class="list_td" align="center" ><?php echo $content[$i][2] ?></td>
|
||||
<td class="list_td" align="center" ><?php echo $content[$i][3] ?></td>
|
||||
<td class="list_td" align="center" ><?php echo $content[$i][4] ?></td>
|
||||
<td class="list_td" id="arrow_<?php echo $i; ?>" class="arrow_normal"> </td>
|
||||
</tr>
|
||||
<?php }else{ ?>
|
||||
<tr style="cursor:pointor;" class="list_normal">
|
||||
<td align="center" class="list"> </td>
|
||||
<td class="list_td"> </td>
|
||||
<td class="list_td"> </td>
|
||||
<td class="list_td"> </td>
|
||||
<td class="list_td"> </td>
|
||||
<td class="list_td"> </td>
|
||||
<td class="list_td" class="arrow_normal"> </td>
|
||||
</tr>
|
||||
<?php } } ?>
|
||||
</table></td><td style="background-image: url(ty_right.jpg); background-repeat: no-repeat; width: 60%;">
|
||||
<?php
|
||||
for($i=1;$i<=count($content_div);$i++){
|
||||
echo $content_div[$i];
|
||||
}
|
||||
?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<form name="s" action="<?php echo $_SERVER[PHP_SELF]; ?>" method="post" onsubmit="return sub_ph();">
|
||||
<td><table border="0" cellspacing="2" cellpadding="1"><tr>
|
||||
<?php
|
||||
//区域条件
|
||||
$check=get_db_msg("select count(*) 'num' from ".$table_pre."client where face='9'");
|
||||
if($check["num"]>0){
|
||||
echo "<td><select name=\"s_qy\" style=\"width:80px;height:29px;\" onchange=\"do_s();\"><option value=''>-区域-</option>";
|
||||
$q="select id,title from ".$table_pre."client where face='9' order by id";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
echo "<option value=\"".$m["id"]."\"";
|
||||
if($m["id"]==$s_qy)
|
||||
echo " selected";
|
||||
echo ">".$m["title"]."</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php if(check_arr_select_show("brand")){ ?>
|
||||
<td><select name="s_brand" style="width:80px;height:29px;" onchange="do_s();"><option value=''>-<?php echo get_cate_title_no("arr_select","brand"); ?>-</option><?php echo op_select_cate2("brand",$s_brand); ?></select></td>
|
||||
<?php } ?>
|
||||
<?php if(check_arr_select_show("sxz")){ ?>
|
||||
<td><select name="s_sxz" style="width:80px;height:29px;" onchange="do_s();"><option value=''>-<?php echo get_cate_title_no("arr_select","sxz"); ?>-</option><?php echo op_select_cate2("sxz",$s_sxz); ?></select></td>
|
||||
<?php } ?>
|
||||
<?php if(check_arr_select_show("series")){ ?>
|
||||
<td><select name="s_series" style="width:80px;height:29px;" onchange="do_s();"><option value=''>-<?php echo get_cate_title_no("arr_select","series"); ?>-</option><?php echo op_select_cate2("series",$s_series); ?></select></td>
|
||||
<?php } ?>
|
||||
<?php if(check_arr_select_show("theme")){ ?>
|
||||
<td><select name="s_theme" style="width:80px;height:29px;" onchange="do_s();"><option value=''>-<?php echo get_cate_title_no("arr_select","theme"); ?>-</option><?php echo op_select_cate2("theme",$s_theme); ?></select></td>
|
||||
<?php } ?>
|
||||
<?php if(check_arr_select_show("season")){ ?>
|
||||
<td><select name="s_season" style="width:80px;height:29px;" onchange="do_s();"><option value=''>-<?php echo get_cate_title_no("arr_select","season"); ?>-</option><?php echo op_select_cate2("season",$s_season); ?></select></td>
|
||||
<?php } ?>
|
||||
<td><select name="s_bc" style="width:80px;height:29px;" onchange="do_s();"><option value=''>-<?php echo get_cate_title_no("arr_select","bc"); ?>-</option><?php echo op_select_cate2("bc",$s_bc); ?></select></td>
|
||||
<td><select name="s_category" style="width:80px;height:29px;" onchange="do_s();"><option value=''>-<?php echo get_cate_title_no("arr_select","category"); ?>-</option><?php echo op_select_cate2("category",$s_category); ?></select></td>
|
||||
<td>滚动间隔<input type="text" name="s_time" value="<?php echo $s_time; ?>" style="width:20px;">秒 刷新时间<input type="text" name="s_refresh_time" value="<?php echo $s_refresh_time; ?>" style="width:20px;">分钟 显示前<input type="text" name="page_size" value="<?php echo $page_size; ?>" style="width:20px;">名</td>
|
||||
<td><input type="submit" value=" 执 行 "></td>
|
||||
</tr></table></td>
|
||||
</tr>
|
||||
</form>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 187 KiB |
@@ -0,0 +1,343 @@
|
||||
<?php
|
||||
//------------------------------------------投影,到款,for新作
|
||||
define("THIS_FILE_ROOT",dirname(__FILE__));
|
||||
define("THIS_IN","edt_ipad");
|
||||
$flag_pad_offline="";
|
||||
include "../tmpl/config.php";
|
||||
require "../ipad/include/function.php";
|
||||
require "../ipad/include/db_mysql.php";
|
||||
error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
||||
date_default_timezone_set('Asia/Shanghai');
|
||||
$ip=$_SERVER["REMOTE_ADDR"];
|
||||
$http_root="http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
|
||||
$http_root=str_replace("/index.php","",$http_root);
|
||||
//-------------------------------register global
|
||||
$magic_quotes_gpc = get_magic_quotes_gpc();
|
||||
$register_globals = @ini_get('register_globals');
|
||||
if(!$register_globals || !$magic_quotes_gpc) {
|
||||
@extract(daddslashes($_POST));
|
||||
@extract(daddslashes($_GET));
|
||||
}
|
||||
$db=_mysql_connect();
|
||||
//
|
||||
if(${'s_'.$phb_config['key']}>0){
|
||||
$tmpl=get_db_msg("select count(id) 'num' from ".$table_pre."kh where ".$phb_config['key']."='".${'s_'.$phb_config['key']}."'");//先取总款数
|
||||
$page_size=round($tmpl['num']*$phb_config['detail'][${'s_'.$phb_config['key']}]);
|
||||
}
|
||||
//
|
||||
$page_size=$page_size?$page_size:20;
|
||||
$s_time=$s_time?$s_time:3;
|
||||
$s_refresh_time=$s_refresh_time?$s_refresh_time:30;
|
||||
$s_reload_time=$s_reload_time?$s_reload_time:10;
|
||||
$xh_ms=get_set("xh_ms");
|
||||
if($s_time<=0 || $page_size<=0){
|
||||
alert_and_back("请输入数字!");
|
||||
}
|
||||
$sql_qy="";
|
||||
$url_var="s_time=".$s_time."&s_refresh_time=".$s_refresh_time."&page_size=".$page_size;
|
||||
//取得排行款号
|
||||
if($s_qy || $s_brand || $s_sxz || $s_series || $s_theme || $s_category || $s_category1 || $s_season || $s_bc){
|
||||
$sql_con="where ";
|
||||
if($s_qy){
|
||||
$sql_con.="qy='".$s_qy."' and ";
|
||||
$sql_qy.=" and qy='".$s_qy."'";
|
||||
$url_var.="&s_qy=".$s_qy;
|
||||
}
|
||||
if($s_brand){
|
||||
$sql_con.="brand='".$s_brand."' and ";
|
||||
$url_var.="&s_brand=".$s_brand;
|
||||
}
|
||||
if($s_sxz){
|
||||
$sql_con.="sxz='".$s_sxz."' and ";
|
||||
$url_var.="&s_sxz=".$s_sxz;
|
||||
}
|
||||
if($s_series){
|
||||
$sql_con.="series='".$s_series."' and ";
|
||||
$url_var.="&s_series=".$s_series;
|
||||
}
|
||||
if($s_theme){
|
||||
$sql_con.="theme='".$s_theme."' and ";
|
||||
$url_var.="&s_theme=".$s_theme;
|
||||
}
|
||||
if($s_category){
|
||||
$sql_con.="category='".$s_category."' and ";
|
||||
$url_var.="&s_category=".$s_category;
|
||||
}
|
||||
if($s_category1){
|
||||
$sql_con.="category1='".$s_category1."' and ";
|
||||
$url_var.="&s_category1=".$s_category1;
|
||||
}
|
||||
if($s_bc){
|
||||
$sql_con.="bc='".$s_bc."' and ";
|
||||
$url_var.="&s_bc=".$s_bc;
|
||||
}
|
||||
$sql_con=substr($sql_con,0,-4);
|
||||
}
|
||||
$q="select sum(num) 'num',sum(je) 'je',iid 'id' from ".$table_pre."order ".$sql_con." group by iid order by num desc limit 0,".$page_size;
|
||||
$r=$db->query($q);
|
||||
$i=1;
|
||||
$content=$content_div=array();
|
||||
while($m=$db->fetch_array($r)){
|
||||
$m_kh=get_db_msg("select * from ".$table_pre."kh where id='".$m["id"]."'");
|
||||
$xh=get_kh_xh($m_kh);
|
||||
$content[$i][]=$xh;
|
||||
$content[$i][]=$m_kh["no"];
|
||||
$content[$i][]=get_cate_title_no("bc",$m_kh["bc"]);
|
||||
$content[$i][]=get_cate_title_no("category",$m_kh["category"]);
|
||||
//取得下单客户量
|
||||
$m_num_client=get_db_msg("select count(distinct uid) 'num' from ".$table_pre."order where iid='".$m_kh["id"]."'".$sql_qy);
|
||||
//
|
||||
//取得定制选项
|
||||
$select_dz=array();
|
||||
$q1="select no,title from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no<>'jgd' and no<>'sx' and no<>'color' order by ord";
|
||||
$r1=$db->query($q1);
|
||||
$j=0;
|
||||
while($m1=$db->fetch_array($r1)){
|
||||
$select_dz[$j][0]=$m1["title"].":";
|
||||
$select_dz[$j][1]=get_cate_title_no($m1["no"],$m_kh[$m1["no"]]);
|
||||
$j++;
|
||||
}
|
||||
$dzHTML = '';
|
||||
$dzCount = 0;
|
||||
for($k=0;$k<ceil(count($select_dz)/2);$k++){
|
||||
$dzHTML.="<div><span>".$select_dz[$k*2][0]."</span><span>".$select_dz[$k*2][1]."</span></div>";
|
||||
if ($select_dz[$k*2][0]) $dzCount++;
|
||||
$dzHTML.="<div><span>".$select_dz[$k*2+1][0]."</span><span>".$select_dz[$k*2+1][1]."</span></div>";
|
||||
if ($select_dz[$k*2+1][0]) $dzCount++;
|
||||
}
|
||||
//
|
||||
$pic=get_kh_picture_big($m_kh["no"],$m_kh["main_pic"],$m_kh["color"]);
|
||||
$content_div[$i]="
|
||||
<div id=\"div_".$i."\" style=\"display:none; width: 100%; height: 100%;\">
|
||||
<div style=\"width: 50%;\">
|
||||
<div style=\"background: white; text-align: center; width: calc(80% - 32px); margin: 32px auto; padding: 16px; max-width: 200px; border-radius: 12px;\">
|
||||
<span style=\"display: block; font-size: 30px;\">NO.".$i."</span>
|
||||
<span style=\"display: block; font-size: 20px;\">第".$i."名</span>
|
||||
</div>
|
||||
<div style=\"background: white; text-align: left; width: calc(80% - 32px); margin: 32px auto; padding: 16px; max-width: 200px; border-radius: 12px;\">
|
||||
<div><span>款号:</span><span>".$m_kh["no"]."</span></div>
|
||||
<div><span>序号:</span><span>".get_kh_xh($m_kh)."</span></div>
|
||||
".$dzHTML."
|
||||
<div><span>款式名:</span><span>".$m_kh["title"]."</span></div>
|
||||
<div><span>下单客户:</span><span>".$m_num_client["num"]."个</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div style=\"width: 50%; position: relative;\">
|
||||
<div style=\"text-align: center; width: calc(80% - 32px); height: ".(($dzCount+4)*22+16*2+102+32-54)."px; padding-top: 54px; background: white; overflow: hidden; margin: 32px auto; border-radius: 12px;\">".out_good_pic($pic,280,300)."</div>
|
||||
</div>
|
||||
</div>";
|
||||
$i++;
|
||||
}
|
||||
$num2=count($content)>20?count($content):20;
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="refresh" content="<?php echo $s_refresh_time*60; ?>;url=<?php echo $http_root."?".$url_var; ?>" />
|
||||
<title>排行榜</title>
|
||||
<style>
|
||||
.tab_hlight{
|
||||
background-color:#cccccc;border:1px solid #000000;font-weight:bold;
|
||||
}
|
||||
.tab_normal{
|
||||
background-color:#ffffff;border:1px solid #000000;font-weight:normal;
|
||||
}
|
||||
.list_th{
|
||||
font-size:18px;font-weight:bold;height:30px;
|
||||
}
|
||||
.list_td{
|
||||
font-size:18px;height:25px;
|
||||
}
|
||||
.list_hlight{
|
||||
background-color:#cccccc;
|
||||
}
|
||||
.list_normal{
|
||||
background-color: white;
|
||||
}
|
||||
.arrow_hlight{
|
||||
background-color:#cccccc;
|
||||
}
|
||||
.arrow_normal{
|
||||
background-color:#f0f0f0;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var l=1;
|
||||
var num=<?php echo count($content); ?>;
|
||||
function dhlight(i1){
|
||||
var obj_list={},obj_div={},obj_arrow={};
|
||||
for(var i=1;i<=num;i++){
|
||||
obj_list=document.getElementById("list_"+i);
|
||||
obj_div=document.getElementById("div_"+i);
|
||||
obj_arrow=document.getElementById("arrow_"+i);
|
||||
if(i==i1){
|
||||
obj_div.style.display="flex";
|
||||
obj_list.className="list_hlight";
|
||||
obj_arrow.className="arrow_hlight";
|
||||
}else{
|
||||
obj_div.style.display="none";
|
||||
obj_list.className="list_normal";
|
||||
obj_arrow.className="arrow_normal";
|
||||
}
|
||||
}
|
||||
l=i1;
|
||||
}
|
||||
function autochangecategory(){
|
||||
var category=document.getElementsByName('s_category')[0];
|
||||
var submit=document.getElementsByName('s')[0];
|
||||
var index=category.selectedIndex+1;
|
||||
if (index==category.length) {
|
||||
index=0;
|
||||
};
|
||||
category.options[index].selected=true;
|
||||
console.log(submit);
|
||||
submit.submit();
|
||||
}
|
||||
function dauto(){
|
||||
dhlight(l);
|
||||
if(l==num)
|
||||
l=1;
|
||||
else
|
||||
l++;
|
||||
window.setTimeout('dauto()',<?php echo $s_time*1000; ?>);
|
||||
}
|
||||
function sub_ph(){
|
||||
var f=document.s;
|
||||
var f1=window.parent.document.s1;
|
||||
if(f.s_qy){
|
||||
var s_qy=f.s_qy.options[f.s_qy.selectedIndex].value;
|
||||
f1.s_qy.value=s_qy;
|
||||
}
|
||||
if(f.s_brand){
|
||||
var s_brand=f.s_brand.options[f.s_brand.selectedIndex].value;
|
||||
f1.s_brand.value=s_brand;
|
||||
}
|
||||
if(f.s_gender){
|
||||
var s_gender=f.s_gender.options[f.s_gender.selectedIndex].value;
|
||||
f1.s_gender.value=s_gender;
|
||||
}
|
||||
if(f.s_sxz){
|
||||
var s_sxz=f.s_sxz.options[f.s_sxz.selectedIndex].value;
|
||||
f1.s_sxz.value=s_sxz;
|
||||
}
|
||||
if(f.s_series){
|
||||
var s_series=f.s_series.options[f.s_series.selectedIndex].value;
|
||||
f1.s_series.value=s_series;
|
||||
}
|
||||
if(f.s_theme){
|
||||
var s_theme=f.s_theme.options[f.s_theme.selectedIndex].value;
|
||||
f1.s_theme.value=s_theme;
|
||||
}
|
||||
if(f.s_season){
|
||||
var s_season=f.s_season.options[f.s_season.selectedIndex].value;
|
||||
f1.s_season.value=s_season;
|
||||
}
|
||||
if(f.s_bc){
|
||||
var s_bc=f.s_bc.options[f.s_bc.selectedIndex].value;
|
||||
f1.s_bc.value=s_bc;
|
||||
}
|
||||
if(f.s_category){
|
||||
var s_category=f.s_category.options[f.s_category.selectedIndex].value;
|
||||
f1.s_category.value=s_category;
|
||||
}
|
||||
if(f.s_category1){
|
||||
var s_category1=f.s_category1.options[f.s_category1.selectedIndex].value;
|
||||
f1.s_category1.value=s_category1;
|
||||
}
|
||||
f1.s_time.value=f.s_time.value;
|
||||
f1.page_size.value=f.page_size.value;
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body style="padding:0;margin:0; background: white;" onload="dauto();">
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
|
||||
<tr>
|
||||
<td style="width: 40%;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td width="40" align="center" class="list_th">排名</td>
|
||||
<td width="80" align="center" class="list_th">序号</td>
|
||||
<td align="center" class="list_th">款号</td>
|
||||
<td align="center" class="list_th"><?php echo get_cate_title_no("arr_select","bc"); ?></td>
|
||||
<td align="center" class="list_th"><?php echo get_cate_title_no("arr_select","category"); ?></td>
|
||||
<td height="25"> </td>
|
||||
</tr>
|
||||
<?php
|
||||
for($i=1;$i<=$num2;$i++){
|
||||
if($content[$i][0]){ ?>
|
||||
<tr id="list_<?php echo $i; ?>" onclick="dhlight(<?php echo $i; ?>)" style="cursor:pointor;" class="list_normal">
|
||||
<td align="center" class="list"><?php echo $i; ?></td>
|
||||
<td class="list_td" align="center" ><?php echo $content[$i][0] ?></td>
|
||||
<td class="list_td" align="center" ><?php echo $content[$i][1] ?></td>
|
||||
<td class="list_td" align="center" ><?php echo $content[$i][2] ?></td>
|
||||
<td class="list_td" align="center" ><?php echo $content[$i][3] ?></td>
|
||||
<td class="list_td" id="arrow_<?php echo $i; ?>" class="arrow_normal"> </td>
|
||||
</tr>
|
||||
<?php }else{ ?>
|
||||
<tr style="cursor:pointor;" class="list_normal">
|
||||
<td align="center" class="list"> </td>
|
||||
<td class="list_td"> </td>
|
||||
<td class="list_td"> </td>
|
||||
<td class="list_td"> </td>
|
||||
<td class="list_td"> </td>
|
||||
<td class="list_td" class="arrow_normal"> </td>
|
||||
</tr>
|
||||
<?php } } ?>
|
||||
</table></td><td style="background-image: url(ty_right.jpg); background-repeat: no-repeat; width: 60%;">
|
||||
<?php
|
||||
for($i=1;$i<=count($content_div);$i++){
|
||||
echo $content_div[$i];
|
||||
}
|
||||
?></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<form name="s" action="<?php echo $_SERVER[PHP_SELF]; ?>" method="post" onsubmit="sub_ph();">
|
||||
<td><table border="0" cellspacing="2" cellpadding="1"><tr>
|
||||
<?php
|
||||
//区域条件
|
||||
$check=get_db_msg("select count(*) 'num' from ".$table_pre."client where face='9'");
|
||||
if($check["num"]>0){
|
||||
echo "<td><select name=\"s_qy\" style=\"width:80px;height:29px;\" onchange=\"do_s();\"><option value=''>-区域-</option>";
|
||||
$q="select id,title from ".$table_pre."client where face='9' order by id";
|
||||
$r=$db->query($q);
|
||||
while($m=$db->fetch_array($r)){
|
||||
echo "<option value=\"".$m["id"]."\"";
|
||||
if($m["id"]==$s_qy)
|
||||
echo " selected";
|
||||
echo ">".$m["title"]."</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php if(check_arr_select_show("brand")){ ?>
|
||||
<td><select name="s_brand" style="width:80px;height:29px;" onchange="do_s();"><option value=''>-<?php echo get_cate_title_no("arr_select","brand"); ?>-</option><?php echo op_select_cate2("brand",$s_brand); ?></select></td>
|
||||
<?php } ?>
|
||||
<?php if(check_arr_select_show("sxz")){ ?>
|
||||
<td><select name="s_sxz" style="width:80px;height:29px;" onchange="do_s();"><option value=''>-<?php echo get_cate_title_no("arr_select","sxz"); ?>-</option><?php echo op_select_cate2("sxz",$s_sxz); ?></select></td>
|
||||
<?php } ?>
|
||||
<?php if(check_arr_select_show("series")){ ?>
|
||||
<td><select name="s_series" style="width:80px;height:29px;" onchange="do_s();"><option value=''>-<?php echo get_cate_title_no("arr_select","series"); ?>-</option><?php echo op_select_cate2("series",$s_series); ?></select></td>
|
||||
<?php } ?>
|
||||
<?php if(check_arr_select_show("theme")){ ?>
|
||||
<td><select name="s_theme" style="width:80px;height:29px;" onchange="do_s();"><option value=''>-<?php echo get_cate_title_no("arr_select","theme"); ?>-</option><?php echo op_select_cate2("theme",$s_theme); ?></select></td>
|
||||
<?php } ?>
|
||||
<?php if(check_arr_select_show("season")){ ?>
|
||||
<td><select name="s_season" style="width:80px;height:29px;" onchange="do_s();"><option value=''>-<?php echo get_cate_title_no("arr_select","season"); ?>-</option><?php echo op_select_cate2("season",$s_season); ?></select></td>
|
||||
<?php } ?>
|
||||
<td><select name="s_bc" style="width:80px;height:29px;" onchange="do_s();"><option value=''>-<?php echo get_cate_title_no("arr_select","bc"); ?>-</option><?php echo op_select_cate2("bc",$s_bc); ?></select></td>
|
||||
<td><select name="s_category" style="width:80px;height:29px;" onchange="do_s();"><option value=''>-<?php echo get_cate_title_no("arr_select","category"); ?>-</option><?php echo op_select_cate2("category",$s_category); ?></select></td>
|
||||
<td>滚动间隔<input type="text" name="s_time" value="<?php echo $s_time; ?>" style="width:20px;">秒 刷新时间<input type="text" name="s_refresh_time" value="<?php echo $s_refresh_time; ?>" style="width:20px;">分钟 显示前<input type="text" name="page_size" value="<?php echo $page_size; ?>" style="width:20px;">名</td>
|
||||
<td><input type="submit" value=" 执 行 "></td>
|
||||
</tr></table></td>
|
||||
</tr>
|
||||
</form>
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
var time=1000*num*document.getElementsByName('s_time')[0].value>0?1000*num*document.getElementsByName('s_time')[0].value:3000;
|
||||
//window.setInterval('autochangecategory()',1000*num*document.getElementsByName('s_time')[0].value);
|
||||
window.setInterval('autochangecategory()',time);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||