'jgd' and no<>'sx' order by ord"; $r=$db->query($q); while($m=$db->fetch_array($r)){ if($m["no"]!="zd1" && $m["no"]!="zd2" && $m["no"]!="zd3"){ $arr_select_no1[]=$m["no"]; $arr_select_title1[]=$m["title"]; if($m["no"]!="designer"){ $arr_select_no2[]=$m["no"]; $arr_select_title2[]=$m["title"]; } } $arr_select_no[]=$m["no"]; $arr_select_title[]=$m["title"]; } //杯型参数 if($is_gg=="n"){ 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; } //童装 if($child_sizegroup_title){ $tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$child_sizegroup_title."' limit 0,1"); $child_sizegroup_id=$tmp["id"]; }else{ $child_sizegroup_id=0; } } $json_data.="\"uid\":".$uid.","; //有权限 switch($_a){ case "view_order": $s_group_by=$s_group_by?$s_group_by:"4"; $arr_group_by=array("4"=>"客户","3"=>"代理","9"=>"区域","1"=>"明细"); $msg=get_db_msg("select * from ".$table_pre."kh where id='".$id."'"); $pic=get_kh_picture($msg["no"],$msg["main_pic"],$msg["color"]); $pic_big=get_kh_picture_big($msg["no"],$msg["main_pic"],$msg["color"]); $pic1=out_good_pic($pic,200,200,'border=0'); $arr_pic_set=out_good_pic_set_arr($pic,200,200); $json_data.="\"pic_src\":\"".$pic."\",\"pic_w\":\"".$arr_pic_set[0]."\",\"pic_h\":\"".$arr_pic_set[1]."\",\"xhno\":\"".$msg["xh"]."#".$msg["no"]."\","; $content=""; $content.=""; $content.="
".$pic1."
".$msg["xh"]."#".$msg["no"]."
"; foreach($arr_group_by as $k1 => $v1){ $sty=($k1==$s_group_by)?"font-weight:bold;border:1px solid #333333;padding:6px;":"font-weight:normal;border:1px solid #cccccc;padding:4px;"; $content.="".$v1." "; } $content.="
"; $sql_con="iid='".$id."' and "; if($color) $sql_con.="color='".$color."' and "; $sql_con=substr($sql_con,0,-4); $json_data1=$json_data2=$json_data3=""; if($s_group_by=="1"){ //------------------------明细 //表头 $content.=""; $json_data1.="\"客户\",\"颜色\","; if($is_gg=="y") $content.=""; if($bx_sizegroup_id==$msg["size_group"]){ $content.=""; $json_data1.="\"杯型\","; // $size_str=""; $r1=$db->query("select * from ".$table_pre."size where iid='".$msg["size_group"]."' order by no"); while($m1=$db->fetch_array($r1)){ $size_str.=$m1["no"].","; } if($size_str) $size_str=substr($size_str,0,-1); $size=explode(",",$size_str); }else{ $size=explode(",",$msg["size"]); } $tmp1=explode(",",$msg["color"]); for($l=0;$l".$tmp3["title"].""; $json_data1.="\"".$tmp3["title"]."\","; } $content.=""; $json_data1.="\"小计\",\"订单时间\""; $q="select * from ".$table_pre."order where ".$sql_con." and _key='".$_key."' order by uid,add_date"; $r=$db->query($q); $hj=0; while($m=$db->fetch_array($r)){ $tmp=get_db_msg("select * from ".$table_pre."client where id='".$m["uid"]."'"); $content.=""; $json_data2.="\"".$tmp["title"]."(".$tmp["username"].")\","; $content.=""; $json_data2.="\"".$m["color"]."-".get_cate_title_no("color",$m["color"])."\","; if($bx_sizegroup_id==$msg["size_group"]){ $content.=""; $json_data2.="\"".$m["bx"]."\","; } if($is_gg=="y"){ $content.=""; $json_data2.="\"".get_gg_title($m["bx"])."\","; } //尺码列表 $xj=0; for($l=0;$l".$m["num_".$size[$l]].""; $json_data2.="\"".$m["num_".$size[$l]]."\","; } $content.=""; $json_data2.="\"".date("d日 H点i分",$m["add_date"])."\""; } //合计 $hj_colspan=($bx_sizegroup_id==$msg["size_group"])?3:2; if($is_gg=="y") $hj_colspan++; $content.=""; for($l=0;$l".$$v1.""; $json_data3.="\"".$$v1."\","; } $json_data3.="\"".$hj."\",\"\""; $content.=""; }else{ //------------------------客户、代理、区域 $arr_show_log_hd=array("23"=>"加量","22"=>"减量","24"=>"删单"); //取得数组 $arr1=array(); $q="select * from ".$table_pre."client where face='".$s_group_by."'"; $r=$db->query($q); while($m=$db->fetch_array($r)){ if($s_group_by=="4"){ $tmp_sql=" and uid='".$m["id"]."'"; }else{ $p=$m["path"]."-".$m["id"]; $tmp_sql=" and upath like '".$p."-%'"; } $tmp=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where ".$sql_con.$tmp_sql); if($tmp["num"]>0) $arr1[$m["id"]]=$tmp["num"]; } arsort($arr1); if($bx_sizegroup_id==$msg["size_group"]){ // $size_str=""; $r1=$db->query("select * from ".$table_pre."size where iid='".$msg["size_group"]."' order by no"); while($m1=$db->fetch_array($r1)){ $size_str.=$m1["no"].","; } if($size_str) $size_str=substr($size_str,0,-1); $size=explode(",",$size_str); }else{ $size=explode(",",$msg["size"]); } //表头 $content.=""; if($s_group_by=="4"){ // foreach($arr_show_log_hd as $k1 => $v1){ $content.=""; } } for($l=0;$l".$tmp3["title"].""; } $content.=""; // $hj=0; $list=1; foreach($arr1 as $id1 => $num1){ $hj+=$num1; $m=get_db_msg("select * from ".$table_pre."client where id='".$id1."'"); if($s_group_by=="4"){ $tmp_sql=" and uid='".$m["id"]."'"; }else{ $p=$m["path"]."-".$m["id"]; $tmp_sql=" and (upath='".$p."' or upath like '".$p."-%')"; } $tmp=get_db_msg("select ".get_size_sql("sum1")." from ".$table_pre."order where ".$sql_con.$tmp_sql." and _key='".$_key."'"); $content.=""; if($s_group_by=="4"){ foreach($arr_show_log_hd as $k1 => $v1){ //加单次数 $t1=get_db_msg("select count(*) 'num' from ".$table_pre."log_hd where uid='".$m["id"]."' and action='".$k1."'"); $content.=""; } } for($l=0;$l".$tmp["num_".$size[$l]].""; //尺码合计 $v1="hj_".$size[$l]; $$v1+=$tmp["num_".$size[$l]]; } $content.=""; $list++; } //合计 $hj_colspan=($s_group_by=="4")?5:2; $content.=""; for($l=0;$l".$$v1.""; } $content.=""; } $json_data.="\"hj_cos\":\"".$hj_colspan."\",\"size\":[".$json_data1."],\"mx\":[".$json_data2."],\"hj\":[".$json_data3."],"; $content.="
客户颜色".d_translate("gg")."杯型小计订单时间
".$tmp["title"]."(".$tmp["username"].")".$m["color"]."-".get_cate_title_no("color",$m["color"])."".$m["bx"]."".get_gg_title($m["bx"])."".$xj."".date("d日 H点i分",$m["add_date"])."
合计".$hj." 
序号客户".$v1."
次数
小计
".$list."".$m["title"]."(".$m["username"].")".$t1["num"]."".$num1."
合计".$hj."
"; break; case "ka" : if(is_array($id)) $arr_id=$id; else $arr_id=explode(",",$id); $num=count($arr_id); if($num==0) alert_and_back("请至少选择一条记录!"); for($i=0;$i<$num;$i++){ if($arr_id[$i]>0){ $tmp=get_db_msg("select no from ".$table_pre."kh where id='".$arr_id[$i]."'"); // $db->query("update ".$table_pre."kh set ka='y' where id='".$arr_id[$i]."'"); $db->query("update ".$table_pre."kh set color_ka=color where id='".$arr_id[$i]."'"); $db->query("update ".$table_pre."kh_color set ka='y' where iid='".$arr_id[$i]."'"); $db->query("update ".$table_pre."order set ka='y' where iid='".$arr_id[$i]."' and _key='".$_key."'"); $lid.=$tmp["no"].", "; } } $lid=substr($lid,0,-2); set_order_total_all(); set_log("设为删除款",$lid); if($r_url) url_redirect(urldecode($r_url)); else echo "ok"; break; case "ka_qx" : if(is_array($id)) $arr_id=$id; else $arr_id=explode(",",$id); $num=count($arr_id); if($num==0) alert_and_back("请至少选择一条记录!"); for($i=0;$i<$num;$i++){ if($arr_id[$i]>0){ $tmp=get_db_msg("select no from ".$table_pre."kh where id='".$arr_id[$i]."'"); // $db->query("update ".$table_pre."kh set ka='n' where id='".$arr_id[$i]."'"); $db->query("update ".$table_pre."kh_color set ka='n' where iid='".$arr_id[$i]."'"); $db->query("update ".$table_pre."kh set color_ka='' where id='".$arr_id[$i]."'"); $db->query("update ".$table_pre."order set ka='n' where iid='".$arr_id[$i]."' and _key='".$_key."'"); $lid.=$tmp["no"].", "; } } set_order_total_all(); $lid=substr($lid,0,-2); set_log("取消删除款",$lid); if($r_url) url_redirect(urldecode($r_url)); else echo "ok"; break; case "color_ka": $msg_kh=get_db_msg("select * from ".$table_pre."kh where id='".$id."'"); if($msg_kh["color_ka"]) $color_ka=$msg_kh["color_ka"].",".$color; else $color_ka=$color; $q="update ".$table_pre."kh set color_ka='".$color_ka."' where id='".$id."'"; $db->query($q); // //恢复删除款 $arr1=explode(",",$msg_kh["color"]); $arr2=explode(",",$color_ka); if(count($arr1)==count($arr2)) $db->query("update ".$table_pre."kh set ka='y' where id='".$id."'"); // //设置款色表 $db->query("update ".$table_pre."kh_color set ka='y' where iid='".$id."' and color='".$color."'"); //设置订货表 $db->query("update ".$table_pre."order set ka='y' where iid='".$id."' and color='".$color."' and _key='".$_key."'"); set_order_total_all(); set_log("删除颜色",$msg_kh["no"]."|".$color); echo "ok"; //url_redirect(urldecode($r_url)); break; case "color_ka_qx": $msg_kh=get_db_msg("select * from ".$table_pre."kh where id='".$id."'"); $tmp=explode(",",$msg_kh["color_ka"]); $ka_color=""; for($i=0;$iquery($q); //恢复删除款 $db->query("update ".$table_pre."kh set ka='n' where id='".$id."'"); //设置款色表 $db->query("update ".$table_pre."kh_color set ka='n' where iid='".$id."' and color='".$color."'"); //设置订货表 $db->query("update ".$table_pre."order set ka='n' where iid='".$id."' and color='".$color."' and _key='".$_key."'"); set_order_total_all(); // set_log("取消删除颜色",$msg_kh["no"]."|".$color); echo "ok"; //url_redirect(urldecode($r_url)); break; case "export": //-------------------处理尺码表头 //取得合并尺码 $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].="".$t.""; } $num_size_group++; } //杯型参数 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; } $_tbody=" "; //-------------------/处理尺码表头结束 $_tbody.=""; //取得定制选项 $q="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' order by ord"; $r=$db->query($q); $num_dz=0; while($m=$db->fetch_array($r)){ $_tbody.=""; $num_dz++; } $_tbody.=""; if($bx_sizegroup_id>0) $_tbody.=""; if($is_gg=="y") $_tbody.=""; $_tbody.=$size_tr[0].""; for($i=1;$i<$num_size_group;$i++){ $_tbody.="".$size_tr[$i].""; } $sql_con="where ka<>'y'"; $q="select * from ".$table_pre."order where ka='y' and _key='".$_key."' order by uid,no,color"; //echo $q."
"; $r=$db->query($q); $count=0; while($m=$db->fetch_array($r)){ $list=$count+1; $bg="#ffffff"; $m2=get_db_msg("select path,title,username from ".$table_pre."client where id='".$m["uid"]."'"); $msg_kh=get_db_msg("select no,xh from ".$table_pre."kh where id='".$m["iid"]."'"); $qy_id=get_qy_id($m2["path"]); if($qy_id){ //取得区域 $tmp=get_db_msg("select title from ".$table_pre."client where id='".$qy_id."'"); $qy=$tmp["title"]; }else{ $qy=""; } //取得代理 $dl_id=get_dl_id($m2["path"]); if($dl_id){ $tmp=get_db_msg("select title from ".$table_pre."client where id='".$dl_id."'"); $dl=$tmp["title"]; }else{ $dl=""; } $td_size1=""; $num=$money=0; for($k=0;$k<$num_size_total;$k++){ $num+=$m["num_".$arr_size_merged[$k]]; $td_size1.=""; } $_tbody.=""; //取得定制选项 $q2="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' order by ord"; $r2=$db->query($q2); while($m2=$db->fetch_array($r2)){ if($m2["no"]=="zd1" || $m2["no"]=="zd2" || $m2["no"]=="zd3") $_tbody.=""; else $_tbody.=""; } $_tbody.=""; if($bx_sizegroup_id>0) $_tbody.=""; if($is_gg=="y") $_tbody.=""; $_tbody.=$td_size1.""; $count++; } $_tbody.="
区域代理客户名称客户代码序号款号".get_cate_title_no("arr_select",$m["no"])."吊牌价颜色名称颜色代码杯型".d_translate("gg")."小计吊牌金额结算金额
".$m["num_".$arr_size_merged[$k]]."
".$qy."".$dl."".$m2["title"]."".$m2["username"]."".get_kh_xh($msg_kh,$m["color"])."".$m["no"]."".$m[$m2["no"]]."".get_cate_title_no($m2["no"],$m[$m2["no"]])."".$m["price"]."".get_cate_title_no("color",$m["color"])."".$m["color"]."".$m["bx"]."".get_gg_title($m["bx"])."".$num."".$m["je"]."".$m["jsje"]."
"; $content_str=$_tbody; $filename="ka_".date("YmdHi").".xls"; $mime_type=ereg('MSIE ([0-9].[0-9]{1,2})',$_SERVER['HTTP_USER_AGENT'])||ereg('Opera(/| )([0-9].[0-9]{1,2})',$_SERVER['HTTP_USER_AGENT'])?"application/octetstream":"application/octet-stream"; header("Content-Type:".$mime_type); header('Content-Disposition: attachment; filename="'.$filename.'"'); echo $content_str; break; case "detail": //可选择字段 $arr_zd=array( "xh"=>"序号", "price"=>"价格", "title"=>"款式名" ); for($i=0;$iquery("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].="".$t.""; $size_tr[$num_size_group].="{\"zd\":\"num_".$i."\",\"title\":\"".$t."\",\"is_size\":\"y\"},"; } $arr_size_merged[]=$m1["no"]; $num_size_group++; } //-------------------/处理尺码表头结束 $s_zd=$s_zd?$s_zd:"price"; $sql_con=""; $search_content=""; //字段 $zd=""; $zd1=""; $i=0; $arrzd=array(); $arrzd=explode(",",$s_zd); $zd_ct=0; foreach($arr_zd as $k1 => $v1){ $zd.="".$v1.""; } $json_data.="\"th_zd\":[".substr($zd1,0,-1)."],"; $search_content.="显示列:".$zd; //$search_content.=" "; $search_content.=" "; //-----------------------/search //-----------------------tab //-----------------------/tab $json_data.="\"thead_str_group\":\"".$num_size_group."\","; $th_zd=""; for($i=0;$i".get_main_value($arr_zd,$s_zd[$i]).""; } $thead_str=""; $thead_str.="{\"zd\":\"no\",\"title\":\"款号\",\"is_size\":\"n\"},"; $colnum=0; foreach($arr_zd as $k1 => $v1){ if(in_array($k1,$arrzd)){ $thead_str.="{\"zd\":\"".$k1."\",\"title\":\"".$v1."\",\"is_size\":\"n\"},"; $colnum++; } } $thead_str.="{\"zd\":\"color_title\",\"title\":\"颜色名称\",\"is_size\":\"n\"},"; $thead_str.="{\"zd\":\"color\",\"title\":\"颜色代码\",\"is_size\":\"n\"},"; if($bx_sizegroup_id>0){ $thead_str.="{\"zd\":\"bx\",\"title\":\"杯型\",\"is_size\":\"n\"},"; } if($is_gg=="y"){ $thead_str.="{\"zd\":\"gg\",\"title\":\"".d_translate("gg")."\",\"is_size\":\"n\"},"; //$thead_str.="{\"zd\":\"ggprice\",\"title\":\"".get_main_value($sys_gg_zd,"price")."\",\"is_size\":\"n\"},"; } $thead_str.=$size_tr[0]; $thead_str.="{\"zd\":\"js\",\"title\":\"小计\",\"is_size\":\"n\"},"; $thead_str.="{\"zd\":\"je\",\"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)."},"; $_tbody="次序款号".$th_zd."颜色颜色代码"; if($bx_sizegroup_id>0) $_tbody.="杯型"; if($is_gg=="y") $_tbody.="".d_translate("gg").""; $_tbody.=$size_tr[0]."小计金额"; for($i=1;$i<$num_size_group;$i++){ $_tbody.="".$size_tr[$i].""; } $q="select * from ".$table_pre."kh where ka='y' or (ka<>'y' and color_ka<>'') order by xh"; //echo $q."
"; $r=$db->query($q); $count=0; $l=0; $_tcontent=array(); $total_num=$total_money=0; $list_kh=$list_color=0; $list=1; while($m=$db->fetch_array($r)){ //取得杯型 $arrBx=array(); $r1=$db->query("select * from ".$table_pre."size_bx where no='".$m["no"]."' order by bx"); $i1=0; while($m1=$db->fetch_array($r1)){ $arrBx[$i1][]=$m1["bx"]; $arrBx[$i1][]=$m1["size"]; $i1++; } if(count($arrBx)==0){ $arrBx[0][0]=""; $arrBx[0][1]=$m["size"]; } $bg=($l%2)?"#f0f0f0":"#ffffff"; // $tmp_zd=""; for($i=0;$i"; $tmp_zd.=($s_zd=="title" || $s_zd=="price" || $s_zd=="xh")?deel_td($m[$s_zd[$i]]):deel_td(get_cate_title_no($s_zd[$i],$m[$s_zd[$i]])); $tmp_zd.=""; } //取得颜色 $arr_color=($m["ka"]=="y")?explode(",",$m["color"]):explode(",",$m["color_ka"]); $num1=count($arr_color); //有多种颜色 for($j=0;$j".add_0($tmp["num"]).""; $xixi=$tmp["num"]; if(!$xixi) $xixi=""; $tbody_str.="\"num_".$k1."\":\"".$xixi."\","; $xj_js+=$tmp["num"]; $xj_je+=$tmp["num"]*$m["price"]; } $total_num+=$xj_js; $total_money+=$xj_je; $tbody_str2=""; foreach($arr_zd as $k1 => $v1){ if(in_array($k1,$arrzd)){ if($k1=="title" || $k1=="price"){ $tbody_str2.="\"".$k1."\":\"".deel_td($m[$k1])."\","; }else if($k1=="xh"){ $tbody_str2.="\"".$k1."\":\"".get_kh_xh($m1)."\","; }else{ $tbody_str2.="\"".$k1."\":\"".deel_td(get_cate_title_no($k1,$m[$k1]))."\","; } } } $tbody_str.="\"no\":\"".$m["no"]."\","; $tbody_str.=$tbody_str2; $tbody_str.="\"color_title\":\"".deel_td(get_cate_title_no("color",$arr_color[$j]))."\","; $tbody_str.="\"color\":\"".deel_td($arr_color[$j])."\","; if($bx_sizegroup_id>0){ $tbody_str.="\"bx\":\"".deel_td($m["bx"])."\","; } if($is_gg=="y"){ //取得规格价格 $tmp=get_db_msg("select price from ".$table_pre."kh_gg where iid='".$m2["iid"]."' and gg='".$m2["bx"]."'"); $tbody_str.="\"gg\":\"".deel_td(get_gg_title($arrBx[$i1][0]))."\","; //$tbody_str.="\"ggprice\":\"".deel_td($tmp["price"])."\","; } $tbody_str.="\"js\":\"".add_0($xj_js)."\","; $tbody_str.="\"je\":\"".add_0($xj_je)."\""; $tbody_str.="},"; $_tcontent[$count].="".$list."".$m["no"]."".$tmp_zd."".deel_td(get_cate_title_no("color",$arr_color[$j]))."".deel_td($arr_color[$j]).""; if($is_gg=="y") $_tcontent[$count].="".deel_td(get_gg_title($arrBx[$i1][0])).""; if($bx_sizegroup_id>0) $_tcontent[$count].="".deel_td($arrBx[$i1][0]).""; $_tcontent[$count].=$td_size1."".add_0($xj_js)."".add_0($xj_je).""; $count++; $list++; } $list_color++; } $list_kh++; $l++; } $json_data.="\"tbody_str\":[".substr($tbody_str,0,-1)."],"; $td_size1=""; $tfoot_str2=""; for($k=0;$k<$num_size_total;$k++){ $k1=$k+1; $tmp=get_db_msg("select sum(num_".$k1.") 'num' from ".$table_pre."order where ka='y' and _key='".$_key."'"); $td_size1.="".add_0($tmp["num"]).""; $haha=add_0($tmp["num"]); if(!$haha) $haha=""; $tfoot_str2.="\"num_".$k1."\":\"".$haha."\","; } $th_zd=""; for($i=0;$i "; } $_tcontent[$count].="合计".add_0($list_kh)."".$th_zd."".add_0($list_color)." "; $hj_colspan=($bx_sizegroup_id>0)?4:3; if($is_gg=="y") $hj_colspan+=1; $tdnum=$hj_colspan+$zd_ct; $json_data.="\"tfoot_str\":{\"tdnum\":\"".$tdnum."\",".$tfoot_str2."\"js\":\"".deel_td($total_num)."\",\"je\":\"".deel_td($total_money)."\"},"; if($is_sub) $json_data.="\"issub\":\"y\","; if($bx_sizegroup_id>0) $_tcontent[$count].=" "; if($is_gg=="y") $_tcontent[$count].=" "; $_tcontent[$count].=$td_size1."".add_0($total_num)."".add_0($total_money).""; $_nav_.=" > 删除款订单明细表"; break; default : // $content=array(); $s_order=$s_order?$s_order:"1"; $s_in_ph=$s_in_ph?$s_in_ph:"y"; $offset=$offset?$offset:"0"; $order=$order?$order:"xh"; $s_ms=$s_ms?$s_ms:"dk"; $sql_con=""; if($s_ka) $sql_con.="ka='".$s_ka."' and "; if($s_ka_color=="y") $sql_con.="color_ka<>'' and "; if($s_is_sp) $sql_con.="is_sp='".$s_is_sp."' and "; if($s_xh) $sql_con.="xh='".$s_xh."' and "; if($s_no) $sql_con.="no like '%".$s_no."%' and "; for($i=0;$iquery($q); $arr_kh_num_all=array(); while($m=$db->fetch_array($r)){ $arr_kh_num_all[]=$m["num"]; } $arr_kh_num_all[]=0; //读取相应款号和订单量数组 $q="select * from ".$table_pre."kh ".$sql_con; //echo $q."
"; $r=$db->query($q); $arr_kh_id=$arr_kh_num=$arr_kh=array(); $i=0; while($m=$db->fetch_array($r)){ if($s_ms=="dk"){ //到款 $tmp=get_db_msg("select sum(num) 'num' from ".$table_pre.$tj_table." where iid='".$m["id"]."'"); $num=$tmp["num"]?$tmp["num"]:0; $arr_kh[$i]["id"]=$m["id"]; $arr_kh[$i]["num"]=$num; $arr_kh_id[$i]=$m["id"]; $arr_kh_num[$i]=$num; $i++; }else{ //到色 $arr_color=explode(",",$m["color"]); for($j=0;$jquery($q1); $i=0; while($m1=$db->fetch_array($r1)){ $arr_ks_pm[$i]=$m1["num"]; $i++; } //取得款类、色类排行数组 $arr_kl_ph=array(); $arr_sl_ph=array(); $q1="select * from ".$table_pre."keyword where cate='category'"; $r1=$db->query($q1); while($m1=$db->fetch_array($r1)){ $q2="select sum(num) 'num' from ".$table_pre.$tj_table." where category='".$m1["no"]."' group by no,color order by num desc"; $r2=$db->query($q2); $i=0; while($m2=$db->fetch_array($r2)){ $arr_sl_pm[$m1["no"]][$i]=$m2["num"]; $i++; } // $q2="select sum(num) 'num' from ".$table_pre.$tj_table." where category='".$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++; } } //取得定制选项 $select_dz=""; for($i=0;$iquery("select no,title from ".$table_pre."keyword where cate='".$arr_select_no1[$i]."' order by no"); while($m1=$db->fetch_array($r1)){ $tmp.="{\"no\":\"".$m1["no"]."\",\"title\":\"".$m1["title"]."\"},"; } $tmp=deel_end($tmp); $var="s_".$arr_select_no1[$i]; $select_dz.="{\"no\":\"".$arr_select_no1[$i]."\",\"title\":\"".$arr_select_title1[$i]."\",\"value\":\"".$$var."\",\"op\":[".$tmp."]},"; } $select_dz=deel_end($select_dz); //-----------------------search $search_content1="序号:

