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

205 lines
7.8 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.
<?php
//-------------------------------订单打印
header("Content-type: text/html; charset=utf-8");
if(THIS_IN!="edt_admin")
exit("错误的访问!");
$msg_login_user=get_db_msg("select * from ".$table_pre."user where id='".$uid."'");
//---------priv
$priv=return_priv($_m,$msg_login_user["priv"]);
$json_data="{";
if($priv[0]=="n"){
//没有操作权限
$json_data.="\"error\":\"没有操作权限\",\"code\":0,\"msg\":\"\",\"count\":0,\"data\":[],";
}else{
//$arr_report=array("detail"=>d_translate("admin_order_print_detail"),"confirm"=>d_translate("admin_order_print_confirm"));
$arr_report=array("detail"=>d_translate("admin_order_print_detail"));
$_a=$_a?$_a:"detail";
$json_data.="\"uid\":".$uid.",";
$file_root1=dir_cutb(THIS_FILE_ROOT,1);
//有权限
//-----------------------tab
$str_tab="";
$i=0;
foreach($arr_report as $k => $v){
$str_tab.="{\"no\":\"".$k."\",\"title\":\"".$v."\"},";
}
$str_tab=deel_end($str_tab);
$json_data.="\"tab\":[".$str_tab."],";
$json_data.="\"s_cate\":\"".$_a."\",";
//-----------------------/tab
switch($_a){
case "detail" :
//明细单
require_once $file_root1."/tmpl/order_print_detail.php";
break;
case "get_table" :
require THIS_FILE_ROOT."/include/print.class.php";
//尺码前字段
$arr_zd1=array("xh"=>"圆牌号","no"=>"款号","category"=>"大类","color"=>"颜色","bx"=>"杯型","price"=>"价格");
//尺码后字段
$arr_zd2=array("num"=>"数量","je"=>"吊牌金额","jsje"=>"结算金额");
//是否显示颜色代码
$is_show_color="n";
//是否显示金额
$is_show_je="y";
//
$is_brand=is_brand();
$detail_size_ms=get_set("detail_size_ms");
$print_not_qr=get_set("print_not_qr");
$sys_size_num=get_max_size_num();
//查询条件定制
$s_ka="n";
$s_key=$_key;
$con=" and ka<> 'y'";
if($s_brand){
$con.=" and brand='".$s_brand."'";
$con_brand=" and brand='".$s_brand."'";
}else{
$con_brand="";
}
//杯型参数
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;
}
$con_u="";
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);
$confirm_str=$confirm_str1=$p_title=$error="";
for($i=0;$i<count($arr_username);$i++){
//检查是否存在
$m_client=get_db_msg("select * from ".$table_pre."client where username='".$arr_username[$i]."'");
if($is_brand=="y"){
$m_client_brand=get_db_msg("select is_checked from ".$table_pre."client_brand where cid='".$m_client["id"]."'".$con_brand." order by is_checked limit 0,1");
$is_checked=$m_client_brand["is_checked"];
}else{
$is_checked=$m_client["is_checked"];
}
//
if($m_client["id"]){
if($m_client["face"]=="4"){
$con_u.=" (uid='".$m_client["id"]."') or ";
if($is_checked!="y"){
$confirm_str.="<span style=\"color:#0000ff;\">".$arr_username[$i]."(未确认)</span>,";
$confirm_str1.=$arr_username[$i].",";
}else{
$confirm_str.="<span style=\"color:#ff0000;\">".$arr_username[$i]."(已确认)</span>,";
}
}else{
$con_u.=" (upath='".$m_client["path"]."-".$m_client["id"]."' or upath like '".$m_client["path"]."-".$m_client["id"]."-%') or ";
}
$p_title.=$m_client["title"]."(".$m_client["username"]."),";
}else{
$error.=$arr_username[$i].",";
}
}
}
//
$con_u_exp="";
if($s_username_exp){
$s_username_exp=str_replace("",",",$s_username_exp);
//去掉最后一个逗号
if(substr($s_username_exp,strlen($s_username_exp)-1,1)==",")
$s_username_exp1=substr($s_username_exp,0,-1);
else
$s_username_exp1=$s_username_exp;
$arr_username_exp=explode(",",$s_username_exp1);
//去掉重复值
$arr_username_exp=array_unique($arr_username_exp);
$title_exp="";
for($i=0;$i<count($arr_username_exp);$i++){
//检查是否存在
$m_client_exp=get_db_msg("select id,title from ".$table_pre."client where username='".$arr_username_exp[$i]."'");
//
if($m_client_exp["id"]){
$con_u_exp.=" (uid<>'".$m_client_exp["id"]."') and ";
$title_exp.=$m_client_exp["title"].",";
}
}
}
if($con_u)
$con.=" and (".substr($con_u,0,-3).") ";
if($con_u_exp)
$con.=" and (".substr($con_u_exp,0,-4).") ";
$sys_client_title=get_set("sys_client_title");
$dl=get_dl_title($m_client["path"]);
$title_dl=$dl?$dl."-":"";
if($title_exp)
$title_exp=",不含".substr($title_exp,0,-1);
//$_title="<div align=\"center\" style=\"font-size:20px;line-height:30px;\">".$sys_client_title."</div><div align=\"center\" style=\"font-size:15px;\">".$title_dl.substr($p_title,0,-1).$title_exp."明细单 ".date("Y年m月d日 H点i分")."<div>";
//$search_content.="<input type=\"button\" value=\"重新设置折扣\" onclick=\"o_window('?_m=".$_m."&_cid=".$_cid."&_a=set_zk&id=".$m_client["id"]."','set_zk',400,600)\">";
//-------------------处理尺码表头
//取得合并尺码
$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"]:"&nbsp;";
$size_tr[$num_size_group].="<td bgcolor=\"#dddddd\" align=\"center\" width=\"30\">".$t."</td>";
}
$arr_size_merged[]=$m1["no"];
$num_size_group++;
}
//-------------------/处理尺码表头结束
//仅在第一页显示但是表头
$p_head="<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td align='center' style='font-size:20px;line-height:30px;font-weight:bold;'>".$sys_client_title."</td></tr><tr><td align='center' style='font-size:15px;font-weight:bold;'>".$title_dl.substr($p_title,0,-1).$title_exp."明细单 ".date("Y年m月d日 H点i分")."</td></tr></table>";
//仅在最后一页显示的页尾
$p_foot="<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td align='left' width='50%' style='font-size:20px;font-weight:bold;' height='45' colspan=4>客户确认签字:</td><td align='left' width='50%' style='font-size:20px;font-weight:bold;' height='45' colspan=4>日期:</td></tr></table>";
$pt=new pt;
$pt->db=$db;
$pt->con=$con;
$pt->p_head=$p_head;
$pt->arr_zd2=$arr_zd2;
$pt->arr_zd1=$arr_zd1;
$pt->table_pre=$table_pre;
$pt->p_foot=$p_foot;
$pt->show_xs="n";
$pt->px="category";
$content=$pt->rt_table();
$json_data.="\"tb\":\"".$content."\",";
//是否打印预览
$json_data.="\"is_pre\":\"n\",";
break;
case "export" :
//导出
require_once $file_root1."/tmpl/order_print_export.php";
break;
case "set_log":
//记录日志
$arr_username=explode(",",$s_username);
for($i=0;$i<count($arr_username);$i++){
if($arr_username[$i]){
$m=get_db_msg("select id from ".$table_pre."client where username='".$arr_username[$i]."'");
if($m["id"]>0)
update_order_state($uid,$m["id"],"打印订单","");
}
}
break;
}
}
$json_data=substr($json_data,0,-1)."}";
echo $json_data;
?>