From 2decf5219e3476e30095fd9dbf6e49c55e105563 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期六, 06 九月 2025 23:22:49 +0800
Subject: [PATCH] feat: 增加公交广告中的优惠券功能

---
 ServiceOrder_List.gds |  118 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 109 insertions(+), 9 deletions(-)

diff --git a/ServiceOrder_List.gds b/ServiceOrder_List.gds
index e15fe06..13bd567 100644
--- a/ServiceOrder_List.gds
+++ b/ServiceOrder_List.gds
@@ -3,6 +3,7 @@
 <!--#include virtual="/inc/chkadmin.gds"-->
 <!--#include virtual="/inc/function.gds"-->
 <%
+
 searchTXT=SafeRequest(trim(Request("searchTXT")))
 searchTXTMore=SafeRequest(Request("searchTXTMore"))
 If InStr(searchTXT,",")>0 Then
@@ -268,6 +269,102 @@
 If CoopUnitID<>"" Then page_URL=page_URL&"&CoopUnitID="&CoopUnitID
 
 %>
+
+
+<%
+' 璁板綍绠$悊鍛樻搷浣滄棩蹇�,璋佽闂簡杩欎釜椤甸潰锛屽啓鍦ㄤ簡logs/鐩綍涓嬮潰
+Dim adminName
+adminName = Session("adminName")
+
+' 妫�鏌� adminName 鏄惁涓虹┖
+If adminName = "" Then
+    Response.Write("绠$悊鍛樺悕绉版湭璁剧疆锛�")
+    Response.End()
+End If
+
+' 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
+Dim currentDate
+currentDate = Year(Now()) & "-" & Right("0" & Month(Now()), 2) & "-" & Right("0" & Day(Now()), 2)
+
+' 瀹氫箟鏂囦欢璺緞鍜屾枃浠跺悕
+Dim fileName, filePath
+fileName = "log_" & currentDate & ".txt" ' 渚嬪锛歭og_2023-10-05.txt
+filePath = Server.MapPath("logs/" & fileName)
+
+' 鍒涘缓鏂囦欢绯荤粺瀵硅薄
+Dim fs, f
+Set fs = Server.CreateObject("Scripting.FileSystemObject")
+
+' 妫�鏌� logs 鐩綍鏄惁瀛樺湪锛屽鏋滀笉瀛樺湪鍒欏垱寤�
+Dim logsFolderPath
+logsFolderPath = Server.MapPath("logs")
+If Not fs.FolderExists(logsFolderPath) Then
+    fs.CreateFolder(logsFolderPath)
+End If
+
+' 妫�鏌ユ枃浠舵槸鍚﹀瓨鍦紝濡傛灉涓嶅瓨鍦ㄥ垯鍒涘缓
+If Not fs.FileExists(filePath) Then
+    Set f = fs.CreateTextFile(filePath, True)
+    f.Close
+End If
+
+
+Dim isDepartmentStr
+
+if isDepartment("020114")=1 Then
+	isDepartmentStr="鏌ョ湅鍏ㄩ儴璁㈠崟鏉冮檺"
+ElseIf isDepartment("020103")=1 Or isDepartment("020115")=1 Then
+	isDepartmentStr="鏈嶅姟鍗曟煡璇㈡潈闄�"
+Else 
+	isDepartmentStr="鏃犳潈闄�"
+End If
+
+
+' 鎵撳紑鏂囦欢骞跺啓鍏ュ唴瀹�
+On Error Resume Next ' 鍚敤閿欒澶勭悊
+Set f = fs.OpenTextFile(filePath, 8, True) ' 8 琛ㄧず杩藉姞妯″紡
+If Err.Number = 0 Then ' 濡傛灉鏈彂鐢熼敊璇�
+    f.WriteLine(Now() & " - " & adminName & " - 璁块棶浜哰ServiceOrder_List 椤甸潰] - 鐢ㄦ埛鏉冮檺锛�" & isDepartmentStr) ' 鍐欏叆褰撳墠鏃堕棿鍜岀鐞嗗憳鍚嶇О
+	f.Close
+Else
+    ' 濡傛灉鎵撳紑鏂囦欢澶辫触锛屽拷鐣ラ敊璇�
+End If
+' 閲婃斁瀵硅薄
+Set f = Nothing
+Set fs = Nothing
+
+On Error GoTo 0 ' 鍏抽棴閿欒澶勭悊
+
+
+
+
+'濡傛灉isDepartmentStr="鏃犳潈闄�"
+If isDepartmentStr = "鏃犳潈闄�" Then
+	' 鎵撳紑鏂囦欢骞跺啓鍏ュ唴瀹�
+	On Error Resume Next ' 鍚敤閿欒澶勭悊
+	Set f = fs.OpenTextFile(filePath, 8, True) ' 8 琛ㄧず杩藉姞妯″紡
+	If Err.Number = 0 Then ' 濡傛灉鏈彂鐢熼敊璇�
+		f.WriteLine(Now() & " - " & adminName & " - 灏濊瘯璁块棶[ServiceOrder_List 椤甸潰] - " & isDepartmentStr) ' 鍐欏叆褰撳墠鏃堕棿鍜岀鐞嗗憳鍚嶇О
+		f.Close
+	Else
+		' 濡傛灉鎵撳紑鏂囦欢澶辫触锛屽拷鐣ラ敊璇�
+	End If
+
+	' 閲婃斁瀵硅薄
+	Set f = Nothing
+	Set fs = Nothing
+
+	On Error GoTo 0 ' 鍏抽棴閿欒澶勭悊
+
+	Response.Write("Access not allowed, no permission!")
+	Response.End()
+End If
+%>
+
+
+
+
+
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 	<head>
@@ -662,9 +759,11 @@
 				searchSql=" CONVERT(VARCHAR(10),ServiceOrd_CC_Time,120)=CONVERT(VARCHAR(10),'"&Year(now())&"-"&Right("0"&Month(now()),2)&"-"&Mid(searchTXT,1,2)&"',120) and Right('00'+convert(varchar(3),ServiceOrdNo),3)='"&Right(searchTXT,3)&"' "
 			  ElseIf Len(searchTXT)=14 And Not IsNumeric(Left(searchTXT,2)) And IsNumeric(Mid(searchTXT,3,8)) And IsNumeric(Right(searchTXT,3)) And Mid(searchTXT,11,1)="-" Then
 				searchSql=" ServiceOrdClass='"&Left(searchTXT,2)&"' and CONVERT(VARCHAR(10),ServiceOrd_CC_Time,120)=CONVERT(VARCHAR(10),'"&Mid(searchTXT,3,4)&"-"&Mid(searchTXT,7,2)&"-"&Mid(searchTXT,9,2)&"',120) and Right('00'+convert(varchar(3),ServiceOrdNo),3)='"&Right(searchTXT,3)&"' "