款号: "; //删除款 $search_content=" "; //删除色 $search_content.=" "; //饰品款 $search_content.=" "; //选项 for($i=0;$i".op_select_cate1($arr_select_no1[$i],$$v)." "; } // $search_content.=" 名 "; //排行款 //$search_content.=" "; $search_content.=""; $search_form_hidden=array( "_a"=>$_a ); //-----------------------/search $tmp_page_size=($s_pagesize=="")?$total:$s_pagesize; //-----------------------act $act=""; $act.=""; $act.=""; $act.=" "; if($s_no || $s_xh) $act.=" 显示全部"; //-----------------------/act //-----------------------tab //-----------------------/tab $r_url=$_SERVER[PHP_SELF]."?_cid=".$_cid."&_m=".$_m."&s_xh=".$s_xh."&s_no=".$s_no."&s_ka=".$s_ka."&s_ka_color=".$s_ka_color."&s_is_sp=".$s_is_sp."&s_pagesize=".$s_pagesize."&s_order=".$s_order; for($i=0;$iurlencode($r_url) ); $column=array( "序号", "订单/客户量", "款号/名".get_order_action("no",$order,$_SERVER[PHP_SELF],$tran_var) ); $column_property=array("align=left width=40","align=center width=80","align=left"); for($count=0;$count<$tmp_page_size;$count++){ if($s_ms=="dk"){ //到款 $khid=$arr_kh[$count]["id"]; }else{ //到色 $arr_tmp=explode(",",$arr_kh[$count]["id"]); $khid=$arr_tmp[0]; $this_color=$arr_tmp[1]; } $msg=get_db_msg("select * from ".$table_pre."kh where id='".$khid."'"); if($msg["id"]>0){ $list=$count+1; $content[$count][]="\"bh\":\"".$list."\",\"id\":\"".$msg["id"]."\""; $c=$msg["ka"]=="y"?"font_ka":"font_normal"; // if($s_ms=="dk"){ //到款 $num_client=get_num_client($msg["id"],$uid); }else{ //到色 $num_client=get_num_client_color($msg["id"],$this_color,$uid); } if($arr_kh[$count]["num"]>0){ $t_num="".$arr_kh[$count]["num"]."/".get_num_client($msg["id"],$uid).""; }else{ $t_num="".$arr_kh[$count]["num"]."/".get_num_client($msg["id"],$uid).""; } $content[$count][]=$t_num; if($s_ms=="dk"){ $pic=get_kh_picture($msg["no"],$msg["main_pic"],$msg["color"]); $pic_big=get_kh_picture_big($msg["no"],$msg["main_pic"],$msg["color"]); }else{ $pic=get_kh_color_picture($msg["no"],$this_color); $pic_big=get_kh_color_picture_big($msg["no"],$this_color); } $arr_pic_set=out_good_pic_set_arr($pic,120,120); $pic1=out_good_pic($pic,80,80,'border=0'); $tmp1=explode(",",$msg["color"]); $tmp2=explode(",",$msg["color_ka"]); //取得杯型 $arrBx=array(); $arrBx[0][0]=""; $arrBx[0][1]=$msg["size"]; if($bx_sizegroup_id==$msg["size_group"]){ $arrBx=array(); $str_bx=""; $r1=$db->query("select * from ".$table_pre."size_bx where no='".$msg["no"]."' order by bx"); $i1=0; while($m1=$db->fetch_array($r1)){ $arrBx[$i1][]=$m1["bx"]; $arrBx[$i1][]=$m1["size"]; $i1++; } if(count($arrBx)==0){ $arrBx[0][0]=""; $arrBx[0][1]=$msg["size"]; } $r3=$db->query("select * from ".$table_pre."size where iid='".$bx_sizegroup_id."' order by no"); $str_size_title=""; $str_size_title1="\"颜色\",\"杯型\","; $size_str=""; while($m3=$db->fetch_array($r3)){ $str_size_title.="".$m3["title"].""; $str_size_title1.="\"".$m3["title"]."\","; $size_str.=$m3["no"].","; } $size=explode(",",substr($size_str,0,-1)); } //else if($msg["size_group"]==$child_sizegroup_id){ //} else{ if($is_gg=="y"){ $arrBx=array(); $arrBx[0][0]=""; $r1=$db->query("select gg from ".$table_pre."kh_gg where iid='".$msg["id"]."' order by color,ord"); $i1=0; while($m1=$db->fetch_array($r1)){ $arrBx[$i1][0]=$m1["gg"]; $i1++; } if(count($arrBx)==0){ $arrBx[0][0]=""; $arrBx[0][1]=$msg["size"]; } $r3=$db->query("select * from ".$table_pre."size where iid='".$msg["size_group"]."' order by no"); $str_size_title=""; $str_size_title1="\"颜色\",\"规格\","; $size_str=""; while($m3=$db->fetch_array($r3)){ $str_size_title.="".$m3["title"].""; $str_size_title1.="\"".$m3["title"]."\","; $size_str.=$m3["no"].","; } $size=explode(",",substr($size_str,0,-1)); } else{ $size=explode(",",$msg["size"]); $str_size_title=""; $str_size_title1="\"颜色\","; for($l=0;$l".$tmp3["title"].""; $str_size_title1.="\"".$tmp3["title"]."\","; } } } $str_size_title1.="\"小计\", \"色总排名\",\"色类排名\","; $color=""; $color1=""; $color_ka=""; $color_ka1=""; for($k=0;$k"; }else{ $ka_button=""; $st1="font_normal"; } $color_ka1.="[\"".$tmp1[$k]."\",\"".in_array($tmp1[$k],$tmp2)."\"],"; //尺码列表 //$size=explode(",",$arrBx[$i1][1]); $str_size_num=""; $str_size_num1=""; $xj=0; $tmp4=get_db_msg("select ".get_size_sql("sum1")." from ".$table_pre."order where iid='".$msg["id"]."' and color='".$tmp1[$k]."' and bx='".$arrBx[$i1][0]."'"); for($l=0;$l".$tmp4["num_".$size[$l]].""; $hehe=$tmp4["num_".$size[$l]]; if(!$hehe) $hehe=""; $str_size_num1.="\"".$hehe."\","; } if($xj_num_color>0){ $pm=get_main_key($arr_ks_pm,$xj_num_color)+1; $slpm=(get_main_key($arr_sl_pm[$msg["category"]],$xj_num_color)+1)."/".count($arr_sl_pm[$msg["category"]]); }else{ $pm=""; $slpm=""; } $color1.="["; if($i1==0){ $color.="".$tmp1[$k]."-".get_cate_title_no("color",$tmp1[$k]).""; $color1.="\"bxhb:".count($arrBx)."\",\"bxhb:".$tmp1[$k]."-".get_cate_title_no("color",$tmp1[$k])."\","; $color_ka=$color_ka1; } if($i1!=0) $color1.="\"\","; if($bx_sizegroup_id==$msg["size_group"]){ $color.="".$arrBx[$i1][0].""; $color1.="\"".$arrBx[$i1][0]."\","; } if($is_gg=="y"){ $color.="".$arrBx[$i1][0].""; $color1.="\"".$arrBx[$i1][0]."\","; } if($is_gg=="b"){ $tmpgg=get_db_msg("select * from web_kh_gg_title where id='".$arrBx[$i1][0]."'"); $color.="".$tmpgg["title"].""; $color1.="\"".$tmpgg["title"]."\","; } $color.=$str_size_num; $color1.="".$str_size_num1.""; if($i1==0){ $color.="".$xj_num_color."".$pm."".$slpm."
".$ka_button."
"; $color1.="\"bxhb:".$xj_num_color."\",\"bxhb:".$pm."\",\"bxhb:".$slpm."\",\"bxhb:thisaaa:操作\","; } $color1="".substr($color1,0,-1)."],"; } } if($msg["ka"]=="y") $button_ka=""; else $button_ka=""; $details=""; if($bx_sizegroup_id==$msg["size_group"]) $details.=""; $details.=$str_size_title."".$color."
颜色杯型小计色总
排名
色类
排名
操作
"; if($s_ms=="dk"){ $xj1=$arr_kh[$count]["num"];//款订量 $yph=get_kh_xh($msg); }else{ $tmp=get_db_msg("select sum(num) 'num' from ".$table_pre."order where iid='".$khid."' group by iid"); $xj1=$tmp["num"];//款订量 $yph=get_kh_xh($msg,$this_color); } if($xj1>0) $klpm=(get_main_key($arr_kl_pm[$msg["category"]],$xj1)+1)."/".count($arr_kl_pm[$msg["category"]]); else $klpm=""; //取得款总排名 if($this_color) $color_title="
".$this_color."-".get_cate_title_no("color",$this_color); $other_info=""; if($msg["category"]) $other_info.=" ".get_cate_title_no("category",$msg["category"]); if($msg["category1"]) $other_info.=" ".get_cate_title_no("category1",$msg["category1"]); if(trim($msg["title"])) $other_info.=" ".trim($msg["title"]); $content[$count][]="\"ka\":\"".$msg["ka"]."\",\"klpm\":\"".$klpm."\",\"kh\":\"".$msg["no"]."\",\"xh\":\"".$yph."\",\"kpm\":\"".(get_main_key1($arr_kh_num_all,$arr_kh[$count]["num"])+1)."\",\"colors\":\"".$this_color."\",\"other_info\":\" ".$other_info." ".$msg["price"]."元 款类排名 :".$klpm."\",\"pic_src\":\"".$pic."\",\"pic_name\":\"".$color_title."\",\"pic_w\":\"".$arr_pic_set[0]."\",\"pic_h\":\"".$arr_pic_set[1]."\""; $content[$count][]="\"cm\":[".substr($str_size_title1,0,-1)."]"; $content[$count][]="\"color\":[".substr($color1,0,-1)."],\"color_ka\":[".substr($color_ka1,0,-1)."],\"msg_color\":\"".$msg["color"]."\""; } } $json_data.="\"code\":0,\"ss_ms\":\"".$s_ms."\",\"ss_ka\":\"".$s_ka."\",\"ss_is_sp\":\"".$s_is_sp."\",\"ss_ka_color\":\"".$s_ka_color."\",\"ss_pagesize\":\"".$s_pagesize."\",\"ss_order\":\"".$s_order."\",\"select_dz\":[".$select_dz."],\"ss_xh\":\"".$s_xh."\",\"ss_no\":\"".$s_no."\",\"count\":".count($content).",\"data\":["; foreach($content as $key=>$value){ $json_data1.="{".$value[0].",\"dingdan\":\"".$value[1]."\",".$value[2].",".$value[3].",".$value[4]."},"; } $json_data.=substr($json_data1,0,-1)."],"; break; } } $json_data=substr($json_data,0,-1)."}"; echo $json_data; ?>