7e47ce238b
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
77 lines
4.6 KiB
PHP
77 lines
4.6 KiB
PHP
<?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."\",";
|
|
?>
|