-			  ElseIf Len(searchTXT)=10 And IsNumeric(searchTXT) Then
-				searchSql=" ServiceOrdID="&Right(searchTXT,10)&" "
-			  ElseIf Mid(searchTXT,1,4)="out|" Then	' and DispatchOrdState in (8)
+			  ElseIf Len(searchTXT)=14 And Mid(searchTXT,11,1)="-" Then
+    searchSql=" Old_ServiceOrdID_TXT='"&searchTXT&"' "
+  ElseIf Len(searchTXT)=10 And IsNumeric(searchTXT) Then
+    searchSql=" ServiceOrdID="&Right(searchTXT,10)&" "
+  ElseIf Mid(searchTXT,1,4)="out|" Then	' and DispatchOrdState in (8)
 				searchSql=" (ServiceOrdPtOutHosp in (select vid from dictionary where vType=1 and vtitle='HospName' and vtext='"&Mid(searchTXT,5)&"')) and ServiceOrd_CC_Time "&SqlOrdDateType
 			  ElseIf Mid(searchTXT,1,3)="in|" Then
 				searchSql=" (ServiceOrdPtInHosp in (select vid from dictionary where vType=1 and vtitle='HospName' and vtext='"&Mid(searchTXT,4)&"')) and ServiceOrd_CC_Time "&SqlOrdDateType
@@ -775,7 +874,7 @@
 			'缁勬垚璁$畻鎬婚〉鏁癝QL
 			total_sql = "select ServiceOrdID "&sqlWhere
 			'缁勬垚鏄剧ず缁撴灉SQL
