【调度系统】广东民航医疗快线调度系统源代码
wlzboy
2025-09-06 2decf5219e3476e30095fd9dbf6e49c55e105563
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%Session.CodePage=65001%>
<!--#include virtual="/inc/chkadmin.gds"-->
<!--#include virtual="/inc/function.gds"-->
<!--#include virtual="/inc/core.asp"-->
 
<%
ServiceOrdID=SafeRequest(Request("ServiceOrdID"))
Phone=SafeRequest(Request("Phone"))
If Phone<>"" And Request.Cookies("CAME_Phone")("Phone")<>Phone Then 
    Response.Cookies("CAME_Phone")("Phone")=Phone
    Response.Cookies("CAME_Phone")("PhoneTime")=now()
End If
'注册&查询用户ID
If Phone<>"" And Len(Phone)=11 And Left(Phone,1)="1" And IsNumeric(Phone) Then
    UserPhone=Phone
    UserName=Phone
    Call User_Login(UserID,UserPhone,wxOriginalID,wxOpenid,wxUnionID,UserSource,UserName)
End If
OrdClass=SafeRequest(Request("OrdClass"))
admin_save=SafeRequest(Request("admin_save"))
 
OrdClassList=SafeRequest(Request("OrdClassList"))
OrdDateType=SafeRequest(Request("OrdDateType"))
NEWOrder=SafeRequest(Request("NEWOrder"))
'各种返回信息
SystemMessageType=trim(Request("SystemMessageType"))
SMT=trim(Request("SMT"))
error=trim(Request("error"))
if SystemMessageType<>"" then
  if SMT="1" then
    SystemMessageTXT="数据不完整!!"
  elseif SMT="2" then
    SystemMessageTXT="请不要重复提交单据!!"
  elseif SMT="3" then
    SystemMessageTXT="保存完成!!"
  elseif SMT="4" then
    SystemMessageTXT="数据不足,请按要求填写或先保存为[咨询单]!!"
  elseif SMT="5" then
    SystemMessageTXT="服务单审核完成!!"
  elseif SMT="6" then
    SystemMessageTXT="服务单反审核完成!!"
  elseif SMT="7" then
    SystemMessageTXT="生成服务单完成!!"
  elseif SMT="8" then
    SystemMessageTXT="取消服务单完成!!"
  elseif SMT="9" then
    SystemMessageTXT="作废咨询单完成!!"
  elseif SMT="10" then
    SystemMessageTXT="还原服务单完成!!"
  elseif SMT="11" then
    SystemMessageTXT="短信已发送!!"
  elseif SMT="12" then
    SystemMessageTXT="手机本月多次提交订单!!"
  elseif SMT="14" then
    SystemMessageTXT="预估距离不能为0!!"
  elseif SMT="22" then
    SystemMessageTXT="请选择需要操作的单据"
  elseif SMT="23" then
    SystemMessageTXT="费用单审核完成!!"
  elseif SMT="24" then
    SystemMessageTXT="费用单反审核完成!!"
  elseif SMT="25" then
    SystemMessageTXT="费用单作废完成!!"
  elseif SMT="35" then
    SystemMessageTXT="费用单新建完成!!"
  elseif SMT="40" then
    SystemMessageTXT="操作留言保存完成!!"
  elseif SMT="41" then
    SystemMessageTXT="操作留言删除完成!!"
  elseif SMT="42" then
    SystemMessageTXT="发票申请提交完成!!"
  elseif SMT="43" then
    SystemMessageTXT="请到企业微信审核客户退款!!"
  Else
    SystemMessageTXT=SMT
  end if
end If
 
