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
| <%
| '人员列表
| sql="select vID,vtext from dictionary where vType=1 and vtitle='DispatchOrdEntourage' and vtext='司机' order by vOrder"
| rs.open sql,objConn,1,1
| i=0
| EntourageIDs=""
| do while not rs.Eof
| EntourageID = rs("vID")
| EntourageName= rs("vtext")
| EntourageNames=EntourageNames&","&EntourageName
| EntourageIDs=EntourageIDs&","&EntourageID
| i=i+1
| rs.movenext
| loop
| rs.close()
| EntourageNamePS = SPLIT(EntourageNames,",")
| EntourageIDPS = SPLIT(EntourageIDs,",")
|
| acc1=request("page")
| if acc1=empty then acc1=clng(1)
| QuantityInt = 20
| acc2=0
| acc3=0
|
| '查看各分公司报表权限
| if isDepartment("070109")=1 then
| OrdClassListSql=""
| If UnitNameID<>"" And UnitNameID<>"0" Then
| sql="select vOrder2 from dictionary where vtitle='UnitName' and vID="&UnitNameID
| rs.open sql,objConn,1,1
| If not rs.Eof Then
| UnitTypeID=rs(0)
| rs.close()
| sql="select vID,vtext,vOrder2 from dictionary where vID in ("&UnitTypeID&") and vtitle='OrderClass' order by vOrder"
| rs.open sql,objConn,1,1
| do while not rs.Eof
| OrderClassID = rs("vOrder2")
| OrdClassListSql = OrdClassListSql&","&OrderClassID
| rs.movenext
| Loop
| OrdClassListSql=Mid(OrdClassListSql,2)
| OrdClassListSql=Replace(OrdClassListSql,",","','")
| End If
| rs.close()
| Else
| sql="select vID,vtext,vOrder2 from dictionary where vType in (1,2) and vtitle='OrderClass' order by vOrder"
| rs.open sql,objConn,1,1
| do while not rs.Eof
| OrderClassID = rs("vOrder2")
| OrdClassListSql = OrdClassListSql&","&OrderClassID
| rs.movenext
| loop
| rs.close()
| OrdClassListSql=Mid(OrdClassListSql,2)
| OrdClassListSql=Replace(OrdClassListSql,",","','")
| End If
| end If
|
| If CoopUnitID<>"" And CoopUnitID<>"0" Then
| If Left(CoopUnitID,2)="0," Then CoopUnitID=Mid(CoopUnitID,3)
| CoopUnitSql=" And ServiceOrdUnitID in ("&CoopUnitID&")"
| Else
| CoopUnitSql=""
| End If
|
| if searchTXT<>"" Then
| searchSql=" and (HospName like '%"&searchTXT&"%') "
| else
| searchSql=""
| end If
| If InStr(orderby," desc")>1 Then
| orderbydesc=""
| descTXT="↓"
| Else
| orderbydesc=" desc"
| descTXT="↑"
| End If
| 'sql="select * from (select vID,HospName,OutHosp=(select count(ServiceOrdPtOutHosp) from ServiceOrder where ServiceOrdPtOutHosp=vID and ServiceOrd_CC_Time "&SqlOrdDateType&"),InHosp=(select count(ServiceOrdPtInHosp) from ServiceOrder where ServiceOrdPtInHosp=vID and ServiceOrd_CC_Time "&SqlOrdDateType&") from HospData,dictionary where vtitle='HospName' and HospState=1 and vtext=HospName GROUP BY vID,HospName) as aa order by OutHosp+OutHosp desc"
| If orderby="" Then
| orderby="OutHosp|InHosp desc,OutHospPrice|InHospPrice desc"
| descTXT="↓"
| End If
| 'Response.Write OrdClassListSql
| If OrdClassType="2" Then
| '按服务单统计
| sql="select ServiceOrdID,ServiceOrdClass+convert(nvarchar(10),year(ServiceOrd_CC_Time))+right('0'+convert(nvarchar(10),month(ServiceOrd_CC_Time)),2)+right('0'+convert(nvarchar(10),day(ServiceOrd_CC_Time)),2)+'-'+right('00'+convert(nvarchar(10),ServiceOrdNo),3),a.vtext,CONVERT(nvarchar(20),ServiceOrd_CC_Time, 111) ,ServiceOrdCoName,ServiceOrdCoPhone,ServiceOrd_SaleName=(select OA_Name from OA_User where OA_User_ID=ServiceOrd_Sale_ID),ServiceOrdIntroducer,ServiceOrd_CCName=(select OA_Name from OA_User where OA_User_ID=ServiceOrd_CC_ID),DispatchOrd_NSName=(select OA_Name from OA_User where OA_User_ID=DispatchOrd_NS_ID),ServiceOrdSource=(select vtext from dictionary where vtitle='OrdSource' and vID=ServiceOrdSource),hospA.HospName,hospB.HospName,ServiceOrdTraTxnPrice+isnull(StretcherMoney,0) from HospData as hospA,HospData as HospB,dictionary as A,ServiceOrder LEFT JOIN DispatchOrd on ServiceOrdIDDt=ServiceOrdID where hospA.HospID=ServiceOrdPtOutHospID and hospB.HospID=ServiceOrdPtInHospID and A.vID=ServiceOrdState and a.vtitle='ServiceOrderState' and ServiceOrd_CC_Time "&SqlOrdDateType&CoopUnitSql&" and ServiceOrdClass in ('"&OrdClassListSql&"') order by ServiceOrd_CC_Time"
| Else
| '按调度单统计
| sql="select DispatchOrdID,DispatchOrdClass+convert(nvarchar(10),year(DispatchOrd_NS_Time))+right('0'+convert(nvarchar(10),month(DispatchOrd_NS_Time)),2)+right('0'+convert(nvarchar(10),day(DispatchOrd_NS_Time)),2)+'-'+right('00'+convert(nvarchar(10),DispatchOrdNo),3),a.vtext,CONVERT(nvarchar(20),DispatchOrd_NS_Time, 111),ServiceOrdCoName,ServiceOrdCoPhone,ServiceOrd_SaleName=(select OA_Name from OA_User where OA_User_ID=ServiceOrd_Sale_ID),ServiceOrdIntroducer,ServiceOrd_CCName=(select OA_Name from OA_User where OA_User_ID=ServiceOrd_CC_ID),DispatchOrd_NSName=(select OA_Name from OA_User where OA_User_ID=DispatchOrd_NS_ID),ServiceOrdSource=(select vtext from dictionary where vtitle='OrdSource' and vID=ServiceOrdSource),hospA.HospName,hospB.HospName,ServiceOrdTraTxnPrice+StretcherMoney from dbo.ServiceOrder,dbo.DispatchOrd,HospData as hospA,HospData as HospB,dictionary as A where ServiceOrdIDDt=ServiceOrdID and DispatchOrdState not in (10) and hospA.HospID=ServiceOrdPtOutHospID and hospB.HospID=ServiceOrdPtInHospID and A.vID=DispatchOrdState and a.vtitle='DispatchOrdState' and DispatchOrd_NS_Time "&SqlOrdDateType&CoopUnitSql&" and DispatchOrdClass in ('"&OrdClassListSql&"') order by DispatchOrd_NS_Time"
| End If
|
| 'If Right(sql,2)=", " Then sql=Left(sql,Len(sql)-2)
| 'Response.Write sql
| rs.open sql,objConn,1,1
| if not rs.eof then
| rs.pagesize=QuantityInt
| rs.absolutepage=acc1
| acc2=rs.pagecount
| acc3=rs.recordcount
| else
| SystemMessageType=2
| SystemMessageTXT="数据库中相关无数据!"
| end If
| If SystemMessageType<>"2" then
| Dim FormArray()
| ArrayX=50
| If acc3<QuantityInt Or (is_CSV=1 And acc3>QuantityInt) Then
| ArrayY=acc3
| Else
| ArrayY=QuantityInt
| End If
| '表头
| FormFields="序号,调度单号,状态,日期,联系人,联系电话,销售,介绍人,客服,调度,来源,发出地,目的址,成交价"
| FormFields=split(FormFields,",")
| ArrayX=ubound(FormFields)+1
| REDIM FormArray(ArrayX,ArrayY+1)
| for i=0 to ubound(FormFields)
| FormArray((i+1),0)=FormFields(i)
| next
| Y=1
| do while not rs.Eof and Y<=ArrayY
| '读取数据
|
| Y=Y+1
| '读取数据--End
|
| '写入数组
| FormArray(1,Y)=(Y-1)+((acc1-1)*QuantityInt)
| If OrdClassType="2" Then
| FormArray(2,Y)="<a href=""ServiceOrder.gds?ServiceOrdID="&rs(0)&"&OrdDateType=4&OrdClassList=0&h_menu1_1=1"" target=""_blank"">"&rs(1)&"</a>"
| else
| FormArray(2,Y)="<a href=""DispatchOrder.gds?DispatchOrdID="&rs(0)&"&OrdDateType=4&OrdClassList=0&h_menu1_1=1"" target=""_blank"">"&rs(1)&"</a>"
| End If
| FormArray(3,Y)=rs(2)
| FormArray(4,Y)=rs(3)
| FormArray(5,Y)=rs(4)
| FormArray(6,Y)=rs(5)
| FormArray(7,Y)=rs(6)
| FormArray(8,Y)=UnitIntroducer(rs(7),"UnitName")
| FormArray(9,Y)=rs(8)
| FormArray(10,Y)=rs(9)
| FormArray(11,Y)=rs(10)
| FormArray(12,Y)=rs(11)
| FormArray(13,Y)=rs(12)
| FormArray(14,Y)=rs(13)
|
| '写入数组--End
|
| rs.movenext
| Loop
| 'REDIM FormArray(ArrayX,Y)
| rs.close()
| End If
| %>
|
|