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

464 lines
16 KiB
PHP

<?php
//-------------------------------------------------------客户端,订单明细
//有款型的版本定制
$s_order=$s_order?$s_order:"date";
$detail_size_ms=get_set("detail_size_ms");
//订货会标记选项
$tmp_order_flag="";
foreach($arr_sys_order_flag as $k => $v){
$tmp_order_flag.="{\"no\":\"".$k."\",\"title\":\"".$v."\"},";
}
$con_f=$con_f1=$con_f2="";
if(count($arr_sys_order_flag)>1){
$tmp_order_flag.="{\"no\":\"all\",\"title\":\"所有订单\"},";
$json_data.="\"show_key\":\"y\",";
$tmp_order_flag=deel_end($tmp_order_flag);
if($s_key){
$selectf=$s_key;
}else{
$selectf=$_key;
}
$str_json="\"select_order_flag\":{\"no\":\"s_key\",\"title\":\"订货会标记\",\"value\":\"".$selectf."\",\"op\":[".$tmp_order_flag."]},";
$json_data.=$str_json;
if($s_key){
if($s_key=="all"){
$con_f=$con_f1=$con_f2="";
}else{
$con_f=" and _key='".$s_key."'";
$con_f1=" and a._key='".$s_key."'";
$con_f2=" and b._key='".$s_key."'";
}
}
}
//-------------------处理尺码表头
//取得合并尺码
$arr_size_merged=get_size_merged();
$num_size_total=count($arr_size_merged);
//结算金额相关
$check_md=get_db_msg("select count(*) 'num' from ".$table_pre."kh_md");
$zk_type=get_set("zk_type");
//取得尺码合计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"]:"&nbsp;";
$size_tr[$num_size_group].="{\"zd\":\"num_".$i."\",\"title\":\"".$t."\",\"is_size\":\"y\"},";
}
$arr_size_merged[]=$m1["no"];
$num_size_group++;
}
//-------------------/处理尺码表头结束
$i1=0;
//买断款过滤
if($check_md["num"]>0){
$search_select_no[$i1]="s_md";
$search_select_op[$i1]=array(""=>"包含买断款","n"=>"非买断款");
$i1++;
}
//----------------------------------------------取得订单记录
//----表头
$content_tbody=$content_tbody_color=$id_tbody=$idcolor_tbody=array();
$thead_str="";
$thead_str.="{\"zd\":\"cx\",\"title\":\"次序\",\"is_size\":\"n\"},";
$thead_str.="{\"zd\":\"cx\",\"title\":\"款号\",\"is_size\":\"n\"},";
for($i=0;$i<count($sys_detail_show_select);$i++){
$thead_str.="{\"zd\":\"cx".$i."\",\"title\":\"".get_cate_title_no("arr_select",$sys_detail_show_select[$i])."\",\"is_size\":\"n\"},";
}
$thead_str.="{\"zd\":\"color\",\"title\":\"颜色\",\"is_size\":\"n\"},";
if($is_gg=="y"){
$thead_str.="{\"zd\":\"kx\",\"title\":\"".d_translate("gg")."\",\"is_size\":\"n\"},";
$thead_str.="{\"zd\":\"kx\",\"title\":\"".get_main_value($sys_gg_zd,"price")."\",\"is_size\":\"n\"},";
}else if($is_gg=="b"){
$thead_str.="{\"zd\":\"kx\",\"title\":\"".d_translate("gg")."\",\"is_size\":\"n\"},";
}
$thead_str.=$size_tr[0];
//$thead_str.="{\"zd\":\"kx\",\"title\":\"款型小计\",\"is_size\":\"n\"},";
$thead_str.="{\"zd\":\"kx\",\"title\":\"箱数\",\"is_size\":\"n\"},";
$thead_str.="{\"zd\":\"kx\",\"title\":\"双数\",\"is_size\":\"n\"},";
$thead_str.="{\"zd\":\"kx\",\"title\":\"合计\",\"is_size\":\"n\"},";
$thead_str.="{\"zd\":\"kx\",\"title\":\"吊牌金额\",\"is_size\":\"n\"}";
if(trim($zk_type) || $check_md["num"]>0){
$thead_str.=",{\"zd\":\"kx\",\"title\":\"结算金额\",\"is_size\":\"n\"}";
}
$thead_str2="\"0\":[".$thead_str."],";
for($i=1;$i<$num_size_group;$i++){
$thead_str2.="\"".$i."\":[".substr($size_tr[$i],0,-1)."],";
}
$json_data.="\"thead_str\":{".substr($thead_str2,0,-1)."},";
$json_data.="\"thead_str_group\":\"".$num_size_group."\",";
//----表头完成$con_order="";
if($s_order=="date"){
$con_order=" add_date desc";
}else if($s_order=="num"){
$con_order=" num desc,no";
}else if($s_order=="je"){
$con_order=" je desc,no";
}else if($s_order=="no"){
$con_order=" no";
}
$q="select iid,no,sum(num) 'num',sum(num) 'num1',sum(je) 'je',price from ".$table_pre."order where id>0".$con.$con_f." group by iid order by ".$con_order;
//echo $q."<br>";
$r=$db->query($q);
$total_num=$total_xs=$total_je=$total_jsje=0;
$i1=0;
$arr_kh=$arr_color=$arr_bx=$arr_pm=$arr_size_td=array();
$arr_xj_kh=$arr_xj_color=array();
while($m=$db->fetch_array($r)){
$m1=get_db_msg("select * from ".$table_pre."kh where id='".$m["iid"]."'");
$msg_size_group=get_db_msg("select title from ".$table_pre."keyword where cate='size' and id='".$m1["size_group"]."'");
/*if(in_array($msg_size_group["title"],$sys_size_group_xz)){
$is_xd_clothes="n";
}else{
$is_xd_clothes="y";
}*/
$arr_kh_size=explode(",",$m1["size"]);
$arr_kh[$i1]=$m["iid"];
$bg=($i1%2)?"td1":"td2";
//取得颜色
$q2="select iid,color from ".$table_pre."order where id>0".$con.$con_f." and iid='".$m["iid"]."' group by color";
//echo $q2."<br>";
$r2=$db->query($q2);
//
$i2=0;
$xj_je_kh=$xj_jsje_kh=$xj_num_kh=$xj_xs_kh=0;
while($m2=$db->fetch_array($r2)){
$arr_color[$m["iid"]][$i2]=$m2["color"];
//取得杯型订单
$q3="select * from ".$table_pre."order where id>0".$con.$con_f." and iid='".$m["iid"]."' and color='".$m2["color"]."' order by bx";
//echo $q3."<br>";
$r3=$db->query($q3);
$i3=0;
$xj_je_color=$xj_jsje_color=$xj_num_color=0;
while($m3=$db->fetch_array($r3)){
$arr_td_size_tmp=array();
if($sys_ver_hy=="xz"){
$q4="select * from ".$table_pre."order_pm where uid='".$m3["uid"]."' and iid='".$m3["iid"]."' and color='".$m3["color"]."' and bx='".$m3["bx"]."'";
//echo $q4."<br>";
$r4=$db->query($q4);
$xj_num=0;
$i4=0;
$num1=$xs1=0;
while($m4=$db->fetch_array($r4)){
//echo $q4."<br>";
$m_pm=get_db_msg("select * from ".$table_pre."size_pm where id='".$m4["pmid"]."'");
$arr_pm2=explode(":",$m_pm["gz"]);
$arr_pm1=tz_pm($arr_kh_size,$arr_pm2);
$pm_xj_num=0;
for($k=1;$k<=$num_size_total;$k++){
$v1="hj_num_".$k;
$tmp_num=$arr_pm1[$k];
$$v1+=$tmp_num;
if($tmp_num>0){
$arr_td_size_tmp[$k]=$tmp1."|".deel_0($tmp_num);
}else{
$arr_td_size_tmp[$k]=$tmp1."| ";
}
$xj_num+=$tmp_num;
$pm_xj_num+=$tmp_num;
}
if($pm_xj_num>0){
//echo $m4["pmid"];
$xs1+=$m4["xs"];
$num1+=$m4["xs"]*$m_pm["num"];
$arr_td_size_tmp[$k]="|".deel_0($m4["xs"]);
$arr_td_size_tmp[$k+1]="|".deel_0($m4["xs"]*$m_pm["num"]);
$arr_size_td[$m["iid"]][$m2["color"]][$m3["bx"]][$i4]=$arr_td_size_tmp;
$arr_pm[$m3["iid"]][$m3["color"]][$m3["bx"]][$i4]=$m4["pmid"];
$i4++;
}
}
if($num1>0){
//杯型小计
//$arr_td_size_tmp[$k]="|".deel_0($xj_num);
$xj_je=$m3["je"];
$xj_jsje=$m3["jsje"];
$xj_num_color+=$num1;
$xj_je_color+=$m3["je"];
$xj_jsje_color+=$m3["jsje"];
$xj_xs_kh+=$xs1;
$xj_num_kh+=$num1;
$xj_je_kh+=$m3["je"];
$xj_jsje_kh+=$m3["jsje"];
$total_num+=$num1;
$total_xs+=$xs1;
$total_je+=$m3["je"];
$total_jsje+=$m3["jsje"];
$arr_bx[$m["iid"]][$m2["color"]][$i3]=$m3["bx"];
//$arr_size_td[$m["iid"]][$m2["color"]][$i3]=$arr_td_size_tmp;
$i3++;
}
}
}//m3结束
if($xj_jsje_color>0)
$xj_jsje_color=deel_num(keep_float($xj_jsje_color,2));
$arr_xj_color[$m["iid"]][$i2]=array($xj_num_color,$xj_je_color,$xj_jsje_color);
$i2++;
}//m2结束
if($xj_jsje_kh>0)
$xj_jsje_kh=deel_num(keep_float($xj_jsje_kh,2));
$arr_xj_kh[$i1]=array($xj_num_kh,$xj_je_kh,$xj_jsje_kh);
$i1++;
}//m结束
//print_r($arr_size_td);
//计算rowspan值
$arr_rowspan_kh=$arr_rowspan_color=$arr_rowspan_bx=array();
if($sys_ver_hy=="xz"){
$k=$j=0;
for($i1=0;$i1<count($arr_kh);$i1++){
$this_kh=$arr_kh[$i1];
$s1=count($arr_color[$this_kh]);
$tmp_kh_rowspan=0;
for($i2=0;$i2<$s1;$i2++){
$this_color=$arr_color[$this_kh][$i2];
$s2=count($arr_bx[$this_kh][$this_color]);
$tmp_color_rowspan=0;
for($i3=0;$i3<$s2;$i3++){
$this_bx=$arr_bx[$this_kh][$this_color][$i3];
$s3=count($arr_pm[$this_kh][$this_color][$this_bx]);
$tmp_bx_rowspan=0;
for($i4=0;$i4<$s3;$i4++){
$tmp_kh_rowspan++;
$tmp_color_rowspan++;
$tmp_bx_rowspan++;
}
$arr_rowspan_bx[$j]=$tmp_bx_rowspan;
$j++;
}
$arr_rowspan_color[$k]=$tmp_color_rowspan;
$k++;
}
$arr_rowspan_kh[$i1]=$tmp_kh_rowspan;
}
}
//print_r($arr_pm);
/*
print_r($arr_rowspan_kh);
echo "<br>";
print_r($arr_rowspan_color);
echo "<Br>";
*/
//组合输出内容
$k=$k2=$k3=0;
for($i1=0;$i1<count($arr_kh);$i1++){
$this_kh=$arr_kh[$i1];
$bg=($i1%2)?"td1":"td2";
//计算款号合并行数
$s1=count($arr_color[$this_kh]);
$rowspan_kh=$arr_rowspan_kh[$i1]>1?"rs:".$arr_rowspan_kh[$i1]."":"rs:1";
//取得款号表数据
$m_kh=get_db_msg("select * from ".$table_pre."kh where id='".$this_kh."'");
if($_m=="main_4"){
//
}else{
//取得预览图片
//取得弹出层内容
$arr_color1=explode(",",$m_kh["color"]);
$num2=count($arr_color1);
for($j=0;$j<$num2;$j++){
if($num2==1){
$pic_big=get_kh_picture($m_kh["no"],$m_kh["main_pic"],$m_kh["color"]);
}else{
$pic_big=get_kh_color_picture($m_kh["no"],$arr_color1[$j]);
}
}
$pich=get_good_pic_height($pic_big,100,100);
$pic_yl=$pic_big."——".$pich;
}
for($i2=0;$i2<$s1;$i2++){
//计算颜色合并行数
$this_color=$arr_color[$this_kh][$i2];
$s2=count($arr_bx[$this_kh][$this_color]);
$rowspan_color=$arr_rowspan_color[$k2]>1?"rs:".$arr_rowspan_color[$k2]."":"";
for($i3=0;$i3<$s2;$i3++){
if($sys_ver_hy=="xz"){
$this_bx=$arr_bx[$this_kh][$this_color][$i3];
$s3=count($arr_pm[$this_kh][$this_color][$this_bx]);
//echo $s3;
$rowspan_bx=$arr_rowspan_bx[$k3]>1?"rs:".$arr_rowspan_bx[$k3]."":"";
for($i4=0;$i4<$s3;$i4++){
//echo "a";
$content_tbody[$k]="";
$content_tbody_color[$k]="";
$idcolor_tbody[$k]="";
$id_tbody[$k]="";
if($k==count_arr_num_before($arr_rowspan_kh,$i1)){
//次序
$content_tbody[$k].="\"".$rowspan_kh."|".($i1+1)."\",";
$content_tbody_color[$k]="\"".$bg."\",";
$id_tbody[$k]="\"".$m_kh["id"]."\",";
$idcolor_tbody[$k]="\"".$this_color."\",";
//圆牌号
//$content_tbody[$k].="\"".$rowspan_kh." c:".$bg."|".get_kh_xh($m_kh)."\",";
//款号
/*if($face=="4"){
//直接跳转订货
$act1=$pic_yl."tzyl";
}else{
//显示图片预览
$act1=$pic_yl."yulan";
}*/
$act1=$pic_yl."tzyl";
$content_tbody[$k].="\"".$rowspan_kh."|".$act1.$m_kh["no"]."\",";
//定制字段
for($j=0;$j<count($sys_detail_show_select);$j++){
$content_tbody[$k].="\"".$rowspan_kh."|".get_cate_title_no($sys_detail_show_select[$j],$m_kh[$sys_detail_show_select[$j]])."\",";
}
}
if($k==count_arr_num_before($arr_rowspan_color,$k2)){
//颜色
$content_tbody[$k].="\"".$rowspan_color."|".$this_color."-".get_cate_title_no("color",$this_color)."\",";
}
$content_tbody_color[$k]="\"".$bg."\",";
$id_tbody[$k]="\"".$m_kh["id"]."\",";
$idcolor_tbody[$k]="\"".$this_color."\",";
//杯型
if($is_gg=="y"){
$tmp=get_db_msg("select price from ".$table_pre."kh_gg where iid='".$this_kh."' and color='".$this_color."' and gg='".$this_bx."'");
if($k==count_arr_num_before($arr_rowspan_bx,$k3)){
$content_tbody[$k].="\"".$rowspan_bx."|".$arr_bx[$this_kh][$this_color][$this_bx]."\",";
$content_tbody[$k].="\"".$rowspan_bx."|".$tmp["price"]."\",";
}
}else if($is_gg=="b"){
if($k==count_arr_num_before($arr_rowspan_bx,$k3)){
$content_tbody[$k].="\"".$rowspan_bx."|".$arr_bx[$this_kh][$this_color][$this_bx]."\",";
}
}
//尺码
//print_R($arr_size_td[$this_kh][$this_color][$this_bx][$k]);
for($k1=1;$k1<=count($arr_size_td[$this_kh][$this_color][$this_bx][$i4]);$k1++){
//echo $arr_size_td[$this_kh][$this_color][$this_bx][$k1];
$content_tbody[$k].="\"".$arr_size_td[$this_kh][$this_color][$this_bx][$i4][$k1]."\",";
}
//if($k==count_arr_num_before($arr_rowspan_color,$k2)){
//颜色小计
// $content_tbody[$k].="\"".$rowspan_color."|".$arr_xj_color[$this_kh][$i2][0]."\",";
//}
if($k==count_arr_num_before($arr_rowspan_kh,$i1)){
//print_r($arr_xj_kh[$i1]);
//款号小计
$content_tbody[$k].="\"".$rowspan_kh."|".$arr_xj_kh[$i1][0]."\",";
//款号小计金额
$content_tbody[$k].="\"".$rowspan_kh."|".$arr_xj_kh[$i1][1]."\",";
if(trim($zk_type) || $check_md["num"]>0){
//款号小计结算金额
$content_tbody[$k].="\"".$rowspan_kh."|".$arr_xj_kh[$i1][2]."\",";
}
}
$k++;
}
$k3++;
}
}
$k2++;
}
}
foreach($content_tbody as $key=>$value){
if($value){
$json_data3.="[".substr($value,0,-1)."],";
}
}
foreach($content_tbody_color as $key=>$value){
$json_data4.="[".substr($value,0,-1)."],";
}
$json_data6=$json_data7=array();
if($khid)
$khid="\"".$khid."\",";
foreach($id_tbody as $key=>$value){
$json_d2.="[".substr($idcolor_tbody[$key],0,-1)."],";
$json_data5.="[".substr($value,0,-1)."],";
if($khid){
if($khid==$value){
$json_data6[$key]=$ii;
$ii++;
}
}
}
foreach($json_data6 as $key=>$value){
$json_d1.="[".substr($content_tbody[$key],0,-1)."],";
$json_d3.="[".substr($content_tbody_color[$key],0,-1)."],";
}
$json_data.="\"table_mid\":[".substr($json_data3,0,-1)."],\"table_color\":[".substr($json_data4,0,-1)."],\"table_id\":[".substr($json_data5,0,-1)."],\"get_new\":[".substr($json_d1,0,-1)."],\"get_newcolor\":[".substr($json_d3,0,-1)."],\"table_idcolor\":[".substr($json_d2,0,-1)."],";
//获取完成率和已订件数,传递参数khid
//完成率
$is_spk=get_set("is_spk");
$con_spk=($is_spk=="y")?" and is_sp<>'y'":"";
//已订金额和件数
$tmp=get_db_msg("select sum(je) 'je',sum(jsje) 'jsje',sum(num) 'num' from ".$table_pre."order where ka<>'y'".$con_spk.$con_f." and uid='".$uid."'");
$ydje=$tmp["je"];
$ydjsje=$tmp["jsje"];
$ydjs=$tmp["num"];
if($is_brand=="y"){
$tmp=get_db_msg("select sum(zb) 'zb',sum(zb_js) 'zb_js' from ".$table_pre."client_brand where cid='".$uid."'");
$zb1=$tmp["zb"]*10000;
$zb=deel_num($tmp["zb"]);
$zb_js=$tmp["zb_js"];
}else{
$zb1=$msg_login["zb"]*10000;
$zb=deel_num($msg_login["zb"]);
$zb_js=$msg_login["zb_js"];
}
$wcl=deel_bfb1($ydje,$zb1,1);
$wcl_js=deel_bfb1($ydjs,$zb_js,1);
if($khid){
$tmp=get_db_msg("select sum(num) 'num' from ".$table_pre."order where uid='".$uid."' and iid='".$khid."'".$con_f);
$k_ydjs=$tmp["num"];
}else{
$k_ydjs=0;
}
//该款已订件数
$zb_client_show=get_set("zb_client_show");
$json_data.="\"ydjs\":\"".$k_ydjs."\",";
$json_data.="\"zb_client_show\":\"".$zb_client_show."\",";
//订货信息
$json_data.="\"order_num\":\"".$ydjs."\",\"order_je\":\"".$ydje."\",\"order_jsje\":\"".$ydjsje."\",";
//指标信息
$json_data.="\"zb_je\":\"".$zb."\",\"wcl_je\":\"".$wcl."\",\"zb_js\":\"".$zb_js."\",\"wcl_js\":\"".$wcl_js."\",";
//-----------合计行
//尺码合计
$hj_colspan=3;
if($is_gg=="y")
$hj_colspan+=2;
else if($is_gg=="b")
$hj_colspan+=1;
$hj_colspan+=count($sys_detail_show_select);
$json_data.="\"table_hj\":[\"".$hj_colspan."co合计\",";
if($sys_ver_hy=="xz"){
for($k1=1;$k1<=$num_size_total;$k1++){
$v1="hj_num_".$k1;
$json_data.="\"".deel_td($$v1)."\",";
}
$json_data.="\"".$total_xs."\",";
$json_data.="\"2co".$total_num."\",";
}
if($total_je>0)
$total_je=deel_num(keep_float($total_je,2));
if(trim($zk_type) || $check_md["num"]>0){
$json_data.="\"".$total_je."\",";
if($total_jsje>0)
$total_jsje=deel_num(keep_float($total_jsje,2));
$json_data.="\"".$total_jsje."\"],";
}else{
$json_data.="\"".$total_je."\"],";
}
?>