If session("Origin")<>"" Then
'保存错误返回字段
    Origin    = session("Origin")
    session("Origin")=""
    OriginSP    = SPLIT(Origin,"|")
    For i=1 to UBOUND(OriginSP)
    OriginSPv=SPLIT(OriginSP(i),"=")
    If UBOUND(OriginSPv)=1 then
        v=OriginSPv(0)
        t=OriginSPv(1)
        Execute( v & "= """&t&""" ")
    End If
    Next
End if
 
OrderLevel=0
Set rs = Server.CreateObject("ADODB.Recordset")
If (ServiceOrdID<>"" Or Phone<>"") And NEWOrder="" Then
    If ServiceOrdID<>"" then
    sql="select * from ServiceOrder where ServiceOrdID="&ServiceOrdID
    Else
    '来电的7天内咨询单或处理中的服务单或完成后3天内的服务单
    sql="select top 1 * from ServiceOrder where ServiceOrdCoPhone='"&Phone&"' and ((ServiceOrdState=1 and datediff(dd,ServiceOrdStartDate,getdate())<7) or ServiceOrdState=2 or (ServiceOrdState=3 and datediff(dd,ServiceOrdApptDate,getdate())<=3)) order by ServiceOrdID desc"
    End If
    rs.open sql,objConn,1,1
    If not rs.Eof then
        ServiceOrdID        = rs("ServiceOrdID")
        ServiceOrdClass        = rs("ServiceOrdClass")
        ServiceOrdState        = rs("ServiceOrdState")
        ServiceOrdAreaType    = rs("ServiceOrdAreaType")
        ServiceOrdType        = rs("ServiceOrdType")
        ServiceOrdStartDate    = rs("ServiceOrd_CC_Time")
        ServiceOrd_CC_ID    = rs("ServiceOrd_CC_ID")        '服务单客服人员ID
        ServiceOrd_Sale_ID    = rs("ServiceOrd_Sale_ID")        '服务单销售人员ID
        ServiceOrdIntroducer= rs("ServiceOrdIntroducer")    '服务单介绍人
        RecommendUserID            = rs("RecommendUserID")                '小程序介绍人ID
        ServiceOrd_work_ID    = rs("ServiceOrd_work_ID")
        ServiceOrd_work_IDs    = rs("ServiceOrd_work_IDs")
        ServiceOrd_work_is    = rs("ServiceOrd_work_is")
        CommissionScenarioID=rs("CommissionScenarioID")
        ServiceOrdCancelReason= rs("ServiceOrdCancelReason")
        ServiceOrdCancelReasonTXT= rs("ServiceOrdCancelReasonTXT")
        ServiceOrdUnitID    = rs("ServiceOrdUnitID")        '第三方ID
        ServiceOrdUnitRemarks=rs("ServiceOrdUnitRemarks")    '第三方订单备注
        ServiceOrdSource    = rs("ServiceOrdSource")
        OrderLevel            = rs("OrderLevel")                '查看等级
        ServiceOrd_AP_Check    = rs("ServiceOrd_AP_Check")
        IsLocking            = rs("IsLocking")            '财务锁定
        Old_ServiceOrdID_TXT = rs("Old_ServiceOrdID_TXT") '原始单据编号
        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)
        If InStr(session("admin_OrderClass"),ServiceOrdClass)>0 Or isDepartment("070109")=1 Then 
            Call OA_Running("打开服务单:"&ServiceOrdNo&" ID:"&ServiceOrdID)
        Else
            Call OA_Running("打开服务单失败:"&ServiceOrdNo&" ID:"&ServiceOrdID)
            Response.Redirect "/"
            Response.End()
        End If
    End If
    rs.close()
End If
 
'默认字段
If ServiceOrdStartDate="" Then ServiceOrdStartDate=now()
If ServiceOrdClass="" Then
    If session("admin_OrderClass")<>"" Then
        OA_OrderClassIDSP    = SPLIT(session("admin_OrderClass"),",")
        for i = 0 to UBOUND(OA_OrderClassIDSP)
            sql="select vID,vtext,vOrder2 from dictionary where vType=1 and vtitle='OrderClass' and vOrder2='"&Trim(OA_OrderClassIDSP(i))&"' order by vOrder"
            rs.open sql,objConn,1,1
            if not rs.Eof Then
                ServiceOrdClass=rs("vOrder2")
            End If
            rs.close()
            if ServiceOrdClass<>"" Then Exit For
        next
    Else
        ServiceOrdClass="BF"
    End If
End If
If ServiceOrdState="" Or (ServiceOrdState="2" And ServiceOrdID="") Then ServiceOrdState=1
If OrdClass<>""  Then
    ServiceOrdClass=OrdClass
    OrdClassName=OrderClassA(OrdClass)
Else
    OrdClass=ServiceOrdClass
    OrdClassName=OrderClassA(OrdClass)
End If
If ServiceOrdID="" Then
    ServiceOrdID_TXT="[系统自动生成]"
Else
    ServiceOrdID_TXT=ServiceOrdNo
End If
ServiceOrdStateTXT=ServiceOrdStateA(ServiceOrdState)
DispatchOrd_AP_Check=0
If ServiceOrdID<>"" Then    '调度单完成后,把联系人资料开放
    sql="select DispatchOrdID,DispatchOrdClass,DispatchOrdState,DispatchOrd_AP_Check from DispatchOrd where ServiceOrdIDDt="&ServiceOrdID&" and DispatchOrdState=8 order by DispatchOrdID desc"
    'Response.Write sql
    rs.open sql,objConn,1,1
    If not rs.Eof Then
      is_Privacy="YES"
      DispatchOrd_AP_Check = rs("DispatchOrd_AP_Check")
    End If
    rs.close()
End If
 
is_User=session("is_User")
%>
<!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>
        <title><%=LindemanAdmin%></title>
        <!--#include virtual="/inc/ccs.gds"-->
        <!-- scripts (custom) -->
        <script src="resources/scripts/smooth.js" type="text/javascript"></script>
        <script src="resources/scripts/smooth.menu.js" type="text/javascript"></script>
        <script src="resources/scripts/smooth.table.js" type="text/javascript"></script>
        <script src="resources/scripts/smooth.form.js" type="text/javascript"></script>
        <script src="resources/scripts/smooth.dialog.js" type="text/javascript"></script>
        <script src="resources/scripts/smooth.autocomplete.js" type="text/javascript"></script>
        <script src="resources/scripts/Menu.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                style_path = "resources/css/colors";
 
                //$("#date-picker").datepicker();
 
                //$("#box-tabs, #box-left-tabs").tabs();
            });
        </script>
    </head>
    <body onkeydown="xKeyEvent(event)">
        <!--#INCLUDE FILE="menu_header.gds" -->
        <!-- content -->
        <div id="content">
            <%If is_User="1" then%>
            <!--#INCLUDE FILE="User_menu_left.gds" -->
            <%elseIf NEWOrder="2" Then
                OrdClassName="新建调度单 - 信息采集表"
                ServiceOrdStateTXT="新建调度单"%>
            <!--#INCLUDE FILE="Dispatch_menu_left.gds" -->
            <%else%>
            <!--#INCLUDE FILE="ServiceCenter_menu_left.gds" -->
            <%End if%>
            <!-- content / right -->
            <div id="right">
                <!-- messages -->
 
            <%If OrderLevel<>1 Or isDepartment("020111")=1 Then%>
                <%If ServiceOrdID<>"" Then
                '敏感信息处理
                If isDepartment("020109")=0 And session("Power_"&ServiceOrdID)<>"1" And (DispatchOrdID<>"" or ServiceOrdID<>"") And (ServiceOrdClass="BF" And is_Privacy<>"YES") Then
                    sql="select MID from ServiceOrd_Message where ServiceOrdIDDt="&ServiceOrdID&" and MessageState>0 and MessageToOAid="&session("adminID")
                    rs.open sql,objConn,1,1
                    if not rs.eof Then
                        is_Privacy="YES"
                    Else
                        is_Privacy="NO"
                    End If 
                    rs.close()
                Else
                    is_Privacy="YES"
                End If
 
                 sql="select * from CallRecord where CallRecord_OrdID="&ServiceOrdID&" order by CallRecord_StartTime"
                rs.open sql,objConn,1,1
                If not rs.Eof then
                %>
                <div class="box">
                    <!-- box / title -->
                    <div class="title">
                        <h5>来电记录</h5>
                    </div>
                    <!-- end box / title -->
                    <div class="table">
                        <table>
                            <thead>
                                <tr>
                                    <th>来电时间</th>
                                    <th>来电号码</th>
                                    <th>话务员</th>
                                    <th>来电备注</th>
                                    <th>通话时长</th>
                                    <th class="selected last"><input type="checkbox" class="checkall"></th>
                                </tr>
                            </thead>
                            <tbody>
                            <%
                              i=0
                              do while not rs.Eof
                              i=i+1
                              CallRecord_Phine        = rs("CallRecord_Phine")
                              CallRecord_OAUserID    = rs("CallRecord_OAUserID")
                              CallRecord_StartTime    = rs("CallRecord_StartTime")
                              CallRecord_EndTime    = rs("CallRecord_EndTime")
                              CallRecord_Type        = rs("CallRecord_Type")
                              CallRecord_OrdClass    = rs("CallRecord_OrdClass")
                              CallRecord_OrdID        = rs("CallRecord_OrdID")
                              CallRecord_Record        = rs("CallRecord_Record")
 
                              CallRecord_Time    = SplitTime(DateDiff("s",CallRecord_StartTime,CallRecord_EndTime))
                              If is_Privacy="NO" Then CallRecord_Phine="【隐】"
                              
                              'AcceptMoneyyudxl=UserMoney&"元 "&mono&" "&TVadminUser(Operation,"cname")&"("&formatdatetime(time1,vbshortdate)&")"
                              %>
                              <tr>
                                    <td class="category"><%=CallRecord_StartTime%></td>
                                    <td class="category"><%=CallRecord_Phine%></td>
                                    <td class="category"><%=OAUser(CallRecord_OAUserID,"UserName")%></td>
                                    <td class="category"><%=CallRecord_Record%></td>
                                    <td class="category"><%=CallRecord_Time%></td>
                                    <td class="selected last"><input type="checkbox"></td>
                                </tr>
                            <%rs.movenext
                            loop 
                            
                            %>
                            <%for j=i to 3%>
                                    <tr>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td class="selected last">&nbsp;</td>
                                    </tr>
                                <%next%>
                            </tbody>
                        </table>
                    </div>
                    <%End If
                    rs.close()
                    End if%>
 
                <%If ServiceOrdID<>"" Or Phone<>"" Then
                If ServiceOrdID<>"" Then
                    sql="select top 4 * from dbo.ServiceOrder where ServiceOrdCoPhone in (select ServiceOrdCoPhone from ServiceOrder where ServiceOrdID="&ServiceOrdID&") and ((ServiceOrdCancelReason<>10 or ServiceOrdCancelReason is null) and (ServiceOrdCancelReasonTXT<>'自动取消' or ServiceOrdCancelReasonTXT is null)) and (ServiceOrdOperationRemarks<>'[客户未正式提交需求,可不联系]' or ServiceOrdOperationRemarks is null)  and ServiceOrdID<>"&ServiceOrdID&" order by ServiceOrdID desc"
                Else
                    sql="select top 4 * from dbo.ServiceOrder where ServiceOrdCoPhone='"&Phone&"' order by ServiceOrdID desc"
                End If
                rs.open sql,objConn,1,1
                If not rs.Eof then
                %>
                <div class="box">
                    <!-- box / title -->
                    <div class="title">
                        <h5>相关服务单</h5>
                    </div>
                    <!-- end box / title -->
                    <div class="table">
                        <table>
                            <thead>
                                <tr>
                                    <th>服务单号</th>
                                    <th>状态</th>
                                    <th>日期</th>
                                    <th>价钱</th>
                                    <th>目的地</th>
                                    <th>介绍人</th>
                                    <th class="last">操作备注</th>
                                </tr>
                            </thead>
                            <tbody>
                            <%
                              i=0
                              do while not rs.Eof
                              i=i+1
                                History_ServiceOrdID        = rs("ServiceOrdID")            '服务单号
                                History_ServiceOrdClass        = rs("ServiceOrdClass")            '单据类型
                                History_ServiceOrdType        = rs("ServiceOrdType")            '服务单类型
                                History_ServiceOrdState        = rs("ServiceOrdState")            '服务单状态
                                History_ServiceOrdStartDate    = rs("ServiceOrd_CC_Time")        '开单日期
                                History_ServiceOrdApptDate    = rs("ServiceOrdApptDate")        '预约日期
                                History_ServiceOrdCoName    = rs("ServiceOrdCoName")        '联系人姓名
                                History_ServiceOrdCoPhone    = rs("ServiceOrdCoPhone")        '联系人电话
                                History_ServiceOrdTraStreet    = rs("ServiceOrdTraStreet")        '出发地
                                History_ServiceOrdTraEnd        = rs("ServiceOrdTraEnd")        '目的地
                                History_ServiceOrdTraVia        = rs("ServiceOrdTraVia")        '途经地(计划)
                                History_ServiceOrdTraTxnPrice    = rs("ServiceOrdTraTxnPrice")    '成交价
                                History_ServiceOrdVIP            = rs("ServiceOrdVIP")
                                History_ServiceOrdUnitID        = rs("ServiceOrdUnitID")        '第三方ID
                                History_ServiceOrdUnitRemarks    = rs("ServiceOrdUnitRemarks")    '第三方订单备注
                                History_ServiceOrdOperationRemarks    = rs("ServiceOrdOperationRemarks")    '操作备注
                                History_ServiceOrdIntroducer    = rs("ServiceOrdIntroducer")    '介绍人
                                History_ServiceOrdPtOutHospID    = rs("ServiceOrdPtOutHospID")    '转出医院ID
                                History_ServiceOrdPtOutHosp    = rs("ServiceOrdPtOutHosp")        '转出医院
                                History_ServiceOrdPtInHospID    = rs("ServiceOrdPtInHospID")    '转入医院ID
                                History_ServiceOrdPtInHosp    = rs("ServiceOrdPtInHosp")        '转入医院
                                History_ServiceOrdNo            = History_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)
 
                                'VIP客户订单
                                  If History_ServiceOrdVIP="1" Then
                                    History_ServiceOrdVIPTXT="[<span style='color: #E91E63;font-weight: bold;'>VIP</span>]"
                                  Else
                                    History_ServiceOrdVIPTXT=""
                                  End If
                                '出发地
                                  If History_ServiceOrdTraVia<>"" Then
                                    OrdTraVia=History_ServiceOrdTraVia
                                  Else
                                    OrdTraVia=History_ServiceOrdTraStreet
                                  End If
                              %>
                              <tr>
                                    <td class="category"><A HREF="ServiceOrder.gds?ServiceOrdID=<%=History_ServiceOrdID%>&OrdDateType=<%=OrdDateType%>&OrdClassList=<%=OrdClassList%>&h_menu1_1=1&Phone=<%=Phone%>"<%If History_ServiceOrdUnitID<>"0" Then Response.Write("  style='color: #F44336;'")%>><%=History_ServiceOrdNo%><%=History_ServiceOrdVIPTXT%></A></td>
                                    <td class="category"><%=ServiceOrdStateA(History_ServiceOrdState)%></td>
                                    <td class="category"><%=DateFormat(History_ServiceOrdStartDate)%></td>
                                    <td class="category"><%=MoneyCheck(History_ServiceOrdTraTxnPrice,1)%></td>
                                    <td class="category"><span style='color: #E91E63;'><%If History_ServiceOrdPtOutHosp="814" Then Response.Write OrdTraVia Else Response.Write HospA(History_ServiceOrdPtOutHosp,"HospName") End If%></span><br><span style='color: #4CAF50;'><%If History_ServiceOrdPtInHosp="814" Then Response.Write History_ServiceOrdTraEnd Else Response.Write HospA(History_ServiceOrdPtInHosp,"HospName") End If%></span></td>
                                    <td class="category"><%=History_ServiceOrdIntroducer%></td>
                                    <td class="last"><%=History_ServiceOrdOperationRemarks%></td>
                                </tr>
                            <%rs.movenext
                            loop 
                            
                            %>
                            <%for j=i to 3%>
                                    <tr>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td class="selected last">&nbsp;</td>
                                    </tr>
                                <%next%>
                            </tbody>
                        </table>
                    </div>
                    <%End If
                    rs.close()
                    End if%>
                <%End If%>
 
                <%If ServiceOrdID<>""  Then%>
                <!-- forms -->
                <div class="box">
                    <!-- box / title -->
                    <div class="title">
                        <h5>操作留言</h5>
                    </div>
                    <!-- forms -->
 
                    <div class="form">
                        <div class="fields">
 
                    <ul class="links">
                        <%'------------------- 留言显示 ---------------------
                        P_OAid=""
                        P_callid=""
                        sql="select * from ServiceOrd_Message where ServiceOrdIDDt="&ServiceOrdID&" and MessageState>0 order by MID"
                        rs.open sql,objConn,1,1
                        do while not rs.Eof  
                            ID            = rs("MID")        '留言ID
                            MessageOAid    = rs("MessageOAid")    '留言者
                            MessageDate    = rs("MessageDate")    '留言时间
                            MessageHeadline    = rs("MessageHeadline")    '留言标题
                            MessageContents    = rs("MessageContents")    '留言内容
                            MessageToOAid    = rs("MessageToOAid")    '接收人员ID
                            MessageToState    = rs("MessageToState")    '已读状态
                            MessageToStateTime= rs("MessageToStateTime")    '已读时间
                            MessagePhone_is    = rs("Phone_is")    '电话提醒状态
                            MessagePhone_callid    = rs("Phone_callid")    '电话callID
                            If MessageContents<>"" Then MessageContents=DealInput3(MessageContents)
                            If InStr(MessageHeadline,"发送通知给") >1 Then
                                MessageContents=MessageHeadline&" "&OAUser(MessageToOAid,"UserPhone")&","&MessageContents
                            elseIf MessageHeadline<>"" Then 
                                MessageContents=MessageHeadline&","&MessageContents
                            End If
                            If MessagePhone_is=1 And MessagePhone_callid<>"" Then
                                P_OAid=P_OAid&MessageToOAid&"|"
                                P_callid=P_callid&MessagePhone_callid&"|"
                            End If
                            %>
                            <div class="field" style="min-height: 50px;">
                                <div class="label" style="float: left;margin-left: 0px;width: 100px;">
                                    <label for="input-small"><%=OAUser(MessageOAid,"UserName")%>:</label>
                                </div>
                                <div class="input" style="float:left;margin-left: 100px;line-height: 20px;">
                                    <%=MessageDate%>
                                    <%If MessageToOAid<>"0" Then
                                        If MessageToState="0" Then
                                            If MessagePhone_is=0 Then
                                                Response.Write "&nbsp;&nbsp;未阅&nbsp;[<a onclick='JS_SendPhone("""&ID&""","""&MessageToOAid&""")'>发送电话强提醒</a>]"
                                            Else
                                                MessagePhone_TXT=""
                                                select case MessagePhone_is
                                                case 1
                                                    MessagePhone_TXT="&nbsp;(已发送电话强提醒)"
                                                case 2
                                                    MessagePhone_TXT="&nbsp;(已接听)"
                                                case 3
                                                    MessagePhone_TXT="&nbsp;(通话中)"
                                                case 4
                                                    MessagePhone_TXT="&nbsp;(呼叫超时–用户挂机)"
                                                case 5
                                                    MessagePhone_TXT="&nbsp;(不在服务区)"
                                                case 6
                                                    MessagePhone_TXT="&nbsp;(欠费未接听)"
                                                case 7
                                                    MessagePhone_TXT="&nbsp;(拒接)"
                                                case 8
                                                    MessagePhone_TXT="&nbsp;(关机)"
                                                case 9
                                                    MessagePhone_TXT="&nbsp;(空号)"
                                                case 10
                                                    MessagePhone_TXT="&nbsp;(停机)"
                                                case 11
                                                    MessagePhone_TXT="&nbsp;(线路错误)"
                                                case 12
                                                    MessagePhone_TXT="&nbsp;(呼叫超时–系统挂机)"
                                                case 13
                                                    MessagePhone_TXT="&nbsp;(呼叫超过限制–24小时8次)"
                                                case 99
                                                    MessagePhone_TXT="&nbsp;(其它)"
 
                                                end select
                                                Response.Write "&nbsp;&nbsp;未阅"&MessagePhone_TXT&"&nbsp;[<a onclick='JS_SendPhone("""&ID&""","""&MessageToOAid&""")'>再次发送电话强提醒</a>]"
                                            End If
                                            'Response.Write "&nbsp;&nbsp;未阅"
                                        Else
                                            Response.Write "&nbsp;&nbsp;[已阅&nbsp;"&MessageToStateTime&"]"
                                        End If
                                    End If%>
                                    <%If MessageOAid=session("adminID") Or isDepartment("020119")=1 Then%>&nbsp;&nbsp;&nbsp;&nbsp;[<a href="/admin_save.gds?admin_save=108&DispatchOrdID=<%=DispatchOrdID%>&ServiceOrdID=<%=ServiceOrdID%>&MID=<%=ID%>&UrlType=ServiceOrder">删除</a>]<%End If%><br>
                                    <%=MessageContents%>
                                </div>
                            </div>
                            <%
                            rs.movenext
                        loop 
                        rs.close()
                        %>
 
                        <form id="formMessage" name="formMessage" action="admin_save.gds" method="post" style="min-width: 1110px;">
                        <input name="admin_save" type="hidden" value="107">
                        <input name="ServiceOrdID" id="ServiceOrdID" type="hidden" value="<%=ServiceOrdID%>">
                        <input name="UrlType" type="hidden" value="ServiceOrder">
                            <!--
                            <div class="buttons" style="margin: 10px 0 0 100px;">
                                <div class="highlight">
                                  <input type="button" name="submit107" value="提交留言" class="ui-state-default ui-button ui-widget ui-corner-all" onclick="formMessage_submit107();" role="button" aria-disabled="false">&nbsp;&nbsp;
                                  <!--
                                  <input type="button" name="submit48_1" value="上传图片" class="ui-state-default ui-button ui-widget ui-corner-all" onclick="formMessage_submit2();" role="button" aria-disabled="false">&nbsp;&nbsp;
                                  <input type="button" name="submit48_1" value="微信推送" class="ui-state-default ui-button ui-widget ui-corner-all" onclick="formMessage_submit3();" role="button" aria-disabled="false">&nbsp;&nbsp;
                                  ->
                                </div>
                            </div>
                            -->
                            <div class="field" style="min-height: 44px;">
                                <div class="label" style="float: left;margin-left: 0px;width: 100px;">
                                    <label for="input-small">留言:</label>
                                </div>
                                <div class="input" style="float:left;margin-left: 100px;">
                                    <textarea id="MessageContents" name="MessageContents" cols="50" rows="4" style="width:600px;" onchange="upperCase(this.name)"><%=ServiceOrdVisit%></textarea>
                                </div>
                            </div>
                        </form>
 
                    </ul>
                    </div>
                </div>
                <!-- end forms -->    
                <script LANGUAGE="javascript">
                        //提交留言(新增)
                        function formMessage_submit107(){
                        document.formMessage.action = "admin_save.gds";
                        document.formMessage.admin_save.value = "107";
                        formMessage.submit();
                        }
                </script>
                <script LANGUAGE="javascript">
                //查询电话状态
                <%If P_OAid<>"" And P_callid<>"" Then
                P_OAid=Mid(P_OAid,1,Len(P_OAid)-1)
                P_callid=Mid(P_callid,1,Len(P_callid)-1)
                %>
                    $.ajax({
                    type: "post",  
                    url: "/weixin/message_send_PhoneGetStates.gds",//需要跳转到的界面 the page you want to post data  
                    data: {  
                        OAid: '<%=P_OAid%>',//要传给后台的数据 the data you should send to background  
                        callid: '<%=P_callid%>'
                    }, 
                    success:function(data){
                        if(data == '1'){
                            //alert("电话状态查询完成");
                            return false;
                        }else{
                            //alert("电话状态查询失败!"+data);
                            return false;
                        }
                    }
                });
                <%End If%>
                //打开窗口(通知推送)
                function JS_OrdSendOAOpen()
                {
                var sTop=document.documentElement.scrollTop;
                    if (sTop==0) {sTop=document.body.scrollTop;}
                var sLeft= document.documentElement.scrollLeft;
                    if (sLeft==0) {sLeft=document.body.scrollLeft;}
                var dTop = document.getElementById("addSave").getBoundingClientRect().top;
                var dLeft = document.getElementById("addSave").getBoundingClientRect().left;
                if (dTop<200) {dTop=200;}
                if (dLeft<120) {dLeft=120;}
                OrdSendOA.style.display="block";
                OrdSendOA.style.left=(dLeft+200)+"px";
                OrdSendOA.style.top=(sTop+dTop-450)+"px";
                OrdSendOA.style.display='block';
                document.all.OrdSendOARemarks.value=document.all.ServiceOrdOperationRemarks.value;
                ServiceOrdClass=document.all.ServiceOrdClass.value;
                //alert(ServiceOrdClass);
                document.getElementsByName("OrdSendisPhone")[0].checked = true;
                if (ServiceOrdClass=='HA' || ServiceOrdClass=='TH' || ServiceOrdClass=='YN' || ServiceOrdClass=='MA' || ServiceOrdClass=='ZA' || ServiceOrdClass=='NF' || ServiceOrdClass=='EN' || ServiceOrdClass=='JA' || ServiceOrdClass=='ZN' || ServiceOrdClass=='ZY') {
                    //不强提醒
                    document.getElementsByName("OrdSendisPhone")[0].checked = false;
                }
                //JS_PaidMoneySearch();
                }
                //关闭窗口(通知推送)
                function JS_OrdSendOAClose()
                {
                    OrdSendOA.style.display="none";
                }
                //发起通知推送
                function JS_OrdSendOA() {
                    OrdSendOAid=document.all.Entourage_OrdSendOAid.value;
                    OrdSendOARemarks=document.all.OrdSendOARemarks.value;
                    OrdSendOA_Send=document.all.OrdSendOA_Send.value;
                    
                    if (OrdSendOA_Send=="发送")
                    {
                        document.all.OrdSendOA_Send.value='发送中';
                        OrdSendisPhone=0;
                        if(document.getElementsByName("OrdSendisPhone")[0].checked == true){OrdSendisPhone=1;}
                        if (OrdSendOAid!="")
                        {
                            $.ajax({
                                type: "post",  
                                url: "/weixin/message_send_OrderOA.gds",//需要跳转到的界面 the page you want to post data  
                                data: {  
                                    ServiceOrdID: '<%=ServiceOrdID%>',//要传给后台的数据 the data you should send to background  
                                    OAid: OrdSendOAid,
                                    OrdSendOARemarks: OrdSendOARemarks,
                                    isPhone: OrdSendisPhone
                                }, 
                                success:function(data){
                                    if(data == '1'){
                                        JS_OrdSendOAClose();
                                        alert("发送成功");
                                        return false;
                                    }else{
                                        alert("提交失败,请重试!"+data);
                                        return false;
                                    }
                                    document.all.OrdSendOA_Send.value='发送';
                                }
                            });
                        }
                        else {
                            alert("请先选择收件人!");
                            return false;
                        }
                    }
                }
                //发起电话通知
                function JS_SendPhone(ID,ToOAid) {
                    if (ToOAid!="")
                    {
                        $.ajax({
                            type: "post",  
                            url: "/weixin/message_send_Phone.gds",//需要跳转到的界面 the page you want to post data  
                            data: { 
                                ID: ID,
                                OAid: ToOAid
                            }, 
                            success:function(data){
                                if(data == '1'){
                                    JS_OrdSendOAClose();
                                    alert("电话通知成功");
                                    return false;
                                }else{
                                    alert("提交失败,请重试!"+data);
                                    return false;
                                }
                            }
                        });
                    }
                    else {
                        alert("请先选择收件人!");
                        return false;
                    }
                }
            </script>
            <!--发送订单通知-->
            <div class="dialogJ  dialogJfix dialogJshadow" id="OrdSendOA" style="width: 370px; right: 300px; top: 150px;display:none;z-index: 100;">
            
                <div class="dialogJtitle">
                    <a href="javascript:JS_OrdSendOAClose();" class="dialogJclose" title="关闭本窗口">&nbsp;</a>
                    <span class="dialogJtxt" id="EditPhotoTXT">发送订单通知</span>
                </div>
                <form id="formOrdSendOA" name="formOrdSendOA" action="admin_save.gds" method="post">
                
                <input id="Entourage_OrdSendOAid" name="OrdSendOAid" type="hidden" value="<%=OrdSendOAid%>">
                <div class="dialogJcontent">
                    <div class="dialogJbody" id="dialogJbody" style="height: 210px;">
                        <div class="modify-album-name">
                            <span>通知人员:</span>
                            <input type="text" id="EntourageName_OrdSendOAid" name="OrdSendOAName" class="small" onclick="javascript:JS_EntourageOpen('OrdSendOAid','OrdSendOA');" style="width:258px;" value="<%=UnitIntroducer(OrdSendOAid,"UnitName")%>" readonly="true">
                        </div>
                        <div class="modify-album-name">
                            <span>留言:</span>
                            <textarea id="OrdSendOARemarks" name="OrdSendOARemarks" cols="50" rows="5" style="width:322px;"></textarea>
                        </div>
                        <div class="modify-album-name">
                            <span>电话强提醒:</span>
                            <input type="checkbox" name="OrdSendisPhone" id="OrdSendisPhone" style="width: 20px;">
                        </div>
                    </div>
                </div>
                </form>
                <div class="dialogJanswers">
                    <input type="button" class="dialogJbtn first-child" id="OrdSendOA_Send" onclick="JS_OrdSendOA()" value="发送"> 
                    <input type="button" class="dialogJbtn" onclick="JS_OrdSendOAClose()" value="取消">
                </div>
            </div>
            <!--发送订单通知 end-->
                <%End if%>
 
                <!-- forms -->
                <div class="box">
                    <!-- box / title -->
                    <div class="title<%If NEWOrder="2" then%> title4<%ElseIf ServiceOrdState="1" And NEWOrder<>"1" then%> title1<%ElseIf OrdClass="AB" then%> title2<%Else%> title3<%End if%>">
                        <h5><%=OrdClassName%>&nbsp;&nbsp;<%=UnitUser(ServiceOrdUnitID,"UnitShort")%>&nbsp;<%=OrderLevelA(OrderLevel)%></h5>
                        <ul class="links">
                            <%If ServiceOrdID="" Then%>
                            <li>
                                <div class="search">
                                <div id="OrdClass_container" class="select-container" style="overflow: hidden;cursor:pointer" onclick="JS_OrdClassType()">
                                    <span class="select-content" style="width: 46px;">单据类型:<%=OrderClassB(ServiceOrdClass,"vtext")%></span><span class="arrow" id="OrdClass_arrow"></span>
                                </div>
                                <div id="OrdClass_list" class="select-list scroll-pane" style="overflow: hidden; position: absolute; background-color: white; width: 280px; display: none;background-position: initial initial; background-repeat: initial initial;margin-left: 10px;">
                                    <div class="jspContainer">
                                        <div style="padding: 0px; top: 0px;">
                                        <%admin_OrderClassPS=SPLIT(admin_OrderClass,",")
                                        OrdClassType=""
                                        for z = 0 to UBOUND(admin_OrderClassPS)
                                            If OrderClassB(admin_OrderClassPS(z),"vType")="1" Then
                                            OrdClassType=OrdClassType&","&admin_OrderClassPS(z)
                                            %>
                                              <span title="<%=vtext%>" onmouseover="JS_OrdClassTypeMouseover('OrdClassType_<%=admin_OrderClassPS(z)%>')" onclick="form1_OrdClass('<%=admin_OrderClassPS(z)%>')" id="OrdClassType_<%=admin_OrderClassPS(z)%>" class="list-option<%if admin_OrderClassPS(z)=OrdClassName then Response.Write "  option"%>"><%=OrderClassB(admin_OrderClassPS(z),"vtext")%></span>
                                            <%End If
                                        Next
                                        OrdClassTypePS=SPLIT(OrdClassType,",")
                                        %>
                                        </div>
                                    </div>
                                </div>
                                </div>
                            </li>
                            <script LANGUAGE="javascript">
                            //单据类型显示下拉菜单
                            function JS_OrdClassType(){
                              if (OrdClass_container.className!="select-container select-container-show-list"){
                                OrdClass_container.className="select-container select-container-show-list";
                                OrdClass_arrow.className="arrow arrow-up";
                                OrdClass_list.style.display="block";
                                //Date_arrow.className="arrow";
                                //Date_list.style.display="none";
                                //OrdDateTypeCreate.style.display="none";
                              }
                              else {
                                OrdClass_container.className="select-container";
                                OrdClass_arrow.className="arrow";
                                OrdClass_list.style.display="none";
                              }
                            }
                            //单据类型指针移动到下拉菜单
                            function JS_OrdClassTypeMouseover(id){
                              var d=document.getElementById(id);
                              <%for z = 1 to UBOUND(OrdClassTypePS)
                              %>
                              document.getElementById("OrdClassType_<%=OrdClassTypePS(z)%>").className="list-option";
                              <%next%>
                              d.className="list-option option";
                            }
                            </script>
                            <%End If%>
                          <%If NEWOrder<>"2" then%>
                            <%If isDepartment("020101")=1 then%><li><a href="ServiceOrder.gds?Phone=<%=Phone%>&NEWOrder=1">新服务单</a></li><%End if%>
                            <%If ServiceOrdID<>"" Then%>
                            <!--发送短信-->
                            <%
                            '短信模板
                            sql="select vtext,vOrder2 from dictionary where vtitle in ('SMS') and vType=1 order by id desc"
                            rs.open sql,objConn,1,1
                            SMS_dictionary="短信模板:<br>"
                            do while not rs.Eof
                              vtext        = rs("vtext")
                              vOrder2    = rs("vOrder2")
                              vOrder2    = Replace(vOrder2," ","")
                              SMS_dictionary=SMS_dictionary&"&nbsp;<a onclick=JavaScript:document.getElementById('New_Send_Text').value='"&vOrder2&"';JS_SendText_Len();>"&vtext&"</a><br>"
                             rs.movenext
                            Loop
                            SMS_dictionary=SMS_dictionary&"<br>"
                            rs.close()
                            %>
                            <!--<li><a onclick="JS_smsTosend('','')">短信发送</a></li>-->
                            <li><a href="SMS_List.gds?searchTXT=ServiceOrdID:<%=ServiceOrdID%>" target="_blank">相关短信记录</a></li>
                            <li><a href="Log_List.gds?searchTXT=ServiceOrdID:<%=ServiceOrdID%>" target="_blank">相关操作记录</a></li>
                            <script LANGUAGE="javascript">
                                //新建短信发送-关闭上传窗口
                                function JS_SMSCreateClose()
                                {
                                SMSCreate.style.display="none";
                                }
                                //短信发送
                                function JS_SMSCreateSave()
                                {
                                formSMS.submit();
                                }
                                //显示发送短信窗口
                                function JS_smsTosend(Send_Phone,Send_Text)
                                {
                                    var sTop=document.documentElement.scrollTop;
                                        if (sTop==0) {sTop=document.body.scrollTop;}
                                    var sLeft= document.documentElement.scrollLeft;
                                        if (sLeft==0) {sLeft=document.body.scrollLeft;}
                                    var dTop = document.getElementById("form1").getBoundingClientRect().top;
                                    var dLeft = document.getElementById("form1").getBoundingClientRect().right;
                                    if (dTop<200) {dTop=400;}
                                    if (dLeft<120) {dLeft=500;}
                                    SMSCreate.style.display="block";
                                    SMSCreate.style.right="100px";
                                    SMSCreate.style.top=(sTop+dTop-200)+"px";
                                    Send_Phone=document.getElementById("ServiceOrdCoPhone").value;
                                    document.getElementById('New_Send_Phone').innerHTML = Send_Phone; 
                                    document.getElementById('New_Send_Text').innerHTML = Send_Text;
                                    JS_SendText_Len();
                                    document.formSMS.admin_save.value='96';
                                }
                                //输入字符数量
                                function JS_SendText_Len()
                                {
                                    var smsAutograph=document.getElementById('smsAutograph').innerHTML;
                                    var Send_Text=document.getElementById('New_Send_Text').value;
                                    document.getElementById('Send_Text_Len').innerHTML = "<%=SMS_dictionary%>内容:"+Send_Text.length+"个字符 + 签名"+smsAutograph.length+"个字符<br>共计:"+(Send_Text.length+smsAutograph.length)+"个字符"
                                }
 
                            </script>
                            <div class="dialogJ  dialogJfix dialogJshadow" id="SMSCreate" style="width:500px; right: 300px; top: 150px;display:none;z-index: 10;">
                            
                                <div class="dialogJtitle">
                                    <a href="javascript:JS_SMSCreateClose();" class="dialogJclose" title="关闭本窗口">&nbsp;</a>
                                    <span class="dialogJtxt" id="EditPhotoTXT">短信发送</span>
                                </div>
                                <form id="formSMS" name="formSMS" action="admin_save.gds" method="post">
                                <input name="admin_save" type="hidden" value="96">
                                <%Send_Remarks="ServiceOrdID:"&ServiceOrdID%>
                                <input name="Send_Remarks" type="hidden" value="<%=Send_Remarks%>">
                                <input name="ReturnURL" type="hidden" value="ServiceOrder">
                                <input name="searchTXT" type="hidden" value="<%=searchTXT%>">
                                <input name="page" type="hidden" value="<%=request("page")%>">
                                <div class="dialogJcontent">
                                    <div class="dialogJbody" id="dialogJbody">
                                        <div class="modify-album-name" style="border-bottom: 1px solid #cdcdcd;padding: 10px 21px;">
                                            <span>手机号码:</span>
                                            <textarea name="Send_Phone" id="New_Send_Phone" style="width:200px;height:130px;"></textarea>
                                                <span>同时对多个手机进行发送,<br>
                                                    每个手机号码占一行<br>
                                                    例如:<br>
                                                    13195606061<br>
                                                    13119560607</span>
                                        </div>
                                        <div class="modify-album-name" style="border-bottom: 1px solid #cdcdcd;padding: 0px 21px;">
                                            <span>短信内容:</span>
                                            <textarea name="Send_Text" id="New_Send_Text" style="width:200px;height:200px;" onKeyDown="JS_SendText_Len()" onKeyUp="JS_SendText_Len()"></textarea>
                                            <span id="Send_Text_Len"><%=SMS_dictionary%>内容:4个字符 + 签名6个字符<br>共计:10个字符</span>
                                        </div>
                                        <div class="modify-album-name" style="border-bottom: 1px solid #cdcdcd;padding: 0px 21px;">
                                            <span>使用签名:</span>
                                            <span id="smsAutograph">【医疗快线】</span>
                                            
                                        </div>
                                    </div>
                                </div>
                                </form>
                                <div class="dialogJanswers" style="padding: 10px 20px 13px 18px;">
                                    <input type="button" id="formSMS_submit" class="dialogJbtn first-child" onclick="JS_SMSCreateSave()" value="发送"> 
                                    <input type="button" class="dialogJbtn" onclick="JS_SMSCreateClose()" value="取消">
                                </div>
                            </div>
 
                            <script LANGUAGE="javascript">
                                //微信服务通知-关闭窗口
                                function JS_WXSMSCreateClose()
                                {
                                WXSMSCreate.style.display="none";
                                }
                                //微信服务通知发送
                                function JS_WXSMSCreateSave()
                                {
                                formWXSMS.submit();
                                }
                                //显示发送微信服务通知窗口
                                function JS_WXSMSTosend(wx_APPID,wx_openid,wx_UserID,wx_template_id,wx_form_id,wx_page,wx_keyword1,wx_keyword2,wx_keyword3,wx_keyword4,wx_keyword5,wx_keyword6)
                                {
                                    var sTop=document.documentElement.scrollTop;
                                        if (sTop==0) {sTop=document.body.scrollTop;}
                                    var sLeft= document.documentElement.scrollLeft;
                                        if (sLeft==0) {sLeft=document.body.scrollLeft;}
                                    var dTop = document.getElementById("form1").getBoundingClientRect().top;
                                    var dLeft = document.getElementById("form1").getBoundingClientRect().right;
                                    if (dTop<200) {dTop=400;}
                                    if (dLeft<120) {dLeft=500;}
                                    WXSMSCreate.style.display="block";
                                    WXSMSCreate.style.right="100px";
                                    WXSMSCreate.style.top=(sTop+dTop-200)+"px";
                                    document.getElementById('wx_APPID').value = wx_APPID; 
                                    document.getElementById('wx_openid').value = wx_openid;
                                    document.getElementById('wx_UserID').value = wx_UserID;
                                    document.getElementById('wx_template_id').value = wx_template_id;
                                    document.getElementById('wx_form_id').value = wx_form_id;
                                    document.getElementById('wx_page').value = wx_page;
                                    document.getElementById('wx_keyword1').value = wx_keyword1;
                                    document.getElementById('wx_keyword2').value = wx_keyword2;
                                    document.getElementById('wx_keyword3').value = wx_keyword3;
                                    document.getElementById('wx_keyword4').value = wx_keyword4;
                                    document.getElementById('wx_keyword5').value = wx_keyword5;
                                    document.getElementById('wx_keyword6').value = wx_keyword6;
 
                                    document.formWXSMS.admin_save.value='109';
                                }
 
                            </script>
                            <div class="dialogJ  dialogJfix dialogJshadow" id="WXSMSCreate" style="width:500px; right: 300px; top: 150px;display:none;z-index: 10;">
                                <div class="dialogJtitle">
                                    <a href="javascript:JS_WXSMSCreateClose();" class="dialogJclose" title="关闭本窗口">&nbsp;</a>
                                    <span class="dialogJtxt" id="EditPhotoTXT">微信服务通知发送</span>
                                </div>
                                <form id="formWXSMS" name="formWXSMS" action="admin_save.gds" method="post">
                                <input name="admin_save" type="hidden" value="109">
                                <%Send_Remarks="ServiceOrdID:"&ServiceOrdID%>
                                <input name="Send_Remarks" type="hidden" value="<%=Send_Remarks%>">
                                <input name="ReturnURL" type="hidden" value="ServiceOrder">
                                <input name="searchTXT" type="hidden" value="<%=searchTXT%>">
                                <input name="APPID" id="wx_APPID" type="hidden" value="">
                                <input name="openid" id="wx_openid" type="hidden" value="">
                                <input name="UserID" id="wx_UserID" type="hidden" value="">
                                <input name="template_id" id="wx_template_id" type="hidden" value="">
                                <input name="form_id" id="wx_form_id" type="hidden" value="">
                                <input name="page" id="wx_page" type="hidden" value="">
 
                                <div class="dialogJcontent">
                                    <div class="dialogJbody" id="dialogJbody">
                                        <div class="modify-album-name">
                                            <span>服务名称:</span>
                                            <input id="wx_keyword1" name="keyword1" type="text" value="" maxlength="99/">
                                        </div>
                                        <div class="modify-album-name">
                                            <span>起始地:</span>
                                            <input id="wx_keyword2" name="keyword2" type="text" value="" maxlength="99/">
                                        </div>
                                        <div class="modify-album-name">
                                            <span>目的地:</span>
                                            <input id="wx_keyword3" name="keyword3" type="text" value="" maxlength="99/">
                                        </div>
                                        <div class="modify-album-name">
                                            <span>订单价格:</span>
                                            <input id="wx_keyword4" name="keyword4" type="text" value="" maxlength="99/">
                                        </div>
                                        <div class="modify-album-name">
                                            <span>定金金额:</span>
                                            <input id="wx_keyword5" name="keyword5" type="text" value="" maxlength="99/">
                                        </div>
                                        <div class="modify-album-name">
                                            <span>支付提醒:</span>
                                            <input id="wx_keyword6" name="keyword6" type="text" value="" maxlength="99/">
                                        </div>
                                    </div>
                                </div>
                                </form>
                                <div class="dialogJanswers" style="padding: 10px 20px 13px 18px;">
                                    <input type="button" id="formWXSMS_submit" class="dialogJbtn first-child" onclick="JS_WXSMSCreateSave()" value="发送"> 
                                    <input type="button" class="dialogJbtn" onclick="JS_WXSMSCreateClose()" value="取消">
                                </div>
                            </div>
                            <!--发送短信  end-->
                            <%End If%>
                          <%End if%>
                            <%
                            if PositionURLID="1" then PositionURLID=11
                            ReturnURL=session("PositionURL"&PositionURLID-1)
                            if InStr(ReturnURL,"?")<1 then
                              ReturnURL=ReturnURL&"?ReturnURLID="&(PositionURLID-1)
                            else
                              ReturnURL=ReturnURL&"&ReturnURLID="&(PositionURLID-1)
                            end if
                            %>
                            <li><a href="<%=ReturnURL%>">返回</a></li>
                        </ul>
                    </div>
                    <!-- end box / title -->
                    <!--#include virtual="/inc/SystemMessages.gds" -->
 
                    <form id="form1" name="form1" action="admin_save.gds" method="post" style="min-width: 1110px;">
                    <input name="admin_save" type="hidden" value="19">
                    <input name="ServiceOrdID" type="hidden" value="<%=ServiceOrdID%>">
                    <input name="Phone" type="hidden" value="<%=Phone%>">
                    <input name="ServiceOrdState" type="hidden" value="<%=ServiceOrdState%>">
                    <input name="ServiceOrd_Check" type="hidden" value="">
                    <input name="NEWOrder" type="hidden" value="<%=NEWOrder%>">
                    <input name="MessageContents_form1" id="MessageContents_form1" type="hidden" value="">
                    <div class="form">
                        <div class="fields">
                            <div class="field  field-first">
                                <div class="label" style="float: left;margin-left: 0px;">
                                    <label for="input-small">单据编号:</label>
                                </div>
                                <div class="input" style="float:left;margin-left: 74px;">
                                    <input type="text" id="ServiceOrdID_TXT" name="ServiceOrdID_TXT" class="small <%If ServiceOrdState=4 then%>error<%else%>valid<%End if%>" style="width: 98px;" value="<%=ServiceOrdID_TXT%>" readonly="true">
                                </div>
                                <div class="label" style="float: left;margin-left:188px;">
                                    <label for="input-small">单据类型:</label>
                                </div>
                                <div class="input" style="float:left;margin-left:62px;">
                                    <select name="ServiceOrdAreaType" id="ServiceOrdAreaType" <%If InStr(error,",ServiceOrdAreaType,")>0 Or ServiceOrdAreaType="" Or ServiceOrdAreaType="0" Then Response.Write " style=""width:74px;height:28px;background-color:#FBE3E4;border:1px solid #FBC2C4;""" Else Response.Write  " style=""width:74px;height:28px;"" class=""select""" %> onchange="upperCase(this.name)">
                                        <%If ServiceOrdID="" Then
                                            'Response.Write "<option value="""">选择</option>"
                                        End If%>
                                        <%
                                        sql="select vID,vtext from dictionary where vtitle='ServiceOrdAreaType' and vType=1 order by vOrder"
                                        rs.open Sql,objConn,1,1
                                        do while not rs.Eof%>
                                        <option value="<%=rs("vID")%>"<%if ServiceOrdAreaType=rs("vID") then Response.Write " selected"%>><%=rs("vtext")%></option>
                                        <%rs.movenext
                                          Loop
                                          rs.close()%>
                                    </select>
                                    <select name="ServiceOrdType" id="ServiceOrdType" <%If InStr(error,",ServiceOrdType,")>0 Or ServiceOrdType="" Or ServiceOrdType="0" Then Response.Write " style=""width:64px;height:28px;background-color:#FBE3E4;border:1px solid #FBC2C4;""" Else Response.Write  " style=""width:64px;height:28px;"" class=""select""" %> onchange="form1_FromAddress();upperCase(this.name)">
                                        <%If ServiceOrdID="" Then
                                            'Response.Write "<option value="""">选择</option>"
                                        End If%>
                                        <%If ServiceOrdClass="AB" Then OrdClassSql=" and vID=5 "
                                        If InStr(admin_OrderClass,"BF")>=0 And (ServiceOrdClass="" Or ServiceOrdClass="BF") Then
                                            sql="select vID,vtext from dictionary where vtitle='ServiceOrderType' and vType>=1 "&OrdClassSql&" order by vOrder"
                                        Else
                                            sql="select vID,vtext from dictionary where vtitle='ServiceOrderType' and vType=1 "&OrdClassSql&" order by vOrder"
                                        End If
                                        rs.open Sql,objConn,1,1
                                        do while not rs.Eof%>
                                        <option value="<%=rs("vID")%>"<%if ServiceOrdType=rs("vID") then Response.Write " selected"%>><%=rs("vtext")%></option>
                                        <%rs.movenext
                                          Loop
                                          rs.close()%>
                                    </select>
                                    <%If ServiceOrdID="" Or ServiceOrdUnitID<>"0" Or ServiceOrdState<3 Then%>
                                    <select name="ServiceOrdClass" id="ServiceOrdClass" style="width:90px;height:28px;" class="select" onchange="form1_FromAddress();upperCase(this.name);">
                                        <%admin_OrderClassPS=SPLIT(admin_OrderClass,",")
                                            isOrderClass=0
                                            ClassAddressS=""
                                            for z = 0 to UBOUND(admin_OrderClassPS)
                                                If OrderClassB(admin_OrderClassPS(z),"UnitState")<>"0" Then
                                                    sql="select ServiceAddress from IntroducerUnitData where UnitState>0 and ServiceAddress_lat is not null and ServiceAddress_lng is not null and ServiceBranch='"&admin_OrderClassPS(z)&"'"
                                                    rs.open sql,objConn,1,1
                                                    if not rs.Eof Then
                                                        ClassAddress=rs("ServiceAddress")
                                                    Else
                                                        ClassAddress=""
                                                    End If
                                                    rs.close()
                                                    ClassAddressS=ClassAddressS&"|"&admin_OrderClassPS(z)&";"&ClassAddress
                                                    If ServiceOrdClass=admin_OrderClassPS(z) Then
                                                        isOrderClass=1
                                                        FromAddress=ClassAddress
                                                    End If%>
                                                  <option value="<%=admin_OrderClassPS(z)%>"<%if ServiceOrdClass=admin_OrderClassPS(z) then Response.Write " selected"%>><%=OrderClassB(admin_OrderClassPS(z),"vtext")%></option>
                                                <%End If
                                            Next
                                            If isOrderClass=0 Then%>
                                            <option value="<%=ServiceOrdClass%>" selected><%=OrderClassB(ServiceOrdClass,"vtext")%></option>
                                            <%
                                            End If
                                            %>
                                    </select>
                                    <script LANGUAGE="javascript">
                                        function form1_FromAddress(){
                                            OrdClass = document.form1.ServiceOrdClass.value;
                                            OrdType = document.form1.ServiceOrdType.value;
                                            FromAddress='';
                                            <%ClassAddressPS=SPLIT(ClassAddressS,"|")
                                            for z = 1 to UBOUND(ClassAddressPS)
                                                ClassAddressPSs=SPLIT(ClassAddressPS(z),";")
                                                %>
                                                if(OrdClass=='<%=ClassAddressPSs(0)%>') {
                                                    FromAddress='<%=ClassAddressPSs(1)%>';
                                                }
                                            <%Next%>
                                            document.form1.ServiceOrdTraStreet.value = FromAddress;
                                            if(OrdType=='5' || OrdType=='8') {    //航空、高铁、包机这三个类型,下发调度单后,精简一下流程
                                                document.getElementById("TransferModeID_6").checked = true;
                                            } else {
                                                document.getElementById("TransferModeID_6").checked = false;
                                            }
                                            
                                            <%If ServiceOrd_AP_Check<>"1" Then%>if (document.form1.ServiceOrdTraDistance.value!=''){lbs_addressdistance();}<%end if%>
                                        }
                                    </script>
                                    <%else%>
                                    <input name="ServiceOrdClass" type="hidden" value="<%=ServiceOrdClass%>">
                                    <input type="text" name="ServiceOrdClassTXT" class="small valid" style="width:84px;float:none;" value="<%=OrderClassB(ServiceOrdClass,"vtext")%>" readonly="true">
                                    <%End If%>
                                </div>
                                <div class="label" style="float: left;margin-left: 488px;">
                                    <label for="input-small">单据状态:</label>
                                </div>
                                <div class="input" style="float:left;margin-left: 62px;">
                                    <input type="text" id="ServiceOrdStateTXT" name="ServiceOrdStateTXT" class="small <%If ServiceOrdState=4 then%>error<%else%>valid<%End if%>" style="width:132px;" value="<%=ServiceOrdStateTXT%>" readonly="true">
                                </div>
 
                                <div class="label" style="float: left;margin-left: 696px">
                                    <label for="input-small">开单时间:</label>
                                </div>
                                <div class="input" style="float:left;margin-left: 58px;">
                                    <input type="text" id="ServiceOrdStartDate" name="ServiceOrdStartDate" class="small valid" style="width:122px;" value="<%=ServiceOrdStartDate%>" readonly="true">
                                </div>
                            
                            </div>
 
                            <%'取消原因
                            If ServiceOrdCancelReason<>"" And ServiceOrdCancelReason<>"0" then%>
                            <div class="field">
                                        <div class="label" style="float: left;margin-left: 0px;"><label for="input-small">取消原因:</label></div>
                                        <div class="input" style="float:left;margin-left: 70px;">
                                            <input type="text" id="ServiceOrdCancelReason" name="ServiceOrdCancelReason" class="small error" style="width:132px;" value="<%=CancelReasonA(ServiceOrdCancelReason)%>" readonly="true">
                                        </div>
                                        <div class="label" style="float: left;margin-left: 247px;"><label for="input-small">备注:</label></div>
                                        <div class="input" style="float:left;margin-left: 70px;">
                                            <input type="text" id="ServiceOrdCancelReasonTXT" name="ServiceOrdCancelReasonTXT" class="small error" style="width:432px;" value="<%=ServiceOrdCancelReasonTXT%>" readonly="true">
                                        </div>
                            </div>
                            <%End if%>
 
                            <div class="field">
                                        <%'客服人员
                                        If ServiceOrd_CC_ID="" Or ServiceOrd_CC_ID="0" Then ServiceOrd_CC_ID=session("adminID")
                                        If ServiceOrd_CC_ID<>"" Then ServiceOrd_CC_Name=OAUser(ServiceOrd_CC_ID,"UserName")
                                        EntourageID="-1"
                                        departmentID="9"
                                        %>
                                        <div class="label" style="float: left;margin-left: 0px;"><label for="input-small">客服:</label></div>
                                        <div class="input" style="float:left;margin-left: 70px;">
                                            <input id="Entourage_<%=EntourageID%>" name="ServiceOrd_CC_ID" type="hidden" value="<%=ServiceOrd_CC_ID%>">
                                            <input type="text" id="EntourageName_<%=EntourageID%>" name="ServiceOrd_CC_Name" class="small" <%If ServiceOrd_CC_ID="" Or isDepartment("020116")=1 Then%>onclick="javascript:JS_EntourageOpen('<%=EntourageID%>','-<%=departmentID%>');"<%End If%> style="width:138px;" value="<%=ServiceOrd_CC_Name%>" readonly="true">
                                        </div>
 
                                        <%'销售人员
                                        If ServiceOrd_Sale_ID<>"" Then ServiceOrd_Sale_Name=OAUser(ServiceOrd_Sale_ID,"UserName")
                                        EntourageID="-3"
                                        departmentID="128"
                                        %>
                                        <div class="label" style="float: left;margin-left: 226px;"><label for="input-small">销售:</label></div>
                                        <div class="input" style="float:left;margin-left: 76px;">
                                            <input id="Entourage_<%=EntourageID%>" name="ServiceOrd_Sale_ID" type="hidden" value="<%=ServiceOrd_Sale_ID%>">
                                            <input type="text" id="EntourageName_<%=EntourageID%>" name="ServiceOrd_Sale_Name"  <%If isDepartment("010601")=1 Then%>onclick="javascript:JS_EntourageOpen('<%=EntourageID%>','-<%=departmentID%>');" value="<%=ServiceOrd_Sale_Name%>" class="small"<%else%>class="small valid"<%End If%> style="width:136px;" readonly="true">
                                        </div>
 
                                        <div class="label" style="float: left;margin-left: 452px;"><label for="input-small">介绍人:</label></div>
                                        <%If RecommendUserID<>"0" And RecommendUserID<>"" Then
                                            If ServiceOrdIntroducer<>"0" And ServiceOrdIntroducer<>"" Then
                                                ServiceOrdIntroducerTXT=UnitIntroducer(ServiceOrdIntroducer,"UnitName")&" - "&WX_RUID(RecommendUserID)
                                            Else
                                                ServiceOrdIntroducerTXT="个人介绍 - "&WX_RUID(RecommendUserID)
                                            End If
                                        Else
                                            ServiceOrdIntroducerTXT=UnitIntroducer(ServiceOrdIntroducer,"UnitName")
                                        End If%>
                                        <div class="input" style="float:left;margin-left: 70px;">
                                            <input id="Entourage_ServiceOrdIntroducer" name="ServiceOrdIntroducer" type="hidden" value="<%=ServiceOrdIntroducer%>">
                                            <input type="text" id="EntourageName_ServiceOrdIntroducer" name="ServiceOrdIntroducerName" <%If isDepartment("010602")=1 Then%> onclick="javascript:JS_EntourageOpen('ServiceOrdIntroducer','ServiceOrdIntroducer');" value="<%=ServiceOrdIntroducerTXT%>" class="small"<%else%>class="small valid"<%End If%> style="width:133px;" value="<%=ServiceOrdIntroducerTXT%>" readonly="true">
                                        </div>
                                        
 
                                        <div class="label" style="float: left;margin-left: 682px;"><label for="input-small">电话来源:</label></div>
                                        <div class="input" style="float:left;margin-left: 72px;">
                                        <select name="ServiceOrdSource" id="ServiceOrdSource" <%If InStr(error,",ServiceOrdSource,")>0 Or ServiceOrdSource="" Or ServiceOrdSource="0" Then Response.Write " style=""width:138px;height:30px;background-color:#FBE3E4;border:1px solid #FBC2C4;""" Else Response.Write  " style=""width:138px;"" class=""select1""" %> onchange="upperCase(this.name)">
                                            <option value="">无指定</option>
                                            <%
                                            If ServiceOrdSource="" Then ServiceOrdSource=0
                                            sql="select vID,vtext from dictionary where vtitle in ('OrdSource') and (vType=1 or vID="&ServiceOrdSource&") order by vOrder"
                                            rs.open sql,objConn,1,1
                                            do while not rs.Eof
                                              vID    = rs("vID")
                                              vtext    = rs("vtext")
                                              %>
                                              <option value="<%=vID%>"<%if Clng(ServiceOrdSource)=Clng(vID) then Response.Write " selected"%>><%=vtext%></option>
                                              <%
                                             rs.movenext
                                            Loop
                                            rs.close()%>
                                        </select>
                                        
                                        </div>
                            </div>
                            <div class="field">
                                <!-- 开单人 -->
                                <%
                                EntourageID_OpenUser = "-8"
                                departmentID_OpenUser = "9"
                                OpenUserID = ""
                                OpenUserName = ""
                                OpenUserRatio = ""
                                OpenerAndFollowerEnableModify = False
                                if isDepartment("020140")=1 then
                                    OpenerAndFollowerEnableModify=True
                                End If
 
                                If ServiceOrdID<>"" Then
                                    openSql="select * from ServiceOrderCommissionDetails where ServiceOrderID="&ServiceOrdID&" and PersonType='Opener'"
                                    rs.open openSql,objConn,1,1
                                    If not rs.Eof Then
                                    OpenUserID = rs("PersonID")
                                    OpenUserName = rs("PersonName")
                                    OpenUserRatio = rs("CommissionRatio")
                                    End If
                                    rs.close()
                                End If
                                %>
                                
                                <div class="label" style="float: left;margin-left: 0px;"><label for="input-small">开单人:</label></div>
                                <div class="input" style="float:left;margin-left: 70px;">
                                    <input id="Entourage_<%=EntourageID_OpenUser%>" name="OpenUserID" type="hidden" value="<%=OpenUserID%>">
                                    <input type="text" id="EntourageName_<%=EntourageID_OpenUser%>" name="OpenUserName" <% if OpenerAndFollowerEnableModify=False Then%> disabled <% end If%> class="small" <%If OpenUserID="" Or OpenerAndFollowerEnableModify=True Then%>onclick="javascript:JS_EntourageOpen('<%=EntourageID_OpenUser%>','-<%=departmentID_OpenUser%>');"<%End If%> style="width:138px;" value="<%=OpenUserName%>" readonly="true">
                                </div>
                                <%
                                    followerCount = 0
                                    showFollower = False
                                    If ServiceOrdID<>"" Then
                                        followerSqlCount="select count(1) from ServiceOrderCommissionDetails where ServiceOrderID="&ServiceOrdID&" and PersonType='Follower'"
                                        rs.open followerSqlCount,objConn,1,1
                                        If Not rs.EOF Then
                                            ' 获取查询结果
                                            followerCount = rs.Fields(0).Value
                                            if followerCount>0 then
                                                showFollower = True
                                            else
                                                showFollower = False
                                            end if
                                        Else
                                            ' 如果记录集为空,将结果设为 0
                                            followerCount = 0
                                            showFollower = False
                                        End If
                                        rs.close()
                                    End If
                                    EditFollower=True
                                    showTopFollowerAdd=True
                                    if showFollower=True then
                                        showTopFollowerAdd=False
                                    End If
                                    if OpenerAndFollowerEnableModify=False Then
                                        EditFollower=False
                                        showTopFollowerAdd=False
                                    End If
                                    
                                    
 
                                %>
                                
                                <div class="label" style="float: left;margin-left: 226px;"><label for="input-small">提成比例(%):</label></div>
                                <div class="input" style="float:left;margin-left: 86px;">                                
                                    <input type="text" id="OpenUserRatio" name="OpenUserRatio" <% if EditFollower=False Then%> disabled <% end If%> value="<%=OpenUserRatio%>" class="small" style="width:50px;">
                                </div>
                                <div class="input" style="float:left;margin-left: 10px;">
                                <button class="ui-state-default" <% If showTopFollowerAdd=False then %> style='display:none' <% End If%> id="inputTopAddFollower" onclick="return showFollower();">添加跟单人</button>
                                </div>
                                </div>
                            
                                <div class="field" id="followerDiv" <% If showFollower<>True  then %> style="display:none;" <% end if%>>
                                    <!-- 跟单人 -->
                                    <input type="hidden" id="hidFollowerCount" name="FollowersCount" value="<%=followerCount%>"/>
                                    <div class="label" style="float: left;margin-left: 10px;"><label for="input-small">跟单人:</label></div>
                                    <div class="input" style="float:left;margin-left: 70px;">
                                        <div id="FollowersList">
                                            <%
                                            FollowerCount = 1
                                            EntourageID_Follower = "-9"
                                            departmentID_Follower = "9"            
                                            if ServiceOrdID<>"" then                            
                                                followerSql="select * from ServiceOrderCommissionDetails where ServiceOrderID="&ServiceOrdID&" and PersonType='Follower'"
                                                rs.open followerSql,objConn,1,1
                                                FollowerIndex=1
                                                do while not rs.Eof
                                                    FollowerID = rs("PersonID")
                                                    FollowerName = rs("PersonName")
                                                    FollowerRatio = rs("CommissionRatio")
 
                                            %>
                                            <div class="follower-item">
                                                <input  name="FollowerID_<%=FollowerIndex%>" id="FollowerId_<%=FollowerIndex%>" type="hidden" value="<%=FollowerID%>">
                                                <input type="text" name="FollowerName_<%=FollowerIndex%>"  <% if EditFollower=False Then %> disabled <% End If%> id="FollowerName_<%=FollowerIndex%>" class="small" <%If FollowerID="" Or isDepartment("020140")=1 Then%>onclick="javascript:JS_EntourageOpen('<%=EntourageID_Follower%>_<%=FollowerCount%>','-<%=departmentID_Follower%>');"<%End If%> style="width:138px;" value="<%=FollowerName%>" readonly="true">
                                                <div class="label" style="float: left;margin-left: 226px;"><label for="input-small">提成比例(%):</label></div>
                                                <div class="input" style="float:left;margin-left: 87px;">
                                                    <input type="text" id="FollowerRatio_<%=FollowerIndex%>"  <% if EditFollower=False Then %> disabled <% End If%> name="FollowerRatio_<%=FollowerIndex%>" class="small" style="width:50px;" value="<%=FollowerRatio%>" />
                                                </div>
                                                <div class="input" style="float:left;margin-left: 10px;"> 
                                                    <button <% if EditFollower=False Then %> style="display:none" <% End If%> onclick="return removeFollower();">删除</button>
                                                </div>
                                            </div>
                                            <%
                                                FollowerIndex=FollowerIndex+1
                                                rs.movenext
                                                loop
                                                rs.close()
                                            End If
                                            %>
                                        </div>
                                        <button  <% if EditFollower=False Then %> style="display:none" <% End If%> class="ui-state-default" onclick="return addFollower()">添加跟单人</button>
                                    </div>
                                    
                                </div>
                                <style>
                                    /* 其他已有样式... */
                                    .follower-item {
                                        margin-bottom: 10px; /* 每个跟单人项之间的间距 */
                                        clear: both; /* 清除浮动 */
                                        overflow: hidden; /* 处理浮动元素 */
                                    }
                                    .follower-item input {
                                        margin-right: 10px; /* 输入框之间的间距 */
                                    }
                                </style>
                            <script LANGUAGE="javascript">
                            function showFollower(){        
                                document.getElementById("followerDiv").style.display="";
                                document.getElementById("inputTopAddFollower").style.display="none";
                                addFollower()
                                return false;
                                
                            }
                            function checkOpenerAndFollower(){
                                // 获取开单人信息
                                var openerNameInput = document.getElementById("EntourageName_<%=EntourageID_OpenUser%>");
                                var openerName = openerNameInput.value;
                                var openerRatioInput = document.getElementById("OpenUserRatio");
                                var openerRatio = openerRatioInput.value;
 
                                // 检测开单人姓名是否为空
                                //if (openerName === "") {
                                //    alert("开单人姓名不能为空");
                                //    return false;
                                //}
 
                                // 检测开单人提成比例是否为空
                                if (openerName !="" && openerRatio === "") {
                                    alert("开单人提成比例不能为空");
                                    return false;
                                }
 
                                // 存储跟单人姓名和提成比例
                                var followerNames = [];
                                var followerRatios = [];
                                var followersList = document.getElementById('FollowersList');
                                var followerItems = followersList.getElementsByClassName('follower-item');
 
                                // 遍历跟单人,收集姓名和提成比例并进行检测
                                for (var i = 0; i < followerItems.length; i++) {
                                    var followerNameInput = followerItems[i].querySelector('input[name^="FollowerName_"]');
                                    var followerName = followerNameInput.value;
                                    var followerRatioInput = followerItems[i].querySelector('input[name^="FollowerRatio_"]');
                                    var followerRatio = followerRatioInput.value;
 
                                    // 检测跟单人姓名是否为空
                                    if (followerName === "") {
                                        alert("跟单人姓名不能为空");
                                        return false;
                                    }
 
                                    // 检测跟单人提成比例是否为空
                                    if (followerRatio === "") {
                                        alert("跟单人提成比例不能为空");
                                        return false;
                                    }
 
                                    followerNames.push(followerName);
                                    followerRatios.push(parseFloat(followerRatio));
                                }
 
                                // 将开单人提成比例转换为浮点数
                                openerRatio = parseFloat(openerRatio);
 
                                // 检测逻辑 1: 开单人与跟单人比例加起不能超过 100
                                var totalRatio = openerRatio;
                                for (var j = 0; j < followerRatios.length; j++) {
                                    totalRatio += followerRatios[j];
                                }
                                if (totalRatio > 100) {
                                    alert("开单人与跟单人提成比例总和不能超过 100%");
                                    return false;
                                }
 
                                // 检测逻辑 2: 开单人与跟单人不要出现重复
                                if (followerNames.includes(openerName)) {
                                    alert("开单人与跟单人不能重复");
                                    return false;
                                }
 
                                // 检测逻辑 3: 多个跟单人之间也不要出现重复
                                var uniqueFollowerNames = [];
                                for (var k = 0; k < followerNames.length; k++) {
                                    if (uniqueFollowerNames.includes(followerNames[k])) {
                                        alert("跟单人之间不能重复");
                                        return false;
                                    }
                                    uniqueFollowerNames.push(followerNames[k]);
                                }
 
                                return true;
                            }
                            function addFollower() {
                                
                                var followersList = document.getElementById('FollowersList');
                                var newFollower = document.createElement('div');
                                newFollower.className = 'follower-item';
                                var followerCount = followersList.children.length + 1;
                                newFollower.innerHTML = `
                                    <input id="Entourage_<%=EntourageID_Follower%>_${followerCount}" name="FollowerID_${followerCount}" type="hidden" value="">
                                    <input type="text" id="EntourageName_<%=EntourageID_Follower%>_${followerCount}" name="FollowerName_${followerCount}" class="small" onclick="javascript:JS_EntourageOpen('<%=EntourageID_Follower%>_${followerCount}','-<%=departmentID_Follower%>');" style="width:138px;" value="" readonly="true">
                                    <div class="label" style="float: left;margin-left: 226px;"><label for="input-small">提成比例(%):</label></div>
                                    <div class="input" style="float:left;margin-left: 87px;">
                                        <input type="text" id="FollowerRatio_${followerCount}" name="FollowerRatio_${followerCount}" class="small" style="width:50px;">
                                    </div>
                                    <div class="input" style="float:left;margin-left: 10px;"> 
                                        <button onclick="return removeFollower();">删除</button>
                                    </div>
                                `;
                                followersList.appendChild(newFollower);
                                addFollowerCount(1);
                                return false;
                            }
                            function removeFollower(index){
                                var followersList = document.getElementById('FollowersList');
                            
                                var followerItems = followersList.getElementsByClassName('follower-item');
                                // 如果传入了 index 参数,删除指定索引的元素;否则删除最后一个元素
                                var elementToRemove = index !== undefined ? followerItems[index] : followersList.lastElementChild;
                                if (elementToRemove) {
                                    elementToRemove.remove();
                                }
                                followersList = document.getElementById('FollowersList');
                                let len=followersList.children.length;
                                
                                // 更新剩余元素的 name 属性和索引
                                var newFollowerCount = 1;
                                for (var i = 0; i < len; i++) {
                                    var item = followerItems[i];
                                    var followerIdInput = item.querySelector('input[name^="FollowerID_"]');
                                    var followerNameInput = item.querySelector('input[name^="FollowerName_"]');
                                    var followerRatioInput = item.querySelector('input[name^="FollowerRatio_"]');
                                    if (followerIdInput) {
                                        followerIdInput.name = `FollowerID_${newFollowerCount}`;
                                        followerIdInput.id = `FollowerId_${newFollowerCount}`;
                                    }
                                    if (followerNameInput) {
                                        followerNameInput.name = `FollowerName_${newFollowerCount}`;
                                        followerNameInput.id = `FollowerName_${newFollowerCount}`;
                                    }
                                    if (followerRatioInput) {
                                        followerRatioInput.name = `FollowerRatio_${newFollowerCount}`;
                                        followerRatioInput.id = `FollowerRatio_${newFollowerCount}`;
                                    }
                                    newFollowerCount++;
                                }
                                if(followersList.children.length==0){
                                    document.getElementById("followerDiv").style.display="none";
                                    document.getElementById("inputTopAddFollower").style.display="";
                                }
                                addFollowerCount(-1);
                                return false;
                            }
                            function addFollowerCount(val){
                                var hid=document.getElementById("hidFollowerCount");
                                var oldv=hid.value;
                                hid.value=parseInt(oldv)+val;
                            }
                            
                            </script>
                            <%If isDepartment("070127")=1 Then%>
                            <div class="field">
                                        <%'主要企微客服
                                        If ServiceOrd_work_ID<>"" Then ServiceOrd_work_Name=OAUser(ServiceOrd_work_ID,"UserName")
                                        EntourageID="-4"
                                        departmentID="me"
                                        %>
                                        <div class="label" style="float: left;margin-left: 0px;"><label for="input-small">主要企微客服:</label></div>
                                        <div class="input" style="float:left;margin-left: 85px;">
                                            <input id="Entourage_<%=EntourageID%>" name="ServiceOrd_work_ID" type="hidden" value="<%=ServiceOrd_work_ID%>">
                                            <input type="text" id="EntourageName_<%=EntourageID%>" name="ServiceOrd_work_Name" class="small" <%If ServiceOrd_work_Name="" Or isDepartment("020116")=1 Then%>onclick="javascript:JS_EntourageOpen('<%=EntourageID%>','<%=departmentID%>');"<%End If%> style="width:124px;" value="<%=ServiceOrd_work_Name%>" readonly="true">
                                        </div>
 
                                        <%'其他企微客服
                                        If ServiceOrd_work_IDs<>"" Then ServiceOrd_work_Names=OAUser(ServiceOrd_work_IDs,"UserName")
                                        EntourageID="-5"
                                        departmentID="me"
                                        %>
                                        <div class="label" style="float: left;margin-left: 226px;"><label for="input-small">其他企微客服:</label></div>
                                        <div class="input" style="float:left;margin-left: 84px;">
                                            <input id="Entourage_<%=EntourageID%>" name="ServiceOrd_work_IDs" type="hidden" value="<%=ServiceOrd_work_IDs%>">
                                            <input type="text" id="EntourageName_<%=EntourageID%>" name="ServiceOrd_work_Names"  onclick="javascript:JS_EntourageOpen('<%=EntourageID%>','<%=departmentID%>');" value="<%=ServiceOrd_work_Names%>" class="small" style="width:348px;" readonly="true">
                                        </div>
                                        <%If DispatchOrd_AP_Check>=1 And isDepartment("020102")=1 Then%>
                                        &nbsp;&nbsp;<input type="button" name="submit149_1" value="保存企微客服" class="ui-state-default" style="background: #9a6d92 url(../../../resources/images/colors/purple/button_highlight.png) repeat-x;color: #ffffff;" onclick="form1_submit149_1();">
                                        <script LANGUAGE="javascript">
                                            //保存企微客服
                                            function form1_submit149_1(){
                                            document.form1.action = "admin_save.gds";
                                            document.form1.admin_save.value = "149";
                                            document.getElementById("zhezhao").style.display="block"; 
                                            document.getElementById("login").style.display="block"; 
                                            form1.submit();
                                            }
                                        </script>
                                        <%End If%>
                            </div>
                            <div class="field">
                                        <div class="label" style="float: left;margin-left: 0px;"><label for="input-small"><label for="ServiceOrd_work_is">是否企微成交</label>:</label></div>
                                        <div class="input" style="float:left;margin-left: 84px;">
                                            <input type="checkbox" id="ServiceOrd_work_is" value="1" name="ServiceOrd_work_is" style="margin-top: 8px;"<%If ServiceOrd_work_is="1" Then Response.Write " checked=""checked"""%> onchange="upperCase(this.name)"/>
                                        </div>
                                        <div class="label" style="float: left;margin-left: 116px;">
                                        <label for="input-small">企微绩效方案:</label>
                                        </div>
                                        <div class="input" style="float:left;margin-left: 104px;">
                                            <input name="CommissionScenarioID" id="CommissionScenarioID" type="hidden" value="<%=CommissionScenarioID%>" onchange="upperCase(this.name)">
                                            <%
                                            If CommissionScenarioID<>"" Then
                                                sql="select vID,vtext,vMono,vOrder2 from dictionary where vtitle in ('CommissionScenario') and vID="&CommissionScenarioID&" order by vOrder"
                                                rs.open sql,objConn,1,1
                                                if not rs.Eof Then
                                                    CommissionScenarioTXT=rs("vtext")&" "&rs("vOrder2")
                                                End If
                                                rs.close()
                                            End If%>
                                            <input type="text" id="CommissionScenario" name="CommissionScenario" class="small<%'If ServiceOrd_AP_Check="1" Then Response.Write " valid"%>" style="width:456px;" value="<%=CommissionScenarioTXT%>" readonly="true" onclick="javascript:JS_CommissionScenarioOpen('CommissionScenario');" onchange="upperCase(this.name)">
                                        </div>
                            </div>
                            <%Else%>
                                <input name="CommissionScenarioID" type="hidden" value="<%=CommissionScenarioID%>">
                                <input name="ServiceOrd_work_is" type="hidden" value="<%=ServiceOrd_work_is%>">
                                <input name="ServiceOrd_work_ID" type="hidden" value="<%=ServiceOrd_work_ID%>">
                                <input name="ServiceOrd_work_IDs" type="hidden" value="<%=ServiceOrd_work_IDs%>">
                            <%End If%>
                            <div class="field">                        
                                <div class="label" style="float: left;margin-left: 0px;">
                                <label for="input-small">原始单据编号:</label></div>                    
<div class="input" style="float:left;margin-left: 84px;">
    <input type="text" id="Old_ServiceOrdID_TXT" name="Old_ServiceOrdID_TXT" 
    class="small <% If ServiceOrdState=4 Then %>error<% Else %>valid<% End If %>"
    style="width: 98px;"
    value="<% If Old_ServiceOrdID_TXT <> "" Then %>
            <%=Server.HTMLEncode(Old_ServiceOrdID_TXT)%>
          <% Else %>
            [未关联]
          <% End If %>">
                                </div> 
                                </div>
 
                <%If OrderLevel<>1 Or isDepartment("020111")=1 Then%>
                        <!-- 服务单数据 -->
                        <!--#INCLUDE FILE="ServiceOrder_Data.gds" -->
                <%End If%>
                
                        <%If NEWOrder="2" Then%>
                            <div class="field" style="height: 25px;">
                                <div class="label" style="float: left;margin-left:0px;">
                                    <label for="input-small">绩效计价:</label>
                                </div>
                                <div class="input" style="float:left;margin-left: 70px;">
                                    <input type="text" id="DispatchOrdPerfomance" name="DispatchOrdPerfomance" class="small<%If DispatchOrd_AP_Check=1 Or isDepartment("030112")=0 Then Response.Write " valid"%>" style="width:138px;" value="<%=DispatchOrdPerfomance%>"<%If DispatchOrd_AP_Check=1 Or isDepartment("030112")=0 Then Response.Write " readonly=""true""" %>>
                                </div>
                                <div class="label" style="float: left;margin-left:242px;">
                                    <label for="input-small">担架费:</label>
                                </div>
                                <div class="input" style="float:left;margin-left: 70px;">
                                    <input type="text" id="StretcherMoney" name="StretcherMoney" class="small<%If DispatchOrd_AP_Check=1 Or isDepartment("030112")=0 Then Response.Write " valid"%>" style="width:138px;" value="<%=StretcherMoney%>"<%If DispatchOrd_AP_Check=1 Or isDepartment("030112")=0 Then Response.Write " readonly=""true""" %>>
                                </div>
                            </div>
                        <%End if%>
                        <style>
                        .closeimg  
                        {  
                            position : absolute;  
                            width : 20px;  
                            height : 20px;  
                            margin-left: -25px;
                            z-index: 100;
                        } 
                        </style>
                        <%
                        If ServiceOrdID<>"" Then
                        sql="select * from ImageData where SOrdIDDt="&ServiceOrdID&" and ImageDel=0 order by ImageType,UpImageTime"
                        rs.open sql,objConn,1,1
                        ImageTypeOld=0
                        i=0
                        do while not rs.Eof
                            ImageID        = rs("id")
                            ImageType    = rs("ImageType")
                            ImageUrl    = rs("ImageUrl")
                            ImageUrls    = rs("ImageUrls")
                            ImageDeg    = rs("ImageDeg")
                            UpImageTime    = rs("UpImageTime")
                            UpImageOAid    = rs("UpImageOAid")
                            If Len(ImageUrls)>0 Then
                                strPICUrl=ImageUrls
                            Else
                                strPICUrl=ImageUrl
                            End If
                              
                            If ImageTypeOld<>ImageType Then
                            ImageTypeOld=ImageType
                            If i>0 Then Response.Write "</div>"%>
                                <div style=" margin:10px 10px;border-bottom: 1px solid #f1f1f1;"><%=ImageTypeA(ImageType)%><br>
                            <%End If%>
                                        <a href="/Image.gds?ImageID=<%=ImageID%>" target="_blank"><img src="<%=strPICUrl%>" width="80" border="0" style="margin: 10px;transform: rotate(<%=ImageDeg%>deg);-ms-transform:rotate(<%=ImageDeg%>deg);-moz-transform:rotate(<%=ImageDeg%>deg);-webkit-transform:rotate(<%=ImageDeg%>deg);-o-transform:rotate(<%=ImageDeg%>deg);"></a>
                                        <a href="javascript:DelImage_JS('<%=ImageID%>')" ><img src="/resources/images/xx.png" class="closeimg" alt="删除文档" width="20px" height="20px" /></a><br><%=OAUser(UpImageOAid,"UserName")%><br><%=UpImageTime%>
                        <%i=i+1
                        rs.movenext
                        loop
                        rs.close()
                        If ImageID<>"" Then Response.Write "</div>"
                        End If
                        %>
                <%
                If ServiceOrdID<>"" Then
                    OnlineUnixTime=ToUnixTime(now(),+8)
                    OnlineOAName=","&session("adminName")
                    If ServiceOrdOnlineOAName<>"" Then
                        OnlineOANameSP=split(ServiceOrdOnlineOAName,",")
                        ServiceOrdOnlineOAName=","&session("adminName")&"|"&OnlineUnixTime
                        for i = 1 to UBOUND(OnlineOANameSP)
                            OnlineOASP=split(OnlineOANameSP(i),"|")
                            If OnlineOASP(0)<>session("adminName") And (OnlineUnixTime-OnlineOASP(1))<15 Then
                                ServiceOrdOnlineOAName=ServiceOrdOnlineOAName&","&OnlineOASP(0)&"|"&OnlineOASP(1)
                                OnlineOAName=OnlineOAName&","&OnlineOASP(0)
                            End If
                        Next
                    Else
                        ServiceOrdOnlineOAName=","&session("adminName")&"|"&OnlineUnixTime
                    End If
                    sql="update ServiceOrder set ServiceOrdOnlineOAName='"&ServiceOrdOnlineOAName&"' where ServiceOrdID="&ServiceOrdID
                    objConn.Execute sql
                    If OnlineOAName<>"" Then
                        OnlineOAName="&nbsp;正在查看:"&Mid(OnlineOAName,2)&"&nbsp;"
                    End If
                End If
                If (OrderLevel<>1 Or isDepartment("020111")=1) And IsLocking<>"1" Then%>
                        <span id="buttonDivHeight"></span>
                            <div class="field" id="buttonDiv" style="height: 45px;border-bottom: initial;width: 79.5%;left: 290px;bottom: 0px;background-color:white;padding: 0 20px 10px 20px;min-width: 1110px;">
                                <div class="buttons">
                                <div class="highlight" id="addSave">
                                <%If DispatchOrd_AP_Check<=0 Then%>
                                  <%If ServiceOrdID="" And NEWOrder="2" And isDepartment("030101")=1 then%>
                                    <%If SystemMessageType="4" then%><input type="button" name="submit48_2" value="保存咨询单" class="ui-state-default" onclick="form1_submit19_1();">&nbsp;&nbsp;<%End if%>
                                    <input type="button" name="submit48_1" value="下一步" class="ui-state-default" onclick="form1_submit19_2();">&nbsp;&nbsp;
                                  <%else%>
                                    <%If (ServiceOrdID="" Or ServiceOrdState="1") And (isDepartment("020101")=1 Or isDepartment("020102")=1) then%><input type="button" name="submit48_2" value="保存咨询单" class="ui-state-default" onclick="<%If ServiceOrdID="" then%>form1_submit19_1();<%else%>form1_submit20_1();<%End if%>">&nbsp;&nbsp;<%End if%>
                                    <%If (ServiceOrdID="" Or ServiceOrdID="" Or ServiceOrdState="1") And (isDepartment("020101")=1 Or isDepartment("020102")=1) then%><input type="button" name="submit48_1" value="生成服务单" class="ui-state-default" onclick="<%If ServiceOrdID="" then%>form1_submit19_2();<%else%>form1_submit20_2();<%End if%>">&nbsp;&nbsp;<%End if%>
                                    
                                    <%If ServiceOrdID<>"" And (ServiceOrdState="2" Or (ServiceOrdState="3")) And isDepartment("020102")=1 then%><input type="button" name="submit48_1" value="保存服务单" class="ui-state-default" onclick="form1_submit20_2();">&nbsp;&nbsp;<%End if%>
                                    <%If ServiceOrdID<>"" And ServiceOrdState="2" And ServiceOrd_AP_Check="0" And isDepartment("020105")=1 then%><input type="button" name="submit48_1" value="审核" class="ui-state-default" onclick="form1_submit20_3();">&nbsp;&nbsp;<%End if%>
                                    <%If ServiceOrdID<>"" And ServiceOrdState="2" And ServiceOrd_AP_Check="1" And isDepartment("020105")=1 then%><!--<input type="button" name="submit48_1" value="反审核" class="ui-state-default" onclick="form1_submit20_5();">&nbsp;&nbsp;--><%End if%>
                                    <%If ServiceOrdID<>"" And ServiceOrdState="2" And isDepartment("020107")=1 then%><input type="button" name="submit48_1" value="取消服务单" class="ui-state-default" onclick="JS_CancelOpen('5');">&nbsp;&nbsp;<%End if%>
                                    <%If ServiceOrdID<>"" And (ServiceOrdState="2" Or ServiceOrdState="3") And ServiceOrd_AP_Check="1" And isDepartment("030101")=1 then%>
                                    <input type="button" id="form_Dispatch" name="submit48_1" value="生成调度单" class="ui-state-default" onclick="form1_Dispatch();">&nbsp;&nbsp;
                                    <!--<input type="button" name="submit48_1" value="生成居家ICU调度单" class="ui-state-default" onclick="form1_Dispatch();">&nbsp;&nbsp;
                                    <input type="button" name="submit48_1" value="生成大型活动保障调度单" class="ui-state-default" onclick="form1_Dispatch();">&nbsp;&nbsp;-->
                                    <%End if%>
                                    <%If ServiceOrdID="" And isDepartment("020101")=1 then%><input type="button" name="submit48_2" value="无效电话" class="ui-state-default" onclick="JS_CancelOpen('4_1');">&nbsp;&nbsp;<%End if%>
                                    <%If ServiceOrdID<>"" And ServiceOrdState="1" And isDepartment("020101")=1 then%><input type="button" name="submit48_2" value="作废咨询单" class="ui-state-default" onclick="JS_CancelOpen('5');">&nbsp;&nbsp;<%End if%>
                                    <%If ServiceOrdID<>"" And ServiceOrdState="4" And isDepartment("020101")=1 then%><input type="button" name="submit48_2" value="还原服务单" class="ui-state-default" onclick="form1_submit20_2();">&nbsp;&nbsp;<%End if%>
                                    <%If ServiceOrdID<>"" And ServiceOrdState>=2 And isDepartment("020107")=1 And 1=2 then%><input type="button" name="submit48_2" value="打印服务单" class="ui-state-default" onclick="form1_submit48_2();">&nbsp;&nbsp;<%End if%>
                                    <%If  session("Power_"&ServiceOrdID)<>"1" And DispatchOrdID="" And ServiceOrdID<>"" Then%><input type="button" name="submit51" id="OrdSendOAOpen" value="订单通知推送" class="ui-button ui-widget ui-state-default ui-corner-all" role="button" aria-disabled="false" onclick="javascript:JS_OrdSendOAOpen()">&nbsp;&nbsp;<%End If%>
                                    
                                    
 
                                  <%End if%>
                                <%Else%>
                                  调度单审核后不可操作,若需操作先反审核相关调度单
                                <%End If%>
                                  <span id="vic"></span>
                                  <span class="dialogJtxt" id="OnlineServiceOAName" style="background: #04BE02;"><%=OnlineOAName%></span>
                                </div>
                                </div>
                            </div>
                        <script LANGUAGE="javascript">
                        var oTop = $("#buttonDivHeight").offset().top-document.body.offsetHeight+75;//默认上边距离
                        window.onscroll=function(){
                            if(document.documentElement.scrollTop > oTop ){
                                document.getElementById("buttonDiv").style.cssText="height: 45px;border-bottom: initial;"
                            }else{
                                document.getElementById("buttonDiv").style.cssText="height: 45px;border-bottom: initial;position: fixed;width: 79.5%;left: 290px;bottom: 0px;background-color:white;padding: 0 20px 10px 20px;min-width: 1110px;"
                            }
                        }
                        </script>
                <%End If%>
                        </div>
                    </div>
                    
 
                    <%If (ServiceOrdID<>"" And ((ServiceOrdState="2" And isDepartment("020107")=1) or (ServiceOrdState="1" And isDepartment("020101")=1))) Or (ServiceOrdID="" And isDepartment("020101")=1) then%>
                            <!--取消调用单-->
                            <script LANGUAGE="javascript">
                                //打开取消窗口
                                function JS_CancelOpen(ServiceOrdState)
                                {
                                var sTop=document.documentElement.scrollTop;
                                    if (sTop==0) {sTop=document.body.scrollTop;}
                                var sLeft= document.documentElement.scrollLeft;
                                    if (sLeft==0) {sLeft=document.body.scrollLeft;}
                                var dTop = document.getElementById("addSave").getBoundingClientRect().top;
                                var dLeft = document.getElementById("addSave").getBoundingClientRect().left;
                                if (dTop<200) {dTop=200;}
                                if (dLeft<120) {dLeft=120;}
                                CancelCreate.style.display="block";
                                CancelCreate.style.left=(dLeft+200)+"px";
                                CancelCreate.style.top=(sTop+dTop-450)+"px";
                                CancelCreate.style.display='block';
                                if (ServiceOrdState=='4_1')
                                {
                                    document.form1.admin_save.value = "19";
                                    document.form1.NEWOrder.value = "";
                                    document.form1.ServiceOrdState.value = "4";
                                }
                                else
                                {
                                    document.form1.ServiceOrdState.value=ServiceOrdState
                                    document.form1.admin_save.value = "20";
                                }
                                }
 
                                //取消调用单-关闭上传窗口
                                function JS_CancelCreateClose()
                                {
                                CancelCreate.style.display="none";
                                }
                                //取消调用单-保存
                                function JS_CancelCreateSave()
                                {
                                    var a = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/
                                    var b = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2})$/
 
                                    if(document.form1.CancelReason.value=='' || document.form1.CancelReason.value=='0') {
                                        alert('请选择取消原因!!');
                                        return false;
                                    }
                                    if(confirm("确定取消服务单?"))
                                    {
                                        document.form1.action = "admin_save.gds";
                                        document.getElementById("zhezhao").style.display="block"; 
                        document.getElementById("login").style.display="block";
                                        form1.submit();
                                    }
                                }
                            </script>
                            <!--取消调用单-->
                            <div class="dialogJ  dialogJfix dialogJshadow" id="CancelCreate" style="width: 370px; right: 300px; top: 150px;display:none;">
                                <div class="dialogJtitle">
                                    <a href="javascript:JS_CancelCreateClose();" class="dialogJclose" title="关闭本窗口">&nbsp;</a>
                                    <span class="dialogJtxt" id="EditPhotoTXT">取消服务单</span>
                                </div>
                                <div class="dialogJcontent">
                                    <div class="dialogJbody" id="dialogJbody" style="height: 210px;">
                                        <div class="modify-album-name">
                                            <span>取消原因:</span>
                                            <select name="CancelReason" id="CancelReason" style="padding: 5px 0 5px 8px;">
                                                <option value="">请选择</option>
                                                <%sql="select vID,vtext from dictionary where vtitle='CancelReason' and vType>=1 order by vOrder"
                                                rs.open Sql,objConn,1,1
                                                do while not rs.Eof%>
                                                <option value="<%=rs("vID")%>"><%=rs("vtext")%></option>
                                                <%rs.movenext
                                                Loop
                                                rs.close()%>
                                            </select>
                                        </div>
                                        <div class="modify-album-name">
                                            <span>备注:</span>
                                            <input id="CancelReasonTXT" name="CancelReasonTXT" class="text" type="text" value="<%=CancelReason%>" style="width: 165px;" maxlength="99/">
                                        </div>
                                    </div>
                                </div>
                                <div class="dialogJanswers">
                                    <input type="button" class="dialogJbtn first-child" onclick="JS_CancelCreateSave()" value="确定"> 
                                    <input type="button" class="dialogJbtn" onclick="JS_CancelCreateClose()" value="取消">
                                </div>
                            </div>
                            <!--取消调用单 end-->
                        <%End if%>
 
                    </form>
                    <script LANGUAGE="javascript">
                        //生成咨询单(新增)
                        function form1_submit19_1(){
                            let checkResult=checkOpenerAndFollower();
                            if(!checkResult){
                                return;
                            }
                            document.form1.action = "admin_save.gds";
                            document.form1.admin_save.value = "19";
                            document.form1.NEWOrder.value = "";
                            document.form1.ServiceOrdState.value = "1";
                            document.getElementById("zhezhao").style.display="block"; 
                            document.getElementById("login").style.display="block";
                            form1.submit();
                        }
                        //生成服务单(新增)
                        function form1_submit19_2(){
                            let checkResult=checkOpenerAndFollower();
                            if(!checkResult){
                                return;
                            }
                            document.form1.action = "admin_save.gds";
                            document.form1.admin_save.value = "19";
                            document.form1.ServiceOrdState.value = "2";
                            document.getElementById("zhezhao").style.display="block"; 
                            document.getElementById("login").style.display="block";
                            form1.submit();
                        }
                        //生成无效电话(新增)
                        function form1_submit19_4(){
                            if(confirm("确定来电设为无效?"))
                            {
                                document.form1.action = "admin_save.gds";
                                document.form1.admin_save.value = "19";
                                document.form1.NEWOrder.value = "";
                                document.form1.ServiceOrdState.value = "4";
                                document.getElementById("zhezhao").style.display="block"; 
                                document.getElementById("login").style.display="block";
                                form1.submit();
                            }
                        }
                        
                        //保存咨询单(修改)
                        function form1_submit20_1(){
                            let checkResult=checkOpenerAndFollower();
                            if(!checkResult){
                                return;
                            }
                            document.getElementById("MessageContents_form1").value=document.getElementById("MessageContents").value;
                            document.form1.action = "admin_save.gds";
                            document.form1.admin_save.value = "20";
                            document.form1.NEWOrder.value = "";
                            document.form1.ServiceOrdState.value = "1";
                            document.getElementById("zhezhao").style.display="block"; 
                            document.getElementById("login").style.display="block";
                            form1.submit();
                        }
                        //生成/保存服务单(修改)
                        function form1_submit20_2(){
                            let checkResult=checkOpenerAndFollower();
                            if(!checkResult){
                                return;
                            }
                            document.getElementById("MessageContents_form1").value=document.getElementById("MessageContents").value;
                            document.form1.action = "admin_save.gds";
                            document.form1.admin_save.value = "20";
                            document.form1.ServiceOrdState.value = "2";
                            document.getElementById("zhezhao").style.display="block"; 
                            document.getElementById("login").style.display="block";
                            form1.submit();
                        }
                        //审核服务单(修改)
                        function form1_submit20_3(){
                        if(confirm("确定审核服务单?"))
                            {
                                document.getElementById("MessageContents_form1").value=document.getElementById("MessageContents").value;
                                document.form1.action = "admin_save.gds";
                                document.form1.admin_save.value = "20";
                                document.form1.ServiceOrd_Check.value = "1";
                                document.getElementById("zhezhao").style.display="block"; 
                                document.getElementById("login").style.display="block";
                                form1.submit();
                            }
                        }
                        //反审核服务单(修改)
                        function form1_submit20_5(){
                        if(confirm("确定反审核服务单?"))
                            {
                                document.getElementById("MessageContents_form1").value=document.getElementById("MessageContents").value;
                                document.form1.action = "admin_save.gds";
                                document.form1.admin_save.value = "20";
                                document.form1.ServiceOrd_Check.value = "0";
                                document.getElementById("zhezhao").style.display="block"; 
                        document.getElementById("login").style.display="block";
                                form1.submit();
                            }
                        }
                        //取消服务单(修改并还原为咨询单)
                        function form1_submit20_4(){
                            if(confirm("确定取消服务单,还原为咨询单吗?"))
                            {
                                document.getElementById("MessageContents_form1").value=document.getElementById("MessageContents").value;
                                document.form1.action = "admin_save.gds";
                                document.form1.admin_save.value = "20";
                                document.form1.ServiceOrdState.value = "4";
                                document.getElementById("zhezhao").style.display="block"; 
                        document.getElementById("login").style.display="block";
                                form1.submit();
                            }
                        }
                        //作废咨询单(新增)
                        function form1_submit20_6(){
                            if(confirm("确定咨询单设为无效?"))
                            {
                                document.getElementById("MessageContents_form1").value=document.getElementById("MessageContents").value;
                                document.form1.action = "admin_save.gds";
                                document.form1.admin_save.value = "20";
                                document.form1.ServiceOrdState.value = "5";
                                document.getElementById("zhezhao").style.display="block"; 
                        document.getElementById("login").style.display="block";
                                form1.submit();
                            }
                        }
                        
                        //修改单据类型
                        function form1_OrdClass(OrdClass){
                        document.form1.action = "ServiceOrder.gds?NEWOrder=<%=NEWOrder%>&OrdClass="+OrdClass;  
                        document.getElementById("zhezhao").style.display="block"; 
                        document.getElementById("login").style.display="block";
                        form1.submit();
                        }
                        //地图-关闭窗口
                        function JS_BaiduCalCreateClose()
                        {
                        BaiduCalCreate.style.display="none";
                        //document.getElementById("frm_street").value="";
                        //document.getElementById("frm_end").value="";
                        }
                        //地图-清空计价
                        function JS_BaiduCalCreateEmpty()
                        {
                            document.getElementById('ServiceOrdTraDuration').value='';
                            document.getElementById('ServiceOrdTraDistance').value='';
                            document.getElementById('ServiceOrdTraOfferPrice').value=0;
                            document.getElementById('ServiceOrdTraTxnPrice').value=0;
                        }
                        //地图-确定地址
                        function JS_BaiduCalCreateSave()
                        {
                            //服务单地址
                            document.getElementById('ServiceOrdTraStreet').value=document.getElementById('search0').value; //出发地
                            document.getElementById('ServiceOrdTraEnd').value=document.getElementById('search1').value;    //目的地
                            //途经地
                            var OrdTraVia="";
                            var frmTxt="";
                            for(var i=2;i<=7;i++){
                                frmTxt=document.getElementById("search"+i).value;
                                if (frmTxt!=''){OrdTraVia +=" => "+frmTxt;}
                            }
                            if (OrdTraVia!=''){OrdTraVia=OrdTraVia.substring(4);document.getElementById('OrdTraVia').style.display='block';}
                            else {document.getElementById('OrdTraVia').style.display='none';}
                            document.getElementById('ServiceOrdTraVia').value=OrdTraVia;
 
                            //计算标准报价
                            document.getElementById('ServiceOrdTraDuration').value=document.getElementById('frm_Duration').value; //获取时间
                            document.getElementById('ServiceOrdTraDistance').value=document.getElementById('frm_Distance').value; //获取距离
                            if (document.getElementById('ServiceOrdTraOfferPrice_A').value=="0" || document.getElementById('ServiceOrdTraOfferPrice_A').value=="") {document.getElementById('ServiceOrdTraOfferPrice').value=document.getElementById('frm_OfferPrice').value;}
                            document.getElementById('ServiceOrdTraTxnPrice').value=document.getElementById('frm_OfferPrice').value;
                            <%If NEWOrder="2" Then%>document.getElementById('DispatchOrdPerfomance').value=document.getElementById('frm_OfferPrice').value;<%end if%>
                            JS_BaiduCalCreateClose();
                            MapDel_JS()
                        }
 
                        //地图-确定地址_旧
                        function JS_BaiduCalCreateSave_old(sw,Lu,ret1,ret,transfer)
                        {
                            //服务单地址
                            document.getElementById('ServiceOrdTraStreet').value=document.getElementById('hidden_street').value; //出发地
                            document.getElementById('ServiceOrdTraEnd').value=document.getElementById('hidden_end').value;    //目的地
                            document.getElementById('ServiceOrdTraStreetCoo').value=sw; //起点坐标
                            document.getElementById('ServiceOrdTraEndCoo').value=Lu; //起点坐标
                            
                            //计算标准报价
                            var TraUnitPrice=document.getElementById('ServiceOrdTraUnitPrice').value;
                            var km="";
                            if (ret.indexOf("公里")>=1) {km=ret.replace(/公里/, "");}
                            else {km=ret.replace(/米/, "");km=parseFloat(km)/1000;}
                            km=parseFloat(km);
                            OfferPrice=parseFloat(document.getElementById('ServiceOrdTraOfferPrice').value)
 
                            if (transfer==1 && OfferPrice>60)
                            {    //A-B-C报价
                                document.getElementById('ServiceOrdTraDuration').value=document.getElementById('ServiceOrdTraDuration').value+"+"+ret1; //获取时间
                                document.getElementById('ServiceOrdTraDistance').value=document.getElementById('ServiceOrdTraDistance').value+"+"+ret; //获取距离
                                if (TraUnitPrice!='')
                                {
                                    
                                    TraUnitPrice=parseFloat(TraUnitPrice);
                                    document.getElementById('ServiceOrdTraOfferPrice').value=parseFloat(document.getElementById('ServiceOrdTraOfferPrice').value)+TraUnitPrice*km;
                                    document.getElementById('ServiceOrdTraTxnPrice').value=parseFloat(document.getElementById('ServiceOrdTraTxnPrice').value)+TraUnitPrice*km;
                                }
                            }
                            else
                            {    //A-B报价
                                document.getElementById('ServiceOrdTraDuration').value=ret1; //获取时间
                                document.getElementById('ServiceOrdTraDistance').value=ret; //获取距离
                                if (TraUnitPrice!='')
                                {
                                    TraUnitPrice=parseFloat(TraUnitPrice);
                                    document.getElementById('ServiceOrdTraOfferPrice').value=TraUnitPrice*km;
                                    document.getElementById('ServiceOrdTraTxnPrice').value=TraUnitPrice*km;
                                }
                            }
                        }
                    </script>
                    <div class="dialogJ  dialogJfix dialogJshadow" id="BaiduCalCreate" style="width: 1215px;left: 80px; top: 110px;height:696px ;display:none;">
                        <div class="dialogJtitle">
                            <a href="javascript:JS_BaiduCalCreateClose();" class="dialogJclose" title="关闭本窗口">&nbsp;</a>
                            <span class="dialogJtxt" id="EditPhotoTXT">选择路线</span>
                        </div>
                        <div class="dialogJcontent" style="margin-left: 5px;margin-right:5px;">
                        <!--#include virtual="/inc/baidu_cal3.0.gds" -->
                        </div>
                    </div>
 
                    <div class="dialogJ  dialogJfix dialogJshadow" id="window_Entourage" style="z-index: 50007; width: 350px; left: 0px; top: 0px;display:none;">
                    <div class="dialogJtitle">
                        <a href="javascript:JS_EntourageClose();" class="dialogJclose" title="关闭本窗口">&nbsp;</a>
                        <input type="hidden" id="EntourageSearch" name="EntourageSearch" value=""/>
                        <span class="dialogJtxt">选择</span>&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" id="EntourageSearchTXT" name="EntourageSearchTXT" value="<%=EntourageSearchTXT%>" style="width: 100px;" onkeyup="JS_EntourageSearch();"/>&nbsp;<input type="button" name="button3" value="查询" onclick="JS_EntourageSearch();">&nbsp;<input type="button" name="button3" value="全选" onclick="JS_EntourageSaveAll();">&nbsp;<input type="button" name="button3" value="清空" onclick="JS_EntourageDel();">
                    </div>
                    <div class="dialogJcontent">
                        <div class="box">
                                <div class="table" style="padding: 0px;">
                                    <input name="window_EntourageID" type="hidden" value="">
                                    <input name="window_OA_CompetencyID" type="hidden" value="">
                                    <table>
                                        <thead>
                                            <tr>
                                                <th class="selected left">&nbsp;</th>
                                                <th class="category" style="text-align: center;">姓名</th>
                                                <th class="category last" style="text-align: center;">手机</th>
                                            </tr>
                                        </thead>
                                        <tbody id="EntourageList">
                                            <%for j=0 to 6%>
                                                <tr>
                                                    <td class="selected">&nbsp;</td>
                                                    <td class="category">&nbsp;</td>
                                                    <td class="category last">&nbsp;</td>
                                                </tr>
                                            <%next%>
                                        </tbody>
                                    </table>
                            </div>
                    </div>
                    </div>
                </div>
                <script LANGUAGE="javascript">
                //打开选择人员窗口
                function JS_EntourageOpen(id,OA_CompetencyID)
                {
                var sTop=document.documentElement.scrollTop;
                    if (sTop==0) {sTop=document.body.scrollTop;}
                var sLeft= document.documentElement.scrollLeft;
                    if (sLeft==0) {sLeft=document.body.scrollLeft;}
 
                var dTop = document.getElementById("EntourageName_"+id).getBoundingClientRect().top;
                if (dTop<200) {dTop=110;}
                var dLeft = document.getElementById("EntourageName_"+id).getBoundingClientRect().left;
                if (dLeft<200) {dLeft=200;}
                window_Entourage.style.display="block";
                window_Entourage.style.left=(dLeft-100)+"px";
                window_Entourage.style.top=(sTop+dTop+30)+"px";
                document.all.window_EntourageID.value=id;
                document.all.window_OA_CompetencyID.value=OA_CompetencyID;
                var OAHospID='';
                if (OA_CompetencyID=="OrdSendOA")
                {
                    OAHospID1=document.getElementById("ServiceOrdPtOutHospID").value;
                    OAHospID2=document.getElementById("ServiceOrdPtInHospID").value;
                    if (OAHospID1!='' && OAHospID2!=''){
                        OAHospID=OAHospID1+','+OAHospID2;
                    }else if (OAHospID1!=''){
                        OAHospID=OAHospID1;
                    }else if (OAHospID2!=''){
                        OAHospID=OAHospID2;
                    }
                }
                if (OA_CompetencyID!=0){window.HiddenFrame.location.replace('AdminUserSearch.gds?OrdClass=<%=ServiceOrdClass%>&OA_CompetencyID='+OA_CompetencyID+'&HospID='+OAHospID);}
                document.getElementById('EntourageSearchTXT').focus();
                }
                //关闭选择人员窗口
                function JS_EntourageClose()
                {
                document.all.EntourageSearchTXT.value='';
                document.all.window_EntourageID.value="";
                window_Entourage.style.display="none";
                }
                //选择人员查询
                function JS_EntourageSearch()
                {
                EntourageSearchTXT=document.all.EntourageSearchTXT.value;
                OA_CompetencyID=document.all.window_OA_CompetencyID.value;
                var OAHospID='';
                if (OA_CompetencyID=="OrdSendOA")
                {
                    OAHospID1=document.getElementById("ServiceOrdPtOutHospID").value;
                    OAHospID2=document.getElementById("ServiceOrdPtInHospID").value;
                    if (OAHospID1!='' && OAHospID2!=''){
                        OAHospID=OAHospID1+','+OAHospID2;
                    }else if (OAHospID1!=''){
                        OAHospID=OAHospID1;
                    }else if (OAHospID2!=''){
                        OAHospID=OAHospID2;
                    }
                }
                window.HiddenFrame.location.replace('AdminUserSearch.gds?OrdClass=<%=ServiceOrdClass%>&OA_CompetencyID='+OA_CompetencyID+"&HospID="+OAHospID+'&EntourageSearchTXT='+EntourageSearchTXT);
                }
                function EnterPress(e){ //传入 event 
                var e = e || window.event; 
                if(e.keyCode == 13){JS_EntourageSearch();} 
                } 
                //选择人员
                function JS_EntourageSave(OA_UserID,OA_UserName)
                {
                    id=document.all.window_EntourageID.value;
                    if (id=="OrdSendOAid" || id=="-5")
                    {
                        OA_UserID_old=document.getElementById("Entourage_"+id).value;
                        OA_UserName_old=document.getElementById("EntourageName_"+id).value;
                        if (OA_UserID_old=='') {
                            document.getElementById("Entourage_"+id).value=OA_UserID;
                            document.getElementById("EntourageName_"+id).value=OA_UserName;
                        }else{
                            if (OA_UserName_old.indexOf(OA_UserName) == -1)
                            {
                                document.getElementById("Entourage_"+id).value=document.getElementById("Entourage_"+id).value+","+OA_UserID;
                                document.getElementById("EntourageName_"+id).value=document.getElementById("EntourageName_"+id).value+","+OA_UserName;
                            }
                        }
                        document.getElementById("EntourageName_"+id).className='small';
                    }else{
                        document.getElementById("Entourage_"+id).value=OA_UserID;
                        document.getElementById("EntourageName_"+id).value=OA_UserName;
                        document.getElementById("EntourageName_"+id).className='small';
                        document.all.window_EntourageID.value="";
                        JS_EntourageClose();
                    }
                }
                //全选人员
                function JS_EntourageSaveAll()
                {
                    EntourageSearch=OAHospID1=document.getElementById("EntourageSearch").value;
                    if (EntourageSearch!='')
                    {
                        var EntourageSearchArr=EntourageSearch.split("|");
                        for (i = 1; i < EntourageSearchArr.length; i++) {
                            if (EntourageSearchArr[i]!='') {
                                EntourageArr=EntourageSearchArr[i].split(",");
                                JS_EntourageSave(EntourageArr[0],EntourageArr[1]);
                            }
                        }
                        JS_EntourageClose();
                    }
                    
                    
                }
                //选择人员清空
                function JS_EntourageDel()
                {
                    id=document.all.window_EntourageID.value;
                    document.getElementById("Entourage_"+id).value='';
                    document.getElementById("EntourageName_"+id).value='';
                    document.getElementById("EntourageName_"+id).className='small';
                    document.all.window_EntourageID.value="";
                    JS_EntourageClose();
                }
                //显示人员列表窗口
                function JS_EntourageList(EntourageListArray,acc1,acc2,EntourageSearchTXT,OA_CompetencyID,OA_CompetencyName)
                {
                    var EntourageListHTML = "";
                    var i = 0;
                    var OAHospID='';
                    document.getElementById("EntourageSearch").value="";
                    if (OA_CompetencyID=="OrdSendOA")
                    {
                        OAHospID1=document.getElementById("ServiceOrdPtOutHospID").value;
                        OAHospID2=document.getElementById("ServiceOrdPtInHospID").value;
                        if (OAHospID1!='' && OAHospID2!=''){
                            OAHospID=OAHospID1+','+OAHospID2;
                        }else if (OAHospID1!=''){
                            OAHospID=OAHospID1;
                        }else if (OAHospID2!=''){
                            OAHospID=OAHospID2;
                        }
                    }
                    if (EntourageListArray.length>0)
                    {
                        for (var i=0;i<EntourageListArray.length;i++)
                        {
                            document.getElementById("EntourageSearch").value=document.getElementById("EntourageSearch").value+"|"+EntourageListArray[i][0]+","+EntourageListArray[i][1]
                            EntourageListHTML = EntourageListHTML+"<tr onclick='JS_EntourageSave("+EntourageListArray[i][0]+",\""+EntourageListArray[i][1]+"\")' style='cursor:pointer'><td class='selected'><img src='"+EntourageListArray[i][3]+"' style='max-width:29px;max-height: 29px;'></td><td class='category'>"+EntourageListArray[i][1]+"</td><td class='selected last1'>"+EntourageListArray[i][2]+"</td></tr>";
                        }
                    }
                    if (acc2>1)
                    {
                        i=i+1;
                        EntourageListHTML = EntourageListHTML+"<tr><td class='selected'>&nbsp;</td><td colspan='2' style='text-align:center;'>";
                        if (acc1>1){EntourageListHTML = EntourageListHTML+"<a href='javascript:window.HiddenFrame.location.replace(\"AdminUserSearch.gds?OrdClass=<%=ServiceOrdClass%>&OA_CompetencyID="+OA_CompetencyID+"&HospID="+OAHospID+"&EntourageSearchTXT="+EntourageSearchTXT+"&page="+(acc1-1)+"\");'>上一页</a>";}else{EntourageListHTML = EntourageListHTML+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";}
                        if (acc1<acc2){EntourageListHTML = EntourageListHTML+"&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:window.HiddenFrame.location.replace(\"AdminUserSearch.gds?OrdClass=<%=ServiceOrdClass%>&OA_CompetencyID="+OA_CompetencyID+"&HospID="+OAHospID+"&EntourageSearchTXT="+EntourageSearchTXT+"&page="+(acc1+1)+"\");'>下一页</a></td></tr>";}
                    }
                    
                    for (var j=i;j<10;j++)
                    {
                        EntourageListHTML = EntourageListHTML+"<tr><td class='selected'>&nbsp;</td><td class='price'>&nbsp;</td><td class='selected last1'>&nbsp;</td></tr>";
                    }
                    document.getElementById("EntourageList").innerHTML=EntourageListHTML;
                    
                }
                </script>
                <!-- end forms -->    
                </div>
                <!-- end forms -->    
                
 
 
                <%If ServiceOrdID<>"" And ServiceOrd_AP_Check="1" And isDepartment("03")=1 Then%>
                <!-- forms -->
                <div class="box">
                    <!-- box / title -->
                    <div class="title">
                        <h5>派车调度单</h5>
                    </div>
                    <!-- end box / title -->
                    <!-- end box / title -->
                    <div class="table">
                        <table>
                            <thead>
                                <tr style="white-space: nowrap;">
                                    <th>单据编号</th>
                                    <th>开单日期</th>
                                    <th>车牌号码</th>
                                    <%sql="select vID,vtext from dictionary where vType=1 and vtitle='DispatchOrdEntourage' order by vOrder"
                                    rs.open sql,objConn,1,1
                                    i=0
                                    EntourageIDs=""
                                    do while not rs.Eof
                                        EntourageID    = rs("vID")
                                        EntourageName= rs("vtext")
                                        EntourageIDs=EntourageIDs&","&EntourageID
                                        %>
                                        <th><%=EntourageName%></th>
                                        <%i=i+1
                                        rs.movenext
                                    loop
                                    rs.close()
                                    EntourageIDPS    = SPLIT(EntourageIDs,",")
                                    %>
                                    <th>出车时间</th>
                                    <th>行程</th>
                                    <th class="last">状态</th>
                                </tr>
                            </thead>
                            <tbody>
                            <%
                              sql="select * from DispatchOrd LEFT JOIN ServiceOrder on ServiceOrdIDDt=ServiceOrdID where ServiceOrdIDDt="&ServiceOrdID&" and DispatchOrdState>=0 order by DispatchOrdID"
                                'Response.Write sql
                                rs.open sql,objConn,1,1
                                i=0
                                StretcherMoney=0
                                do while not rs.Eof
                                  DispatchOrdID            = rs("DispatchOrdID")            '调度单号
                                  DispatchOrdClass        = rs("DispatchOrdClass")        '调度单单据类型
                                  ServiceOrdID            = rs("ServiceOrdID")            '受理单号
                                  ServiceOrdClass        = rs("ServiceOrdClass")            '受理单单据类型
                                  DispatchOrdState        = rs("DispatchOrdState")        '服务单状态
                                  DispatchOrd_NS_Time    = rs("DispatchOrd_NS_Time")    '开单日期
                                  DispatchOrdCarID        = rs("DispatchOrdCarID")        '调度车辆ID
                                  ServiceOrdApptDate    = rs("ServiceOrdApptDate")        '预约日期
                                  ServiceOrdCoName        = rs("ServiceOrdCoName")        '联系人姓名
                                  ServiceOrdCoPhone        = rs("ServiceOrdCoPhone")        '联系人电话
                                  ServiceOrdTraProvince    = rs("ServiceOrdTraProvince")    '出发地省份
                                  ServiceOrdTraCity        = rs("ServiceOrdTraCity")        '出发地城市
                                  ServiceOrdTraStreet    = rs("ServiceOrdTraStreet")        '出发地
                                  ServiceOrdTraEnd        = rs("ServiceOrdTraEnd")        '目的地
                                  ServiceOrdTraSDTime    = rs("ServiceOrdTraSDTime")        '拟出发时间
                                  DispatchOrd_AP_Check    = rs("DispatchOrd_AP_Check")        '审核状态(0未审核,1已审核)
                                  DispatchOrd_AP_ID        = rs("DispatchOrd_AP_ID")        '审核人员ID
                                  DispatchOrd_AP_Time    = rs("DispatchOrd_AP_Time")        '审核时间
                                  StretcherMoney        = StretcherMoney+rs("StretcherMoney")        '担架费
                                  DispatchOrdNo            = DispatchOrdClass& year(rs("DispatchOrd_NS_Time"))&Right("0"&month(rs("DispatchOrd_NS_Time")),2)&Right("0"&day(rs("DispatchOrd_NS_Time")),2) & "-"&Right("00"&rs("DispatchOrdNo"),3)    '调度单编号
 
                                  If DispatchOrdState<>10 Then i=i+1
 
                                  If ServiceOrdTraSDTime<>"" Then
                                    ServiceOrdTraSDTime=FORMATDATETIME(ServiceOrdTraSDTime,vbShortDate) &" "& Right("0"&Hour(ServiceOrdTraSDTime),2) &":"& Right("0"&Minute(ServiceOrdTraSDTime),2)
                                  End If
                                  If ServiceOrdApptDate<>"" Then
                                    ServiceOrdApptDate=FORMATDATETIME(ServiceOrdApptDate,vbShortDate) &" "& Right("0"&Hour(ServiceOrdApptDate),2) &":"& Right("0"&Minute(ServiceOrdApptDate),2)
                                  End If
                                  If DispatchOrdState<>10 Then Response.Write "<script LANGUAGE=""javascript"">document.getElementById(""form_Dispatch"").style.display='none';</script>"
                                  %>
                                  <tr style="white-space: nowrap;">
                                    <td class="category"><A HREF="DispatchOrder.gds?DispatchOrdID=<%=DispatchOrdID%>&OrdDateType=<%=OrdDateType%>&OrdClassList=<%=OrdClassList%>&h_menu1_1=1"><%=DispatchOrdNo%></A></td>
                                    <td class="category"><A HREF="DispatchOrder.gds?DispatchOrdID=<%=DispatchOrdID%>&OrdDateType=<%=OrdDateType%>&OrdClassList=<%=OrdClassList%>&h_menu1_1=1"><%=FORMATDATETIME(DispatchOrd_NS_Time,vbShortDate)%></A></td>
                                    <td class="selected"><%=DispatchOrdCarLicense%></td>
                                    <%
                                    for j = 1 to UBOUND(EntourageIDPS)
                                        EntourageID    = EntourageIDPS(j)
                                        %>
                                        <td class="category"><%=EntourageOANameA(EntourageID,DispatchOrdID,"UserName")%></td>
                                    <%Next%>
 
                                    <td class="category"><%=ServiceOrdTraSDTime%></td>
                                    <td class="category"><%=ServiceOrdTraStreet%>~<%=ServiceOrdTraEnd%></td>
                                    <td class="category last"><%=DispatchOrdStateA(DispatchOrdState)%></td>
                                  </tr>
                                <%rs.movenext
                                loop
                                rs.close()
                                %>
                            <%for j=i to 1%>
                                    <tr>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td class="last">&nbsp;</td>
                                    </tr>
                                <%next%>
                            </tbody>
                        </table>
                    </div>
                </div>
                <script LANGUAGE="javascript">
                        //生成调度单
                        <%if i>=1 then%>
                        
                        function form1_Dispatch(){
                        if(confirm("本受理单已有调度单正在进行中,确定再生成新的调度单?"))
                            {
                                window.location.href='/DispatchOrder.gds?ServiceOrdID=<%=ServiceOrdID%>&OrdDateType=1&OrdClassList=0&h_menu1_1=1';
                            }
                        }
                        <%else%>
                        function form1_Dispatch(){
                            window.location.href='/DispatchOrder.gds?ServiceOrdID=<%=ServiceOrdID%>&OrdDateType=1&OrdClassList=0&h_menu1_1=1';
                        }
                        <%end if%>
                        
                    </script>
                <!-- end forms -->    
                <%End if%>
                
                
                <%If ServiceOrdID<>""  Then%>
                <!-- forms -->
                <div class="box">
                    <!-- box / title -->
                    <div class="title">
                        <h5>收款记录</h5>
                    </div>
                    <!-- end box / title -->
                    <!-- end box / title -->
                    <div class="table">
                        <table>
                            <thead>
                                <tr style="white-space: nowrap;">
                                    <th>收款编号</th>
                                    <th>收款日期</th>
                                    <th>收款方式</th>
                                    <th>收款金额</th>
                                    <th>收款/申请</th>
                                    <th>状态</th>
                                    <th>备注</th>
                                    <th class="selected last"><input type="checkbox" class="checkall" /></th>
                                </tr>
                            </thead>
                            <form id="form3" name="form3" action="" method="post">
                            <input name="admin_save" type="hidden" value="34">
                            <input name="PaidMoney_Check" type="hidden" value="">
                            <input name="ServiceOrdID" type="hidden" value="<%=ServiceOrdID%>">
                            <tbody>
                            <%
                              sql="select PaidMoney.id,vtext,PaidMoney,PaidMoneyType,PaidMoneyTime,PaidMoneyOaID,PaidMoney_AP_Check,PaidMoney_AP_ID,PaidMoney_AP_Time,PaidMoneyMono from PaidMoney,dictionary where vtitle='PaidMoneyType' and vType>=1 and vID=PaidMoneyType and PaidMoney<>0 and ServiceOrdIDDt="&ServiceOrdID&" order by PaidMoneyTime"
                                rs.open sql,objConn,1,1
                                i=0
                                PaidMoney_Check=0
                                sunPaidMoney=0
                                do while not rs.Eof
                                  PaidMoneyID        = rs("ID")                        '收款单号
                                  PaidMoneyName        = rs("vtext")                    '收款方式名称
                                  PaidMoneyType        = rs("PaidMoneyType")            '收款方式ID
                                  PaidMoney            = rs("PaidMoney")                '收款金额
                                  PaidMoneyTime        = rs("PaidMoneyTime")            '收款时间
                                  PaidMoneyOaID        = rs("PaidMoneyOaID")            '收款操作人员ID
                                  PaidMoney_AP_Check= rs("PaidMoney_AP_Check")        '审核状态(0未审核,1已审核)
                                  PaidMoney_AP_ID        = rs("PaidMoney_AP_ID")        '审核人员ID
                                  PaidMoney_AP_Time    = rs("PaidMoney_AP_Time")        '审核时间
                                  PaidMoneyMono        = rs("PaidMoneyMono")            '结算备注
                                  PaidMoneyMono=Replace(PaidMoneyMono,"]","]<br>")
 
                                  If PaidMoney_AP_Check>=0 Then sunPaidMoney=sunPaidMoney+PaidMoney
                                  If PaidMoney_AP_Check=0 Then PaidMoney_Check=1
                                  %>
                                  <tr style="white-space: nowrap;">
                                    <td class="category"><%=PaidMoneyID%></td>
                                    <td class="category"><%=PaidMoneyTime%></td>
                                    <td class="category"><%=PaidMoneyName%></td>
 
                                    <td class="category"><%=MoneyCheck(PaidMoney,1)%></td>
                                    <td class="category"><%=OAUser(PaidMoneyOaID,"UserName")%></td>
                                    <td class="category"><%=AP_CHECK_A(PaidMoney_AP_Check)%><%If PaidMoney_AP_Check<>0 Then Response.Write "<br>("&OAUser(PaidMoney_AP_ID,"UserName")&"&nbsp;"&PaidMoney_AP_Time&")"%></td>
                                    <td class="category"><%=PaidMoneyMono%></td>
                                    <td class="selected last"><%If PaidMoney_AP_Check=0 then%><input type="checkbox" id="PaidMoneyID_<%=PaidMoneyID%>" name="PaidMoneyID" value="<%=PaidMoneyID%>"/><%End if%></th>
                                    
                                  </tr>
                                <%rs.movenext
                                loop
                                rs.close()
                                %>
                                    <tr>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td style="text-align: right;">总收款:</td>
                                        <td style="text-align: center;"><%=MoneyCheck(sunPaidMoney,1)%></td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td class="last">&nbsp;</td>
                                    </tr>
                                    <%If ServiceOrdTraTxnPrice-sunPaidMoney>0 then%>
                                    <tr>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td style="text-align: right;">未支付:</td>
                                        <td style="text-align: center;"><%=MoneyCheck(ServiceOrdTraTxnPrice+StretcherMoney-sunPaidMoney,1)%></td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                        <td class="last">&nbsp;</td>
                                    </tr>
                                    <%End if%>
                                    <%'发票相关信息
                                    sql="select top 1 InvoiceID,InvoiceType,InvoiceName,InvoiceMakeout,AuditStatus,ApplicationTime,AuditTime,Invoice_strEmail,InvoiceCompanyID,Invoice_strPhone,InvoiceURL,InvoiceOddNo from InvoiceData where ServiceOrderIDPK="&ServiceOrdID&" order by AuditStatus,InvoiceID desc"
                                    rs.open sql,objConn,1,1
                                    If not rs.Eof Then
                                    isInvoice="1"%>
                                    <tr>
                                        <td colspan="8" class="last" style="text-align: right;">&nbsp;
                                            发票抬头:<%=rs("InvoiceName")%>&nbsp;&nbsp;
                                            <%If rs("InvoiceMakeout")<>"" Then%>发票备注:<%=rs("InvoiceMakeout")%>&nbsp;&nbsp;<%End If%>
                                            <%If rs("Invoice_strEmail")<>"" And rs("Invoice_strEmail")<>"无" Then%>接收电子邮箱:<%=rs("Invoice_strEmail")%>&nbsp;&nbsp;<%End If%>
                                            <%If rs("Invoice_strPhone")<>"" And rs("Invoice_strPhone")<>"无" Then%>接收短信电话:<%=rs("Invoice_strPhone")%>&nbsp;&nbsp;<%End If%>
                                            <%If rs("InvoiceCompanyID")<>"" And rs("InvoiceCompanyID")<>"无" Then%>纳税识别号:<%=rs("InvoiceCompanyID")%>&nbsp;&nbsp;<%End If%>
                                            发票类型:<%=InvoiceType_A(rs("InvoiceType"))%>&nbsp;&nbsp;
                                            申请时间:<%=rs("ApplicationTime")%>&nbsp;&nbsp;
                                            处理状态:<%=AuditStatus_A(rs("AuditStatus"))%>&nbsp;&nbsp;
                                            <%If rs("AuditTime")<>"" Then%>处理时间:<%=rs("AuditTime")%>&nbsp;&nbsp;<%End If%>
                                            <%If rs("InvoiceURL")<>"" Then%>
                                            [<a href="<%=rs("InvoiceURL")%>" target='_blank'>下载发票</a>]&nbsp;&nbsp;
                                            <%ElseIf rs("InvoiceOddNo")<>"" Then%>
                                            物流单号:<%=rs("InvoiceOddNo")%>&nbsp;&nbsp;
                                            <%End If%>
                                        </td>
                                    </tr>
                                    <%End If
                                    rs.close()%>
                            </tbody>
                            </form>
                        </table>
                        <%If (PaidMoney_Check=1 And isDepartment("030204")=1) Or isDepartment("030202")=1 Or isDepartment("030208")=1 then%>
                        <div class="action">
                            <div class="button">
                                
                                <%If isDepartment("030202")=1 And isInvoice<>"1" Then%>
                                <input type="button" name="submit51" id="InvoiceAdd" value="发票申请" class="ui-button ui-widget ui-state-default ui-corner-all" role="button" aria-disabled="false" onclick="javascript:JS_InvoiceCreateOpen()">&nbsp;&nbsp;
                                <%End If%>
                                <%If isDepartment("030202")=1 And DispatchOrd_AP_Check<>1 And IsLocking<>"1" Then%>
                                <input type="button" name="submit51" id="PaidMoneyAdd" value="新建费用单" class="ui-button ui-widget ui-state-default ui-corner-all" role="button" aria-disabled="false" onclick="javascript:JS_PaidMoneyCreateOpen()">&nbsp;&nbsp;
                                <%End If%>
                                <%If PaidMoney_Check=1 And isDepartment("030204")=1 And DispatchOrd_AP_Check<>1 And IsLocking<>"1" then%><input type="button" name="submit51" id="PaidMoneyAP_1" value="审核费用单" class="ui-button ui-widget ui-state-default ui-corner-all" role="button" aria-disabled="false" onclick="javascript:form1_AP_1();">&nbsp;&nbsp;<%End If%>
                                <%If PaidMoney_Check=1 And isDepartment("030203")=1 And DispatchOrd_AP_Check<>1 And IsLocking<>"1" then%><input type="button" name="submit51" id="PaidMoneyAP_1" value="作废费用单" class="ui-button ui-widget ui-state-default ui-corner-all" role="button" aria-disabled="false" onclick="javascript:form1_AP_2();">&nbsp;&nbsp;<%End If%>
                                <%If isDepartment("030208")=1 And DispatchOrd_AP_Check<>1 And IsLocking<>"1" Then%><input type="button" name="submit51" id="PaidMoneyRefundOpen" value="申请退款" class="ui-button ui-widget ui-state-default ui-corner-all" role="button" aria-disabled="false" onclick="javascript:JS_PaidMoneyRefundOpen()">&nbsp;&nbsp;<%End If%>
 
 
                            </div>
                            <script LANGUAGE="javascript">
                                //审核
                                function form1_AP_1(){
                                if(confirm("确定审核所选费用单?"))
                                    {
                                        document.form3.action = "admin_save.gds";
                                        document.form3.admin_save.value="34"
                                        document.form3.PaidMoney_Check.value="1"
                                        form3.submit();
                                    }
                                }
                                //反审核
                                function form1_AP_0(){
                                if(confirm("确定反审核所选费用单?"))
                                    {
                                        document.form3.action = "admin_save.gds";
                                        document.form3.admin_save.value="34"
                                        document.form3.PaidMoney_Check.value="0"
                                        form3.submit();
                                    }
                                }
                                //作废
                                function form1_AP_2(){
                                if(confirm("确定作废所选费用单?"))
                                    {
                                        document.form3.action = "admin_save.gds";
                                        document.form3.admin_save.value="34"
                                        document.form3.PaidMoney_Check.value="-1"
                                        form3.submit();
                                    }
                                }
                                
                            </script>
 
                            <!--新建发票申请-->
                                <script LANGUAGE="javascript">
                                    //打开发票申请窗口
                                    function JS_InvoiceCreateOpen()
                                    {
                                    var sTop=document.documentElement.scrollTop;
                                        if (sTop==0) {sTop=document.body.scrollTop;}
                                    var sLeft= document.documentElement.scrollLeft;
                                        if (sLeft==0) {sLeft=document.body.scrollLeft;}
                                    var dTop = document.getElementById("InvoiceAdd").getBoundingClientRect().top;
                                    var dLeft = document.getElementById("InvoiceAdd").getBoundingClientRect().left;
                                    if (dTop<200) {dTop=200;}
                                    if (dLeft<120) {dLeft=120;}
                                    InvoiceCreate.style.display="block";
                                    InvoiceCreate.style.left=(dLeft-330)+"px";
                                    InvoiceCreate.style.top=(sTop+dTop-800)+"px";
                                    InvoiceCreate.style.display='block';
                                    JS_InvoiceSearch();
                                    }
 
                                    //新建发票申请-关闭上传窗口
                                    function JS_InvoiceCreateClose()
                                    {
                                    InvoiceCreate.style.display="none";
                                    }
                                    //新建发票申请-保存
                                    function JS_InvoiceCreateSave()
                                    {
                                        InvoiceType=document.formInvoice.InvoiceType.value;
                                        InvoiceMoney=document.formInvoice.InvoiceMoney.value;
                                        InvoiceName=document.formInvoice.InvoiceName.value;
                                        InvoiceCompanyID=document.formInvoice.InvoiceCompanyID.value;
                                        Invoice_strAdd=document.formInvoice.Invoice_strAdd.value;
                                        Invoice_strName=document.formInvoice.Invoice_strName.value;
                                        Invoice_strPhone=document.formInvoice.Invoice_strPhone.value;
                                        Invoice_strEmail=document.formInvoice.Invoice_strEmail.value;
                                        if (InvoiceMoney==''){alert("请填写开票金额!");return false;}
                                        if (InvoiceName==''){alert("请填写发票抬头!");return false;}
                                        if (InvoiceName.indexOf("公司")>=0 && InvoiceCompanyID==''){alert("请填写纳税识别号!");return false;}
                                        if (InvoiceType=='2'){
                                            if (Invoice_strEmail==''){alert("请填写电子邮箱!");return false;}
                                            if (Invoice_strPhone==''){alert("请填写接收短信电话!");return false;}
                                        }else if (InvoiceType=='3'){
                                            if (Invoice_strPhone==''){alert("请填写收件人电话!");return false;}
                                            if (Invoice_strName==''){alert("请填写收件人!");return false;}
                                            if (Invoice_strAdd==''){alert("请填写邮寄地址!");return false;}
                                        }
                                        formInvoice.submit();
                                    }
                                    //受理单调单查询
                                    function JS_InvoiceSearch()
                                    {
                                    ServiceOrdNo=document.formInvoice.ServiceOrdNo.value;
                                        $.ajax({
                                            type: "POST",
                                            dataType:'json',
                                            url: "Search_ServiceOrd_ajax.gds",
                                            data: {
                                                ServiceOrdNo:ServiceOrdNo,
                                                Invoice:1
                                            },
                                            success:function(data){
                                                //console.log(data);
                                                if (data!='')
                                                {
                                                    if (data.result==1){
                                                        document.formInvoice.InvoiceName.value=data.ServiceOrdCoName;
                                                        document.formInvoice.Invoice_strPhone.value=data.ServiceOrdCoPhone;
                                                        document.formInvoice.Invoice_strName.value=data.ServiceOrdCoName;
                                                        document.formInvoice.InvoiceMoney.value=data.PaidMoney;
                                                        document.formInvoice.ServiceOrdID.value=data.ServiceOrdID;
                                                    }else{
                                                        alert("受理单号错误");
                                                    }
                                                }
                                            }
                                        })
                                    }
                                    function JS_InvoiceType(){
                                            InvoiceType = document.formInvoice.InvoiceType.value;
                                            if(InvoiceType=='2') {
                                                InvoiceCompanyAddDiv.style.display="none";
                                                InvoiceCompanyBankDiv.style.display="none";
                                                Invoice_strAddDiv.style.display="none";
                                                Invoice_strEmailDiv.style.display="block";
                                                Invoice_strNameTXT.innerHTML="接收人<font color='#ff0000'>*</font>:";
                                                Invoice_strPhoneTXT.innerHTML="接收短信电话<font color='#ff0000'>*</font>:";
                                            }else if (InvoiceType=='3') {
                                                InvoiceCompanyAddDiv.style.display="none";
                                                InvoiceCompanyBankDiv.style.display="none";
                                                Invoice_strAddDiv.style.display="block";
                                                Invoice_strEmailDiv.style.display="none";
                                                Invoice_strNameTXT.innerHTML="收件人<font color='#ff0000'>*</font>:";
                                                Invoice_strPhoneTXT.innerHTML="收件人电话<font color='#ff0000'>*</font>:";
                                            }else if (InvoiceType=='4') {
                                                InvoiceCompanyAddDiv.style.display="block";
                                                InvoiceCompanyBankDiv.style.display="block";
                                                Invoice_strAddDiv.style.display="block";
                                                Invoice_strEmailDiv.style.display="none";
                                                Invoice_strNameTXT.innerHTML="收件人<font color='#ff0000'>*</font>:";
                                                Invoice_strPhoneTXT.innerHTML="收件人电话<font color='#ff0000'>*</font>:";
                                            }
                                        }
                                </script>
                                <div class="dialogJ  dialogJfix dialogJshadow" id="InvoiceCreate" style="width:800px; right: 300px; top: 150px;display:none;text-align: left;z-index: 1000;">
                        
                                <div class="dialogJtitle">
                                    <a href="javascript:JS_InvoiceCreateClose();" class="dialogJclose" title="关闭本窗口">&nbsp;</a>
                                    <span class="dialogJtxt" id="EditPhotoTXT">发票申请信息</span>
                                </div>
                                <form id="formInvoice" name="formInvoice" action="admin_save.gds" method="post">
                                <input name="admin_save" type="hidden" value="127">
                                <input name="ServiceOrdID" type="hidden" value="<%=ServiceOrdID%>">
                                <input name="DispatchOrdID" type="hidden" value="">
                                <input name="ReturnID" type="hidden" value="ServiceOrder">
                                <div class="dialogJcontent">
                                    <div class="dialogJbody" id="dialogJbody">
                                        <div class="modify-album-name">
                                            <span>服务单号:</span>
                                            <input name="ServiceOrdNo" type="text" value="<%=ServiceOrdNo%>" style="width: 165px;" maxlength="99/"><input type="button" style="text-indent:initial;" class="dialogJbtn first-child" onclick="JS_InvoiceSearch()" value="调用"> 
                                        </div>
                                        <div class="modify-album-name">
                                            <span>发票类型:</span>
                                            <select id="InvoiceType" name="InvoiceType" onchange="JS_InvoiceType();" style="padding: 5px 0 5px 8px;">
                                                <option value="2">电子发票</option>
                                                <option value="3">增值税普票</option>
                                                <!--<option value="4">增值税专票</option>-->
                                            </select>
                                            <span>开票金额<font color="#ff0000">*</font>:</span>
                                            <input id="InvoiceMoney" name="InvoiceMoney" type="text" value="" maxlength="99/" style="width: 100px;">
                                        </div>
                                        <div class="modify-album-name">
                                            <span>发票抬头<font color="#ff0000">*</font>:</span>
                                            <input id="InvoiceName" name="InvoiceName" type="text" value="" maxlength="99/" style="width: 400px;">
                                        </div>
                                        <div class="modify-album-name">
                                            <span>发票备注:</span>
                                            <input id="InvoiceMakeout" name="InvoiceMakeout" type="text" value="" maxlength="99/" style="width: 400px;">
                                        </div>
                                        <div class="modify-album-name">
                                            <span>纳税识别号:</span>
                                            <input id="InvoiceCompanyID" name="InvoiceCompanyID" type="text" value="" maxlength="99/" style="width: 388px;">
                                        </div>
                                        <div class="modify-album-name" id="InvoiceCompanyAddDiv" style="display:none;">
                                            <span>企业注册地址:</span>
                                            <input name="InvoiceCompanyAdd" type="text" value="" maxlength="99/" style="width: 300px;">
                                            <span>企业电话:</span>
                                            <input name="InvoiceCompanyPhone" type="text" value="" maxlength="99/" style="width: 200px;">
                                        </div>
                                        <div class="modify-album-name" id="InvoiceCompanyBankDiv" style="display:none;">
                                            <span>企业开户银行:</span>
                                            <input name="InvoiceCompanyBank" type="text" value="" maxlength="99/" style="width: 200px;">
                                            <span>企业银行账号:</span>
                                            <input name="InvoiceCompanyBankNo" type="text" value="" maxlength="99/" style="width: 276px;">
                                        </div>
                                        <div class="modify-album-name" id="Invoice_strAddDiv" style="display:none;">
                                            <span>邮寄地址<font color="#ff0000">*</font>:</span>
                                            <input name="Invoice_strAdd" id="Invoice_strAdd" type="text" value="" maxlength="99/" style="width: 286px;">
                                            <span>邮编:</span>
                                            <input name="InvoiceZipCode" type="text" value="" maxlength="99/" style="width: 60px;">
                                            <br><font color="#E91E63">邮寄费用到付</font>
                                        </div>
                                        <div class="modify-album-name" id="Invoice_strEmailDiv">
                                            <span>接收电子邮箱<font color="#ff0000">*</font>:</span>
                                            <input name="Invoice_strEmail" type="text" value="" maxlength="99/" style="width: 200px;">若无邮箱,请填写“无”
                                        </div>
                                        <div class="modify-album-name">
                                            <span id="Invoice_strNameTXT">接收人<font color="#ff0000">*</font>:</span>
                                            <input id="Invoice_strName" name="Invoice_strName" type="text" value="" maxlength="99/" style="width: 150px;">
                                            <span id="Invoice_strPhoneTXT">接收短信电话<font color="#ff0000">*</font>:</span>
                                            <input id="Invoice_strPhone" name="Invoice_strPhone" type="text" value="" maxlength="99/" style="width: 156px;">
                                        </div>
                                        
                                    </div>
                                </div>
                                </form>
                                <div class="dialogJanswers" style="padding: 30px 20px 13px 18px;">
                                    <input type="button" class="dialogJbtn first-child" onclick="JS_InvoiceCreateSave()" value="确定"> 
                                    <input type="button" class="dialogJbtn" onclick="JS_InvoiceCreateClose()" value="取消">
                                </div>
                            </div>
                            <!--新建发票申请 end-->
 
                            <!--申请退款-->
                            <%If isDepartment("030208")=1 Then%>
                            <script LANGUAGE="javascript">
                             //打开申请退款窗口
                                function JS_PaidMoneyRefundOpen()
                                {
                                    var PaidMoneyIDobj = document.getElementsByName("PaidMoneyID");
                                    var num  = 0;
                                    var id  = '';
                                    for (var i = 0; i < PaidMoneyIDobj.length; i++) {
                                        if (PaidMoneyIDobj[i].checked){
                                            num++;
                                            id=PaidMoneyIDobj[i].value;
                                        }
                                    }
                                    if (num==1){
                                        $.ajax({
                                            type: "POST",
                                            dataType:'json',
                                            url: "Search_PaidMoney.gds",
                                            data: {
                                                PaidMoneyID:id
                                            },
                                            success:function(data){
                                                //console.log(data);
                                                if (data!='')
                                                {
                                                    if (data.result==1){
                                                        if (data.PaidMoney>0){
                                                            var sTop=document.documentElement.scrollTop;
                                                            if (sTop==0) {sTop=document.body.scrollTop;}
                                                            var sLeft= document.documentElement.scrollLeft;
                                                                if (sLeft==0) {sLeft=document.body.scrollLeft;}
                                                            var dTop = document.getElementById("PaidMoneyRefundOpen").getBoundingClientRect().top;
                                                            var dLeft = document.getElementById("PaidMoneyRefundOpen").getBoundingClientRect().left;
                                                            if (dTop<200) {dTop=200;}
                                                            if (dLeft<120) {dLeft=120;}
                                                            PaidMoneyRefund.style.display="block";
                                                            PaidMoneyRefund.style.left=(dLeft-330)+"px";
                                                            PaidMoneyRefund.style.top=(sTop+dTop-600)+"px";
                                                            PaidMoneyRefund.style.display='block';
                                                            document.getElementById("PaidMoneyToId").value=data.PaidMoneyID;
                                                            document.getElementById("PaidMoneyToMoney").value=data.PaidMoney;
                                                            document.getElementById("PaidMoneyRefund_ToId").innerHTML=data.PaidMoneyID;
                                                            document.getElementById("PaidMoneyRefund_PaidMoney").innerHTML=data.PaidMoney;
                                                            document.getElementById("RefundMoney").value=data.PaidMoney;
                                                            document.getElementById("PaidMoneyRefund_alert").innerHTML='';
                                                            document.getElementById("PaidMoneyRefund_alert2").innerHTML='';
                                                        }else{
                                                            alert("本收款记录没款可退");
                                                            JS_PaidMoneyRefundClose()
                                                        }
                                                    }else{
                                                        alert("请选择一条收款记录");
                                                        JS_PaidMoneyRefundClose()
                                                    }
                                                }
                                            }
                                        })
                                        
                                    }else{
                                        alert("请选择一条收款记录");
                                        JS_PaidMoneyRefundClose()
                                    }
                                }
                                //申请退款-关闭上传窗口
                                function JS_PaidMoneyRefundClose()
                                {
                                PaidMoneyRefund.style.display="none";
                                }
                                //申请退款-保存
                                function JS_PaidMoneyRefundSave()
                                {
                                    var RefundMoney=document.getElementById("RefundMoney").value;
                                    var PaidMoney=document.getElementById("PaidMoneyToMoney").value;
                                    var PaidMoneyMono=document.form4.PaidMoneyMono.value;
                                    if (RefundMoney<=0 || RefundMoney=='' || isNaN(RefundMoney)==true) {document.getElementById("PaidMoneyRefund_alert").innerHTML='<label style="color: #E91E63;">退款金额不可为0</label>';return false;}
                                    if (parseInt(RefundMoney)>parseInt(PaidMoney)) {document.getElementById("PaidMoneyRefund_alert").innerHTML='<label style="color: #E91E63;">退款金额不可大于可退金额</label>';return false;}
                                    if (parseInt(RefundMoney)>2000) {document.getElementById("PaidMoneyRefund_alert").innerHTML='<label style="color: #E91E63;">退款金额大于2000,请通知财务手动退款</label>';return false;}
                                    if (PaidMoneyMono=='') {document.getElementById("PaidMoneyRefund_alert2").innerHTML='<label style="color: #E91E63;">退款备注不可为空</label>';return false;}
                                    document.getElementById("PaidMoneyRefund_alert").innerHTML='';
                                    document.getElementById("PaidMoneyRefund_alert2").innerHTML='';
                                    form4.submit();
                                }
                            </script>
 
                            <div class="dialogJ  dialogJfix dialogJshadow" id="PaidMoneyRefund" style="width: 370px; right: 300px; top: 150px;display:none;text-align: left;">
                            
                                <div class="dialogJtitle">
                                    <a href="javascript:JS_PaidMoneyRefundClose();" class="dialogJclose" title="关闭本窗口">&nbsp;</a>
                                    <span class="dialogJtxt" id="EditPhotoTXT">申请退款</span>
                                </div>
                                <form id="form4" name="form4" action="admin_save.gds" method="post">
                                <input name="admin_save" type="hidden" value="126">
                                <input name="ServiceOrdID" type="hidden" value="<%=ServiceOrdID%>">
                                <input name="PaidMoneyToId" id="PaidMoneyToId" type="hidden" value="">
                                <input name="PaidMoneyToMoney" id="PaidMoneyToMoney" type="hidden" value="">
                                <input name="PaidMoneyTimestamp" id="PaidMoneyTimestamp" type="hidden" value="<%=ToUnixTime(now(),+8)%>">
                                <input name="ReturnID" type="hidden" value="ServiceOrder">
                                <div class="dialogJcontent">
                                    <div class="dialogJbody" id="dialogJbody">
                                        <div class="modify-album-name">
                                            <span>收款编号:</span>
                                            <span id="PaidMoneyRefund_ToId" style="color: #000000;"></span>
                                        </div>
                                        <div class="modify-album-name">
                                            <span>可退金额:</span>
                                            <span id="PaidMoneyRefund_PaidMoney" style="color: #000000;"></span>
                                        </div>
                                        <div class="modify-album-name">
                                            <span>退款金额:</span>
                                            <input id="RefundMoney" name="PaidMoney" type="text" value="" style="width: 165px;" maxlength="99/">
                                            <span id="PaidMoneyRefund_alert"></span>
                                        </div>
                                        <div class="modify-album-name">
                                            <span>退款备注:</span><span id="PaidMoneyRefund_alert2"></span>
                                            <input name="PaidMoneyMono" type="text" value="" maxlength="99/">
                                        </div>
                                    </div>
                                </div>
                                </form>
                                <div class="dialogJanswers" style="padding: 30px 20px 13px 18px;">
                                    <input type="button" class="dialogJbtn first-child" onclick="JS_PaidMoneyRefundSave()" value="确定"> 
                                    <input type="button" class="dialogJbtn" onclick="JS_PaidMoneyRefundClose()" value="取消">
                                </div>
                            </div>
                            <%End If%>
                            <!--申请退款 end-->
 
                            <!--新建费用单-->
                            <script LANGUAGE="javascript">
                            //打开新建费用单窗口
                                function JS_PaidMoneyCreateOpen()
                                {
                                var sTop=document.documentElement.scrollTop;
                                    if (sTop==0) {sTop=document.body.scrollTop;}
                                var sLeft= document.documentElement.scrollLeft;
                                    if (sLeft==0) {sLeft=document.body.scrollLeft;}
                                var dTop = document.getElementById("PaidMoneyAdd").getBoundingClientRect().top;
                                var dLeft = document.getElementById("PaidMoneyAdd").getBoundingClientRect().left;
                                if (dTop<200) {dTop=200;}
                                if (dLeft<120) {dLeft=120;}
                                PaidMoneyCreate.style.display="block";
                                PaidMoneyCreate.style.left=(dLeft-230)+"px";
                                PaidMoneyCreate.style.top=(sTop+dTop-600)+"px";
                                PaidMoneyCreate.style.display='block';
                                JS_PaidMoneySearch();
                                }
 
                                //新建费用单-关闭上传窗口
                                function JS_PaidMoneyCreateClose()
                                {
                                PaidMoneyCreate.style.display="none";
                                }
                                //新建费用单-保存
                                function JS_PaidMoneyCreateSave()
                                {
                                form2.submit();
                                }
                                //受理单调单查询
                                function JS_PaidMoneySearch()
                                {
                                ServiceOrdNo=document.form2.ServiceOrdNo.value;
                                window.HiddenFrame.location.replace('Search_ServiceOrd.gds?ServiceOrdNo='+ServiceOrdNo);
                                }
                                //显示受理单数据
                                function JS_PaidMoneyData(ServiceOrdID,ServiceOrdPtName,PaidMoney)
                                {
                                    document.form2.ServiceOrdPtName.value=ServiceOrdPtName;
                                    document.form2.PaidMoney.value=PaidMoney;
                                    document.form2.ServiceOrdID.value=ServiceOrdID;
                                }
                                //显示支付二维码
                                 function JS_PaidMoneyPay(){
 
                                    PaidMoney=document.getElementById('PaidMoney').value
                                    PaidMoneyType=document.getElementById('PaidMoneyType').value
                                    PaidMoneyTimestamp=document.getElementById('PaidMoneyTimestamp').value
                                    if (PaidMoney==''){PaidMoney=0}
                                    if (isNaN(PaidMoney)){alert("收款金额请输入数字");return false;}
                                    if (PaidMoney<=0){alert("收款金额不可为0");return false;}
                                    if (PaidMoneyType=='3')
                                        {
                                            window.location.replace('/weixin_pay_QR.asp?pc=1&ServiceOrdID=<%=ServiceOrdID%>&total_fee='+PaidMoney);
                                        }
                                    else if (PaidMoneyType=='4')
                                        {
                                            window.location.replace('/alipay_pay_QR.php?pc=1&ServiceOrdID=<%=ServiceOrdID%>&total_fee='+PaidMoney);
                                        }
                                    else
                                        {alert("只支持结算方式为微信支付或支付宝");}
                                 }
                            </script>
                            <div class="dialogJ  dialogJfix dialogJshadow" id="PaidMoneyCreate" style="width: 370px; right: 300px; top: 150px;display:none;text-align: left;">
                            
                                <div class="dialogJtitle">
                                    <a href="javascript:JS_PaidMoneyCreateClose();" class="dialogJclose" title="关闭本窗口">&nbsp;</a>
                                    <span class="dialogJtxt" id="EditPhotoTXT">新建费用单</span>
                                </div>
                                <form id="form2" name="form2" action="admin_save.gds" method="post">
                                <input name="admin_save" type="hidden" value="35">
                                <input name="searchTXT" type="hidden" value="<%=searchTXT%>">
                                <input name="ServiceOrdID" type="hidden" value="<%=ServiceOrdID%>">
                                <input name="page" type="hidden" value="<%=acc1%>">
                                <input name="OrdState" type="hidden" value="<%=OrdState%>">
                                <input name="OrdClassList" type="hidden" value="<%=OrdClassList%>">
                                <input name="OrdDateType" type="hidden" value="<%=OrdDateType%>">
                                <input name="PaidMoneyTimestamp" id="PaidMoneyTimestamp" type="hidden" value="<%=ToUnixTime(now(),+8)%>">
                                <input name="ReturnID" type="hidden" value="ServiceOrder">
                                <div class="dialogJcontent">
                                    <div class="dialogJbody" id="dialogJbody">
                                        <div class="modify-album-name">
                                            <span>受理单号:</span>
                                            <input id="ServiceOrdNo" name="ServiceOrdNo" type="text" value="<%=ServiceOrdID_TXT%>" style="width: 165px;" maxlength="99/"><input type="button" style="text-indent:initial;" class="dialogJbtn first-child" onclick="JS_PaidMoneySearch()" value="调单"> 
                                        </div>
                                        <div class="modify-album-name">
                                            <span>患者姓名:</span>
                                            <input id="ServiceOrdPtName" name="ServiceOrdPtName" class="valid" type="text" value="" maxlength="99/" readonly="true">
                                        </div>
                                        <div class="modify-album-name">
                                            <span>结算方式:</span>
                                            <select name="PaidMoneyType" id="PaidMoneyType" style="padding: 5px 0 5px 8px;">
                                                <option value="">请选择</option>
                                                <%sql="select vID,vtext from dictionary where vtitle='PaidMoneyType' and vType>=1 order by vOrder"
                                                rs.open Sql,objConn,1,1
                                                do while not rs.Eof%>
                                                <option value="<%=rs("vID")%>"><%=rs("vtext")%></option>
                                                <%rs.movenext
                                                Loop
                                                rs.close()%>
                                            </select>
                                            &nbsp;<span><a onclick="JS_PaidMoneyPay()">显示支付二维码</a></span>
                                            
                                        </div>
                                        <div class="modify-album-name">
                                            <span>结算金额:</span>
                                            <input id="PaidMoney" name="PaidMoney" type="text" value="" maxlength="99/">
                                        </div>
                                        <div class="modify-album-name">
                                            <span>结算备注:</span>
                                            <input id="PaidMoneyMono" name="PaidMoneyMono" type="text" value="" maxlength="99/">
                                        </div>
                                    </div>
                                </div>
                                </form>
                                <div class="dialogJanswers" style="padding: 30px 20px 13px 18px;">
                                    <input type="button" class="dialogJbtn first-child" onclick="JS_PaidMoneyCreateSave()" value="确定"> 
                                    <input type="button" class="dialogJbtn" onclick="JS_PaidMoneyCreateClose()" value="取消">
                                </div>
                            </div>
                            <!--新建费用单 end-->
 
                            
                        </div>
                        <%End if%>
                    
                        
 
                    </div>
                </div>
                <!-- end forms -->    
                <%End if%>
 
 
                
                
 
 
            </div>
            <!-- end content / right -->
        </div>
        <!-- end content -->
        <!--#include FILE="vicgame.asp"-->
        <IFRAME id="HiddenFrame" name="HiddenFrame" WIDTH=0 HEIGHT=0 MARGINWIDTH=0 MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=no BORDERCOLOR=#ffffff></IFRAME>
    </body>
</html>