7e47ce238b
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
145 lines
6.9 KiB
PHP
145 lines
6.9 KiB
PHP
<?php
|
||
//-----------------------------------------------------后台->订单打印->明细单 for 劲霸汇总到商品名称
|
||
//--条件定制
|
||
$s_group_by="category1";
|
||
//--条件定制
|
||
//查询条件定制
|
||
$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).") ";
|
||
//echo $con."<br>";
|
||
$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>";
|
||
//----------------------------------------------取得订单记录
|
||
if($s_md=="y"){
|
||
//-------------------仅买断款
|
||
|
||
}else{
|
||
//包含买断款,非买断款
|
||
//表头
|
||
$th_je="";
|
||
$_tbody="<thead style=\"display:table-header-group;\"><tr><td rowspan=\"2\" bgcolor=\"#dddddd\" align=\"center\">".get_cate_title_no("arr_select","sxz")."</td><td rowspan=\"2\" bgcolor=\"#dddddd\" align=\"center\">".get_cate_title_no("arr_select","category")."</td><td rowspan=\"2\" bgcolor=\"#dddddd\" align=\"center\">".get_cate_title_no("arr_select",$s_group_by)."</td><td colspan=\"2\" align=\"center\" bgcolor=\"#dddddd\">订货</td><td colspan=\"2\" align=\"center\" bgcolor=\"#dddddd\">生效</td><td colspan=\"2\" align=\"center\" bgcolor=\"#dddddd\">删单</td></tr>";
|
||
$_tbody.="<tr><td bgcolor=\"#dddddd\" align=\"center\">数量</td><td bgcolor=\"#dddddd\" align=\"center\">零售额</td><td bgcolor=\"#dddddd\" align=\"center\">数量</td><td bgcolor=\"#dddddd\" align=\"center\">零售额</td><td bgcolor=\"#dddddd\" align=\"center\">数量</td><td bgcolor=\"#dddddd\" align=\"center\">零售额</td></tr>";
|
||
for($i=1;$i<$num_size_group;$i++){
|
||
$_tbody.="<tr>".$size_tr[$i]."</tr>";
|
||
}
|
||
$_tbody.="</thead>";
|
||
//内容
|
||
$q="select sxz,category,".$s_group_by.",sum(num) 'num',sum(je) 'je' from ".$table_pre."order where id>0 ".str_replace("ka<>'y' and ","",$con)." group by ".$s_group_by." order by ".$s_group_by;
|
||
//echo $q."<br>";
|
||
$r=$db->query($q);
|
||
$total_dh_num=$total_dh_je=0;
|
||
$total_sx_num=$total_sx_je=0;
|
||
$total_ka_num=$total_ka_je=0;
|
||
$count=0;
|
||
while($m=$db->fetch_array($r)){
|
||
$bg=($count%2)?"#ffffff":"#f0f0f0";
|
||
$td_size1="";
|
||
//取得删除款数量
|
||
//echo "select sum(num) 'num',sum(je) 'je' from ".$table_pre."order where id>0 ".str_replace("ka<>'y'","ka='y'",$con)." and ".$s_group_by."='".$m[$s_group_by]."'<br>";
|
||
$tmp=get_db_msg("select sum(num) 'num',sum(je) 'je' from ".$table_pre."order where id>0 ".str_replace("ka<>'y'","ka='y'",$con)." and ".$s_group_by."='".$m[$s_group_by]."'");
|
||
$ka_num=$tmp["num"];
|
||
$ka_je=deel_num($tmp["je"]);
|
||
//
|
||
$dh_num=$m["num"];
|
||
$dh_je=deel_num($m["je"]);
|
||
//
|
||
$sx_num=$dh_num-$ka_num;
|
||
$sx_je=$dh_je-$ka_je;
|
||
$_tcontent[$count]="<tr height=\"25\"><td bgcolor=\"".$bg."\">".get_cate_title_no("sxz",$m["sxz"])."</td><td bgcolor=\"".$bg."\">".get_cate_title_no("category",$m["category"])."</td><td bgcolor=\"".$bg."\">".get_cate_title_no($s_group_by,$m[$s_group_by])."</td><td bgcolor=\"".$bg."\" align=\"right\">".deel_td(deel_0($dh_num))."</td><td bgcolor=\"".$bg."\" align=\"right\">".deel_td(deel_0($dh_je))."</td><td bgcolor=\"".$bg."\" align=\"right\">".deel_td(deel_0($sx_num))."</td><td bgcolor=\"".$bg."\" align=\"right\">".deel_td(deel_0($sx_je))."</td><td bgcolor=\"".$bg."\" align=\"right\">".deel_td(deel_0($ka_num))."</td><td bgcolor=\"".$bg."\" align=\"right\">".deel_td(deel_0($ka_je))."</td></tr>";
|
||
$total_dh_num+=$dh_num;
|
||
$total_dh_je+=$dh_je;
|
||
$total_sx_num+=$sx_num;
|
||
$total_sx_je+=$sx_je;
|
||
$total_ka_num+=$ka_num;
|
||
$total_ka_je+=$ka_je;
|
||
$count++;
|
||
//
|
||
}
|
||
$_tcontent[$count]="<tr height=\"25\"><td colspan=\"3\" align=\"right\" bgcolor=\"#f0f0f0\">合计</td><td bgcolor=\"#f0f0f0\" align=\"right\">".$total_dh_num."</td><td bgcolor=\"#f0f0f0\" align=\"right\">".$total_dh_je."</td><td bgcolor=\"#f0f0f0\" align=\"right\">".$total_sx_num."</td><td bgcolor=\"#f0f0f0\" align=\"right\">".$total_sx_je."</td><td bgcolor=\"#f0f0f0\" align=\"right\">".$total_ka_num."</td><td bgcolor=\"#f0f0f0\" align=\"right\">".$total_ka_je."</td></tr>";
|
||
}
|
||
$bottom_button="<input type=\"button\" name=\"s1\" value=\"打 印\" onclick=\"start_print()\">";
|
||
}
|
||
?>
|