7e47ce238b
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
535 lines
19 KiB
PHP
535 lines
19 KiB
PHP
<?php
|
|
//-------------------------------------------------------导出每个客户的订单明细
|
|
function get_order_by_client($upath){
|
|
global $table_pre,$db,$bx_sizegroup_id,$child_sizegroup_id,$check_md,$zk_type,$xh_ms,$is_gg,$sys_gg_zd,$show_wd;
|
|
$_tbody="<html xmlns:o=\"urn:schemas-microsoft-com:office:office\"
|
|
xmlns:x=\"urn:schemas-microsoft-com:office:excel\"
|
|
xmlns=\"http://www.w3.org/TR/REC-html40\">
|
|
|
|
<head>
|
|
<meta http-equiv=Content-Type content=\"text/html; charset=utf-8\">
|
|
<meta name=ProgId content=Excel.Sheet>
|
|
<meta name=Generator content=\"Microsoft Excel 11\">
|
|
<style>
|
|
<!--table
|
|
{mso-displayed-decimal-separator:\"\.\";
|
|
mso-displayed-thousand-separator:\"\,\";}
|
|
@page
|
|
{margin:1.0in .75in 1.0in .75in;
|
|
mso-header-margin:.5in;
|
|
mso-footer-margin:.5in;}
|
|
tr
|
|
{mso-height-source:auto;
|
|
mso-ruby-visibility:none;}
|
|
col
|
|
{mso-width-source:auto;
|
|
mso-ruby-visibility:none;}
|
|
br
|
|
{mso-data-placement:same-cell;}
|
|
.style0
|
|
{mso-number-format:General;
|
|
text-align:general;
|
|
vertical-align:middle;
|
|
white-space:nowrap;
|
|
mso-rotate:0;
|
|
mso-background-source:auto;
|
|
mso-pattern:auto;
|
|
color:windowtext;
|
|
font-size:12.0pt;
|
|
font-weight:400;
|
|
font-style:normal;
|
|
text-decoration:none;
|
|
font-family:宋体;
|
|
mso-generic-font-family:auto;
|
|
mso-font-charset:134;
|
|
border:none;
|
|
mso-protection:locked visible;
|
|
mso-style-name:常规;
|
|
mso-style-id:0;}
|
|
td
|
|
{mso-style-parent:style0;
|
|
padding-top:1px;
|
|
padding-right:1px;
|
|
padding-left:1px;
|
|
mso-ignore:padding;
|
|
color:windowtext;
|
|
font-size:12.0pt;
|
|
font-weight:400;
|
|
font-style:normal;
|
|
text-decoration:none;
|
|
font-family:宋体;
|
|
mso-generic-font-family:auto;
|
|
mso-font-charset:134;
|
|
mso-number-format:General;
|
|
text-align:general;
|
|
vertical-align:middle;
|
|
border:none;
|
|
mso-background-source:auto;
|
|
mso-pattern:auto;
|
|
mso-protection:locked visible;
|
|
white-space:nowrap;
|
|
mso-rotate:0;}
|
|
ruby
|
|
{ruby-align:left;}
|
|
rt
|
|
{color:windowtext;
|
|
font-size:9.0pt;
|
|
font-weight:400;
|
|
font-style:normal;
|
|
text-decoration:none;
|
|
font-family:宋体;
|
|
mso-generic-font-family:auto;
|
|
mso-font-charset:134;
|
|
mso-char-type:none;
|
|
display:none;}
|
|
-->
|
|
</style>
|
|
<!--[if gte mso 9]><xml>
|
|
<x:ExcelWorkbook>
|
|
<x:ExcelWorksheets>
|
|
<x:ExcelWorksheet>
|
|
<x:WorksheetOptions>
|
|
<x:DefaultRowHeight>285</x:DefaultRowHeight>
|
|
<x:Selected/>
|
|
<x:ProtectContents>False</x:ProtectContents>
|
|
<x:ProtectObjects>False</x:ProtectObjects>
|
|
<x:ProtectScenarios>False</x:ProtectScenarios>
|
|
</x:WorksheetOptions>
|
|
</x:ExcelWorksheet>
|
|
</x:ExcelWorksheets>
|
|
<x:WindowHeight>8640</x:WindowHeight>
|
|
<x:WindowWidth>17955</x:WindowWidth>
|
|
<x:WindowTopX>720</x:WindowTopX>
|
|
<x:WindowTopY>315</x:WindowTopY>
|
|
<x:ProtectStructure>False</x:ProtectStructure>
|
|
<x:ProtectWindows>False</x:ProtectWindows>
|
|
</x:ExcelWorkbook>
|
|
</xml><![endif]-->
|
|
</head>
|
|
<body link=blue vlink=purple><table x:str border=0 cellpadding=0 cellspacing=0 style='border-collapse:
|
|
collapse;table-layout:fixed;'>";
|
|
//-------------------处理尺码表头
|
|
//取得合并尺码
|
|
$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=\"5%\">".$t."</td>";
|
|
}
|
|
$num_size_group++;
|
|
}
|
|
//-------------------/处理尺码表头结束
|
|
$_tbody.="<tr>";
|
|
if($xh_ms=="1")
|
|
$_tbody.="<td rowspan=\"".$num_size_group."\">序号</td>";
|
|
$_tbody.="<td rowspan=\"".$num_size_group."\">款号</td>";
|
|
$_tbody.="<td rowspan=\"".$num_size_group."\">款式名</td>";
|
|
//取得定制选项
|
|
$q="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no<>'jgd' and no<>'sx' order by ord";
|
|
$r=$db->query($q);
|
|
$num_dz=0;
|
|
while($m=$db->fetch_array($r)){
|
|
$_tbody.="<td rowspan=\"".$num_size_group."\">".get_cate_title_no("arr_select",$m["no"])."</td>";
|
|
$arr_zd[$m["no"]]=$m["title"];
|
|
$num_dz++;
|
|
}
|
|
if($is_gg!="y")
|
|
$_tbody.="<td rowspan=\"".$num_size_group."\">吊牌价</td>";
|
|
if($xh_ms=="2")
|
|
$_tbody.="<td rowspan=\"".$num_size_group."\">序号</td>";
|
|
$_tbody.="<td rowspan=\"".$num_size_group."\">颜色名称</td><td rowspan=\"".$num_size_group."\">颜色代码</td>";
|
|
if($bx_sizegroup_id>0)
|
|
$_tbody.="<td rowspan=\"".$num_size_group."\">杯型</td>";
|
|
else if($child_sizegroup_id>0)
|
|
$_tbody.="<td rowspan=\"".$num_size_group."\">款型</td>";
|
|
if($is_gg=="y")
|
|
$_tbody.="<td rowspan=\"".$num_size_group."\" bgcolor=\"#f0f0f0\" align=\"center\">".d_translate("gg")."</td><td rowspan=\"".$num_size_group."\" bgcolor=\"#f0f0f0\" align=\"center\">".get_main_value($sys_gg_zd,"price")."</td>";
|
|
else if($is_gg=="b")
|
|
$_tbody.="<td rowspan=\"".$num_size_group."\" bgcolor=\"#f0f0f0\" align=\"center\">".d_translate("gg")."</td>";
|
|
$_tbody.=$size_tr[0]."<td rowspan=\"".$num_size_group."\">小计</td><td rowspan=\"".$num_size_group."\">吊牌金额</td>";
|
|
if(trim($zk_type) || $check_md["num"]>0)
|
|
$_tbody.="<td rowspan=\"".$num_size_group."\">结算金额</td>";
|
|
$_tbody.="</tr>";
|
|
for($i=1;$i<$num_size_group;$i++){
|
|
$_tbody.="<tr>".$size_tr[$i]."</tr>";
|
|
}
|
|
$sql_con="where (upath='".$upath."' or upath like '".$upath."-%') and ka<>'y'";
|
|
if($show_wd=="n"){
|
|
//-------不显示未订款
|
|
$q="select iid,no,price from ".$table_pre."order ".$sql_con." group by no order by 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();
|
|
while($m=$db->fetch_array($r)){
|
|
$bg=($count%2)?"#ffffff":"#f0f0f0";
|
|
$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 iid,color,bx,".get_size_sql("sum1").",sum(num) 'num',sum(je) 'je',sum(jsje) 'jsje',price from ".$table_pre."order ".$sql_con." and no='".$m["no"]."' group by color,bx order by color,bx";
|
|
//echo $q2."<br>";
|
|
$r2=$db->query($q2);
|
|
//
|
|
$j=0;
|
|
$je1=$jsje1=$num1=0;
|
|
while($m2=$db->fetch_array($r2)){
|
|
$td_size1="";
|
|
for($k=0;$k<$num_size_total;$k++){
|
|
$tmp_num=$m2["num_".$arr_size_merged[$k]];
|
|
//计算尺码合计
|
|
$v11="hj_num_".$k;
|
|
$$v11+=$tmp_num;
|
|
//
|
|
$td_size1.="<td x:num>".deel_td(deel_0($tmp_num))."</td>";
|
|
}
|
|
if($m2["num"]>0){
|
|
$arr_kh_color[$count][$j]="";
|
|
if($xh_ms=="2")
|
|
$arr_kh_color[$count][$j]="<td>".get_kh_xh($m1,$m2["color"])."</td>";
|
|
$arr_kh_color[$count][$j].="<td>".get_cate_title_no("color",$m2["color"])."</td><td>".$m2["color"]."</td>";
|
|
//if($bx_sizegroup_id>0)
|
|
if($bx_sizegroup_id>0 || $child_sizegroup_id>0)
|
|
$arr_kh_color[$count][$j].="<td>".deel_td($m2["bx"])."</td>";
|
|
if($is_gg=="y"){
|
|
//取得规格价格
|
|
$tmp=get_db_msg("select price from ".$table_pre."kh_gg where iid='".$m2["iid"]."' and color='".$m2["color"]."' and gg='".$m2["bx"]."'");
|
|
$arr_kh_color[$count][$j].="<td>".deel_td(get_gg_title($m2["bx"]))."</td><td>".deel_td($tmp["price"])."</td>";
|
|
}else if($is_gg=="b"){
|
|
$arr_kh_color[$count][$j].="<td>".deel_td(get_gg_title($m2["bx"]))."</td>";
|
|
}
|
|
$arr_kh_color[$count][$j].=$td_size1;
|
|
$j++;
|
|
}
|
|
$num1+=$m2["num"];
|
|
$je1+=$m2["je"];
|
|
$jsje1+=$m2["jsje"];
|
|
}
|
|
$total_num+=$num1;
|
|
$total_money+=$je1;
|
|
$total_money_zk+=$jsje1;
|
|
//
|
|
if($num1>0){
|
|
$arr_kh[$count]["id"]=$m1["id"];
|
|
$arr_kh[$count]["no"]=$m1["no"];
|
|
$arr_kh[$count]["title"]=$m1["title"];
|
|
if($xh_ms=="1"){
|
|
$xh=get_kh_xh($m1);
|
|
$arr_kh[$count]["xh"]=$xh;
|
|
}
|
|
$arr_kh[$count]["title"]=$m1["title"];
|
|
foreach($arr_zd as $k1 => $v1){
|
|
if($k1!="zd1" && $k1!="zd2" && $k1!="zd3")
|
|
$arr_kh[$count][$k1]=get_cate_title_no($k1,$m1[$k1]);
|
|
else
|
|
$arr_kh[$count][$k1]=$m1[$k1];
|
|
}
|
|
$arr_kh[$count]["num"]=$num1;
|
|
$arr_kh[$count]["price"]=$m["price"];
|
|
$arr_kh[$count]["je"]=$je1;
|
|
$arr_kh[$count]["jsje"]=$jsje1;
|
|
$count++;
|
|
}
|
|
}
|
|
//组合输出内容
|
|
$count=0;
|
|
for($i=0;$i<count($arr_kh);$i++){
|
|
$num1=count($arr_kh_color[$i]);
|
|
for($j=0;$j<$num1;$j++){
|
|
if($j==0){
|
|
$tmp_zd="";
|
|
foreach($arr_zd as $k1 => $v1){
|
|
$tmp_zd.="<td rowspan=\"".$num1."\">".deel_td($arr_kh[$i][$k1])."</td>";
|
|
}
|
|
$_tbody.="<tr>";
|
|
if($xh_ms=="1")
|
|
$_tbody.="<td rowspan=\"".$num1."\">".$arr_kh[$i]["xh"]."</td>";
|
|
$_tbody.="<td rowspan=\"".$num1."\">".$arr_kh[$i]["no"]."</td><td rowspan=\"".$num1."\">".$arr_kh[$i]["title"]."</td>".$tmp_zd;
|
|
if($is_gg!="y")
|
|
$_tbody.="<td rowspan=\"".$num1."\">".$arr_kh[$i]["price"]."</td>";
|
|
$_tbody.=$arr_kh_color[$i][$j]."<td rowspan=\"".$num1."\" x:num>".$arr_kh[$i]["num"]."</td><td rowspan=\"".$num1."\" x:num>".deel_num($arr_kh[$i]["je"])."</td>";
|
|
if(trim($zk_type) || $check_md["num"]>0)
|
|
$_tbody.="<td rowspan=\"".$num1."\" x:num>".deel_num($arr_kh[$i]["jsje"])."</td>";
|
|
$_tbody.="</tr>";
|
|
}else{
|
|
$_tbody.="<tr>".$arr_kh_color[$i][$j]."</tr>";
|
|
}
|
|
$count++;
|
|
}
|
|
}
|
|
}else{
|
|
//-------显示未订款,不合并款号
|
|
//取得订单表数据
|
|
$arr_order=array();
|
|
$q="select iid,color,bx,jsje/num 'price',sum(num) 'num',".get_size_sql("sum1").",sum(je) 'je',sum(jsje) 'jsje' from ".$table_pre."order ".$sql_con." group by iid,color,bx";
|
|
//echo $q."<br>";
|
|
$r=$db->query($q);
|
|
$total_num=$total_money=$total_money_zk=0;
|
|
$count=0;
|
|
$arr_kh=$arr_kh_color=array();
|
|
while($m=$db->fetch_array($r)){
|
|
$arr_order[$m["iid"]][$m["color"]][$m["bx"]]=$m;
|
|
}
|
|
//
|
|
//print_r($arr_order);
|
|
//
|
|
$arr_data=array();
|
|
$q="select id,no,color,color_ka,size from ".$table_pre."kh where ka<>'y' order by no";
|
|
$r=$db->query($q);
|
|
$i=0;
|
|
$count=0;
|
|
while($m=$db->fetch_array($r)){
|
|
//取得bx,size
|
|
$arr_bx_size=array();
|
|
$check_bx=get_db_msg("select count(*) 'num' from ".$table_pre."size_bx where no='".$m["no"]."'");
|
|
if($check_bx["num"]>0){
|
|
$q1="select no,bx,size from ".$table_pre."size_bx where no='".$m["no"]."'";
|
|
$r1=$db->query($q1);
|
|
while($m1=$db->fetch_array($r1)){
|
|
$arr_bx_size[$m1["bx"]]=$m1["size"];
|
|
}
|
|
}else{
|
|
$arr_bx_size[""]=$m["size"];
|
|
}
|
|
$arr_color=explode(",",$m["color"]);
|
|
$arr_color_ka=explode(",",$m["color_ka"]);
|
|
for($j=0;$j<count($arr_color);$j++){
|
|
if(!in_array($arr_color[$j],$arr_color_ka)){
|
|
foreach($arr_bx_size as $bx1 => $size1){
|
|
$arr_data[$count]["iid"]=$m["id"];
|
|
$arr_data[$count]["color"]=$arr_color[$j];
|
|
$arr_data[$count]["bx"]=$bx1;
|
|
$arr_size1=explode(",",$size1);
|
|
for($k=0;$k<count($arr_size1);$k++){
|
|
$arr_data[$count]["num_".$arr_size1[$k]]=$arr_order[$m["id"]][$arr_color[$j]][$bx1]["num_".$arr_size1[$k]];
|
|
}
|
|
$arr_data[$count]["num"]=$arr_order[$m["id"]][$arr_color[$j]][$bx1]["num"];
|
|
$arr_data[$count]["je"]=$arr_order[$m["id"]][$arr_color[$j]][$bx1]["je"];
|
|
$arr_data[$count]["jsje"]=$arr_order[$m["id"]][$arr_color[$j]][$bx1]["jsje"];
|
|
$count++;
|
|
}
|
|
}
|
|
}
|
|
$i++;
|
|
}
|
|
//print_r($arr_data);
|
|
//exit;
|
|
//输出
|
|
$total_num=$total_money=$total_money_zk=0;
|
|
for($i=0;$i<count($arr_data);$i++){
|
|
$msg_kh=get_db_msg("select * from ".$table_pre."kh where id='".$arr_data[$i]["iid"]."'");
|
|
$_tbody.="<tr>";
|
|
$_tbody.="<td>".get_kh_xh($msg_kh,$arr_data[$i]["color"])."</td>";
|
|
$tmp_zd="";
|
|
foreach($arr_zd as $k1 => $v1){
|
|
if($k1!="zd1" && $k1!="zd2" && $k1!="zd3")
|
|
$tmp1=get_cate_title_no($k1,$msg_kh[$k1]);
|
|
else
|
|
$tmp1=$msg_kh[$k1];
|
|
$tmp_zd.="<td>".deel_td($tmp1)."</td>";
|
|
}
|
|
$_tbody.="<td>".$msg_kh["no"]."</td><td>".$msg_kh["title"]."</td>".$tmp_zd;
|
|
if($is_gg!="y")
|
|
$_tbody.="<td>".deel_num(keep_float($arr_data[$i]["price"],1))."</td>";
|
|
$_tbody.="<td>".get_cate_title_no("color",$arr_data[$i]["color"])."</td>";
|
|
$_tbody.="<td>".$arr_data[$i]["color"]."</td>";
|
|
if($bx_sizegroup_id>0)
|
|
$arr_kh_color[$count][$j].="<td>".deel_td($m2["bx"])."</td>";
|
|
if($is_gg=="y"){
|
|
//取得规格价格
|
|
$tmp=get_db_msg("select price from ".$table_pre."kh_gg where iid='".$arr_data[$i]["iid"]."' and color='".$arr_data[$i]["color"]."' and gg='".$arr_data[$i]["bx"]."'");
|
|
$_tbody.="<td>".deel_td(get_gg_title($arr_data[$i]["bx"]))."</td><td>".deel_td($tmp["price"])."</td>";
|
|
}else if($is_gg=="b"){
|
|
$arr_kh_color[$count][$j].="<td>".deel_td(get_gg_title($arr_data[$i]["bx"]))."</td>";
|
|
}
|
|
if($bx_sizegroup_id>0 || $child_sizegroup_id>0)
|
|
$_tbody.="<td>".$m["bx"]."</td>";
|
|
//尺码
|
|
for($k=0;$k<$num_size_total;$k++){
|
|
$v1="hj_num_".$k;
|
|
$$v1+=$arr_data[$i]["num_".$arr_size_merged[$k]];
|
|
$_tbody.="<td x:num>".deel_0(deel_num($arr_data[$i]["num_".$arr_size_merged[$k]]))."</td>";
|
|
}
|
|
$_tbody.="<td x:num>".deel_0(deel_num($arr_data[$i]["num"]))."</td>";
|
|
$_tbody.="<td x:num>".deel_0(deel_num($arr_data[$i]["je"]))."</td>";
|
|
if(trim($zk_type) || $check_md["num"]>0)
|
|
$_tbody.="<td x:num>".deel_num($arr_data[$i]["jsje"])."</td>";
|
|
$_tbody.="</tr>";
|
|
$total_num+=$arr_data[$i]["num"];
|
|
$total_money+=$arr_data[$i]["je"];
|
|
$total_money_zk+=$arr_data[$i]["jsje"];
|
|
}
|
|
}
|
|
$tmp_zd_je="<td x:num>".$total_money."</td>";
|
|
if(trim($zk_type) || $check_md["num"]>0){
|
|
$tmp_zd_je.="<td x:num>".keep_float($total_money_zk,2)."</td>";
|
|
}
|
|
$td_size1="";
|
|
for($k=0;$k<$num_size_total;$k++){
|
|
$v1="hj_num_".$k;
|
|
$td_size1.="<td x:num>".deel_td($$v1)."</td>";
|
|
}
|
|
if($bx_sizegroup_id>0 || $child_sizegroup_id>0)
|
|
$colspan1=count($arr_zd)+7;
|
|
else
|
|
$colspan1=count($arr_zd)+6;
|
|
if($is_gg=="y")
|
|
$colspan1++;
|
|
else if($is_gg=="b")
|
|
$colspan1++;
|
|
$_tbody.="<tr><td colspan=\"".($colspan1)."\">合计</td>".$td_size1."<td x:num>".$total_num."</td>".$tmp_zd_je."</tr>";
|
|
$_tbody.="</table></body></html>";
|
|
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");
|
|
$sub=$_GET["sub"];
|
|
$id=$_GET["id"];
|
|
$list=$_GET["list"]?$_GET["list"]:1;
|
|
$is_dir=$_GET["is_dir"]?$_GET["is_dir"]:"n";
|
|
$show_wd=$_GET["show_wd"]?$_GET["show_wd"]:"n";
|
|
if($sub=="y"){
|
|
//
|
|
$xh_ms=get_set("xh_ms");
|
|
$check_md=get_db_msg("select count(*) 'num' from ".$table_pre."kh_md");
|
|
//文胸
|
|
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;
|
|
}
|
|
$zk_type=get_set("zk_type");
|
|
//
|
|
$sys_size_num=get_max_size_num();
|
|
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."client where face>'2'");
|
|
$total=$tmp["num"];
|
|
if(!$id){
|
|
//
|
|
$tmp=get_db_msg("select min(id) 'id' from ".$table_pre."client where face>'2'");
|
|
$this_id=$tmp["id"];
|
|
}else{
|
|
$tmp=get_db_msg("select min(id) 'id' from ".$table_pre."client where face>'2' and id>'".$id."'");
|
|
$this_id=$tmp["id"];
|
|
}
|
|
$m=get_db_msg("select * from ".$table_pre."client where id='".$this_id."'");
|
|
$upath=$m["path"]."-".$m["id"];
|
|
//检查是否有订单
|
|
$q1="select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where (upath='".$upath."' or upath like '".$upath."-%') and ka<>'y'";
|
|
$tmp=get_db_msg($q1);
|
|
if($tmp["num"]>0){
|
|
//echo $q."<br>";
|
|
$content=get_order_by_client($upath);
|
|
$file_name="订单明细_".get_main_value($arr_client_face,$m["face"])."_".$m["title"]."_".$m["username"].".xls";
|
|
if($is_dir=="y"){
|
|
//建立目录结构
|
|
$dir1="";
|
|
$arr_path=explode("-",$m["path"]);
|
|
for($j=0;$j<count($arr_path);$j++){
|
|
if($arr_path[$j]>0){
|
|
$m1=get_db_msg("select title from ".$table_pre."client where id='".$arr_path[$j]."'");
|
|
//$dir.="/".$m1["title"];
|
|
$dir1.="/".$m1["title"];
|
|
$dir=iconv("utf-8","gb2312",$dir1);
|
|
make_dir("xls".$dir);
|
|
}
|
|
}
|
|
}else{
|
|
$dir="/";
|
|
}
|
|
$file_name=iconv("utf-8","gb2312",$file_name);
|
|
write_file("xls".$dir,$file_name,$content);
|
|
$file_name=iconv("gb2312","utf-8",$file_name);
|
|
$list++;
|
|
echo $list."/".$total.":".$file_name.",输出完成,<a href=\"".$_SERVER[PHP_SELF]."?is_dir=".$is_dir."&show_wd=".$show_wd."\">暂停</a><br>";
|
|
}
|
|
$url=$_SERVER[PHP_SELF]."?sub=y&id=".$this_id."&list=".$list."&is_dir=".$is_dir."&show_wd=".$show_wd;
|
|
//取得最大id
|
|
$tmp=get_db_msg("select max(id) 'id' from ".$table_pre."client where face>'2'");
|
|
$db->close();
|
|
if($id<$tmp["id"]){
|
|
//
|
|
url_redirect($url);
|
|
}else{
|
|
echo $total."个客户订单输出完成(包含无订单的客户),位于admin/debug/xls/下面,请手动下载!";
|
|
}
|
|
exit;
|
|
}else{
|
|
$is_dir=$is_dir?$is_dir:"n";
|
|
$arr_is_dir=array("n"=>"同一个目录","y"=>"按照客户结构列出目录");
|
|
}
|
|
?>
|
|
<!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:0px;padding:0px;
|
|
}
|
|
a,a:link,a:visited,a:active {
|
|
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
|
|
}
|
|
a:hover {
|
|
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
|
|
}
|
|
body,input,td,select,div,li,ul,textarea,form {
|
|
font-family:宋体;
|
|
FONT-SIZE:12px;
|
|
}
|
|
.wrong{
|
|
color:#ff0000;font-weight:bold;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<br />
|
|
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
|
|
<form name="form1" action="<?php echo $_SERVER[PHP_SELF]; ?>" method="get">
|
|
<input type="hidden" name="sub" value="y">
|
|
<tr>
|
|
<td align="center" bgcolor="#f0f0f0"><b>导出每个客户的订单明细</b></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" bgcolor="#ffffff" style="line-height:25px;">文件目录方式<select name="is_dir"><?php echo get_main_op($arr_is_dir,$is_dir); ?></select> <select name="show_wd"><?php echo get_main_op(array("n"=>"不显示未订","y"=>"显示未订"),"n"); ?></select></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center" bgcolor="#f0f0f0"><input type="submit" value=" 执 行 "></td>
|
|
</tr>
|
|
<?php
|
|
if($msg){
|
|
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
|
|
}
|
|
?>
|
|
</form>
|
|
</table>
|
|
</body>
|
|
</html>
|