【调度系统】广东民航医疗快线调度系统源代码
wzp
2024-12-06 0df39a8c5a45c6ff25411eace15d40a606f9769c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%Session.CodePage=65001%>
<!--#include virtual="/inc/chkadmin.gds"-->
<!--#include virtual="/inc/function.gds"-->
<%
CouponSearchTXT=trim(Replace(Request("CouponSearchTXT")," ",""))
OA_CompetencyID=trim(Request("OA_CompetencyID"))
CouponAppID=trim(Request("CouponAppID"))
acc1=trim(Request("page"))
t=trim(Request("t"))
if acc1="" then acc1=1
acc2=1
i=0
acc3=0
page=acc1
 
page_size=6
Set rs = Server.CreateObject("ADODB.Recordset")
'生成优惠券
If CouponAppID="1" And CouponSearchTXT<>"" And IsNumeric(CouponSearchTXT) Then
    UserID=CouponSearchTXT
    sql="select strPhone from UserPhone where ToUserID="&UserID
    rs.open Sql,objConn,1,1
    If not rs.Eof then
        CouponSearchTXT=rs("strPhone")
    Else
        Response.End
    End If
    rs.close()
    sql="select * from Coupon where CouponDate_Ent>=getdate() and ToUserID="&UserID
    rs.open Sql,objConn,1,1
    If rs.Eof then
        '发优惠券: 市内50 省内200 省外500
        CouponNO=DTimeID()&getIDnumbers(6)
        CouponMoney=50
        CouponRemarks=""
        CouponName="公交广告促销活动PC 50元代金券-(本市行政区域内转运可使用)"
        If UserID="" Then UserID=0
        sql="Insert into Coupon (CouponNO,CouponName,CouponMoney,CouponDate_Ent,CouponRemarks,ServiceOrdIDPK,ToUserID) values ('"&CouponNO&"','"&CouponName&"',"&CouponMoney&",getdate()+365,'"&CouponRemarks&"',0,"&UserID&")"
        objConn.Execute sql
        CouponNO=DTimeID()&getIDnumbers(6)
        sql="Insert into Coupon (CouponNO,CouponName,CouponMoney,CouponDate_Ent,CouponRemarks,ServiceOrdIDPK,ToUserID) values ('"&CouponNO&"','"&CouponName&"',"&CouponMoney&",getdate()+365,'"&CouponRemarks&"',0,"&UserID&")"
        objConn.Execute sql
 
        CouponNO=DTimeID()&getIDnumbers(6)
        CouponMoney=200
        CouponName="公交广告促销活动PC 200元代金券-(广东内单程转运距离100公里以上可使用)"
        If UserID="" Then UserID=0
        sql="Insert into Coupon (CouponNO,CouponName,CouponMoney,CouponDate_Ent,CouponRemarks,ServiceOrdIDPK,ToUserID) values ('"&CouponNO&"','"&CouponName&"',"&CouponMoney&",getdate()+365,'"&CouponRemarks&"',0,"&UserID&")"
        objConn.Execute sql
 
        CouponNO=DTimeID()&getIDnumbers(6)
        CouponMoney=500
        CouponName="公交广告促销活动PC 500元代金券-(全国范围内单程转运距离500公里以上可使用)"
        If UserID="" Then UserID=0
        sql="Insert into Coupon (CouponNO,CouponName,CouponMoney,CouponDate_Ent,CouponRemarks,ServiceOrdIDPK,ToUserID) values ('"&CouponNO&"','"&CouponName&"',"&CouponMoney&",getdate()+365,'"&CouponRemarks&"',0,"&UserID&")"
        objConn.Execute sql
 
        CouponNO=DTimeID()&getIDnumbers(6)
        CouponMoney=500
        CouponName="公交广告促销活动PC 500元代金券-(全国范围内单程转运距离500公里以上可使用)"
        If UserID="" Then UserID=0
        sql="Insert into Coupon (CouponNO,CouponName,CouponMoney,CouponDate_Ent,CouponRemarks,ServiceOrdIDPK,ToUserID) values ('"&CouponNO&"','"&CouponName&"',"&CouponMoney&",getdate()+365,'"&CouponRemarks&"',0,"&UserID&")"
        objConn.Execute sql
 
        CouponNO=DTimeID()&getIDnumbers(6)
        CouponMoney=500
        CouponName="公交广告促销活动PC 500元代金券-(全国范围内单程转运距离500公里以上可使用)"
        If UserID="" Then UserID=0
        sql="Insert into Coupon (CouponNO,CouponName,CouponMoney,CouponDate_Ent,CouponRemarks,ServiceOrdIDPK,ToUserID) values ('"&CouponNO&"','"&CouponName&"',"&CouponMoney&",getdate()+365,'"&CouponRemarks&"',0,"&UserID&")"
        objConn.Execute sql
 
        CouponNO=DTimeID()&getIDnumbers(6)
        CouponMoney=1000
        CouponRemarks=""
        CouponName="公交广告促销活动PC 1000元代金券-(全国范围内高铁医疗转运可使用)"
        If UserID="" Then UserID=0
        sql="Insert into Coupon (CouponNO,CouponName,CouponMoney,CouponDate_Ent,CouponRemarks,ServiceOrdIDPK,ToUserID) values ('"&CouponNO&"','"&CouponName&"',"&CouponMoney&",getdate()+365,'"&CouponRemarks&"',0,"&UserID&")"
        objConn.Execute sql
 
        CouponNO=DTimeID()&getIDnumbers(6)
        CouponMoney=3000
        CouponRemarks=""
        CouponName="公交广告促销活动PC 3000元代金券-(全国范围内航空医疗转运可使用)"
        If UserID="" Then UserID=0
        sql="Insert into Coupon (CouponNO,CouponName,CouponMoney,CouponDate_Ent,CouponRemarks,ServiceOrdIDPK,ToUserID) values ('"&CouponNO&"','"&CouponName&"',"&CouponMoney&",getdate()+365,'"&CouponRemarks&"',0,"&UserID&")"
        objConn.Execute sql
    End If
    rs.close()
