chore: 添加多个图片和资源文件

添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
This commit is contained in:
2025-06-15 13:04:37 +08:00
parent 1e61dc3970
commit 7e47ce238b
13220 changed files with 1377028 additions and 0 deletions
+96
View File
@@ -0,0 +1,96 @@
<?php
//-------------------------------------------------------导入评价
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//-------------------------------mysql connect
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$is_submit=$_POST["is_submit"];
if($is_submit=="y"){
//初始化
$table=$table_pre."client_pj";
$db->query("truncate table ".$table.";");
$content=$_POST["content"];
$arr=explode("\n",$content);
$num=0;
for($i=0;$i<count($arr);$i++){
$arr1=explode(" ",$arr[$i]);
//
$dpdm=trim($arr1[0]);
$kh=trim($arr1[1]);
$race=trim($arr1[2]);
$remark=trim($arr1[3]);
$check=get_db_msg("select id from ".$table_pre."client where username='".$dpdm."' limit 0,1");
$check_kh=get_db_msg("select id from ".$table_pre."kh where no='".$kh."' limit 0,1");
if($check["id"]>0 && $check_kh["id"]>0){
$sql_value.="('".$check["id"]."','".$check_kh["id"]."','".$race."','".$remark."','".time()."'),";
$num++;
}else{
//客户名称有误
$msg.="<span class=\"wrong\">".$dpdm."-".$kh."客户编码或款号有误!</span><br>";
}
}
if($num>0){
$sql_value=substr($sql_value,0,-1);
$q1="insert into ".$table." (cid,khid,race,remark,add_date) values ".$sql_value;
//echo $q1."<br>";
$db->query($q1);
$msg.="<span class=\"right\">导入成功!</span><br>";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>导入评价</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="form1" action="" method="post">
<input type="hidden" name="is_submit" value="y">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>导入评价</b></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">格式说明:同行之间用|分隔,如:登陆代码,款号,评分1-5,备注;多条记录请回车。<Br>
<textarea name="content" style="width:100%;" rows="20"><?php echo $content; ?></textarea></td>
</tr>
<tr>
<td align="center" bgcolor="#f0f0f0"><input type="submit" value=" 提 交 "></td>
</tr>
<?php
if($msg){
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
}
?>
</form>
</table>
</body>
</html>
+99
View File
@@ -0,0 +1,99 @@
<?php
//-------------------------------------------------------批量设置客户表字段值
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//-------------------------------mysql connect
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$is_submit=$_POST["is_submit"];
$col_name=$_POST["col_name"];
if($is_submit=="y"){
if($col_name){
$content=$_POST["content"];
$arr=explode("\n",$content);
for($i=0;$i<count($arr);$i++){
//$str1=str_replace("","|",$arr[$i]);
//$str1=str_replace(",","|",$arr[$i]);
$str1=trim($arr[$i]);
$arr1=explode("|",$str1);
$no=trim($arr1[0]);
$col_value=trim($arr1[1]);
$check=get_db_msg("select * from ".$table_pre."client where username='".$no."' limit 0,1");
if($check["id"]>0){
$q="update ".$table_pre."client set ".$col_name."='".$col_value."' where id='".$check["id"]."'";
//echo $q."<br>";
$db->query($q);
$msg.=$no.":".$col_value."-设置成功!<br>";
}else{
//有误
$msg.="<span class=\"wrong\">".$no."-客户代码有误!</span><br>";
}
}
}else{
$msg.="<span class=\"wrong\">请选择字段名!</span><br>";
}
}
$arr_column_client=array("title"=>"用户名称","dpsx"=>"店铺属性","dj"=>"店铺等级","password"=>"登陆密码","zb"=>"指标金额","zb_js"=>"指标件数","zb_ks"=>"指标款数","zb_kss"=>"指标款色数");
//
$q="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no<>'jgd' and no<>'sx' order by ord";
$r=$db->query($q);
while($m=$db->fetch_array($r)){
$arr_column_kh[$m["no"]]=$m["title"];
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>批量设置客户表字段值</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="form1" action="" method="post">
<input type="hidden" name="is_submit" value="y">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>批量设置客户表字段值</b></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;"><select name="col_name"><option value=''>-请选择字段名-</option><?php echo get_main_op($arr_column_client,$col_name); ?></select></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">格式说明:同行之间用|分隔,如:登陆代码|字段值;多条记录请回车。<Br>
<textarea name="content" style="width:100%;" rows="20"><?php echo $content; ?></textarea></td>
</tr>
<tr>
<td align="center" bgcolor="#f0f0f0"><input type="submit" value=" 提 交 "></td>
</tr>
<?php
if($msg){
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
}
?>
</form>
</table>
</body>
</html>
+157
View File
@@ -0,0 +1,157 @@
<?php
//----------设置指标相关
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//-------------------------------mysql connect
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$is_brand=get_set("is_brand");
$zb_type=get_set("zb_type");
$arr_zb_type=explode(",",$zb_type);
$arr_hj_type=array("qy"=>"合计区域","dl"=>"合计代理");
$sub=$_POST["sub"];
$hj_type=$_POST["hj_type"]?$_POST["hj_type"]:array("1","2");
$content="<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\"><table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#cccccc\">";
if($sub=="y"){
if($is_brand=="y"){
$content.="<tr bgcolor=\"#eeeeee\"><td>客户</td><td>品牌</td>";
if(in_array("je",$arr_zb_type))
$content.="<td>指标金额(万)</td>";
if(in_array("js",$arr_zb_type))
$content.="<td>指标件数</td>";
$content.="</tr>";
if(in_array("dl",$hj_type)){
//合计代理指标
$q="select * from ".$table_pre."client where face='3'";
$r=$db->query($q);
while($m=$db->fetch_array($r)){
$q2="select * from ".$table_pre."keyword where cate='brand'";
$r2=$db->query($q2);
while($m2=$db->fetch_array($r2)){
$m1=get_db_msg("select sum(b.zb) 'zb',sum(b.zb_js) 'zb_js' from ".$table_pre."client_brand b,".$table_pre."client c where b.cid=c.id and b.brand='".$m2["no"]."' and c.path='".$m["path"]."-".$m["id"]."'");
$tmp1=get_db_msg("select id from ".$table_pre."client_brand where cid='".$m["id"]."' and brand='".$m2["no"]."'");
if($tmp1["id"]>0){
$q1="update ".$table_pre."client_brand set zb='".$m1["zb"]."',zb_js='".$m1["zb_js"]."' where id='".$tmp1["id"]."'";
}else{
$q1="insert into ".$table_pre."client_brand (cid,brand,zb,zb_js) values ('".$m["id"]."','".$m2["no"]."','".$m1["zb"]."','".$m1["zb_js"]."')";
}
$db->query($q1);
$content.="<tr bgcolor=\"#ffffff\"><td>代理:".$m["title"]."(".$m["username"].")</td><td>".$m2["title"]."</td>";
if(in_array("je",$arr_zb_type))
$content.="<td>".$m1["zb"]."</td>";
if(in_array("js",$arr_zb_type))
$content.="<td>".$m1["zb_js"]."</td>";
$content.="</tr>";
}
}
}
if(in_array("qy",$hj_type)){
//合计区域指标
$q="select * from ".$table_pre."client where face='9'";
$r=$db->query($q);
while($m=$db->fetch_array($r)){
$q2="select * from ".$table_pre."keyword where cate='brand'";
$r2=$db->query($q2);
while($m2=$db->fetch_array($r2)){
$m1=get_db_msg("select sum(b.zb) 'zb',sum(b.zb_js) 'zb_js' from ".$table_pre."client_brand b,".$table_pre."client c where b.cid=c.id and b.brand='".$m2["no"]."' and c.path='".$m["path"]."-".$m["id"]."'");
$tmp1=get_db_msg("select id from ".$table_pre."client_brand where cid='".$m["id"]."' and brand='".$m2["no"]."'");
if($tmp1["id"]>0){
$q1="update ".$table_pre."client_brand set zb='".$m1["zb"]."',zb_js='".$m1["zb_js"]."' where id='".$tmp1["id"]."'";
}else{
$q1="insert into ".$table_pre."client_brand (cid,brand,zb,zb_js) values ('".$m["id"]."','".$m2["no"]."','".$m1["zb"]."','".$m1["zb_js"]."')";
}
$db->query($q1);
$content.="<tr bgcolor=\"#ffffff\"><td>区域:".$m["title"]."(".$m["username"].")</td><td>".$m2["title"]."</td>";
if(in_array("je",$arr_zb_type))
$content.="<td>".$m1["zb"]."</td>";
if(in_array("js",$arr_zb_type))
$content.="<td>".$m1["zb_js"]."</td>";
$content.="</tr>";
}
}
}
}else{
$content.="<tr bgcolor=\"#eeeeee\"><td>客户</td>";
if(in_array("je",$arr_zb_type))
$content.="<td>指标金额(万)</td>";
if(in_array("js",$arr_zb_type))
$content.="<td>指标件数</td>";
$content.="</tr>";
if(in_array("dl",$hj_type)){
//合计代理指标
$q="select * from ".$table_pre."client where face='3'";
$r=$db->query($q);
while($m=$db->fetch_array($r)){
$m1=get_db_msg("select sum(zb) 'zb',sum(zb_js) 'zb_js' from ".$table_pre."client where path='".$m["path"]."-".$m["id"]."'");
$q1="update ".$table_pre."client set zb='".$m1["zb"]."',zb_js='".$m1["zb_js"]."' where id='".$m["id"]."'";
$db->query($q1);
$content.="<tr bgcolor=\"#ffffff\"><td>代理:".$m["title"]."(".$m["username"].")</td>";
if(in_array("je",$arr_zb_type))
$content.="<td>".$m1["zb"]."</td>";
if(in_array("js",$arr_zb_type))
$content.="<td>".$m1["zb_js"]."</td>";
$content.="</tr>";
}
}
if(in_array("qy",$hj_type)){
//合计区域指标
$q="select * from ".$table_pre."client where face='9'";
$r=$db->query($q);
while($m=$db->fetch_array($r)){
$m1=get_db_msg("select sum(zb) 'zb',sum(zb_js) 'zb_js' from ".$table_pre."client where path='".$m["path"]."-".$m["id"]."'");
$q1="update ".$table_pre."client set zb='".$m1["zb"]."',zb_js='".$m1["zb_js"]."' where id='".$m["id"]."'";
$db->query($q1);
$content.="<tr bgcolor=\"#ffffff\"><td>区域:".$m["title"]."(".$m["username"].")</td>";
if(in_array("je",$arr_zb_type))
$content.="<td>".$m1["zb"]."</td>";
if(in_array("js",$arr_zb_type))
$content.="<td>".$m1["zb_js"]."</td>";
$content.="</tr>";
}
}
}
$content.="</table></td></tr>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>自动合计客户指标</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>自动合计客户指标</b></td>
</tr>
<tr>
<td align="center" bgcolor="#ffffff"><form name="form1" action="<?php echo $_SERVER[PHP_SELF]; ?>" method="post"><input type="hidden" name="sub" value="y">
<?php echo get_main_checkbox($arr_hj_type,"hj_type",arr_to_str($hj_type)); ?><input type="submit" value="开始合计"></form></td>
</tr>
<?php echo $content; ?>
</table>
</body>
</html>
+22
View File
@@ -0,0 +1,22 @@
<?php
//-------------------------------------------------------更新价格带
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//-------------------------------mysql connect
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$q="select * from ".$table_pre."kh";
$r=$db->query($q);
$i=1;
while($m=$db->fetch_array($r)){
$q1="update ".$table_pre."kh set jgd='".get_jgd($m["price"])."' where id='".$m["id"]."'";
$db->query($q1);
$db->query("update ".$table_pre."order set jgd='".get_jgd($m["price"])."' where iid='".$m["id"]."'");
echo " . ";
}
echo "<br>更新完成";
?>
+134
View File
@@ -0,0 +1,134 @@
<?php
//-------------------------------------------------------批量设置删除款
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//-------------------------------mysql connect
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$is_submit=$_POST["is_submit"];
if($is_submit=="y"){
$content=$_POST["content"];
$arr=explode("\n",$content);
for($i=0;$i<count($arr);$i++){
//$str1=str_replace("","|",$arr[$i]);
//$str1=str_replace(",","|",$arr[$i]);
$str1=trim($arr[$i]);
$arr1=explode("|",$str1);
$no=trim($arr1[0]);
$color=trim($arr1[1]);
$check=get_db_msg("select * from ".$table_pre."kh where no='".$no."' limit 0,1");
if($check["id"]>0){
if($color){
//有色号
$arr_color=explode(",",$check["color"]);
if(in_array($color,$arr_color)){
//--删除色
$arr_color_ka=explode(",",$check["color_ka"]);
if(in_array($color,$arr_color_ka)){
//色号已经删除
$msg.="<span class=\"wrong\">".$no."-".$color."-色号已经被删除!</span><br>";
}else{
//款号表
$color_ka=$check["color_ka"]?($check["color_ka"].",".$color):$color;
$q="update ".$table_pre."kh set color_ka='".$color_ka."' where id='".$check["id"]."'";
$db->query($q);
//如果所有色都删除
$arr_color_ka=explode(",",$color_ka);
if(count($arr_color)==count($arr_color_ka)){
$q="update ".$table_pre."kh set ka='y' where id='".$check["id"]."'";
$db->query($q);
}
//订单表
$q="update ".$table_pre."order set ka='y' where iid='".$check["id"]."' and color='".$color."'";
$db->query($q);
//款色表
$q="update ".$table_pre."kh_color set ka='y' where iid='".$check["id"]."' and color='".$color."'";
$db->query($q);
$msg.=$no."-".$color."-设置成功!<br>";
}
}else{
//色号有误
$msg.="<span class=\"wrong\">".$no."-".$color."-色号有误!</span><br>";
}
}else{
//--删除整款
if($check["ka"]=="y"){
$msg.="<span class=\"wrong\">".$no."-已经被删除!</span><br>";
}else{
//款号表
$q="update ".$table_pre."kh set ka='y' where id='".$check["id"]."'";
$db->query($q);
$q="update ".$table_pre."kh set color_ka=color where id='".$check["id"]."'";
$db->query($q);
//订单表
$q="update ".$table_pre."order set ka='y' where iid='".$check["id"]."'";
$db->query($q);
//款色表
$q="update ".$table_pre."kh_color set ka='y' where iid='".$check["id"]."'";
$db->query($q);
//
$msg.=$no."-设置成功!<br>";
}
}
}else{
//款号有误
$msg.="<span class=\"wrong\">".$no."-款号有误!</span><br>";
}
}
set_order_total_all();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>批量设置删除款</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="form1" action="" method="post">
<input type="hidden" name="is_submit" value="y">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>批量设置删除款</b></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">格式说明:同行之间用|分隔,如:款号|色号;删除整款不需要色号;多条记录请回车。<Br>
<textarea name="content" style="width:100%;" rows="20"><?php echo $content; ?></textarea></td>
</tr>
<tr>
<td align="center" bgcolor="#f0f0f0"><input type="submit" value=" 提 交 "></td>
</tr>
<?php
if($msg){
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
}
?>
</form>
</table>
</body>
</html>
+106
View File
@@ -0,0 +1,106 @@
<?php
//-------------------------------------------------------批量设置款号表字段值
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//-------------------------------mysql connect
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$is_submit=$_POST["is_submit"];
$col_name=$_POST["col_name"];
if($is_submit=="y"){
if($col_name){
$content=$_POST["content"];
$arr=explode("\n",$content);
for($i=0;$i<count($arr);$i++){
//$str1=str_replace("","|",$arr[$i]);
//$str1=str_replace(",","|",$arr[$i]);
$str1=trim($arr[$i]);
$arr1=explode("|",$str1);
$no=trim($arr1[0]);
$col_value=trim($arr1[1]);
$check=get_db_msg("select * from ".$table_pre."kh where no='".$no."' limit 0,1");
if($check["id"]>0){
$q="update ".$table_pre."kh set ".$col_name."='".$col_value."' where id='".$check["id"]."'";
$db->query($q);
$msg.=$no.":".$col_value."-设置成功!<br>";
}else{
//款号有误
$msg.="<span class=\"wrong\">".$no."-款号有误!</span><br>";
}
}
}else{
$msg.="<span class=\"wrong\">请选择字段名!</span><br>";
}
}
$arr_column_kh["xh"]="序号";
$arr_column_kh["title"]="款式名";
$arr_column_kh["price"]="吊牌价";
$arr_column_kh["dhbs"]="订货倍数";
$zk_type=get_set("zk_type");
$arr_column_kh["remark"]="备注";
$arr_column_kh["size_group"]="尺码组";
$arr_column_kh["size"]="尺码";
$arr_column_kh["dpk"]="搭配款";
//
$q="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no<>'jgd' and no<>'sx' order by ord";
$r=$db->query($q);
while($m=$db->fetch_array($r)){
$arr_column_kh[$m["no"]]=$m["title"];
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>批量设置款号表字段值</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="form1" action="" method="post">
<input type="hidden" name="is_submit" value="y">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>批量设置款号表字段值</b></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;"><select name="col_name"><option value=''>-请选择字段名-</option><?php echo get_main_op($arr_column_kh,$col_name); ?></select></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">格式说明:同行之间用|分隔,如:款号|字段值;多条记录请回车。<Br>
<textarea name="content" style="width:100%;" rows="20"><?php echo $content; ?></textarea></td>
</tr>
<tr>
<td align="center" bgcolor="#f0f0f0"><input type="submit" value=" 提 交 "></td>
</tr>
<?php
if($msg){
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
}
?>
</form>
</table>
</body>
</html>
+31
View File
@@ -0,0 +1,31 @@
<?php
//-------------------------------------------------------处理备注字段
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//-------------------------------mysql connect
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
//
$arr_zd=array("remark1"=>"买点","remark2"=>"说明");
$q="select * from ".$table_pre."kh";
$r=$db->query($q);
$i=1;
while($m=$db->fetch_array($r)){
$str="";
foreach($arr_zd as $k1 => $v1){
if(trim($m[$k1]))
$str.=$v1."".trim($m[$k1])."\r\n";
}
if($str){
$str=substr($str,0,-2);
$q1="update ".$table_pre."kh set remark='".$str."' where id='".$m["id"]."'";
$db->query($q1);
echo $i.".".$str."<br><br>";
$i++;
}
}
?>
+73
View File
@@ -0,0 +1,73 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>更新订单表的款号资料</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>更新订单表的款号资料</b></td>
</tr>
<tr><td align="left" bgcolor="#ffffff" valign="top" style="line-height:150%;">
<?php
//--------------------------------------------------------------更新订单表的款号资料缓存
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//-------------------------------mysql connect
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
//
$is_multi_price=get_set("is_multi_price");
//取得选项
$arr_select_no=array();
$q1="select no from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no<>'jgd' and no<>'sx' and no<>'zd1' and no<>'zd2' and no<>'zd3' order by ord";
$r1=$db->query($q1);
$sql1="";
while($m1=$db->fetch_array($r1)){
$arr_select_no[]=$m1["no"];
$sql1.=$m1["no"].",";
}
//
$q="select * from ".$table_pre."kh";
$r=$db->query($q);
$i=1;
while($m1=$db->fetch_array($r)){
$sql1="";
for($i1=0;$i1<count($arr_select_no);$i1++){
$sql1.=$arr_select_no[$i1]."='".$m1[$arr_select_no[$i1]]."',";
}
$q1="update ".$table_pre."order set is_sp='".$m1["is_sp"]."',".$sql1.$sql_price."no='".$m1["no"]."' where iid='".$m1["id"]."'";
//echo $q1."<br>";
$db->query($q1);
echo ". ";
$i++;
}
echo "更新完成!";
?></td></tr>
</table>
</body>
</html>
+56
View File
@@ -0,0 +1,56 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>更新订单表的色系</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>更新订单表的色系</b></td>
</tr>
<tr><td align="left" bgcolor="#ffffff" valign="top" style="line-height:150%;">
<?php
//-------------------------------------------------------更新订单表的色系
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//-------------------------------mysql connect
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$q="select * from ".$table_pre."keyword where cate='color'";
$r=$db->query($q);
while($m=$db->fetch_array($r)){
$sx=get_sx($m["no"]);
$q1="update ".$table_pre."order set sx='".$sx."' where color='".$m["no"]."'";
//echo $q1."<br>";
$db->query($q1);
echo ". ";
}
echo "<br>更新完成!";
?></td></tr>
</table>
</body>
</html>
+263
View File
@@ -0,0 +1,263 @@
<?php
//-------------------------------------------------------自动计算不予下单尺码,支持童装和文胸
//--2019/11/29 by hehe
//对数组根据值排序,并且重新计算索引
function arr_px1($arr){
asort($arr);//排序
$k2=0;
//索引排序
$arr1=array();
foreach($arr as $k1 => $v1){
$arr1[$k2]=$v1;
$k2++;
}
return $arr1;
}
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//-------------------------------mysql connect
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$is_submit=$_POST["is_submit"];
$is_multi_price=get_set("is_multi_price");
//文胸
if($bx_sizegroup_title){
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$bx_sizegroup_title."' limit 0,1");
$bx_sizegroup_id=$tmp["id"];
}else{
$bx_sizegroup_id=0;
}
//童装
if($child_sizegroup_title){
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$child_sizegroup_title."' limit 0,1");
$child_sizegroup_id=$tmp["id"];
}else{
$child_sizegroup_id=0;
}
if($is_submit=="y"){
$content=$_POST["content"];
$arr=explode("\n",$content);
$arr_kh=array();
$error_kh=$error_kh=array();
//
for($i=0;$i<count($arr);$i++){
$str1=$arr[$i];
$arr1=explode(" ",$str1);
$kh=trim($arr1[0]);
$color=trim($arr1[1]);
$bx=trim($arr1[2]);
$size_group=trim($arr1[3]);
$size=trim($arr1[4]);
if($kh){
$arr_kh[$kh][]=array($color,$bx,$size_group,$size);
//echo $i.":".$kh."-".$color."-".$bx."-".$size_group."-".$size."<br>";
}
}
//清空不予下单表
//$db->query("truncate table ".$table_pre."size_not;");
//计算尺码
foreach($arr_kh as $kh => $arr1){
$m_kh=get_db_msg("select id,no,size_group from ".$table_pre."kh where no='".$kh."'");
$khid=$m_kh["id"];
if($khid>0){
$db->query("delete from ".$table_pre."size_not where kh='".$kh."'");//清空该款的不予下单表
$j=count($arr1);
$arr_color=$arr_bx=$arr_size_group=$arr_size=array();
for($k=0;$k<$j;$k++){
//
$arr_color[$k]=$arr1[$k][0];
$arr_bx[$k]=$arr1[$k][1];
$arr_size_group[$k]=$arr1[$k][2];
$arr_size[$k]=$arr1[$k][3];
}
if($bx_sizegroup_id==$m_kh["size_group"] || $child_sizegroup_id==$m_kh["size_group"]){
//---------------------文胸或者童装
if($j>1){
$size_all_bx=array();//到杯型的全尺码
$kh_bx=array();//该款的所有杯型
$arr_size_no=array();
for($i1=0;$i1<count($arr_bx);$i1++){
$size_all_bx[$arr_bx[$i1]]=array();//初始化数组
}
for($i1=0;$i1<count($arr_size);$i1++){
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$arr_size_group[$i1]."'");
$size_group_id=$tmp["id"];
$arr_tmp=explode(",",$arr_size[$i1]);
for($i2=0;$i2<count($arr_tmp);$i2++){
$tmp=get_db_msg("select no from ".$table_pre."size where iid='".$size_group_id."' and title='".$arr_tmp[$i2]."'");
$arr_size_no[$i1][$i2]=$tmp["no"];//尺码名称转换成尺码编码
if(!in_array($tmp["no"],$size_all_bx[$arr_bx[$i1]]))
$size_all_bx[$arr_bx[$i1]][]=$tmp["no"];
}
if(!in_array($arr_bx[$i1],$kh_bx)){
$kh_bx[]=$arr_bx[$i1];
}
}
foreach($size_all_bx as $bx => $arr_s){
$size_all_bx[$bx]=arr_px1($arr_s);
}
//print_r($size_all_bx);
foreach($size_all_bx as $bx => $arr_s){
$check=get_db_msg("select id from ".$table_pre."size_bx where no='".$m_kh["no"]."' and bx='".$bx."'");
if($check["id"]>0){
$q="update ".$table_pre."size_bx set size='".arr_to_str($arr_s)."' where no='".$m_kh["no"]."' and bx='".$bx."'";
}else{
$q="insert ".$table_pre."size_bx (no,bx,size) values ('".$m_kh["no"]."','".$bx."','".arr_to_str($arr_s)."')";
}
$db->query($q);//更新size_bx表的尺码
}
//------检查是否存在遗漏的杯型
$arr_color_bx=array();
for($i3=0;$i3<count($arr_color);$i3++){
$arr_color_bx[$arr_color[$i3]][]=$arr_bx[$i3];
}
foreach($arr_color_bx as $color1 => $arr_bx1){
for($i4=0;$i4<count($kh_bx);$i4++){
if(!in_array($kh_bx[$i4],$arr_bx1)){
$q="insert ".$table_pre."size_not (kh,color,bx,size) values ('".$kh."','".$color1."','".$kh_bx[$i4]."','".arr_to_str($size_all_bx[$kh_bx[$i4]])."')";
$db->query($q);
//echo $q."<br>";
$right_kh[]=$kh."-".$color1."-".$kh_bx[$i4];
}
}
}
//print_r($kh_bx);
//echo "<Br>";
//print_r($arr_color_bx);
for($i3=0;$i3<count($arr_color);$i3++){
//设置不予下单尺码
$size_not="";
$size_all_tmp=$size_all_bx[$arr_bx[$i3]];
for($j3=0;$j3<count($size_all_tmp);$j3++){
if(!in_array($size_all_tmp[$j3],$arr_size_no[$i3]))
$size_not.=$size_all_tmp[$j3].",";
}
if($size_not){
$size_not=substr($size_not,0,-1);
$check=get_db_msg("select id from ".$table_pre."size_not where kh='".$kh."' and color='".$arr_color[$i3]."' and bx='".$arr_bx[$i3]."'");
if($check["id"]>0){
$q="update ".$table_pre."size_not set size='".$size_not."' where id='".$check["id"]."'";
}else{
$q="insert ".$table_pre."size_not (kh,color,bx,size) values ('".$kh."','".$arr_color[$i3]."','".$arr_bx[$i3]."','".$size_not."')";
}
//echo $q."<br>";
$db->query($q);//设置不予下单尺码
$right_kh[]=$kh."-".$arr_color[$i3]."-".$arr_bx[$i3];
}
}
}
}else{
//---------------------非文胸
if($j>1){
//
$arr_size1=array_unique($arr_size);
if(count($arr_size1)>1){
//需要设置不予下单
$size_all=array();//到款的全尺码
$arr_size_no=array();
for($i1=0;$i1<count($arr_size);$i1++){
//取得尺码组id
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$arr_size_group[$i1]."'");
$size_group_id=$tmp["id"];
$arr_tmp=explode(",",$arr_size[$i1]);
for($i2=0;$i2<count($arr_tmp);$i2++){
$tmp=get_db_msg("select no from ".$table_pre."size where iid='".$size_group_id."' and title='".$arr_tmp[$i2]."'");
$arr_size_no[$i1][$i2]=$tmp["no"];//尺码名称转换成尺码编码
if(!in_array($tmp["no"],$size_all))
$size_all[]=$tmp["no"];
}
}
$size_all=arr_px1($size_all);//排序
//print_r($size_all);
$q="update ".$table_pre."kh set size='".arr_to_str($size_all)."' where id='".$khid."'";
$db->query($q);//更新款号表的尺码
for($i3=0;$i3<count($arr_color);$i3++){
//设置不予下单尺码
$size_not="";
for($j3=0;$j3<count($size_all);$j3++){
if(!in_array($size_all[$j3],$arr_size_no[$i3]))
$size_not.=$size_all[$j3].",";
}
if($size_not){
$size_not=substr($size_not,0,-1);
$check=get_db_msg("select id from ".$table_pre."size_not where kh='".$kh."' and color='".$arr_color[$i3]."' and bx='".$arr_bx[$i3]."'");
if($check["id"]>0){
$q="update ".$table_pre."size_not set size='".$size_not."' where id='".$check["id"]."'";
}else{
$q="insert ".$table_pre."size_not (kh,color,bx,size) values ('".$kh."','".$arr_color[$i3]."','".$arr_bx[$i3]."','".$size_not."')";
}
//echo $q."<br>";
$db->query($q);//设置不予下单尺码
$right_kh[]=$kh."-".$arr_color[$i3];
}
}
//echo $kh.":";
//print_r($size_all);
}
}
}
}else{
$error_kh[]=$kh;//款号有误
}
}
$msg="";
if(count($error_kh)>0){
$msg.="以下款号有误:".arr_to_str($error_kh).";<br>";
}
if(count($right_kh)>0){
$msg.="以下款设置成功:".arr_to_str($right_kh).";<br>";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>自动计算不予下单尺码</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="form1" action="" method="post">
<input type="hidden" name="is_submit" value="y">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>自动计算不予下单尺码(按款计算)</b></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">格式说明(字段间用制表符分割):款号,颜色代码,规格或杯型(没有留空),尺码组名称,尺码名称(逗号分隔);多条记录请回车。<Br>
<textarea name="content" style="width:100%;" rows="20"><?php echo $content; ?></textarea></td>
</tr>
<tr>
<td align="center" bgcolor="#f0f0f0"><input type="submit" value=" 提 交 "></td>
</tr>
<?php
if($msg){
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
}
?>
</form>
</table>
</body>
</html>
+93
View File
@@ -0,0 +1,93 @@
<?php
//-------------------------------------------------------批量设置客户折扣
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//-------------------------------mysql connect
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$is_submit=$_POST["is_submit"];
$is_multi_price=get_set("is_multi_price");
if($is_submit=="y"){
$content=$_POST["content"];
$arr=explode("\n",$content);
$db->query("truncate table ".$table_pre."zk;");
for($i=0;$i<count($arr);$i++){
$str1=str_replace("","|",$arr[$i]);
$str1=str_replace(",","|",$arr[$i]);
$arr1=explode("|",$str1);
$username=trim($arr1[0]);
$zk=trim($arr1[1]);
$check=get_db_msg("select id from ".$table_pre."client where username='".$username."'");
if($check["id"]>0){
if($is_multi_price=="y"){
$q="select id from ".$table_pre."kh";
$r=$db->query($q);
while($m=$db->fetch_array($r)){
$q="insert into ".$table_pre."zk (cid,iid,zk,price) values ('".$check["id"]."','".$m["id"]."','".$zk."','".get_price_dp($check["id"],$m["id"])*$zk."')";
$db->query($q);
}
}else{
$q="insert into ".$table_pre."zk (cid,iid,zk,price) select c.id,a.id,".$zk.",a.price*".$zk." from web_kh a,web_client c where c.username='".$username."'";
$db->query($q);
}
$msg.=$username."-设置成功!<br>";
}else{
$msg.="<span class=\"wrong\">".$username."-不存在!</span><br>";
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>批量设置客户折扣</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="form1" action="" method="post">
<input type="hidden" name="is_submit" value="y">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>批量设置客户折扣</b></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">格式说明:用户代码|折扣(折扣为小数如0.3);多条记录请回车。<Br>
<textarea name="content" style="width:100%;" rows="20"><?php echo $content; ?></textarea></td>
</tr>
<tr>
<td align="center" bgcolor="#f0f0f0"><input type="submit" value=" 提 交 "></td>
</tr>
<?php
if($msg){
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
}
?>
</form>
</table>
</body>
</html>
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B

+55
View File
@@ -0,0 +1,55 @@
<?php
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
header("Content-type: text/html; charset=utf-8");
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$arr_column_dm=array(
"username"=>"客户代码",
"usertitle"=>"客户名称",
"dmtext"=>"内容"
);
$_a=$_GET["_a"];
switch($_a){
case "export_do":
$num=count($arr_column_dm);
$data=array();
//设置表头数据类型
for($i=0;$i<$num;$i++){
$data["col"][]="str";
}
//设置表头
foreach($arr_column_dm as $k=>$v){
$data["header"][0][]=$v;
}
$query="select * from web_barrage order by id";
$r=$db->query($query);
$row=0;
while($m=$db->fetch_array($r)){
$tmp=get_db_msg("select * from web_client where id='".$m["uid"]."' limit 0,1");
foreach($arr_column_dm as $k=>$v){
if($k=="username"){
$data["body"][$row][]=$tmp["username"];
}else if($k=="usertitle"){
$data["body"][$row][]=$tmp["title"];
}else if($k=="dmtext"){
$data["body"][$row][]=$m["value"];
}
}
$row++;
}
$file_name="dm_export_".date("Y-m-d-H-i");
output_excel($file_name,$data);
break;
default :
echo '无效访问!';
break;
}
$db->close();
?>
+140
View File
@@ -0,0 +1,140 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>明细单</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
.border1{
border-bottom:1px solid #cccccc;
}
</style>
</head>
<body>
<br />
<form name="form1" action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>款号明细单</b></td>
</tr>
<tr><td align="left" bgcolor="#ffffff" valign="top" style="line-height:150%;">
<?php
//--------------------------------------------------------款号明细单
function get_kh_picture_dhd($no,$main_pic,$color){
$pic="";
if(trim($main_pic)){
$pic="../../attachments/design/mini/".$no."_".$main_pic.".jpg";
}
if(!is_file($pic)){
$pic="../../attachments/design/mini/".$no.".jpg";
}
if(!is_file($pic)){
$tmp=explode(",",$color);
for($j=0;$j<count($tmp);$j++){
$pic="../../attachments/design/mini/".$no."_".$tmp[$j].".jpg";
if(is_file($pic))
break;
}
}
if(!is_file($pic)){
$pic="../images/no_pic_80.gif";
}
return $pic;
}
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//-------------------------------mysql connect
$s_zd=$_POST["s_zd"]?$_POST["s_zd"]:array("category","bc");
$s_px=$_POST["s_px"]?$_POST["s_px"]:"category,bc";
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$sys_size_num=get_max_size_num();
//杯型参数
if($bx_sizegroup_title){
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$bx_sizegroup_title."' limit 0,1");
$bx_sizegroup_id=$tmp["id"];
}else{
$bx_sizegroup_id=0;
}
//取得选项
$arr_select_no=array();
$arr_select_title=array();
$q="select no,title from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no<>'jgd' and no<>'sx' and no<>'zd1' and no<>'zd2' and no<>'zd3' order by ord";
$r=$db->query($q);
while($m=$db->fetch_array($r)){
$arr_select_no[]=$m["no"];
$arr_select_title[]=$m["title"];
}
//可选择字段
$arr_zd["xh"]="序号";
$arr_zd["price"]="零售价";
$arr_zd["price_zk"]="折扣价";
$arr_zd["title"]="款式名";
for($i=0;$i<count($arr_select_no);$i++){
if(check_arr_select_show($arr_select_no[$i]))
$arr_zd[$arr_select_no[$i]]=$arr_select_title[$i];
}
$arr_px=array(
"category,num desc"=>get_cate_title_no("arr_select","category"),
"category,bc,num desc"=>get_cate_title_no("arr_select","category").",".get_cate_title_no("arr_select","bc"),
"category,series,num desc"=>get_cate_title_no("arr_select","category").",".get_cate_title_no("arr_select","series"),
"category,theme,num desc"=>get_cate_title_no("arr_select","category").",".get_cate_title_no("arr_select","theme"),
"no,num desc"=>"款号"
);
//字段
$zd="";
$i=0;
foreach($arr_zd as $k1 => $v1){
$zd.="<input type=\"checkbox\" name=\"s_zd[]\" value=\"".$k1."\" id=\"zd_".$k1."\"";
if(in_array($k1,$s_zd))
$zd.=" checked";
$zd.="><label for=\"zd_".$k1."\">".$v1."</label>";
}
echo "显示列:".$zd;
echo "&nbsp;&nbsp;排序:<select name=\"s_px\">".get_main_op($arr_px,$s_px)."</select>";
echo " <input type=submit value=\" 生 成 \" class=\"button_act\"></td><tr>";
//-----------------------/search
$th_zd="";
for($i=0;$i<count($s_zd);$i++){
$th_zd.="<td align=\"center\" bgcolor=\"#dddddd\">".get_main_value($arr_zd,$s_zd[$i])."</td>";
}
echo "<tr><td bgcolor=\"#ffffff\"><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" bgcolor=\"#cccccc\"><tr><td align=\"center\" bgcolor=\"#dddddd\" width=\"40\">序号</td><td align=\"center\" bgcolor=\"#dddddd\" width=\"100\">图片</td><td align=\"center\" bgcolor=\"#dddddd\">款号</td><td align=\"center\" bgcolor=\"#dddddd\" width=\"40\">件数</td></tr>";
$query="select a.no 'no',a.color 'color',a.main_pic 'main_pic',a.category 'category',sum(b.num) 'num' from ".$table_pre."kh a left join ".$table_pre."order b on a.id=b.iid group by a.id order by num desc";
//echo $query."<br>";
$res=$db->query($query);
$count=0;
$l=0;
$_tcontent=array();
while($m=$db->fetch_array($res)){
$list=$count+1;
//图片
$pic=get_kh_picture_dhd($m["no"],$m["main_pic"],$m["color"]);
echo "<tr bgcolor=\"#ffffff\" height=\"100\"><td>".$list."</td><td>".out_good_pic($pic,90,90)."</td><td>".$m["no"]."</td><td>".$m["num"]."</td></tr>";
$count++;
$l++;
}
?></table></td></tr>
</table>
</form>
</body>
</html>
+566
View File
@@ -0,0 +1,566 @@
<?php
function get_kh_picture_dhd($no,$main_pic,$color){
$pic="";
if(trim($main_pic)){
$pic="../../attachments/design/mini/".$no."_".$main_pic.".jpg";
}
if(!is_file($pic)){
$pic="../../attachments/design/mini/".$no.".jpg";
}
if(!is_file($pic)){
$tmp=explode(",",$color);
for($j=0;$j<count($tmp);$j++){
$pic="../../attachments/design/mini/".$no."_".$tmp[$j].".jpg";
if(is_file($pic))
break;
}
}
if(!is_file($pic)){
$pic="../images/no_pic_80.gif";
}
return $pic;
}
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$sys_size_num=get_max_size_num();
//-------------------------------mysql connect
$dc=$_GET["dc"];
if($dc=="y"){
$s_zd=$_GET["s_zd"]?$_GET["s_zd"]:array("category","bc");
$s_px=$_GET["s_px"]?$_GET["s_px"]:"category,bc";
//文胸
if($bx_sizegroup_title){
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$bx_sizegroup_title."' limit 0,1");
$bx_sizegroup_id=$tmp["id"];
}else{
$bx_sizegroup_id=0;
}
//童装
if($child_sizegroup_title){
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$child_sizegroup_title."' limit 0,1");
$child_sizegroup_id=$tmp["id"];
}else{
$child_sizegroup_id=0;
}
//取得选项
$arr_select_no=array();
$arr_select_title=array();
$q="select no,title from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no<>'jgd' and no<>'sx' and no<>'zd1' and no<>'zd2' and no<>'zd3' order by ord";
$r=$db->query($q);
while($m=$db->fetch_array($r)){
$arr_select_no[]=$m["no"];
$arr_select_title[]=$m["title"];
$tmpa="sx_".$m["no"];
$$tmpa=$_GET[$tmpa];
}
$arr_zd["xh"]="序号";
$arr_zd["price"]="零售价";
$arr_zd["price_zk"]="折扣价";
$arr_zd["title"]="款式名";
for($i=0;$i<count($arr_select_no);$i++){
if(check_arr_select_show($arr_select_no[$i]))
$arr_zd[$arr_select_no[$i]]=$arr_select_title[$i];
$tmpsx="sx_".$arr_select_no[$i];
if($$tmpsx){
$consx.=" and ".$arr_select_no[$i]."='".$$tmpsx."'";
}
}
$data["col"][]='str';
$data["header"][0][]="序号";
$data["col"][]='img';
$data["header"][0][]="图片";
$data["col"][]='str';
$data["header"][0][]="款号";
for($i=0;$i<count($s_zd);$i++){
$data["col"][]='str';
$data["header"][0][]=get_main_value($arr_zd,$s_zd[$i]);
}
$sys_size_num=get_max_size_num();
$cs=$sys_size_num+2;
$data["col"][]='num';
$data["header"][0][]="件数";
for($i=0;$i<$cs;$i++){
$data["col"][]='str';
$data["header"][0][]="";
}
$query="select sum(".get_size_sql("sum").") 'num',no,iid,size_group_id from ".$table_pre."order where ka<>'y'".$consx." group by no order by ".$s_px;
//echo $query."<br>";
$res=$db->query($query);
$count=0;
$l=0;
$_tcontent=array();
$row=0;
while($m=$db->fetch_array($res)){
$list=$count+1;
$bg="#ffffff";
$m1=get_db_msg("select * from ".$table_pre."kh where id='".$m["iid"]."'");
$total_num+=$m["num"];
$total_money+=$money;
//图片
$pic=get_kh_picture_dhd($m1["no"],$m1["main_pic"],$m1["color"]);
$tmp_zd="";
$num_zd=0;
for($i=0;$i<count($s_zd);$i++){
$tmp_zd.="<td bgcolor=\"".$bg."\" class=\"border1\">";
$tmp_zd.=($s_zd=="title" || $s_zd=="price" || $s_zd=="xh")?deel_td($m1[$s_zd[$i]]):deel_td(get_cate_title_no($s_zd[$i],$m1[$s_zd[$i]]));
$tmp_zd.="</td>";
$num_zd++;
}
//--订单明细
//$detail="";
//$detail="<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\" bgcolor='#cccccc'>";
//$detail.="<tr><td bgcolor=\"#f0f0f0\">颜色</td>";
if($bx_sizegroup_id==$m["size_group_id"]){
//$detail.="<td bgcolor=\"#f0f0f0\" width=\"30\">杯型</td>";
//
$size_str="";
$r2=$db->query("select * from ".$table_pre."size where iid='".$m["size_group_id"]."' order by no");
while($m2=$db->fetch_array($r2)){
$size_str.=$m2["no"].",";
}
if($size_str)
$size_str=substr($size_str,0,-1);
$size=explode(",",$size_str);
}else if($child_sizegroup_id==$m["size_group_id"]){
//$detail.="<td bgcolor=\"#f0f0f0\" width=\"25\">款型</td>";
//
$size_str="";
$r2=$db->query("select * from ".$table_pre."size where iid='".$m["size_group_id"]."' order by no");
while($m2=$db->fetch_array($r2)){
$size_str.=$m2["no"].",";
}
if($size_str)
$size_str=substr($size_str,0,-1);
$size=explode(",",$size_str);
}else{
$size=explode(",",$m1["size"]);
}
$tmp1=explode(",",$m1["color"]);
for($l=0;$l<count($size);$l++){
$v1="hj_".$size[$l];
$$v1=0;
$tmp3=get_db_msg("select * from ".$table_pre."size where iid='".$m1["size_group"]."' and no='".$size[$l]."' limit 0,1");
//$detail.="<td bgcolor=\"#f0f0f0\" width=\"30\" align='center'>".$tmp3["title"]."</td>";
}
//$detail.="<td bgcolor=\"#f0f0f0\" width=\"30\">小计</td></tr>";
$q2="select ".get_size_sql("sum1").",color,bx from ".$table_pre."order where ka<>'y' and iid='".$m1["id"]."' group by color,bx";
//echo $q2."<br>";
$r2=$db->query($q2);
$hj=0;
$k=0;
$rs=1;
while($m2=$db->fetch_array($r2)){
//$detail.="<tr><td bgcolor=\"#ffffff\">".$m2["color"]."-".get_cate_title_no("color",$m2["color"])."</td>";
//if($bx_sizegroup_id==$m1["size_group"] || $child_sizegroup_id==$m1["size_group"])
//$detail.="<td bgcolor=\"#ffffff\" align=\"center\">".$m2["bx"]."</td>";
//尺码列表
$xj=0;
for($l=0;$l<count($size);$l++){
$xj+=$m2["num_".$size[$l]];
$hj+=$m2["num_".$size[$l]];
//尺码合计
$v1="hj_".$size[$l];
$$v1+=$m2["num_".$size[$l]];
//$detail.="<td bgcolor=\"#ffffff\" align=\"right\">".deel_0($m2["num_".$size[$l]])."</td>";
}
//$detail.="<td bgcolor=\"#ffffff\" align=\"right\">".$xj."</td></tr>";
$k++;
$rs++;
}
if($bx_sizegroup_id==$m1["size_group"] || $child_sizegroup_id==$m1["size_group"])
$hj_colspan=" colspan='2'";
else
$hj_colspan="";
if($k>1){
$rs++;
//合计
$detail.="<tr><td bgcolor=\"#f0f0f0\" align=\"right\"".$hj_colspan.">合计</td>";
for($l=0;$l<count($size);$l++){
$v1="hj_".$size[$l];
//$detail.="<td bgcolor=\"#f0f0f0\" align=\"right\">".deel_0($$v1)."</td>";
}
//$detail.="<td bgcolor=\"#f0f0f0\" align=\"right\">".$hj."</td></tr>";
}
//$detail.="</table>";
//if($dc!="y"){
//echo "<tr height=\"100\"><td bgcolor=\"".$bg."\" class=\"border1\">".$list."</td><td bgcolor=\"".$bg."\" class=\"border1\"><div align=\"center\">".out_good_pic($pic,90,90)."<div></td><td bgcolor=\"".$bg."\" class=\"border1\">".$m1["no"]."</td>".$tmp_zd."<td bgcolor=\"".$bg."\" class=\"border1\" align=\"center\">".$m["num"]."</td><td bgcolor=\"".$bg."\" valign=\"top\" class=\"border1\">".$detail."</td></tr>";
//}
if($dc=="y"){
$strrs="";
if($rs){
$strrs="|rs:".$rs;
}
$data["body"][$row][]=$list.$strrs;
$data["body"][$row][]=$pic.$strrs;
$data["body"][$row][]=$m1["no"].$strrs;
for($i=0;$i<count($s_zd);$i++){
if($s_zd=="title" || $s_zd=="price" || $s_zd=="xh"){
$data["body"][$row][]=$m1[$s_zd[$i]].$strrs;
}else{
$data["body"][$row][]=get_cate_title_no($s_zd[$i],$m1[$s_zd[$i]]).$strrs;
}
}
$data["body"][$row][]=$m["num"].$strrs;
//--订单明细
//$detail="";
//$detail="<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\" bgcolor='#cccccc'>";
//$detail.="<tr><td bgcolor=\"#f0f0f0\">颜色</td>";
$data["body"][$row][]="颜色";
if($bx_sizegroup_id==$m["size_group_id"]){
//$detail.="<td bgcolor=\"#f0f0f0\" width=\"30\">杯型</td>";
$data["body"][$row][]="杯型";
//
$size_str="";
$r2=$db->query("select * from ".$table_pre."size where iid='".$m["size_group_id"]."' order by no");
while($m2=$db->fetch_array($r2)){
$size_str.=$m2["no"].",";
}
if($size_str)
$size_str=substr($size_str,0,-1);
$size=explode(",",$size_str);
}else if($child_sizegroup_id==$m["size_group_id"]){
//$detail.="<td bgcolor=\"#f0f0f0\" width=\"25\">款型</td>";
$data["body"][$row][]="款型";
//
$size_str="";
$r2=$db->query("select * from ".$table_pre."size where iid='".$m["size_group_id"]."' order by no");
while($m2=$db->fetch_array($r2)){
$size_str.=$m2["no"].",";
}
if($size_str)
$size_str=substr($size_str,0,-1);
$size=explode(",",$size_str);
}else{
$size=explode(",",$m1["size"]);
}
$tmp1=explode(",",$m1["color"]);
for($l=0;$l<count($size);$l++){
$v1="hj_".$size[$l];
$$v1=0;
$tmp3=get_db_msg("select * from ".$table_pre."size where iid='".$m1["size_group"]."' and no='".$size[$l]."' limit 0,1");
//$detail.="<td bgcolor=\"#f0f0f0\" width=\"30\" align='center'>".$tmp3["title"]."</td>";
$data["body"][$row][]=$tmp3["title"];
}
//$detail.="<td bgcolor=\"#f0f0f0\" width=\"30\">小计</td></tr>";
$data["body"][$row][]="小计";
$row++;
$q2="select ".get_size_sql("sum1").",color,bx from ".$table_pre."order where ka<>'y' and iid='".$m1["id"]."' group by color,bx";
//echo $q2."<br>";
$r2=$db->query($q2);
$hj=0;
$k=0;
$rs=0;
//print_r($size);
while($m2=$db->fetch_array($r2)){
//$detail.="<tr><td bgcolor=\"#ffffff\">".$m2["color"]."-".get_cate_title_no("color",$m2["color"])."</td>";
$data["body"][$row][]=$m2["color"]."-".get_cate_title_no("color",$m2["color"]);
if($bx_sizegroup_id==$m1["size_group"] || $child_sizegroup_id==$m1["size_group"]){
//$detail.="<td bgcolor=\"#ffffff\" align=\"center\">".$m2["bx"]."</td>";
$data["body"][$row][]=$m2["bx"];
}
//尺码列表
$xj=0;
for($l=0;$l<count($size);$l++){
//print_r($m2["num_".$size[$l]]);
$xj+=$m2["num_".$size[$l]];
$hj+=$m2["num_".$size[$l]];
//尺码合计
$v1="hj_".$size[$l];
$$v1+=$m2["num_".$size[$l]];
//$detail.="<td bgcolor=\"#ffffff\" align=\"right\">".deel_0($m2["num_".$size[$l]])."</td>";
$data["body"][$row][]=deel_0($m2["num_".$size[$l]]);
}
//$detail.="<td bgcolor=\"#ffffff\" align=\"right\">".$xj."</td></tr>";
$data["body"][$row][]=$xj;
$k++;
$rs++;
$row++;
}
$strhj="";
if($bx_sizegroup_id==$m1["size_group"] || $child_sizegroup_id==$m1["size_group"]){
$hj_colspan=" colspan='2'";
$strhj="|cs:2";
}else{
$hj_colspan="";
}
if($k>1){
$rs++;
//合计
//$detail.="<tr><td bgcolor=\"#f0f0f0\" align=\"right\"".$hj_colspan.">合计</td>";
$data["body"][$row][]="合计".$strhj;
for($l=0;$l<count($size);$l++){
$v1="hj_".$size[$l];
//$detail.="<td bgcolor=\"#f0f0f0\" align=\"right\">".deel_0($$v1)."</td>";
$data["body"][$row][]=deel_0($$v1);
}
//$detail.="<td bgcolor=\"#f0f0f0\" align=\"right\">".$hj."</td></tr>";
$data["body"][$row][]=$hj;
$row++;
}
//$detail.="</table>";
//echo "<tr height=\"100\"><td bgcolor=\"".$bg."\" class=\"border1\">".$list."</td><td bgcolor=\"".$bg."\" class=\"border1\"><div align=\"center\">".out_good_pic($pic,90,90)."<div></td><td bgcolor=\"".$bg."\" class=\"border1\">".$m1["no"]."</td>".$tmp_zd."<td bgcolor=\"".$bg."\" class=\"border1\" align=\"center\">".$m["num"]."</td><td bgcolor=\"".$bg."\" valign=\"top\" class=\"border1\">".$detail."</td></tr>";
}
$count++;
$l++;
}
//print_r($data);
//exit;
$file_name="dhd_".date("Y-m-d-H-i");
output_excel($file_name,$data);
}else{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>大货生产单</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
.border1{
border-bottom:1px solid #cccccc;
}
</style>
</head>
<body>
<br />
<table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="form1" action="dhd.php" method="post">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>大货生产单</b></td>
</tr>
<tr><td align="left" bgcolor="#ffffff" valign="top" style="line-height:150%;">
<?php
//--------------------------------------------------------大货生产单
$s_zd=$_POST["s_zd"]?$_POST["s_zd"]:array("category","bc");
$s_px=$_POST["s_px"]?$_POST["s_px"]:"category,bc";
//文胸
if($bx_sizegroup_title){
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$bx_sizegroup_title."' limit 0,1");
$bx_sizegroup_id=$tmp["id"];
}else{
$bx_sizegroup_id=0;
}
//童装
if($child_sizegroup_title){
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$child_sizegroup_title."' limit 0,1");
$child_sizegroup_id=$tmp["id"];
}else{
$child_sizegroup_id=0;
}
//取得选项
$arr_select_no=array();
$arr_select_title=array();
$q="select no,title from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no<>'jgd' and no<>'sx' and no<>'zd1' and no<>'zd2' and no<>'zd3' order by ord";
$r=$db->query($q);
while($m=$db->fetch_array($r)){
$arr_select_no[]=$m["no"];
$arr_select_title[]=$m["title"];
$tmpa="sx_".$m["no"];
$$tmpa=$_POST[$tmpa];
}
//可选择字段
$arr_zd["xh"]="序号";
$arr_zd["price"]="零售价";
$arr_zd["price_zk"]="折扣价";
$arr_zd["title"]="款式名";
$sxzd="";
$consx="";
$tmpu="?dc=y";
for($i=0;$i<count($arr_select_no);$i++){
if(check_arr_select_show($arr_select_no[$i]))
$arr_zd[$arr_select_no[$i]]=$arr_select_title[$i];
$q="select no,title from ".$table_pre."keyword where cate='".$arr_select_no[$i]."' order by no";
$r=$db->query($q);
$sxzd.="<select name=\"sx_".$arr_select_no[$i]."\" onchange=\"form1.submit();\"><option value=\"\">".$arr_select_title[$i]."筛选</option>";
$op="";
$tmpsx="sx_".$arr_select_no[$i];
//echo $$tmpsx;
while($m=$db->fetch_array($r)){
$op.="<option value=\"".$m["no"]."\"";
if($$tmpsx==$m["no"]){
$op.=" selected";
$consx.=" and ".$arr_select_no[$i]."='".$m["no"]."'";
$tmpu.="&".$tmpsx."=".$m["no"];
}
$op.=">".$m["title"]."</option>";
}
$sxzd.=$op."</select> ";
}
//选项字段:
//排序选项设置数组=>左边填写需要排序的字段(如款号字段为no,数量字段为num,吊牌金额字段为je),多个字段用逗号隔开最后以空格+desc结束。=>右边填写选项显示名字
$arr_px=array(
"category,num desc"=>get_cate_title_no("arr_select","category"),
"category,bc,num desc"=>get_cate_title_no("arr_select","category").",".get_cate_title_no("arr_select","bc"),
"category,series,num desc"=>get_cate_title_no("arr_select","category").",".get_cate_title_no("arr_select","series"),
"category,theme,num desc"=>get_cate_title_no("arr_select","category").",".get_cate_title_no("arr_select","theme"),
"no,num desc"=>"款号",
"num desc"=>"数量"
);
//字段
$zd="";
$i=0;
foreach($arr_zd as $k1 => $v1){
$zd.="<input type=\"checkbox\" name=\"s_zd[]\" value=\"".$k1."\" id=\"zd_".$k1."\"";
if(in_array($k1,$s_zd)){
$zd.=" checked";
$tmpu.="&s_zd[]=".$k1;
}
$zd.="><label for=\"zd_".$k1."\">".$v1."</label>";
}
echo "显示列:".$zd;
echo "&nbsp;&nbsp;排序:<select name=\"s_px\" onchange=\"form1.submit();\">".get_main_op($arr_px,$s_px)."</select>";
echo " </td></tr>";
$tmpu.="&s_px=".$s_px;
$dcurl="";
//echo " <a href='".$tmpu."'>导出</a></td></tr>";
echo "<tr><td>筛选列:".$sxzd;
//echo " <input type=submit value=\" 生 成 \" class=\"button_act\">";
$tmpu.="&s_px=".$s_px;
$dcurl="";
echo "&nbsp;<input type=submit value=\" 生 成 \" class=\"button_act\"> <a href='".$tmpu."'>导出</a></td></tr>";
//-----------------------/search
$th_zd="";
for($i=0;$i<count($s_zd);$i++){
$th_zd.="<td align=\"center\" bgcolor=\"#dddddd\">".get_main_value($arr_zd,$s_zd[$i])."</td>";
}
$sys_size_num=get_max_size_num();
echo "<tr><td bgcolor=\"#ffffff\"><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" bgcolor=\"#cccccc\"><tr><td align=\"center\" bgcolor=\"#dddddd\" width=\"40\">序号</td><td align=\"center\" bgcolor=\"#dddddd\" width=\"100\">图片</td><td align=\"center\" bgcolor=\"#dddddd\">款号</td>".$th_zd."<td align=\"center\" bgcolor=\"#dddddd\" width=\"40\">件数</td><td align=\"center\" bgcolor=\"#dddddd\">明细</td></tr>";
$query="select sum(".get_size_sql("sum").") 'num',no,iid,size_group_id from ".$table_pre."order where ka<>'y'".$consx." group by no order by ".$s_px;
//echo $query."<br>";
$res=$db->query($query);
$count=0;
$l=0;
$_tcontent=array();
$row=0;
while($m=$db->fetch_array($res)){
$list=$count+1;
$bg="#ffffff";
$m1=get_db_msg("select * from ".$table_pre."kh where id='".$m["iid"]."'");
$total_num+=$m["num"];
$total_money+=$money;
//图片
$pic=get_kh_picture_dhd($m1["no"],$m1["main_pic"],$m1["color"]);
$tmp_zd="";
$num_zd=0;
for($i=0;$i<count($s_zd);$i++){
$tmp_zd.="<td bgcolor=\"".$bg."\" class=\"border1\">";
$tmp_zd.=($s_zd=="title" || $s_zd=="price" || $s_zd=="xh")?deel_td($m1[$s_zd[$i]]):deel_td(get_cate_title_no($s_zd[$i],$m1[$s_zd[$i]]));
$tmp_zd.="</td>";
$num_zd++;
}
//--订单明细
$detail="";
$detail="<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\" bgcolor='#cccccc'>";
$detail.="<tr><td bgcolor=\"#f0f0f0\">颜色</td>";
if($bx_sizegroup_id==$m["size_group_id"]){
$detail.="<td bgcolor=\"#f0f0f0\" width=\"30\">杯型</td>";
//
$size_str="";
$r2=$db->query("select * from ".$table_pre."size where iid='".$m["size_group_id"]."' order by no");
while($m2=$db->fetch_array($r2)){
$size_str.=$m2["no"].",";
}
if($size_str)
$size_str=substr($size_str,0,-1);
$size=explode(",",$size_str);
}else if($child_sizegroup_id==$m["size_group_id"]){
$detail.="<td bgcolor=\"#f0f0f0\" width=\"25\">款型</td>";
//
$size_str="";
$r2=$db->query("select * from ".$table_pre."size where iid='".$m["size_group_id"]."' order by no");
while($m2=$db->fetch_array($r2)){
$size_str.=$m2["no"].",";
}
if($size_str)
$size_str=substr($size_str,0,-1);
$size=explode(",",$size_str);
}else{
$size=explode(",",$m1["size"]);
}
$tmp1=explode(",",$m1["color"]);
for($l=0;$l<count($size);$l++){
$v1="hj_".$size[$l];
$$v1=0;
$tmp3=get_db_msg("select * from ".$table_pre."size where iid='".$m1["size_group"]."' and no='".$size[$l]."' limit 0,1");
$detail.="<td bgcolor=\"#f0f0f0\" width=\"30\" align='center'>".$tmp3["title"]."</td>";
}
$detail.="<td bgcolor=\"#f0f0f0\" width=\"30\">小计</td></tr>";
$q2="select ".get_size_sql("sum1").",color,bx from ".$table_pre."order where ka<>'y' and iid='".$m1["id"]."' group by color,bx";
//echo $q2."<br>";
$r2=$db->query($q2);
$hj=0;
$k=0;
$rs=0;
while($m2=$db->fetch_array($r2)){
$detail.="<tr><td bgcolor=\"#ffffff\">".$m2["color"]."-".get_cate_title_no("color",$m2["color"])."</td>";
if($bx_sizegroup_id==$m1["size_group"] || $child_sizegroup_id==$m1["size_group"])
$detail.="<td bgcolor=\"#ffffff\" align=\"center\">".$m2["bx"]."</td>";
//尺码列表
$xj=0;
for($l=0;$l<count($size);$l++){
$xj+=$m2["num_".$size[$l]];
$hj+=$m2["num_".$size[$l]];
//尺码合计
$v1="hj_".$size[$l];
$$v1+=$m2["num_".$size[$l]];
$detail.="<td bgcolor=\"#ffffff\" align=\"right\">".deel_0($m2["num_".$size[$l]])."</td>";
}
$detail.="<td bgcolor=\"#ffffff\" align=\"right\">".$xj."</td></tr>";
$k++;
$rs++;
}
if($bx_sizegroup_id==$m1["size_group"] || $child_sizegroup_id==$m1["size_group"])
$hj_colspan=" colspan='2'";
else
$hj_colspan="";
if($k>1){
$rs++;
//合计
$detail.="<tr><td bgcolor=\"#f0f0f0\" align=\"right\"".$hj_colspan.">合计</td>";
for($l=0;$l<count($size);$l++){
$v1="hj_".$size[$l];
$detail.="<td bgcolor=\"#f0f0f0\" align=\"right\">".deel_0($$v1)."</td>";
}
$detail.="<td bgcolor=\"#f0f0f0\" align=\"right\">".$hj."</td></tr>";
}
$detail.="</table>";
//if($dc!="y"){
echo "<tr height=\"100\"><td bgcolor=\"".$bg."\" class=\"border1\">".$list."</td><td bgcolor=\"".$bg."\" class=\"border1\"><div align=\"center\">".out_good_pic($pic,90,90)."<div></td><td bgcolor=\"".$bg."\" class=\"border1\">".$m1["no"]."</td>".$tmp_zd."<td bgcolor=\"".$bg."\" class=\"border1\" align=\"center\">".$m["num"]."</td><td bgcolor=\"".$bg."\" valign=\"top\" class=\"border1\">".$detail."</td></tr>";
//}
$count++;
$l++;
}
?></table></td></tr></form>
</table>
</body>
</html>
<?php
}
?>
+524
View File
@@ -0,0 +1,524 @@
<?php
//-------------------------------------------------------总部修改订单,先找到款,再按照区域,代理,店铺修改
function get_kh_picture_debug($no,$main_pic,$color){
$pic="";
if(trim($main_pic)){
$pic="../../attachments/design/mini/".$no."_".$main_pic.".jpg";
}
if(!is_file($pic)){
$pic="../../attachments/design/mini/".$no.".jpg";
}
if(!is_file($pic)){
$tmp=explode(",",$color);
for($j=0;$j<count($tmp);$j++){
$pic="../../attachments/design/mini/".$no."_".$tmp[$j].".jpg";
if(is_file($pic))
break;
}
}
if(!is_file($pic)){
$pic="../images/no_pic_80.gif";
}
return $pic;
}
error_reporting(E_ERROR | E_WARNING | E_PARSE);
require "../config.php";
include "../../tmpl/config.php";
require "../../ipad/include/function.php";
require "../../ipad/include/db_mysql.php";
//-------------------------------mysql connect
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$magic_quotes_gpc = get_magic_quotes_gpc();
$register_globals = @ini_get('register_globals');
if(!$register_globals || !$magic_quotes_gpc) {
@extract(daddslashes($_POST));
@extract(daddslashes($_GET));
}
$uid=$_COOKIE[THIS_COOKIE];
if($uid!="1"){
$msg=get_db_msg("select username from ".$table_pre."user where id='1'");
echo "对不起,无权查看,请先用(".$msg["username"].")账号登陆,<a href=\"../?_m=user/logout\">返回</a>!";
exit;
}
$xh_ms=get_set("xh_ms");
$sys_size_num=get_max_size_num();
switch($_a){
case "view_order":
//-------------------------------------取得订单
$default_group_by="";
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."client where face=9");
if($tmp["num"]>0){
$arr_group_by["9"]="区域";
$default_group_by="9";
}
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."client where face=3");
if($tmp["num"]>0){
$arr_group_by["3"]="代理";
$default_group_by="3";
}
$default_group_by=$default_group_by?$default_group_by:"4";
$arr_group_by["4"]="店铺";
$arr_group_by["1"]="明细";
$s_group_by=$s_group_by?$s_group_by:$default_group_by;
$m_kh=get_db_msg("select * from ".$table_pre."kh where id='".$khid."'");
$s_kh=$m_kh["no"];
$pic=get_kh_picture_debug($m_kh["no"],$m_kh["main_pic"],$m_kh["color"]);
$pic1=out_good_pic($pic,200,200,'border=0');
$content="<table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"4\" cellspacing=\"1\" bgcolor=\"#ffffff\"><tr><td bgcolor=\"#ffffff\" align=\"center\">".$pic1."</td></tr><tr><td bgcolor=\"#ffffff\" align=\"center\">".get_kh_xh($m_kh,'')."#".$m_kh["no"]."</td></tr>";
$content.="<tr><td>";
foreach($arr_group_by as $k1 => $v1){
$sty=($k1==$s_group_by)?"font-weight:bold;border:1px solid #f0f0f0;padding:6px;":"font-weight:normal;border:1px solid #cccccc;padding:4px;";
$content.="<a href=\"".$_SERVER[PHP_SELF]."?_a=".$_a."&khid=".$khid."&s_group_by=".$k1."\"><span style=\"".$sty."\">".$v1."</span></a> ";
}
$content.="</td></tr>";
$sql_con="iid='".$khid."' and _key='".$sys_this_order_flag."' and ";
if($color)
$sql_con.="color='".$color."' and ";
$sql_con=substr($sql_con,0,-4);
$size=explode(",",$m_kh["size"]);
if($s_group_by=="1"){
//------------------------明细
$con_dp_o="";
if($dpid){
$m1=get_db_msg("select id,path,title,username from ".$table_pre."client where id='".$dpid."'");
$p1=$m1["path"]."-".$m1["id"];
$con_dp_o.=" and uid='".$m1["id"]."'";
$content.="<tr><td align='left'><b>".$m1["title"]."(".$m1["username"].")</b> <input type='button' value=' 后 退 ' onclick='history.back();'></td></tr>";
}
$content.="<tr><td bgcolor=\"#ffffff\"><table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"4\" cellspacing=\"1\" bgcolor=\"#cccccc\">";
//表头
$content.="<tr><td bgcolor=\"#f0f0f0\">店铺</td><td bgcolor=\"#f0f0f0\">款号</td><td bgcolor=\"#f0f0f0\">颜色</td>";
$tmp1=explode(",",$m_kh["color"]);
for($l=0;$l<count($size);$l++){
$tmp3=get_db_msg("select * from ".$table_pre."size where iid='".$m_kh["size_group"]."' and no='".$size[$l]."' limit 0,1");
$content.="<td bgcolor=\"#f0f0f0\" width=\"25\">".$tmp3["title"]."</td>";
}
$content.="<td bgcolor=\"#f0f0f0\" width=\"30\">小计</td><td bgcolor=\"#f0f0f0\">订单时间</td></tr>";
$q="select * from ".$table_pre."order where ".$sql_con.$con_dp_o." order by uid,color,add_date";
$r=$db->query($q);
$hj=$count=0;
while($m=$db->fetch_array($r)){
$tmp=get_db_msg("select username,title from ".$table_pre."client where id='".$m["uid"]."'");
$m_kh=get_db_msg("select no,color,color_ka from ".$table_pre."kh where id='".$m["iid"]."'");
$arr_color_ka=explode(",",$m_kh["color_ka"]);
$flag_ka=(in_array($m["color"],$arr_color_ka))?"<span class='font_ka'>(已删除)</span>":"";
$content.="<tr><td bgcolor=\"#ffffff\">".$tmp["title"]."(".$tmp["username"].")</td>";
$content.="<td bgcolor=\"#ffffff\">".$m_kh["no"]."</td>";
$content.="<td bgcolor=\"#ffffff\">".$m["color"]."-".get_cate_title_no("color",$m["color"]).$flag_ka."<input type='button' value='修改' onclick=\"o_window('".$_SERVER["PHP_SELF"]."?_a=edit&khid=".$khid."&color=".$m["color"]."&dpid=".$m["uid"]."','edit',760,550)\"></td>";
//尺码列表
$xj=0;
for($l=0;$l<count($size);$l++){
$xj+=$m["num_".$size[$l]];
$hj+=$m["num_".$size[$l]];
//尺码合计
$v1="hj_".$size[$l];
$$v1+=$m["num_".$size[$l]];
$content.="<td bgcolor=\"#ffffff\">".$m["num_".$size[$l]]."</td>";
}
$content.="<td bgcolor=\"#ffffff\">".$xj."</td><td bgcolor=\"#ffffff\">".date("d日 H点i分",$m["add_date"])."</td></tr>";
$count++;
}
if($count==0 && $dpid){
$arr_color=explode(",",$m_kh["color"]);
$arr_color_ka=explode(",",$m_kh["color_ka"]);
for($i1=0;$i1<count($arr_color);$i1++){
$flag_ka=(in_array($arr_color[$i1],$arr_color_ka))?"<span class='font_ka'>(已删除)</span>":"";
$content.="<tr><td bgcolor=\"#ffffff\">".$m1["title"]."(".$m1["username"].")</td><td bgcolor=\"#ffffff\">".$m_kh["no"]."</td><td bgcolor=\"#ffffff\" colspan='".(count($size)+3)."'>".$arr_color[$i1]."-".get_cate_title_no("color",$arr_color[$i1]).$flag_ka."<input type='button' value='下单' onclick=\"o_window('".$_SERVER["PHP_SELF"]."?_a=edit&khid=".$khid."&color=".$arr_color[$i1]."&dpid=".$dpid."','edit',760,550)\"></td></tr>";
}
}
//合计
$hj_colspan=3;
$content.="<tr><td bgcolor=\"#ffffff\" colspan=\"".($hj_colspan)."\" align=\"right\">合计</td>";
for($l=0;$l<count($size);$l++){
$v1="hj_".$size[$l];
$content.="<td bgcolor=\"#ffffff\">".$$v1."</td>";
}
$content.="<td bgcolor=\"#ffffff\">".$hj."</td><td bgcolor=\"#ffffff\">&nbsp;</td></tr>";
}else{
//------------------------店铺、代理、区域
$con_dp=$con_dp_o="";
if($s_group_by=="4"){
if($s_sj){
$m1=get_db_msg("select id,path,title,username from ".$table_pre."client where id='".$s_sj."'");
$p1=$m1["path"]."-".$m1["id"];
$con_dp.=" and (path='".$p1."' or path like '".$p1."-%')";
$con_dp_o.=" and (upath='".$p1."' or upath like '".$p1."-%')";
$content.="<tr><td align='left'><b>".$m1["title"]."(".$m1["username"].")</b> <input type='button' value=' 后 退 ' onclick='history.back();'></td></tr>";
}
}
//取得数组
$arr1=array();
$q="select * from ".$table_pre."client where face='".$s_group_by."'".$con_dp;
$r=$db->query($q);
while($m=$db->fetch_array($r)){
if($s_group_by=="4"){
$tmp_sql=" and uid='".$m["id"]."'";
}else{
$p=$m["path"]."-".$m["id"];
$tmp_sql=" and upath like '".$p."-%'";
}
$tmp=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where ".$sql_con.$tmp_sql.$con_dp_o);
//if($tmp["num"]>0)
$arr1[$m["id"]]=$tmp["num"];
}
arsort($arr1);
$content.="<tr><td bgcolor=\"#ffffff\"><table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"4\" cellspacing=\"1\" bgcolor=\"#cccccc\">";
//表头
$content.="<tr><td bgcolor=\"#f0f0f0\" width=\"25\">序号</td><td bgcolor=\"#f0f0f0\">客户</td>";
for($l=0;$l<count($size);$l++){
$tmp3=get_db_msg("select * from ".$table_pre."size where iid='".$m_kh["size_group"]."' and no='".$size[$l]."' limit 0,1");
$content.="<td bgcolor=\"#f0f0f0\" width=\"25\">".trim($tmp3["title"])."</td>";
}
$content.="<td bgcolor=\"#f0f0f0\" width=\"30\">小计</td></tr>";
//
$hj=0;
$list=1;
foreach($arr1 as $id1 => $num1){
$hj+=$num1;
$m=get_db_msg("select id,path,title,username from ".$table_pre."client where id='".$id1."'");
if($s_group_by=="4"){
$tmp_sql=" and uid='".$m["id"]."'";
$link_var="<a href=\"".$_SERVER["PHP_SELF"]."?_a=".$_a."&khid=".$khid."&s_group_by=1&dpid=".$m["id"]."\">";
}else{
$p=$m["path"]."-".$m["id"];
$tmp_sql=" and (upath='".$p."' or upath like '".$p."-%')";
$link_var="<a href=\"".$_SERVER["PHP_SELF"]."?_a=".$_a."&khid=".$khid."&s_group_by=4&s_sj=".$m["id"]."\">";
}
$tmp=get_db_msg("select ".get_size_sql("sum1")." from ".$table_pre."order where ".$sql_con.$tmp_sql.$con_dp_o);
$content.="<tr><td bgcolor=\"#ffffff\">".$list."</td><td bgcolor=\"#ffffff\">".$link_var.$m["title"]."(".$m["username"].")</a></td>";
for($l=0;$l<count($size);$l++){
$content.="<td bgcolor=\"#ffffff\">".$tmp["num_".$size[$l]]."</td>";
//尺码合计
$v1="hj_".$size[$l];
$$v1+=$tmp["num_".$size[$l]];
}
$content.="<td bgcolor=\"#ffffff\">".$num1."</td>";
$list++;
}
//合计
$hj_colspan=2;
$content.="<tr><td bgcolor=\"#ffffff\" align=\"right\" colspan=\"".$hj_colspan."\">合计</td>";
for($l=0;$l<count($size);$l++){
$v1="hj_".$size[$l];
$content.="<td bgcolor=\"#ffffff\">".$$v1."</td>";
}
$content.="<td bgcolor=\"#ffffff\">".$hj."</td></tr>";
}
$content.="</table></td></tr></table>";
break;
case "edit":
//-------------------------------------修改订单
$m_kh=get_db_msg("select no,size,size_group,color,color_ka,pm_dj from ".$table_pre."kh where id='".$khid."'");
$m_client=get_db_msg("select username,title from ".$table_pre."client where id='".$dpid."'");
$arr_size=explode(",",$m_kh["size"]);
$arr_color_ka=explode(",",$m_kh["color_ka"]);
//-----------------尺码
$str_size_title="";
$arr_size_title=array();
for($i=0;$i<count($arr_size);$i++){
$tmp=get_db_msg("select title from ".$table_pre."size where iid='".$m_kh["size_group"]."' and no='".$arr_size[$i]."'");
$str_size_title.=$arr_size[$i]."|".$tmp["title"].",";
$arr_size_title[$i]=$tmp["title"];
}
if($str_size_title)
$str_size_title=substr($str_size_title,0,-1);
//-----------------
if(in_array($color,$arr_color_ka)){
$is_ka="y";
}else{
$is_ka="n";
}
$is_selected="n";
//-----------------取得装箱数
$q1="select distinct(num) 'num' from ".$table_pre."gz where cate='zxs' and (dj='".$m_client["username"]."' or dj='') and kh='".$m_kh["no"]."' order by num";
$r1=$db->query($q1);
$zxs="";
while($m1=$db->fetch_array($r1)){
$zxs.=$m1["num"].",";
}
if($zxs)
$zxs=substr($zxs,0,-1);
//-----------------取得配码的行数
$tmp1=get_db_msg("select count(*) 'num' from ".$table_pre."size_pm where uid='".$dpid."' and pm_dj='".$m_kh["pm_dj"]."'");
$pm_rows=$tmp1["num"];
//
$colspan1=3+count($arr_size);
//
$q="select * from ".$table_pre."order_pm where _key='".$sys_this_order_flag."' and uid='".$dpid."' and iid='".$khid."' and color='".$color."'";
//echo $q."--<br>";
$r=$db->query($q);
$num_arr="[";
$total_xs=$total_num=$j1=0;
while($m1=$db->fetch_array($r)){
$tmp=get_db_msg("select title,gz from ".$table_pre."size_pm where id='".$m1["pmid"]."'");
$num_arr.="[\"".$color."|".get_cate_title_no("color",$color)."\",".$j1.",\"".$tmp["title"]."|".$tmp["gz"]."\",".$m1["xs"].",\"".$is_ka."\",\"".$is_selected."\"],";
$total_xs+=$m1["xs"];
$total_num+=$m1["xs"]*count_pm_num($tmp["gz"]);
$j1++;
}
if($j1==0){
$num_arr.="[\"".$color."|".get_cate_title_no("color",$color)."\",0,\"|\",0,\"".$is_ka."\",\"".$is_selected."\"],";
$j1=1;
}
$num_arr.="]";
break;
case "save_edit":
//-------------------------------------保存修改
if(substr($str_sub,strlen($str_sub)-1,1)==",")
$str_sub=substr($str_sub,0,-1);
$arr_str_sub=explode(",",$str_sub);
$msg=get_db_msg("select * from ".$table_pre."kh where id='".$khid."'");
//检测配码
$arr_str_sub1=array();
$arr_pm_id=array();
$qy_uid=get_qy_id($msg_login["path"]);
for($i1=0;$i1<count($arr_str_sub);$i1++){
$arr_tmp=explode("|",$arr_str_sub[$i1]);
$arr_gz=explode(":",$arr_tmp[1]);
//取得配码id
$m_pm=get_db_msg("select id from ".$table_pre."size_pm where uid='".$dpid."' and gz='".$arr_tmp[1]."'");
if($m_pm["id"]>0){
$pmid1=$m_pm["id"];
}else{
$pm_title="临时".get_rand_num(4);
$num=count_pm_num($arr_tmp[1]);
$q="insert into ".$table_pre."size_pm (qyid,uid,size_group_id,pm_dj,khid,title,gz,num) values ('".$qy_uid."','".$dpid."','".$msg["size_group"]."','临时配码','".$msg["id"]."','".$pm_title."','".$arr_tmp[1]."','".$num."')";
//echo $q."<br>";
$db->query($q);
$pmid1=$db->insert_id();
}
$arr_pm_id[$i1]=$pmid1;
}
//保存订单
$arr_size=explode(",",$msg["size"]);
$arr_color_ka=explode(",",$msg["color_ka"]);
$tmp_total_num=0;
$tmp_old=get_db_msg("select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where _key='".$sys_this_order_flag."' and uid='".$dpid."' and iid='".$khid."'");
//取得总量
for($i=0;$i<count($arr_str_sub);$i++){
$arr_tmp=explode("|",$arr_str_sub[$i]);
$tmp_num=count_pm_num($arr_tmp[1])*$arr_tmp[2];
$tmp_total_num+=$tmp_num;
}
//取得到色的尺码数量
for($i1=0;$i1<count($arr_str_sub);$i1++){
$arr_tmp=explode("|",$arr_str_sub[$i1]);
$arr_gz=explode(":",$arr_tmp[1]);
for($j=0;$j<count($arr_gz);$j++){
$tmp_num=$arr_gz[$j]*$arr_tmp[2];
$v="pm_num_".$arr_tmp[0]."_".$arr_size[$j];
$$v+=$tmp_num;
}
}
/*
//检查订货规则
for($i=0;$i<count($arr_color);$i++){
if(!in_array($arr_color[$i],$arr_color_ka)){
$num1=0;
for($i1=0;$i1<count($arr_str_sub);$i1++){
$arr_tmp=explode("|",$arr_str_sub[$i1]);
if($arr_tmp[0]==$arr_color[$i]){
$tmp_num=count_pm_num($arr_tmp[1])*$arr_tmp[2];
$num1+=$tmp_num;
}
}
check_dhgz_bdks($msg,$arr_color[$i],$num1);
}
}
check_dhgz_bdk($msg,$tmp_total_num);
check_dhgz_qdl($msg["no"],$tmp_total_num);
check_dhgz_glk($msg["no"],$tmp_total_num);
*/
//取得选项
$arr_select_no=array();
$q1="select no from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no<>'jgd' and no<>'sx' and no<>'zd1' and no<>'zd2' and no<>'zd3' order by ord";
$r1=$db->query($q1);
while($m1=$db->fetch_array($r1)){
$arr_select_no[]=$m1["no"];
}
$check1=get_db_msg("select * from ".$table_pre."kh_dp where kh='".$msg["no"]."' and color='".$color."' and gz='1' limit 0,1");
if(!in_array($color,$arr_color_ka) && !$check1["id"]){
$sql_size1=$sql_size2=$sql_size3="";
$c=0;
for($k=0;$k<count($arr_size);$k++){
$v="pm_num_".$color."_".$arr_size[$k];
$c+=$$v;
$sql_size1.="num_".$arr_size[$k]."='".$$v."',";
$sql_size2.=",'".$$v."'";
$sql_size3.=",num_".$arr_size[$k];
}
$check=get_db_msg("select id from ".$table_pre."order where _key='".$sys_this_order_flag."' and uid='".$dpid."' and iid='".$khid."' and color='".$color."'");
if($check["id"]){
if($c>0){
$q="update ".$table_pre."order set size_group_id='".$msg["size_group"]."',".$sql_size1."add_date='".time()."' where id='".$check["id"]."'";
$db->query($q);
cache_order($dpid,$khid,$color,"");
}else{
$q="delete from ".$table_pre."order where id='".$check["id"]."'";
$db->query($q);
}
}else{
if($c>0){
$sql1=$sql2="";
for($i1=0;$i1<count($arr_select_no);$i1++){
$sql1.=$arr_select_no[$i1].",";
$sql2.="'".$msg[$arr_select_no[$i1]]."',";
}
$q="insert into ".$table_pre."order (uid,upath,iid,no,".$sql1."jgd,color,bx,is_sp,size_group_id".$sql_size3.",_key,sx,add_date) values ('".$dpid."','".$upath."','".$khid."','".$msg["no"]."',".$sql2."'".get_jgd($msg["price"])."','".$color."','','".$msg["is_sp"]."','".$msg["size_group"]."'".$sql_size2.",'".$sys_this_order_flag."','".get_sx($color)."','".time()."')";
$db->query($q);
cache_order($dpid,$khid,$color,"");
}
}
count_ph($dpid,$khid,$color);
}
//清空配码信息
$db->query("delete from ".$table_pre."order_pm where _key='".$sys_this_order_flag."' and uid='".$dpid."' and iid='".$khid."' and color='".$color."'");
//保存配码信息
for($i1=0;$i1<count($arr_str_sub);$i1++){
$arr_tmp=explode("|",$arr_str_sub[$i1]);
$q="insert into ".$table_pre."order_pm (_key,uid,iid,color,pmid,xs) values ('".$sys_this_order_flag."','".$dpid."','".$khid."','".$arr_tmp[0]."','".$arr_pm_id[$i1]."','".$arr_tmp[2]."')";
$db->query($q);
}
//计算数量变化
$log_hd_old_num=$tmp_old["num"];
$log_hd_num=$tmp_total_num-$tmp_old["num"];
echo "<script>
alert('保存成功!');
window.opener.location.reload();
window.close();
</script>";
break;
default:
//
break;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php if(trim($m_kh["no"])) echo $m_kh["no"]." - ";?>总部修改订单</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
.order_single_table{
background-color:#cccccc;
}
.order_single_td1{
background-color:#e9e9e9;
}
.order_single_td2{
background-color:#d3d2d0;
}
.font_ka{
font-weight:bold;color:#ff0000;
}
</style>
<script language="javascript" src="../js/function.js"></Script>
<script type="text/javascript" src="js/function.order.js"></script>
<!--自动完成 -->
<script type="text/javascript" src="../js/autocomplete/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="../js/autocomplete/jquery.autocomplete.js"></script>
<link rel="Stylesheet" href="../js/autocomplete/jquery.autocomplete.css" />
<!--/自动完成 -->
<script>
<?php
if($_a=="edit"){
echo "var strColor='".$color."';\n";
echo "var arrColor=strColor.split(\",\");\n";
echo "var arr_color_hang=[".$j1."];\n";
echo "var strSize=\"".$m_kh["size"]."\";\n";
echo "var arrSize=strSize.split(\",\");\n";
echo "var str_size_title=\"".$str_size_title."\";\n";
echo "var num_arr=".$num_arr.";\n";
echo "var zxs=\"".$zxs."\";\n";
echo "var translate_unit=\"".$m_kh["unit_title"]."\";\n";
echo "var pm_rows=\"".$pm_rows."\";\n";
echo "var uid=".$dpid.";\n";
echo "var id=".$khid.";\n";
echo "var colspan1=\"".$colspan1."\";\n";
echo "var total_xs=\"".$total_xs."\";\n";
echo "var total_num=\"".$total_num."\";\n";
}else{
//取得款号自动完成
$str="var khs = [\n";
$q="select id,no from ".$table_pre."kh ".$con." order by no";
$r=$db->query($q);
$i=0;
while($m=$db->fetch_array($r)){
$str.="{id:\"".$m["id"]."\",no:\"".$m["no"]."\"},";
$i++;
}
if($i>0)
$str=substr($str,0,-1);
$str.="];\n";
echo $str;
echo "$(function() {
$('#s_kh').autocomplete(khs, {
max: 100, //列表里的条目数
minChars: 0, //自动完成激活之前填入的最小字符
width: 100, //提示的宽度,溢出隐藏
scrollHeight: 300, //提示的高度,溢出显示滚动条
matchContains: true, //包含匹配,就是data参数里的数据,是否只要包含文本框里的数据就显示
autoFill: false, //自动填充
formatItem: function(row, i, max) {
return row.no;
},
formatMatch: function(row, i, max) {
return row.no+row.id;
},
formatResult: function(row) {
return row.id;
}
}).result(function(event, row, formatted) {
document.form1.s_kh.value=row.no;
document.form1.khid.value=row.id;
document.form1.submit();
});
});
function check_form(){
var obj=document.form1;
return true;
}";
}
?>
</script>
</head>
<body>
<br />
<?php
if($_a=="edit"){
echo "<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"post\" name=\"form1\" id=\"form1\" onsubmit=\"return save_order();\"><input type=\"hidden\" id=\"_a\" name=\"_a\" value=\"save_edit\"><input type=\"hidden\" name=\"khid\" value=\"".$khid."\" /><input type=\"hidden\" name=\"color\" value=\"".$color."\" /><input type=\"hidden\" id=\"_a\" name=\"_a\" value=\"save_edit\"><input type=\"hidden\" name=\"dpid\" value=\"".$dpid."\" /><input type=\"hidden\" id=\"str_sub\" name=\"str_sub\" value=\"\" /><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\"><tr><td>店 铺:".$m_client["title"]."(".$m_client["username"].")</td></tr><tr><td>款 号:".$m_kh["no"]."</td></tr><tr><td>颜 色:".$color."-".get_cate_title_no("color",$color)."</td></tr><tr><td>装箱数:".$zxs."</td></tr><tr><td><div id='div_num'></div></td></tr><tr><td align='center'><input id=\"sub_save\" name=\"sub_save\" class=\"button1\" type=\"submit\" value=\"保存订单\" /></td></tr></table></form>";
echo "<script> rebuild_num_tr();window.focus(); </script>";
}else{
echo "<form name=\"form1\" action=\"".$_SERVER["PHP_SELF"]."\" method=\"get\" onsubmit=\"return check_form();\"><input type=\"hidden\" id=\"_a\" name=\"_a\" value=\"view_order\"><input type=\"hidden\" id=\"khid\" name=\"khid\" value=\"".$khid."\"><table width=\"90%\" border=\"0\" align=\"center\" cellpadding=\"5\" cellspacing=\"1\" bgcolor=\"#cccccc\">
<tr>
<td align=\"center\" bgcolor=\"#f0f0f0\"><b>总部修改订单</b></td>
</tr>
<tr>
<td align=\"left\" bgcolor=\"#ffffff\" style=\"line-height:25px;\">输入款号<input type=text name=\"s_kh\" id=\"s_kh\" style=\"width:100px\" onfocus=\"this.select()\" value=\"".$s_kh."\"> <input type='submit' value=' 提 交 '></td>
</tr>";
if($content){
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$content."</td></tr>";
}
echo "</table></form>";
}
?>
</body>
</html>
+535
View File
@@ -0,0 +1,535 @@
<?php
//-------------------------------------------------------导出每个客户的订单明细
function get_order_by_client($upath){
global $table_pre,$db,$bx_sizegroup_id,$child_sizegroup_id,$check_md,$zk_type,$xh_ms,$is_gg,$sys_gg_zd,$show_wd;
$_tbody="<html xmlns:o=\"urn:schemas-microsoft-com:office:office\"
xmlns:x=\"urn:schemas-microsoft-com:office:excel\"
xmlns=\"http://www.w3.org/TR/REC-html40\">
<head>
<meta http-equiv=Content-Type content=\"text/html; charset=utf-8\">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content=\"Microsoft Excel 11\">
<style>
<!--table
{mso-displayed-decimal-separator:\"\.\";
mso-displayed-thousand-separator:\"\,\";}
@page
{margin:1.0in .75in 1.0in .75in;
mso-header-margin:.5in;
mso-footer-margin:.5in;}
tr
{mso-height-source:auto;
mso-ruby-visibility:none;}
col
{mso-width-source:auto;
mso-ruby-visibility:none;}
br
{mso-data-placement:same-cell;}
.style0
{mso-number-format:General;
text-align:general;
vertical-align:middle;
white-space:nowrap;
mso-rotate:0;
mso-background-source:auto;
mso-pattern:auto;
color:windowtext;
font-size:12.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
border:none;
mso-protection:locked visible;
mso-style-name:常规;
mso-style-id:0;}
td
{mso-style-parent:style0;
padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:windowtext;
font-size:12.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-number-format:General;
text-align:general;
vertical-align:middle;
border:none;
mso-background-source:auto;
mso-pattern:auto;
mso-protection:locked visible;
white-space:nowrap;
mso-rotate:0;}
ruby
{ruby-align:left;}
rt
{color:windowtext;
font-size:9.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-char-type:none;
display:none;}
-->
</style>
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:WorksheetOptions>
<x:DefaultRowHeight>285</x:DefaultRowHeight>
<x:Selected/>
<x:ProtectContents>False</x:ProtectContents>
<x:ProtectObjects>False</x:ProtectObjects>
<x:ProtectScenarios>False</x:ProtectScenarios>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
<x:WindowHeight>8640</x:WindowHeight>
<x:WindowWidth>17955</x:WindowWidth>
<x:WindowTopX>720</x:WindowTopX>
<x:WindowTopY>315</x:WindowTopY>
<x:ProtectStructure>False</x:ProtectStructure>
<x:ProtectWindows>False</x:ProtectWindows>
</x:ExcelWorkbook>
</xml><![endif]-->
</head>
<body link=blue vlink=purple><table x:str border=0 cellpadding=0 cellspacing=0 style='border-collapse:
collapse;table-layout:fixed;'>";
//-------------------处理尺码表头
//取得合并尺码
$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"]:"&nbsp;";
$size_tr[$num_size_group].="<td width=\"5%\">".$t."</td>";
}
$num_size_group++;
}
//-------------------/处理尺码表头结束
$_tbody.="<tr>";
if($xh_ms=="1")
$_tbody.="<td rowspan=\"".$num_size_group."\">序号</td>";
$_tbody.="<td rowspan=\"".$num_size_group."\">款号</td>";
$_tbody.="<td rowspan=\"".$num_size_group."\">款式名</td>";
//取得定制选项
$q="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no<>'jgd' and no<>'sx' order by ord";
$r=$db->query($q);
$num_dz=0;
while($m=$db->fetch_array($r)){
$_tbody.="<td rowspan=\"".$num_size_group."\">".get_cate_title_no("arr_select",$m["no"])."</td>";
$arr_zd[$m["no"]]=$m["title"];
$num_dz++;
}
if($is_gg!="y")
$_tbody.="<td rowspan=\"".$num_size_group."\">吊牌价</td>";
if($xh_ms=="2")
$_tbody.="<td rowspan=\"".$num_size_group."\">序号</td>";
$_tbody.="<td rowspan=\"".$num_size_group."\">颜色名称</td><td rowspan=\"".$num_size_group."\">颜色代码</td>";
if($bx_sizegroup_id>0)
$_tbody.="<td rowspan=\"".$num_size_group."\">杯型</td>";
else if($child_sizegroup_id>0)
$_tbody.="<td rowspan=\"".$num_size_group."\">款型</td>";
if($is_gg=="y")
$_tbody.="<td rowspan=\"".$num_size_group."\" bgcolor=\"#f0f0f0\" align=\"center\">".d_translate("gg")."</td><td rowspan=\"".$num_size_group."\" bgcolor=\"#f0f0f0\" align=\"center\">".get_main_value($sys_gg_zd,"price")."</td>";
else if($is_gg=="b")
$_tbody.="<td rowspan=\"".$num_size_group."\" bgcolor=\"#f0f0f0\" align=\"center\">".d_translate("gg")."</td>";
$_tbody.=$size_tr[0]."<td rowspan=\"".$num_size_group."\">小计</td><td rowspan=\"".$num_size_group."\">吊牌金额</td>";
if(trim($zk_type) || $check_md["num"]>0)
$_tbody.="<td rowspan=\"".$num_size_group."\">结算金额</td>";
$_tbody.="</tr>";
for($i=1;$i<$num_size_group;$i++){
$_tbody.="<tr>".$size_tr[$i]."</tr>";
}
$sql_con="where (upath='".$upath."' or upath like '".$upath."-%') and ka<>'y'";
if($show_wd=="n"){
//-------不显示未订款
$q="select iid,no,price from ".$table_pre."order ".$sql_con." group by no order by bc,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"]."'");
$price_zk=get_price_zk($m1["id"],$m_client["id"]);
//取得颜色,杯型
$q2="select iid,color,bx,".get_size_sql("sum1").",sum(num) 'num',sum(je) 'je',sum(jsje) 'jsje',price from ".$table_pre."order ".$sql_con." and no='".$m["no"]."' group by color,bx order by color,bx";
//echo $q2."<br>";
$r2=$db->query($q2);
//
$j=0;
$je1=$jsje1=$num1=0;
while($m2=$db->fetch_array($r2)){
$td_size1="";
for($k=0;$k<$num_size_total;$k++){
$tmp_num=$m2["num_".$arr_size_merged[$k]];
//计算尺码合计
$v11="hj_num_".$k;
$$v11+=$tmp_num;
//
$td_size1.="<td x:num>".deel_td(deel_0($tmp_num))."</td>";
}
if($m2["num"]>0){
$arr_kh_color[$count][$j]="";
if($xh_ms=="2")
$arr_kh_color[$count][$j]="<td>".get_kh_xh($m1,$m2["color"])."</td>";
$arr_kh_color[$count][$j].="<td>".get_cate_title_no("color",$m2["color"])."</td><td>".$m2["color"]."</td>";
//if($bx_sizegroup_id>0)
if($bx_sizegroup_id>0 || $child_sizegroup_id>0)
$arr_kh_color[$count][$j].="<td>".deel_td($m2["bx"])."</td>";
if($is_gg=="y"){
//取得规格价格
$tmp=get_db_msg("select price from ".$table_pre."kh_gg where iid='".$m2["iid"]."' and color='".$m2["color"]."' and gg='".$m2["bx"]."'");
$arr_kh_color[$count][$j].="<td>".deel_td(get_gg_title($m2["bx"]))."</td><td>".deel_td($tmp["price"])."</td>";
}else if($is_gg=="b"){
$arr_kh_color[$count][$j].="<td>".deel_td(get_gg_title($m2["bx"]))."</td>";
}
$arr_kh_color[$count][$j].=$td_size1;
$j++;
}
$num1+=$m2["num"];
$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"];
$arr_kh[$count]["title"]=$m1["title"];
if($xh_ms=="1"){
$xh=get_kh_xh($m1);
$arr_kh[$count]["xh"]=$xh;
}
$arr_kh[$count]["title"]=$m1["title"];
foreach($arr_zd as $k1 => $v1){
if($k1!="zd1" && $k1!="zd2" && $k1!="zd3")
$arr_kh[$count][$k1]=get_cate_title_no($k1,$m1[$k1]);
else
$arr_kh[$count][$k1]=$m1[$k1];
}
$arr_kh[$count]["num"]=$num1;
$arr_kh[$count]["price"]=$m["price"];
$arr_kh[$count]["je"]=$je1;
$arr_kh[$count]["jsje"]=$jsje1;
$count++;
}
}
//组合输出内容
$count=0;
for($i=0;$i<count($arr_kh);$i++){
$num1=count($arr_kh_color[$i]);
for($j=0;$j<$num1;$j++){
if($j==0){
$tmp_zd="";
foreach($arr_zd as $k1 => $v1){
$tmp_zd.="<td rowspan=\"".$num1."\">".deel_td($arr_kh[$i][$k1])."</td>";
}
$_tbody.="<tr>";
if($xh_ms=="1")
$_tbody.="<td rowspan=\"".$num1."\">".$arr_kh[$i]["xh"]."</td>";
$_tbody.="<td rowspan=\"".$num1."\">".$arr_kh[$i]["no"]."</td><td rowspan=\"".$num1."\">".$arr_kh[$i]["title"]."</td>".$tmp_zd;
if($is_gg!="y")
$_tbody.="<td rowspan=\"".$num1."\">".$arr_kh[$i]["price"]."</td>";
$_tbody.=$arr_kh_color[$i][$j]."<td rowspan=\"".$num1."\" x:num>".$arr_kh[$i]["num"]."</td><td rowspan=\"".$num1."\" x:num>".deel_num($arr_kh[$i]["je"])."</td>";
if(trim($zk_type) || $check_md["num"]>0)
$_tbody.="<td rowspan=\"".$num1."\" x:num>".deel_num($arr_kh[$i]["jsje"])."</td>";
$_tbody.="</tr>";
}else{
$_tbody.="<tr>".$arr_kh_color[$i][$j]."</tr>";
}
$count++;
}
}
}else{
//-------显示未订款,不合并款号
//取得订单表数据
$arr_order=array();
$q="select iid,color,bx,jsje/num 'price',sum(num) 'num',".get_size_sql("sum1").",sum(je) 'je',sum(jsje) 'jsje' from ".$table_pre."order ".$sql_con." group by iid,color,bx";
//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)){
$arr_order[$m["iid"]][$m["color"]][$m["bx"]]=$m;
}
//
//print_r($arr_order);
//
$arr_data=array();
$q="select id,no,color,color_ka,size from ".$table_pre."kh where ka<>'y' order by no";
$r=$db->query($q);
$i=0;
$count=0;
while($m=$db->fetch_array($r)){
//取得bx,size
$arr_bx_size=array();
$check_bx=get_db_msg("select count(*) 'num' from ".$table_pre."size_bx where no='".$m["no"]."'");
if($check_bx["num"]>0){
$q1="select no,bx,size from ".$table_pre."size_bx where no='".$m["no"]."'";
$r1=$db->query($q1);
while($m1=$db->fetch_array($r1)){
$arr_bx_size[$m1["bx"]]=$m1["size"];
}
}else{
$arr_bx_size[""]=$m["size"];
}
$arr_color=explode(",",$m["color"]);
$arr_color_ka=explode(",",$m["color_ka"]);
for($j=0;$j<count($arr_color);$j++){
if(!in_array($arr_color[$j],$arr_color_ka)){
foreach($arr_bx_size as $bx1 => $size1){
$arr_data[$count]["iid"]=$m["id"];
$arr_data[$count]["color"]=$arr_color[$j];
$arr_data[$count]["bx"]=$bx1;
$arr_size1=explode(",",$size1);
for($k=0;$k<count($arr_size1);$k++){
$arr_data[$count]["num_".$arr_size1[$k]]=$arr_order[$m["id"]][$arr_color[$j]][$bx1]["num_".$arr_size1[$k]];
}
$arr_data[$count]["num"]=$arr_order[$m["id"]][$arr_color[$j]][$bx1]["num"];
$arr_data[$count]["je"]=$arr_order[$m["id"]][$arr_color[$j]][$bx1]["je"];
$arr_data[$count]["jsje"]=$arr_order[$m["id"]][$arr_color[$j]][$bx1]["jsje"];
$count++;
}
}
}
$i++;
}
//print_r($arr_data);
//exit;
//输出
$total_num=$total_money=$total_money_zk=0;
for($i=0;$i<count($arr_data);$i++){
$msg_kh=get_db_msg("select * from ".$table_pre."kh where id='".$arr_data[$i]["iid"]."'");
$_tbody.="<tr>";
$_tbody.="<td>".get_kh_xh($msg_kh,$arr_data[$i]["color"])."</td>";
$tmp_zd="";
foreach($arr_zd as $k1 => $v1){
if($k1!="zd1" && $k1!="zd2" && $k1!="zd3")
$tmp1=get_cate_title_no($k1,$msg_kh[$k1]);
else
$tmp1=$msg_kh[$k1];
$tmp_zd.="<td>".deel_td($tmp1)."</td>";
}
$_tbody.="<td>".$msg_kh["no"]."</td><td>".$msg_kh["title"]."</td>".$tmp_zd;
if($is_gg!="y")
$_tbody.="<td>".deel_num(keep_float($arr_data[$i]["price"],1))."</td>";
$_tbody.="<td>".get_cate_title_no("color",$arr_data[$i]["color"])."</td>";
$_tbody.="<td>".$arr_data[$i]["color"]."</td>";
if($bx_sizegroup_id>0)
$arr_kh_color[$count][$j].="<td>".deel_td($m2["bx"])."</td>";
if($is_gg=="y"){
//取得规格价格
$tmp=get_db_msg("select price from ".$table_pre."kh_gg where iid='".$arr_data[$i]["iid"]."' and color='".$arr_data[$i]["color"]."' and gg='".$arr_data[$i]["bx"]."'");
$_tbody.="<td>".deel_td(get_gg_title($arr_data[$i]["bx"]))."</td><td>".deel_td($tmp["price"])."</td>";
}else if($is_gg=="b"){
$arr_kh_color[$count][$j].="<td>".deel_td(get_gg_title($arr_data[$i]["bx"]))."</td>";
}
if($bx_sizegroup_id>0 || $child_sizegroup_id>0)
$_tbody.="<td>".$m["bx"]."</td>";
//尺码
for($k=0;$k<$num_size_total;$k++){
$v1="hj_num_".$k;
$$v1+=$arr_data[$i]["num_".$arr_size_merged[$k]];
$_tbody.="<td x:num>".deel_0(deel_num($arr_data[$i]["num_".$arr_size_merged[$k]]))."</td>";
}
$_tbody.="<td x:num>".deel_0(deel_num($arr_data[$i]["num"]))."</td>";
$_tbody.="<td x:num>".deel_0(deel_num($arr_data[$i]["je"]))."</td>";
if(trim($zk_type) || $check_md["num"]>0)
$_tbody.="<td x:num>".deel_num($arr_data[$i]["jsje"])."</td>";
$_tbody.="</tr>";
$total_num+=$arr_data[$i]["num"];
$total_money+=$arr_data[$i]["je"];
$total_money_zk+=$arr_data[$i]["jsje"];
}
}
$tmp_zd_je="<td x:num>".$total_money."</td>";
if(trim($zk_type) || $check_md["num"]>0){
$tmp_zd_je.="<td x:num>".keep_float($total_money_zk,2)."</td>";
}
$td_size1="";
for($k=0;$k<$num_size_total;$k++){
$v1="hj_num_".$k;
$td_size1.="<td x:num>".deel_td($$v1)."</td>";
}
if($bx_sizegroup_id>0 || $child_sizegroup_id>0)
$colspan1=count($arr_zd)+7;
else
$colspan1=count($arr_zd)+6;
if($is_gg=="y")
$colspan1++;
else if($is_gg=="b")
$colspan1++;
$_tbody.="<tr><td colspan=\"".($colspan1)."\">合计</td>".$td_size1."<td x:num>".$total_num."</td>".$tmp_zd_je."</tr>";
$_tbody.="</table></body></html>";
return $_tbody;
}
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
header("Content-type: text/html; charset=utf-8");
//-------------------------------mysql connect
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$sub=$_GET["sub"];
$id=$_GET["id"];
$list=$_GET["list"]?$_GET["list"]:1;
$is_dir=$_GET["is_dir"]?$_GET["is_dir"]:"n";
$show_wd=$_GET["show_wd"]?$_GET["show_wd"]:"n";
if($sub=="y"){
//
$xh_ms=get_set("xh_ms");
$check_md=get_db_msg("select count(*) 'num' from ".$table_pre."kh_md");
//文胸
if($bx_sizegroup_title){
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$bx_sizegroup_title."' limit 0,1");
$bx_sizegroup_id=$tmp["id"];
}else{
$bx_sizegroup_id=0;
}
//童装
if($child_sizegroup_title){
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$child_sizegroup_title."' limit 0,1");
$child_sizegroup_id=$tmp["id"];
}else{
$child_sizegroup_id=0;
}
$zk_type=get_set("zk_type");
//
$sys_size_num=get_max_size_num();
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."client where face>'2'");
$total=$tmp["num"];
if(!$id){
//
$tmp=get_db_msg("select min(id) 'id' from ".$table_pre."client where face>'2'");
$this_id=$tmp["id"];
}else{
$tmp=get_db_msg("select min(id) 'id' from ".$table_pre."client where face>'2' and id>'".$id."'");
$this_id=$tmp["id"];
}
$m=get_db_msg("select * from ".$table_pre."client where id='".$this_id."'");
$upath=$m["path"]."-".$m["id"];
//检查是否有订单
$q1="select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where (upath='".$upath."' or upath like '".$upath."-%') and ka<>'y'";
$tmp=get_db_msg($q1);
if($tmp["num"]>0){
//echo $q."<br>";
$content=get_order_by_client($upath);
$file_name="订单明细_".get_main_value($arr_client_face,$m["face"])."_".$m["title"]."_".$m["username"].".xls";
if($is_dir=="y"){
//建立目录结构
$dir1="";
$arr_path=explode("-",$m["path"]);
for($j=0;$j<count($arr_path);$j++){
if($arr_path[$j]>0){
$m1=get_db_msg("select title from ".$table_pre."client where id='".$arr_path[$j]."'");
//$dir.="/".$m1["title"];
$dir1.="/".$m1["title"];
$dir=iconv("utf-8","gb2312",$dir1);
make_dir("xls".$dir);
}
}
}else{
$dir="/";
}
$file_name=iconv("utf-8","gb2312",$file_name);
write_file("xls".$dir,$file_name,$content);
$file_name=iconv("gb2312","utf-8",$file_name);
$list++;
echo $list."/".$total.":".$file_name.",输出完成,<a href=\"".$_SERVER[PHP_SELF]."?is_dir=".$is_dir."&show_wd=".$show_wd."\">暂停</a><br>";
}
$url=$_SERVER[PHP_SELF]."?sub=y&id=".$this_id."&list=".$list."&is_dir=".$is_dir."&show_wd=".$show_wd;
//取得最大id
$tmp=get_db_msg("select max(id) 'id' from ".$table_pre."client where face>'2'");
$db->close();
if($id<$tmp["id"]){
//
url_redirect($url);
}else{
echo $total."个客户订单输出完成(包含无订单的客户),位于admin/debug/xls/下面,请手动下载!";
}
exit;
}else{
$is_dir=$is_dir?$is_dir:"n";
$arr_is_dir=array("n"=>"同一个目录","y"=>"按照客户结构列出目录");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>导出每个客户的订单明细</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="form1" action="<?php echo $_SERVER[PHP_SELF]; ?>" method="get">
<input type="hidden" name="sub" value="y">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>导出每个客户的订单明细</b></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">文件目录方式<select name="is_dir"><?php echo get_main_op($arr_is_dir,$is_dir); ?></select> <select name="show_wd"><?php echo get_main_op(array("n"=>"不显示未订","y"=>"显示未订"),"n"); ?></select></td>
</tr>
<tr>
<td align="center" bgcolor="#f0f0f0"><input type="submit" value=" 执 行 "></td>
</tr>
<?php
if($msg){
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
}
?>
</form>
</table>
</body>
</html>
@@ -0,0 +1,325 @@
<?php
//-------------------------------------------------------导出每个客户的erp可导入文件,尺码横排
function get_order_by_client($upath){
global $table_pre,$db,$bx_sizegroup_id,$child_sizegroup_id,$check_md,$zk_type,$xh_ms,$cid;
$_tbody="<html xmlns:o=\"urn:schemas-microsoft-com:office:office\"
xmlns:x=\"urn:schemas-microsoft-com:office:excel\"
xmlns=\"http://www.w3.org/TR/REC-html40\">
<head>
<meta http-equiv=Content-Type content=\"text/html; charset=utf-8\">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content=\"Microsoft Excel 11\">
<style>
<!--table
{mso-displayed-decimal-separator:\"\.\";
mso-displayed-thousand-separator:\"\,\";}
@page
{margin:1.0in .75in 1.0in .75in;
mso-header-margin:.5in;
mso-footer-margin:.5in;}
tr
{mso-height-source:auto;
mso-ruby-visibility:none;}
col
{mso-width-source:auto;
mso-ruby-visibility:none;}
br
{mso-data-placement:same-cell;}
.style0
{mso-number-format:General;
text-align:general;
vertical-align:middle;
white-space:nowrap;
mso-rotate:0;
mso-background-source:auto;
mso-pattern:auto;
color:windowtext;
font-size:12.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
border:none;
mso-protection:locked visible;
mso-style-name:常规;
mso-style-id:0;}
td
{mso-style-parent:style0;
padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:windowtext;
font-size:12.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-number-format:General;
text-align:general;
vertical-align:middle;
border:none;
mso-background-source:auto;
mso-pattern:auto;
mso-protection:locked visible;
white-space:nowrap;
mso-rotate:0;}
ruby
{ruby-align:left;}
rt
{color:windowtext;
font-size:9.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-char-type:none;
display:none;}
-->
</style>
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:WorksheetOptions>
<x:DefaultRowHeight>285</x:DefaultRowHeight>
<x:Selected/>
<x:ProtectContents>False</x:ProtectContents>
<x:ProtectObjects>False</x:ProtectObjects>
<x:ProtectScenarios>False</x:ProtectScenarios>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
<x:WindowHeight>8640</x:WindowHeight>
<x:WindowWidth>17955</x:WindowWidth>
<x:WindowTopX>720</x:WindowTopX>
<x:WindowTopY>315</x:WindowTopY>
<x:ProtectStructure>False</x:ProtectStructure>
<x:ProtectWindows>False</x:ProtectWindows>
</x:ExcelWorkbook>
</xml><![endif]-->
</head>
<body link=blue vlink=purple><table x:str border=0 cellpadding=0 cellspacing=0 style='border-collapse:
collapse;table-layout:fixed;'>";
//-------------------处理尺码表头
//取得合并尺码
$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"]:"&nbsp;";
$size_tr[$num_size_group].="<td bgcolor=\"#f0f0f0\" align=\"center\" width=\"5%\">".$t."</td>";
}
$num_size_group++;
}
//-------------------/处理尺码表头结束
//
$_tbody.="<tr>";
$_tbody.="<td align=\"center\">ltExpd</td>";
$_tbody.="<td align=\"center\">商品尺码横排明细</td>";
for($i=1;$i<=$num_size_total;$i++){
$_tbody.="<td align=\"center\">&nbsp;</td>";
}
$_tbody.="<td align=\"center\">&nbsp;</td>";
$_tbody.="<td align=\"center\">&nbsp;</td>";
$_tbody.="<td align=\"center\">&nbsp;</td>";
$_tbody.="</tr>";
//
$_tbody.="<tr>";
$_tbody.="<td align=\"center\">商品代码</td>";
$_tbody.="<td align=\"center\">颜色代码</td>";
if($bx_sizegroup_id>0)
$_tbody.="<td align=\"center\">杯型</td>";
else if($child_sizegroup_id>0)
$_tbody.="<td align=\"center\">款型</td>";
$_tbody.=$size_tr[0];
$_tbody.="<td align=\"center\">标准价</td>";
$_tbody.="<td align=\"center\">折扣</td>";
$_tbody.="<td align=\"center\">单价</td>";
$_tbody.="</tr>";
$sql_con="where (upath='".$upath."' or upath like '".$upath."-%') and ka<>'y'";
$q="select * from ".$table_pre."order ".$sql_con." order by no,color,bx";
//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)){
if($m["num"]>0){
$m_kh=get_db_msg("select no,price from ".$table_pre."kh where id='".$m["iid"]."'");
//取得尺码
$_tbody.="<tr>";
$_tbody.="<td>".$m_kh["no"]."</td>";
$_tbody.="<td>".$m["color"]."</td>";
if($bx_sizegroup_id>0 || $child_sizegroup_id>0)
$_tbody.="<td>".$m["bx"]."</td>";
for($i=1;$i<=$num_size_total;$i++){
$_tbody.="<td x:num>".$m["num_".$i]."</td>";
}
$_tbody.="<td x:num>".$m_kh["price"]."</td>";
$m_zk=get_db_msg("select * from ".$table_pre."zk where cid='".$cid."' and iid='".$m["iid"]."'");
$_tbody.="<td>".$m_zk["zk"]."</td>";
$_tbody.="<td x:num>".$m_zk["price"]."</td>";
$_tbody.="</tr>";
}
}
$_tbody.="</table></body></html>";
return $_tbody;
}
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
header("Content-type: text/html; charset=utf-8");
//-------------------------------mysql connect
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$sub=$_GET["sub"];
$id=$_GET["id"];
$list=$_GET["list"]?$_GET["list"]:1;
$is_dir=$_GET["is_dir"]?$_GET["is_dir"]:"n";
if($sub=="y"){
//
$xh_ms=get_set("xh_ms");
$check_md=get_db_msg("select count(*) 'num' from ".$table_pre."kh_md");
//文胸
if($bx_sizegroup_title){
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$bx_sizegroup_title."' limit 0,1");
$bx_sizegroup_id=$tmp["id"];
}else{
$bx_sizegroup_id=0;
}
//童装
if($child_sizegroup_title){
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$child_sizegroup_title."' limit 0,1");
$child_sizegroup_id=$tmp["id"];
}else{
$child_sizegroup_id=0;
}
$zk_type=get_set("zk_type");
//
$sys_size_num=get_max_size_num();
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."client where face>'2'");
$total=$tmp["num"];
if(!$id){
//
$tmp=get_db_msg("select min(id) 'id' from ".$table_pre."client where face>'2'");
$this_id=$tmp["id"];
}else{
$tmp=get_db_msg("select min(id) 'id' from ".$table_pre."client where face>'2' and id>'".$id."'");
$this_id=$tmp["id"];
}
$m=get_db_msg("select * from ".$table_pre."client where id='".$this_id."'");
$cid=$m["id"];
$upath=$m["path"]."-".$m["id"];
//检查是否有订单
$q1="select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where (upath='".$upath."' or upath like '".$upath."-%') and ka<>'y'";
$tmp=get_db_msg($q1);
if($tmp["num"]>0){
//echo $q."<br>";
$content=get_order_by_client($upath);
$file_name="订单明细_".get_main_value($arr_client_face,$m["face"])."_".$m["title"]."_".$m["username"].".xls";
if($is_dir=="y"){
//建立目录结构
$dir="";
$arr_path=explode("-",$m["path"]);
for($j=0;$j<count($arr_path);$j++){
if($arr_path[$j]>0){
$m1=get_db_msg("select title from ".$table_pre."client where id='".$arr_path[$j]."'");
$dir.="/".$m1["title"];
$dir=iconv("utf-8","gb2312",$dir);
make_dir("xls".$dir);
}
}
}else{
$dir="/";
}
$file_name=iconv("utf-8","gb2312",$file_name);
write_file("xls".$dir,$file_name,$content);
$list++;
echo $list."/".$total.":".$file_name.",输出完成,<a href=\"".$_SERVER[PHP_SELF]."?is_dir=".$is_dir."\">暂停</a><br>";
}
$url=$_SERVER[PHP_SELF]."?sub=y&id=".$this_id."&list=".$list."&is_dir=".$is_dir;
//取得最大id
$tmp=get_db_msg("select max(id) 'id' from ".$table_pre."client where face>'2'");
$db->close();
if($id<$tmp["id"]){
//
url_redirect($url);
}else{
echo $total."个客户订单输出完成(包含无订单的客户),位于admin/debug/xls/下面,请手动下载!";
}
exit;
}else{
$is_dir=$is_dir?$is_dir:"n";
$arr_is_dir=array("n"=>"同一个目录","y"=>"按照客户结构列出目录");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>导出每个客户的订单明细</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="form1" action="<?php echo $_SERVER[PHP_SELF]; ?>" method="get">
<input type="hidden" name="sub" value="y">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>导出每个客户的订单明细</b></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">文件目录方式<select name="is_dir"><?php echo get_main_op($arr_is_dir,$is_dir); ?></select></td>
</tr>
<tr>
<td align="center" bgcolor="#f0f0f0"><input type="submit" value=" 执 行 "></td>
</tr>
<?php
if($msg){
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
}
?>
</form>
</table>
</body>
</html>
@@ -0,0 +1,296 @@
<?php
//-------------------------------------------------------导出每个客户的erp可导入文件,尺码竖排
function get_order_by_client($upath){
global $table_pre,$db,$check_md,$zk_type,$xh_ms;
$_tbody="<html xmlns:o=\"urn:schemas-microsoft-com:office:office\"
xmlns:x=\"urn:schemas-microsoft-com:office:excel\"
xmlns=\"http://www.w3.org/TR/REC-html40\">
<head>
<meta http-equiv=Content-Type content=\"text/html; charset=utf-8\">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content=\"Microsoft Excel 11\">
<style>
<!--table
{mso-displayed-decimal-separator:\"\.\";
mso-displayed-thousand-separator:\"\,\";}
@page
{margin:1.0in .75in 1.0in .75in;
mso-header-margin:.5in;
mso-footer-margin:.5in;}
tr
{mso-height-source:auto;
mso-ruby-visibility:none;}
col
{mso-width-source:auto;
mso-ruby-visibility:none;}
br
{mso-data-placement:same-cell;}
.style0
{mso-number-format:General;
text-align:general;
vertical-align:middle;
white-space:nowrap;
mso-rotate:0;
mso-background-source:auto;
mso-pattern:auto;
color:windowtext;
font-size:12.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
border:none;
mso-protection:locked visible;
mso-style-name:常规;
mso-style-id:0;}
td
{mso-style-parent:style0;
padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:windowtext;
font-size:12.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-number-format:General;
text-align:general;
vertical-align:middle;
border:none;
mso-background-source:auto;
mso-pattern:auto;
mso-protection:locked visible;
white-space:nowrap;
mso-rotate:0;}
ruby
{ruby-align:left;}
rt
{color:windowtext;
font-size:9.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-char-type:none;
display:none;}
-->
</style>
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:WorksheetOptions>
<x:DefaultRowHeight>285</x:DefaultRowHeight>
<x:Selected/>
<x:ProtectContents>False</x:ProtectContents>
<x:ProtectObjects>False</x:ProtectObjects>
<x:ProtectScenarios>False</x:ProtectScenarios>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
<x:WindowHeight>8640</x:WindowHeight>
<x:WindowWidth>17955</x:WindowWidth>
<x:WindowTopX>720</x:WindowTopX>
<x:WindowTopY>315</x:WindowTopY>
<x:ProtectStructure>False</x:ProtectStructure>
<x:ProtectWindows>False</x:ProtectWindows>
</x:ExcelWorkbook>
</xml><![endif]-->
</head>
<body link=blue vlink=purple><table x:str border=0 cellpadding=0 cellspacing=0 style='border-collapse:
collapse;table-layout:fixed;'>";
//-------------------处理尺码表头
//取得合并尺码
$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"]:"&nbsp;";
$size_tr[$num_size_group].="<td bgcolor=\"#f0f0f0\" align=\"center\" width=\"5%\">".$t."</td>";
}
$num_size_group++;
}
//-------------------/处理尺码表头结束
$_tbody.="<tr>";
$_tbody.="<td align=\"center\">条码</td>";
$_tbody.="<td align=\"center\">数量</td>";
$_tbody.="</tr>";
$sql_con="where (upath='".$upath."' or upath like '".$upath."-%') and ka<>'y'";
$q="select no,color,bx,size_group_id,".get_size_sql("sum1")." from ".$table_pre."order ".$sql_con." group by no,color order by no,color";
//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)){
for($k=0;$k<$num_size_total;$k++){
$size_no=$arr_size_merged[$k];
$tmp_num=$m["num_".$size_no];
if($tmp_num>0){
//取得尺码
$tmp=get_db_msg("select * from ".$table_pre."size where iid='".$m["size_group_id"]."' and no='".$size_no."'");
$tm=$m["no"].$m["color"];
if($m["bx"])
$tm.=$m["bx"];
$tm.=$tmp["title"];
$_tbody.="<tr>";
$_tbody.="<td>".$tm."</td>";
$_tbody.="<td x:num>".$tmp_num."</td>";
$_tbody.="</tr>";
}
}
}
$_tbody.="</table></body></html>";
return $_tbody;
}
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
header("Content-type: text/html; charset=utf-8");
//-------------------------------mysql connect
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$sub=$_GET["sub"];
$id=$_GET["id"];
$list=$_GET["list"]?$_GET["list"]:1;
$is_dir=$_GET["is_dir"]?$_GET["is_dir"]:"n";
if($sub=="y"){
//
$xh_ms=get_set("xh_ms");
$check_md=get_db_msg("select count(*) 'num' from ".$table_pre."kh_md");
//杯型参数
if($bx_sizegroup_title){
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$bx_sizegroup_title."' limit 0,1");
$bx_sizegroup_id=$tmp["id"];
}else{
$bx_sizegroup_id=0;
}
$zk_type=get_set("zk_type");
//
$sys_size_num=get_max_size_num();
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."client where face>'2'");
$total=$tmp["num"];
if(!$id){
//
$tmp=get_db_msg("select min(id) 'id' from ".$table_pre."client where face>'2'");
$this_id=$tmp["id"];
}else{
$tmp=get_db_msg("select min(id) 'id' from ".$table_pre."client where face>'2' and id>'".$id."'");
$this_id=$tmp["id"];
}
$m=get_db_msg("select * from ".$table_pre."client where id='".$this_id."'");
$upath=$m["path"]."-".$m["id"];
//检查是否有订单
$q1="select sum(".get_size_sql("sum").") 'num' from ".$table_pre."order where (upath='".$upath."' or upath like '".$upath."-%') and ka<>'y'";
$tmp=get_db_msg($q1);
if($tmp["num"]>0){
//echo $q."<br>";
$content=get_order_by_client($upath);
$file_name="订单明细_".get_main_value($arr_client_face,$m["face"])."_".$m["title"]."_".$m["username"].".xls";
if($is_dir=="y"){
//建立目录结构
$dir="";
$arr_path=explode("-",$m["path"]);
for($j=0;$j<count($arr_path);$j++){
if($arr_path[$j]>0){
$m1=get_db_msg("select title from ".$table_pre."client where id='".$arr_path[$j]."'");
$dir.="/".$m1["title"];
$dir=iconv("utf-8","gb2312",$dir);
make_dir("xls".$dir);
}
}
}else{
$dir="/";
}
$file_name=iconv("utf-8","gb2312",$file_name);
write_file("xls".$dir,$file_name,$content);
$list++;
echo $list."/".$total.":".$file_name.",输出完成,<a href=\"".$_SERVER[PHP_SELF]."?is_dir=".$is_dir."\">暂停</a><br>";
}
$url=$_SERVER[PHP_SELF]."?sub=y&id=".$this_id."&list=".$list."&is_dir=".$is_dir;
//取得最大id
$tmp=get_db_msg("select max(id) 'id' from ".$table_pre."client where face>'2'");
$db->close();
if($id<$tmp["id"]){
//
url_redirect($url);
}else{
echo $total."个客户订单输出完成(包含无订单的客户),位于admin/debug/xls/下面,请手动下载!";
}
exit;
}else{
$is_dir=$is_dir?$is_dir:"n";
$arr_is_dir=array("n"=>"同一个目录","y"=>"按照客户结构列出目录");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>导出每个客户的订单明细</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="form1" action="<?php echo $_SERVER[PHP_SELF]; ?>" method="get">
<input type="hidden" name="sub" value="y">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>导出每个客户的订单明细</b></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">文件目录方式<select name="is_dir"><?php echo get_main_op($arr_is_dir,$is_dir); ?></select></td>
</tr>
<tr>
<td align="center" bgcolor="#f0f0f0"><input type="submit" value=" 执 行 "></td>
</tr>
<?php
if($msg){
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
}
?>
</form>
</table>
</body>
</html>
+341
View File
@@ -0,0 +1,341 @@
<?php
//-------------------------------------------------------导出订单总表
function get_order_by_client($start,$end){
global $table_pre,$db,$bx_sizegroup_title,$child_sizegroup_title,$xh_ms,$is_gg,$sys_gg_zd,$sys_color_zd;
$_tbody="<html xmlns:o=\"urn:schemas-microsoft-com:office:office\"
xmlns:x=\"urn:schemas-microsoft-com:office:excel\"
xmlns=\"http://www.w3.org/TR/REC-html40\">
<head>
<meta http-equiv=Content-Type content=\"text/html; charset=utf-8\">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content=\"Microsoft Excel 11\">
<style>
<!--table
{mso-displayed-decimal-separator:\"\.\";
mso-displayed-thousand-separator:\"\,\";}
@page
{margin:1.0in .75in 1.0in .75in;
mso-header-margin:.5in;
mso-footer-margin:.5in;}
tr
{mso-height-source:auto;
mso-ruby-visibility:none;}
col
{mso-width-source:auto;
mso-ruby-visibility:none;}
br
{mso-data-placement:same-cell;}
.style0
{mso-number-format:General;
text-align:general;
vertical-align:middle;
white-space:nowrap;
mso-rotate:0;
mso-background-source:auto;
mso-pattern:auto;
color:windowtext;
font-size:12.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
border:none;
mso-protection:locked visible;
mso-style-name:常规;
mso-style-id:0;}
td
{mso-style-parent:style0;
padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:windowtext;
font-size:12.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-number-format:General;
text-align:general;
vertical-align:middle;
border:none;
mso-background-source:auto;
mso-pattern:auto;
mso-protection:locked visible;
white-space:nowrap;
mso-rotate:0;}
ruby
{ruby-align:left;}
rt
{color:windowtext;
font-size:9.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-char-type:none;
display:none;}
-->
</style>
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:WorksheetOptions>
<x:DefaultRowHeight>285</x:DefaultRowHeight>
<x:Selected/>
<x:ProtectContents>False</x:ProtectContents>
<x:ProtectObjects>False</x:ProtectObjects>
<x:ProtectScenarios>False</x:ProtectScenarios>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
<x:WindowHeight>8640</x:WindowHeight>
<x:WindowWidth>17955</x:WindowWidth>
<x:WindowTopX>720</x:WindowTopX>
<x:WindowTopY>315</x:WindowTopY>
<x:ProtectStructure>False</x:ProtectStructure>
<x:ProtectWindows>False</x:ProtectWindows>
</x:ExcelWorkbook>
</xml><![endif]-->
</head>
<body link=blue vlink=purple><table x:str border=0 cellpadding=0 cellspacing=0 style='border-collapse:
collapse;table-layout:fixed;'>";
//-------------------处理尺码表头
//取得合并尺码
$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"]:"&nbsp;";
$size_tr[$num_size_group].="<td width=\"5%\">".$t."</td>";
}
$num_size_group++;
}
//文胸
if($bx_sizegroup_title){
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$bx_sizegroup_title."' limit 0,1");
$bx_sizegroup_id=$tmp["id"];
}else{
$bx_sizegroup_id=0;
}
//童装
if($child_sizegroup_title){
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$child_sizegroup_title."' limit 0,1");
$child_sizegroup_id=$tmp["id"];
}else{
$child_sizegroup_id=0;
}
//-------------------/处理尺码表头结束
if($start==0){
$_tbody.="<tr><td rowspan=\"".$num_size_group."\">".d_translate("qy")."</td><td rowspan=\"".$num_size_group."\">".d_translate("dl")."</td><td rowspan=\"".$num_size_group."\">客户名称</td><td rowspan=\"".$num_size_group."\">客户代码</td><td rowspan=\"".$num_size_group."\">序号</td><td rowspan=\"".$num_size_group."\">款号</td><td rowspan=\"".$num_size_group."\">款式名</td>";
//取得定制选项
$q="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' order by ord";
$r=$db->query($q);
$num_dz=0;
while($m=$db->fetch_array($r)){
$_tbody.="<td rowspan=\"".$num_size_group."\">".get_cate_title_no("arr_select",$m["no"])."</td>";
$num_dz++;
}
//到色属性
if(count($sys_color_zd)>0){
foreach($sys_color_zd as $k1 => $v1){
$_tbody.="<td rowspan=\"".$num_size_group."\">".$v1."</td>";
}
}
$_tbody.="<td rowspan=\"".$num_size_group."\">吊牌价</td><td rowspan=\"".$num_size_group."\">颜色名称</td><td rowspan=\"".$num_size_group."\">颜色代码</td>";
if($is_gg=="y"){
$_tbody.="<td rowspan=\"".$num_size_group."\">".d_translate("gg")."</td>";
foreach($sys_gg_zd as $k1 => $v1){
$_tbody.="<td rowspan=\"".$num_size_group."\">".$v1."</td>";
}
}else if($is_gg=="b"){
$_tbody.="<td rowspan=\"".$num_size_group."\">".d_translate("gg")."</td>";
}
if($bx_sizegroup_id>0)
$_tbody.="<td rowspan=\"".$num_size_group."\">杯型</td>";
else if($child_sizegroup_id>0)
$_tbody.="<td rowspan=\"".$num_size_group."\">款型</td>";
$_tbody.=$size_tr[0]."<td rowspan=\"".$num_size_group."\" align=\"center\" bgcolor=\"#f0f0f0\">小计</td><td rowspan=\"".$num_size_group."\">吊牌金额</td><td rowspan=\"".$num_size_group."\">结算金额</td></tr>";
for($i=1;$i<$num_size_group;$i++){
$_tbody.="<tr>".$size_tr[$i]."</tr>";
}
}
$sql_con="where ka<>'y'";
$q="select * from ".$table_pre."order ".$sql_con." order by id limit ".$start.",".$end;
//echo $q."<br>";
$r=$db->query($q);
$count=0;
while($m=$db->fetch_array($r)){
$list=$count+1;
$bg="#ffffff";
$m2=get_db_msg("select path,title,username from ".$table_pre."client where id='".$m["uid"]."'");
$msg_kh=get_db_msg("select no,xh,title,zd1,zd2,zd3 from ".$table_pre."kh where id='".$m["iid"]."'");
$qy_id=get_qy_id($m2["path"]);
if($qy_id){
//取得区域
$tmp=get_db_msg("select title from ".$table_pre."client where id='".$qy_id."'");
$qy=$tmp["title"];
}else{
$qy="";
}
//取得代理
$dl_id=get_dl_id($m2["path"]);
if($dl_id){
$tmp=get_db_msg("select title from ".$table_pre."client where id='".$dl_id."'");
$dl=$tmp["title"];
}else{
$dl="";
}
$td_size1="";
$num=$money=0;
for($k=0;$k<$num_size_total;$k++){
$num+=$m["num_".$arr_size_merged[$k]];
$td_size1.="<td x:num>".$m["num_".$arr_size_merged[$k]]."</td>";
}
$_tbody.="<tr><td>".$qy."</td><td>".$dl."</td><td>".$m2["title"]."</td><td>".$m2["username"]."</td><td>".get_kh_xh($msg_kh,$m["color"])."</td><td>".$m["no"]."</td><td>".$msg_kh["title"]."</td>";
//取得定制选项
$q2="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' order by ord";
$r2=$db->query($q2);
while($m2=$db->fetch_array($r2)){
if($m2["no"]=="zd1" || $m2["no"]=="zd2" || $m2["no"]=="zd3")
$_tbody.="<td>".$msg_kh[$m2["no"]]."</td>";
else
$_tbody.="<td>".get_cate_title_no($m2["no"],$m[$m2["no"]])."</td>";
}
//到色字段
if(count($sys_color_zd)>0){
$m_kh_color=get_db_msg("select * from ".$table_pre."kh_color where iid='".$m["iid"]."' and color='".$m["color"]."'");
foreach($sys_color_zd as $k1 => $v1){
$_tbody.="<td>".$m_kh_color[$k1]."</td>";
}
}
$_tbody.="<td x:num>".$m["price"]."</td><td>".get_cate_title_no("color",$m["color"])."</td><td>".$m["color"]."</td>";
if($is_gg=="y"){
$_tbody.="<td>".get_gg_title($m["bx"])."</td>";
$tmp1=get_db_msg("select * from ".$table_pre."kh_gg where iid='".$m["iid"]."' and color='".$m["color"]."' and gg='".$m["bx"]."'");
foreach($sys_gg_zd as $k1 => $v1){
$_tbody.="<td>".$tmp1[$k1]."</td>";
}
}else if($is_gg=="b"){
$_tbody.="<td>".get_gg_title($m["bx"])."</td>";
}
if($bx_sizegroup_id>0 || $child_sizegroup_id>0)
$_tbody.="<td>".$m["bx"]."</td>";
$_tbody.=$td_size1."<td x:num>".$num."</td><td x:num>".$m["je"]."</td><td x:num>".$m["jsje"]."</td></tr>";
$count++;
}
$_tbody.="</table></body></html>";
$db->close();
return $_tbody;
}
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
header("Content-type: text/html; charset=utf-8");
//-------------------------------mysql connect
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$sys_size_num=get_max_size_num();
$sub=$_GET["sub"];
$step=$_GET["step"];
$list=$_GET["list"];
if($sub=="y"){
//定义每次导出的订单数量
$xh_ms=get_set("xh_ms");
$step=$step?$step:50000;
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."order where ka<>'y'");
$total_num=$tmp["num"];
$list=$_GET["list"]?$_GET["list"]:1;
$start=($list-1)*$step;
if($step*$list<$total_num){
$content=get_order_by_client($start,$step);
$file_name="DetailTotal-".$list.".xls";
$file_name=iconv("utf-8","gb2312",$file_name);
write_file("xls",$file_name,$content);
echo $list*$step."/".$total_num."条记录导出完成(".$file_name."),位于<a href='xls/'>admin/debug/xls</a>下面,请手动下载!";
$list++;
url_redirect($_SERVER[PHP_SELF]."?sub=y&list=".$list."&step=".$step);
}else{
$end=$total_num-($list-1)*$step;
$content=get_order_by_client($start,$end);
$file_name="DetailTotal-".$list.".xls";
$file_name=iconv("utf-8","gb2312",$file_name);
//$fp=fopen("中文订单明细.xls","w");
//fwrite($fp,$content);
write_file("xls",$file_name,$content);
echo $total_num."条记录导出完成(共".$list."个文件),位于<a href='xls/'>admin/debug/xls</a>下面,请手动下载!";
}
exit;
}else{
$step=50000;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>导出订单明细总表</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="form1" action="<?php echo $_SERVER[PHP_SELF]; ?>" method="get">
<input type="hidden" name="sub" value="y">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>导出订单明细总表</b></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">单文件订单条数<input type="text" name="step" value="<?php echo $step; ?>" style="width:60px;">条 (如果执行超时,请减小条数)</td>
</tr>
<tr>
<td align="center" bgcolor="#f0f0f0"><input type="submit" value=" 执 行 "></td>
</tr>
<?php
if($msg){
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
}
?>
</form>
</table>
</body>
</html>
+292
View File
@@ -0,0 +1,292 @@
<?php
//-------------------------------------------------------导出订单总表,尺码竖排
function get_order_by_client($start,$end){
global $table_pre,$db,$bx_sizegroup_title,$child_sizegroup_title,$xh_ms,$is_gg,$sys_gg_zd;
$_tbody="<html xmlns:o=\"urn:schemas-microsoft-com:office:office\"
xmlns:x=\"urn:schemas-microsoft-com:office:excel\"
xmlns=\"http://www.w3.org/TR/REC-html40\">
<head>
<meta http-equiv=Content-Type content=\"text/html; charset=utf-8\">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content=\"Microsoft Excel 11\">
<style>
<!--table
{mso-displayed-decimal-separator:\"\.\";
mso-displayed-thousand-separator:\"\,\";}
@page
{margin:1.0in .75in 1.0in .75in;
mso-header-margin:.5in;
mso-footer-margin:.5in;}
tr
{mso-height-source:auto;
mso-ruby-visibility:none;}
col
{mso-width-source:auto;
mso-ruby-visibility:none;}
br
{mso-data-placement:same-cell;}
.style0
{mso-number-format:General;
text-align:general;
vertical-align:middle;
white-space:nowrap;
mso-rotate:0;
mso-background-source:auto;
mso-pattern:auto;
color:windowtext;
font-size:12.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
border:none;
mso-protection:locked visible;
mso-style-name:常规;
mso-style-id:0;}
td
{mso-style-parent:style0;
padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:windowtext;
font-size:12.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-number-format:General;
text-align:general;
vertical-align:middle;
border:none;
mso-background-source:auto;
mso-pattern:auto;
mso-protection:locked visible;
white-space:nowrap;
mso-rotate:0;}
ruby
{ruby-align:left;}
rt
{color:windowtext;
font-size:9.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-char-type:none;
display:none;}
-->
</style>
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:WorksheetOptions>
<x:DefaultRowHeight>285</x:DefaultRowHeight>
<x:Selected/>
<x:ProtectContents>False</x:ProtectContents>
<x:ProtectObjects>False</x:ProtectObjects>
<x:ProtectScenarios>False</x:ProtectScenarios>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
<x:WindowHeight>8640</x:WindowHeight>
<x:WindowWidth>17955</x:WindowWidth>
<x:WindowTopX>720</x:WindowTopX>
<x:WindowTopY>315</x:WindowTopY>
<x:ProtectStructure>False</x:ProtectStructure>
<x:ProtectWindows>False</x:ProtectWindows>
</x:ExcelWorkbook>
</xml><![endif]-->
</head>
<body link=blue vlink=purple><table x:str border=0 cellpadding=0 cellspacing=0 style='border-collapse:
collapse;table-layout:fixed;'>";
//-------------------处理尺码表头
//取得合并尺码
$arr_size_merged=get_size_merged();
$num_size_total=count($arr_size_merged);
//文胸
if($bx_sizegroup_title){
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$bx_sizegroup_title."' limit 0,1");
$bx_sizegroup_id=$tmp["id"];
}else{
$bx_sizegroup_id=0;
}
//童装
if($child_sizegroup_title){
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$child_sizegroup_title."' limit 0,1");
$child_sizegroup_id=$tmp["id"];
}else{
$child_sizegroup_id=0;
}
//-------------------/处理尺码表头结束
if($start==0){
$_tbody.="<tr><td bgcolor=\"#f0f0f0\" align=\"center\">".d_translate("qy")."</td><td bgcolor=\"#f0f0f0\" align=\"center\">".d_translate("dl")."</td><td bgcolor=\"#f0f0f0\" align=\"center\">客户名称</td><td bgcolor=\"#f0f0f0\" align=\"center\">客户代码</td><td bgcolor=\"#f0f0f0\" align=\"center\">序号</td><td bgcolor=\"#f0f0f0\" align=\"center\">款号</td><td bgcolor=\"#f0f0f0\" align=\"center\">款式名</td>";
//取得定制选项
$q="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' order by ord";
$r=$db->query($q);
$num_dz=0;
while($m=$db->fetch_array($r)){
$_tbody.="<td bgcolor=\"#f0f0f0\" align=\"center\">".get_cate_title_no("arr_select",$m["no"])."</td>";
$num_dz++;
}
$_tbody.="<td bgcolor=\"#f0f0f0\" align=\"center\">吊牌价</td><td bgcolor=\"#f0f0f0\" align=\"center\">颜色名称</td><td bgcolor=\"#f0f0f0\" align=\"center\">颜色代码</td>";
if($bx_sizegroup_id>0)
$_tbody.="<td bgcolor=\"#f0f0f0\" align=\"center\">杯型</td>";
else if($child_sizegroup_id>0)
$_tbody.="<td rowspan=\"".$num_size_group."\">款型</td>";
if($is_gg!="n")
$_tbody.="<td bgcolor=\"#f0f0f0\" align=\"center\">".d_translate("gg")."</td>";
$_tbody.="<td align=\"center\" bgcolor=\"#f0f0f0\">尺码</td><td align=\"center\" bgcolor=\"#f0f0f0\">数量</td></tr>";
}
$sql_con="where ka<>'y'";
$q="select * from ".$table_pre."order ".$sql_con." order by id limit ".$start.",".$end;
//echo $q."<br>";
$r=$db->query($q);
$count=0;
while($m=$db->fetch_array($r)){
$m_client=get_db_msg("select path,title,username from ".$table_pre."client where id='".$m["uid"]."'");
$msg_kh=get_db_msg("select no,xh,title,zd1,zd2,zd3 from ".$table_pre."kh where id='".$m["iid"]."'");
$qy_id=get_qy_id($m_client["path"]);
if($qy_id){
//取得区域
$tmp=get_db_msg("select title from ".$table_pre."client where id='".$qy_id."'");
$qy=$tmp["title"];
}else{
$qy="";
}
//取得代理
$dl_id=get_dl_id($m_client["path"]);
if($dl_id){
$tmp=get_db_msg("select title from ".$table_pre."client where id='".$dl_id."'");
$dl=$tmp["title"];
}else{
$dl="";
}
//取得定制选项
$tr_dz="";
$q2="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' order by ord";
$r2=$db->query($q2);
while($m2=$db->fetch_array($r2)){
if($m2["no"]=="zd1" || $m2["no"]=="zd2" || $m2["no"]=="zd3")
$tr_dz.="<td>".$msg_kh[$m2["no"]]."</td>";
else
$tr_dz.="<td>".get_cate_title_no($m2["no"],$m[$m2["no"]])."</td>";
}
for($k=0;$k<$num_size_total;$k++){
$num=$m["num_".$arr_size_merged[$k]];
if($num>0){
//取得尺码名称
$tmp=get_db_msg("select title from ".$table_pre."size where iid='".$m["size_group_id"]."' and no='".$arr_size_merged[$k]."'");
$_tbody.="<tr height=\"25\"><td>".$qy."</td><td>".$dl."</td><td>".$m_client["title"]."</td><td>".$m_client["username"]."</td><td>".get_kh_xh($msg_kh,$m["color"])."</td><td>".$m["no"]."</td><td>".$msg_kh["title"]."</td>";
$_tbody.=$tr_dz;
$_tbody.="<td>".$m["price"]."</td><td>".get_cate_title_no("color",$m["color"])."</td><td>".$m["color"]."</td>";
if($bx_sizegroup_id>0 || $child_sizegroup_id>0)
$_tbody.="<td>".$m["bx"]."</td>";
if($is_gg!="n")
$_tbody.="<td>".get_gg_title($m["bx"])."</td>";
$_tbody.="<td>".$tmp["title"]."</td><td x:num>".$num."</td></tr>";
}
}
}
$_tbody.="</table></body></html>";
$db->close();
return $_tbody;
}
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
header("Content-type: text/html; charset=utf-8");
//-------------------------------mysql connect
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$sys_size_num=get_max_size_num();
$sub=$_GET["sub"];
$step=$_GET["step"];
$list=$_GET["list"];
if($sub=="y"){
//定义每次导出的订单数量
$xh_ms=get_set("xh_ms");
$step=$step?$step:20000;
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."order where ka<>'y'");
$total_num=$tmp["num"];
$list=$_GET["list"]?$_GET["list"]:1;
$start=($list-1)*$step;
if($step*$list<$total_num){
$content=get_order_by_client($start,$step);
$file_name="order_detail_all_s-".$list.".xls";
$file_name=iconv("utf-8","gb2312",$file_name);
write_file("xls",$file_name,$content);
echo $list*$step."/".$total_num."条记录导出完成(".$file_name."),位于<a href='xls/'>admin/debug/xls</a>下面,请手动下载!";
$list++;
url_redirect($_SERVER[PHP_SELF]."?sub=y&list=".$list."&step=".$step);
}else{
$end=$total_num-($list-1)*$step;
$content=get_order_by_client($start,$end);
$file_name="order_detail_all_s-".$list.".xls";
$file_name=iconv("utf-8","gb2312",$file_name);
write_file("xls",$file_name,$content);
echo $total_num."条记录导出完成(共".$list."个文件),位于<a href='xls/'>admin/debug/xls</a>下面,请手动下载!";
}
exit;
}else{
$step=20000;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>导出订单明细总表(尺码竖排)</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="form1" action="<?php echo $_SERVER[PHP_SELF]; ?>" method="get">
<input type="hidden" name="sub" value="y">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>导出订单明细总表(尺码竖排)</b></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">单文件订单条数<input type="text" name="step" value="<?php echo $step; ?>" style="width:60px;">条 (如果执行超时,请减小条数)</td>
</tr>
<tr>
<td align="center" bgcolor="#f0f0f0"><input type="submit" value=" 执 行 "></td>
</tr>
<?php
if($msg){
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
}
?>
</form>
</table>
</body>
</html>
+296
View File
@@ -0,0 +1,296 @@
<?php
//-------------------------------------------------------导出订单总表 for 戈美其,本次订单。
function get_order_by_client($start,$end){
global $table_pre,$db,$bx_sizegroup_title,$xh_ms,$is_gg,$sys_gg_zd,$sys_this_order_flag;
$_tbody="<html xmlns:o=\"urn:schemas-microsoft-com:office:office\"
xmlns:x=\"urn:schemas-microsoft-com:office:excel\"
xmlns=\"http://www.w3.org/TR/REC-html40\">
<head>
<meta http-equiv=Content-Type content=\"text/html; charset=utf-8\">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content=\"Microsoft Excel 11\">
<style>
<!--table
{mso-displayed-decimal-separator:\"\.\";
mso-displayed-thousand-separator:\"\,\";}
@page
{margin:1.0in .75in 1.0in .75in;
mso-header-margin:.5in;
mso-footer-margin:.5in;}
tr
{mso-height-source:auto;
mso-ruby-visibility:none;}
col
{mso-width-source:auto;
mso-ruby-visibility:none;}
br
{mso-data-placement:same-cell;}
.style0
{mso-number-format:General;
text-align:general;
vertical-align:middle;
white-space:nowrap;
mso-rotate:0;
mso-background-source:auto;
mso-pattern:auto;
color:windowtext;
font-size:12.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
border:none;
mso-protection:locked visible;
mso-style-name:常规;
mso-style-id:0;}
td
{mso-style-parent:style0;
padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:windowtext;
font-size:12.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-number-format:General;
text-align:general;
vertical-align:middle;
border:none;
mso-background-source:auto;
mso-pattern:auto;
mso-protection:locked visible;
white-space:nowrap;
mso-rotate:0;}
ruby
{ruby-align:left;}
rt
{color:windowtext;
font-size:9.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-char-type:none;
display:none;}
-->
</style>
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:WorksheetOptions>
<x:DefaultRowHeight>285</x:DefaultRowHeight>
<x:Selected/>
<x:ProtectContents>False</x:ProtectContents>
<x:ProtectObjects>False</x:ProtectObjects>
<x:ProtectScenarios>False</x:ProtectScenarios>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
<x:WindowHeight>8640</x:WindowHeight>
<x:WindowWidth>17955</x:WindowWidth>
<x:WindowTopX>720</x:WindowTopX>
<x:WindowTopY>315</x:WindowTopY>
<x:ProtectStructure>False</x:ProtectStructure>
<x:ProtectWindows>False</x:ProtectWindows>
</x:ExcelWorkbook>
</xml><![endif]-->
</head>
<body link=blue vlink=purple><table x:str border=0 cellpadding=0 cellspacing=0 style='border-collapse:
collapse;table-layout:fixed;'>";
//-------------------处理尺码表头
//取得合并尺码
$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"]:"&nbsp;";
$size_tr[$num_size_group].="<td width=\"5%\">".$t."</td>";
}
$num_size_group++;
}
//-------------------/处理尺码表头结束
if($start==0){
$_tbody.="<tr><td rowspan=\"".$num_size_group."\">区域</td><td rowspan=\"".$num_size_group."\">代理</td><td rowspan=\"".$num_size_group."\">客户名称</td><td rowspan=\"".$num_size_group."\">客户代码</td><td rowspan=\"".$num_size_group."\">圆牌号</td><td rowspan=\"".$num_size_group."\">款号</td><td rowspan=\"".$num_size_group."\">款式名</td>";
//取得定制选项
$q="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' order by ord";
$r=$db->query($q);
$num_dz=0;
while($m=$db->fetch_array($r)){
$_tbody.="<td rowspan=\"".$num_size_group."\">".get_cate_title_no("arr_select",$m["no"])."</td>";
$num_dz++;
}
$_tbody.="<td rowspan=\"".$num_size_group."\">吊牌价</td><td rowspan=\"".$num_size_group."\">颜色名称</td><td rowspan=\"".$num_size_group."\">颜色代码</td>";
$_tbody.=$size_tr[0]."<td rowspan=\"".$num_size_group."\" align=\"center\" bgcolor=\"#f0f0f0\">箱数</td><td rowspan=\"".$num_size_group."\" align=\"center\" bgcolor=\"#f0f0f0\">双数</td></tr>";
for($i=1;$i<$num_size_group;$i++){
$_tbody.="<tr>".$size_tr[$i]."</tr>";
}
}
$sql_con="";
$q="select a.id 'id',a.uid 'uid',a.iid 'iid',a.color 'color',a.pmid 'pmid',a.xs 'xs' from ".$table_pre."order_pm a,".$table_pre."order b where a._key='".$sys_this_order_flag."' and b._key='".$sys_this_order_flag."' and a.uid=b.uid and a.iid=b.iid and a.color=b.color and b.ka<>'y' group by id order by id limit ".$start.",".$end;
//echo $q."<br>";
$r=$db->query($q);
$count=0;
while($m=$db->fetch_array($r)){
$list=$count+1;
$bg="#ffffff";
$m2=get_db_msg("select path,title,username from ".$table_pre."client where id='".$m["uid"]."'");
$msg_kh=get_db_msg("select * from ".$table_pre."kh where id='".$m["iid"]."'");
$arr_kh_size=explode(",",$msg_kh["size"]);
$kh_pm_size_start=$arr_kh_size[0];
$qy_id=get_qy_id($m2["path"]);
if($qy_id){
//取得区域
$tmp=get_db_msg("select title from ".$table_pre."client where id='".$qy_id."'");
$qy=$tmp["title"];
}else{
$qy="";
}
//取得代理
$dl_id=get_dl_id($m2["path"]);
if($dl_id){
$tmp=get_db_msg("select title from ".$table_pre."client where id='".$dl_id."'");
$dl=$tmp["title"];
}else{
$dl="";
}
$td_size1="";
$m_pm=get_db_msg("select * from ".$table_pre."size_pm where id='".$m["pmid"]."'");
$arr_pm=explode(":",$m_pm["gz"]);
$arr_pm1=tz_pm($arr_kh_size,$arr_pm);
for($k=1;$k<=$num_size_total;$k++){
$td_size1.="<td x:num>".deel_0($arr_pm1[$k])."</td>";
}
$_tbody.="<tr><td>".$qy."</td><td>".$dl."</td><td>".$m2["title"]."</td><td>".$m2["username"]."</td><td>".get_kh_xh($msg_kh,$m["color"])."</td><td>".$msg_kh["no"]."</td><td>".$msg_kh["title"]."</td>";
//取得定制选项
$q2="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' order by ord";
$r2=$db->query($q2);
while($m2=$db->fetch_array($r2)){
if($m2["no"]=="zd1" || $m2["no"]=="zd2" || $m2["no"]=="zd3")
$_tbody.="<td>".$msg_kh[$m2["no"]]."</td>";
else
$_tbody.="<td>".get_cate_title_no($m2["no"],$msg_kh[$m2["no"]])."</td>";
}
$xs=$m["xs"];
$num=$xs*$m_pm["num"];
$_tbody.="<td x:num>".$msg_kh["price"]."</td><td>".get_cate_title_no("color",$m["color"])."</td><td>".$m["color"]."</td>";
$_tbody.=$td_size1."<td x:num>".deel_td(deel_0($xs))."</td><td x:num>".$num."</td></tr>";
$count++;
}
$_tbody.="</table></body></html>";
return $_tbody;
}
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
header("Content-type: text/html; charset=utf-8");
//-------------------------------mysql connect
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$sys_size_num=get_max_size_num();
$sub=$_GET["sub"];
$step=$_GET["step"];
$list=$_GET["list"];
if($sub=="y"){
//定义每次导出的订单数量
$xh_ms=get_set("xh_ms");
$step=$step?$step:50000;
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."order_pm where _key='".$sys_this_order_flag."'");
$total_num=$tmp["num"];
$list=$_GET["list"]?$_GET["list"]:1;
$start=($list-1)*$step;
if($step*$list<$total_num){
$content=get_order_by_client($start,$step);
$file_name="order_detail_all_xz-".$list.".xls";
$file_name=iconv("utf-8","gb2312",$file_name);
write_file("xls",$file_name,$content);
//echo $list*$step."/".$total_num."条记录导出完成(".$file_name.")!";
echo $list*$step."/".$total_num."条记录导出完成(".$file_name."),位于<a href='xls/'>admin/debug/xls</a>下面,请手动下载!";
$list++;
url_redirect($_SERVER[PHP_SELF]."?sub=y&list=".$list."&step=".$step);
}else{
$end=$total_num-($list-1)*$step;
$content=get_order_by_client($start,$end);
$file_name="order_detail_all_xz-".$list.".xls";
$file_name=iconv("utf-8","gb2312",$file_name);
write_file("xls",$file_name,$content);
//echo $total_num."条记录导出完成(共".$list."个文件),位于admin/debug/xls/下面,请手动下载!";
echo $total_num."条记录导出完成(共".$list."个文件),位于<a href='xls/'>admin/debug/xls</a>下面,请手动下载!";
}
exit;
}else{
$step=50000;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>导出订单明细总表</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="form1" action="<?php echo $_SERVER[PHP_SELF]; ?>" method="get">
<input type="hidden" name="sub" value="y">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>导出订单明细总表</b></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">单文件订单条数<input type="text" name="step" value="<?php echo $step; ?>" style="width:60px;">条 (如果执行超时,请减小条数)</td>
</tr>
<tr>
<td align="center" bgcolor="#f0f0f0"><input type="submit" value=" 执 行 "></td>
</tr>
<?php
if($msg){
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
}
?>
</form>
</table>
</body>
</html>
+272
View File
@@ -0,0 +1,272 @@
<?php
//-------------------------------------------------------上次订单导入
function get_main_key2($arr,$v){
if(!is_array($arr))
return;
for($i=0;$i<count($arr);$i++){
if($arr[$i]==$v)
return $i;
}
return false;
}
function get_cate_no_title($cate,$value){
global $db,$table_pre;
$m=get_db_msg("select * from ".$table_pre."keyword where cate='".$cate."' and title='".$value."' limit 0,1");
$r=trim($m["no"])?trim($m["no"]):$value;
return $r;
}
date_default_timezone_set('Asia/Shanghai');
header("Content-type: text/html; charset=utf-8");
error_reporting(E_ERROR | E_WARNING | E_PARSE);
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
//require THIS_FILE_ROOT."/include/excel_class.php";
//require THIS_FILE_ROOT."/include/excel_fun.php";
//-------------------------------mysql connect
$json_data="";
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$magic_quotes_gpc = get_magic_quotes_gpc();
$register_globals = @ini_get('register_globals');
if(!$register_globals || !$magic_quotes_gpc) {
@extract(daddslashes($_POST));
@extract(daddslashes($_GET));
}
$arr_this_thead=array("订货会标记","店铺代码","款号","颜色代码","吊牌价","箱数","数量","吊牌金额","结算金额","代理结算金额");
if($step=="1"){
//-------------------------------------------------------------检测
$file1=$_FILES["file1"];
if($file1["name"]){
if(!check_file_type("xls",get_file_ext($file1["name"])))
alert_and_back("请选择2003格式的EXCEL文档(.xls)!");
}
$tmp_file_name=save_tmp_file($file1);
$tmp_content=get_tmp_content($tmp_file_name);
$arr_content=explode("\n",$tmp_content);
$arr_thead=get_table_thead($tmp_content);
//------------检测表头是否完整
$wrong_str="";
for($i=0;$i<count($arr_this_thead);$i++){
if(in_array($arr_this_thead[$i],$arr_thead)){
//--存在
}else{
//--不存在
$wrong_str.=$arr_this_thead[$i].",";
}
}
if($wrong_str){
alert_and_redirect("对不起,字段缺失(".substr($wrong_str,0,-1)."),请检查!",$_SERVER["PHP_SELF"]);
}
//------------导入数据
//是否清空
if($is_qk=="y"){
$db->query("delete from ".$table_pre."order where _key<>'".$sys_this_order_flag."'");
$db->query("delete from ".$table_pre."order_pm where _key<>'".$sys_this_order_flag."'");
}
//取得选项名称
$arr_select=array();
$q1="select * from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no not in ('zd1','zd2','zd3') order by no";
$r1=$db->query($q1);
$sql_select_insert1="";
while($m1=$db->fetch_array($r1)){
$arr_select[$m1["no"]]=$m1["title"];
$sql_select_insert1.=$m1["no"].",";
}
$size_num=get_max_size_num();
$sys_size_num=get_max_size_num();
//导入数据
$total_num=0;
for($i=1;$i<count($arr_content);$i++){
$tmp_arr=explode("|^_^|",$arr_content[$i]);
$username=$tmp_arr[get_main_key($arr_thead,"店铺代码")];
$m_client=get_db_msg("select id,path from ".$table_pre."client where username='".$username."'");
$kh=$tmp_arr[get_main_key($arr_thead,"款号")];
$m_kh=get_db_msg("select id,size from ".$table_pre."kh where no='".$kh."'");
$order_flag=$tmp_arr[get_main_key($arr_thead,"订货会标记")];
$color=$tmp_arr[get_main_key($arr_thead,"颜色代码")];
//取得尺码组id
$t1=$tmp_arr[get_main_key($arr_thead,"尺码组")];
$tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$t1."'");
$size_group_id=$tmp["id"];
//
$xs=$tmp_arr[get_main_key($arr_thead,"箱数")];
//尺码sql
$pm_gz="";
$v="";
$tmood=get_db_msg("select * from ".$table_pre."order where _key<>'".$sys_this_order_flag."' and uid='".$m_client["id"]."' and iid='".$m_kh["id"]."' and color='".$color."' and bx='".$bx."'");
if($tmood["id"]){
$sql_size_insert1=$sql_size_insert2="";
$tmp_num=$tmood["num"]+$tmp_arr[get_main_key($arr_thead,"数量")];
$tmp_je=$tmood["je"]+$tmp_arr[get_main_key($arr_thead,"吊牌金额")];
$tmp_jsje=$tmood["jsje"]+$tmp_arr[get_main_key($arr_thead,"结算金额")];
$tmp_jsje_dl=$tmood["jsje_dl"]+$tmp_arr[get_main_key($arr_thead,"代理结算金额")];
for($j=1;$j<=$size_num;$j++){
$sql_size_insert1.="num_".$j.",";
$v="num_".$j;
$tmp=get_main_key2($arr_thead,$j);
if($tmp==false){
$strt=$v."='".$tmood[$v]."',";
$sql_size_insert2.=$strt;
$$v=$tmood[$v];
}else{
$strt=$v."='".($tmood[$v]+deel_num($tmp_arr[$tmp])*$xs)."',";
$sql_size_insert2.=$strt;
$$v=$tmood[$v]+deel_num($tmp_arr[$tmp])*$xs;
$tmpnum+=deel_num($tmp_arr[$tmp])*$xs;
$pm_gz.=deel_num($tmp_arr[$tmp]).":";
}
}
$sql_size_insert2.="num=".$tmp_num.",";
$sql_size_insert2.="je=".$tmp_je.",";
$sql_size_insert2.="jsje=".$tmp_jsje.",";
$sql_size_insert2.="jsje_dl=".$tmp_jsje_dl.",";
}else{
$sql_size_insert1=$sql_size_insert2="";
$tmp_num=$tmp_arr[get_main_key($arr_thead,"数量")];
for($j=1;$j<=$size_num;$j++){
$sql_size_insert1.="num_".$j.",";
$v="num_".$j;
$tmp=get_main_key2($arr_thead,$j);
if($tmp==false){
$sql_size_insert2.="0,";
$$v=0;
}else{
$sql_size_insert2.=deel_num($tmp_arr[$tmp])*$xs.",";
$$v=deel_num($tmp_arr[$tmp])*$xs;
$pm_gz.=deel_num($tmp_arr[$tmp]).":";
}
}
}
//echo $pm_gz."<br>";
//echo $sql_size_insert1."<br>";
//echo $sql_size_insert2."<br>";
//选项
$sql_select_insert2="";
foreach($arr_select as $no1 => $title1){
$sql_select_insert2.="'".get_cate_no_title($no1,$tmp_arr[get_main_key($arr_thead,get_main_value($arr_select,$no1))])."',";
}
//--导入订单表
if($tmood["id"]){
$q="update ".$table_pre."order set ".$sql_size_insert2."add_date='".time()."' where id='".$tmood["id"]."'";
$db->query($q);
}else{
$q="insert into ".$table_pre."order (uid,upath,size_group_id,iid,no,price,color,bx,".$sql_select_insert1.$sql_size_insert1."num,je,jsje,jsje_dl,_key,add_date) values ('".$m_client["id"]."','".$m_client["path"]."-".$m_client["id"]."','".$size_group_id."','".$m_kh["id"]."','".$kh."','".$tmp_arr[get_main_key($arr_thead,"吊牌价")]."','".$color."','".$bx."',".$sql_select_insert2.$sql_size_insert2."'".$tmp_num."','".$tmp_arr[get_main_key($arr_thead,"吊牌金额")]."','".$tmp_arr[get_main_key($arr_thead,"结算金额")]."','".$tmp_arr[get_main_key($arr_thead,"代理结算金额")]."','".$order_flag."','".time()."')";
$db->query($q);
}
$total_num+=$tmp_num;
//--导入订单配码表
//计算配码规则
if($pm_gz)
$pm_gz=substr($pm_gz,0,-1);
//取得配码id
$m_pm=get_db_msg("select id from ".$table_pre."size_pm where uid='".$m_client["id"]."' and gz='".$pm_gz."'");
if($m_pm["id"]>0){
$pmid=$m_pm["id"];
}else{
$pm_title="临时".get_rand_num(4);
$pm_num=count_pm_num($pm_gz);
$q="insert into ".$table_pre."size_pm (qyid,uid,size_group_id,pm_dj,khid,title,gz,num) values ('0','".$m_client["id"]."','".$size_group_id."','临时配码','".$m_kh["id"]."','".$pm_title."','".$pm_gz."','".$pm_num."')";
//echo $q."<br>";
$db->query($q);
$pmid=$db->insert_id();
}
$q="insert into ".$table_pre."order_pm (_key,uid,iid,color,pmid,xs) values ('".$order_flag."','".$m_client["id"]."','".$m_kh["id"]."','".$color."','".$pmid."','".$xs."')";
$db->query($q);
//echo $q."<br>";
}
$msg="导入成功!(数量:".$total_num."";
alert_and_back($msg);
}
//switch($lx){
//default:
//-------------------------------取得数据
$content='<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="renderer" content="webkit"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><title>导入excel-e订通后台</title><link rel="stylesheet" href="index.css"><script src="../layuiadmin/layui/layui.js"></script><script src="../js/function.js"></script><style>#table1{border:0px;}</style></head><body>';
$content.='<form class="layui-form" method="post" enctype="multipart/form-data"><input type="hidden" name="step" value="1"><div style="padding:20px;background:#ccc;" >上次订单导入</div><table class="layui-table" id="table1" style="width:100%;"><tr><td width="300px">导入模板:</td><td><a href="order_sc_mb.xls"><img src="../images/excel.png" width="30" height="33"></a><a href="order_sc_mb.xls">debug/order_sc_mb.xls (Excel格式参考上面的模板,点击图片下载xls格式)</a></td></tr><tr><td width="300px">模板图片:</td><td height="120"><a href="order_sc_mb.xls"><img src="order_sc_mb.jpg" style=" border:1px solid #cccccc;width:800px;height:110;" ></a></td></tr><tr><td>请选择excel数据文档:</td><td><input type=file name="file1" style="width:250px"> <input type="checkbox" name="is_qk" id="is_qk" value="y" lay-skin="primary" checked><label for="is_qk">清空导入<input type="submit" value="提交" class="layui-btn layui-btn-sm layui-btn-normal"></label></td></tr></table></body></html>';
echo $content;
/*$js="<script>
var this1=".$json1.";
layui.use(['form','layer','laydate','table','laytpl','element',],function(){
var form = layui.form,
layer = parent.layer === undefined ? layui.layer : top.layer,
$=layui.jquery,
laydate = layui.laydate,
laytpl = layui.laytpl,
table = layui.table;
//数据表格
var url='import_order.php?lx=1';
var tableIns = table.render({
even:false,
elem: '#table2',
url : url,
cellMinWidth : 80,
page : true,
height : 'full-100',
limit : 10,
limits : [10,20,30,50,100],
id : 'ListTable',
cols :this1,
done: function(res, curr, count){
}
});
function add(id){
var t1=(id>0)?'':'';
var index = layui.layer.open({
title : t1+'修改历史数据',
type : 2,
area: ['700px', '500px'],
content : 'import_order.php?lx=edit&id='+id,
success : function(layero, index){
}
,cancel: function(index, layero){
window.parent.location.reload();
}
})
}
//批量删除
$('.btn_del').click(function(){
var checkStatus = table.checkStatus('ListTable'),
data = checkStatus.data,
check_id = [];
if(data.length > 0) {
for (var i in data) {
check_id.push(data[i].id);
}
layer.confirm('确定删除吗?', {icon: 3, title: '提示信息'}, function (index) {
$.get('import_order.php?lx=del',{id:check_id},function(data){
tableIns.reload();
layer.close(index);
})
})
}else{
layer.msg('请选择需要删除的记录');
}
})
//列表操作
table.on('tool(layui_table)', function(obj){
var layEvent = obj.event,
data = obj.data;
if(layEvent === 'edit'){
//编辑
add(data.id);
}
});
});
</script>";
echo $js;*/
//break;
//}
?>
+102
View File
@@ -0,0 +1,102 @@
<?php
//-------------------------------------------------------
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//-------------------------------mysql connect
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
//判断是否有搭配资料
$sys_ms=get_set("sys_ms");
$arr_sys_ms=explode("_",$sys_ms);
$uid=$_COOKIE[THIS_COOKIE];
if($uid!="1"){
$msg=get_db_msg("select username from ".$table_pre."user where id='1'");
header("Content-type: text/html; charset=utf-8");
echo "对不起,无权查看,请先用(".$msg["username"].")账号登陆,<a href=\"../login.htm\">返回</a>!";
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>后台数据整理程序-E订通</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
font-weight: bold;
}
</style>
</head>
<body>
<div align="center" style="font-size:14px;font-weight:bold;line-height:40px;">后台数据处理平台</div>
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<tr>
<td height="30" align="left" bgcolor="#f0f0f0">数据初始化</td>
</tr>
<tr>
<td height="25" align="left" bgcolor="#FFFFFF"><a href="install.php" target="blank">数据初始化</a>&nbsp;&nbsp;</td>
</tr>
<tr>
<td height="30" align="left" bgcolor="#f0f0f0">数据处理工具</td>
</tr>
<tr>
<td height="25" align="left" bgcolor="#FFFFFF"><a href="alter_ka.php" target="blank">批量设置删除款</a>&nbsp;&nbsp;<a href="alter_kh.php" target="_blank">批量设置款号表字段值</a>&nbsp;&nbsp;<a href="alter_client.php" target="_blank">批量设置客户表字段值</a>&nbsp;&nbsp;<a href="alter_order_kh.php" target="_blank">更新订单表的款号资料</a>&nbsp;&nbsp;<a href="alter_jgd.php" target="_blank">缓存价格带</a><?php
$tmp=get_db_msg("select * from ".$table_pre."keyword where cate='arr_select' and no='sx'");
if($tmp["flag_ka"]=="y")
echo "&nbsp;&nbsp;<a href=\"alter_order_sx.php\" target=\"_blank\">更新订单表的色系</a>";
?>&nbsp;&nbsp;<a href="../order_cache_client.htm" target="_blank">缓存客户表</a>&nbsp;&nbsp;<a href="../order_cache_order.htm" target="_blank">缓存订单表</a>&nbsp;&nbsp;<a href="alter_client_zb.php" target="_blank">自动合计客户指标</a>&nbsp;&nbsp;<a href="alter_size_not.php" target="_blank">自动计算不予下单尺码</a></td>
</tr>
<tr>
<td height="30" align="left" bgcolor="#f0f0f0">模板编辑</td>
</tr>
<tr>
<td height="25" align="left" bgcolor="#FFFFFF"><?php
foreach($arr_tmpl as $k1 => $v1){
echo "<a href=\"mod_tmpl.php?_f=".$k1."\" target=\"blank\">".$v1."</a>&nbsp;&nbsp;";
}
?></td>
</tr>
<tr>
<td height="30" align="left" bgcolor="#f0f0f0">订货会数据导出</td>
</tr>
<tr>
<td height="25" align="left" bgcolor="#FFFFFF"><a href="../kh_export.htm" target="blank">款号资料导出</a>&nbsp;&nbsp;<a href="../client_export.htm" target="blank">客户资料导出</a><?php
if(in_array("2",$arr_sys_ms))
echo "&nbsp;&nbsp;<a href=\"../kh_dp_export.htm\" target=\"blank\">搭配资料导出</a>";
if(in_array("3",$arr_sys_ms))
echo "&nbsp;&nbsp;<a href=\"../kh_cl_export.htm\" target=\"blank\">陈列资料导出</a>";
//是否有删除款
$tmp=get_db_msg("select count(*) 'num' from ".$table_pre."kh where ka='y' or color_ka<>''");
if($tmp["num"]>0)
echo "&nbsp;&nbsp;<a href=\"../kh_ka.htm\" target=\"blank\">删除款明细</a>";
?>&nbsp;&nbsp;<a href="../database_export.htm" target="blank">数据库源文件</a>&nbsp;&nbsp;<a href="export_order_by_client.php" target="blank">单客户明细表</a>&nbsp;&nbsp;<a href="export_order_total.php" target="blank">明细总表</a>&nbsp;&nbsp;<a href="export_order_total_xz.php" target="blank">明细总表(鞋子版本)</a>&nbsp;&nbsp;<a href="export_order_total_s.php" target="blank">明细总表(尺码竖排)</a>&nbsp;&nbsp;<a href="dhd.php" target="blank">大货单</a>&nbsp;&nbsp;<a href="danmu_export.php?_a=export_do" target="blank">弹幕导出</a>&nbsp;&nbsp;图片资料(请复制attachments文件夹)</td>
</tr>
<tr>
<td height="30" align="left" bgcolor="#f0f0f0">订单处理</td>
</tr>
<tr>
<td height="25" align="left" bgcolor="#FFFFFF"><a href="import_order.php" target="blank">上次订单导入</a>&nbsp;&nbsp;<a href="edit_order.php" target="blank">订单修改</a>&nbsp;&nbsp;<a href="alert_pj_detail.php" target="blank">评价导入</a>&nbsp;&nbsp;</td>
</tr>
<tr>
<td height="30" align="left" bgcolor="#f0f0f0">扫描入场</td>
</tr>
<tr>
<td height="25" align="left" bgcolor="#FFFFFF"><a href="set_sm.php" target="blank">设置扫描入场</a>&nbsp;&nbsp;</td>
</tr>
</table>
</body>
</html>
+102
View File
@@ -0,0 +1,102 @@
<?php
//-------------------------------------------------------数据初始化
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//-------------------------------mysql connect
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$is_submit=$_POST["is_submit"];
$keep_client=$_POST["keep_client"]?$_POST["keep_client"]:"y";
if($is_submit=="y"){
if($keep_client=="n"){
$arr_table[]=$table_pre."client";
$arr_table[]=$table_pre."zk";
$arr_table[]=$table_pre."client_brand";
}
$arr_table[]=$table_pre."bb_log";
$arr_table[]=$table_pre."client_pj";
$arr_table[]=$table_pre."order";
$arr_table[]=$table_pre."order_state";
$arr_table[]=$table_pre."order_pm";
$arr_table[]=$table_pre."order_log";
$arr_table[]=$table_pre."kh";
$arr_table[]=$table_pre."kh_color";
$arr_table[]=$table_pre."gz";
$arr_table[]=$table_pre."kh_dp";
$arr_table[]=$table_pre."kh_cl";
$arr_table[]=$table_pre."kh_cc";
$arr_table[]=$table_pre."kh_gg";
$arr_table[]=$table_pre."kh_gg_title";
$arr_table[]=$table_pre."kh_md";
$arr_table[]=$table_pre."kh_xh";
$arr_table[]=$table_pre."kh_tb";
$arr_table[]=$table_pre."kh_ty";
$arr_table[]=$table_pre."kh_tb_t";
$arr_table[]=$table_pre."size_bx";
$arr_table[]=$table_pre."size_not";
$arr_table[]=$table_pre."size_pm";
$arr_table[]=$table_pre."sx";
$arr_table[]=$table_pre."ph";
$arr_table[]=$table_pre."ls_zb";
$arr_table[]=$table_pre."msg";
$arr_table[]=$table_pre."log";
$arr_table[]=$table_pre."log_hd";
for($i=0;$i<count($arr_table);$i++){
$q="truncate table ".$arr_table[$i].";";
//echo $q."<Br>";
$db->query($q);
}
$msg="<span style=\"color:#0000ff;font-weight:bold;\">数据初始化成功!</span>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>数据初始化</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="form1" action="" method="post">
<input type="hidden" name="is_submit" value="y">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>订货会数据初始化</b></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">保留客户资料:<?php echo get_main_radio(array("y"=>"是","n"=>"否"),"keep_client",$keep_client); ?></td>
</tr>
<tr>
<td align="center" bgcolor="#f0f0f0"><input type="submit" value=" 提 交 "></td>
</tr>
<?php
if($msg){
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
}
?>
</form>
</table>
</body>
</html>
+510
View File
@@ -0,0 +1,510 @@
//----------------------------------------------------来自ipad/js/function.order.js
function check_order_modify(url,is_parent){
var f=document.forms['form1'];
if(num_arr.sort().toString()!=num_arr_check.sort().toString() && f.sub_save.disabled==false){
//检测装配码是否符合装箱数
if(zxs!=""){
var arr_zxs=zxs.split(",");
for(var i=0;i<num_arr.length;i++){
arr_tmp1=num_arr[i][2].split("|");
arr_tmp=num_arr[i][0].split("|");
if(in_array(arr_zxs,get_pm_num(arr_tmp1[1]))==-1 && num_arr[i][3]>0){
alert(arr_tmp[0]+"-"+arr_tmp[1]+",第"+(num_arr[i][1]+1)+"行,配码错误(装箱数:"+zxs+")");
return false;
}
}
}
//处理变量
var str_sub="";
var arr_tmp=[],arr_tmp1=[];
for(var i=0;i<num_arr.length;i++){
arr_tmp=num_arr[i][0].split("|");
arr_tmp1=num_arr[i][2].split("|");
if(num_arr[i][3]>0){
str_sub+=arr_tmp[0]+"|"+arr_tmp1[1]+"|"+num_arr[i][3]+",";
}else{
if(arr_tmp1[1]!=""){
//有配码,无箱数
alert(arr_tmp[0]+"-"+arr_tmp[1]+",第"+(num_arr[i][1]+1)+"行,请输入箱数!");
d_focus("xs_"+arr_tmp[0]+"_"+num_arr[i][1]);
return false;
}
}
}
alert("b");
alert(str_sub);
//
f.str_sub.value=str_sub;
f.go_url.value=url;
f.sub_save.value='保存中...';
f.sub_save.disabled=true;
f.submit();
}else{
alert("c");
if(url){
is_parent?window.parent.location.href=url:window.location.href=url;
}
}
}
//
function go_xh(){
check_order_modify('');
var f=document.forms['form2'];
var xh=f.s_xh.value;
if(xh>0){
f.submit();
}else{
alert("您输入的序号有误,请检查!");
}
}
function go_xh_qj(){
var f=document.forms['form2'];
var xh=f.s_xh.value;
if(xh>0){
f.submit();
}else{
alert("您输入的序号有误,请检查!");
}
}
//
function go_order_search(_t){
check_order_modify('');
var f=document.forms['form2'];
eval("var v1=f.s_"+_t+".value");
if(v1){
f.submit();
}else{
alert("请输入条件!");
}
}
//保存订单
function save_order(){
var obj_form=document.getElementById("form1");
var arr_tmp=[],arr_tmp1=[];
//检测装配码是否符合装箱数
if(zxs!=""){
var arr_zxs=zxs.split(",");
for(var i=0;i<num_arr.length;i++){
arr_tmp1=num_arr[i][2].split("|");
arr_tmp=num_arr[i][0].split("|");
if(in_array(arr_zxs,get_pm_num(arr_tmp1[1]))==-1 && num_arr[i][3]>0){
alert(arr_tmp[0]+"-"+arr_tmp[1]+",第"+(num_arr[i][1]+1)+"行,配码错误(装箱数:"+zxs+")");
return false;
}
}
}
//处理变量
var str_sub="";
for(var i=0;i<num_arr.length;i++){
arr_tmp=num_arr[i][0].split("|");
arr_tmp1=num_arr[i][2].split("|");
if(num_arr[i][3]>0){
str_sub+=arr_tmp[0]+"|"+arr_tmp1[1]+"|"+num_arr[i][3]+",";
}else{
if(arr_tmp1[1]!=""){
//有配码,无箱数
alert(arr_tmp[0]+"-"+arr_tmp[1]+",第"+(num_arr[i][1]+1)+"行,请输入箱数!");
d_focus("xs_"+arr_tmp[0]+"_"+num_arr[i][1]);
return false;
}
}
}
//
obj_form.str_sub.value=str_sub;
obj_form.sub_save.value='保存中...';
obj_form.sub_save.disabled=true;
obj_form._a.value='save';
return true;
}
//
function rebuild_num_tr(){
var str="";
//表头
str+="<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" class=\"order_single_table\" id=\"table_num\"><tr><td align=\"center\" bgcolor=\"#e9e9e9\">颜色</td>";
str+="<td align=\"center\" class=\"order_single_td1\" width=\"100\">多配码编辑</td><td align=\"center\" class=\"order_single_td1\" width=\"30\">配码</td>";
var arr_size_title=str_size_title.split(",");
var arr_tmp=[];
for(var i=0;i<arr_size_title.length;i++){
arr_tmp=arr_size_title[i].split("|");
str+="<td align=\"center\" style=\"width:50px;\" width=\"50\" class=\"order_single_td1\">"+arr_tmp[1]+"</td>";
}
str+="<td align=\"center\" class=\"order_single_td1\" width=\"30\">箱数</td>";
str+="<td align=\"center\" style=\"width:50px;\" width=\"50\" class=\"order_single_td1\">"+translate_unit+"数</td></tr>";
var old_hang=0;
for(var i=0;i<arrColor.length;i++){
old_hang=get_old_hang_num(i);
for(var j=0;j<arr_color_hang[i];j++){
//alert(num_arr[old_hang+j]);
var arr_color1=num_arr[old_hang+j][0].split("|");
var arr_gz1=num_arr[old_hang+j][2].split("|");
var arr_this_gz=arr_gz1[1].split(":");
var tmp_obj=arr_color1[0]+"_"+num_arr[old_hang+j][1];
var dis1="",ka_style="",ka_text="";
var pm_div_h=pm_rows*35+40;
pm_div_h=pm_div_h>150?pm_div_h:150;
var click_act=" onclick=\"show_div_hehe('pm_"+tmp_obj+"',400,"+pm_div_h+",'<iframe id=frame_pm name=frame_pm width=100% height="+pm_div_h+" border=0 scrolling=no frameborder=0 src=pm.php?dpid="+uid+"&iid="+id+"&obj=pm_"+tmp_obj+"></iframe>')\"";
if(num_arr[old_hang+j][4]=="y"){
dis1=" disabled";
click_act="";
ka_style="color:red;font-weight:bold;";
ka_text=" 已删除";
}
str+="<tr>";
if(j==0){
str+="<td id='color_td_"+arr_color1[0]+"' rowspan='"+arr_color_hang[i]+"' align='center' bgcolor='#ffffff' onclick=\"pic_tab('"+arr_color1[0]+"')\"><span style='"+ka_style+"'>"+arr_color1[0]+"-"+arr_color1[1]+ka_text+"</span></td>";
}
//
str+="<td bgcolor=\"#ffffff\"><input type='button' value='新增' style='width:45px;' onclick=\"add_color_pm('"+tmp_obj+"')\""+dis1+"> <input type='button' value='删除' style='width:45px;' onclick=\"del_color_pm('"+tmp_obj+"')\""+dis1+"></td>";
//配码
str+="<td bgcolor=\"#ffffff\"><div id='pm_"+tmp_obj+"' style='white-space:nowrap;overflow:hidden;width:50px;height:30px;border:1px solid #cccccc;text-align:left;line-height:30px;padding:2px;'"+click_act+">"+arr_gz1[0]+"</div></td>";
//尺码
for(var k=0;k<arrSize.length;k++){
var num1=arr_this_gz[k]?arr_this_gz[k]:"";
str+="<td bgcolor=\"#ffffff\"><input type='number' id='pm_num_"+tmp_obj+"_"+arrSize[k]+"' name='pm_num_"+tmp_obj+"_"+arrSize[k]+"' onchange=\"change_size('"+tmp_obj+"')\" style='width:30px;' value='"+num1+"'></td>";
}
//箱数
str+="<td bgcolor=\"#ffffff\"><input type=\"number\" id=\"xs_"+tmp_obj+"\" name=\"xs_"+tmp_obj+"\" value=\""+deel_0(num_arr[old_hang+j][3],'')+"\" onchange=\"change_xs('xs_"+tmp_obj+"');this.value=parseInt(this.value);\" style=\"width:40px;\""+dis1+"></td>";
//小计
str+="<td class=\"order_single_td2\" align=\"center\"><div id=\"xj_"+tmp_obj+"\" name=\"xj_"+tmp_obj+"\" />"+(num_arr[old_hang+j][3]*get_pm_num(arr_gz1[1]))+"</div></td>";
str+="</tr>";
}
}
//合计
str+="<tr><td align=\"right\" height=\"25\" colspan=\""+parseInt(colspan1)+"\" bgcolor=\"#ffffff\">合计</td>";
str+="<td align=\"center\" class=\"order_single_td2\"><div id=\"total_xs\" />"+total_xs+"</div></td>";
str+="<td align=\"center\" class=\"order_single_td2\"><div id=\"total_num\" />"+total_num+"</div></td></tr></table>";
document.getElementById("div_num").innerHTML=str;
return str;
}
//
function get_old_hang_num(ind){
var r=0;
for(var j=0;j<ind;j++){
r+=arr_color_hang[j];
}
return r;
}
//新增颜色配码
function add_color_pm(obj){
var arr_obj=obj.split("_");
var color=arr_obj[0];
var hang=arr_obj[1];
//处理num_arr
var num_arr1=[],arr_tmp=[],new_arr=[];
for(var i=0,i1=0;i<num_arr.length;i++){
arr_tmp=num_arr[i][0].split("|");
if(arr_tmp[0]==color){
if(num_arr[i][1]==hang){
num_arr1[i]=num_arr[i];
i1++;
num_arr1[i1]=[num_arr[i][0],num_arr[i][1]+1,"|",0,"n","n"];
i1++;
}else if(num_arr[i][1]<hang){
num_arr1[i1]=num_arr[i];
i1++;
}else{
num_arr1[i1]=[num_arr[i][0],num_arr[i][1]+1,num_arr[i][2],num_arr[i][3],num_arr[i][4],num_arr[i][5]];
i1++;
}
}else{
num_arr1[i1]=num_arr[i];
i1++;
}
}
//alert(num_arr+"\n"+num_arr1);
num_arr=num_arr1;
//处理arr_color_hang
var arr_color_hang1=[];
for(var i=0;i<arrColor.length;i++){
if(arrColor[i]==color)
arr_color_hang1[i]=arr_color_hang[i]+1;
else
arr_color_hang1[i]=arr_color_hang[i];
}
//alert(arr_color_hang+"\n"+arr_color_hang1);
arr_color_hang=arr_color_hang1;
rebuild_num_tr();
return;
}
//删除颜色配码
function del_color_pm(obj){
var confirm1=confirm("确认删除吗?");
if(confirm1==true){
var arr_obj=obj.split("_");
var color=arr_obj[0];
var hang=arr_obj[1];
var this_hang_num=1;
for(var i=0;i<arrColor.length;i++){
if(arrColor[i]==color){
this_hang_num=arr_color_hang[i];
}
}
//处理num_arr
var num_arr1=[],arr_tmp=[],new_arr=[];
for(var i=0,i1=0;i<num_arr.length;i++){
arr_tmp=num_arr[i][0].split("|");
if(arr_tmp[0]==color){
if(num_arr[i][1]==hang){
//删除
if(this_hang_num==1){
num_arr1[i1]=[num_arr[i][0],0,"|",0,num_arr[i][4],num_arr[i][5]];
i1++;
}
}else if(num_arr[i][1]<hang){
num_arr1[i1]=num_arr[i];
i1++;
}else{
num_arr1[i1]=[num_arr[i][0],num_arr[i][1]-1,num_arr[i][2],num_arr[i][3],num_arr[i][4],num_arr[i][5]];
i1++;
}
}else{
num_arr1[i1]=num_arr[i];
i1++;
}
}
//alert(num_arr+"\n"+num_arr1);
num_arr=num_arr1;
//处理arr_color_hang
var arr_color_hang1=[];
for(var i=0;i<arrColor.length;i++){
if(arrColor[i]==color && arr_color_hang[i]>1){
arr_color_hang1[i]=arr_color_hang[i]-1;
}else{
arr_color_hang1[i]=arr_color_hang[i];
}
}
//alert(arr_color_hang+"\n"+arr_color_hang1);
arr_color_hang=arr_color_hang1;
rebuild_num_tr();
count_total_num();
}
return;
}
//改变尺码数量
function change_size(obj){
var arr_obj=obj.split("_");
var color=arr_obj[0];
var color_hang=arr_obj[1];
var xs=get_xs(color,color_hang);
count_color_hang(color,color_hang,xs);
var new_pm=get_new_pm(color,color_hang);
//处理num_arr,改变配码
var num_arr1=[],arr_tmp=[],new_arr=[];
for(var i=0,i1=0;i<num_arr.length;i++){
arr_tmp=num_arr[i][0].split("|");
if(arr_tmp[0]==color && num_arr[i][1]==color_hang){
arr_tmp=num_arr[i][2].split("|");
num_arr1[i]=[num_arr[i][0],num_arr[i][1],arr_tmp[0]+"|"+new_pm,num_arr[i][3],num_arr[i][4],num_arr[i][5]];
}else{
num_arr1[i]=num_arr[i];
}
}
num_arr=num_arr1;
count_total_num();
}
//录入箱数
function change_xs(obj){
var arr_obj=obj.split("_");
var color=arr_obj[1];
var color_hang=arr_obj[2];
var xs=get_xs(color,color_hang);
count_color_hang(color,color_hang,xs);
//处理num_arr,改变箱数
var num_arr1=[],arr_tmp=[],new_arr=[];
for(var i=0,i1=0;i<num_arr.length;i++){
arr_tmp=num_arr[i][0].split("|");
if(arr_tmp[0]==color && num_arr[i][1]==color_hang){
num_arr1[i]=[num_arr[i][0],num_arr[i][1],num_arr[i][2],xs,num_arr[i][4],num_arr[i][5]];
}else{
num_arr1[i]=num_arr[i];
}
}
num_arr=num_arr1;
}
//选中配码
function check_pm(obj,v){
var arr_obj=obj.split("_");
var color=arr_obj[1];
var color_hang=arr_obj[2];
var arr_v=v.split("|");
var title=arr_v[1];
var arr_gz=arr_v[2].split(":");
//检查这个配码是否被选
var arr_tmp=[],arr_tmp1=[];
var is_checked="n";
for(var i=0,i1=0;i<num_arr.length;i++){
arr_tmp=num_arr[i][0].split("|");
arr_tmp1=num_arr[i][2].split("|");
if(arr_tmp[0]==color && arr_tmp1[1]==arr_v[2]){
is_checked="y";
break;
}
}
if(is_checked=="y"){
alert("该配码已经存在!");
return;
}
//填充title
document.getElementById("pm_"+color+"_"+color_hang).innerHTML=title;
//填充配码值
var obj1={};
for(var i=0;i<arrSize.length;i++){
obj1=document.getElementById("pm_num_"+color+"_"+color_hang+"_"+arrSize[i]);
if(obj1)
obj1.value=arr_gz[i];
}
//关闭配码层
show_div_hehe_close();
var xs=get_xs(color,color_hang);
count_color_hang(color,color_hang,xs);
//处理num_arr,改变配码
var num_arr1=[],arr_tmp=[],new_arr=[];
for(var i=0,i1=0;i<num_arr.length;i++){
arr_tmp=num_arr[i][0].split("|");
if(arr_tmp[0]==color && num_arr[i][1]==color_hang){
num_arr1[i]=[num_arr[i][0],num_arr[i][1],title+"|"+arr_v[2],num_arr[i][3],num_arr[i][4],num_arr[i][5]];
}else{
num_arr1[i]=num_arr[i];
}
}
num_arr=num_arr1;
d_focus("xs_"+color+"_"+color_hang);
}
//取得箱数
function get_xs(color,color_hang){
var xs=document.getElementById("xs_"+color+"_"+color_hang).value;
if(!xs)
xs=0;
xs=parseInt(xs);
return xs;
}
//取得新的配码
function get_new_pm(color,color_hang){
var new_pm="";
for(var i=0;i<arrSize.length;i++){
obj1=document.getElementById("pm_num_"+color+"_"+color_hang+"_"+arrSize[i]);
if(obj1){
if(obj1.value)
new_pm+=parseInt(obj1.value)+":";
else
new_pm+="0:";
}
}
return new_pm.substring(0,new_pm.length-1);
}
//计算1行的小计
function count_color_hang(color,color_hang,xs){
//取得配码
var pm_num=0;
var obj1={};
for(var i=0;i<arrSize.length;i++){
obj1=document.getElementById("pm_num_"+color+"_"+color_hang+"_"+arrSize[i]);
if(obj1){
if(obj1.value)
pm_num+=parseInt(obj1.value);
}
}
document.getElementById("xj_"+color+"_"+color_hang).innerHTML=pm_num*xs;
count_total_num();
}
//计算合计
function count_total_num(){
var total_xs=total_num=0;
var obj={};
for(var i=0;i<arr_color_hang.length;i++){
for(var j=0;j<arr_color_hang[i];j++){
obj=document.getElementById("xs_"+arrColor[i]+"_"+j);
if(obj && obj.value)
total_xs+=parseInt(obj.value);
obj=document.getElementById("xj_"+arrColor[i]+"_"+j);
if(obj && obj.innerHTML)
total_num+=parseInt(obj.innerHTML);
}
}
document.getElementById("total_num").innerHTML=total_num;
document.getElementById("total_xs").innerHTML=total_xs;
}
//----------------------------------------------------来自ipad/js/show_div.js
function show_div_hehe(obj,w,h,content){
var obj1=document.getElementById(obj);
var div_hehe="<div id='div_hehe'><div id='div_hehe_close' style='position:absolute;right:0;'><a href='javascript:show_div_hehe_close();'><img src='close.gif' width='24' height='24' border=0></a></div>"+content+"</div>";
var is_div=document.getElementById("div_hehe");
if(is_div){
$("#div_hehe").remove();
}
$("body").append(div_hehe);
//
var keyboard=$("#div_hehe");
//元素css样式控制
keyboard.css({"position":"absolute","z-index":"10","display":"none","background":"#ffffff",overflow:"hidden","width":w,"height":h,"border-radius":w*0.01,"border":"1px solid #cccccc"});
//
var p=show_div_hehe_GetScreenPosition(obj1);
//alert(p.x+","+p.y);
var screen_h=$(window).height();
var screen_w=$(window).width();
var obj_h=$("#"+obj).height()*1.1;
var key_num_h=keyboard.height();
//计算top值
var t=0;
if(p.y+obj_h+key_num_h>screen_h){
t=p.y-key_num_h;
}else{
t=p.y+obj_h;
}
//计算left值
var key_num_w=keyboard.width();
var obj_w=$("#"+obj).width();
var l=0;
if(p.x+key_num_w>screen_w){
l=p.x-key_num_w+obj_w;
}else{
l=p.x;
}
if(keyboard.css("display")=="none"){
keyboard.css({"display":"block","left":l,"top":t});
}
}
//关闭
function show_div_hehe_close(){
var keyboard=$("#div_hehe");
keyboard.css({"display":"none"});
}
//取得输入框坐标
function show_div_hehe_GetScreenPosition(object) {
var position = {};
position.x = object.offsetLeft;
position.y = object.offsetTop;
while (object.offsetParent) {
position.x = position.x + object.offsetParent.offsetLeft;
position.y = position.y + object.offsetParent.offsetTop;
if (object == document.getElementsByTagName("body")[0]) {
break;
}
else{
object = object.offsetParent;
}
}
return position;
}
//----------------------------------------------------来自ipad/js/function.js
//取得配码的合计
function get_pm_num(gz){
var arr_gz=gz.split(":");
var r=0;
for(var i=0;i<arr_gz.length;i++){
if(arr_gz[i]!="")
r+=parseInt(arr_gz[i]);
}
return r;
}
//输入框聚焦
function d_focus(obj){
var obj1=document.getElementById(obj);
obj1.readonly=true;
obj1.focus();
obj1.readonly=false;
}
Binary file not shown.
+78
View File
@@ -0,0 +1,78 @@
<?php
//-------------------------------------------------------模板编辑
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
$msg="";
$is_submit=$_POST["is_submit"];
$col_name=$_POST["col_name"];
$_f=$_REQUEST["_f"];
$_file=get_last_path(THIS_FILE_ROOT)."/tmpl/".$_f.".php";
if(is_file($_file)){
$content=read_file($_file);
$content=dhtmlspecialchars($content);
}else{
$msg.="<span class=\"wrong\">文件不存在(".$_file.")!</span><br>";
}
if($is_submit=="y"){
//
$content=$_POST["content"];
write_file(get_last_path(THIS_FILE_ROOT)."/tmpl",$_f.".php",stripslashes(str_replace("\x0d\x0a", "\x0a", $content)));
$content=read_file($_file);
$content=dhtmlspecialchars($content);
$msg="保存成功(".date("Y-m-d H:i:s").")!";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>模板编辑</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body onload="this.focus();">
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="form1" action="" method="post">
<input type="hidden" name="is_submit" value="y">
<input type="hidden" name="_f" value="<?php echo $_f; ?>">
<tr>
<td align="left" bgcolor="#f0f0f0"><b>模板编辑-><?php echo get_main_value($arr_tmpl,$_f); ?></b></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;"></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;"><textarea name="content" style="width:100%;" rows="30"><?php echo $content; ?></textarea></td>
</tr>
<tr>
<td align="center" bgcolor="#f0f0f0"><input type="submit" value=" 保 存 "></td>
</tr>
<?php
if($msg){
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
}
?>
</form>
</table>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.
+289
View File
@@ -0,0 +1,289 @@
<?php
//-------------------------------------------------------导入历史数据
date_default_timezone_set('Asia/Shanghai');
header("Content-type: text/html; charset=utf-8");
error_reporting(E_ERROR | E_WARNING | E_PARSE);
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
$page=@$_GET["page"];
$lx=@$_GET["lx"];
$limit=@$_GET["limit"];
$json_data="";
$page=$page>0?$page:1;
$limit=$limit>0?$limit:10;
$start=($page-1)*$limit;
$end=$limit;
$arr_column_keyword=array("uid"=>"客户代码","c1"=>"大类名称","je"=>"金额","js"=>"件数","ks"=>"款数");
//-------------------------------定义字段
//-------------------------------定义数据表
$wjname="plugin_ls1";
$json_data="";
$tname=$table_pre.$wjname;
$sql_create_table="CREATE TABLE ".$tname." (
`id` int(10) unsigned NOT NULL auto_increment,
`uid` int(10) unsigned NOT NULL default '0',
`upath` varchar(255) NOT NULL default '',
`c1` varchar(255) NOT NULL default '',
`je` int(10) unsigned NOT NULL default '0',
`js` int(10) unsigned NOT NULL default '0',
`ks` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
//-------------------------------mysql connect
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$is_submit=$_POST["is_submit"];
$is_qk=$_POST["is_qk"];
//-------------------------------导入数据
//建立数据表
if(check_table_exist($tname)!="y")
$db->query($sql_create_table);
if($is_submit=="y"){
//
$file1=$_FILES["file1"];
if($file1["name"]){
if(!check_file_type("xls|xlsx",get_file_ext($file1["name"])))
alert_and_back("请选择EXCEL文档(.xls)!");
}else{
alert_and_back("请选择EXCEL文档(.xls)!");
}
$tmp_file_name=save_tmp_file($file1);
$tmp_content=get_tmp_content($tmp_file_name);
$arr_content=explode("\n",$tmp_content);
$arr_thead=get_table_thead($tmp_content);
$arr_column=check_table_thead($arr_thead,$arr_column_keyword);
if(count($arr_column[0])==0){
alert_and_back("未检测到可导入字段,请返回检查EXCEL文件!");
//del_tmp_file($tmp_file_name);
}
//检查客户代码
$arr_wrong_username=array();
for($i=1;$i<count($arr_content);$i++){
$tmp_arr=explode("|^_^|",$arr_content[$i]);
$insert_value="";
for($k=0;$k<count($arr_column[0]);$k++){
$ind=$arr_column[0][$k];
$ititle=$arr_column[1][$k];
if($ititle=="uid"){
$m1=get_db_msg("select id from ".$table_pre."client where username='".trim($tmp_arr[$ind])."'");
if($m1["id"]>0){
//客户存在
}else{
if(!in_array($tmp_arr[$ind],$arr_wrong_username))
$arr_wrong_username[]=$tmp_arr[$ind];
}
}
}
}
if(count($arr_wrong_username)>0)
alert_and_back("以下客户代码有误,请检查:".arr_to_str($arr_wrong_username)."!");
//导入数据
if($is_qk=="y"){
//初始化
$db->query("truncate table ".$tname.";");
}
foreach($arr_column[1] as $k1 => $v1){
if($v1=="uid")
$insert_column.=$v1.",upath,";
else
$insert_column.=$v1.",";
}
for($i=1;$i<count($arr_content);$i++){
$tmp_arr=explode("|^_^|",$arr_content[$i]);
$insert_value="";
for($k=0;$k<count($arr_column[0]);$k++){
$ind=$arr_column[0][$k];
$ititle=$arr_column[1][$k];
if($ititle=="uid"){
$m1=get_db_msg("select id,path from ".$table_pre."client where username='".trim($tmp_arr[$ind])."'");
$insert_value.="'".$m1["id"]."','".$m1["path"]."-".$m1["id"]."',";
}else{
$insert_value.="'".mysql_escape_string(trim($tmp_arr[$ind]))."',";
}
}
$q="insert into ".$tname." (".substr($insert_column,0,-1).") values (".substr($insert_value,0,-1).")";
//echo $i.".".$q."<br>";
$db->query($q);
}
//del_tmp_file($tmp_file_name);
}
$json1='{type: "checkbox", fixed:"left", width:50},';
foreach($arr_column_keyword as $key=>$value){
$json1.="{field: '".$key."', title: '".$value."', width:150},";
}
$json1.="{field:'action', title:'操作',templet: '#action_mx'}";
$json1="[[".$json1."]]";
$content="";
switch($lx){
case "1":
//取得总数
$tmp=get_db_msg("select count(*) 'num' from ".$tname." where id>0 ".$sql_con);
$total_num=$tmp["num"];
$query="select * from ".$tname." where id>0 ".$sql_con." order by id limit ".$start.",".$end;
$count=0;
$res=$db->query($query);
$str_tmp="";
$json_data.="{\"code\":0,\"msg\":\"\",\"count\":".$total_num.",\"data\":[";
while($msg=$db->fetch_array($res)){
$list=$count_first+$count+1;
$kehu_name=get_db_msg("select username from ".$table_pre."client where id='".$msg["uid"]."'");
$str_tmp.="{";
$str_tmp.="\"id\":\"".$msg["id"]."\",";
$str_tmp.="\"uid\":\"".$kehu_name["username"]."\",";
$str_tmp.="\"bh\":\"".$list."\",";
foreach($arr_column_keyword as $key=>$value){
if($key!="uid"){
$str_tmp.="\"".$key."\":\"".$msg[$key]."\",";
}
}
//$str_tmp.="\"action\":\"".$msg["action"]."\",";
$str_tmp.="\"ks\":\"".$msg["ks"]."\"";
$str_tmp.="},";
$count++;
}
$json_data.=substr($str_tmp,0,-1)."]}";
echo $json_data;
break;
case "save_add":
$neirong="";
$id=@$_GET["id"];
foreach($arr_column_keyword as $key=>$value){
if($key!="uid"){
$v="s_".$key."";
$neirong =$_POST[$v];
$sql_con.="".$key."='".$neirong."',";
}
}
$sql_con=substr($sql_con,0,-1);
$query="update ".$tname." set ".$sql_con." where id='".$id."'";
$db->query($query);
alert_and_back("保存成功");
break;
case "del":
$id=@$_GET["id"];
$id=(is_array($id))?$id:array($id);
$num=count($id);
for($i=0;$i<$num;$i++){
$db->query("delete from ".$tname." where id='".$id[$i]."'");
}
$json_data.="{\"code\":1}";
echo $json_data;
break;
case "edit":
$id=@$_GET["id"];
//'.$wjname.'.php?lx=save_add&id='.$id.'
$content='<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="renderer" content="webkit"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><title>导入excel-e订通后台</title><link rel="stylesheet" href="../layuiadmin/layui/css/layui.css"><link rel="stylesheet" href="index.css"><script src="../layuiadmin/layui/layui.js"></script><script src="../js/function.js"></script><style>#table1{border:0px;}</style></head><body>';
$content.='<form class="layui-form" action="'.$wjname.'.php?lx=save_add&id='.$id.'" method="post"><br><br><table class="layui-table" id="table1" style="width:90%;margin:0 auto;">';
$xinxi=get_db_msg("select * from ".$tname." where id='".$id."'");
foreach($arr_column_keyword as $key=>$value){
if($key!="uid")
$content.="<tr><td>".$value."</td><td><input type='text' class='layui-input' value='".$xinxi[$key]."' name='s_".$key."'></td></tr>";
else{
$check=get_db_msg("select username from web_client where id='".$xinxi[$key]."'");
$content.="<tr style='background:#ccc;'><td>".$value."</td><td>".$check["username"]."</tr>";
}
}
$content.='</table><div style="padding-left:300px;"><button id="form1_submit" class="layui-btn layui-btn-normal btn1" lay-submit lay-filter="form1_submit">保存</button></form></div></body></html>';
$js="<script>
var this1=".$json1.";
layui.use(['form','layer','laydate','table','laytpl','element',],function(){
var form = layui.form,
layer = parent.layer === undefined ? layui.layer : top.layer,
$=layui.jquery,
laydate = layui.laydate,
laytpl = layui.laytpl,
table = layui.table;
form.on('submit(form1_submit)',function(data){
});
});
</script>";
echo $js;
echo $content;
break;
default:
//-------------------------------取得数据
$content='<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="renderer" content="webkit"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><title>导入excel-e订通后台</title><link rel="stylesheet" href="../layuiadmin/layui/css/layui.css"><link rel="stylesheet" href="index.css"><script src="../layuiadmin/layui/layui.js"></script><script src="../js/function.js"></script><style>#table1{border:0px;}</style></head><body>';
$content.='<form class="layui-form" method="post" enctype="multipart/form-data"><input type="hidden" name="is_submit" value="y"><div style="padding:20px;background:#ccc;" >导入历史数据</div><table class="layui-table" id="table1" style="width:100%;"><tr><td width="300px">导入模板:</td><td><a href="'.$wjname.'_mb.xls"><img src="../images/excel.png" width="30" height="33"></a><a href="'.$wjname.'_mb.xls">debug/'.$wjname.'_mb.xls</a></td></tr><tr><td>请选择excel数据文档:</td><td><input type=file name="file1" style="width:250px"> <input type="checkbox" name="is_qk" id="is_qk" value="y" lay-skin="primary" checked><label for="is_qk">清空导入<input type="submit" value="提交" class="layui-btn layui-btn-sm layui-btn-normal"></label>'.$content_sj.'</td></tr></table><a class="layui-btn layui-btn-danger btn_del">删除</a><table id="table2" lay-filter="layui_table"></table></form><script type="text/html" id="action_mx"><a lay-event="edit" style="color:blue;">修改</a></script><p id="aa"></p></body></html>';
echo $content;
$js="<script>
var this1=".$json1.";
layui.use(['form','layer','laydate','table','laytpl','element',],function(){
var form = layui.form,
layer = parent.layer === undefined ? layui.layer : top.layer,
$=layui.jquery,
laydate = layui.laydate,
laytpl = layui.laytpl,
table = layui.table;
//数据表格
var url='".$wjname.".php?lx=1';
var tableIns = table.render({
even:false,
elem: '#table2',
url : url,
cellMinWidth : 80,
page : true,
height : 'full-100',
limit : 10,
limits : [10,20,30,50,100],
id : 'ListTable',
cols :this1,
done: function(res, curr, count){
}
});
function add(id){
var t1=(id>0)?'':'';
var index = layui.layer.open({
title : t1+'修改历史数据',
type : 2,
area: ['700px', '500px'],
content : '".$wjname.".php?lx=edit&id='+id,
success : function(layero, index){
}
,cancel: function(index, layero){
window.parent.location.reload();
}
})
}
//批量删除
$('.btn_del').click(function(){
var checkStatus = table.checkStatus('ListTable'),
data = checkStatus.data,
check_id = [];
if(data.length > 0) {
for (var i in data) {
check_id.push(data[i].id);
}
layer.confirm('确定删除吗?', {icon: 3, title: '提示信息'}, function (index) {
$.get('".$wjname.".php?lx=del',{id:check_id},function(data){
tableIns.reload();
layer.close(index);
})
})
}else{
layer.msg('请选择需要删除的记录');
}
})
//列表操作
table.on('tool(layui_table)', function(obj){
var layEvent = obj.event,
data = obj.data;
if(layEvent === 'edit'){
//编辑
add(data.id);
}
});
});
</script>";
echo $js;
break;
}
?>
Binary file not shown.
+289
View File
@@ -0,0 +1,289 @@
<?php
//-------------------------------------------------------导入历史数据
date_default_timezone_set('Asia/Shanghai');
header("Content-type: text/html; charset=utf-8");
error_reporting(E_ERROR | E_WARNING | E_PARSE);
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
$page=@$_GET["page"];
$lx=@$_GET["lx"];
$limit=@$_GET["limit"];
$json_data="";
$page=$page>0?$page:1;
$limit=$limit>0?$limit:10;
$start=($page-1)*$limit;
$end=$limit;
$arr_column_keyword=array("uid"=>"客户代码","c1"=>"波段名称","c2"=>"大类名称","je"=>"金额","js"=>"件数","ks"=>"款数");
//-------------------------------定义字段
//-------------------------------定义数据表
$wjname="plugin_ls2";
$json_data="";
$tname=$table_pre.$wjname;
$sql_create_table="CREATE TABLE ".$tname." (
`id` int(10) unsigned NOT NULL auto_increment,
`uid` int(10) unsigned NOT NULL default '0',
`upath` varchar(255) NOT NULL default '',
`c1` varchar(255) NOT NULL default '',
`c2` varchar(255) NOT NULL default '',
`je` int(10) unsigned NOT NULL default '0',
`js` int(10) unsigned NOT NULL default '0',
`ks` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
//-------------------------------mysql connect
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$is_submit=$_POST["is_submit"];
$is_qk=$_POST["is_qk"];
//-------------------------------导入数据
//建立数据表
if(check_table_exist($tname)!="y")
$db->query($sql_create_table);
if($is_submit=="y"){
//
$file1=$_FILES["file1"];
if($file1["name"]){
if(!check_file_type("xls|xlsx",get_file_ext($file1["name"])))
alert_and_back("请选择EXCEL文档(.xls)!");
}else{
alert_and_back("请选择EXCEL文档(.xls)!");
}
$tmp_file_name=save_tmp_file($file1);
$tmp_content=get_tmp_content($tmp_file_name);
$arr_content=explode("\n",$tmp_content);
$arr_thead=get_table_thead($tmp_content);
$arr_column=check_table_thead($arr_thead,$arr_column_keyword);
if(count($arr_column[0])==0){
alert_and_back("未检测到可导入字段,请返回检查EXCEL文件!");
//del_tmp_file($tmp_file_name);
}
//检查客户代码
$arr_wrong_username=array();
for($i=1;$i<count($arr_content);$i++){
$tmp_arr=explode("|^_^|",$arr_content[$i]);
$insert_value="";
for($k=0;$k<count($arr_column[0]);$k++){
$ind=$arr_column[0][$k];
$ititle=$arr_column[1][$k];
if($ititle=="uid"){
$m1=get_db_msg("select id from ".$table_pre."client where username='".trim($tmp_arr[$ind])."'");
if($m1["id"]>0){
//客户存在
}else{
if(!in_array($tmp_arr[$ind],$arr_wrong_username))
$arr_wrong_username[]=$tmp_arr[$ind];
}
}
}
}
if(count($arr_wrong_username)>0)
alert_and_back("以下客户代码有误,请检查:".arr_to_str($arr_wrong_username)."!");
//导入数据
if($is_qk=="y"){
//初始化
$db->query("truncate table ".$tname.";");
}
foreach($arr_column[1] as $k1 => $v1){
if($v1=="uid")
$insert_column.=$v1.",upath,";
else
$insert_column.=$v1.",";
}
for($i=1;$i<count($arr_content);$i++){
$tmp_arr=explode("|^_^|",$arr_content[$i]);
$insert_value="";
for($k=0;$k<count($arr_column[0]);$k++){
$ind=$arr_column[0][$k];
$ititle=$arr_column[1][$k];
if($ititle=="uid"){
$m1=get_db_msg("select id,path from ".$table_pre."client where username='".trim($tmp_arr[$ind])."'");
$insert_value.="'".$m1["id"]."','".$m1["path"]."-".$m1["id"]."',";
}else{
$insert_value.="'".mysql_escape_string(trim($tmp_arr[$ind]))."',";
}
}
$q="insert into ".$tname." (".substr($insert_column,0,-1).") values (".substr($insert_value,0,-1).")";
//echo $i.".".$q."<br>";
$db->query($q);
}
//del_tmp_file($tmp_file_name);
}
$json1='{type: "checkbox", fixed:"left", width:50},';
foreach($arr_column_keyword as $key=>$value){
$json1.="{field: '".$key."', title: '".$value."', width:150},";
}
$json1.="{field:'action', title:'操作',templet: '#action_mx'}";
$json1="[[".$json1."]]";
$content="";
switch($lx){
case "1":
//取得总数
$tmp=get_db_msg("select count(*) 'num' from ".$tname." where id>0 ".$sql_con);
$total_num=$tmp["num"];
$query="select * from ".$tname." where id>0 ".$sql_con." order by id limit ".$start.",".$end;
$count=0;
$res=$db->query($query);
$str_tmp="";
$json_data.="{\"code\":0,\"msg\":\"\",\"count\":".$total_num.",\"data\":[";
while($msg=$db->fetch_array($res)){
$list=$count_first+$count+1;
$kehu_name=get_db_msg("select username from ".$table_pre."client where id='".$msg["uid"]."'");
$str_tmp.="{";
$str_tmp.="\"id\":\"".$msg["id"]."\",";
$str_tmp.="\"uid\":\"".$kehu_name["username"]."\",";
$str_tmp.="\"bh\":\"".$list."\",";
foreach($arr_column_keyword as $key=>$value){
if($key!="uid"){
$str_tmp.="\"".$key."\":\"".$msg[$key]."\",";
}
}
//$str_tmp.="\"action\":\"".$msg["action"]."\",";
$str_tmp.="\"ks\":\"".$msg["ks"]."\"";
$str_tmp.="},";
$count++;
}
$json_data.=substr($str_tmp,0,-1)."]}";
echo $json_data;
break;
case "save_add":
$neirong="";
$id=@$_GET["id"];
foreach($arr_column_keyword as $key=>$value){
if($key!="uid"){
$v="s_".$key."";
$neirong =$_POST[$v];
$sql_con.="".$key."='".$neirong."',";
}
}
$sql_con=substr($sql_con,0,-1);
$query="update ".$tname." set ".$sql_con." where id='".$id."'";
$db->query($query);
alert_and_back("保存成功");
break;
case "del":
$id=@$_GET["id"];
$id=(is_array($id))?$id:array($id);
$num=count($id);
for($i=0;$i<$num;$i++){
$db->query("delete from ".$tname." where id='".$id[$i]."'");
}
$json_data.="{\"code\":1}";
echo $json_data;
break;
case "edit":
$id=@$_GET["id"];
$content='<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="renderer" content="webkit"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><title>导入excel-e订通后台</title><link rel="stylesheet" href="../layuiadmin/layui/css/layui.css"><link rel="stylesheet" href="index.css"><script src="../layuiadmin/layui/layui.js"></script><script src="../js/function.js"></script><style>#table1{border:0px;}</style></head><body>';
$content.='<form class="layui-form" action="'.$wjname.'.php?lx=save_add&id='.$id.'" method="post"><br><br><table class="layui-table" id="table1" style="width:90%;margin:0 auto;">';
$xinxi=get_db_msg("select * from ".$tname." where id='".$id."'");
foreach($arr_column_keyword as $key=>$value){
if($key!="uid")
$content.="<tr><td>".$value."</td><td><input type='text' class='layui-input' value='".$xinxi[$key]."' name='s_".$key."'></td></tr>";
else{
$check=get_db_msg("select username from web_client where id='".$xinxi[$key]."'");
$content.="<tr style='background:#ccc;'><td>".$value."</td><td>".$check["username"]."</tr>";
}
}
$content.='</table><div style="padding-left:300px;"><button id="form1_submit" class="layui-btn layui-btn-normal btn1" lay-submit lay-filter="form1_submit">保存</button></form></div></body></html>';
$js="<script>
var this1=".$json1.";
layui.use(['form','layer','laydate','table','laytpl','element',],function(){
var form = layui.form,
layer = parent.layer === undefined ? layui.layer : top.layer,
$=layui.jquery,
laydate = layui.laydate,
laytpl = layui.laytpl,
table = layui.table;
form.on('submit(form1_submit)',function(data){
});
});
</script>";
echo $js;
echo $content;
break;
default:
//-------------------------------取得数据
$content='<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="renderer" content="webkit"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><title>导入excel-e订通后台</title><link rel="stylesheet" href="../layuiadmin/layui/css/layui.css"><link rel="stylesheet" href="index.css"><script src="../layuiadmin/layui/layui.js"></script><script src="../js/function.js"></script><style>#table1{border:0px;}</style></head><body>';
$content.='<form class="layui-form" method="post" enctype="multipart/form-data"><input type="hidden" name="is_submit" value="y"><div style="padding:20px;background:#ccc;" >导入历史数据</div><table class="layui-table" id="table1" style="width:100%;"><tr><td width="300px">导入模板:</td><td><a href="'.$wjname.'_mb.xls"><img src="../images/excel.png" width="30" height="33"></a><a href="'.$wjname.'_mb.xls">debug/'.$wjname.'_mb.xls</a></td></tr><tr><td>请选择excel数据文档:</td><td><input type=file name="file1" style="width:250px"> <input type="checkbox" name="is_qk" id="is_qk" value="y" lay-skin="primary" checked><label for="is_qk">清空导入<input type="submit" value="提交" class="layui-btn layui-btn-sm layui-btn-normal"></label>'.$content_sj.'</td></tr></table><a class="layui-btn layui-btn-danger btn_del">删除</a><table id="table2" lay-filter="layui_table"></table></form><script type="text/html" id="action_mx"><a lay-event="edit" style="color:blue;">修改</a></script><p id="aa"></p></body></html>';
echo $content;
$js="<script>
var this1=".$json1.";
layui.use(['form','layer','laydate','table','laytpl','element',],function(){
var form = layui.form,
layer = parent.layer === undefined ? layui.layer : top.layer,
$=layui.jquery,
laydate = layui.laydate,
laytpl = layui.laytpl,
table = layui.table;
//数据表格
var url='".$wjname.".php?lx=1';
var tableIns = table.render({
even:false,
elem: '#table2',
url : url,
cellMinWidth : 80,
page : true,
height : 'full-100',
limit : 10,
limits : [10,20,30,50,100],
id : 'ListTable',
cols :this1,
done: function(res, curr, count){
}
});
function add(id){
var t1=(id>0)?'':'';
var index = layui.layer.open({
title : t1+'修改历史数据',
type : 2,
area: ['700px', '500px'],
content : '".$wjname.".php?lx=edit&id='+id,
success : function(layero, index){
}
,cancel: function(index, layero){
window.parent.location.reload();
}
})
}
//批量删除
$('.btn_del').click(function(){
var checkStatus = table.checkStatus('ListTable'),
data = checkStatus.data,
check_id = [];
if(data.length > 0) {
for (var i in data) {
check_id.push(data[i].id);
}
layer.confirm('确定删除吗?', {icon: 3, title: '提示信息'}, function (index) {
$.get('".$wjname.".php?lx=del',{id:check_id},function(data){
tableIns.reload();
layer.close(index);
})
})
}else{
layer.msg('请选择需要删除的记录');
}
})
//列表操作
table.on('tool(layui_table)', function(obj){
var layEvent = obj.event,
data = obj.data;
if(layEvent === 'edit'){
//编辑
add(data.id);
}
});
});
</script>";
echo $js;
break;
}
?>
Binary file not shown.
+292
View File
@@ -0,0 +1,292 @@
<?php
//-------------------------------------------------------导入历史数据
date_default_timezone_set('Asia/Shanghai');
header("Content-type: text/html; charset=utf-8");
error_reporting(E_ERROR | E_WARNING | E_PARSE);
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
$page=@$_GET["page"];
$lx=@$_GET["lx"];
$limit=@$_GET["limit"];
$json_data="";
$page=$page>0?$page:1;
$limit=$limit>0?$limit:10;
$start=($page-1)*$limit;
$end=$limit;
$arr_column_keyword=array("uid"=>"客户代码","c1"=>"上下装","c2"=>"大类","skc_sc"=>"上次订货SKC","ls_xsnum"=>"销售量","ls_numzb"=>"销比","ls_xsje"=>"销售额","ls_jezb"=>"金额占比");
//-------------------------------定义字段
//-------------------------------定义数据表
$wjname="plugin_ls2sxz";
$json_data="";
$tname=$table_pre.$wjname;
$sql_create_table="CREATE TABLE ".$tname." (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(10) unsigned NOT NULL default '0',
`upath` varchar(255) NOT NULL default '',
`c1` varchar(255) NOT NULL default '',
`c2` varchar(255) NOT NULL default '',
`skc_sc` int(10) unsigned NOT NULL default '0',
`ls_xsnum` int(10) unsigned NOT NULL default '0',
`ls_numzb` decimal(4,3) NOT NULL default '0.000',
`ls_xsje` int(10) unsigned NOT NULL default '0',
`ls_jezb` decimal(4,3) NOT NULL default '0.000',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
//-------------------------------mysql connect
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$is_submit=$_POST["is_submit"];
$is_qk=$_POST["is_qk"];
//-------------------------------导入数据
//建立数据表
if(check_table_exist($tname)!="y")
$db->query($sql_create_table);
if($is_submit=="y"){
//
$file1=$_FILES["file1"];
if($file1["name"]){
if(!check_file_type("xls|xlsx",get_file_ext($file1["name"])))
alert_and_back("请选择EXCEL文档(.xls)!");
}else{
alert_and_back("请选择EXCEL文档(.xls)!");
}
$tmp_file_name=save_tmp_file($file1);
$tmp_content=get_tmp_content($tmp_file_name);
$arr_content=explode("\n",$tmp_content);
$arr_thead=get_table_thead($tmp_content);
$arr_column=check_table_thead($arr_thead,$arr_column_keyword);
if(count($arr_column[0])==0){
alert_and_back("未检测到可导入字段,请返回检查EXCEL文件!");
//del_tmp_file($tmp_file_name);
}
//检查客户代码
$arr_wrong_username=array();
for($i=1;$i<count($arr_content);$i++){
$tmp_arr=explode("|^_^|",$arr_content[$i]);
$insert_value="";
for($k=0;$k<count($arr_column[0]);$k++){
$ind=$arr_column[0][$k];
$ititle=$arr_column[1][$k];
if($ititle=="uid"){
$m1=get_db_msg("select id from ".$table_pre."client where username='".trim($tmp_arr[$ind])."'");
if($m1["id"]>0){
//客户存在
}else{
if(!in_array($tmp_arr[$ind],$arr_wrong_username))
$arr_wrong_username[]=$tmp_arr[$ind];
}
}
}
}
if(count($arr_wrong_username)>0)
alert_and_back("以下客户代码有误,请检查:".arr_to_str($arr_wrong_username)."!");
//导入数据
if($is_qk=="y"){
//初始化
$db->query("truncate table ".$tname.";");
}
foreach($arr_column[1] as $k1 => $v1){
if($v1=="uid")
$insert_column.=$v1.",upath,";
else
$insert_column.=$v1.",";
}
for($i=1;$i<count($arr_content);$i++){
$tmp_arr=explode("|^_^|",$arr_content[$i]);
$insert_value="";
for($k=0;$k<count($arr_column[0]);$k++){
$ind=$arr_column[0][$k];
$ititle=$arr_column[1][$k];
if($ititle=="uid"){
$m1=get_db_msg("select id,path from ".$table_pre."client where username='".trim($tmp_arr[$ind])."'");
$insert_value.="'".$m1["id"]."','".$m1["path"]."-".$m1["id"]."',";
}else{
$insert_value.="'".mysql_escape_string(trim($tmp_arr[$ind]))."',";
}
}
$q="insert into ".$tname." (".substr($insert_column,0,-1).") values (".substr($insert_value,0,-1).")";
//echo $i.".".$q."<br>";
$db->query($q);
}
//del_tmp_file($tmp_file_name);
}
$json1='{type: "checkbox", fixed:"left", width:50},';
foreach($arr_column_keyword as $key=>$value){
$json1.="{field: '".$key."', title: '".$value."', width:150},";
}
$json1.="{field:'action', title:'操作',templet: '#action_mx'}";
$json1="[[".$json1."]]";
$content="";
switch($lx){
case "1":
//取得总数
$tmp=get_db_msg("select count(*) 'num' from ".$tname." where id>0 ".$sql_con);
$total_num=$tmp["num"];
$query="select * from ".$tname." where id>0 ".$sql_con." order by id limit ".$start.",".$end;
$count=0;
$res=$db->query($query);
$str_tmp="";
$json_data.="{\"code\":0,\"msg\":\"\",\"count\":".$total_num.",\"data\":[";
while($msg=$db->fetch_array($res)){
$list=$count_first+$count+1;
$kehu_name=get_db_msg("select username from ".$table_pre."client where id='".$msg["uid"]."'");
$str_tmp.="{";
$str_tmp.="\"id\":\"".$msg["id"]."\",";
$str_tmp.="\"uid\":\"".$kehu_name["username"]."\",";
$str_tmp.="\"bh\":\"".$list."\",";
foreach($arr_column_keyword as $key=>$value){
if($key!="uid"){
$str_tmp.="\"".$key."\":\"".$msg[$key]."\",";
}
}
//$str_tmp.="\"action\":\"".$msg["action"]."\",";
$str_tmp.="\"ks\":\"".$msg["ks"]."\"";
$str_tmp.="},";
$count++;
}
$json_data.=substr($str_tmp,0,-1)."]}";
echo $json_data;
break;
case "save_add":
$neirong="";
$id=@$_GET["id"];
foreach($arr_column_keyword as $key=>$value){
if($key!="uid"){
$v="s_".$key."";
$neirong =$_POST[$v];
$sql_con.="".$key."='".$neirong."',";
}
}
$sql_con=substr($sql_con,0,-1);
$query="update ".$tname." set ".$sql_con." where id='".$id."'";
$db->query($query);
alert_and_back("保存成功");
break;
case "del":
$id=@$_GET["id"];
$id=(is_array($id))?$id:array($id);
$num=count($id);
for($i=0;$i<$num;$i++){
$db->query("delete from ".$tname." where id='".$id[$i]."'");
}
$json_data.="{\"code\":1}";
echo $json_data;
break;
case "edit":
$id=@$_GET["id"];
//'.$wjname.'.php?lx=save_add&id='.$id.'
$content='<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="renderer" content="webkit"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><title>导入excel-e订通后台</title><link rel="stylesheet" href="../layuiadmin/layui/css/layui.css"><link rel="stylesheet" href="index.css"><script src="../layuiadmin/layui/layui.js"></script><script src="../js/function.js"></script><style>#table1{border:0px;}</style></head><body>';
$content.='<form class="layui-form" action="'.$wjname.'.php?lx=save_add&id='.$id.'" method="post"><br><br><table class="layui-table" id="table1" style="width:90%;margin:0 auto;">';
$xinxi=get_db_msg("select * from ".$tname." where id='".$id."'");
foreach($arr_column_keyword as $key=>$value){
if($key!="uid")
$content.="<tr><td>".$value."</td><td><input type='text' class='layui-input' value='".$xinxi[$key]."' name='s_".$key."'></td></tr>";
else{
$check=get_db_msg("select username from web_client where id='".$xinxi[$key]."'");
$content.="<tr style='background:#ccc;'><td>".$value."</td><td>".$check["username"]."</tr>";
}
}
$content.='</table><div style="padding-left:300px;"><button id="form1_submit" class="layui-btn layui-btn-normal btn1" lay-submit lay-filter="form1_submit">保存</button></form></div></body></html>';
$js="<script>
var this1=".$json1.";
layui.use(['form','layer','laydate','table','laytpl','element',],function(){
var form = layui.form,
layer = parent.layer === undefined ? layui.layer : top.layer,
$=layui.jquery,
laydate = layui.laydate,
laytpl = layui.laytpl,
table = layui.table;
form.on('submit(form1_submit)',function(data){
});
});
</script>";
echo $js;
echo $content;
break;
default:
//-------------------------------取得数据
$content='<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="renderer" content="webkit"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><title>导入excel-e订通后台</title><link rel="stylesheet" href="../layuiadmin/layui/css/layui.css"><link rel="stylesheet" href="index.css"><script src="../layuiadmin/layui/layui.js"></script><script src="../js/function.js"></script><style>#table1{border:0px;}</style></head><body>';
$content.='<form class="layui-form" method="post" enctype="multipart/form-data"><input type="hidden" name="is_submit" value="y"><div style="padding:20px;background:#ccc;" >导入历史数据</div><table class="layui-table" id="table1" style="width:100%;"><tr><td width="300px">导入模板:</td><td><a href="'.$wjname.'_mb.xls"><img src="../images/excel.png" width="30" height="33"></a><a href="'.$wjname.'_mb.xls">debug/'.$wjname.'_mb.xls</a></td></tr><tr><td>请选择excel数据文档:</td><td><input type=file name="file1" style="width:250px"> <input type="checkbox" name="is_qk" id="is_qk" value="y" lay-skin="primary" checked><label for="is_qk">清空导入<input type="submit" value="提交" class="layui-btn layui-btn-sm layui-btn-normal"></label>'.$content_sj.'</td></tr></table><a class="layui-btn layui-btn-danger btn_del">删除</a><table id="table2" lay-filter="layui_table"></table></form><script type="text/html" id="action_mx"><a lay-event="edit" style="color:blue;">修改</a></script><p id="aa"></p></body></html>';
echo $content;
$js="<script>
var this1=".$json1.";
layui.use(['form','layer','laydate','table','laytpl','element',],function(){
var form = layui.form,
layer = parent.layer === undefined ? layui.layer : top.layer,
$=layui.jquery,
laydate = layui.laydate,
laytpl = layui.laytpl,
table = layui.table;
//数据表格
var url='".$wjname.".php?lx=1';
var tableIns = table.render({
even:false,
elem: '#table2',
url : url,
cellMinWidth : 80,
page : true,
height : 'full-100',
limit : 10,
limits : [10,20,30,50,100],
id : 'ListTable',
cols :this1,
done: function(res, curr, count){
}
});
function add(id){
var t1=(id>0)?'':'';
var index = layui.layer.open({
title : t1+'修改历史数据',
type : 2,
area: ['700px', '500px'],
content : '".$wjname.".php?lx=edit&id='+id,
success : function(layero, index){
}
,cancel: function(index, layero){
window.parent.location.reload();
}
})
}
//批量删除
$('.btn_del').click(function(){
var checkStatus = table.checkStatus('ListTable'),
data = checkStatus.data,
check_id = [];
if(data.length > 0) {
for (var i in data) {
check_id.push(data[i].id);
}
layer.confirm('确定删除吗?', {icon: 3, title: '提示信息'}, function (index) {
$.get('".$wjname.".php?lx=del',{id:check_id},function(data){
tableIns.reload();
layer.close(index);
})
})
}else{
layer.msg('请选择需要删除的记录');
}
})
//列表操作
table.on('tool(layui_table)', function(obj){
var layEvent = obj.event,
data = obj.data;
if(layEvent === 'edit'){
//编辑
add(data.id);
}
});
});
</script>";
echo $js;
break;
}
?>
Binary file not shown.
+291
View File
@@ -0,0 +1,291 @@
<?php
//-------------------------------------------------------导入区域类别类型数据 for pit 20190329 by clc
date_default_timezone_set('Asia/Shanghai');
header("Content-type: text/html; charset=utf-8");
error_reporting(E_ERROR | E_WARNING | E_PARSE);
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
$page=@$_GET["page"];
$lx=@$_GET["lx"];
$limit=@$_GET["limit"];
$json_data="";
$page=$page>0?$page:1;
$limit=$limit>0?$limit:10;
$start=($page-1)*$limit;
$end=$limit;
$arr_column_keyword=array("c1"=>"区域","c2"=>"产品类别","c3"=>"各类型风格","dy_sku"=>"带样SKU","cg_sku"=>"采购SKU","cg_num"=>"采购量","xs_num"=>"销售量","xs_je"=>"销售额","cb_je"=>"成本额");
//-------------------------------定义字段
//-------------------------------定义数据表
$wjname="plugin_pitsd";
$json_data="";
$tname=$table_pre.$wjname;
$sql_create_table="CREATE TABLE ".$tname." (
`id` int(10) unsigned NOT NULL auto_increment,
`c1` varchar(255) NOT NULL default '',
`c2` varchar(255) NOT NULL default '',
`c3` varchar(255) NOT NULL default '',
`dy_sku` float(10) unsigned NOT NULL default '0',
`cg_sku` float(10) unsigned NOT NULL default '0',
`cg_num` float(10) unsigned NOT NULL default '0',
`xs_num` float(10) unsigned NOT NULL default '0',
`xs_je` float(10) unsigned NOT NULL default '0',
`cb_je` float(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
//-------------------------------mysql connect
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$is_submit=$_POST["is_submit"];
$is_qk=$_POST["is_qk"];
//-------------------------------导入数据
//建立数据表
if(check_table_exist($tname)!="y")
$db->query($sql_create_table);
if($is_submit=="y"){
//
$file1=$_FILES["file1"];
if($file1["name"]){
if(!check_file_type("xls|xlsx",get_file_ext($file1["name"])))
alert_and_back("请选择EXCEL文档(.xls)!");
}else{
alert_and_back("请选择EXCEL文档(.xls)!");
}
$tmp_file_name=save_tmp_file($file1);
$tmp_content=get_tmp_content($tmp_file_name);
$arr_content=explode("\n",$tmp_content);
$arr_thead=get_table_thead($tmp_content);
$arr_column=check_table_thead($arr_thead,$arr_column_keyword);
if(count($arr_column[0])==0){
alert_and_back("未检测到可导入字段,请返回检查EXCEL文件!");
//del_tmp_file($tmp_file_name);
}
//检查客户代码
$arr_wrong_username=array();
for($i=1;$i<count($arr_content);$i++){
$tmp_arr=explode("|^_^|",$arr_content[$i]);
$insert_value="";
for($k=0;$k<count($arr_column[0]);$k++){
$ind=$arr_column[0][$k];
$ititle=$arr_column[1][$k];
if($ititle=="uid"){
$m1=get_db_msg("select id from ".$table_pre."client where username='".trim($tmp_arr[$ind])."'");
if($m1["id"]>0){
//客户存在
}else{
if(!in_array($tmp_arr[$ind],$arr_wrong_username))
$arr_wrong_username[]=$tmp_arr[$ind];
}
}
}
}
if(count($arr_wrong_username)>0)
alert_and_back("以下客户代码有误,请检查:".arr_to_str($arr_wrong_username)."!");
//导入数据
if($is_qk=="y"){
//初始化
$db->query("truncate table ".$tname.";");
}
foreach($arr_column[1] as $k1 => $v1){
if($v1=="uid")
$insert_column.=$v1.",upath,";
else
$insert_column.=$v1.",";
}
for($i=1;$i<count($arr_content);$i++){
$tmp_arr=explode("|^_^|",$arr_content[$i]);
$insert_value="";
for($k=0;$k<count($arr_column[0]);$k++){
$ind=$arr_column[0][$k];
$ititle=$arr_column[1][$k];
if($ititle=="uid"){
$m1=get_db_msg("select id,path from ".$table_pre."client where username='".trim($tmp_arr[$ind])."'");
$insert_value.="'".$m1["id"]."','".$m1["path"]."-".$m1["id"]."',";
}else{
$insert_value.="'".mysql_escape_string(trim($tmp_arr[$ind]))."',";
}
}
$q="insert into ".$tname." (".substr($insert_column,0,-1).") values (".substr($insert_value,0,-1).")";
//echo $i.".".$q."<br>";
$db->query($q);
}
//del_tmp_file($tmp_file_name);
}
$json1='{type: "checkbox", fixed:"left", width:50},';
foreach($arr_column_keyword as $key=>$value){
$json1.="{field: '".$key."', title: '".$value."', width:150},";
}
$json1.="{field:'action', title:'操作',templet: '#action_mx'}";
$json1="[[".$json1."]]";
$content="";
switch($lx){
case "1":
//取得总数
$tmp=get_db_msg("select count(*) 'num' from ".$tname." where id>0 ".$sql_con);
$total_num=$tmp["num"];
$query="select * from ".$tname." where id>0 ".$sql_con." order by id limit ".$start.",".$end;
$count=0;
$res=$db->query($query);
$str_tmp="";
$json_data.="{\"code\":0,\"msg\":\"\",\"count\":".$total_num.",\"data\":[";
while($msg=$db->fetch_array($res)){
$list=$count_first+$count+1;
$kehu_name=get_db_msg("select username from ".$table_pre."client where id='".$msg["uid"]."'");
$str_tmp.="{";
$str_tmp.="\"id\":\"".$msg["id"]."\",";
$str_tmp.="\"uid\":\"".$kehu_name["username"]."\",";
$str_tmp.="\"bh\":\"".$list."\",";
foreach($arr_column_keyword as $key=>$value){
if($key!="uid"){
$str_tmp.="\"".$key."\":\"".$msg[$key]."\",";
}
}
//$str_tmp.="\"action\":\"".$msg["action"]."\",";
$str_tmp.="\"ks\":\"".$msg["ks"]."\"";
$str_tmp.="},";
$count++;
}
$json_data.=substr($str_tmp,0,-1)."]}";
echo $json_data;
break;
case "save_add":
$neirong="";
$id=@$_GET["id"];
foreach($arr_column_keyword as $key=>$value){
if($key!="uid"){
$v="s_".$key."";
$neirong =$_POST[$v];
$sql_con.="".$key."='".$neirong."',";
}
}
$sql_con=substr($sql_con,0,-1);
$query="update ".$tname." set ".$sql_con." where id='".$id."'";
$db->query($query);
alert_and_back("保存成功");
break;
case "del":
$id=@$_GET["id"];
$id=(is_array($id))?$id:array($id);
$num=count($id);
for($i=0;$i<$num;$i++){
$db->query("delete from ".$tname." where id='".$id[$i]."'");
}
$json_data.="{\"code\":1}";
echo $json_data;
break;
case "edit":
$id=@$_GET["id"];
$content='<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="renderer" content="webkit"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><title>导入excel-e订通后台</title><link rel="stylesheet" href="../layuiadmin/layui/css/layui.css"><link rel="stylesheet" href="index.css"><script src="../layuiadmin/layui/layui.js"></script><script src="../js/function.js"></script><style>#table1{border:0px;}</style></head><body>';
$content.='<form class="layui-form" action="'.$wjname.'.php?lx=save_add&id='.$id.'" method="post"><br><br><table class="layui-table" id="table1" style="width:90%;margin:0 auto;">';
$xinxi=get_db_msg("select * from ".$tname." where id='".$id."'");
foreach($arr_column_keyword as $key=>$value){
if($key!="uid")
$content.="<tr><td>".$value."</td><td><input type='text' class='layui-input' value='".$xinxi[$key]."' name='s_".$key."'></td></tr>";
else{
$check=get_db_msg("select username from web_client where id='".$xinxi[$key]."'");
$content.="<tr style='background:#ccc;'><td>".$value."</td><td>".$check["username"]."</tr>";
}
}
$content.='</table><div style="padding-left:300px;"><button id="form1_submit" class="layui-btn layui-btn-normal btn1" lay-submit lay-filter="form1_submit">保存</button></form></div></body></html>';
$js="<script>
var this1=".$json1.";
layui.use(['form','layer','laydate','table','laytpl','element',],function(){
var form = layui.form,
layer = parent.layer === undefined ? layui.layer : top.layer,
$=layui.jquery,
laydate = layui.laydate,
laytpl = layui.laytpl,
table = layui.table;
form.on('submit(form1_submit)',function(data){
});
});
</script>";
echo $js;
echo $content;
break;
default:
//-------------------------------取得数据
$content='<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="renderer" content="webkit"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><title>导入excel-e订通后台</title><link rel="stylesheet" href="../layuiadmin/layui/css/layui.css"><link rel="stylesheet" href="index.css"><script src="../layuiadmin/layui/layui.js"></script><script src="../js/function.js"></script><style>#table1{border:0px;}</style></head><body>';
$content.='<form class="layui-form" method="post" enctype="multipart/form-data"><input type="hidden" name="is_submit" value="y"><div style="padding:20px;background:#ccc;" >导入历史数据</div><table class="layui-table" id="table1" style="width:100%;"><tr><td width="300px">导入模板:</td><td><a href="'.$wjname.'_mb.xls"><img src="../images/excel.png" width="30" height="33"></a><a href="'.$wjname.'_mb.xls">debug/'.$wjname.'_mb.xls</a></td></tr><tr><td>请选择excel数据文档:</td><td><input type=file name="file1" style="width:250px"> <input type="checkbox" name="is_qk" id="is_qk" value="y" lay-skin="primary" checked><label for="is_qk">清空导入<input type="submit" value="提交" class="layui-btn layui-btn-sm layui-btn-normal"></label>'.$content_sj.'</td></tr></table><a class="layui-btn layui-btn-danger btn_del">删除</a><table id="table2" lay-filter="layui_table"></table></form><script type="text/html" id="action_mx"><a lay-event="edit" style="color:blue;">修改</a></script><p id="aa"></p></body></html>';
echo $content;
$js="<script>
var this1=".$json1.";
layui.use(['form','layer','laydate','table','laytpl','element',],function(){
var form = layui.form,
layer = parent.layer === undefined ? layui.layer : top.layer,
$=layui.jquery,
laydate = layui.laydate,
laytpl = layui.laytpl,
table = layui.table;
//数据表格
var url='".$wjname.".php?lx=1';
var tableIns = table.render({
even:false,
elem: '#table2',
url : url,
cellMinWidth : 80,
page : true,
height : 'full-100',
limit : 10,
limits : [10,20,30,50,100],
id : 'ListTable',
cols :this1,
done: function(res, curr, count){
}
});
function add(id){
var t1=(id>0)?'':'';
var index = layui.layer.open({
title : t1+'修改历史数据',
type : 2,
area: ['700px', '500px'],
content : '".$wjname.".php?lx=edit&id='+id,
success : function(layero, index){
}
,cancel: function(index, layero){
window.parent.location.reload();
}
})
}
//批量删除
$('.btn_del').click(function(){
var checkStatus = table.checkStatus('ListTable'),
data = checkStatus.data,
check_id = [];
if(data.length > 0) {
for (var i in data) {
check_id.push(data[i].id);
}
layer.confirm('确定删除吗?', {icon: 3, title: '提示信息'}, function (index) {
$.get('".$wjname.".php?lx=del',{id:check_id},function(data){
tableIns.reload();
layer.close(index);
})
})
}else{
layer.msg('请选择需要删除的记录');
}
})
//列表操作
table.on('tool(layui_table)', function(obj){
var layEvent = obj.event,
data = obj.data;
if(layEvent === 'edit'){
//编辑
add(data.id);
}
});
});
</script>";
echo $js;
break;
}
?>
Binary file not shown.
+289
View File
@@ -0,0 +1,289 @@
<?php
//-------------------------------------------------------导入历史数据
date_default_timezone_set('Asia/Shanghai');
header("Content-type: text/html; charset=utf-8");
error_reporting(E_ERROR | E_WARNING | E_PARSE);
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
$page=@$_GET["page"];
$lx=@$_GET["lx"];
$limit=@$_GET["limit"];
$json_data="";
$page=$page>0?$page:1;
$limit=$limit>0?$limit:10;
$start=($page-1)*$limit;
$end=$limit;
$arr_column_keyword=array("uid"=>"客户代码","zd1"=>"指标字段","zb"=>"指标金额","zb_js"=>"指标件数","zb_skc"=>"指标skc数");
//-------------------------------定义字段
//-------------------------------定义数据表
$wjname="plugin_report_khzb_1w";
$json_data="";
$tname=$table_pre.$wjname;
$sql_create_table="CREATE TABLE ".$tname." (
`id` int(10) unsigned NOT NULL auto_increment,
`uid` int(10) unsigned NOT NULL default '0',
`upath` varchar(255) NOT NULL default '',
`zd1` varchar(255) NOT NULL default '',
`zb` int(10) unsigned NOT NULL default '0',
`zb_js` int(10) unsigned NOT NULL default '0',
`zb_skc` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
//-------------------------------mysql connect
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$is_submit=$_POST["is_submit"];
$is_qk=$_POST["is_qk"];
//-------------------------------导入数据
//建立数据表
if(check_table_exist($tname)!="y")
$db->query($sql_create_table);
if($is_submit=="y"){
//
$file1=$_FILES["file1"];
if($file1["name"]){
if(!check_file_type("xls|xlsx",get_file_ext($file1["name"])))
alert_and_back("请选择EXCEL文档(.xls)!");
}else{
alert_and_back("请选择EXCEL文档(.xls)!");
}
$tmp_file_name=save_tmp_file($file1);
$tmp_content=get_tmp_content($tmp_file_name);
$arr_content=explode("\n",$tmp_content);
$arr_thead=get_table_thead($tmp_content);
$arr_column=check_table_thead($arr_thead,$arr_column_keyword);
if(count($arr_column[0])==0){
alert_and_back("未检测到可导入字段,请返回检查EXCEL文件!");
//del_tmp_file($tmp_file_name);
}
//检查客户代码
$arr_wrong_username=array();
for($i=1;$i<count($arr_content);$i++){
$tmp_arr=explode("|^_^|",$arr_content[$i]);
$insert_value="";
for($k=0;$k<count($arr_column[0]);$k++){
$ind=$arr_column[0][$k];
$ititle=$arr_column[1][$k];
if($ititle=="uid"){
$m1=get_db_msg("select id from ".$table_pre."client where username='".trim($tmp_arr[$ind])."'");
if($m1["id"]>0){
//客户存在
}else{
if(!in_array($tmp_arr[$ind],$arr_wrong_username))
$arr_wrong_username[]=$tmp_arr[$ind];
}
}
}
}
if(count($arr_wrong_username)>0)
alert_and_back("以下客户代码有误,请检查:".arr_to_str($arr_wrong_username)."!");
//导入数据
if($is_qk=="y"){
//初始化
$db->query("truncate table ".$tname.";");
}
foreach($arr_column[1] as $k1 => $v1){
if($v1=="uid")
$insert_column.=$v1.",upath,";
else
$insert_column.=$v1.",";
}
for($i=1;$i<count($arr_content);$i++){
$tmp_arr=explode("|^_^|",$arr_content[$i]);
$insert_value="";
for($k=0;$k<count($arr_column[0]);$k++){
$ind=$arr_column[0][$k];
$ititle=$arr_column[1][$k];
if($ititle=="uid"){
$m1=get_db_msg("select id,path from ".$table_pre."client where username='".trim($tmp_arr[$ind])."'");
$insert_value.="'".$m1["id"]."','".$m1["path"]."-".$m1["id"]."',";
}else{
$insert_value.="'".mysql_escape_string(trim($tmp_arr[$ind]))."',";
}
}
$q="insert into ".$tname." (".substr($insert_column,0,-1).") values (".substr($insert_value,0,-1).")";
//echo $i.".".$q."<br>";
$db->query($q);
}
//del_tmp_file($tmp_file_name);
}
$json1='{type: "checkbox", fixed:"left", width:50},';
foreach($arr_column_keyword as $key=>$value){
$json1.="{field: '".$key."', title: '".$value."', width:150},";
}
$json1.="{field:'action', title:'操作',templet: '#action_mx'}";
$json1="[[".$json1."]]";
$content="";
switch($lx){
case "1":
//取得总数
$tmp=get_db_msg("select count(*) 'num' from ".$tname." where id>0 ".$sql_con);
$total_num=$tmp["num"];
$query="select * from ".$tname." where id>0 ".$sql_con." order by id limit ".$start.",".$end;
$count=0;
$res=$db->query($query);
$str_tmp="";
$json_data.="{\"code\":0,\"msg\":\"\",\"count\":".$total_num.",\"data\":[";
while($msg=$db->fetch_array($res)){
$list=$count_first+$count+1;
$kehu_name=get_db_msg("select username from ".$table_pre."client where id='".$msg["uid"]."'");
$str_tmp.="{";
$str_tmp.="\"id\":\"".$msg["id"]."\",";
$str_tmp.="\"uid\":\"".$kehu_name["username"]."\",";
$str_tmp.="\"bh\":\"".$list."\",";
foreach($arr_column_keyword as $key=>$value){
if($key!="uid"){
$str_tmp.="\"".$key."\":\"".$msg[$key]."\",";
}
}
//$str_tmp.="\"action\":\"".$msg["action"]."\",";
$str_tmp.="\"ks\":\"".$msg["ks"]."\"";
$str_tmp.="},";
$count++;
}
$json_data.=substr($str_tmp,0,-1)."]}";
echo $json_data;
break;
case "save_add":
$neirong="";
$id=@$_GET["id"];
foreach($arr_column_keyword as $key=>$value){
if($key!="uid"){
$v="s_".$key."";
$neirong =$_POST[$v];
$sql_con.="".$key."='".$neirong."',";
}
}
$sql_con=substr($sql_con,0,-1);
$query="update ".$tname." set ".$sql_con." where id='".$id."'";
$db->query($query);
alert_and_back("保存成功");
break;
case "del":
$id=@$_GET["id"];
$id=(is_array($id))?$id:array($id);
$num=count($id);
for($i=0;$i<$num;$i++){
$db->query("delete from ".$tname." where id='".$id[$i]."'");
}
$json_data.="{\"code\":1}";
echo $json_data;
break;
case "edit":
$id=@$_GET["id"];
//'.$wjname.'.php?lx=save_add&id='.$id.'
$content='<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="renderer" content="webkit"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><title>导入excel-e订通后台</title><link rel="stylesheet" href="../layuiadmin/layui/css/layui.css"><link rel="stylesheet" href="index.css"><script src="../layuiadmin/layui/layui.js"></script><script src="../js/function.js"></script><style>#table1{border:0px;}</style></head><body>';
$content.='<form class="layui-form" action="'.$wjname.'.php?lx=save_add&id='.$id.'" method="post"><br><br><table class="layui-table" id="table1" style="width:90%;margin:0 auto;">';
$xinxi=get_db_msg("select * from ".$tname." where id='".$id."'");
foreach($arr_column_keyword as $key=>$value){
if($key!="uid")
$content.="<tr><td>".$value."</td><td><input type='text' class='layui-input' value='".$xinxi[$key]."' name='s_".$key."'></td></tr>";
else{
$check=get_db_msg("select username from web_client where id='".$xinxi[$key]."'");
$content.="<tr style='background:#ccc;'><td>".$value."</td><td>".$check["username"]."</tr>";
}
}
$content.='</table><div style="padding-left:300px;"><button id="form1_submit" class="layui-btn layui-btn-normal btn1" lay-submit lay-filter="form1_submit">保存</button></form></div></body></html>';
$js="<script>
var this1=".$json1.";
layui.use(['form','layer','laydate','table','laytpl','element',],function(){
var form = layui.form,
layer = parent.layer === undefined ? layui.layer : top.layer,
$=layui.jquery,
laydate = layui.laydate,
laytpl = layui.laytpl,
table = layui.table;
form.on('submit(form1_submit)',function(data){
});
});
</script>";
echo $js;
echo $content;
break;
default:
//-------------------------------取得数据
$content='<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="renderer" content="webkit"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><title>导入excel-e订通后台</title><link rel="stylesheet" href="../layuiadmin/layui/css/layui.css"><link rel="stylesheet" href="index.css"><script src="../layuiadmin/layui/layui.js"></script><script src="../js/function.js"></script><style>#table1{border:0px;}</style></head><body>';
$content.='<form class="layui-form" method="post" enctype="multipart/form-data"><input type="hidden" name="is_submit" value="y"><div style="padding:20px;background:#ccc;" >导入历史数据</div><table class="layui-table" id="table1" style="width:100%;"><tr><td width="300px">导入模板:</td><td><a href="'.$wjname.'_mb.xls"><img src="../images/excel.png" width="30" height="33"></a><a href="'.$wjname.'_mb.xls">debug/'.$wjname.'_mb.xls</a></td></tr><tr><td>请选择excel数据文档:</td><td><input type=file name="file1" style="width:250px"> <input type="checkbox" name="is_qk" id="is_qk" value="y" lay-skin="primary" checked><label for="is_qk">清空导入<input type="submit" value="提交" class="layui-btn layui-btn-sm layui-btn-normal"></label>'.$content_sj.'</td></tr></table><a class="layui-btn layui-btn-danger btn_del">删除</a><table id="table2" lay-filter="layui_table"></table></form><script type="text/html" id="action_mx"><a lay-event="edit" style="color:blue;">修改</a></script><p id="aa"></p></body></html>';
echo $content;
$js="<script>
var this1=".$json1.";
layui.use(['form','layer','laydate','table','laytpl','element',],function(){
var form = layui.form,
layer = parent.layer === undefined ? layui.layer : top.layer,
$=layui.jquery,
laydate = layui.laydate,
laytpl = layui.laytpl,
table = layui.table;
//数据表格
var url='".$wjname.".php?lx=1';
var tableIns = table.render({
even:false,
elem: '#table2',
url : url,
cellMinWidth : 80,
page : true,
height : 'full-100',
limit : 10,
limits : [10,20,30,50,100],
id : 'ListTable',
cols :this1,
done: function(res, curr, count){
}
});
function add(id){
var t1=(id>0)?'':'';
var index = layui.layer.open({
title : t1+'修改历史数据',
type : 2,
area: ['700px', '500px'],
content : '".$wjname.".php?lx=edit&id='+id,
success : function(layero, index){
}
,cancel: function(index, layero){
window.parent.location.reload();
}
})
}
//批量删除
$('.btn_del').click(function(){
var checkStatus = table.checkStatus('ListTable'),
data = checkStatus.data,
check_id = [];
if(data.length > 0) {
for (var i in data) {
check_id.push(data[i].id);
}
layer.confirm('确定删除吗?', {icon: 3, title: '提示信息'}, function (index) {
$.get('".$wjname.".php?lx=del',{id:check_id},function(data){
tableIns.reload();
layer.close(index);
})
})
}else{
layer.msg('请选择需要删除的记录');
}
})
//列表操作
table.on('tool(layui_table)', function(obj){
var layEvent = obj.event,
data = obj.data;
if(layEvent === 'edit'){
//编辑
add(data.id);
}
});
});
</script>";
echo $js;
break;
}
?>
Binary file not shown.
+315
View File
@@ -0,0 +1,315 @@
<?php
//-------------------------------------------------------导入历史数据
date_default_timezone_set('Asia/Shanghai');
header("Content-type: text/html; charset=utf-8");
error_reporting(E_ERROR | E_WARNING | E_PARSE);
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
$page=@$_GET["page"];
$lx=@$_GET["lx"];
$limit=@$_GET["limit"];
$tbid=@$_GET["tbid"];
$json_data="";
$page=$page>0?$page:1;
$limit=$limit>0?$limit:10;
$start=($page-1)*$limit;
$end=$limit;
//$arr_column_keyword=array("uid"=>"客户代码","c1"=>"波段名称","c2"=>"大类名称","je"=>"金额","js"=>"件数","ks"=>"款数");
//-------------------------------定义字段
//-------------------------------定义数据表
$wjname="plugin_report_zdy_3w";
$json_data="";
//$sql_create_table="CREATE TABLE ".$tname." (
//`id` int(10) unsigned NOT NULL auto_increment,
//`uid` int(10) unsigned NOT NULL default '0',
//`upath` varchar(255) NOT NULL default '',
//`c1` varchar(255) NOT NULL default '',
//`c2` varchar(255) NOT NULL default '',
//`je` int(10) unsigned NOT NULL default '0',
//`js` int(10) unsigned NOT NULL default '0',
//`ks` int(10) unsigned NOT NULL default '0',
//PRIMARY KEY (`id`)
//) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
//-------------------------------mysql connect
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$is_submit=$_POST["is_submit"];
$is_qk=$_POST["is_qk"];
$tmp=get_db_msg("select * from ".$table_pre."plugin where id='".$tbid."'");
$tmpa=explode(",",$tmp["param"]);
$tmpb=explode("|",$tmpa[0]);
$tname=$table_pre."plugin_zdy_".$tmpb[1];
$arr_zd=array("keyword_zd1"=>"zd1","keyword_zd2"=>"zd2","keyword_zd3"=>"zd3");
$arr_dr_zd=array("dr_zd1"=>"dr_zd1","dr_zd2"=>"dr_zd2","dr_zd3"=>"dr_zd3","dr_zd4"=>"dr_zd4","dr_zd5"=>"dr_zd5","dr_zd6"=>"dr_zd6","dr_zd7"=>"dr_zd7","dr_zd8"=>"dr_zd8");
$arr_column_keyword=array();
$arr_column_keyword["uid"]="客户代码";
foreach($tmpa as $k => $v){
$tmparr=explode("|",$v);
if(array_key_exists($tmparr[0],$arr_zd)){
if($tmparr[1]){
$arr_column_keyword[$arr_zd[$tmparr[0]]]=get_cate_title_no("arr_select",$tmparr[1]);
}
}
if(array_key_exists($tmparr[0],$arr_dr_zd)){
if($tmparr[1]){
$tmpzd=explode("_",$tmparr[1]);
$arr_column_keyword[$arr_dr_zd[$tmparr[0]]]=$tmpzd[0];
}
}
}
//print_r($arr_column_keyword);
//exit;
//-------------------------------导入数据
//建立数据表
//if(check_table_exist($tname)!="y")
//$db->query($sql_create_table);
if($is_submit=="y"){
//
$file1=$_FILES["file1"];
if($file1["name"]){
if(!check_file_type("xls|xlsx",get_file_ext($file1["name"])))
alert_and_back("请选择EXCEL文档(.xls)!");
}else{
alert_and_back("请选择EXCEL文档(.xls)!");
}
$tmp_file_name=save_tmp_file($file1);
$tmp_content=get_tmp_content($tmp_file_name);
$arr_content=explode("\n",$tmp_content);
$arr_thead=get_table_thead($tmp_content);
$arr_column=check_table_thead($arr_thead,$arr_column_keyword);
if(count($arr_column[0])==0){
alert_and_back("未检测到可导入字段,请返回检查EXCEL文件!");
//del_tmp_file($tmp_file_name);
}
//检查客户代码
$arr_wrong_username=array();
for($i=1;$i<count($arr_content);$i++){
$tmp_arr=explode("|^_^|",$arr_content[$i]);
$insert_value="";
for($k=0;$k<count($arr_column[0]);$k++){
$ind=$arr_column[0][$k];
$ititle=$arr_column[1][$k];
if($ititle=="uid"){
$m1=get_db_msg("select id from ".$table_pre."client where username='".trim($tmp_arr[$ind])."'");
if($m1["id"]>0){
//客户存在
}else{
if(!in_array($tmp_arr[$ind],$arr_wrong_username))
$arr_wrong_username[]=$tmp_arr[$ind];
}
}
}
}
if(count($arr_wrong_username)>0)
alert_and_back("以下客户代码有误,请检查:".arr_to_str($arr_wrong_username)."!");
//导入数据
if($is_qk=="y"){
//初始化
$db->query("truncate table ".$tname.";");
}
foreach($arr_column[1] as $k1 => $v1){
if($v1=="uid")
$insert_column.=$v1.",upath,";
else
$insert_column.=$v1.",";
}
for($i=1;$i<count($arr_content);$i++){
$tmp_arr=explode("|^_^|",$arr_content[$i]);
$insert_value="";
for($k=0;$k<count($arr_column[0]);$k++){
$ind=$arr_column[0][$k];
$ititle=$arr_column[1][$k];
if($ititle=="uid"){
$m1=get_db_msg("select id,path from ".$table_pre."client where username='".trim($tmp_arr[$ind])."'");
$insert_value.="'".$m1["id"]."','".$m1["path"]."-".$m1["id"]."',";
}else{
$insert_value.="'".mysql_escape_string(trim($tmp_arr[$ind]))."',";
}
}
$q="insert into ".$tname." (".substr($insert_column,0,-1).") values (".substr($insert_value,0,-1).")";
//echo $i.".".$q."<br>";
$db->query($q);
}
//del_tmp_file($tmp_file_name);
}
$json1='{type: "checkbox", fixed:"left", width:50},';
foreach($arr_column_keyword as $key=>$value){
$json1.="{field: '".$key."', title: '".$value."', width:150},";
}
$json1.="{field:'action', title:'操作',templet: '#action_mx'}";
$json1="[[".$json1."]]";
$content="";
switch($lx){
case "1":
//取得总数
$tmp=get_db_msg("select count(*) 'num' from ".$tname." where id>0 ".$sql_con);
$total_num=$tmp["num"];
$query="select * from ".$tname." where id>0 ".$sql_con." order by id limit ".$start.",".$end;
$count=0;
$res=$db->query($query);
$str_tmp="";
$json_data.="{\"code\":0,\"msg\":\"\",\"count\":".$total_num.",\"data\":[";
while($msg=$db->fetch_array($res)){
$list=$count_first+$count+1;
$kehu_name=get_db_msg("select username from ".$table_pre."client where id='".$msg["uid"]."'");
$str_tmp.="{";
$str_tmp.="\"id\":\"".$msg["id"]."\",";
$str_tmp.="\"uid\":\"".$kehu_name["username"]."\",";
$str_tmp.="\"bh\":\"".$list."\",";
foreach($arr_column_keyword as $key=>$value){
if($key!="uid"){
$str_tmp.="\"".$key."\":\"".$msg[$key]."\",";
}
}
//$str_tmp.="\"action\":\"".$msg["action"]."\",";
$str_tmp.="\"ks\":\"".$msg["ks"]."\"";
$str_tmp.="},";
$count++;
}
$json_data.=substr($str_tmp,0,-1)."]}";
echo $json_data;
break;
case "save_add":
$neirong="";
$id=@$_GET["id"];
foreach($arr_column_keyword as $key=>$value){
if($key!="uid"){
$v="s_".$key."";
$neirong =$_POST[$v];
$sql_con.="".$key."='".$neirong."',";
}
}
$sql_con=substr($sql_con,0,-1);
$query="update ".$tname." set ".$sql_con." where id='".$id."'";
$db->query($query);
alert_and_back("保存成功");
break;
case "del":
$id=@$_GET["id"];
$id=(is_array($id))?$id:array($id);
$num=count($id);
for($i=0;$i<$num;$i++){
$db->query("delete from ".$tname." where id='".$id[$i]."'");
}
$json_data.="{\"code\":1}";
echo $json_data;
break;
case "edit":
$id=@$_GET["id"];
$content='<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="renderer" content="webkit"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><title>导入excel-e订通后台</title><link rel="stylesheet" href="../layuiadmin/layui/css/layui.css"><link rel="stylesheet" href="index.css"><script src="../layuiadmin/layui/layui.js"></script><script src="../js/function.js"></script><style>#table1{border:0px;}</style></head><body>';
$content.='<form class="layui-form" action="'.$wjname.'.php?lx=save_add&id='.$id.'" method="post"><br><br><table class="layui-table" id="table1" style="width:90%;margin:0 auto;">';
$xinxi=get_db_msg("select * from ".$tname." where id='".$id."'");
foreach($arr_column_keyword as $key=>$value){
if($key!="uid")
$content.="<tr><td>".$value."</td><td><input type='text' class='layui-input' value='".$xinxi[$key]."' name='s_".$key."'></td></tr>";
else{
$check=get_db_msg("select username from web_client where id='".$xinxi[$key]."'");
$content.="<tr style='background:#ccc;'><td>".$value."</td><td>".$check["username"]."</tr>";
}
}
$content.='</table><div style="padding-left:300px;"><button id="form1_submit" class="layui-btn layui-btn-normal btn1" lay-submit lay-filter="form1_submit">保存</button></form></div></body></html>';
$js="<script>
var this1=".$json1.";
layui.use(['form','layer','laydate','table','laytpl','element',],function(){
var form = layui.form,
layer = parent.layer === undefined ? layui.layer : top.layer,
$=layui.jquery,
laydate = layui.laydate,
laytpl = layui.laytpl,
table = layui.table;
form.on('submit(form1_submit)',function(data){
});
});
</script>";
echo $js;
echo $content;
break;
default:
//-------------------------------取得数据
$content='<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="renderer" content="webkit"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><title>导入excel-e订通后台</title><link rel="stylesheet" href="../layuiadmin/layui/css/layui.css"><link rel="stylesheet" href="index.css"><script src="../layuiadmin/layui/layui.js"></script><script src="../js/function.js"></script><style>#table1{border:0px;}</style></head><body>';
$content.='<form class="layui-form" method="post" enctype="multipart/form-data"><input type="hidden" name="is_submit" value="y"><div style="padding:20px;background:#ccc;" >导入自定义数据</div><table class="layui-table" id="table1" style="width:100%;"><tr><td width="300px">导入模板:</td><td><a href="'.$wjname.'_mb.xls"><img src="../images/excel.png" width="30" height="33"></a><a href="'.$wjname.'_mb.xls">debug/'.$wjname.'_mb.xls</a></td></tr><tr><td>请选择excel数据文档:</td><td><input type=file name="file1" style="width:250px"> <input type="checkbox" name="is_qk" id="is_qk" value="y" lay-skin="primary" checked><label for="is_qk">清空导入<input type="submit" value="提交" class="layui-btn layui-btn-sm layui-btn-normal">(请根据实际表格情况删除excel中的多余栏,以及根据下面表格的字段名去命名excel第一行的标题名)</label>'.$content_sj.'</td></tr></table><a class="layui-btn layui-btn-danger btn_del">删除</a><table id="table2" lay-filter="layui_table"></table></form><script type="text/html" id="action_mx"><a lay-event="edit" style="color:blue;">修改</a></script><p id="aa"></p></body></html>';
echo $content;
$js="<script>
var this1=".$json1.";
layui.use(['form','layer','laydate','table','laytpl','element',],function(){
var form = layui.form,
layer = parent.layer === undefined ? layui.layer : top.layer,
$=layui.jquery,
laydate = layui.laydate,
laytpl = layui.laytpl,
table = layui.table;
//数据表格
var url='".$wjname.".php?lx=1&tbid=".$tbid."';
var tableIns = table.render({
even:false,
elem: '#table2',
url : url,
cellMinWidth : 80,
page : true,
height : 'full-100',
limit : 10,
limits : [10,20,30,50,100],
id : 'ListTable',
cols :this1,
done: function(res, curr, count){
}
});
function add(id){
var t1=(id>0)?'':'';
var index = layui.layer.open({
title : t1+'修改历史数据',
type : 2,
area: ['700px', '500px'],
content : '".$wjname.".php?lx=edit&tbid=".$tbid."&id='+id,
success : function(layero, index){
}
,cancel: function(index, layero){
window.parent.location.reload();
}
})
}
//批量删除
$('.btn_del').click(function(){
var checkStatus = table.checkStatus('ListTable'),
data = checkStatus.data,
check_id = [];
if(data.length > 0) {
for (var i in data) {
check_id.push(data[i].id);
}
layer.confirm('确定删除吗?', {icon: 3, title: '提示信息'}, function (index) {
$.get('".$wjname.".php?lx=del&tbid=".$tbid."',{id:check_id},function(data){
tableIns.reload();
layer.close(index);
})
})
}else{
layer.msg('请选择需要删除的记录');
}
})
//列表操作
table.on('tool(layui_table)', function(obj){
var layEvent = obj.event,
data = obj.data;
if(layEvent === 'edit'){
//编辑
add(data.id);
}
});
});
</script>";
echo $js;
break;
}
?>
Binary file not shown.
+290
View File
@@ -0,0 +1,290 @@
<?php
//-------------------------------------------------------导入指标细分表
date_default_timezone_set('Asia/Shanghai');
header("Content-type: text/html; charset=utf-8");
error_reporting(E_ERROR | E_WARNING | E_PARSE);
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
$page=@$_GET["page"];
$lx=@$_GET["lx"];
$limit=@$_GET["limit"];
$json_data="";
$page=$page>0?$page:1;
$limit=$limit>0?$limit:10;
$start=($page-1)*$limit;
$end=$limit;
$arr_column_keyword=array("uid"=>"客户代码","key1"=>"波段名称","key2"=>"大类名称","je"=>"指标金额","js"=>"指标件数","ks"=>"指标款数");
//-------------------------------定义字段
//-------------------------------定义数据表
$wjname="plugin_zbxf2";
$json_data="";
$tname=$table_pre.$wjname;
$sql_create_table="CREATE TABLE ".$tname." (
id int(10) unsigned NOT NULL auto_increment,
uid int(10) unsigned NOT NULL default '0',
upath varchar(255) NOT NULL default '',
key1 varchar(255) NOT NULL default '',
key2 varchar(255) NOT NULL default '',
je int(10) unsigned NOT NULL default '0',
js int(10) unsigned NOT NULL default '0',
ks int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
//-------------------------------mysql connect
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$is_submit=$_POST["is_submit"];
$is_qk=$_POST["is_qk"];
//-------------------------------导入数据
//建立数据表
if(check_table_exist($tname)!="y")
$db->query($sql_create_table);
if($is_submit=="y"){
//
$file1=$_FILES["file1"];
if($file1["name"]){
if(!check_file_type("xls|xlsx",get_file_ext($file1["name"])))
alert_and_back("请选择EXCEL文档(.xls)!");
}else{
alert_and_back("请选择EXCEL文档(.xls)!");
}
$tmp_file_name=save_tmp_file($file1);
$tmp_content=get_tmp_content($tmp_file_name);
$arr_content=explode("\n",$tmp_content);
$arr_thead=get_table_thead($tmp_content);
$arr_column=check_table_thead($arr_thead,$arr_column_keyword);
if(count($arr_column[0])==0){
alert_and_back("未检测到可导入字段,请返回检查EXCEL文件!");
//del_tmp_file($tmp_file_name);
}
//检查客户代码
$arr_wrong_username=array();
for($i=1;$i<count($arr_content);$i++){
$tmp_arr=explode("|^_^|",$arr_content[$i]);
$insert_value="";
for($k=0;$k<count($arr_column[0]);$k++){
$ind=$arr_column[0][$k];
$ititle=$arr_column[1][$k];
if($ititle=="uid"){
$m1=get_db_msg("select id from ".$table_pre."client where username='".trim($tmp_arr[$ind])."'");
if($m1["id"]>0){
//客户存在
}else{
if(!in_array($tmp_arr[$ind],$arr_wrong_username))
$arr_wrong_username[]=$tmp_arr[$ind];
}
}
}
}
if(count($arr_wrong_username)>0)
alert_and_back("以下客户代码有误,请检查:".arr_to_str($arr_wrong_username)."!");
//导入数据
if($is_qk=="y"){
//初始化
$db->query("truncate table ".$tname.";");
}
foreach($arr_column[1] as $k1 => $v1){
if($v1=="uid")
$insert_column.=$v1.",upath,";
else
$insert_column.=$v1.",";
}
for($i=1;$i<count($arr_content);$i++){
$tmp_arr=explode("|^_^|",$arr_content[$i]);
$insert_value="";
for($k=0;$k<count($arr_column[0]);$k++){
$ind=$arr_column[0][$k];
$ititle=$arr_column[1][$k];
if($ititle=="uid"){
$m1=get_db_msg("select id,path from ".$table_pre."client where username='".trim($tmp_arr[$ind])."'");
$insert_value.="'".$m1["id"]."','".$m1["path"]."-".$m1["id"]."',";
}else{
$insert_value.="'".mysql_escape_string(trim($tmp_arr[$ind]))."',";
}
}
$q="insert into ".$tname." (".substr($insert_column,0,-1).") values (".substr($insert_value,0,-1).")";
//echo $i.".".$q."<br>";
$db->query($q);
}
//del_tmp_file($tmp_file_name);
}
$json1='{type: "checkbox", fixed:"left", width:50},';
foreach($arr_column_keyword as $key=>$value){
$json1.="{field: '".$key."', title: '".$value."', width:150},";
}
$json1.="{field:'action', title:'操作',templet: '#action_mx'}";
$json1="[[".$json1."]]";
$content="";
switch($lx){
case "1":
//取得总数
$tmp=get_db_msg("select count(*) 'num' from ".$tname." where id>0 ".$sql_con);
$total_num=$tmp["num"];
$query="select * from ".$tname." where id>0 ".$sql_con." order by id limit ".$start.",".$end;
$count=0;
$res=$db->query($query);
$str_tmp="";
$json_data.="{\"code\":0,\"msg\":\"\",\"count\":".$total_num.",\"data\":[";
while($msg=$db->fetch_array($res)){
$list=$count_first+$count+1;
$kehu_name=get_db_msg("select username from ".$table_pre."client where id='".$msg["uid"]."'");
$str_tmp.="{";
$str_tmp.="\"id\":\"".$msg["id"]."\",";
$str_tmp.="\"uid\":\"".$kehu_name["username"]."\",";
$str_tmp.="\"bh\":\"".$list."\",";
foreach($arr_column_keyword as $key=>$value){
if($key!="uid"){
$str_tmp.="\"".$key."\":\"".$msg[$key]."\",";
}
}
//$str_tmp.="\"action\":\"".$msg["action"]."\",";
$str_tmp.="\"ks\":\"".$msg["ks"]."\"";
$str_tmp.="},";
$count++;
}
$json_data.=substr($str_tmp,0,-1)."]}";
echo $json_data;
break;
case "save_add":
$neirong="";
$id=@$_GET["id"];
foreach($arr_column_keyword as $key=>$value){
if($key!="uid"){
$v="s_".$key."";
$neirong =$_POST[$v];
$sql_con.="".$key."='".$neirong."',";
}
}
$sql_con=substr($sql_con,0,-1);
$query="update ".$tname." set ".$sql_con." where id='".$id."'";
$db->query($query);
alert_and_back("保存成功");
break;
case "del":
$id=@$_GET["id"];
$id=(is_array($id))?$id:array($id);
$num=count($id);
for($i=0;$i<$num;$i++){
$db->query("delete from ".$tname." where id='".$id[$i]."'");
}
$json_data.="{\"code\":1}";
echo $json_data;
break;
case "edit":
$id=@$_GET["id"];
//'.$wjname.'.php?lx=save_add&id='.$id.'
$content='<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="renderer" content="webkit"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><title>导入excel-e订通后台</title><link rel="stylesheet" href="../layuiadmin/layui/css/layui.css"><link rel="stylesheet" href="index.css"><script src="../layuiadmin/layui/layui.js"></script><script src="../js/function.js"></script><style>#table1{border:0px;}</style></head><body>';
$content.='<form class="layui-form" action="'.$wjname.'.php?lx=save_add&id='.$id.'" method="post"><br><br><table class="layui-table" id="table1" style="width:90%;margin:0 auto;">';
$xinxi=get_db_msg("select * from ".$tname." where id='".$id."'");
foreach($arr_column_keyword as $key=>$value){
if($key!="uid")
$content.="<tr><td>".$value."</td><td><input type='text' class='layui-input' value='".$xinxi[$key]."' name='s_".$key."'></td></tr>";
else{
$check=get_db_msg("select username from web_client where id='".$xinxi[$key]."'");
$content.="<tr style='background:#ccc;'><td>".$value."</td><td>".$check["username"]."</tr>";
}
}
$content.='</table><div style="padding-left:300px;"><button id="form1_submit" class="layui-btn layui-btn-normal btn1" lay-submit lay-filter="form1_submit">保存</button></form></div></body></html>';
$js="<script>
var this1=".$json1.";
layui.use(['form','layer','laydate','table','laytpl','element',],function(){
var form = layui.form,
layer = parent.layer === undefined ? layui.layer : top.layer,
$=layui.jquery,
laydate = layui.laydate,
laytpl = layui.laytpl,
table = layui.table;
form.on('submit(form1_submit)',function(data){
});
});
</script>";
echo $js;
echo $content;
break;
default:
//-------------------------------取得数据
$content='<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="renderer" content="webkit"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><title>导入excel-e订通后台</title><link rel="stylesheet" href="../layuiadmin/layui/css/layui.css"><link rel="stylesheet" href="index.css"><script src="../layuiadmin/layui/layui.js"></script><script src="../js/function.js"></script><style>#table1{border:0px;}</style></head><body>';
$content.='<form class="layui-form" method="post" enctype="multipart/form-data"><input type="hidden" name="is_submit" value="y"><div style="padding:20px;background:#ccc;" >导入历史数据</div><table class="layui-table" id="table1" style="width:100%;"><tr><td width="300px">导入模板:</td><td><a href="'.$wjname.'_mb.xls"><img src="../images/excel.png" width="30" height="33"></a><a href="'.$wjname.'_mb.xls">debug/'.$wjname.'_mb.xls</a></td></tr><tr><td>请选择excel数据文档:</td><td><input type=file name="file1" style="width:250px"> <input type="checkbox" name="is_qk" id="is_qk" value="y" lay-skin="primary" checked><label for="is_qk">清空导入<input type="submit" value="提交" class="layui-btn layui-btn-sm layui-btn-normal"></label>'.$content_sj.'</td></tr></table><a class="layui-btn layui-btn-danger btn_del">删除</a><table id="table2" lay-filter="layui_table"></table></form><script type="text/html" id="action_mx"><a lay-event="edit" style="color:blue;">修改</a></script><p id="aa"></p></body></html>';
echo $content;
$js="<script>
var this1=".$json1.";
layui.use(['form','layer','laydate','table','laytpl','element',],function(){
var form = layui.form,
layer = parent.layer === undefined ? layui.layer : top.layer,
$=layui.jquery,
laydate = layui.laydate,
laytpl = layui.laytpl,
table = layui.table;
//数据表格
var url='".$wjname.".php?lx=1';
var tableIns = table.render({
even:false,
elem: '#table2',
url : url,
cellMinWidth : 80,
page : true,
height : 'full-100',
limit : 10,
limits : [10,20,30,50,100],
id : 'ListTable',
cols :this1,
done: function(res, curr, count){
}
});
function add(id){
var t1=(id>0)?'':'';
var index = layui.layer.open({
title : t1+'修改历史数据',
type : 2,
area: ['700px', '500px'],
content : '".$wjname.".php?lx=edit&id='+id,
success : function(layero, index){
}
,cancel: function(index, layero){
window.parent.location.reload();
}
})
}
//批量删除
$('.btn_del').click(function(){
var checkStatus = table.checkStatus('ListTable'),
data = checkStatus.data,
check_id = [];
if(data.length > 0) {
for (var i in data) {
check_id.push(data[i].id);
}
layer.confirm('确定删除吗?', {icon: 3, title: '提示信息'}, function (index) {
$.get('".$wjname.".php?lx=del',{id:check_id},function(data){
tableIns.reload();
layer.close(index);
})
})
}else{
layer.msg('请选择需要删除的记录');
}
})
//列表操作
table.on('tool(layui_table)', function(obj){
var layEvent = obj.event,
data = obj.data;
if(layEvent === 'edit'){
//编辑
add(data.id);
}
});
});
</script>";
echo $js;
break;
}
?>
Binary file not shown.
+279
View File
@@ -0,0 +1,279 @@
<?php
//if(THIS_IN!="edt_ipad")
//exit("错误的访问!");
error_reporting(E_ERROR | E_WARNING | E_PARSE);
require "../config.php";
include "../../tmpl/config.php";
require "../../ipad/include/function.php";
require "../../ipad/include/db_mysql.php";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$iid=$_GET["iid"];
$dpid=$_GET["dpid"];
$obj=$_GET["obj"];
$_a=$_GET["_a"];
$m_kh=get_db_msg("select no,pm_dj,size,size_group from ".$table_pre."kh where id='".$iid."'");
$m_client=get_db_msg("select path,username from ".$table_pre."client where id='".$dpid."'");
switch($_a){
case "add":
if($id){
$msg=get_db_msg("select * from ".$table_pre."size_pm where id='".$id."'");
$title=$msg["title"];
$gz=$msg["gz"];
$arr_gz=explode(":",$gz);
$hj=$msg["num"];
}else{
$title="";
$arr_gz=array();
$hj=0;
}
//取得尺码
$str_size="";
$arr_size=explode(",",$m_kh["size"]);
//计算尺码框宽度
$size_w=floor(200/count($arr_size));
$size_w=$size_w>30?30:$size_w;
$arr_size_title=array();
$tr_size_title=$tr_size_input="";
for($j=0;$j<count($arr_size);$j++){
$m1=get_db_msg("select title from ".$table_pre."size where iid='".$m_kh["size_group"]."' and no='".$arr_size[$j]."'");
$arr_size_title[$j]=$m1["title"];
$tr_size_title.="<td width='".$size_w."'>".$m1["title"]."</td>";
$tr_size_input.="<td><input type='number' id='gz_".$arr_size[$j]."' name='gz_".$arr_size[$j]."' value='".$arr_gz[$j]."' style='width:".$size_w."px;font-size:9pt;' onchange=\"this.value=Math.abs(this.value.replace(/\D/g,'0'));count_hj();\"></td>";
$str_size.=$m1["title"].":";
}
if($str_size)
$str_size=substr($str_size,0,-1);
//取得装箱数
$arr_zxs=array();
$q1="select num from ".$table_pre."gz where cate='zxs' and (dj='".$m_client["username"]."' or dj='') and kh='".$m_kh["no"]."' order by num";
$r1=$db->query($q1);
while($m1=$db->fetch_array($r1)){
$arr_zxs[]=$m1["num"];
}
if($arr_zxs){
$str_zxs=arr_to_str($arr_zxs);
$zxs=$arr_zxs[0];
}else{
$str_zxs="";
$zxs=0;
}
$content="<script>
function count_hj(){
//计算合计
var str_size=\"".$m_kh["size"]."\";
var arr_size=str_size.split(',');
var hj=0;
for(var i=0;i<arr_size.length;i++){
var obj1=document.getElementById('gz_'+arr_size[i]);
if(obj1){
if(obj1.value){
hj+=parseInt(obj1.value);
}
}
}
document.getElementById('hj').innerHTML=hj;
//自动填充最后一格
var zxs=".$zxs.";
if(zxs>0){
var last_null_id='';
var null_num=0;
var hj1=0;
for(var i=0;i<arr_size.length;i++){
var obj1=document.getElementById('gz_'+arr_size[i]);
if(obj1){
if(obj1.value){
hj1+=parseInt(obj1.value);
}else{
last_id='gz_'+arr_size[i];
null_num++;
}
}
}
if(null_num==1){
if(zxs-hj1>0){
document.getElementById(last_id).value=zxs-hj1;
document.getElementById('hj').innerHTML=zxs;
}
}
}
}
function add_pm(){
var obj=document.getElementById('form_pm');
if(obj.title.value==''){
alert('请输入名称!');
return false;
}
obj.sub1.value='保存中...';
obj.sub1.disabled=true;
return true;
}
</script>";
//$url=$_SERVER["PHP_SELF"]."?_a=save_add";
$content.="<form name='form_pm' id='form_pm' action='".$_SERVER["PHP_SELF"]."?_a=save_add' method='post' onsubmit='return add_pm();' target='frame_pm'><input type='hidden' name='_m' value='".$_m."'><input type='hidden' name='dpid' value='".$dpid."'><input type='hidden' name='iid' value='".$iid."'><input type='hidden' name='obj' value='".$obj."'><input type='hidden' name='id' value='".$id."'><input type='hidden' name='_a' value='save_add'><table border=\"0\" cellspacing=\"1\" cellpadding=\"1\" align=\"left\" bgcolor='#cccccc'>";
$content.="<tr bgcolor='#f0f0f0'><td width='50'>名称</td>".$tr_size_title."<td align='center' width='25'>".$str_zxs."</td></tr>";
$content.="<tr bgcolor='#ffffff'><td><input type='text' id='title' name='title' value='".$title."' style='width:50px;'></td>".$tr_size_input."<td align='center'><div id='hj'>".$hj."</div></td></tr>";
$content.="<tr bgcolor='#ffffff'><td colspan='".(2+count($arr_size))."'><input type='submit' name='sub1' id='sub1' value='保存'> <input type='button' name='back' id='back' value='返回' onclick='history.back();'></td></tr>";
$content.="</table></form>";
break;
case "save_add":
$title=$_POST["title"];
$dpid=$_POST["dpid"];
$iid=$_POST["iid"];
$obj=$_POST["obj"];
$id=$_POST["id"];
$m_kh=get_db_msg("select no,pm_dj,size,size_group from ".$table_pre."kh where id='".$iid."'");
$m_client=get_db_msg("select path,username from ".$table_pre."client where id='".$dpid."'");
$arr_size=explode(",",$m_kh["size"]);
for($j=0;$j<count($arr_size);$j++){
$v="gz_".$arr_size[$j];
$$v=$_POST[$v];
}
$title=trim($title);
if(strstr($title,"|"))
alert_and_back("非法字串“|”,请检查!");
//
$num=0;
//检查是否符合尺码数量
$gz="";
for($i=0;$i<count($arr_size);$i++){
$var="gz_".$arr_size[$i];
$arr_gz[$i]=$$var;
$num+=$$var;
if($$var){
$gz.=$$var.":";
}else{
$gz.="0:";
}
}
if($gz)
$gz=substr($gz,0,-1);
if(count($arr_size)!=count($arr_gz))
alert_and_back("对不起,配码数与尺码数不符,请检查!");
//检查是否符合装箱数
$arr_zxs=array();
$q1="select num from ".$table_pre."gz where cate='zxs' and (dj='".$m_client["username"]."' or dj='') and kh='".$m_kh["no"]."' order by num";
$r1=$db->query($q1);
while($m1=$db->fetch_array($r1)){
$arr_zxs[]=$m1["num"];
}
if($arr_zxs){
if(!in_array($num,$arr_zxs))
alert_and_back("对不起,配码不符合装箱数,请检查!");
}
//
//检查是否存在
$check=get_db_msg("select id from ".$table_pre."size_pm where uid='".$dpid."' and pm_dj='".$m_kh["pm_dj"]."' and gz='".$gz."' and id<>'".$id."'");
if($check["id"]>0){
$rurl="pm.php?dpid=".$dpid."&iid=".$iid."&obj=".$obj;
//取得配码行数
$tmp1=get_db_msg("select count(*) 'num' from ".$table_pre."size_pm where uid='".$dpid."' and pm_dj='".$m_kh["pm_dj"]."'");
$pm_rows=deel_num($tmp1["num"]);
echo "<html><head><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\"></head><body><script> alert('保存失败!(该配码已经存在)');window.parent.set_pm_div_h(".$pm_rows.",'".$obj."');window.parent.location.href='".$rurl."'; </script></body></html>";
exit();
}
$qy_uid=get_qy_id($m_client["path"]);
//echo $gz."-".$num."<br>";
if($id>0){
//修改
$msg_old=get_db_msg("select * from ".$table_pre."size_pm where id='".$id."'");
if($msg_old["gz"]!=$gz){
//如果已经有订单用了,不允许修改
$check1=get_db_msg("select count(*) 'num' from ".$table_pre."order_pm where pmid='".$id."'");
if($check1["num"]>0)
alert_and_back("对不起,该配码已经使用,不允许修改!");
}
$q1="update ".$table_pre."size_pm set title='".$title."',gz='".$gz."',num='".$num."' where id='".$id."'";
$db->query($q1);
}else{
//新增
$q1="insert into ".$table_pre."size_pm (qyid,uid,size_group_id,pm_dj,title,gz,num) values ('".$qy_uid."','".$dpid."','".$m_kh["size_group"]."','".$m_kh["pm_dj"]."','".$title."','".$gz."','".$num."')";
$db->query($q1);
}
$rurl="pm.php?dpid=".$dpid."&iid=".$iid."&obj=".$obj;
//取得配码行数
$tmp1=get_db_msg("select count(*) 'num' from ".$table_pre."size_pm where uid='".$dpid."' and pm_dj='".$m_kh["pm_dj"]."'");
$pm_rows=deel_num($tmp1["num"]);
echo "<html><head><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\"></head><body><script> alert('保存成功');window.parent.set_pm_div_h(".$pm_rows.",'".$obj."');window.parent.location.href='".$rurl."'; </script></body></html>";
exit();
break;
case "del":
$check1=get_db_msg("select count(*) 'num' from ".$table_pre."order_pm where pmid='".$id."'");
if($check1["num"]>0)
alert_and_back("对不起,该配码已经使用,不允许删除!");
$q="delete from ".$table_pre."size_pm where id='".$id."'";
$db->query($q);
$rurl="pm.php?dpid=".$dpid."&iid=".$iid."&obj=".$obj;
//取得配码行数
$tmp1=get_db_msg("select count(*) 'num' from ".$table_pre."size_pm where uid='".$dpid."' and pm_dj='".$m_kh["pm_dj"]."'");
$pm_rows=deel_num($tmp1["num"]);
echo "<html><head><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\"></head><body><script> alert('删除成功');window.parent.set_pm_div_h(".$pm_rows.",'".$obj."');window.parent.location.href='".$rurl."'; </script></body></html>";
exit();
break;
default:
$content="<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" width=\"100%\">";
$content.="<tr><td align=\"left\" bgcolor=\"#f0f0f0\"><b>选择配码</b> <input type=\"button\" value=\"新增配码\" onclick=\"window.location.href='pm.php?dpid=".$dpid."&iid=".$iid."&obj=".$obj."&_a=add'\"></td></tr>";
//取得装箱数
$q1="select num from ".$table_pre."gz where cate='zxs' and (dj='".$m_client["username"]."' or dj='') and kh='".$m_kh["no"]."' order by num";
$r1=$db->query($q1);
$sql_pm="";
while($m1=$db->fetch_array($r1)){
$sql_pm.="num='".$m1["num"]."' or ";
}
if($sql_pm)
$sql_pm=" and (".substr($sql_pm,0,-4).")";
//读取配码信息
//配码等级一样,店铺id一样或者店铺id为空(适合所有店铺的配码)
$q="select * from ".$table_pre."size_pm where (uid='".$dpid."' or uid='') and pm_dj='".$m_kh["pm_dj"]."' ".$sql_pm." order by id";
$r=$db->query($q);
$content_pm="<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" width=\"100%\" bgcolor=\"#eeeeee\">";
$i=0;
$size_ws_kh=count(explode(",",$m_kh["size"]));
while($m=$db->fetch_array($r)){
$size_ws=count(explode(":",$m["gz"]));
//echo $size_ws."|".$size_ws_kh."-<br>";
if($size_ws==$size_ws_kh){
$is_edit=($m["uid"]==$dpid)?"":" disabled";
$content_pm.="<tr bgcolor=\"#ffffff\"><td onclick=\"check_pm('".$obj."','".$m["id"]."|".$m["title"]."|".$m["gz"]."')\"><input type='radio' name='pm_id' value='".$m["id"]."|".$m["gz"]."'>".$m["title"]."</td><td>".$m["gz"]."=".$m["num"]."</td><td width=\"110\"><input type=\"button\" value=\"修改\" style='width:50px;' onclick=\"window.location.href='pm.php?dpid=".$dpid."&iid=".$iid."&obj=".$obj."&id=".$m["id"]."&_a=add'\"".$is_edit."> <input type=\"button\" value=\"删除\" style='width:50px;' onclick=\"d_confirm('确认删除吗?','pm.php?dpid=".$dpid."&iid=".$iid."&obj=".$obj."&id=".$m["id"]."&_a=del')\"".$is_edit."></td></tr>";
$i++;
}
}
$content_pm.="</table>";
if($i==0)
$content_pm="暂无您的配码信息,请先新增。";
$content.="<tr><td align=\"left\">".$content_pm."</td></tr>";
//
$content.="</table>";
break;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta content="telephone=no" name="format-detection" />
<meta name="viewport" content="user-scalable=yes,initial-scale=1,maximum-scale=3.0,minimum-scale=1" />
<title>--</title>
<style>
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;FONT-SIZE:14px;
}
</style>
<script>
function d_confirm(msg,url){
var a=confirm(msg);
if(a==true){
window.location.href=url;
}
}
function check_pm(obj,v){
//alert(obj);
window.parent.check_pm(obj,v);
}
</script>
</head>
<body style="margin:0px;padding:0px;background-color:#ffffff;">
<?php echo $content; ?>
</body>
</html>
+116
View File
@@ -0,0 +1,116 @@
<?php
function imagecopymerge_alpha($dst_im,$src_im,$dst_x,$dst_y,$src_x,$src_y,$src_w,$src_h){
$pct=100;
$cut=imagecreatetruecolor($src_w,$src_h);
imagecopy($cut,$dst_im,0,0,$dst_x,$dst_y,$src_w,$src_h);
imagecopy($cut,$src_im,0,0,$src_x,$src_y,$src_w,$src_h);
imagecopymerge($dst_im,$cut,$dst_x,$dst_y,0,0,$src_w,$src_h,$pct);
}
//-------------------------------------------参数
//---------中间
//初始位置
$bg_middle_x=340;
$bg_middle_y=229;
//图片
$img_middle=array();
$img_middle[]='png/m1.png';
$img_middle[]='png/m2.png';
$img_middle[]='png/m3.png';
$img_middle[]='png/m4.png';
$img_middle[]='png/m5.png';
/*
$img_middle[]='png/m6.png';
$img_middle[]='png/m7.png';
$img_middle[]='png/m8.png';
$img_middle[]='png/m9.png';
*/
//---------左边
//初始中心位置
$bg_left_x=232;
$bg_left_y=75;
//上装
$img_left_s=array();
$img_left_s[]="png/l1.png";
$img_left_s[]="png/r1.png";
//下装
$img_left_x=array();
$img_left_x[]="png/l3.png";
//---------右边
//初始中心位置
$bg_right_x=751;
$bg_right_y=66;
//上装
$img_right_s=array();
$img_right_s[]="png/l1.png";
//下装
$img_right_x=array();
$img_right_x[]="png/r2.png";
//---------右边
//背景图片
$target = 'png/bg.jpg';
//-------------------------------------------开始处理
$target_img = Imagecreatefromjpeg($target);
//处理左边图片
$height_left_s=0;
if(is_array($img_left_s)){
$source= array();
foreach ($img_left_s as $k=>$v){
$source[$k]['source'] = Imagecreatefrompng($v);
$source[$k]['size'] = getimagesize($v);
}
$tmp=$bg_left_x-$source[0]['size'][0]/2;
$height_left_s=$source[0]['size'][1];
for($i=0;$i<count($img_left_s);$i++){
imagecopymerge_alpha($target_img,$source[$i]['source'],$tmp,$bg_left_y,0,0,$source[$i]['size'][0],$source[$i]['size'][1]);
}
}
if(is_array($img_left_x)){
$source= array();
foreach ($img_left_x as $k=>$v){
$source[$k]['source'] = Imagecreatefrompng($v);
$source[$k]['size'] = getimagesize($v);
}
$tmp=$bg_left_x-$source[0]['size'][0]/2;
for($i=0;$i<count($img_left_x);$i++){
imagecopymerge_alpha($target_img,$source[$i]['source'],$tmp,$bg_left_y+$height_left_s,0,0,$source[$i]['size'][0],$source[$i]['size'][1]);
}
}
//处理中间图片
$source= array();
foreach ($img_middle as $k=>$v){
$source[$k]['source'] = Imagecreatefrompng($v);
$source[$k]['size'] = getimagesize($v);
}
$tmp=$bg_middle_x;
for($i=0;$i<count($img_middle);$i++){
imagecopymerge_alpha($target_img,$source[$i]['source'],$tmp,$bg_middle_y,0,0,$source[$i]['size'][0],$source[$i]['size'][1]);
$tmp+=$source[$i]['size'][0]+1;
}
//处理右边图片
$height_right_s=0;
if(is_array($img_right_s)){
$source= array();
foreach ($img_right_s as $k=>$v){
$source[$k]['source'] = Imagecreatefrompng($v);
$source[$k]['size'] = getimagesize($v);
}
$tmp=$bg_right_x-$source[0]['size'][0]/2;
$height_right_s=$source[0]['size'][1];
for($i=0;$i<count($img_right_s);$i++){
imagecopymerge_alpha($target_img,$source[$i]['source'],$tmp,$bg_right_y,0,0,$source[$i]['size'][0],$source[$i]['size'][1]);
}
}
if(is_array($img_right_x)){
$source= array();
foreach ($img_right_x as $k=>$v){
$source[$k]['source'] = Imagecreatefrompng($v);
$source[$k]['size'] = getimagesize($v);
}
$tmp=$bg_right_x-$source[0]['size'][0]/2;
for($i=0;$i<count($img_right_x);$i++){
imagecopymerge_alpha($target_img,$source[$i]['source'],$tmp,$bg_right_y+$height_right_s,0,0,$source[$i]['size'][0],$source[$i]['size'][1]);
}
}
Imagejpeg($target_img,'pin.jpg');
?>
<img src="pin.jpg">
+38
View File
@@ -0,0 +1,38 @@
<?php
//-------------------------------------------------------重命名单款图片的名字
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//使用方法:程序和old,new目录放到可执行php的地方,old文件夹放需要命名的图片,命名好的图片会生成在new文件夹
$olddir="old";
$newdir="new";
$d=dir($olddir);
$i=1;
while($a=$d->read()){
if(is_file($olddir.'/'.$a) && ($a!='.') && ($a!='..')){
$f=$a;
//后缀名自动重命名
$img_info=getimagesize($olddir."/".$f);
$arr1=explode(".",$f);
if($img_info["mime"]=="image/png"){
$f1=$arr1[0].".png";
}else if($img_info["mime"]=="image/gif"){
$f1=$arr1[0].".gif";
}else{
$f1=$f;
}
echo $i.":".$f."|".$img_info["mime"]."|".$f1."<br>";
//*/
/*
//自动处理中斜杠
if(strpos($f,"-")){
$f1=str_replace("-","_",$f);
}else{
$f1=$a;
}
echo $f."|".$f1."<br>";
*/
copy($olddir."/".$f,$newdir."/".$f1);
$i++;
}
}
$d->close();
?>
+136
View File
@@ -0,0 +1,136 @@
<?php
//-------------------------------------------------------设置扫描入场
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//-------------------------------register global
$magic_quotes_gpc = get_magic_quotes_gpc();
$register_globals = @ini_get('register_globals');
if(!$register_globals || !$magic_quotes_gpc) {
@extract(daddslashes($_POST));
@extract(daddslashes($_GET));
}
//-------------------------------mysql connect
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$is_submit=$_POST["is_submit"];
$col_name=$_POST["col_name"];
$q="select count(*) 'num' from ".$table_pre."plugin_session_ewm";
$m=get_db_msg($q);
$msg="目前现场有".$m["num"]."";
if($is_submit=="y"){
$q="truncate table ".$table_pre."plugin_session_ewm;";
$db->query($q);
$msg="设置成功!";
}
//if($_a=="volume_allow"){
// $arr_ip1=explode(".",$ip1);
// $arr_ip2=explode(".",$ip2);
// $ip_end_str1=end($arr_ip1);
// $ip_end_str2=end($arr_ip2);
// $ip_con=$arr_ip1[0].".".$arr_ip1[1].".".$arr_ip1[2];
// $n=0;
// for($i=$ip_end_str1;$i<=$ip_end_str2;$i++){
// $ip=$ip_con.".".$i;
// $add_date=date("Y-m-d H:i:s");
// $q="insert into ".$table_pre."plugin_session_ewm (flag,ip,add_date) values ('','".$ip."','".$add_date."');";
// $db->query($q);
// $n++;
// }
// $msg="已允许".$n."个ip";
//}
if($_a=="volume_allow"){
$n=0;
for($i=1;$i<=255;$i++){
$ip=$ip1.".".$i;
$check=get_db_msg("select id from ".$table_pre."plugin_session_ewm where ip='".$ip."'");
if(!$check["id"]){
$add_date=date("Y-m-d H:i:s");
$q="insert into ".$table_pre."plugin_session_ewm (flag,ip,add_date) values ('','".$ip."','".$add_date."');";
$db->query($q);
$n++;
}
}
$msg="已允许".$ip1."网段的".$n."个ip";
}
if($_a=="volume_del"){
$n=0;
for($i=1;$i<=255;$i++){
$ip=$ip1.".".$i;
$check=get_db_msg("select id from ".$table_pre."plugin_session_ewm where ip='".$ip."'");
if($check["id"]){
$q="delete from ".$table_pre."plugin_session_ewm where ip='".$ip."';";
$db->query($q);
$n++;
}
}
$msg="已删除".$ip1."网段的".$n."个ip";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>设置扫描入场</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
<script>
function ok(){
var a=confirm("确认执行吗?");
if(a==true){
document.form1.submit();
}
}
function deel_allow(){
var ip1=document.getElementById("ip1").value;
var url="set_sm.php?_a=volume_allow&ip1="+ip1;
window.location.href=url;
}
function deel_del(){
var ip1=document.getElementById("ip1").value;
var url="set_sm.php?_a=volume_del&ip1="+ip1;
window.location.href=url;
}
</script>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="form1" action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<input type="hidden" name="is_submit" value="y">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>设置扫描入场</b></td>
</tr>
<tr>
<td align="center" bgcolor="#f0f0f0"><input type="button" value="刷新" onclick="window.location.href='<?php echo $_SERVER["PHP_SELF"]; ?>';"> <input type="button" value="一键设置所有客户出门" onclick="ok();"><input type="text" id="ip1" value="192.168.1"><input type="button" value="批量允许该网段" onclick="deel_allow();"><input type="button" value="批量删除该网段" onclick="var a=confirm('确认批量删除该网段吗?');
if(a==true){deel_del();}"></td>
</tr>
<?php
if($msg){
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
}
?>
</form>
</table>
</body>
</html>
Binary file not shown.
File diff suppressed because one or more lines are too long
+58
View File
@@ -0,0 +1,58 @@
<?php
//-------------------------------------------------------列出本目录文件
require "../../config.php";
include "../../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//-------------------------------
$pathdir="./";
$d=dir($pathdir);
$i=1;
$file_list="";
while($a=$d->read()){
if(is_file($pathdir.'/'.$a) && ($a!='.') && ($a!='..') && ($a!='index.php')){
$a=iconv("gb2312","utf-8",$a);
$file_list.="<a href='./".urlencode($a)."'>".$a."</a><br>";
}
}
$d->close();
$msg=$file_list;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>xls</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>xls目录文件列表</b></td>
</tr>
<?php
if($msg){
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
}
?>
</table>
</body>
</html>
File diff suppressed because one or more lines are too long
+106
View File
@@ -0,0 +1,106 @@
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 11">
<style>
<!--table
{mso-displayed-decimal-separator:"\.";
mso-displayed-thousand-separator:"\,";}
@page
{margin:1.0in .75in 1.0in .75in;
mso-header-margin:.5in;
mso-footer-margin:.5in;}
tr
{mso-height-source:auto;
mso-ruby-visibility:none;}
col
{mso-width-source:auto;
mso-ruby-visibility:none;}
br
{mso-data-placement:same-cell;}
.style0
{mso-number-format:General;
text-align:general;
vertical-align:middle;
white-space:nowrap;
mso-rotate:0;
mso-background-source:auto;
mso-pattern:auto;
color:windowtext;
font-size:12.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
border:none;
mso-protection:locked visible;
mso-style-name:常规;
mso-style-id:0;}
td
{mso-style-parent:style0;
padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:windowtext;
font-size:12.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-number-format:General;
text-align:general;
vertical-align:middle;
border:none;
mso-background-source:auto;
mso-pattern:auto;
mso-protection:locked visible;
white-space:nowrap;
mso-rotate:0;}
ruby
{ruby-align:left;}
rt
{color:windowtext;
font-size:9.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-char-type:none;
display:none;}
-->
</style>
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:WorksheetOptions>
<x:DefaultRowHeight>285</x:DefaultRowHeight>
<x:Selected/>
<x:ProtectContents>False</x:ProtectContents>
<x:ProtectObjects>False</x:ProtectObjects>
<x:ProtectScenarios>False</x:ProtectScenarios>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
<x:WindowHeight>8640</x:WindowHeight>
<x:WindowWidth>17955</x:WindowWidth>
<x:WindowTopX>720</x:WindowTopX>
<x:WindowTopY>315</x:WindowTopY>
<x:ProtectStructure>False</x:ProtectStructure>
<x:ProtectWindows>False</x:ProtectWindows>
</x:ExcelWorkbook>
</xml><![endif]-->
</head>
<body link=blue vlink=purple><table x:str border=0 cellpadding=0 cellspacing=0 style='border-collapse:
collapse;table-layout:fixed;'><tr><td rowspan="3">区域</td><td rowspan="3">代理</td><td rowspan="3">客户名称</td><td rowspan="3">客户代码</td><td rowspan="3">圆牌号</td><td rowspan="3">款号</td><td rowspan="3">款式名</td><td rowspan="3">品牌</td><td rowspan="3">季节</td><td rowspan="3">性别</td><td rowspan="3">大类</td><td rowspan="3">零售价</td><td rowspan="3">吊牌价</td><td rowspan="3">颜色名称</td><td rowspan="3">颜色代码</td><td width="5%">S</td><td width="5%">M</td><td width="5%">L</td><td width="5%">XL</td><td width="5%">2XL</td><td width="5%">3XL</td><td width="5%">4XL</td><td width="5%">5XL</td><td width="5%">6XL</td><td rowspan="3" align="center" bgcolor="#f0f0f0">箱数</td><td rowspan="3" align="center" bgcolor="#f0f0f0">双数</td></tr><tr><td width="5%">35</td><td width="5%">36</td><td width="5%">37</td><td width="5%">38</td><td width="5%">39</td><td width="5%">40</td><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td></tr><tr><td width="5%">均</td><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td></tr></table></body></html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,106 @@
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 11">
<style>
<!--table
{mso-displayed-decimal-separator:"\.";
mso-displayed-thousand-separator:"\,";}
@page
{margin:1.0in .75in 1.0in .75in;
mso-header-margin:.5in;
mso-footer-margin:.5in;}
tr
{mso-height-source:auto;
mso-ruby-visibility:none;}
col
{mso-width-source:auto;
mso-ruby-visibility:none;}
br
{mso-data-placement:same-cell;}
.style0
{mso-number-format:General;
text-align:general;
vertical-align:middle;
white-space:nowrap;
mso-rotate:0;
mso-background-source:auto;
mso-pattern:auto;
color:windowtext;
font-size:12.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
border:none;
mso-protection:locked visible;
mso-style-name:常规;
mso-style-id:0;}
td
{mso-style-parent:style0;
padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:windowtext;
font-size:12.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-number-format:General;
text-align:general;
vertical-align:middle;
border:none;
mso-background-source:auto;
mso-pattern:auto;
mso-protection:locked visible;
white-space:nowrap;
mso-rotate:0;}
ruby
{ruby-align:left;}
rt
{color:windowtext;
font-size:9.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-char-type:none;
display:none;}
-->
</style>
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:WorksheetOptions>
<x:DefaultRowHeight>285</x:DefaultRowHeight>
<x:Selected/>
<x:ProtectContents>False</x:ProtectContents>
<x:ProtectObjects>False</x:ProtectObjects>
<x:ProtectScenarios>False</x:ProtectScenarios>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
<x:WindowHeight>8640</x:WindowHeight>
<x:WindowWidth>17955</x:WindowWidth>
<x:WindowTopX>720</x:WindowTopX>
<x:WindowTopY>315</x:WindowTopY>
<x:ProtectStructure>False</x:ProtectStructure>
<x:ProtectWindows>False</x:ProtectWindows>
</x:ExcelWorkbook>
</xml><![endif]-->
</head>
<body link=blue vlink=purple><table x:str border=0 cellpadding=0 cellspacing=0 style='border-collapse:
collapse;table-layout:fixed;'><tr><td rowspan="3">序号</td><td rowspan="3">款号</td><td rowspan="3">款式名</td><td rowspan="3">品牌</td><td rowspan="3">季节</td><td rowspan="3">性别</td><td rowspan="3">大类</td><td rowspan="3">零售价</td><td rowspan="3">吊牌价</td><td rowspan="3">颜色名称</td><td rowspan="3">颜色代码</td><td rowspan="3" bgcolor="#f0f0f0" align="center">规格</td><td width="5%">S</td><td width="5%">M</td><td width="5%">L</td><td width="5%">XL</td><td width="5%">2XL</td><td width="5%">3XL</td><td width="5%">4XL</td><td width="5%">5XL</td><td width="5%">6XL</td><td rowspan="3">小计</td><td rowspan="3">吊牌金额</td><td rowspan="3">结算金额</td></tr><tr><td width="5%">35</td><td width="5%">36</td><td width="5%">37</td><td width="5%">38</td><td width="5%">39</td><td width="5%">40</td><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td></tr><tr><td width="5%">均</td><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td></tr><tr><td rowspan="1">1108</td><td rowspan="1">1108</td><td rowspan="1">短袖T恤</td><td rowspan="1">万富太太</td><td rowspan="1">&nbsp;</td><td rowspan="1">&nbsp;</td><td rowspan="1">短袖T恤</td><td rowspan="1">&nbsp;</td><td rowspan="1">98</td><td>红色1</td><td>11081</td><td>&nbsp;</td><td x:num>&nbsp;</td><td x:num>&nbsp;</td><td x:num>&nbsp;</td><td x:num>1</td><td x:num>1</td><td x:num>1</td><td x:num>1</td><td x:num>1</td><td x:num>1</td><td rowspan="1" x:num>6</td><td rowspan="1" x:num>588</td><td rowspan="1" x:num>588</td></tr><tr><td colspan="12">合计</td><td x:num>&nbsp;</td><td x:num>&nbsp;</td><td x:num>&nbsp;</td><td x:num>1</td><td x:num>1</td><td x:num>1</td><td x:num>1</td><td x:num>1</td><td x:num>1</td><td x:num>6</td><td x:num>588</td><td x:num>588.00</td></tr></table></body></html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+112
View File
@@ -0,0 +1,112 @@
<?php
//-------------------------------------------------------xls2维转置
require "../config.php";
include "../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//-------------------------------mysql connect
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$is_submit=$_POST["is_submit"];
if($is_submit=="y"){
$content=$_POST["content"];
$arr=explode("\n",$content);
$arr_xm=array();
$arr_km=array();
for($i=0;$i<count($arr);$i++){
$str1=trim($arr[$i]);
$arr1=explode(" ",$str1);
$xm=trim($arr1[0]);
$km=trim($arr1[1]);
$ys=trim($arr1[2]);
$zc=trim($arr1[3]);
if(!in_array($km,$arr_km)){
$arr_km[]=$km;
}
$arr_xm[$xm][]=array($km,$ys,$zc);
}
//print_r($arr_km);
//echo "<br>";
//print_r($arr_xm);
//表头
$res="项目名称 项目预算 项目支出 项目余额 ";
for($j=0;$j<count($arr_km);$j++){
$res.=$arr_km[$j]." ";
}
$res.="\n";
//内容
foreach($arr_xm as $xmmc => $arr_xmnr){
if($xmmc){
$xj_ys=$xj_zc=0;//计算预算和支出
$content1="";
for($j=0;$j<count($arr_km);$j++){
$is_find="n";
$tmp_zc=0;
for($k=0;$k<count($arr_xmnr);$k++){
if($arr_xmnr[$k][0]==$arr_km[$j]){
$tmp_zc+=$arr_xmnr[$k][2];
$xj_ys+=$arr_xmnr[$k][1];
$xj_zc+=$arr_xmnr[$k][2];
$is_find="y";
}
}
if($is_find=="n")
$content1.=" ";
else
$content1.=$tmp_zc." ";
}
$res.=$xmmc." ".$xj_ys." ".$xj_zc." ".($xj_ys-$xj_zc)." ".$content1."\n";
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>xls2维转置</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="form1" action="" method="post">
<input type="hidden" name="is_submit" value="y">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>xls2维转置</b></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">格式说明:从excel复制这4列内容(项目,科目,预算,支出),不含表头。<Br>
<textarea name="content" style="width:100%;" rows="20"><?php echo $content; ?></textarea></td>
</tr>
<tr>
<td align="center" bgcolor="#f0f0f0"><input type="submit" value=" 计 算 "></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">结果<Br>
<textarea name="res" style="width:100%;" rows="20"><?php echo $res; ?></textarea></td>
</tr>
</form>
</table>
</body>
</html>
+157
View File
@@ -0,0 +1,157 @@
<?php
//-------------------------------------------------------智订宝,历史畅销款
require "../../config.php";
include "../../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//-------------------------------mysql connect
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$is_submit=$_POST["is_submit"];
if($is_submit=="y"){
//初始化
$table="web_zdb_ls";
$dd=$_POST["dd"];
if($dd==1){
$db->query("truncate table ".$table.";");
//
$content=$_POST["content"];
$arr=explode("\n",$content);
$num=0;
for($i=0;$i<count($arr);$i++){
$arr1=explode(" ",$arr[$i]);
//
$kh=trim($arr1[0]);
$pl=trim($arr1[1]);
$price=trim($arr1[2]);
$ph=trim($arr1[3]);
$xsje_zb=trim($arr1[4]);
$xsje=trim($arr1[5]);
$ljxsje_zb=trim($arr1[6]);
$zfs=trim($arr1[7]);
$dzl=trim($arr1[8]);
$ml=trim($arr1[9]);
$m2=trim($arr1[10]);
$m3=trim($arr1[11]);
$m4=trim($arr1[12]);
$m5=trim($arr1[13]);
$m6=trim($arr1[14]);
$m=trim($arr1[15]);
$m8=trim($arr1[16]);
$m9=trim($arr1[17]);
$m10=trim($arr1[18]);
$m11=trim($arr1[19]);
$m12=trim($arr1[20]);
if(!empty($kh)){
$sql_value.="('".$kh."','".$pl."','".$price."','".$ph."','".$xsje_zb."','".$xsje."','".$ljxsje_zb."','".$zfs."','".$dzl."','".$m1."','".$m2."','".$m3."','".$m4."','".$m5."','".$m6."','".$m7."','".$m8."','".$m9."','".$m10."','".$m11."','".$m12."'),";
$num++;
}
}
if($num>0){
$sql_value=substr($sql_value,0,-1);
$q1="insert into ".$table." (kh,pl,price,ph,xsje_zb,xsje,ljxsje_zb,zfs,dzl,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12) values ".$sql_value;
//echo $q1."<br>";
$db->query($q1);
$msg.="<span class=\"right\">导入成功!</span><br>";
}
}else{
$content=$_POST["content"];
$arr=explode("\n",$content);
$num=0;
for($i=0;$i<count($arr);$i++){
$arr1=explode(" ",$arr[$i]);
//
$kh=trim($arr1[0]);
$pl=trim($arr1[1]);
$price=trim($arr1[2]);
$ph=trim($arr1[3]);
$xsje_zb=trim($arr1[4]);
$xsje=trim($arr1[5]);
$ljxsje_zb=trim($arr1[6]);
$zfs=trim($arr1[7]);
$dzl=trim($arr1[8]);
$ml=trim($arr1[9]);
$m2=trim($arr1[10]);
$m3=trim($arr1[11]);
$m4=trim($arr1[12]);
$m5=trim($arr1[13]);
$m6=trim($arr1[14]);
$m=trim($arr1[15]);
$m8=trim($arr1[16]);
$m9=trim($arr1[17]);
$m10=trim($arr1[18]);
$m11=trim($arr1[19]);
$m12=trim($arr1[20]);
if(!empty($kh)){
$check=get_db_msg("select id from web_zdb_ls where kh='".$kh."' limit 0,1");
if($check["id"]){
$q1="update ".$table." set pl='".$pl."',price='".$price."',ph='".$ph."',xsje_zb='".$xsje_zb."',xsje='".$xsje."',ljxsje_zb='".$ljxsje_zb."',dzl='".$dzl."',zfs='".$zfs."',m1='".$m1."',m2='".$m2."',m3='".$m3."',m4='".$m4."',m5='".$m5."',m6='".$m6."',m7='".$m7."',m8='".$m8."',m9='".$m9."',m10='".$m10."',m11='".$m11."',m12='".$m12."' where id='".$check["id"]."'";
$db->query($q1);
}else{
$q1="insert into ".$table." (kh,pl,price,ph,xsje_zb,xsje,ljxsje_zb,zfs,dzl,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12) values('".$kh."','".$pl."','".$price."','".$ph."','".$xsje_zb."','".$xsje."','".$ljxsje_zb."','".$zfs."','".$dzl."','".$m1."','".$m2."','".$m3."','".$m4."','".$m5."','".$m6."','".$m7."','".$m8."','".$m9."','".$m10."','".$m11."','".$m12."')";
$db->query($q1);
}
}
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>智订宝,历史畅销款导入</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="form1" action="" method="post">
<input type="hidden" name="is_submit" value="y">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>智订宝,历史畅销款导入</b></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">
<label><input type="radio" name="dd" value="1" checked>清空导入</label>
<label><input type="radio" name="dd" value="2">新增导入</label>
</td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">格式说明:款号,品类,价格,排名,销售占比,销售额,累计销售占比,Z分数,打折率,1月销售量,2月销售量,3月销售量,4月销售量,5月销售量,6月销售量,7月销售量,8月销售量,9月销售量,10月销售量,11月销售量,12月销售量;用制表符分隔;多条记录请回车。<Br>
<textarea name="content" style="width:100%;" rows="20"><?php echo $content; ?></textarea></td>
</tr>
<tr>
<td align="center" bgcolor="#f0f0f0"><input type="submit" value=" 提 交 "></td>
</tr>
<?php
if($msg){
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
}
?>
</form>
</table>
</body>
</html>
+157
View File
@@ -0,0 +1,157 @@
<?php
//-------------------------------------------------------智订宝,历史畅销款
require "../../config.php";
include "../../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//-------------------------------mysql connect
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$is_submit=$_POST["is_submit"];
if($is_submit=="y"){
//初始化
$table="web_zdb_ls_je";
$dd=$_POST["dd"];
if($dd==1){
$db->query("truncate table ".$table.";");
//
$content=$_POST["content"];
$arr=explode("\n",$content);
$num=0;
for($i=0;$i<count($arr);$i++){
$arr1=explode(" ",$arr[$i]);
//
$kh=trim($arr1[0]);
$pl=trim($arr1[1]);
$price=trim($arr1[2]);
$ph=trim($arr1[3]);
$xsje_zb=trim($arr1[4]);
$xsje=trim($arr1[5]);
$ljxsje_zb=trim($arr1[6]);
$zfs=trim($arr1[7]);
$dzl=trim($arr1[8]);
$ml=trim($arr1[9]);
$m2=trim($arr1[10]);
$m3=trim($arr1[11]);
$m4=trim($arr1[12]);
$m5=trim($arr1[13]);
$m6=trim($arr1[14]);
$m=trim($arr1[15]);
$m8=trim($arr1[16]);
$m9=trim($arr1[17]);
$m10=trim($arr1[18]);
$m11=trim($arr1[19]);
$m12=trim($arr1[20]);
if(!empty($kh)){
$sql_value.="('".$kh."','".$pl."','".$price."','".$ph."','".$xsje_zb."','".$xsje."','".$ljxsje_zb."','".$zfs."','".$dzl."','".$m1."','".$m2."','".$m3."','".$m4."','".$m5."','".$m6."','".$m7."','".$m8."','".$m9."','".$m10."','".$m11."','".$m12."'),";
$num++;
}
}
if($num>0){
$sql_value=substr($sql_value,0,-1);
$q1="insert into ".$table." (kh,pl,price,ph,xsje_zb,xsje,ljxsje_zb,zfs,dzl,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12) values ".$sql_value;
//echo $q1."<br>";
$db->query($q1);
$msg.="<span class=\"right\">导入成功!</span><br>";
}
}else{
$content=$_POST["content"];
$arr=explode("\n",$content);
$num=0;
for($i=0;$i<count($arr);$i++){
$arr1=explode(" ",$arr[$i]);
//
$kh=trim($arr1[0]);
$pl=trim($arr1[1]);
$price=trim($arr1[2]);
$ph=trim($arr1[3]);
$xsje_zb=trim($arr1[4]);
$xsje=trim($arr1[5]);
$ljxsje_zb=trim($arr1[6]);
$zfs=trim($arr1[7]);
$dzl=trim($arr1[8]);
$ml=trim($arr1[9]);
$m2=trim($arr1[10]);
$m3=trim($arr1[11]);
$m4=trim($arr1[12]);
$m5=trim($arr1[13]);
$m6=trim($arr1[14]);
$m=trim($arr1[15]);
$m8=trim($arr1[16]);
$m9=trim($arr1[17]);
$m10=trim($arr1[18]);
$m11=trim($arr1[19]);
$m12=trim($arr1[20]);
if(!empty($kh)){
$check=get_db_msg("select id from web_zdb_ls where kh='".$kh."' limit 0,1");
if($check["id"]){
$q1="update ".$table." set pl='".$pl."',price='".$price."',ph='".$ph."',xsje_zb='".$xsje_zb."',xsje='".$xsje."',ljxsje_zb='".$ljxsje_zb."',dzl='".$dzl."',zfs='".$zfs."',m1='".$m1."',m2='".$m2."',m3='".$m3."',m4='".$m4."',m5='".$m5."',m6='".$m6."',m7='".$m7."',m8='".$m8."',m9='".$m9."',m10='".$m10."',m11='".$m11."',m12='".$m12."' where id='".$check["id"]."'";
$db->query($q1);
}else{
$q1="insert into ".$table." (kh,pl,price,ph,xsje_zb,xsje,ljxsje_zb,zfs,dzl,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12) values('".$kh."','".$pl."','".$price."','".$ph."','".$xsje_zb."','".$xsje."','".$ljxsje_zb."','".$zfs."','".$dzl."','".$m1."','".$m2."','".$m3."','".$m4."','".$m5."','".$m6."','".$m7."','".$m8."','".$m9."','".$m10."','".$m11."','".$m12."')";
$db->query($q1);
}
}
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>智订宝,历史畅销款导入</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="form1" action="" method="post">
<input type="hidden" name="is_submit" value="y">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>智订宝,历史畅销款导入</b></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">
<label><input type="radio" name="dd" value="1" checked>清空导入</label>
<label><input type="radio" name="dd" value="2">新增导入</label>
</td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">格式说明:款号,品类,价格,排名,销售占比,销售额,累计销售占比,Z分数,打折率,1月销售量,2月销售量,3月销售量,4月销售量,5月销售量,6月销售量,7月销售量,8月销售量,9月销售量,10月销售量,11月销售量,12月销售量;用制表符分隔;多条记录请回车。<Br>
<textarea name="content" style="width:100%;" rows="20"><?php echo $content; ?></textarea></td>
</tr>
<tr>
<td align="center" bgcolor="#f0f0f0"><input type="submit" value=" 提 交 "></td>
</tr>
<?php
if($msg){
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
}
?>
</form>
</table>
</body>
</html>
+157
View File
@@ -0,0 +1,157 @@
<?php
//-------------------------------------------------------智订宝,历史畅销款数量
require "../../config.php";
include "../../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//-------------------------------mysql connect
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$is_submit=$_POST["is_submit"];
if($is_submit=="y"){
//初始化
$table="web_zdb_ls_js";
$dd=$_POST["dd"];
if($dd==1){
$db->query("truncate table ".$table.";");
//
$content=$_POST["content"];
$arr=explode("\n",$content);
$num=0;
for($i=0;$i<count($arr);$i++){
$arr1=explode(" ",$arr[$i]);
//
$kh=trim($arr1[0]);
$pl=trim($arr1[1]);
$price=trim($arr1[2]);
$ph=trim($arr1[3]);
$xsje_zb=trim($arr1[4]);
$xsje=trim($arr1[5]);
$ljxsje_zb=trim($arr1[6]);
$zfs=trim($arr1[7]);
$dzl=trim($arr1[8]);
$ml=trim($arr1[9]);
$m2=trim($arr1[10]);
$m3=trim($arr1[11]);
$m4=trim($arr1[12]);
$m5=trim($arr1[13]);
$m6=trim($arr1[14]);
$m=trim($arr1[15]);
$m8=trim($arr1[16]);
$m9=trim($arr1[17]);
$m10=trim($arr1[18]);
$m11=trim($arr1[19]);
$m12=trim($arr1[20]);
if(!empty($kh)){
$sql_value.="('".$kh."','".$pl."','".$price."','".$ph."','".$xsje_zb."','".$xsje."','".$ljxsje_zb."','".$zfs."','".$dzl."','".$m1."','".$m2."','".$m3."','".$m4."','".$m5."','".$m6."','".$m7."','".$m8."','".$m9."','".$m10."','".$m11."','".$m12."'),";
$num++;
}
}
if($num>0){
$sql_value=substr($sql_value,0,-1);
$q1="insert into ".$table." (kh,pl,price,ph,xsje_zb,xsje,ljxsje_zb,zfs,dzl,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12) values ".$sql_value;
//echo $q1."<br>";
$db->query($q1);
$msg.="<span class=\"right\">导入成功!</span><br>";
}
}else{
$content=$_POST["content"];
$arr=explode("\n",$content);
$num=0;
for($i=0;$i<count($arr);$i++){
$arr1=explode(" ",$arr[$i]);
//
$kh=trim($arr1[0]);
$pl=trim($arr1[1]);
$price=trim($arr1[2]);
$ph=trim($arr1[3]);
$xsje_zb=trim($arr1[4]);
$xsje=trim($arr1[5]);
$ljxsje_zb=trim($arr1[6]);
$zfs=trim($arr1[7]);
$dzl=trim($arr1[8]);
$ml=trim($arr1[9]);
$m2=trim($arr1[10]);
$m3=trim($arr1[11]);
$m4=trim($arr1[12]);
$m5=trim($arr1[13]);
$m6=trim($arr1[14]);
$m=trim($arr1[15]);
$m8=trim($arr1[16]);
$m9=trim($arr1[17]);
$m10=trim($arr1[18]);
$m11=trim($arr1[19]);
$m12=trim($arr1[20]);
if(!empty($kh)){
$check=get_db_msg("select id from web_zdb_ls where kh='".$kh."' limit 0,1");
if($check["id"]){
$q1="update ".$table." set pl='".$pl."',price='".$price."',ph='".$ph."',xsje_zb='".$xsje_zb."',xsje='".$xsje."',ljxsje_zb='".$ljxsje_zb."',dzl='".$dzl."',zfs='".$zfs."',m1='".$m1."',m2='".$m2."',m3='".$m3."',m4='".$m4."',m5='".$m5."',m6='".$m6."',m7='".$m7."',m8='".$m8."',m9='".$m9."',m10='".$m10."',m11='".$m11."',m12='".$m12."' where id='".$check["id"]."'";
$db->query($q1);
}else{
$q1="insert into ".$table." (kh,pl,price,ph,xsje_zb,xsje,ljxsje_zb,zfs,dzl,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12) values('".$kh."','".$pl."','".$price."','".$ph."','".$xsje_zb."','".$xsje."','".$ljxsje_zb."','".$zfs."','".$dzl."','".$m1."','".$m2."','".$m3."','".$m4."','".$m5."','".$m6."','".$m7."','".$m8."','".$m9."','".$m10."','".$m11."','".$m12."')";
$db->query($q1);
}
}
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>智订宝,历史畅销款(数量)导入</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="form1" action="" method="post">
<input type="hidden" name="is_submit" value="y">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>智订宝,历史畅销款(数量)导入</b></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">
<label><input type="radio" name="dd" value="1" checked>清空导入</label>
<label><input type="radio" name="dd" value="2">新增导入</label>
</td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">格式说明:款号,品类,价格,排名,销售占比,销售量,累计销售占比,Z分数,打折率,1月销售量,2月销售量,3月销售量,4月销售量,5月销售量,6月销售量,7月销售量,8月销售量,9月销售量,10月销售量,11月销售量,12月销售量;用制表符分隔;多条记录请回车。<Br>
<textarea name="content" style="width:100%;" rows="20"><?php echo $content; ?></textarea></td>
</tr>
<tr>
<td align="center" bgcolor="#f0f0f0"><input type="submit" value=" 提 交 "></td>
</tr>
<?php
if($msg){
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
}
?>
</form>
</table>
</body>
</html>
+137
View File
@@ -0,0 +1,137 @@
<?php
//-------------------------------------------------------智订宝,地图属性导入
require "../../config.php";
include "../../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//-------------------------------mysql connect
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$is_submit=$_POST["is_submit"];
if($is_submit=="y"){
//初始化
$table="web_zdb_map";
$dd=$_POST["dd"];
if($dd==1){
$db->query("truncate table ".$table.";");
//
$content=$_POST["content"];
$arr=explode("\n",$content);
$num=0;
for($i=0;$i<count($arr);$i++){
$arr1=explode(" ",$arr[$i]);
//
$username=trim($arr1[0]);
$qytitle=trim($arr1[1]);
$dplx=trim($arr1[2]);
$zd1=trim($arr1[3]);
$zd2=trim($arr1[4]);
$zd3=trim($arr1[5]);
$check=get_db_msg("select id from web_client where username='".$username."' limit 0,1");
if($check["id"]>0){
$sql_value.="('".$username."','".$qytitle."','".$dplx."','".$zd1."','".$zd2."','".$zd3."'),";
$num++;
}else{
//客户名称有误
$msg.="<span class=\"wrong\">".$username."-客户编码有误!</span><br>";
}
}
if($num>0){
$sql_value=substr($sql_value,0,-1);
$q1="insert into ".$table." (username,qytitle,dplx,zd1,zd2,zd3) values ".$sql_value;
//echo $q1."<br>";
$db->query($q1);
$msg.="<span class=\"right\">导入成功!</span><br>";
}
}else{
$content=$_POST["content"];
$arr=explode("\n",$content);
$num=0;
for($i=0;$i<count($arr);$i++){
$arr1=explode(" ",$arr[$i]);
//
$username=trim($arr1[0]);
$qytitle=trim($arr1[1]);
$dplx=trim($arr1[2]);
$zd1=trim($arr1[3]);
$zd2=trim($arr1[4]);
$zd3=trim($arr1[5]);
$check=get_db_msg("select id from web_client where username='".$username."' limit 0,1");
if($check["id"]>0){
$check2=get_db_msg("select id from web_zdb_map where username='".$username."' limit 0,1");
if($check2["id"]>0){
$q1="update ".$table." set qytitle='".$dplx."',dplx='".$dplx."',zd1='".$zd1."',zd2='".$zd2."',zd3='".$zd3."' where id='".$check2["id"]."'";
}else{
$q1="insert into ".$table." (username,qytitle,dplx,zd1,zd2,zd3) values('".$username."','".$qytitle."','".$dplx."','".$zd1."','".$zd2."','".$zd3."')";
}
$db->query($q1);
$msg.="<span class=\"right\">".$username."-导入成功!</span><br>";
}else{
//客户名称有误
$msg.="<span class=\"wrong\">".$username."-客户编码有误!</span><br>";
}
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>智订宝,地图属性导入</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="form1" action="" method="post">
<input type="hidden" name="is_submit" value="y">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>智订宝,地图属性导入</b></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">
<label><input type="radio" name="dd" value="1" checked>清空导入</label>
<label><input type="radio" name="dd" value="2">新增导入</label>
</td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">格式说明:店铺编码,区域名,店铺类型;用制表符分隔;多条记录请回车。<Br>
<textarea name="content" style="width:100%;" rows="20"><?php echo $content; ?></textarea></td>
</tr>
<tr>
<td align="center" bgcolor="#f0f0f0"><input type="submit" value=" 提 交 "></td>
</tr>
<?php
if($msg){
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
}
?>
</form>
</table>
</body>
</html>
Binary file not shown.
Binary file not shown.
Binary file not shown.