7e47ce238b
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
202 lines
8.8 KiB
PHP
202 lines
8.8 KiB
PHP
<?
|
||
//-----------------------------------------------------后台->订单打印->明细单 for 纳纹
|
||
//
|
||
function get_client_autocompelete1($face=''){
|
||
global $db,$table_pre;
|
||
$str="var clients = [\n";
|
||
//$str.="{id:\"all\",t:\"-所有客户-\",u:\"all\",p:\"0\"},\n";
|
||
$con=$face?" where face='".$face."'":"";
|
||
$q="select id,title,username,path,CONCAT(path,'-',id) 'abs_path' from ".$table_pre."client ".$con." order by abs_path";
|
||
$r=$db->query($q);
|
||
$i=0;
|
||
while($m=$db->fetch_array($r)){
|
||
$str.="{id:\"".$m["id"]."\",t:\"".$m["title"]."\",u:\"".$m["username"]."\",p:\"".$m["path"]."-".$m["id"]."\"},\n";
|
||
$i++;
|
||
}
|
||
if($i>0)
|
||
$str=substr($str,0,-2);
|
||
$str.="];\n";
|
||
return $str;
|
||
}
|
||
//p1
|
||
if(THIS_IN!="edt_admin")
|
||
exit("错误的访问!");
|
||
//--------------------------------------------
|
||
//查询条件定制
|
||
$s_ka="n";
|
||
$s_key=$_key;
|
||
$s_is_hb=$s_is_hb?$s_is_hb:"y";
|
||
$con="";
|
||
if($s_ka)
|
||
$con.=" and ka='".$s_ka."'";
|
||
if($s_bc)
|
||
$con.=" and bc='".$s_bc."'";
|
||
if($s_category)
|
||
$con.=" and category='".$s_category."'";
|
||
//
|
||
$error="";
|
||
$error_confirm="";
|
||
$confirm_str="";
|
||
$con_u="";
|
||
if($s_username){
|
||
$s_username=str_replace(",",",",$s_username);
|
||
$arr_username=explode(",",$s_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 ";
|
||
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 ";
|
||
}
|
||
}else{
|
||
$error.=$arr_username[$i].",";
|
||
}
|
||
}
|
||
}
|
||
if($con_u)
|
||
$con.=" and (".substr($con_u,0,-3).") ";
|
||
if($error){
|
||
$error=substr($error,0,-1);
|
||
alert_and_back("用户代码有错,请检查(".$error.")");
|
||
}
|
||
|
||
if($error_confirm){
|
||
$error_confirm=substr($error_confirm,0,-1);
|
||
alert_and_back("以下用户未确认,请检查(".$error_confirm.")");
|
||
}
|
||
|
||
|
||
//取得店铺框
|
||
$js_function=get_client_autocompelete1()."\n";
|
||
$js_function.="$(function() {
|
||
$('#s_dp').autocomplete(clients, {
|
||
max: 100, //列表里的条目数
|
||
minChars: 0, //自动完成激活之前填入的最小字符
|
||
width: 400, //提示的宽度,溢出隐藏
|
||
scrollHeight: 300, //提示的高度,溢出显示滚动条
|
||
matchContains: true, //包含匹配,就是data参数里的数据,是否只要包含文本框里的数据就显示
|
||
autoFill: false, //自动填充
|
||
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) {
|
||
var username_new='';
|
||
var username_old=document.form1.s_username.value;
|
||
if(username_old)
|
||
username_new=username_old+','+row.u;
|
||
else
|
||
username_new=row.u;
|
||
document.form1.s_username.value=username_new;
|
||
$('#s_dp').value=row.u;
|
||
});
|
||
});";
|
||
$search_content.="店铺查询: <input type=text name=\"s_dp\" id=\"s_dp\" style=\"width:80px\" onfocus=\"this.select();\" value=\"".$s_dp."\">";
|
||
$search_content.="用户代码: <input type=text name=\"s_username\" id=\"s_username\" style=\"width:200px\" onfocus=\"this.select()\" value=\"".$s_username."\">(多个用户用英文逗号分隔)";
|
||
$search_content.=" <input type=submit value=\"提交\" class=\"button_act\"> ";
|
||
if($confirm_str)
|
||
$confirm_str=substr($confirm_str,0,-1);
|
||
$search_content.=$confirm_str;
|
||
if($m_client["id"]>0){
|
||
//-------------------处理尺码表头
|
||
//取得合并尺码
|
||
$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\">".deel_td($t)."</td>";
|
||
}
|
||
$arr_size_merged[]=$m1["no"];
|
||
$num_size_group++;
|
||
}
|
||
//-------------------/处理尺码表头结束
|
||
//----------------------------------------------取得订单记录
|
||
$_tbody="<tr><td rowspan=\"".$num_size_group."\" bgcolor=\"#dddddd\" align=\"center\">客户</td><td rowspan=\"".$num_size_group."\" bgcolor=\"#dddddd\" align=\"center\" width=\"70\">款号</td><td rowspan=\"".$num_size_group."\" width=\"50\" bgcolor=\"#dddddd\" align=\"center\">单价(元)</td><td rowspan=\"".$num_size_group."\" bgcolor=\"#dddddd\" align=\"center\" width=\"30\">波段</td><td rowspan=\"".$num_size_group."\" bgcolor=\"#dddddd\" align=\"center\" width=\"50\">类别</td><td rowspan=\"".$num_size_group."\" bgcolor=\"#dddddd\" align=\"center\" width=\"50\">颜色</td><td rowspan=\"".$num_size_group."\" bgcolor=\"#dddddd\" align=\"center\" width=\"50\">颜色代码</td>".$size_tr[0]."<td width=\"40\" rowspan=\"".$num_size_group."\" align=\"center\" bgcolor=\"#dddddd\">小计</td></tr>";
|
||
for($i=1;$i<$num_size_group;$i++){
|
||
$_tbody.="<tr>".$size_tr[$i]."</tr>";
|
||
}
|
||
if($s_is_hb=="y"){
|
||
//合并款号的
|
||
$q="select * from ".$table_pre."order where _key='".$s_key."'".$con." group by uid,no order by uid,add_date desc";
|
||
}else{
|
||
//不合并款号的
|
||
$q="select * from ".$table_pre."order where _key='".$s_key."'".$con." order by uid,no,color";
|
||
}
|
||
//echo $q."<br>";
|
||
$r=$db->query($q);
|
||
$total_num=$total_money=0;
|
||
$count=0;
|
||
$c=0;
|
||
while($m=$db->fetch_array($r)){
|
||
$list=$count+1;
|
||
//$bg=($count%2)?"#ffffff":"#f0f0f0";
|
||
$bg="#ffffff";
|
||
$m1=get_db_msg("select * from ".$table_pre."kh where id='".$m["iid"]."'");
|
||
$m_client=get_db_msg("select * from ".$table_pre."client where id='".$m["uid"]."'");
|
||
if($s_is_hb=="y"){
|
||
//合并款号的
|
||
//取得颜色
|
||
$tmp1=get_db_msg("select count(distinct color) 'num',sum(".get_size_sql("sum").") 'xj_num',sum((".get_size_sql("sum").")*price) 'xj_money' from ".$table_pre."order where _key='".$s_key."'".$con." and no='".$m["no"]."' and uid='".$m_client["id"]."'");
|
||
$num1=$tmp1["num"];
|
||
$q2="select ".$sql_sum_num."color from ".$table_pre."order where _key='".$s_key."'".$con." and no='".$m["no"]."' and uid='".$m_client["id"]."' group by color";
|
||
//echo $q2."<br>";
|
||
$r2=$db->query($q2);
|
||
//有多种颜色
|
||
$j=0;
|
||
while($m2=$db->fetch_array($r2)){
|
||
$num=0;
|
||
$td_size1="";
|
||
for($k=0;$k<$num_size_total;$k++){
|
||
$num+=$m2["num_".$arr_size_merged[$k]];
|
||
$v11="hj_num_".$k;
|
||
$$v11+=$m2["num_".$arr_size_merged[$k]];
|
||
$td_size1.="<td bgcolor=\"".$bg."\">".deel_td($m2["num_".$arr_size_merged[$k]])."</td>";
|
||
}
|
||
$money=$num*$m1["price"];
|
||
$total_num+=$num;
|
||
$total_money+=$money;
|
||
if($j==0)
|
||
$_tcontent[$count]="<tr height=\"25\"><td bgcolor=\"".$bg."\" rowspan=\"".$num1."\" align=\"left\">".$m_client["title"]."</td><td bgcolor=\"".$bg."\" rowspan=\"".$num1."\">".$m1["no"]."</td><td bgcolor=\"".$bg."\" rowspan=\"".$num1."\">".$m1["price"]."</td><td bgcolor=\"".$bg."\" rowspan=\"".$num1."\">".deel_td(get_cate_title_no("bc",$m1["bc"]))."</td><td bgcolor=\"".$bg."\" rowspan=\"".$num1."\">".deel_td(get_cate_title_no("category",$m1["category"]))."</td><td bgcolor=\"".$bg."\">".get_cate_title_no("color",$m2["color"])."</td><td bgcolor=\"".$bg."\">".$m2["color"]."</td>".$td_size1."<td bgcolor=\"".$bg."\" rowspan=\"".$num1."\" align=\"right\">".deel_td($tmp1["xj_num"])."</td></tr>";
|
||
else
|
||
$_tcontent[$count]="<tr height=\"25\"><td bgcolor=\"".$bg."\">".get_cate_title_no("color",$m2["color"])."</td><td bgcolor=\"".$bg."\">".$m2["color"]."</td>".$td_size1."</tr>";
|
||
$j++;
|
||
$count++;
|
||
}
|
||
$c++;
|
||
}
|
||
}
|
||
$td_size1="";
|
||
for($k=0;$k<$num_size_total;$k++){
|
||
$v1="hj_num_".$k;
|
||
$td_size1.="<td bgcolor=\"".$bg."\">".deel_td($$v1)."</td>";
|
||
}
|
||
$_tcontent[$count]="<tr height=\"25\"><td colspan=\"7\" align=\"right\" bgcolor=\"#f0f0f0\">合计</td>".$td_size1."<td bgcolor=\"#f0f0f0\" align=\"right\">".$total_num."</td></tr>";
|
||
$bottom_button="<input type=\"button\" name=\"s1\" value=\"打 印\" onclick=\"start_print()\">";
|
||
}
|
||
?>
|