End If
'SQL查询条件
if len(CouponSearchTXT)>0 then
    'sqlWhere=" from Coupon where CouponState=0 and CouponDate_Ent>=getdate() and (CouponNO='"&CouponSearchTXT&"' or ServiceOrdIDPK in (select ServiceOrdID from ServiceOrder where ServiceOrdCoPhone='"&CouponSearchTXT&"') or ServiceOrdIDPK in (select ServiceOrdID from ServiceOrder where ServiceOrdCoPhone in (select UserPhone from weixinOpenIDToPhone where weixinOpenID in (select weixinOpenID from weixinOpenIDToPhone where UserPhone='"&CouponSearchTXT&"'))))"
    sqlWhere=" from Coupon LEFT JOIN ServiceOrder ON ServiceOrdID=CouponRemarks where (CouponNO='"&CouponSearchTXT&"' or ServiceOrdIDPK in (select ServiceOrdID from ServiceOrder where ServiceOrdCoPhone='"&CouponSearchTXT&"') or ServiceOrdIDPK in (select ServiceOrdID from ServiceOrder where ServiceOrdCoPhone in (select UserPhone from weixinOpenIDToPhone where weixinOpenID in (select weixinOpenID from weixinOpenIDToPhone where UserPhone='"&CouponSearchTXT&"')))) or ToUserID in (select ToUserID from UserPhone where strPhone='"&CouponSearchTXT&"')"
else
    Response.End
end if
'组成计算总页数SQL
total_sql = "select count(id) "&sqlWhere    
'组成显示结果SQL
Result_sql = "select Coupon.*,ServiceOrd_CC_Time,row_number() over (order by CouponState desc,CouponDate_Ent desc) n "&sqlWhere    
'附加结果SQL
Additional_sql = ""
 
'计算总页数
'Response.Write total_sql
rs.open total_sql,objConn,1,1
total_records=rs(0)        '总行数
total_page=Fix(total_records/page_size)        '总页数
If (total_records/page_size)-total_page>0 Then total_page=total_page+1
rs.close()
'避免page小于0或大于总页数
 
If CInt(page)>total_page Then
  page=total_page
  
ElseIf CInt(page)<=0 Then
  page=1
End If
'计算开始和结束行数
pageStart = (page-1)*page_size
pageEnd = pageStart+page_size
sqlPage = " where sqlData.n > "&pageStart&" and sqlData.n <= "&pageEnd&" "
sql = "select *"&Additional_sql&" from ("&Result_sql&") sqlData "&sqlPage&" order by sqlData.n"
'Response.Write sql
'Response.Write total_page
    rs.open Sql,objConn,1,1
    %>
        <script language=javascript>
        var CouponListArray=new Array()
        <%
            do while not rs.Eof and i<6
                CouponID        = rs("id")
                CouponNO        = rs("CouponNO")
                CouponName        = Replace(rs("CouponName"),"-","<br>")
                CouponMoney        = rs("CouponMoney")
                CouponDate_Ent    = rs("CouponDate_Ent")
                CouponDate_Ord    = rs("ServiceOrd_CC_Time")
                CouponState        = rs("CouponState")
                if CouponState=1 then
                    CouponDate_Ent=CouponDate_Ord
                elseif CouponDate_Ent<now() then
                    CouponState=2
                else
                end if
                if CouponDate_Ent<>"" then CouponDate_Ent=FormatDateTime(CouponDate_Ent,2)
                Response.Write "CouponListArray["&i&"]=new Array("""&CouponID&""","""&CouponNO&""","""&CouponMoney&""","""&CouponDate_Ent&""","""&CouponName&""","""&CouponState&""");"
                i=i+1
                rs.movenext
            loop
            rs.close()
        %>
        parent.JS_CouponList(CouponListArray,<%=acc1%>,<%=total_page%>,'<%=CouponSearchTXT%>',<%=total_records%>);
        </script>
 
 
<%Response.End%>