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

107 lines
4.8 KiB
PHP

<?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)."],";
}
?>