This repository has been archived on 2026-06-20. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
wsh5485 7e47ce238b chore: 添加多个图片和资源文件
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
2025-06-15 13:04:37 +08:00

489 lines
24 KiB
PHP

<?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."\",";
?>