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

200 lines
8.5 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
//-----------------------------------------------------后台->订单打印->确认单
//一维
$canshu="category";
//二维
$s_group_by1="bc";
$s_group_by2="category";
//查询条件定制
header("Content-type: text/html; charset=utf-8");
$sys_size_num=get_max_size_num();
$s_key=$_key;
$s_ka="n";
$s_key=$_key;
$con=" and ka<> 'y'";
$_tcontent=array();
$_tcontent2=array();
$biaoer=array();
$biaosan_hj=array();
//
$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=$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($m_client["id"]){
if($m_client["face"]=="4"){
$con_u.=" (uid='".$m_client["id"]."') or ";
if($m_client["is_checked"]!="y"){
$error_confirm.=$arr_username[$i].",";
$confirm_str.="<span style=\"color:#0000ff;\">".$arr_username[$i]."(未确认)</span>,";
}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].",";
}
}
}
if($con_u)
$con.=" and (".substr($con_u,0,-3).") ";
if($confirm_str)
$confirm_str=substr($confirm_str,0,-1);
$json_data.="\"s_username\":\"".$s_username."\",";
if($sub){
$sys_client_title=get_set("sys_client_title");
$dl=get_dl_title($m_client["path"]);
$title_dl=$dl?$dl."-":"";
$_title="".$sys_client_title."<br>".$title_dl.substr($p_title,0,-1)."确认单 ".date("Y年m月d日 H点i分")."";
$json_data.="\"top_title\":\"".$_title."\",";
//$search_content.="<input type=\"button\" value=\"重新设置折扣\" onclick=\"o_window('?_m=".$_m."&_cid=".$_cid."&_a=set_zk&id=".$m_client["id"]."','set_zk',400,600)\">";
//----------------------------------------------
//$tmp=get_db_msg("");
$je_w=$m_client["order_money_zk"];
$je_w=$je_w/10000;
//表头
$json_data1="[\"总件数\",\"总金额\",\"指标金额\",\"完成率\"],[\"".$m_client["order_num"]."\",\"".$m_client["order_num"]."\",\"".$je_w."\",\"".deel_bfb1($je_w,$m_client["zb"],2)."\"],";
$json_data2_th="\"".get_cate_title_no("arr_select",$canshu)."\",\"设计款数\",\"已订款数\",\"已订件数\",\"已订金额\"";
$json_data3_th="\"".get_cate_title_no("arr_select",$s_group_by1)."\",\"".get_cate_title_no("arr_select",$s_group_by2)."\",\"设计款数\",\"已订款数\",\"已订件数\",\"已订金额\"";
$jia="";
$con1=" and ka<>'y'";
$q4="select * from ".$table_pre."keyword where cate='".$canshu."' order by no";
$r4=$db->query($q4);
while($m4=$db->fetch_array($r4)){
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ".$canshu."='".$m4["no"]."'".$con1);
$tmp_z_ks=$tmp["num"];
//取得款数
$tmp=get_db_msg("select count(distinct no) 'num' from ".$table_pre."order where _key='".$s_key."' and ".$canshu."='".$m4["no"]."'".$con);
$tmp_yd_ks=$tmp["num"];
//取得数量
$tmp=get_db_msg("select sum(".get_size_sql("sum").") 'num',sum((".get_size_sql("sum").")*price) 'je' from ".$table_pre."order where _key='".$s_key."' and ".$canshu."='".$m4["no"]."'".$con);
$tmp_yd_js=$tmp["num"];
$tmp_yd_je=$tmp["je"];
$biaoer_sjks+=$tmp_z_ks;
$biaoer_ydks+=$tmp_yd_ks;
$biaoer_ydjs+=$tmp_yd_js;
$biaoer_ydje+=$tmp_yd_je;
$biaoer[$jia]="[\"".$m4["title"]."\",\"".$tmp_z_ks."\",\"".deel_td($tmp_yd_ks)."\",\"".deel_td($tmp_yd_js)."\",\"".deel_td($tmp_yd_je)."\"],";
$jia++;
}
$q4="select * from ".$table_pre."keyword where cate='".$s_group_by1."' order by no";
$r4=$db->query($q4);
//取得已订总件数和金额
$tmp=get_db_msg("select sum(num) 'num',sum(jsje) 'je' from ".$table_pre."order where ".$s_group_by1."<>'' and ".$s_group_by2."<>'' ".$con);
$total_yd_js=$tmp["num"];
$total_yd_je=$tmp["je"];
//
//取得已订总款数
$tmp=get_db_msg("select count(distinct no) 'num' from ".$table_pre."order where ".$s_group_by1."<>'' and ".$s_group_by2."<>'' ".$con);
$total_yd_ks=$tmp["num"];
$count=0;
while($m4=$db->fetch_array($r4)){
$q="select * from ".$table_pre."keyword where cate='".$s_group_by2."' order by no";
//echo $q."<br>";
$r=$db->query($q);
//取得已订小计款数
$tmp=get_db_msg("select count(distinct no) 'num' from ".$table_pre."order where ".$s_group_by1."='".$m4["no"]."' and ".$s_group_by1."<>'' and ".$s_group_by2."<>'' ".$con);
$xj_yd_ks=$tmp["num"];
//
$xj_z_ks=$xj_z_sku=0;
$count1=0;
$biao_sjks=$biao_ydks=$biao_ydjs=$biao_ydje=0;
while($m=$db->fetch_array($r)){
$con1=" and ka<>'y'";
//
//取得款数
$tmp=get_db_msg("select count(distinct no) 'num' from ".$table_pre."order where _key='".$s_key."' and ".$s_group_by1."='".$m4["no"]."' and ".$s_group_by2."='".$m["no"]."'".$con);
$tmp_yd_ks=$tmp["num"];
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ".$s_group_by1."='".$m4["no"]."' and ".$s_group_by2."='".$m["no"]."'".$con1);
$tmp_z_ks=$tmp["num"];
$total_ks+=$tmp_z_ks;
$xj_z_ks+=$tmp_z_ks;
//取得数量
$tmp=get_db_msg("select sum(".get_size_sql("sum").") 'num',sum((".get_size_sql("sum").")*price) 'je' from ".$table_pre."order where _key='".$s_key."' and ".$s_group_by1."='".$m4["no"]."' and ".$s_group_by2."='".$m["no"]."'".$con);
$tmp_yd_js=$tmp["num"];
$tmp_yd_je=$tmp["je"];
if($zk_type=="y1"){
//取得折扣金额
$zk=$m_client["zk"];
$zk=($zk>0)?$zk:"100";
$tmp_yd_je=$tmp_yd_je*$zk/100;
}else if($zk_type=="y2"){
$zk=get_zk($m_client["id"],$m["no"]);
$zk=($zk>0)?$zk:"100";
$tmp_yd_je=$tmp_yd_je*$zk/100;
}
//取得合并单元格的数量
$num_group2=0;
$q_tmp="select * from ".$table_pre."keyword where cate='".$s_group_by2."'";
$r_tmp=$db->query($q_tmp);
while($m_tmp=$db->fetch_array($r_tmp)){
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ".$s_group_by1."='".$m4["no"]."' and ".$s_group_by2."='".$m_tmp["no"]."'".$con1);
if($tmp["num"]>0)
$num_group2++;
}
//
//echo $num_group2;
if($tmp_z_ks>0){
if($count1==0){
$_tcontent[$count]="[\"".$num_group2.":rs|".deel_td($m4["title"])."\",\"".deel_td($m["title"])."\",\"".deel_td($tmp_z_ks)."\",\"".deel_td($tmp_yd_ks)."\",\"".deel_td($tmp_yd_js)."\",\"".deel_td($tmp_yd_je)."\"],";
$_tcontent2[$count]=$num_group2;
}
else{
$_tcontent[$count]="[\"".deel_td($m4["title"])."\",\"".deel_td($m["title"])."\",\"".deel_td($tmp_z_ks)."\",\"".deel_td($tmp_yd_ks)."\",\"".deel_td($tmp_yd_js)."\",\"".deel_td($tmp_yd_je)."\"],";
$_tcontent2[$count]=$num_group2;
}
$count++;
$count1++;
$biao_sjks+=deel_td($tmp_z_ks);
$biao_ydks+=deel_td($tmp_yd_ks);
$biao_ydjs+=deel_td($tmp_yd_js);
$biao_ydje+=deel_td($tmp_yd_je);
}
}
if($count1==0){
$_tcontent[$count]="[\"".$num_group2.":rs|".deel_td($m4["title"])."\",\"".deel_td($m["title"])."\",\"".deel_td($tmp_z_ks)."\",\"".deel_td($tmp_yd_ks)."\",\"".deel_td($tmp_yd_js)."\",\"".deel_td($tmp_yd_je)."\"],";
$count++;
}
$_tcontent[$count]="[\"haha|".deel_td($m4["title"])."合计\",\"".$biao_sjks."\",\"".$biao_ydks."\",\"".$biao_ydjs."\",\"".$biao_ydje."\"],";
$count++;
}
//$_tcontent[$count]="<tr><td colspan=\"2\" bgcolor=\"#cccccc\">总计</td><td bgcolor=\"#cccccc\">".deel_td($total_ks)."</td><td bgcolor=\"#cccccc\">".deel_td($total_yd_ks)."</td><td bgcolor=\"#cccccc\">".deel_td($total_yd_js)."</td><td bgcolor=\"#cccccc\">".deel_td(deel_num($total_yd_je))."</td></tr>";
}
foreach($_tcontent as $value)
{
$json_data3_tb.=$value;
}
foreach($biaoer as $value)
{
$json_data2_tb.=$value;
$check_num++;
}
foreach($biaosan_hj as $value)
{
$json_data3_hj.=$value;
}
foreach($_tcontent2 as $value)
{
$json_data3_xj.=$value.",";
}
if($check_num)
$biaoer_hj="\"合计\",\"".$biaoer_sjks."\",\"".$biaoer_ydks."\",\"".$biaoer_ydjs."\",\"".$biaoer_ydje."\"";
$json_data.="\"table1\":[".substr($json_data1,0,-1)."],\"table2_th\":[".$json_data2_th."],\"table2_td\":[".substr($json_data2_tb,0,-1)."],\"table2_hj\":[".$biaoer_hj."],\"table3_th\":[".$json_data3_th."],\"table3_td\":[".substr($json_data3_tb,0,-1)."],\"table3_hj\":[".substr($json_data3_hj,0,-1)."],\"table3_xj\":[".substr($json_data3_xj,0,-1)."],";
?>