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

292 lines
10 KiB
PHP

<?php
//-------------------------------------------------------导出订单总表,尺码竖排
function get_order_by_client($start,$end){
global $table_pre,$db,$bx_sizegroup_title,$child_sizegroup_title,$xh_ms,$is_gg,$sys_gg_zd;
$_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);
//文胸
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.="<tr><td bgcolor=\"#f0f0f0\" align=\"center\">".d_translate("qy")."</td><td bgcolor=\"#f0f0f0\" align=\"center\">".d_translate("dl")."</td><td bgcolor=\"#f0f0f0\" align=\"center\">客户名称</td><td bgcolor=\"#f0f0f0\" align=\"center\">客户代码</td><td bgcolor=\"#f0f0f0\" align=\"center\">序号</td><td bgcolor=\"#f0f0f0\" align=\"center\">款号</td><td bgcolor=\"#f0f0f0\" align=\"center\">款式名</td>";
//取得定制选项
$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.="<td bgcolor=\"#f0f0f0\" align=\"center\">".get_cate_title_no("arr_select",$m["no"])."</td>";
$num_dz++;
}
$_tbody.="<td bgcolor=\"#f0f0f0\" align=\"center\">吊牌价</td><td bgcolor=\"#f0f0f0\" align=\"center\">颜色名称</td><td bgcolor=\"#f0f0f0\" align=\"center\">颜色代码</td>";
if($bx_sizegroup_id>0)
$_tbody.="<td bgcolor=\"#f0f0f0\" align=\"center\">杯型</td>";
else if($child_sizegroup_id>0)
$_tbody.="<td rowspan=\"".$num_size_group."\">款型</td>";
if($is_gg!="n")
$_tbody.="<td bgcolor=\"#f0f0f0\" align=\"center\">".d_translate("gg")."</td>";
$_tbody.="<td align=\"center\" bgcolor=\"#f0f0f0\">尺码</td><td align=\"center\" bgcolor=\"#f0f0f0\">数量</td></tr>";
}
$sql_con="where ka<>'y'";
$q="select * from ".$table_pre."order ".$sql_con." order by id limit ".$start.",".$end;
//echo $q."<br>";
$r=$db->query($q);
$count=0;
while($m=$db->fetch_array($r)){
$m_client=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($m_client["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($m_client["path"]);
if($dl_id){
$tmp=get_db_msg("select title from ".$table_pre."client where id='".$dl_id."'");
$dl=$tmp["title"];
}else{
$dl="";
}
//取得定制选项
$tr_dz="";
$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")
$tr_dz.="<td>".$msg_kh[$m2["no"]]."</td>";
else
$tr_dz.="<td>".get_cate_title_no($m2["no"],$m[$m2["no"]])."</td>";
}
for($k=0;$k<$num_size_total;$k++){
$num=$m["num_".$arr_size_merged[$k]];
if($num>0){
//取得尺码名称
$tmp=get_db_msg("select title from ".$table_pre."size where iid='".$m["size_group_id"]."' and no='".$arr_size_merged[$k]."'");
$_tbody.="<tr height=\"25\"><td>".$qy."</td><td>".$dl."</td><td>".$m_client["title"]."</td><td>".$m_client["username"]."</td><td>".get_kh_xh($msg_kh,$m["color"])."</td><td>".$m["no"]."</td><td>".$msg_kh["title"]."</td>";
$_tbody.=$tr_dz;
$_tbody.="<td>".$m["price"]."</td><td>".get_cate_title_no("color",$m["color"])."</td><td>".$m["color"]."</td>";
if($bx_sizegroup_id>0 || $child_sizegroup_id>0)
$_tbody.="<td>".$m["bx"]."</td>";
if($is_gg!="n")
$_tbody.="<td>".get_gg_title($m["bx"])."</td>";
$_tbody.="<td>".$tmp["title"]."</td><td x:num>".$num."</td></tr>";
}
}
}
$_tbody.="</table></body></html>";
$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:20000;
$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="order_detail_all_s-".$list.".xls";
$file_name=iconv("utf-8","gb2312",$file_name);
write_file("xls",$file_name,$content);
echo $list*$step."/".$total_num."条记录导出完成(".$file_name."),位于<a href='xls/'>admin/debug/xls</a>下面,请手动下载!";
$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="order_detail_all_s-".$list.".xls";
$file_name=iconv("utf-8","gb2312",$file_name);
write_file("xls",$file_name,$content);
echo $total_num."条记录导出完成(共".$list."个文件),位于<a href='xls/'>admin/debug/xls</a>下面,请手动下载!";
}
exit;
}else{
$step=20000;
}
?>
<!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;">单文件订单条数<input type="text" name="step" value="<?php echo $step; ?>" style="width:60px;">条 (如果执行超时,请减小条数)</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>