$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."'"; } } } //文胸 if($bx_sizegroup_title){ $tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$bx_sizegroup_title."' limit 0,1"); $bx_sizegroup_id=$tmp["id"]; }else{ $bx_sizegroup_id=0; } //-------------------处理尺码表头 //-------------------------根据款属性来组合尺码组 by yyj 20191023 $con3=""; for($i=0;$i"; $q1="select size_group from ".$table_pre."kh where id<>0 ".$con3." group by size_group"; $r1=$db->query($q1); $con_size_group_id=$con_size_group_id1=""; while($m1=$db->fetch_array($r1)){ $con_size_group_id.="iid='".$m1["size_group"]."' or "; $con_size_group_id1.="id='".$m1["size_group"]."' or "; } if($con_size_group_id) $con_size_group_id=" and (".substr($con_size_group_id,0,-4).")"; if($con_size_group_id1) $con_size_group_id1=" and (".substr($con_size_group_id1,0,-4).")"; // $arr_size_merged=array(); $r1=$db->query("select no from ".$table_pre."size where id<>0 ".$con_size_group_id." group by no order by no"); while($m1=$db->fetch_array($r1)){ $arr_size_merged[]=$m1["no"]; } $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' ".$con_size_group_id1." 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].="{\"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;$i0){ $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.="\"detail_size_ms\":\"".$detail_size_ms."\","; if($detail_size_ms=="2"){ //重新计算$num_size_total $num_size_total1=0; for($k=$num_size_total-1;$k>=0;$k--){ $tmp=get_db_msg("select sum(num_".$arr_size_merged[$k].") 'num' from ".$table_pre."order where _key='".$s_key."' ".$con); if($tmp["num"]>0){ $num_size_total1=$k+1; break; } } $num_size_total=$num_size_total1; // $content_thead[0]="\"w:40|次序\",\"款号\","; for($i=0;$i0) $content_thead[0].="\"w:30|杯型\","; if($is_gg=="y") $content_thead[0].="\"w:50|".d_translate("gg")."\",\"rs:".$num_size_group." w:50|".get_main_value($sys_gg_zd,"price")."\","; else if($is_gg=="b") $content_thead[0].="\"w:50|".d_translate("gg")."\","; $content_thead[0].="\"cs:".$num_size_total."|尺码明细\",\"w:35|小计\","; if($is_gg!="y") $content_thead[0].="\"w:50|".d_translate("dpj")."\","; $content_thead[0].="\"w:60|".d_translate("dpje")."\","; if(trim($zk_type) || $check_md["num"]>0) $content_thead[0].="\"w:60|结算金额\","; $thead_str.="{\"zd\":\"cx\",\"title\":\"次序\",\"is_size\":\"n\"},"; $thead_str.="{\"zd\":\"cx\",\"title\":\"款号\",\"is_size\":\"n\"},"; for($i=0;$i0) $thead_str.="{\"zd\":\"color\",\"title\":\"杯型\",\"is_size\":\"n\"},"; if($is_gg=="y"){ $thead_str.="{\"zd\":\"color\",\"title\":\"".d_translate("gg")."\",\"is_size\":\"n\"},"; $thead_str.="{\"zd\":\"color\",\"title\":\"".get_main_value($sys_gg_zd,"price")."\",\"is_size\":\"n\"},"; }else if($is_gg=="b"){ $thead_str.="{\"zd\":\"color\",\"title\":\"".d_translate("gg")."\",\"is_size\":\"n\"},"; } $thead_str.="{\"zd\":\"color\",\"title\":\"尺码明细\",\"is_size_cs\":\"y\"},"; $thead_str.="{\"zd\":\"color\",\"title\":\"小计\",\"is_size\":\"n\"},"; if($is_gg!="y") $thead_str.="{\"zd\":\"color\",\"title\":\"".d_translate("dpj")."\",\"is_size\":\"n\"},"; $thead_str.="{\"zd\":\"color\",\"title\":\"".d_translate("dpje")."\",\"is_size\":\"n\"}"; if(trim($zk_type) || $check_md["num"]>0) $thead_str.=",{\"zd\":\"color\",\"title\":\"结算金额\",\"is_size\":\"n\"}"; $thead_str2="\"0\":[".$thead_str."],"; $json_data.="\"thead_str_cs\":\"".$num_size_total."\","; $json_data.="\"thead_str_group\":\"1\","; }else{ $content_thead[0]="\"rs:".$num_size_group." w:40|次序\",\"rs:".$num_size_group."|款号\","; for($i=0;$i0) $content_thead[0].="\"rs:".$num_size_group." w:30|杯型\","; if($is_gg=="y") $content_thead[0].="\"rs:".$num_size_group." w:50|".d_translate("gg")."\",\"rs:".$num_size_group." w:50|".get_main_value($sys_gg_zd,"price")."\","; else if($is_gg=="b") $content_thead[0].="\"rs:".$num_size_group." w:50|".d_translate("gg")."\","; $content_thead[0].=$size_tr[0]."\"rs:".$num_size_group." w:35|小计\","; if($is_gg!="y") $content_thead[0].="\"rs:".$num_size_group." w:50|".d_translate("dpj")."\","; $content_thead[0].="\"rs:".$num_size_group." w:60|".d_translate("dpje")."\","; if(trim($zk_type) || $check_md["num"]>0) $content_thead[0].="\"rs:".$num_size_group." w:60|结算金额\","; for($i=1;$i<$num_size_group;$i++){ $content_thead[$i].=$size_tr[$i]; } $json_data.="\"thead_str_group\":\"".$num_size_group."\","; $thead_str.="{\"zd\":\"cx\",\"title\":\"次序\",\"is_size\":\"n\"},"; $thead_str.="{\"zd\":\"cx\",\"title\":\"款号\",\"is_size\":\"n\"},"; for($i=0;$i0){ $thead_str.="{\"zd\":\"kx\",\"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\"},"; if($is_gg!="y"){ $thead_str.="{\"zd\":\"kx\",\"title\":\"".d_translate("dpj")."\",\"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)."},"; //----表头完成$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."
"; $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."
"; $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 iid,no,bx,size_group_id,sum(num) 'num',sum(num) 'num1',sum(je) 'je',sum(jsje) 'jsje',price,".get_size_sql("sum1")." from ".$table_pre."order where id>0".$con.$con_f." and iid='".$m["iid"]."' and color='".$m2["color"]."' group by bx order by bx"; //echo $q3."
"; $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(); // $xj_num=0; //取得单尺码数量 for($k=0;$k<$num_size_total;$k++){ $ck_md=check_md($m["no"],$m2["color"],$m3["bx"],$arr_size_merged[$k],$msg_login["dj"]); if($s_md=="n"){ if($ck_md!="n"){ $tmp_num=0; }else{ $tmp_num=$m3["num_".$arr_size_merged[$k]]; } }else{ $tmp_num=$m3["num_".$arr_size_merged[$k]]; } if($ck_md!="n"){ $sty1="bc#90"; }else{ $sty1=""; } $xj_num+=$tmp_num; //计算尺码合计 $v11="hj_num_".$k; $$v11+=$tmp_num; // //$tmp1=($sty1=="bc#90")?"st:".$sty1:"c:".$bg; if($detail_size_ms=="2"){ $tmp3=get_db_msg("select title from ".$table_pre."size where iid='".$m3["size_group_id"]."' and no='".$arr_size_merged[$k]."'"); if($tmp_num>0){ $arr_td_size_tmp[$k]=$tmp1."|".$tmp3["title"]."
".deel_0($tmp_num); }else{ $arr_td_size_tmp[$k]=$tmp1."| "; } }else{ if($tmp_num>0){ $arr_td_size_tmp[$k]=$tmp1."|".deel_0($tmp_num); }else{ $arr_td_size_tmp[$k]=$tmp1."| "; } } } if($xj_num>0){ //杯型小计 if($detail_size_ms=="2"){ }else{ //$arr_td_size_tmp[$k]="|".deel_0($xj_num); } $xj_je=$m3["je"]; $xj_jsje=$m3["jsje"]; $xj_num_color+=$xj_num; $xj_je_color+=$m3["je"]; $xj_jsje_color+=$m3["jsje"]; $xj_num_kh+=$xj_num; $xj_je_kh+=$m3["je"]; $xj_jsje_kh+=$m3["jsje"]; $total_num+=$xj_num; $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(); $k=0; for($i1=0;$i1"; print_r($arr_rowspan_color); echo "
"; */ //组合输出内容 $k=$k2=$k3=0; for($i1=0;$i11?"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++){ $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;$j0){ $content_tbody[$k].="\"|".$arr_bx[$this_kh][$this_color][$i3]."\","; } 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='".$arr_bx[$this_kh][$this_color][$i3]."'"); $content_tbody[$k].="\"|".$arr_bx[$this_kh][$this_color][$i3]."\","; $content_tbody[$k].="\"|".$tmp["price"]."\","; }else if($is_gg=="b"){ $content_tbody[$k].="\"|".$arr_bx[$this_kh][$this_color][$i3]."\","; } //尺码 for($k1=0;$k10){ //款号小计结算金额 $content_tbody[$k].="\"".$rowspan_kh."|".$arr_xj_kh[$i1][2]."\","; } } $k++; } $k2++; } } //print_r($content_tbody); 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($bx_sizegroup_id>0){ $hj_colspan+=1; } 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合计\","; for($k1=0;$k1<$num_size_total;$k1++){ $v1="hj_num_".$k1; $json_data.="\"".deel_td($$v1)."\","; } $json_data.="\"co".$total_num."\","; if($is_gg!="y"){ $json_data.="\"\","; } 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."\"],"; } ?>