7e47ce238b
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
148 lines
5.4 KiB
PHP
148 lines
5.4 KiB
PHP
<?php
|
|
//--------------------------------------------------------------------------------订单打印
|
|
//p1
|
|
if(THIS_IN!="edt_c")
|
|
exit("错误的访问!");
|
|
$uid=check_cookie();
|
|
$db=_mysql_connect();
|
|
$msg_login_user=get_db_msg("select * from ".$table_pre."client where id='".$uid."'");
|
|
$arr_dp=array();
|
|
if($msg_login_user["face"]=="3"){
|
|
$q="select id,username,title,path from ".$table_pre."client where path='".$msg_login_user["path"]."-".$msg_login_user["id"]."'";
|
|
$r=$db->query($q);
|
|
$i=0;
|
|
while($m=$db->fetch_array($r)){
|
|
$arr_dp[$i]=array($m["id"],$m["username"],$m["path"],$m["title"]);
|
|
$i++;
|
|
}
|
|
$con_u_all="(upath like '".$msg_login_user["path"]."-".$msg_login_user["id"]."-%' or upath='".$msg_login_user["path"]."-".$msg_login_user["id"]."') and ";
|
|
}else if($msg_login_user["face"]=="2"){
|
|
$arr_upath=explode(",",$msg_login_user["charge_path"]);
|
|
$i2=0;
|
|
for($i=0;$i<count($arr_upath);$i++){
|
|
$m=get_db_msg("select face,id,title,username,path from ".$table_pre."client where id='".get_parent_id($arr_upath[$i])."'");
|
|
if($m["face"]=="4"){
|
|
$arr_dp[$i2]=array($m["id"],$m["username"],$m["path"],$m["title"]);
|
|
$i2++;
|
|
}
|
|
}
|
|
$con_u_all=get_qj_u_con_all($msg_login_user["charge_path"]);
|
|
}else{
|
|
$arr_dp[0]=array($msg_login_user["id"],$msg_login_user["username"],$msg_login_user["path"],$msg_login_user["title"]);
|
|
$con_u_all="uid='".$msg_login_user["id"]."' and";
|
|
}
|
|
//
|
|
$_title_="订单打印";
|
|
$_nav_="<a href=\"".$_SERVER[PHP_SELF]."\">首页</a> > <a href=\"".$_SERVER[PHP_SELF]."?_m=".$_m."&_cid=".$_cid."\">".$_title_."</a>";
|
|
$arr_report=array("detail"=>"明细","confirm"=>"汇总");
|
|
//--------------------------------------------
|
|
$_a=$_a?$_a:"detail";
|
|
$zk_type=get_set("zk_type");
|
|
$file_root1=THIS_FILE_ROOT;
|
|
switch($_a){
|
|
case "confirm":
|
|
require $file_root1."/tmpl/order_print_confirm.php";
|
|
break;
|
|
case "detail":
|
|
require $file_root1."/tmpl/order_print_detail.php";
|
|
break;
|
|
case "export":
|
|
require $file_root1."/tmpl/order_print_export.php";
|
|
break;
|
|
//----------------------------------------------------------------------设置折扣
|
|
case "set_zk" :
|
|
//设置折扣
|
|
$add_date=date("Y-m-d H:i:s");
|
|
if($id){
|
|
$msg=get_db_msg("select * from ".$table_pre."client where id='".$id."'");
|
|
$path=$msg["path"];
|
|
$_nav_="设置折扣";
|
|
}
|
|
$content[]=array("客户","<b>".$msg["title"]."(".$msg["username"].")</b>");
|
|
if($zk_type=="y1"){
|
|
$zk_value=$msg["zk"];
|
|
$zk_value=$zk_value>0?$zk_value:"100";
|
|
$zb="<input type=\"text\" name=\"zk\" id=\"zk\" style=\"width:30px\" value=\"".$zk_value."\">%";
|
|
}else if($zk_type=="y2"){
|
|
//取得指标格式
|
|
$zkxf="category";
|
|
switch($zkxf){
|
|
case "category":
|
|
$zb="<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\" align=\"left\" bgcolor=\"#cccccc\"><tr><td bgcolor=\"#f0f0f0\">大类</td><td bgcolor=\"#f0f0f0\">折扣</td><td bgcolor=\"#f0f0f0\">折后金额</td></tr>";
|
|
//大类
|
|
$q="select * from ".$table_pre."keyword where cate='".$zkxf."' order by no";
|
|
$r=$db->query($q);
|
|
$num_total=0;
|
|
$i=1;
|
|
$total_money=0;
|
|
while($m=$db->fetch_array($r)){
|
|
$zk_value=get_zk($id,$m["no"]);
|
|
$zk_value=$zk_value>0?$zk_value:"100";
|
|
$tmp=get_db_msg("select sum((".get_size_sql("sum").")*price) 'money' from ".$table_pre."order where uid='".$id."' and category='".$m["no"]."' and ka<>'y'");
|
|
$zhje=$tmp["money"]*$zk_value/100;
|
|
$total_money+=$zhje;
|
|
$zb.="<tr><td bgcolor=\"#ffffff\">".$m["no"]."-".$m["title"]."<input type=\"hidden\" name=\"zkno[]\" value=\"".$m["no"]."\"></td><td bgcolor=\"#ffffff\"><input type=\"text\" name=\"num_".$m["no"]."\" id='num_".$i."' style=\"width:30px\" value=\"".$zk_value."\"></td><td bgcolor=\"#ffffff\" align=\"right\">".keep_float($zhje,2)."</td></tr>";
|
|
$i++;
|
|
}
|
|
$zb.="<tr><td bgcolor=\"#ffffff\" align=\"right\" colspan=\"2\">合计</td><td bgcolor=\"#ffffff\" align=\"right\">".keep_float($total_money,2)."</td></tr>";
|
|
break;
|
|
}
|
|
$zb.="</table>";
|
|
}
|
|
$content[]=array("折扣",$zb);
|
|
//js_code
|
|
$js_code.="function ok(){
|
|
obj=document.form1;
|
|
return true;
|
|
}";
|
|
//
|
|
$form_property=" onsubmit=\"return ok()\"";
|
|
$form_hidden=array("id"=>$id,"_a"=>"save_set_zk");
|
|
$_submit_button_="<input type=\"submit\" name=\"s1\" value=\"保存设置\"> <input type=\"button\" name=\"b1\" value=\"关闭窗口\" onclick=\"window.close();\">";
|
|
$_width_="40";
|
|
include template("win_add");
|
|
exit;
|
|
break;
|
|
case "save_set_zk":
|
|
$msg_client=get_db_msg("select * from ".$table_pre."client where id='".$id."'");
|
|
if($zk_type=="y1"){
|
|
$db->query("update ".$table_pre."client set zk='".$zk."' where id='".$id."'");
|
|
}else if($zk_type=="y2"){
|
|
$cid=$id;
|
|
$zkxf="category";
|
|
switch($zkxf){
|
|
case "category":
|
|
for($i=0;$i<count($zkno);$i++){
|
|
$var_num="num_".$zkno[$i];
|
|
update_zk($cid,$zkno[$i],$$var_num);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
set_order_total($cid);
|
|
echo "<script>
|
|
window.opener.location.reload();
|
|
window.location.href='?_m=".$_m."&_cid=".$_cid."&_a=set_zk&id=".$id."';
|
|
alert('设置成功!');
|
|
//window.close();
|
|
</script>";
|
|
break;
|
|
default:
|
|
//
|
|
break;
|
|
}
|
|
//-----------------------tab
|
|
$tab_content=array();
|
|
$i=0;
|
|
foreach($arr_report as $k => $v){
|
|
if($k==$_a)
|
|
$tab_content[$i][0]="_1";
|
|
else
|
|
$tab_content[$i][0]="";
|
|
$tab_content[$i][1]="<a href=\"".$_SERVER[PHP_SELF]."?_cid=".$_cid."&_m=".$_m."&_a=".$k."&s_username=".$s_username."&sub=".$sub."\">".$v."</a>";
|
|
$i++;
|
|
}
|
|
//-----------------------/tab
|
|
$_tmpl=$_tmpl?$_tmpl:"report";
|
|
include template($_tmpl);
|
|
?>
|