This repository has been archived on 2026-06-20. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
EDT/admin/debug/alter_ka.php
T
wsh5485 7e47ce238b chore: 添加多个图片和资源文件
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
2025-06-15 13:04:37 +08:00

134 lines
4.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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>