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
EDT/plugin/client_bb/dgph.php
T
wsh5485 7e47ce238b chore: 添加多个图片和资源文件
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
2025-06-15 13:04:37 +08:00

246 lines
10 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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;
//}
?>