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