7e47ce238b
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
225 lines
8.6 KiB
PHP
225 lines
8.6 KiB
PHP
<?php
|
||
//-----------------------------------------------------后台->订单打印->明细单 for 劲霸
|
||
//--条件定制
|
||
//查询条件定制
|
||
$s_ka="n";
|
||
$s_key=$_key;
|
||
$con=" and ka<> 'y'";
|
||
$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].",";
|
||
}
|
||
}
|
||
if($con_u)
|
||
$con_u.="(".substr($con_u,0,-3).") and ";
|
||
}else{
|
||
$con_u=$con_u_all;
|
||
$p_title=$msg_login_user["title"]."(".$msg_login_user["username"]."),";
|
||
}
|
||
//
|
||
if($con_u)
|
||
$con.=" and (".substr($con_u,0,-4).") ";
|
||
$str="var clients = [\n";
|
||
for($i=0;$i<count($arr_dp);$i++){
|
||
$str.="{id:\"".$arr_dp[$i][0]."\",t:\"".$arr_dp[$i][3]."\",u:\"".$arr_dp[$i][1]."\",p:\"".$arr_dp[$i][2]."-".$arr_dp[$i][0]."\"},\n";
|
||
}
|
||
if($i>0)
|
||
$str=substr($str,0,-2);
|
||
$str.="];\n";
|
||
$js_function.=$str."\n$(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:200px\" value=\"".$s_username."\">";
|
||
$search_content.=" <input type=\"hidden\" name=\"sub\" value=\"yes\"><input type=submit value=\"提 交\" class=\"button_act\"> ";
|
||
if($sub=="yes"){
|
||
$sys_client_title=get_set("sys_client_title");
|
||
$dl=get_dl_title($m_client["path"]);
|
||
$title_dl=$dl?$dl."-":"";
|
||
$_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>";
|
||
//-------------------处理尺码表头
|
||
//取得合并尺码
|
||
$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 bgcolor=\"#dddddd\" align=\"center\" width=\"30\">".$t."</td>";
|
||
}
|
||
$arr_size_merged[]=$m1["no"];
|
||
$num_size_group++;
|
||
}
|
||
//-------------------/处理尺码表头结束
|
||
//----------------------------------------------取得订单记录
|
||
if($s_md=="y"){
|
||
//-------------------仅买断款
|
||
|
||
}else{
|
||
//包含买断款,非买断款
|
||
if($is_gg=="y"){
|
||
$t_je="金额";
|
||
}else{
|
||
$t_je="吊牌金额";
|
||
}
|
||
//表头
|
||
if($detail_size_ms=="2"){
|
||
|
||
}else{
|
||
$_tbody="<thead style=\"display:table-header-group;\"><tr><td rowspan=\"".$num_size_group."\" bgcolor=\"#dddddd\" align=\"center\">款式</td><td rowspan=\"".$num_size_group."\" bgcolor=\"#dddddd\" align=\"center\">款号</td><td rowspan=\"".$num_size_group."\" bgcolor=\"#dddddd\" align=\"center\">颜色</td>";
|
||
$_tbody.=$size_tr[0]."<td rowspan=\"".$num_size_group."\" align=\"center\" bgcolor=\"#dddddd\">小计</td><td rowspan=\"".$num_size_group."\" bgcolor=\"#dddddd\" align=\"center\">价格</td><td rowspan=\"".$num_size_group."\" bgcolor=\"#dddddd\" align=\"center\">金额</td></tr>";
|
||
for($i=1;$i<$num_size_group;$i++){
|
||
$_tbody.="<tr>".$size_tr[$i]."</tr>";
|
||
}
|
||
}
|
||
$_tbody.="</thead>";
|
||
//内容
|
||
$q="select iid,no,sum(je) 'je',sum(jsje) 'jsje' from ".$table_pre."order where _key='".$s_key."'".$con." group by no order by category,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"]."'");
|
||
//取得颜色,杯型
|
||
$q2="select color,".get_size_sql("sum1").",size_group_id,iid,sum(je) 'je',sum(jsje) 'jsje',price from ".$table_pre."order where _key='".$s_key."'".$con." and no='".$m["no"]."' group by color order by color";
|
||
//echo $q2."<br>";
|
||
$r2=$db->query($q2);
|
||
//
|
||
$j=0;
|
||
$num1=$je1=$jsje1=$price1=0;
|
||
while($m2=$db->fetch_array($r2)){
|
||
$td_size1="";
|
||
$num_color_hj=0;
|
||
for($k=0;$k<$num_size_total;$k++){
|
||
$tmp_num=$m2["num_".$arr_size_merged[$k]];
|
||
$sty1=$bg;
|
||
if($tmp_num>0){
|
||
$td_size1.="<td bgcolor=\"".$sty1."\" align=\"right\">".deel_td(deel_0($tmp_num))."</td>";
|
||
}else{
|
||
$td_size1.="<td bgcolor=\"".$sty1."\"> </td>";
|
||
}
|
||
//计算尺码合计
|
||
$v11="hj_num_".$k;
|
||
$$v11+=$tmp_num;
|
||
$num1+=$tmp_num;
|
||
$num_color_hj+=$tmp_num;
|
||
}
|
||
if($num_color_hj>0){
|
||
$arr_kh_color[$count][$j]="<td bgcolor=\"".$bg."\">".$m2["color"]."-".get_cate_title_no("color",$m2["color"])."</td>";
|
||
$arr_kh_color[$count][$j].=$td_size1;
|
||
$j++;
|
||
}
|
||
$price1+=$m2["price"];
|
||
$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"];
|
||
$xh=get_kh_xh($m1);
|
||
$arr_kh[$count]["xh"]=$xh;
|
||
$arr_kh[$count]["title"]=$m1["title"];
|
||
$arr_kh[$count]["category"]=get_cate_title_no("category",$m1["category"]);
|
||
$arr_kh[$count]["num"]=$num1;
|
||
$arr_kh[$count]["price"]=deel_num($m1["price"]);
|
||
$arr_kh[$count]["je"]=$num1*$m1["price"];
|
||
$count++;
|
||
}
|
||
}
|
||
//组合输出内容
|
||
$count=0;
|
||
for($i=0;$i<count($arr_kh);$i++){
|
||
$bg=($i%2)?"#ffffff":"#f0f0f0";
|
||
$num1=count($arr_kh_color[$i]);
|
||
for($j=0;$j<$num1;$j++){
|
||
if($j==0){
|
||
$_tcontent[$count]="<tr height=\"25\"><td bgcolor=\"".$bg."\" rowspan=\"".$num1."\">".get_cate_title_no("category",$arr_kh[$i]["category"])."</td><td bgcolor=\"".$bg."\" rowspan=\"".$num1."\">".$arr_kh[$i]["no"]."</td>".$tmp_zd.$arr_kh_color[$i][$j]."<td bgcolor=\"".$bg."\" rowspan=\"".$num1."\" align=\"right\">".$arr_kh[$i]["num"]."</td><td bgcolor=\"".$bg."\" rowspan=\"".$num1."\" align=\"right\">".$arr_kh[$i]["price"]."</td><td bgcolor=\"".$bg."\" rowspan=\"".$num1."\" align=\"right\">".deel_num($arr_kh[$i]["je"])."</td>";
|
||
$_tcontent[$count].="</tr>";
|
||
}else{
|
||
$_tcontent[$count]="<tr height=\"25\">".$arr_kh_color[$i][$j]."</tr>";
|
||
}
|
||
$count++;
|
||
}
|
||
}
|
||
$td_size1="";
|
||
for($k=0;$k<$num_size_total;$k++){
|
||
$v1="hj_num_".$k;
|
||
$td_size1.="<td bgcolor=\"#f0f0f0\" align=\"right\">".deel_td($$v1)."</td>";
|
||
}
|
||
$jj=$total_num>0?round($total_money/$total_num):" ";
|
||
$_tcontent[$count]="<tr height=\"25\"><td colspan=\"3\" align=\"right\" bgcolor=\"#f0f0f0\">合计</td>".$td_size1."<td bgcolor=\"#f0f0f0\" align=\"right\">".$total_num."</td><td bgcolor=\"#f0f0f0\" align=\"right\">".$jj."</td><td bgcolor=\"#f0f0f0\" align=\"right\">".$total_money."</td></tr>";
|
||
}
|
||
$bottom_button="<input type=\"button\" name=\"s1\" value=\"打 印\" onclick=\"start_print()\">";
|
||
}
|
||
?>
|