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/pc/tmpl/备用/order_tm_export(for 玛斯米亚).php
wsh5485 7e47ce238b chore: 添加多个图片和资源文件
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
2025-06-15 13:04:37 +08:00

96 lines
3.6 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?
//-----------------------------------------------------后台->订单条码导出 for 玛斯米亚
//----------------------------------------------------------------------------合并多客户数据,客户代码用,号分隔
$s_key=$s_key?$s_key:$_key;
$sql_con.="ka<>'y' and ";
$sql_con.="_key='".$_key."' and ";
//构建店铺条件
$con_u="";
$yh="";
if($s_username){
$s_username=str_replace("",",",$s_username);
//去掉最后一个逗号
if(substr($s_username,strlen($s_username)-1,1)==",")
$s_username1=substr($s_username,0,-1);
else
$s_username1=$s_username;
$arr_username=explode(",",$s_username1);
//去掉重复值
$arr_username=array_unique($arr_username);
for($i=0;$i<count($arr_username);$i++){
//检查是否存在
$m_client=get_db_msg("select * from ".$table_pre."client where username='".$arr_username[$i]."'");
//
if($m_client["id"]){
if($m_client["face"]=="4"){
$con_u.=" (uid='".$m_client["id"]."') or ";
}else{
$con_u.=" (upath='".$m_client["path"]."-".$m_client["id"]."' or upath like '".$m_client["path"]."-".$m_client["id"]."-%') or ";
}
$yh.=$m_client["username"].",";
}
}
}
if($con_u)
$sql_con.="(".substr($con_u,0,-3).") and ";
if($sql_con)
$sql_con="where ".substr($sql_con,0,-4);
if($yh)
$yh=substr($yh,0,-1);
//取得店铺框
$js_function=get_client_autocompelete("","n")."\n";
$js_function.="$(function() {
$('#s_username').autocomplete(clients, {
max: 100, //列表里的条目数
minChars: 0, //自动完成激活之前填入的最小字符
width: 300, //提示的宽度,溢出隐藏
scrollHeight: 300, //提示的高度,溢出显示滚动条
matchContains: true, //包含匹配,就是data参数里的数据,是否只要包含文本框里的数据就显示
autoFill: false, //自动填充
multiple:true,
multipleSeparator:',',
formatItem: function(row, i, max) {
return row.t+'('+row.u+')';
},
formatMatch: function(row, i, max) {
return row.t + row.u;
},
formatResult: function(row) {
return row.u;
}
}).result(function(event, row, formatted) {
$('#s_username').value=row.u;
});
});";
$search_content.="店铺:<input type=text name=\"s_username\" id=\"s_username\" style=\"width:300px\" value=\"".$s_username."\">";
$search_content.=" <input type=submit value=\"提交\" class=\"button_act\"> ";
if($con_u){
//开始导出数据
$dump="客户\t日期\t货号\t单价\t数量\r\n";
$arr_size_merged=get_size_merged();
$num_size_total=count($arr_size_merged);
$query="select iid,".get_size_sql("sum1")."color from ".$table_pre."order ".$sql_con." group by no,color order by no";
//echo $query."<br>";
$res=$db->query($query);
while($m=$db->fetch_array($res)){
$m_kh=get_db_msg("select * from ".$table_pre."kh where id='".$m["iid"]."'");
for($i=1;$i<11;$i++){
if($m["num_".$i]>0){
$tmp=get_db_msg("select * from ".$table_pre."size where iid='".$m_kh["size_group"]."' and no='".$i."'");
$m_color=get_db_msg("select * from ".$table_pre."keyword where no='".$m["color"]."' and cate='color'");
$m_season=get_db_msg("select * from ".$table_pre."keyword where cate='season' and no='".$m_kh["season"]."'");
//$tm=trim($m["no"]).trim($m["color"]).trim($tmp["no_tm"]);
$dump.=$yh."\t".date("Y-m-d H:i:s")."\t".$m_kh["no"]."-".$m["color"]."-".$tmp["title"]."\t".$m_kh["price"]."\t".$m["num_".$i]."\r\n";
}
}
}
//
$filename="tm_".date("YmdHis").".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 $dump;
}else{
include template("report");
}
?>