-			Result_sql = "select ServiceOrdID,ServiceOrdNo,ServiceOrdClass,ServiceOrdAreaType,ServiceOrdType,ServiceOrdState,ServiceOrdStartDate,ServiceOrdApptDate,ServiceOrdCoName,ServiceOrdCoPhone,ServiceOrdPtAge,ServiceOrdPtSex,ServiceOrdTraProvince,ServiceOrdTraCity,ServiceOrdTraStreet,ServiceOrdTraEnd,ServiceOrdTraVia,ServiceOrdTraDistance,ServiceOrdTraSDTime,ServiceOrdTraTxnPrice,ServiceOrd_CC_ID,ServiceOrd_CC_Time,ServiceOrd_NS_ID,ServiceOrd_NS_Time,ServiceOrd_AP_Check,ServiceOrd_AP_ID,ServiceOrd_AP_Time,ServiceOrdVIP,ServiceOrdUnitID,ServiceOrdUnitRemarks,ServiceOrdIntroducer,ServiceOrdOperationRemarks,ServiceOrdPtOutHospID,ServiceOrdPtOutHosp,ServiceOrdPtInHospID,ServiceOrdPtInHosp,ServiceOrdCancelReasonTXT,ServiceOrdCancelReason,FromHQ_is,ServiceOrd_Sale_ID,ServiceOrdPoints,row_number() over (order by ServiceOrdID desc) n  "&sqlWhere
+			Result_sql = "select ServiceOrdID,ServiceOrdNo,ServiceOrdClass,ServiceOrdAreaType,ServiceOrdType,ServiceOrdState,ServiceOrdStartDate,ServiceOrdApptDate,ServiceOrdCoName,ServiceOrdCoPhone,ServiceOrdPtAge,ServiceOrdPtSex,ServiceOrdTraProvince,ServiceOrdTraCity,ServiceOrdTraStreet,ServiceOrdTraEnd,ServiceOrdTraVia,ServiceOrdTraDistance,ServiceOrdTraSDTime,ServiceOrdTraTxnPrice,ServiceOrd_CC_ID,ServiceOrd_CC_Time,ServiceOrd_NS_ID,ServiceOrd_NS_Time,ServiceOrd_AP_Check,ServiceOrd_AP_ID,ServiceOrd_AP_Time,ServiceOrdVIP,ServiceOrdUnitID,ServiceOrdUnitRemarks,ServiceOrdIntroducer,ServiceOrdOperationRemarks,ServiceOrdPtOutHospID,ServiceOrdPtOutHosp,ServiceOrdPtInHospID,ServiceOrdPtInHosp,ServiceOrdCancelReasonTXT,ServiceOrdCancelReason,FromHQ_is,ServiceOrd_Sale_ID,ServiceOrdPoints,Old_ServiceOrdID_TXT,row_number() over (order by ServiceOrdID desc) n  "&sqlWhere
 			'闄勫姞缁撴灉SQL
 			Additional_sql = ",StretcherMoney=isnull((select sum(StretcherMoney) from DispatchOrd where ServiceOrdIDDt=ServiceOrdID),0),ContractMode_is=isnull((select COUNT(id) from ServiceOrd_TransferMode where ServiceOrdTMID=ServiceOrdID and TransferModeID=7),0),UserPointsCost=isnull((select sum(Points_Score) from UserPoints where Points_State<>4 and Points_Type=1 and ServiceOrdIDDt=ServiceOrdID),0)"
 
@@ -892,11 +991,12 @@
 			  ServiceOrdCancelReason= rs("ServiceOrdCancelReason")
 			  FromHQ_is				= rs("FromHQ_is")				'鏄惁鏈夎浆鍐呴儴杞彂
 			  ContractMode_is		= rs("ContractMode_is")			'鏄惁鎵垮寘缁勪换鍔�
-			  If isDepartment("010401")=0 Then
-				ServiceOrdNo			= ServiceOrdClass& year(rs("ServiceOrd_CC_Time"))&Right("0"&month(rs("ServiceOrd_CC_Time")),2)&Right("0"&day(rs("ServiceOrd_CC_Time")),2) & "-"&Right("00"&rs("ServiceOrdNo"),3)
-			  Else
-				ServiceOrdNo	= ServiceOrdClass&ServiceOrdID
-			  End If
+			  Old_ServiceOrdID_TXT	= rs("Old_ServiceOrdID_TXT")	'鏃ф湇鍔″崟鍙�
+  If isDepartment("010401")=0 Then
+	ServiceOrdNo = ServiceOrdClass& year(rs("ServiceOrd_CC_Time"))&Right("0"&month(rs("ServiceOrd_CC_Time")),2)&Right("0"&day(rs("ServiceOrd_CC_Time")),2) & "-"&Right("00"&rs("ServiceOrdNo"),3)
+  Else
+	ServiceOrdNo	= ServiceOrdClass&ServiceOrdID
+  End If
 
 			  i=i+1
 

--
Gitblit v1.9.1