"; //-------------------处理尺码表头 //取得合并尺码 $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].=""; } $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; } //童装 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; } //-------------------/处理尺码表头结束 if($start==0){ $_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++; } //到色属性 if(count($sys_color_zd)>0){ foreach($sys_color_zd as $k1 => $v1){ $_tbody.=""; } } $_tbody.=""; if($is_gg=="y"){ $_tbody.=""; foreach($sys_gg_zd as $k1 => $v1){ $_tbody.=""; } }else if($is_gg=="b"){ $_tbody.=""; } if($bx_sizegroup_id>0) $_tbody.=""; else if($child_sizegroup_id>0) $_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 ".$sql_con." order by id limit ".$start.",".$end; //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,title,zd1,zd2,zd3 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.=""; } //到色字段 if(count($sys_color_zd)>0){ $m_kh_color=get_db_msg("select * from ".$table_pre."kh_color where iid='".$m["iid"]."' and color='".$m["color"]."'"); foreach($sys_color_zd as $k1 => $v1){ $_tbody.=""; } } $_tbody.=""; if($is_gg=="y"){ $_tbody.=""; $tmp1=get_db_msg("select * from ".$table_pre."kh_gg where iid='".$m["iid"]."' and color='".$m["color"]."' and gg='".$m["bx"]."'"); foreach($sys_gg_zd as $k1 => $v1){ $_tbody.=""; } }else if($is_gg=="b"){ $_tbody.=""; } if($bx_sizegroup_id>0 || $child_sizegroup_id>0) $_tbody.=""; $_tbody.=$td_size1.""; $count++; } $_tbody.="
".$t."
".d_translate("qy")."".d_translate("dl")."客户名称客户代码序号款号款式名".get_cate_title_no("arr_select",$m["no"])."".$v1."吊牌价颜色名称颜色代码".d_translate("gg")."".$v1."".d_translate("gg")."杯型款型小计吊牌金额结算金额
".$m["num_".$arr_size_merged[$k]]."
".$qy."".$dl."".$m2["title"]."".$m2["username"]."".get_kh_xh($msg_kh,$m["color"])."".$m["no"]."".$msg_kh["title"]."".$msg_kh[$m2["no"]]."".get_cate_title_no($m2["no"],$m[$m2["no"]])."".$m_kh_color[$k1]."".$m["price"]."".get_cate_title_no("color",$m["color"])."".$m["color"]."".get_gg_title($m["bx"])."".$tmp1[$k1]."".get_gg_title($m["bx"])."".$m["bx"]."".$num."".$m["je"]."".$m["jsje"]."
"; $db->close(); return $_tbody; } require "../config.php"; include "../../tmpl/config.php"; require THIS_FILE_ROOT."/include/function.php"; require THIS_FILE_ROOT."/include/db_mysql.php"; //require THIS_FILE_ROOT."/include/page.class.php"; error_reporting(E_ERROR | E_WARNING | E_PARSE); header("Content-type: text/html; charset=utf-8"); //-------------------------------mysql connect $db=new DB_Sql; $db->connect($dbhost,$dbuser,$dbpw,$dbname,"p"); $sys_size_num=get_max_size_num(); $sub=$_GET["sub"]; $step=$_GET["step"]; $list=$_GET["list"]; if($sub=="y"){ //定义每次导出的订单数量 $xh_ms=get_set("xh_ms"); $step=$step?$step:50000; $tmp=get_db_msg("select count(*) 'num' from ".$table_pre."order where ka<>'y'"); $total_num=$tmp["num"]; $list=$_GET["list"]?$_GET["list"]:1; $start=($list-1)*$step; if($step*$list<$total_num){ $content=get_order_by_client($start,$step); $file_name="DetailTotal-".$list.".xls"; $file_name=iconv("utf-8","gb2312",$file_name); write_file("xls",$file_name,$content); echo $list*$step."/".$total_num."条记录导出完成(".$file_name."),位于admin/debug/xls下面,请手动下载!"; $list++; url_redirect($_SERVER[PHP_SELF]."?sub=y&list=".$list."&step=".$step); }else{ $end=$total_num-($list-1)*$step; $content=get_order_by_client($start,$end); $file_name="DetailTotal-".$list.".xls"; $file_name=iconv("utf-8","gb2312",$file_name); //$fp=fopen("中文订单明细.xls","w"); //fwrite($fp,$content); write_file("xls",$file_name,$content); echo $total_num."条记录导出完成(共".$list."个文件),位于admin/debug/xls下面,请手动下载!"; } exit; }else{ $step=50000; } ?> 导出订单明细总表
"; } ?>
导出订单明细总表
单文件订单条数条 (如果执行超时,请减小条数)
".$msg."