7e47ce238b
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
1075 lines
41 KiB
PHP
1075 lines
41 KiB
PHP
<?php
|
|
//-------------------------------电子签名-界面
|
|
header("Content-type: text/html; charset=utf-8");
|
|
function read_file1($file){
|
|
$content="";
|
|
if(is_file($file)){
|
|
$fp=fopen($file,"r");
|
|
while($buffer=fread($fp,1024)){
|
|
$content.=$buffer;
|
|
}
|
|
fclose($fp);
|
|
}
|
|
return $content;
|
|
}
|
|
$json_data="{";
|
|
if(THIS_IN!="edt_ipad")
|
|
exit("错误的访问!");
|
|
$uid=check_cookie_jxs();
|
|
|
|
require THIS_FILE_ROOT."/include/signature-to-image.php";
|
|
|
|
$json_data.="\"uid\":\"".$uid."\",";
|
|
$msg_login=get_db_msg("select * from ".$table_pre."client where id='".$uid."'");
|
|
$msg_login1=get_db_msg("select * from ".$table_pre."client where id='".$id."'");
|
|
$con_path=" and (upath='".$msg_login1["path"]."-".$msg_login1["id"]."' or upath like '".$msg_login1["path"]."-".$msg_login1["id"]."-%')";
|
|
$upath=$msg_login1["path"]."-".$msg_login1["id"];
|
|
$is_brand=is_brand();
|
|
$show_jd=get_set("show_jd");
|
|
$con_spk=($is_spk=="y")?" and is_sp<>'y'":"";
|
|
$json_data.="\"show_jd\":\"".$show_jd."\",";
|
|
$json_data.="\"is_brand\":\"".$is_brand."\",";
|
|
$s_key=$_key;
|
|
$sys_size_num=get_max_size_num();
|
|
|
|
if($is_brand<>"y"){
|
|
$tmp=$msg_login1;
|
|
$is_jd=$msg_login1["is_jd"];
|
|
$is_checked=$msg_login1["is_checked"];
|
|
}else{
|
|
$tmp=get_db_msg("select is_jd from ".$table_pre."client_brand where cid='".$uid."'".$con_brand." order by is_jd limit 0,1");
|
|
$is_jd=$tmp["is_jd"];
|
|
$tmp=get_db_msg("select is_checked from ".$table_pre."client_brand where cid='".$uid."'".$con_brand." order by is_checked limit 0,1");
|
|
$is_checked=$tmp["is_checked"];
|
|
}
|
|
|
|
$xsnr="";
|
|
|
|
if($show_jd=="y"){
|
|
$tmp=$msg_login1;
|
|
if($is_jd=="y"){
|
|
//$jd_button="经理审单|go_url('".$_SERVER[PHP_SELF]."?_m=jd')";
|
|
$xsnr="jd";
|
|
}
|
|
if($is_checked=="y"){
|
|
$m1=get_db_msg("select * from ".$table_pre."order_state where cid='".$uid."' and action<>'订单打印' order by add_date desc limit 0,1");
|
|
if($m1["action"]=="客户签字"){
|
|
//$str_sign="我的订单|go_url('".$_SERVER[PHP_SELF]."?_m=my_detail&window=new\')";
|
|
$xsnr="wddd";
|
|
}else{
|
|
//$str_sign="经理签字|go_url('".$_SERVER[PHP_SELF]."?_m=sign')";
|
|
$xsnr="jlqz";
|
|
}
|
|
$jd_button=$str_sign;
|
|
}
|
|
if($is_jd!="y" && $is_checked!="y"){
|
|
//$jd_button="交单|go_url('".$_SERVER[PHP_SELF]."?_m=jd&_m2=".$_m."')";
|
|
$xsnr="jd";
|
|
}
|
|
}
|
|
$json_data.="\"is_jd\":\"".$is_jd."\",";
|
|
$json_data.="\"_m\":\"".$_m."\",";
|
|
$json_data.="\"_a\":\"".$_a."\",";
|
|
|
|
if(!$_a){
|
|
$_a=$xsnr;
|
|
}
|
|
$json_data.="\"xsnr\":\"".$_a."\",";
|
|
switch($_a){
|
|
case "qjsd": //经理审单
|
|
if($cz=="thjd" || $cz=="qjqr"){
|
|
$tb.="<table lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' class='layui-table'>";
|
|
$tb.="<tr><td bgcolor='#cccccc' height='30' align='center'><b>请输入店铺上级账号</b></td></tr>";
|
|
$tb.="<tr><td bgcolor='#ffffff' align='center'>登录账号<input type='text' style='width:100px;' name='qj_username' id='qj_username' value=''></td></tr>";
|
|
$tb.="<tr><td bgcolor='#ffffff' align='center'>登录密码<input type='password' style='width:100px;' name='qj_password' id='qj_password' value=''></td></tr>";
|
|
$tb.="</table>";
|
|
}
|
|
$json_data.="\"cz\":\"".$cz."\",";
|
|
$json_data.="\"tb\":\"".$tb."\",";
|
|
break;
|
|
case "qjsd_do": //经理审单-账号密码输入
|
|
$arr_path=explode("-",$msg_login1["path"]);
|
|
$sj_id=end($arr_path);
|
|
$tmp_sj=get_db_msg("select id,face,title,username,password from ".$table_pre."client where id='".$sj_id."'");
|
|
if($tmp_sj["face"]=='3'){
|
|
$str_sj="代理商";
|
|
}else{
|
|
$str_sj="区经";
|
|
}
|
|
$login_sj=get_db_msg("select id,title,face,charge_uid,charge_path from ".$table_pre."client where username='".$qj_username."' and password='".$qj_password."' limit 0,1");
|
|
$arr_charge_path=explode(",",$login_sj["charge_path"]);
|
|
$check_sj='false';
|
|
if($msg_login1["face"]=="4"){
|
|
if($tmp_sj["id"]==$login_sj["id"] && $tmp_sj["face"]=='3'){
|
|
$check_sj='true';
|
|
}else{
|
|
if($login_sj["face"]=="2" && in_array($upath,$arr_charge_path)){
|
|
$check_sj='true';
|
|
}
|
|
}
|
|
}else if($msg_login1["face"]=="3"){
|
|
if($login_sj["face"]=="2" && in_array($upath,$arr_charge_path)){
|
|
$check_sj='true';
|
|
}
|
|
}
|
|
//echo $login_sj["face"];exit;
|
|
//$arr_charge_uid=explode(",",$m_qj["charge_uid"]);
|
|
//if($m_qj["face"]=="2" && in_array($uid,$arr_charge_uid)){
|
|
if($check_sj=='true'){
|
|
//------------验证成功
|
|
if($cz=="shtg"){
|
|
if($is_brand=="y"){
|
|
//---------------------审核通过
|
|
$q="update ".$table_pre."client_brand set is_checked='y' where cid='".$uid."'".$con_brand;
|
|
$db->query($q);
|
|
}else{
|
|
//---------------------审核通过
|
|
$q="update ".$table_pre."client set is_checked='y' where id='".$uid."'".$con_brand;
|
|
$db->query($q);
|
|
}
|
|
//加入客户订单操作日志表
|
|
$add_date=date("Y-m-d H:i:s");
|
|
$q1="insert into ".$table_pre."order_state (uid,cid,brand,action,attachments,add_date) values ('".$login_sj["id"]."','".$uid."','".$s_brand."','".$str_sj."确认','','".$add_date."')";
|
|
$db->query($q1);
|
|
//alert_and_redirect("审核成功,请双方签字","?_m=sign&_m2=".$_m2."&s_brand=".$s_brand."");
|
|
$json_data.="\"msg\":\"审核成功,请双方签字\",";
|
|
$json_data.="\"qz\":\"qz\",";
|
|
$json_data.="\"code\":101,";
|
|
$json_data.="\"refresh\":\"y\",";
|
|
}else if($cz=="thjd"){
|
|
if($is_brand=="y"){
|
|
//---------------------退回修改
|
|
$q="update ".$table_pre."client_brand set is_jd='n' where cid='".$uid."'".$con_brand;
|
|
$db->query($q);
|
|
}else{
|
|
//---------------------退回修改
|
|
$q="update ".$table_pre."client set is_jd='n' where id='".$uid."'".$con_brand;
|
|
$db->query($q);
|
|
}
|
|
//加入客户订单操作日志表
|
|
$add_date=date("Y-m-d H:i:s");
|
|
$q1="insert into ".$table_pre."order_state (uid,cid,brand,action,attachments,add_date) values ('".$login_sj["id"]."','".$uid."','".$s_brand."','".$str_sj."退回','','".$add_date."')";
|
|
$db->query($q1);
|
|
$json_data.="\"msg\":\"操作成功\",";
|
|
$json_data.="\"code\":101,";
|
|
$json_data.="\"refresh\":\"y\",";
|
|
}
|
|
}else{
|
|
//身份验证失败
|
|
//alert_and_back("对不起,账号或者权限有误!");
|
|
$json_data.="\"msg\":\"对不起,账号或者权限有误!\",";
|
|
$json_data.="\"code\":101,";
|
|
}
|
|
$json_data.="\"cz\":\"".$cz."\",";
|
|
$json_data=substr($json_data,0,-1)."}";
|
|
echo $json_data;
|
|
exit;
|
|
break;
|
|
case "wddd": //我的订单
|
|
include THIS_FILE_ROOT.'/include/phpqrcode/phpqrcode.php';
|
|
$value = $msg_login1["username"];
|
|
$errorCorrectionLevel = 'L';//容错级别
|
|
$matrixPointSize = 16;//生成图片大小
|
|
//$str = str_replace(PHP_EOL, '', $str);
|
|
//生成二维码图片
|
|
//$tmp=QRcode::png($value, "qrcode.png", $errorCorrectionLevel, $matrixPointSize, 2);
|
|
//var_dump($value);
|
|
//$pic=base64EncodeImage(QRcode::png($value, false, $errorCorrectionLevel, $matrixPointSize, 2));
|
|
ob_start();
|
|
QRcode::png($value, false, $errorCorrectionLevel, $matrixPointSize, 2);
|
|
$data =ob_get_contents();
|
|
ob_end_clean();
|
|
$pic="data:image/png;base64,".base64_encode($data);
|
|
//$cache_file="qrcode.png";
|
|
//var_dump($cache_file);
|
|
//imagepng($png_qj,$cache_file);
|
|
//imagedestroy($png_qj);
|
|
//$png_qj=read_file1($cache_file);
|
|
//del_file($cache_file);
|
|
//$pic="data:image/png;base64,".chunk_split(base64_encode($png_qj));
|
|
$json_data.="\"ewmsrc\":\"".$pic."\",";
|
|
|
|
$wddd=get_db_msg("select * from ".$table_pre."plugin_print where uid='".$uid."'");
|
|
$url="../admin/debug/".$wddd["file_name"];
|
|
$json_data.="\"url\":\"".$url."\",";
|
|
break;
|
|
case "show_ewm": //显示二维码
|
|
include THIS_FILE_ROOT.'/include/phpqrcode/phpqrcode.php';
|
|
$value = $username;
|
|
$errorCorrectionLevel = 'L';//容错级别
|
|
$matrixPointSize = 16;//生成图片大小
|
|
ob_start();
|
|
QRcode::png($value, false, $errorCorrectionLevel, $matrixPointSize, 2);
|
|
$data =ob_get_contents();
|
|
ob_end_clean();
|
|
$pic="data:image/png;base64,".base64_encode($data);
|
|
$json_data.="\"ewmsrc\":\"".$pic."\",";
|
|
break;
|
|
case "jlqz": //经理签字
|
|
$arr_zd=array("brand"=>get_cate_title_no("arr_select","brand"),"no"=>"款号","bc"=>get_cate_title_no("arr_select","bc"),"category"=>get_cate_title_no("arr_select","category"),"category1"=>get_cate_title_no("arr_select","category1"));
|
|
|
|
//-------------------处理尺码表头
|
|
//取得合并尺码
|
|
$arr_size_merged=get_size_merged();
|
|
$num_size_total=count($arr_size_merged);
|
|
//取得尺码合计sql
|
|
$sql_sum_num="";
|
|
for($k=0;$k<$num_size_total;$k++){
|
|
$sql_sum_num.="sum(num_".$arr_size_merged[$k].") 'num_".$arr_size_merged[$k]."',";
|
|
}
|
|
//取得尺码表头内容
|
|
$num_size_group=0;
|
|
$size_tr=array();
|
|
$r1=$db->query("select * from ".$table_pre."keyword where cate='size' order by ord");
|
|
while($m1=$db->fetch_array($r1)){
|
|
$size_tr[$num_size_group]="";
|
|
for($i=1;$i<=$num_size_total;$i++){
|
|
$tmp=get_db_msg("select title from ".$table_pre."size where iid='".$m1["id"]."' and no='".$i."'");
|
|
$t=$tmp["title"]?$tmp["title"]:" ";
|
|
$size_tr[$num_size_group].="<td width='30'>".$t."</td>";
|
|
}
|
|
$arr_size_merged[]=$m1["no"];
|
|
$num_size_group++;
|
|
}
|
|
//-------------------/处理尺码表头结束
|
|
|
|
$tb="";
|
|
$tb.="<table lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' width='100%' class='layui-table'><thead><tr>";
|
|
foreach($arr_zd as $k1 => $v1){
|
|
$tb.="<td rowspan='".$num_size_group."'>".$v1."</td>";
|
|
}
|
|
$tb.="<td rowspan='".$num_size_group."'>颜色</td>".$size_tr[0];
|
|
$tb.="<td rowspan='".$num_size_group."'>小计</td>";
|
|
$tb.="<td rowspan='".$num_size_group."'>吊牌价</td>";
|
|
$tb.="<td rowspan='".$num_size_group."'>吊牌总额</td>";
|
|
for($i=1;$i<$num_size_group;$i++){
|
|
$tb.="<tr>".$size_tr[$i]."</tr>";
|
|
}
|
|
$tb.="</thead><tbody>";
|
|
$q="select iid,no from ".$table_pre."order where _key='".$s_key."' and ka<>'y'".$con_path." group by no order by brand,bc,no";
|
|
//echo $q."<br>";
|
|
$r=$db->query($q);
|
|
$total_num=$total_money=$total_money_zk=0;
|
|
$count=0;
|
|
$arr_kh=$arr_kh_color=array();
|
|
$arr_tmp=array();
|
|
while($m=$db->fetch_array($r)){
|
|
$bg=($count%2)?"#f0f0f0":"#ffffff";
|
|
$m1=get_db_msg("select * from ".$table_pre."kh where id='".$m["iid"]."'");
|
|
$price_zk=get_price_zk($m1["id"],$m_client["id"]);
|
|
//取得颜色,杯型
|
|
$q2="select color,bx,".get_size_sql("sum1")." from ".$table_pre."order where _key='".$s_key."' and ka<>'y' ".$con_path." and no='".$m["no"]."' group by no,color order by color,bx";
|
|
//echo $q2."<br>";
|
|
$r2=$db->query($q2);
|
|
//
|
|
$j=0;
|
|
$je1=$num1=0;
|
|
while($m2=$db->fetch_array($r2)){
|
|
$td_size1="";
|
|
$num_color_hj=0;
|
|
$xj_num=0;
|
|
for($k=0;$k<$num_size_total;$k++){
|
|
$ck_md=check_md($m1["no"],$m2["color"],$m2["bx"],$arr_size_merged[$k]);
|
|
if($s_md=="n"){
|
|
if($ck_md!="n"){
|
|
$tmp_num=0;
|
|
}else{
|
|
$tmp_num=$m2["num_".$arr_size_merged[$k]];
|
|
}
|
|
}else{
|
|
$tmp_num=$m2["num_".$arr_size_merged[$k]];
|
|
}
|
|
if($ck_md!="n"){
|
|
$price_zk1=$ck_md>0?$ck_md:$price_zk;
|
|
$sty1="#999900";
|
|
}else{
|
|
$sty1=$bg;
|
|
$price_zk1=$price_zk;
|
|
}
|
|
if($s_md=="n")
|
|
$sty1=$bg;
|
|
$je1+=$tmp_num*$price_zk1;
|
|
$num1+=$tmp_num;
|
|
$num_color_hj+=$tmp_num;
|
|
//计算尺码合计
|
|
$v11="hj_num_".$k;
|
|
$$v11+=$tmp_num;
|
|
$xj_num+=$tmp_num;
|
|
//
|
|
$td_size1.="<td bgcolor='".$sty1."' align='center'>".deel_td(deel_0($tmp_num))."</td>";
|
|
}
|
|
if($num_color_hj>0){
|
|
$arr_tmp[$m["no"]]=$num_color_hj;
|
|
$arr_kh_color[$count][$j]="<td bgcolor='".$bg."' align='center'>".$m2["color"]."-".get_cate_title_no("color",$m2["color"])."</td>";
|
|
if($bx_sizegroup_id>0)
|
|
$arr_kh_color[$count][$j].="<td bgcolor='".$bg."' align='center'>".deel_td($m2["bx"])."</td>";
|
|
$arr_kh_color[$count][$j].=$td_size1;
|
|
//小计
|
|
$arr_kh_color[$count][$j].="<td bgcolor='".$bg."' align='center'>".$xj_num."</td>";
|
|
$arr_kh_color[$count][$j].="<td bgcolor='".$bg."' align='center'>".$m1["price"]."</td>";
|
|
$arr_kh_color[$count][$j].="<td bgcolor='".$bg."' align='center'>".$xj_num*$m1["price"]."</td>";
|
|
if($is_show_je=="y"){
|
|
//吊牌金额小计
|
|
#$arr_kh_color[$count][$j].="<td bgcolor='".$bg."' align='center'>".$xj_num*$m1["price"]."</td>";
|
|
//结算金额小计
|
|
#if(trim($zk_type) || $check_md["num"]>0)
|
|
#$arr_kh_color[$count][$j].="<td bgcolor='".$bg."' align='center'>".$xj_num*$price_zk1."</td>";
|
|
}
|
|
$j++;
|
|
}
|
|
}
|
|
$total_num+=$num1;
|
|
$total_money+=$num1*$m1["price"];
|
|
$total_money_zk+=$je1;
|
|
//
|
|
if($num1>0){
|
|
$arr_kh[$count]["id"]=$m1["id"];
|
|
$arr_kh[$count]["no"]=$m1["no"];
|
|
$xh=get_kh_xh($m1);
|
|
$xh=$xh>0?$xh."#":"";
|
|
$arr_kh[$count]["xh"]=$xh;
|
|
$arr_kh[$count]["title"]=$m1["title"];
|
|
$arr_kh[$count]["series"]=get_cate_title_no("series",$m1["series"]);
|
|
$arr_kh[$count]["brand"]=get_cate_title_no("brand",$m1["brand"]);
|
|
$arr_kh[$count]["season"]=get_cate_title_no("season",$m1["season"]);
|
|
$arr_kh[$count]["bc"]=get_cate_title_no("bc",$m1["bc"]);
|
|
$arr_kh[$count]["category"]=get_cate_title_no("category",$m1["category"]);
|
|
$arr_kh[$count]["category1"]=get_cate_title_no("category1",$m1["category1"]);
|
|
$arr_kh[$count]["num"]=$num1;
|
|
$arr_kh[$count]["price"]=$m1["price"];
|
|
$arr_kh[$count]["je"]=$je1;
|
|
$count++;
|
|
}
|
|
}
|
|
//组合输出内容
|
|
$count=0;
|
|
for($i=0;$i<count($arr_kh);$i++){
|
|
$bg=($i%2)?"#f0f0f0":"#ffffff";
|
|
$num1=count($arr_kh_color[$i]);
|
|
for($j=0;$j<$num1;$j++){
|
|
$tmp_zd="";
|
|
foreach($arr_zd as $k1 => $v1){
|
|
$tmp_zd.="<td bgcolor='".$bg."' align='center'>".deel_td($arr_kh[$i][$k1])."</td>";
|
|
}
|
|
$tb.="<tr height='18'>".$tmp_zd.$arr_kh_color[$i][$j];
|
|
$tb.="</tr>";
|
|
$count++;
|
|
}
|
|
}
|
|
$td_size1="";
|
|
for($k=0;$k<$num_size_total;$k++){
|
|
$v1="hj_num_".$k;
|
|
$td_size1.="<td bgcolor='#f0f0f0' align='center'>".deel_td($$v1)."</td>";
|
|
}
|
|
if($bx_sizegroup_id>0){
|
|
$colspan1=count($arr_zd)+2;
|
|
$colspan_all=count($arr_zd)+3;
|
|
}else{
|
|
$colspan1=count($arr_zd)+1;
|
|
$colspan_all=count($arr_zd)+2;
|
|
}
|
|
$tb.="<tr height='18'><td colspan='".($colspan1)."' align='center' bgcolor='#f0f0f0'>合计</td>".$td_size1."<td bgcolor='#f0f0f0' align='center'>".$total_num."</td><td bgcolor='#f0f0f0' align='center'></td><td bgcolor='#f0f0f0' align='center'>".$total_money."</td></tr>";
|
|
$tb.="</tbody></table><br>";
|
|
$json_data.="\"tb\":\"".$tb."\",";
|
|
break;
|
|
case "jlqz_save": //经理签字
|
|
//$qy_id=get_qy_id($msg_login1["path"]."-".$msg_login1["id"]);
|
|
$arr_path=explode("-",$msg_login1["path"]);
|
|
$sj_id=end($arr_path);
|
|
$png_qj= sigJsonToImage($sign_qj,array('imageSize'=>array(600,300),"penWidth"=>4));
|
|
$cache_file="../admin/debug/sign/sign_".$msg_login1["id"].".png";
|
|
imagepng($png_qj,$cache_file);
|
|
imagedestroy($png_qj);
|
|
$png_qj=read_file1($cache_file);
|
|
del_file($cache_file);
|
|
$png_base64_qj="data:image/png;base64,".chunk_split(base64_encode($png_qj));
|
|
//print_r($png_base64_qj);
|
|
|
|
$png_sp= sigJsonToImage($sign_sp,array('imageSize'=>array(600,300),"penWidth"=>4));
|
|
$cache_file1="../admin/debug/sign/sign_".$msg_login1["id"]."_sp.png";
|
|
imagepng($png_sp,$cache_file1);
|
|
imagedestroy($png_sp);
|
|
$png_sp=read_file1($cache_file1);
|
|
del_file($cache_file1);
|
|
$png_base64_sp="data:image/png;base64,".chunk_split(base64_encode($png_sp));
|
|
//print_r($png_base64_sp);
|
|
|
|
//
|
|
$png_client= sigJsonToImage($sign_client,array('imageSize'=>array(600,300),"penWidth"=>4));
|
|
$cache_file2="../admin/debug/sign/sign_".$msg_login1["id"]."_qj.png";
|
|
imagepng($png_client,$cache_file2);
|
|
imagedestroy($png_client);
|
|
$png_client=read_file1($cache_file2);
|
|
del_file($cache_file2);
|
|
$png_base64_client="data:image/png;base64,".chunk_split(base64_encode($png_client));
|
|
//print_r($png_base64_client);
|
|
|
|
|
|
$check_client=get_db_msg("select id from ".$table_pre."order_qm where uid='".$msg_login1["id"]."'");
|
|
if(!$check_client["id"]){
|
|
$db->query("insert into ".$table_pre."order_qm (uid,qm_kh,qm_qj,qm_sp) values ('".$msg_login1["id"]."','".$png_base64_client."','".$png_base64_qj."','".$png_base64_sp."')");
|
|
}else{
|
|
$db->query("update ".$table_pre."order_qm set qm_kh='".$png_base64_client."',qm_qj='".$png_base64_qj."',qm_sp='".$png_base64_sp."' where uid='".$msg_login1["id"]."'");
|
|
}
|
|
$html="<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
|
|
<html xmlns=\"http://www.w3.org/1999/xhtml\">
|
|
<head>
|
|
<meta http-equiv=\"content-Type\" content=\"text/html; charset=utf-8\" />
|
|
<title></title>
|
|
<style>
|
|
BODY {
|
|
font-family:宋体;FONT-SIZE:12px;margin:4px;padding:0px;
|
|
}
|
|
a,a:link,a:visited,a:active {
|
|
text-decoration:none;COLOR: #0000ff;
|
|
}
|
|
a:hover {
|
|
TEXT-DECORATION: underline;COLOR: #aaaa9f;
|
|
}
|
|
body,input,td,select,div,li,ul,textarea,form {
|
|
font-family:宋体;FONT-SIZE:12px;
|
|
}
|
|
table.border td {border-bottom:1px solid #000000;border-left:1px solid #000000;}
|
|
.xj{background-color:#f0f0f0;font-weight:bold;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
";
|
|
$m_client=$msg_login1;
|
|
$zbTmp=get_db_msg("select sum(zb) zb from web_client_brand where cid='".$m_client['id']."'");
|
|
$p_title=$m_client["title"]."(".$m_client["username"].") ";
|
|
//------------订单明细
|
|
$sys_client_title=get_set("sys_client_title");
|
|
$dl_id=get_dl_id($m_client["path"]);
|
|
$dl_title=get_db_msg("select title from ".$table_pre."client where id='".$dl_id."'");
|
|
$title_dl=$$dl_title["title"]?$dl_title["title"]."-":"";
|
|
if($title_exp)
|
|
$title_exp=",不含".substr($title_exp,0,-1);
|
|
$html.="<div id=\"print2\"><table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">";
|
|
$html.="<tr><td><div align=\"center\" style=\"font-size:20px;line-height:30px;\">".$sys_client_title."</div><div align=\"center\" style=\"font-size:15px;\">".$title_dl.substr($p_title,0,-1).$title_exp."明细单 ".date("Y年m月d日 H点i分")."</div>";
|
|
|
|
$arr_zd=array("brand"=>get_cate_title_no("arr_select","brand"),"no"=>"款号","bc"=>get_cate_title_no("arr_select","bc"),"category"=>get_cate_title_no("arr_select","category"),"category1"=>get_cate_title_no("arr_select","category1"));
|
|
|
|
//-------------------处理尺码表头
|
|
//取得合并尺码
|
|
$arr_size_merged=get_size_merged();
|
|
$num_size_total=count($arr_size_merged);
|
|
//取得尺码合计sql
|
|
$sql_sum_num="";
|
|
for($k=0;$k<$num_size_total;$k++){
|
|
$sql_sum_num.="sum(num_".$arr_size_merged[$k].") 'num_".$arr_size_merged[$k]."',";
|
|
}
|
|
//取得尺码表头内容
|
|
$num_size_group=0;
|
|
$size_tr=array();
|
|
$r1=$db->query("select * from ".$table_pre."keyword where cate='size' order by ord");
|
|
while($m1=$db->fetch_array($r1)){
|
|
$size_tr[$num_size_group]="";
|
|
for($i=1;$i<=$num_size_total;$i++){
|
|
$tmp=get_db_msg("select title from ".$table_pre."size where iid='".$m1["id"]."' and no='".$i."'");
|
|
$t=$tmp["title"]?$tmp["title"]:" ";
|
|
$size_tr[$num_size_group].="<td width='30'>".$t."</td>";
|
|
}
|
|
$arr_size_merged[]=$m1["no"];
|
|
$num_size_group++;
|
|
}
|
|
//-------------------/处理尺码表头结束
|
|
|
|
$tb="";
|
|
$tb.="<table lay-filter='layui_table' cellspacing='0' cellpadding='0' border='1' width='100%' class='layui-table'><thead><tr>";
|
|
foreach($arr_zd as $k1 => $v1){
|
|
$tb.="<td rowspan='".$num_size_group."'>".$v1."</td>";
|
|
}
|
|
$tb.="<td rowspan='".$num_size_group."'>颜色</td>".$size_tr[0];
|
|
$tb.="<td rowspan='".$num_size_group."'>小计</td>";
|
|
$tb.="<td rowspan='".$num_size_group."'>吊牌价</td>";
|
|
$tb.="<td rowspan='".$num_size_group."'>吊牌总额</td>";
|
|
for($i=1;$i<$num_size_group;$i++){
|
|
$tb.="<tr>".$size_tr[$i]."</tr>";
|
|
}
|
|
$tb.="</thead><tbody>";
|
|
$q="select iid,no from ".$table_pre."order where _key='".$s_key."' and ka<>'y'".$con_path." group by no order by brand,bc,no";
|
|
//echo $q."<br>";
|
|
$r=$db->query($q);
|
|
$total_num=$total_money=$total_money_zk=0;
|
|
$count=0;
|
|
$arr_kh=$arr_kh_color=array();
|
|
$arr_tmp=array();
|
|
while($m=$db->fetch_array($r)){
|
|
$bg=($count%2)?"#f0f0f0":"#ffffff";
|
|
$m1=get_db_msg("select * from ".$table_pre."kh where id='".$m["iid"]."'");
|
|
$price_zk=get_price_zk($m1["id"],$m_client["id"]);
|
|
//取得颜色,杯型
|
|
$q2="select color,bx,".get_size_sql("sum1")." from ".$table_pre."order where _key='".$s_key."' and ka<>'y' ".$con_path." and no='".$m["no"]."' group by no,color order by color,bx";
|
|
//echo $q2."<br>";
|
|
$r2=$db->query($q2);
|
|
//
|
|
$j=0;
|
|
$je1=$num1=0;
|
|
while($m2=$db->fetch_array($r2)){
|
|
$td_size1="";
|
|
$num_color_hj=0;
|
|
$xj_num=0;
|
|
for($k=0;$k<$num_size_total;$k++){
|
|
$ck_md=check_md($m1["no"],$m2["color"],$m2["bx"],$arr_size_merged[$k]);
|
|
if($s_md=="n"){
|
|
if($ck_md!="n"){
|
|
$tmp_num=0;
|
|
}else{
|
|
$tmp_num=$m2["num_".$arr_size_merged[$k]];
|
|
}
|
|
}else{
|
|
$tmp_num=$m2["num_".$arr_size_merged[$k]];
|
|
}
|
|
if($ck_md!="n"){
|
|
$price_zk1=$ck_md>0?$ck_md:$price_zk;
|
|
$sty1="#999900";
|
|
}else{
|
|
$sty1=$bg;
|
|
$price_zk1=$price_zk;
|
|
}
|
|
if($s_md=="n")
|
|
$sty1=$bg;
|
|
$je1+=$tmp_num*$price_zk1;
|
|
$num1+=$tmp_num;
|
|
$num_color_hj+=$tmp_num;
|
|
//计算尺码合计
|
|
$v11="hj_num_".$k;
|
|
$$v11+=$tmp_num;
|
|
$xj_num+=$tmp_num;
|
|
//
|
|
$td_size1.="<td bgcolor='".$sty1."' align='center'>".deel_td(deel_0($tmp_num))."</td>";
|
|
}
|
|
if($num_color_hj>0){
|
|
$arr_tmp[$m["no"]]=$num_color_hj;
|
|
$arr_kh_color[$count][$j]="<td bgcolor='".$bg."' align='center'>".$m2["color"]."-".get_cate_title_no("color",$m2["color"])."</td>";
|
|
if($bx_sizegroup_id>0)
|
|
$arr_kh_color[$count][$j].="<td bgcolor='".$bg."' align='center'>".deel_td($m2["bx"])."</td>";
|
|
$arr_kh_color[$count][$j].=$td_size1;
|
|
//小计
|
|
$arr_kh_color[$count][$j].="<td bgcolor='".$bg."' align='center'>".$xj_num."</td>";
|
|
$arr_kh_color[$count][$j].="<td bgcolor='".$bg."' align='center'>".$m1["price"]."</td>";
|
|
$arr_kh_color[$count][$j].="<td bgcolor='".$bg."' align='center'>".$xj_num*$m1["price"]."</td>";
|
|
if($is_show_je=="y"){
|
|
//吊牌金额小计
|
|
#$arr_kh_color[$count][$j].="<td bgcolor='".$bg."' align='center'>".$xj_num*$m1["price"]."</td>";
|
|
//结算金额小计
|
|
#if(trim($zk_type) || $check_md["num"]>0)
|
|
#$arr_kh_color[$count][$j].="<td bgcolor='".$bg."' align='center'>".$xj_num*$price_zk1."</td>";
|
|
}
|
|
$j++;
|
|
}
|
|
}
|
|
$total_num+=$num1;
|
|
$total_money+=$num1*$m1["price"];
|
|
$total_money_zk+=$je1;
|
|
//
|
|
if($num1>0){
|
|
$arr_kh[$count]["id"]=$m1["id"];
|
|
$arr_kh[$count]["no"]=$m1["no"];
|
|
$xh=get_kh_xh($m1);
|
|
$xh=$xh>0?$xh."#":"";
|
|
$arr_kh[$count]["xh"]=$xh;
|
|
$arr_kh[$count]["title"]=$m1["title"];
|
|
$arr_kh[$count]["series"]=get_cate_title_no("series",$m1["series"]);
|
|
$arr_kh[$count]["brand"]=get_cate_title_no("brand",$m1["brand"]);
|
|
$arr_kh[$count]["season"]=get_cate_title_no("season",$m1["season"]);
|
|
$arr_kh[$count]["bc"]=get_cate_title_no("bc",$m1["bc"]);
|
|
$arr_kh[$count]["category"]=get_cate_title_no("category",$m1["category"]);
|
|
$arr_kh[$count]["category1"]=get_cate_title_no("category1",$m1["category1"]);
|
|
$arr_kh[$count]["num"]=$num1;
|
|
$arr_kh[$count]["price"]=$m1["price"];
|
|
$arr_kh[$count]["je"]=$je1;
|
|
$count++;
|
|
}
|
|
}
|
|
//组合输出内容
|
|
$count=0;
|
|
for($i=0;$i<count($arr_kh);$i++){
|
|
$bg=($i%2)?"#f0f0f0":"#ffffff";
|
|
$num1=count($arr_kh_color[$i]);
|
|
for($j=0;$j<$num1;$j++){
|
|
$tmp_zd="";
|
|
foreach($arr_zd as $k1 => $v1){
|
|
$tmp_zd.="<td bgcolor='".$bg."' align='center'>".deel_td($arr_kh[$i][$k1])."</td>";
|
|
}
|
|
$tb.="<tr height='18'>".$tmp_zd.$arr_kh_color[$i][$j];
|
|
$tb.="</tr>";
|
|
$count++;
|
|
}
|
|
}
|
|
$td_size1="";
|
|
for($k=0;$k<$num_size_total;$k++){
|
|
$v1="hj_num_".$k;
|
|
$td_size1.="<td bgcolor='#f0f0f0' align='center'>".deel_td($$v1)."</td>";
|
|
}
|
|
if($bx_sizegroup_id>0){
|
|
$colspan1=count($arr_zd)+2;
|
|
$colspan_all=count($arr_zd)+3;
|
|
}else{
|
|
$colspan1=count($arr_zd)+1;
|
|
$colspan_all=count($arr_zd)+2;
|
|
}
|
|
$tb.="<tr height='18'><td colspan='".($colspan1)."' align='center' bgcolor='#f0f0f0'>合计</td>".$td_size1."<td bgcolor='#f0f0f0' align='center'>".$total_num."</td><td bgcolor='#f0f0f0' align='center'></td><td bgcolor='#f0f0f0' align='center'>".$total_money."</td></tr>";
|
|
$tb.="</tbody></table>";
|
|
|
|
$html.=$tb;
|
|
$html.="</td></tr>";
|
|
//------------签名
|
|
$html.="<tr><td align='right' width=\"69%\" height='100' style='right-padding:6px;'>
|
|
<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\">
|
|
<tr>
|
|
<td>客户签字</td><td><img src=\"".$png_base64_client."\" height=\"80\"/></td>
|
|
<td>区域经理签字</td><td><img src=\"".$png_base64_qj."\" height=\"80\"/></td>
|
|
<td>商品经理签字</td><td><img src=\"".$png_base64_sp."\" height=\"80\"/></td>
|
|
</tr>
|
|
</table>
|
|
</td></tr>";
|
|
$html.="</table></div></body></html>";
|
|
//建立目录结构
|
|
$str_files="";
|
|
$dir="";
|
|
$arr_path=explode("-",$msg_login1["path"]);
|
|
for($j=0;$j<count($arr_path);$j++){
|
|
if($arr_path[$j]>0){
|
|
$m1=get_db_msg("select username,title from ".$table_pre."client where id='".$arr_path[$j]."'");
|
|
$dir.="/".$m1["username"];
|
|
make_dir("../admin/debug/sign".$dir);
|
|
}
|
|
}
|
|
$arr_file = scandir("../admin/debug/sign".$dir);
|
|
foreach($arr_file as $v){
|
|
$tmp=explode("_",$v);
|
|
if($msg_login1["username"]==$tmp[0] && count($tmp)>1)
|
|
unlink("../admin/debug/sign".$dir."/".$v);
|
|
if($msg_login1["title"]."(".$msg_login1["username"].")"==$tmp[0] && count($tmp)>1)
|
|
unlink("../admin/debug/sign".$dir."/".$v);
|
|
}
|
|
//------------写入
|
|
//中文名文件
|
|
$file_name=$msg_login1["title"]."(".$msg_login1["username"].")_".date("Y-m-d-H-i-s").".html";
|
|
$file_name=iconv("utf-8","gb2312",$file_name);
|
|
$file_state=file_put_contents("../admin/debug/sign".$dir."/".$file_name,$html);
|
|
//用户名文件
|
|
$file_name_sign=$msg_login1["username"]."_".date("Y-m-d-H-i-s").".html";
|
|
$file_state_sign=file_put_contents("../admin/debug/sign".$dir."/".$file_name_sign,$html);
|
|
$str_filename_sign="sign".$dir."/".$file_name_sign."|";
|
|
//
|
|
$con_str_filename.=$str_filename_sign;
|
|
$con_str_filename=substr($con_str_filename,0,-1);
|
|
//加入客户订单操作日志表
|
|
//var_dump($file_state);
|
|
if($file_state_sign){
|
|
$add_date=date("Y-m-d H:i:s");
|
|
$q1="insert into ".$table_pre."order_state (uid,cid,brand,action,attachments,add_date) values ('".$uid."','".$uid."','".$s_brand."','客户签字','".$con_str_filename."','".$add_date."')";
|
|
$db->query($q1);
|
|
|
|
$check=get_db_msg("select id from ".$table_pre."plugin_print where uid='".$uid."' ");
|
|
if(!$check["id"])
|
|
$q2="insert into ".$table_pre."plugin_print (uid,brand,file_name,ip) values ('".$uid."','".$s_brand."','".$con_str_filename."','".$_SERVER['HTTP_HOST']."')";
|
|
else
|
|
$q2="update ".$table_pre."plugin_print set file_name='".$con_str_filename."',ip='".$_SERVER['HTTP_HOST']."' where uid='".$uid."' ";
|
|
$db->query($q2);
|
|
}
|
|
$json_data.="\"msg\":\"操作成功!\",";
|
|
$json_data.="\"code\":101,";
|
|
$json_data.="\"refresh\":\"y\",";
|
|
$json_data=substr($json_data,0,-1)."}";
|
|
echo $json_data;
|
|
exit;
|
|
break;
|
|
case "jd": //交单
|
|
|
|
//横向维度
|
|
$zd1="brand"; //服配鞋品
|
|
$zd2="gender"; //性别
|
|
$zd3="category"; //大类
|
|
$fp="11"; //Q3
|
|
$xp="12"; //Q4
|
|
//
|
|
for($i=1;$i<4;$i++){
|
|
$v="zd".$i;
|
|
$v1="zd_title".$i;
|
|
$v2="arr_zd".$i;
|
|
//取得对应字段的名称
|
|
$$v1=get_cate_title_no("arr_select",$$v);
|
|
//取得字段的选项值
|
|
$q1="select no,title from ".$table_pre."keyword where cate='".$$v."' order by no";
|
|
$r1=$db->query($q1);
|
|
$arr_tmp=array();
|
|
while($m1=$db->fetch_array($r1)){
|
|
$arr_tmp[$m1["no"]]=$m1["title"];
|
|
}
|
|
$$v2=$arr_tmp;
|
|
}
|
|
|
|
$tb="<table lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' width='100%' class='layui-table'><thead><tr>";
|
|
$tb.="<td rowspan='3'>服配鞋品</td>";
|
|
$tb.="<td colspan='6'>指标完成情况</td>";
|
|
$tb.="</tr><tr>";
|
|
$tb.="";
|
|
$tb.="<td colspan='3'>件数</td>";
|
|
$tb.="<td colspan='3'>吊牌额</td>";
|
|
$tb.="</tr><tr>";
|
|
$tb.="<td>指标</td>";
|
|
$tb.="<td>完成</td>";
|
|
$tb.="<td>完成率</td>";
|
|
$tb.="<td>指标</td>";
|
|
$tb.="<td>完成</td>";
|
|
$tb.="<td>完成率</td>";
|
|
$tb.="</tr></thead><tbody>";
|
|
foreach($arr_zd1 as $n1 => $t1){
|
|
$tb.="<tr>";
|
|
$tb.="<td>".$t1."</td>";
|
|
$tmp_zb=get_db_msg("select * from web_client_brand where cid='".$msg_login1["id"]."' and brand='".$n1."'");
|
|
$tmp_order=get_db_msg("select sum(num) js,sum(je) je from web_order where brand='".$n1."' and ka<>'y'".$con_path);
|
|
$tb.="<td>".$tmp_zb["zb_js"]."</td>";
|
|
$tb.="<td>".$tmp_order["js"]."</td>";
|
|
$tb.="<td>".deel_bfb1($tmp_order["js"],$tmp_zb["zb_js"],1)."</td>";
|
|
$je=keep_float($tmp_order["je"]/10000,2);
|
|
$tb.="<td>".$tmp_zb["zb"]."</td>";
|
|
$tb.="<td>".$je."</td>";
|
|
$tb.="<td>".deel_bfb1($je,$tmp_zb["zb"],1)."</td>";
|
|
|
|
}
|
|
$tb.="</tbody></table><br>";
|
|
|
|
$tb.="<span>Q3服装-性别</span>";
|
|
$tb.="<table lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' width='100%' class='layui-table'><thead><tr>";
|
|
$tb.="<td rowspan='2'>性别</td>";
|
|
$tb.="<td colspan='2'>设计款数</td>";
|
|
$tb.="<td colspan='2'>已订款数</td>";
|
|
$tb.="<td colspan='2'>设计款色数</td>";
|
|
$tb.="<td colspan='2'>已订款色数</td>";
|
|
$tb.="<td colspan='2'>已订件数</td>";
|
|
$tb.="<td colspan='2'>已订吊牌额</td>";
|
|
$tb.="</tr><tr>";
|
|
$tb.="<td>款数</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="<td>款数</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="<td>款色数</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="<td>款色数</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="<td>件数</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="<td>吊牌额</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="</tr></thead><tbody>";
|
|
|
|
$q3="select * from ".$table_pre."kh where ka<>'y' and brand='".$fp."'";
|
|
$r3=$db->query($q3);
|
|
$fp_ks_total=$fp_skc_total=0;
|
|
$arr_xb_ks=$arr_xb_skc=array();
|
|
while($m3=$db->fetch_array($r3)){
|
|
$arr_kh_color=array_diff(explode(",",$m3["color"]),explode(",",$m3["color_ka"]));
|
|
$fp_skc_total+=count($arr_kh_color);
|
|
$fp_ks_total++;
|
|
$arr_xb_ks[$m3[$zd2]]++;
|
|
$arr_xb_skc[$m3[$zd2]]+=count($arr_kh_color);
|
|
}
|
|
$order_total=get_db_msg("select count(distinct no) 'ks',count(distinct no,color) 'skc',sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ka<>'y' and brand='".$fp."'".$con_path);
|
|
|
|
foreach($arr_zd2 as $n2 => $t2){
|
|
$order=get_db_msg("select count(distinct no) 'ks',count(distinct no,color) 'skc',sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ka<>'y' and brand='".$fp."' and ".$zd2."='".$n2."'".$con_path);
|
|
$tb.="<tr>";
|
|
$tb.="<td>".$t2."</td>";
|
|
$tb.="<td>".$arr_xb_ks[$n2]."</td>";
|
|
$tb.="<td>".deel_bfb1($arr_xb_ks[$n2],$fp_ks_total,1)."</td>";
|
|
$tb.="<td>".$order["ks"]."</td>";
|
|
$tb.="<td>".deel_bfb1($order["ks"],$order_total["ks"],1)."</td>";
|
|
$tb.="<td>".$arr_xb_skc[$n2]."</td>";
|
|
$tb.="<td>".deel_bfb1($arr_xb_skc[$n2],$fp_skc_total,1)."</td>";
|
|
$tb.="<td>".$order["skc"]."</td>";
|
|
$tb.="<td>".deel_bfb1($order["skc"],$order_total["skc"],1)."</td>";
|
|
$tb.="<td>".$order["num"]."</td>";
|
|
$tb.="<td>".deel_bfb1($order["num"],$order_total["num"],1)."</td>";
|
|
$tb.="<td>".$order["je"]."</td>";
|
|
$tb.="<td>".deel_bfb1($order["je"],$order_total["je"],1)."</td>";
|
|
$tb.="</tr>";
|
|
}
|
|
$tb.="<tr>";
|
|
$tb.="<td>总计</td>";
|
|
$tb.="<td>".$fp_ks_total."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="<td>".$order_total["ks"]."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="<td>".$fp_skc_total."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="<td>".$order_total["skc"]."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="<td>".$order_total["num"]."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="<td>".$order_total["je"]."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="</tr>";
|
|
$tb.="</tbody></table><br>";
|
|
|
|
$tb.="<span>Q4服装-性别</span>";
|
|
$tb.="<table lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' width='100%' class='layui-table'><thead><tr>";
|
|
$tb.="<td rowspan='2'>性别</td>";
|
|
$tb.="<td colspan='2'>设计款数</td>";
|
|
$tb.="<td colspan='2'>已订款数</td>";
|
|
$tb.="<td colspan='2'>设计款色数</td>";
|
|
$tb.="<td colspan='2'>已订款色数</td>";
|
|
$tb.="<td colspan='2'>已订件数</td>";
|
|
$tb.="<td colspan='2'>已订吊牌额</td>";
|
|
$tb.="</tr><tr>";
|
|
$tb.="<td>款数</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="<td>款数</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="<td>款色数</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="<td>款色数</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="<td>件数</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="<td>吊牌额</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="</tr></thead><tbody>";
|
|
|
|
$q3="select * from ".$table_pre."kh where ka<>'y' and brand='".$xp."'";
|
|
$r3=$db->query($q3);
|
|
$fp_ks_total=$fp_skc_total=0;
|
|
$arr_xb_ks=$arr_xb_skc=array();
|
|
while($m3=$db->fetch_array($r3)){
|
|
$arr_kh_color=array_diff(explode(",",$m3["color"]),explode(",",$m3["color_ka"]));
|
|
$fp_skc_total+=count($arr_kh_color);
|
|
$fp_ks_total++;
|
|
$arr_xb_ks[$m3[$zd2]]++;
|
|
$arr_xb_skc[$m3[$zd2]]+=count($arr_kh_color);
|
|
}
|
|
$order_total=get_db_msg("select count(distinct no) 'ks',count(distinct no,color) 'skc',sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ka<>'y' and brand='".$xp."'".$con_path);
|
|
|
|
foreach($arr_zd2 as $n2 => $t2){
|
|
$order=get_db_msg("select count(distinct no) 'ks',count(distinct no,color) 'skc',sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ka<>'y' and brand='".$xp."' and ".$zd2."='".$n2."'".$con_path);
|
|
$tb.="<tr>";
|
|
$tb.="<td>".$t2."</td>";
|
|
$tb.="<td>".$arr_xb_ks[$n2]."</td>";
|
|
$tb.="<td>".deel_bfb1($arr_xb_ks[$n2],$fp_ks_total,1)."</td>";
|
|
$tb.="<td>".$order["ks"]."</td>";
|
|
$tb.="<td>".deel_bfb1($order["ks"],$order_total["ks"],1)."</td>";
|
|
$tb.="<td>".$arr_xb_skc[$n2]."</td>";
|
|
$tb.="<td>".deel_bfb1($arr_xb_skc[$n2],$fp_skc_total,1)."</td>";
|
|
$tb.="<td>".$order["skc"]."</td>";
|
|
$tb.="<td>".deel_bfb1($order["skc"],$order_total["skc"],1)."</td>";
|
|
$tb.="<td>".$order["num"]."</td>";
|
|
$tb.="<td>".deel_bfb1($order["num"],$order_total["num"],1)."</td>";
|
|
$tb.="<td>".$order["je"]."</td>";
|
|
$tb.="<td>".deel_bfb1($order["je"],$order_total["je"],1)."</td>";
|
|
$tb.="</tr>";
|
|
}
|
|
$tb.="<tr>";
|
|
$tb.="<td>总计</td>";
|
|
$tb.="<td>".$fp_ks_total."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="<td>".$order_total["ks"]."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="<td>".$fp_skc_total."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="<td>".$order_total["skc"]."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="<td>".$order_total["num"]."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="<td>".$order_total["je"]."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="</tr>";
|
|
$tb.="</tbody></table><br>";
|
|
|
|
$tb.="<span>Q3服装-大类</span>";
|
|
$tb.="<table lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' width='100%' class='layui-table'><thead><tr>";
|
|
$tb.="<td rowspan='2'>大类</td>";
|
|
$tb.="<td colspan='2'>设计款数</td>";
|
|
$tb.="<td colspan='2'>已订款数</td>";
|
|
$tb.="<td colspan='2'>设计款色数</td>";
|
|
$tb.="<td colspan='2'>已订款色数</td>";
|
|
$tb.="<td colspan='2'>已订件数</td>";
|
|
$tb.="<td colspan='2'>已订吊牌额</td>";
|
|
$tb.="</tr><tr>";
|
|
$tb.="<td>款数</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="<td>款数</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="<td>款色数</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="<td>款色数</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="<td>件数</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="<td>吊牌额</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="</tr></thead><tbody>";
|
|
|
|
$q3="select * from ".$table_pre."kh where ka<>'y' and brand='".$fp."'";
|
|
$r3=$db->query($q3);
|
|
$fp_ks_total=$fp_skc_total=0;
|
|
$arr_xb_ks=$arr_xb_skc=array();
|
|
while($m3=$db->fetch_array($r3)){
|
|
$arr_kh_color=array_diff(explode(",",$m3["color"]),explode(",",$m3["color_ka"]));
|
|
$fp_skc_total+=count($arr_kh_color);
|
|
$fp_ks_total++;
|
|
$arr_xb_ks[$m3[$zd3]]++;
|
|
$arr_xb_skc[$m3[$zd3]]+=count($arr_kh_color);
|
|
}
|
|
$order_total=get_db_msg("select count(distinct no) 'ks',count(distinct no,color) 'skc',sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ka<>'y' and brand='".$fp."'".$con_path);
|
|
|
|
foreach($arr_zd3 as $n2 => $t2){
|
|
$order=get_db_msg("select count(distinct no) 'ks',count(distinct no,color) 'skc',sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ka<>'y' and brand='".$fp."' and ".$zd2."='".$n2."'".$con_path);
|
|
$tb.="<tr>";
|
|
$tb.="<td>".$t2."</td>";
|
|
$tb.="<td>".$arr_xb_ks[$n2]."</td>";
|
|
$tb.="<td>".deel_bfb1($arr_xb_ks[$n2],$fp_ks_total,1)."</td>";
|
|
$tb.="<td>".$order["ks"]."</td>";
|
|
$tb.="<td>".deel_bfb1($order["ks"],$order_total["ks"],1)."</td>";
|
|
$tb.="<td>".$arr_xb_skc[$n2]."</td>";
|
|
$tb.="<td>".deel_bfb1($arr_xb_skc[$n2],$fp_skc_total,1)."</td>";
|
|
$tb.="<td>".$order["skc"]."</td>";
|
|
$tb.="<td>".deel_bfb1($order["skc"],$order_total["skc"],1)."</td>";
|
|
$tb.="<td>".$order["num"]."</td>";
|
|
$tb.="<td>".deel_bfb1($order["num"],$order_total["num"],1)."</td>";
|
|
$tb.="<td>".$order["je"]."</td>";
|
|
$tb.="<td>".deel_bfb1($order["je"],$order_total["je"],1)."</td>";
|
|
$tb.="</tr>";
|
|
}
|
|
$tb.="<tr>";
|
|
$tb.="<td>总计</td>";
|
|
$tb.="<td>".$fp_ks_total."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="<td>".$order_total["ks"]."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="<td>".$fp_skc_total."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="<td>".$order_total["skc"]."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="<td>".$order_total["num"]."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="<td>".$order_total["je"]."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="</tr>";
|
|
$tb.="</tbody></table><br>";
|
|
|
|
$tb.="<span>Q4服装-大类</span>";
|
|
$tb.="<table lay-filter='layui_table' cellspacing='0' cellpadding='0' border='0' width='100%' class='layui-table'><thead><tr>";
|
|
$tb.="<td rowspan='2'>大类</td>";
|
|
$tb.="<td colspan='2'>设计款数</td>";
|
|
$tb.="<td colspan='2'>已订款数</td>";
|
|
$tb.="<td colspan='2'>设计款色数</td>";
|
|
$tb.="<td colspan='2'>已订款色数</td>";
|
|
$tb.="<td colspan='2'>已订件数</td>";
|
|
$tb.="<td colspan='2'>已订吊牌额</td>";
|
|
$tb.="</tr><tr>";
|
|
$tb.="<td>款数</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="<td>款数</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="<td>款色数</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="<td>款色数</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="<td>件数</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="<td>吊牌额</td>";
|
|
$tb.="<td>占比</td>";
|
|
$tb.="</tr></thead><tbody>";
|
|
|
|
$q3="select * from ".$table_pre."kh where ka<>'y' and brand='".$xp."'";
|
|
$r3=$db->query($q3);
|
|
$fp_ks_total=$fp_skc_total=0;
|
|
$arr_xb_ks=$arr_xb_skc=array();
|
|
while($m3=$db->fetch_array($r3)){
|
|
$arr_kh_color=array_diff(explode(",",$m3["color"]),explode(",",$m3["color_ka"]));
|
|
$fp_skc_total+=count($arr_kh_color);
|
|
$fp_ks_total++;
|
|
$arr_xb_ks[$m3[$zd3]]++;
|
|
$arr_xb_skc[$m3[$zd3]]+=count($arr_kh_color);
|
|
}
|
|
$order_total=get_db_msg("select count(distinct no) 'ks',count(distinct no,color) 'skc',sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ka<>'y' and brand='".$xp."'".$con_path);
|
|
|
|
foreach($arr_zd3 as $n2 => $t2){
|
|
$order=get_db_msg("select count(distinct no) 'ks',count(distinct no,color) 'skc',sum(num) 'num',sum(je) 'je' from ".$table_pre."order where ka<>'y' and brand='".$xp."' and ".$zd2."='".$n2."'".$con_path);
|
|
$tb.="<tr>";
|
|
$tb.="<td>".$t2."</td>";
|
|
$tb.="<td>".$arr_xb_ks[$n2]."</td>";
|
|
$tb.="<td>".deel_bfb1($arr_xb_ks[$n2],$fp_ks_total,1)."</td>";
|
|
$tb.="<td>".$order["ks"]."</td>";
|
|
$tb.="<td>".deel_bfb1($order["ks"],$order_total["ks"],1)."</td>";
|
|
$tb.="<td>".$arr_xb_skc[$n2]."</td>";
|
|
$tb.="<td>".deel_bfb1($arr_xb_skc[$n2],$fp_skc_total,1)."</td>";
|
|
$tb.="<td>".$order["skc"]."</td>";
|
|
$tb.="<td>".deel_bfb1($order["skc"],$order_total["skc"],1)."</td>";
|
|
$tb.="<td>".$order["num"]."</td>";
|
|
$tb.="<td>".deel_bfb1($order["num"],$order_total["num"],1)."</td>";
|
|
$tb.="<td>".$order["je"]."</td>";
|
|
$tb.="<td>".deel_bfb1($order["je"],$order_total["je"],1)."</td>";
|
|
$tb.="</tr>";
|
|
}
|
|
$tb.="<tr>";
|
|
$tb.="<td>总计</td>";
|
|
$tb.="<td>".$fp_ks_total."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="<td>".$order_total["ks"]."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="<td>".$fp_skc_total."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="<td>".$order_total["skc"]."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="<td>".$order_total["num"]."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="<td>".$order_total["je"]."</td>";
|
|
$tb.="<td>100%</td>";
|
|
$tb.="</tr>";
|
|
$tb.="</tbody></table><br>";
|
|
$json_data.="\"tb\":\"".$tb."\",";
|
|
break;
|
|
case "jd_do": //交单
|
|
if($is_brand=="y"){
|
|
$msg=check_dhgz_client($uid);
|
|
if($msg!="y"){
|
|
$json_data.="\"code\":0,\"msg\":\"".$msg."\",";
|
|
}else{
|
|
$con_brand="";
|
|
if($s_brand){
|
|
$arr_s_brand=explode(",",$s_brand);
|
|
for($i=0;$i<count($arr_s_brand);$i++){
|
|
$con_brand.="brand='".$arr_s_brand[$i]."' or ";
|
|
}
|
|
if($con_brand)
|
|
$con_brand=" and (".substr($con_brand,0,-3).")";
|
|
}
|
|
$q="update ".$table_pre."client_brand set is_jd='y' where cid='".$uid."'".$con_brand;
|
|
$db->query($q);
|
|
$url=$_SERVER["PHP_SELF"]."?_m=".$_m."&_a=o&s_tab=wcl";
|
|
//记录订单操作日志
|
|
update_order_state($uid,$uid,"交单","");
|
|
$json_data.="\"msg\":\"订单提交成功,请等待客户经理确认!\",";
|
|
$json_data.="\"code\":101,";
|
|
}
|
|
}else{
|
|
//检查订货规则
|
|
$msg=check_dhgz_client($uid);
|
|
if($msg!="y"){
|
|
$json_data.="\"code\":0,\"msg\":\"".$msg."\",";
|
|
}else{
|
|
$q="update ".$table_pre."client set is_jd='y' where id='".$uid."'";
|
|
$db->query($q);
|
|
$url=$_SERVER[PHP_SELF]."?_m=".$_m.$link_var_brand;
|
|
//记录订单操作日志
|
|
update_order_state($uid,$uid,"交单","");
|
|
$json_data.="\"msg\":\"订单提交成功,请等待客户经理确认!\",";
|
|
$json_data.="\"code\":101,";
|
|
}
|
|
//alert_and_redirect("订单提交成功,请等待客户经理确认!",$url);
|
|
}
|
|
$json_data.="\"refresh\":\"y\",";
|
|
$json_data=substr($json_data,0,-1)."}";
|
|
echo $json_data;
|
|
exit;
|
|
break;
|
|
}
|
|
$json_data.="\"code\":100,";
|
|
$json_data=substr($json_data,0,-1)."}";
|
|
echo $json_data;
|
|
?>
|