username@email.com
2023-02-28 67a0042c5f29e4bb0e0b82f6190f2bc51480b45c
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
//获取href里面的参数
function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
    var r = window.location.search.substr(1).match(reg); //匹配目标参数
    if (r != null) return unescape(r[2]); return null; //返回参数值
}
 
var listtypeoptions = [];
var type = 0;
///绑定费用类型
var gettype = function (type) {
    switch (type) {
        case 1:
            $('#txtTitle').html('项目其他措施费付款单');
            listtypeoptions.push('<option value="项目其他措施费">项目其他措施费</option>');
            break;
        case 2:
            $('#txtTitle').html('项目汽车费付款单');
            listtypeoptions.push('<option value="项目汽车费">项目汽车费</option>');
            break;
        case 3:
            $('#txtTitle').html('项目劳保费付款单');
            listtypeoptions.push('<option value="项目劳保费">项目劳保费</option>');
            break;
        case 4:
            $('#txtTitle').html('项目其他间接费付款单');
            listtypeoptions.push('<option value="项目其他间接费">项目其他间接费</option>');
            break;
        case 5:
            $('#txtTitle').html('项目无票支出付款单');
            listtypeoptions.push('<option value="项目无票支出">项目无票支出</option>');
            break;
        case 6:
            $('#txtTitle').html('项目备用金借款单');
            listtypeoptions.push('<option value="项目备用金借款">项目备用金借款</option>');
            break;
        case 7:
            $('#txtTitle').html('项目招待费付款单');
            listtypeoptions.push('<option value="项目招待费">项目招待费</option>');
            break;
        case 8:
            $('#txtTitle').html('咨询顾问费付款单');
            listtypeoptions.push('<option value="咨询顾问费">咨询顾问费</option>');
            break;
        case 9:
            $('#txtTitle').html('审计费付款单');
            listtypeoptions.push('<option value="审计费">审计费</option>');
            break;
        case 10:
            $('#txtTitle').html('招待费付款单');
            listtypeoptions.push('<option value="招待费">招待费</option>');
            break;
        case 11:
            $('#txtTitle').html('外部培训学习费付款单');
            listtypeoptions.push('<option value="外部培训学习费">外部培训学习费</option>');
            break;
        case 12:
            $('#txtTitle').html('例行培训学习费付款单');
            listtypeoptions.push('<option value="例行培训学习费">例行培训学习费</option>');
            break;
        case 13:
            $('#txtTitle').html('汽车费付款单');
            listtypeoptions.push('<option value="汽车费">汽车费</option>');
            break;
        case 14:
            $('#txtTitle').html('招聘费付款单');
            listtypeoptions.push('<option value="招聘费">招聘费</option>');
            break;
        case 15:
            $('#txtTitle').html('办公费付款单');
            listtypeoptions.push('<option value="办公用品">办公用品</option>');
            listtypeoptions.push('<option value="水电费">水电费</option>');
            listtypeoptions.push('<option value="物业费">物业费</option>');
            listtypeoptions.push('<option value="办公设备维修">办公设备维修</option>');
            listtypeoptions.push('<option value="电话费">电话费</option>');
            listtypeoptions.push('<option value="会务费">会务费</option>');
            listtypeoptions.push('<option value="保险费">保险费</option>');
            listtypeoptions.push('<option value="劳保用品">劳保用品</option>');
            listtypeoptions.push('<option value="绿化">绿化</option>');
            listtypeoptions.push('<option value="垃圾清运">垃圾清运</option>');
            listtypeoptions.push('<option value="协会会费">协会会费</option>');
            listtypeoptions.push('<option value="其他">其他</option>');
            break;
        case 16:
            $('#txtTitle').html('办公室装修费付款单');
            listtypeoptions.push('<option value="办公室装修费">办公室装修费</option>');
            break;
        case 17:
            $('#txtTitle').html('办公物业水电费付款单');
            listtypeoptions.push('<option value="办公物业水电费">办公物业水电费</option>');
            break;
        case 18:
            $('#txtTitle').html('对外捐赠付款单');
            listtypeoptions.push('<option value="对外捐赠">对外捐赠</option>');
            break;
        case 19:
            $('#txtTitle').html('文化建设费付款单');
            listtypeoptions.push('<option value="文化建设费">文化建设费</option>');
            break;
        case 20:
            $('#txtTitle').html('会务费,保险费,劳保用品等其他可控管理费付款单');
            listtypeoptions.push('<option value="会务费">会务费</option>');
            listtypeoptions.push('<option value="保险费">保险费</option>');
            listtypeoptions.push('<option value="劳保用品">劳保用品</option>');
            listtypeoptions.push('<option value="绿化">绿化</option>');
            listtypeoptions.push('<option value="垃圾清运">垃圾清运</option>');
            listtypeoptions.push('<option value="协会会费">协会会费</option>');
            listtypeoptions.push('<option value="其他">其他</option>');
            break;
        case 21:
            $('#txtTitle').html('行政管理无票支出付款单');
            listtypeoptions.push('<option value="行政管理无票支出">行政管理无票支出</option>');
            break;
        case 22:
            $('#txtTitle').html('社保银行扣缴付款单');
            listtypeoptions.push('<option value="社保银行扣缴">社保银行扣缴</option>');
            break;
        case 23:
            $('#txtTitle').html('税金付款单');
            listtypeoptions.push('<option value="税金">税金</option>');
 
            break;
        case 24:
            $('#txtTitle').html('利息付款单');
            listtypeoptions.push('<option value="利息">利息</option>');
            break;
        case 25:
            $('#txtTitle').html('还款、转贷付款单');
            listtypeoptions.push('<option value="还款">还款</option>');
            listtypeoptions.push('<option value="转贷">转贷</option>');
            break;
        case 26:
            $('#txtTitle').html('内部借款付款单');
            listtypeoptions.push('<option value="内部借款">内部借款</option>');
            break;
        case 27:
            $('#txtTitle').html('研发费用付款单');
            listtypeoptions.push('<option value="研发费用">研发费用</option>');
            break;
        case 28:
            $('#txtTitle').html('信息化建设付款单');
            listtypeoptions.push('<option value="信息化建设">信息化建设</option>');
            break;
        case 29:
            $('#txtTitle').html('工资、年终各类评优付款单');
            listtypeoptions.push('<option value="工资">工资</option>');
            listtypeoptions.push('<option value="年终">年终</option>');
            listtypeoptions.push('<option value="评优">评优</option>');
            break;
        case 30:
            $('#txtTitle').html('管理人员工作餐付款单');
            listtypeoptions.push('<option value="管理人员工作餐">管理人员工作餐</option>');
            break;
        case 31:
            $('#txtTitle').html('年会、旅游付款单');
            listtypeoptions.push('<option value="年会">年会</option>');
            listtypeoptions.push('<option value="旅游">旅游</option>');
            break;
        case 32:
            $('#txtTitle').html('其他福利费付款单');
            listtypeoptions.push('<option value="其他福利费">其他福利费</option>');
            break;
        case 33:
            $('#txtTitle').html('业务单位往来款付款单');
            listtypeoptions.push('<option value="业务单位往来款">业务单位往来款</option>');
            break;
        case 34:
            $('#txtTitle').html('项目投标保证金付款单');
            listtypeoptions.push('<option value="项目投标保证金">项目投标保证金</option>');
            break;
        case 35:
            $('#txtTitle').html('银行间资金划转付款单');
            listtypeoptions.push('<option value="银行间资金划转">银行间资金划转</option>');
            break;
        case 36:
            $('#txtTitle').html('备用金提取付款单');
            listtypeoptions.push('<option value="备用金提取">备用金提取</option>');
            break;
        case 37:
            $('#txtTitle').html('行政罚款支出付款单');
            listtypeoptions.push('<option value="行政罚款支出">行政罚款支出</option>');
            break;
        case 38:
            $('#txtTitle').html('计划外支出付款单');
            listtypeoptions.push('<option value="计划外支出">计划外支出</option>');
            break;
        case 39:
            $('#txtTitle').html('个人备用金借款单');
            listtypeoptions.push('<option value="个人备用金借款">个人备用金借款</option>');
            break;
        case 40:
            $('#txtTitle').html('项目内部借款付款单');
            listtypeoptions.push('<option value="项目内部借款">项目内部借款</option>');
            break;
        case 41:
            $('#txtTitle').html('项目主材付款单');
            listtypeoptions.push('<option value="混凝土">混凝土</option>');
            listtypeoptions.push('<option value="管桩">管桩</option>');
            listtypeoptions.push('<option value="水泥">水泥</option>');
            listtypeoptions.push('<option value="钢筋">钢筋</option>');
            listtypeoptions.push('<option value="注浆管">注浆管</option>');
            listtypeoptions.push('<option value="声测管">声测管</option>');
            listtypeoptions.push('<option value="其他">其他</option>');
            break;
        case 42:
            $('#txtTitle').html('项目辅材付款单');
            listtypeoptions.push('<option value="柴油">柴油</option>');
            listtypeoptions.push('<option value="小型工具">小型工具</option>');
            listtypeoptions.push('<option value="安全文明设施">安全文明设施</option>');
            listtypeoptions.push('<option value="办公用品">办公用品</option>');
            break;
        case 43:
            $('#txtTitle').html('项目施工费/措施费付款单');
            listtypeoptions.push('<option value="施工费">施工费</option>');
            listtypeoptions.push('<option value="措施费">措施费</option>');
            break;
        case 44:
            $('#txtTitle').html('办公消耗品付款单');
            listtypeoptions.push('<option value="办公消耗品">办公消耗品</option>');
            break;
        case 45:
            $('#txtTitle').html('房产付款单');
            listtypeoptions.push('<option value="房产">房产</option>');
            break;
        case 46:
            $('#txtTitle').html('机械设备付款单');
            listtypeoptions.push('<option value="机械设备">机械设备</option>');
            break;
        case 47:
            $('#txtTitle').html('电器/仪器/机具付款单');
            listtypeoptions.push('<option value="电器">电器</option>');
            listtypeoptions.push('<option value="仪器">仪器</option>');
            listtypeoptions.push('<option value="机具">机具</option>');
            break;
        case 48:
            $('#txtTitle').html('行政办公设备/车辆付款单');
            listtypeoptions.push('<option value="行政办公设备">行政办公设备</option>');
            listtypeoptions.push('<option value="行政车辆">行政车辆</option>');
            break;
        case 49:
            $('#txtTitle').html('设备维修、改装、运输费用付款单');
            listtypeoptions.push('<option value="设备维修">设备维修</option>');
            listtypeoptions.push('<option value="改装">改装</option>');
            listtypeoptions.push('<option value="运输费用">运输费用</option>');
            break;
        case 50:
            $('#txtTitle').html('设备部劳务班组费用付款单');
            listtypeoptions.push('<option value="设备部劳务班组费用">设备部劳务班组费用</option>');
            break;
        case 51:
            $('#txtTitle').html('周转材料付款单');
            listtypeoptions.push('<option value="周转材料">周转材料</option>');
            break;
        case 52:
            $('#txtTitle').html('设备维修配件、改装配件、桩机配件采购付款单');
            listtypeoptions.push('<option value="设备维修配件">设备维修配件</option>');
            listtypeoptions.push('<option value="改装配件">改装配件</option>');
            listtypeoptions.push('<option value="桩机配件采购">桩机配件采购</option>');
            break;
        case 53:
            $('#txtTitle').html('节假日福利费付款单');
            listtypeoptions.push('<option value="节假日福利费">节假日福利费</option>');
            break;
        case 55:
            $('#txtTitle').html('差旅费付款单');
            listtypeoptions.push('<option value="差旅费">差旅费</option>');
            break;
        case 56:
            $('#txtTitle').html('项目差旅费付款单');
            listtypeoptions.push('<option value="项目差旅费">项目差旅费</option>');
            break;
        case 57:
            $('#txtTitle').html('项目生产类押金付款单');
            listtypeoptions.push('<option value="生产类押金">生产类押金</option>');
            break;
        case 58:
            $('#txtTitle').html('非生产类押金付款单');
            listtypeoptions.push('<option value="非生产类押金">非生产类押金</option>');
            break;
        case 19041:
            $('#txtTitle').html('IPO费用(差旅住宿)付款单');
            listtypeoptions.push('<option value="IPO费用(差旅住宿)">IPO费用(差旅住宿)</option>');
            break;
        case 19042:
            $('#txtTitle').html('IPO费用(非差旅住宿)付款单');
            listtypeoptions.push('<option value="IPO费用(非差旅住宿)">IPO费用(非差旅住宿)</option>');
            break;
        case 19043:
            $('#txtTitle').html('礼品、酒付款单');
            listtypeoptions.push('<option value="礼品">礼品</option>');
            listtypeoptions.push('<option value="酒">酒</option>');
            break;
        case 19044:
            $('#txtTitle').html('电脑、打印机维修付款单');
            listtypeoptions.push('<option value="电脑维修">电脑维修</option>');
            listtypeoptions.push('<option value="打印机维修">打印机维修</option>');
            break;
        case 19045:
            $('#txtTitle').html('办公/职工宿舍房租、水电、物业付款单');
            listtypeoptions.push('<option value="办公/职工宿舍房租">办公/职工宿舍房租</option>');
            listtypeoptions.push('<option value="水电">水电</option>');
            listtypeoptions.push('<option value="物业">物业</option>');
            break;
        case 19046:
            $('#txtTitle').html('会务费、保险费等其他可控管理费付款单');
            listtypeoptions.push('<option value="会务费">会务费</option>');
            listtypeoptions.push('<option value="保险费">保险费</option>');
            listtypeoptions.push('<option value="劳保用品">劳保用品</option>');
            listtypeoptions.push('<option value="绿化">绿化</option>');
            listtypeoptions.push('<option value="垃圾清运">垃圾清运</option>');
            listtypeoptions.push('<option value="协会会费">协会会费</option>');
            listtypeoptions.push('<option value="其他">其他</option>');
            break;
        case 19047:
            $('#txtTitle').html('研发其他费用付款单');
            listtypeoptions.push('<option value="自主研发产生的专利相关">自主研发产生的专利相关</option>');
            listtypeoptions.push('<option value="设计试验">设计试验</option>');
            listtypeoptions.push('<option value="委外研发">委外研发</option>');
            listtypeoptions.push('<option value="项目申报代理相关">项目申报代理相关</option>');
            listtypeoptions.push('<option value="专家咨询">专家咨询</option>');
            listtypeoptions.push('<option value="技术论证评审鉴定">技术论证评审鉴定</option>');
            listtypeoptions.push('<option value="培训培养">培训培养</option>');
            listtypeoptions.push('<option value="零星采购">零星采购</option>');
            listtypeoptions.push('<option value="其他">其他</option>');
            break;
        case 19048:
            $('#txtTitle').html('保险理赔款付款单');
            listtypeoptions.push('<option value="保险理赔款">保险理赔款</option>');
            break;
        case 19049:
            $('#txtTitle').html('保理、承兑等金融手续费付款单');
            listtypeoptions.push('<option value="保理">保理</option>');
            listtypeoptions.push('<option value="承兑">承兑</option>');
            listtypeoptions.push('<option value="其他">其他</option>');
            break;
        case 190410:
            $('#txtTitle').html('个税付款单');
            listtypeoptions.push('<option value="个税">个税</option>');
            break;
        case 190411:
            $('#txtTitle').html('公积金付款单');
            listtypeoptions.push('<option value="公积金">公积金</option>');
            break;
        case 190412:
            $('#txtTitle').html('市内交通费付款单');
            listtypeoptions.push('<option value="市内交通费">市内交通费</option>');
            break;
        case 190413:
            $('#txtTitle').html('项目市内交通费付款单');
            listtypeoptions.push('<option value="项目市内交通费">项目市内交通费</option>');
            break;
        case 190414:
            $('#txtTitle').html('行政罚款付款单');
            listtypeoptions.push('<option value="行政罚款">行政罚款</option>');
            break;
        case 190415:
            $('#txtTitle').html('房租费用付款单');
            listtypeoptions.push('<option value="房租费用">房租费用</option>');
            break;
        case 190416:
            $('#txtTitle').html('社保第三方代缴付款单');
            listtypeoptions.push('<option value="社保第三方代缴">社保第三方代缴</option>');
            break;
        case 190417:
            $('#txtTitle').html('公积金第三方代缴付款单');
            listtypeoptions.push('<option value="公积金第三方代缴">公积金第三方代缴</option>');
            break;
        case 19091:
            $('#txtTitle').html('劳务工资付款单');
            document.getElementById('girdtable').rows[0].cells[0].innerHTML = '项目';
            $.ajax({
                url: "/DropDown/ProjectDropDownForProcurementOrder", async: false, cache: false, dataType: "json",
                success: function (data) {
                    listtypeoptions.push("<option style='display: none'></option>");
                    $.each(data, function (i, r) {
                        listtypeoptions.push('<option value="' + r.Text + '">' + r.Text + '</option>');
 
                    });
 
                }
            });
            break;
    }
    if ($.trim(sysid) == '') {
        $('select[name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName"]').eq(0).html(listtypeoptions.join(''));
        $('select[name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName"]').eq(0).trigger("chosen:updated");
    }
 
    if (listtypeoptions.length <= 1)//只有一项一下,禁用选择
    {
        $('select[name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName"]').attr('disabled', 'disabled');
    }
}
 
// 金额转大写
var changeMoneyToChinese = function (money) {
    //汉字的数字
    var cnNums = new Array('零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖');
    //基本单位
    var cnIntRadice = new Array('', '拾', '佰', '仟');
    //对应整数部分扩展单位
    var cnIntUnits = new Array('', '万', '亿', '兆');
    //对应小数部分单位
    var cnDecUnits = new Array('角', '分', '毫', '厘');
    //整数金额时后面跟的字符
    var cnInteger = '整';
    //整型完以后的单位
    var cnIntLast = '元';
    //最大处理的数字
    var maxNum = 999999999999999.9999;
    //金额整数部分
    var integerNum;
    //金额小数部分
    var decimalNum;
    //输出的中文金额字符串
    var chineseStr = '';
    //分离金额后用的数组,预定义
    var parts;
    if (money == '') { return ''; }
    money = parseFloat(money);
    if (money >= maxNum) {
        //超出最大处理数字
        toastr.warning("付款总额超出最大范围");
        return '';
    }
    if (money == 0) {
        chineseStr = cnNums[0] + cnIntLast + cnInteger;
        return chineseStr;
    }
    //转换为字符串
    money = money.toString();
    if (money.indexOf('.') == -1) {
        integerNum = money;
        decimalNum = '';
    } else {
        parts = money.split('.');
        integerNum = parts[0];
        decimalNum = parts[1].substr(0, 4);
    }
    //获取整型部分转换
    if (parseInt(integerNum, 10) > 0) {
        var zeroCount = 0;
        var IntLen = integerNum.length;
        for (var i = 0; i < IntLen; i++) {
            var n = integerNum.substr(i, 1);
            var p = IntLen - i - 1;
            var q = p / 4;
            var m = p % 4;
            if (n == '0') {
                zeroCount++;
            } else {
                if (zeroCount > 0) {
                    chineseStr += cnNums[0];
                }
                //归零
                zeroCount = 0;
                chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
            }
            if (m == 0 && zeroCount < 4) {
                chineseStr += cnIntUnits[q];
            }
        }
        chineseStr += cnIntLast;
    }
    //小数部分
    if (decimalNum != '') {
        var decLen = decimalNum.length;
        for (var i = 0; i < decLen; i++) {
            var n = decimalNum.substr(i, 1);
            if (n != '0') {
                chineseStr += cnNums[Number(n)] + cnDecUnits[i];
            }
        }
    }
    if (chineseStr == '') {
        chineseStr += cnNums[0] + cnIntLast + cnInteger;
    } else if (decimalNum == '') {
        chineseStr += cnInteger;
    }
    return chineseStr;
}
 
 
//获取默认单据号与名称
var getusername = function (type) {
    if ($.trim(sysid) == '') {
        $.ajax({
            url: "/oa/General/GetLoad", async: false, cache: false, dataType: "json",
            success: function (data) {
                $('input[name="fm_otherexpenditureinfo.Code"]').val(data.orderCode);
                $('select[name="fm_otherexpenditureinfo.DepartmentID"]').val(data.deptid);
                $('select[name="fm_otherexpenditureinfo.DepartmentID"]').trigger("chosen:updated");
                $('input[name="fm_otherexpenditureinfo.dept_name"]').val(data.deptname);
                $('input[name="fm_otherexpenditureinfo.dept_id"]').val(data.deptid);
                switch (type) {
                    case 1:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('项目其他措施费付款(' + data.username + ')');
                        break;
                    case 2:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('项目汽车费付款(' + data.username + ')');
                        break;
                    case 3:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('项目劳保费付款(' + data.username + ')');
                        break;
                    case 4:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('项目其他间接费付款(' + data.username + ')');
                        break;
                    case 5:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('项目无票支出付款(' + data.username + ')');
                        break;
                    case 6:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('项目备用金借款(' + data.username + ')');
                        break;
                    case 7:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('项目招待费付款(' + data.username + ')');
                        break;
                    case 8:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('咨询顾问费付款(' + data.username + ')');
                        break;
                    case 9:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('审计费付款(' + data.username + ')');
                        break;
                    case 10:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('招待费付款(' + data.username + ')');
                        break;
                    case 11:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('外部培训学习费付款(' + data.username + ')');
                        break;
                    case 12:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('例行培训学习费付款(' + data.username + ')');
                        break;
                    case 13:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('汽车费付款(' + data.username + ')');
                        break;
                    case 14:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('招聘费付款(' + data.username + ')');
                        break;
                    case 15:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('办公费付款(' + data.username + ')');
                        break;
                    case 16:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('办公室装修付款(' + data.username + ')');
                        break;
                    case 17:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('办公物业水电费付款(' + data.username + ')');
                        break;
                    case 18:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('对外捐赠付款(' + data.username + ')');
                        break;
                    case 19:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('文化建设费付款(' + data.username + ')');
                        break;
                    case 20:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('会务费,保险费,劳保用品等其他可控管理费付款(' + data.username + ')');
                        break;
                    case 21:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('行政管理无票支出付款(' + data.username + ')');
                        break;
                    case 22:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('社保银行扣缴付款(' + data.username + ')');
                        break;
                    case 23:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('税金付款(' + data.username + ')');
                        break;
                    case 24:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('利息付款(' + data.username + ')');
                        $("input[name='fm_otherexpenditureinfo.IsInPlan']:eq(0)").parent().parent().siblings(".form-item-title").text("是否金融机构");
                        break;
                    case 25:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('还款、转贷付款(' + data.username + ')');
                        break;
                    case 26:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('内部借款付款(' + data.username + ')');
                        break;
                    case 27:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('研发费用付款(' + data.username + ')');
                        break;
                    case 28:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('信息化建设付款(' + data.username + ')');
                        break;
                    case 29:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('工资、年终各类评优付款(' + data.username + ')');
                        break;
                    case 30:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('管理人员工作餐付款(' + data.username + ')');
                        break;
                    case 31:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('年会、旅游付款(' + data.username + ')');
                        break;
                    case 32:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('其他福利费付款(' + data.username + ')');
                        break;
                    case 33:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('业务单位往来款付款(' + data.username + ')');
                        break;
                    case 34:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('项目投标保证金付款(' + data.username + ')');
                        var projectId = getUrlParam("projectid");
                        if (projectId != null && projectId != 0) {
                            $('input[name="fm_otherexpenditureinfo.ProjectID"]').val(projectId);
                        }
                        break;
                    case 35:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('银行间资金划转付款(' + data.username + ')');
                        break;
                   
                    case 36:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('备用金提取付款(' + data.username + ')');
                        break;
                    case 37:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('行政罚款支出付款(' + data.username + ')');
                        break;
                    case 38:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('计划外支出付款(' + data.username + ')');
                        break;
                    case 39:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('个人备用金借款(' + data.username + ')');
                        break;
                    case 40:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('项目内部借款付款(' + data.username + ')');
                        break;
                    case 41:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('项目主材付款(' + data.username + ')');
                        break;
                    case 42:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('项目辅材付款(' + data.username + ')');
                        break;
                    case 43:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('项目施工费/措施费付款(' + data.username + ')');
                        break;
                    case 44:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('办公消耗品付款(' + data.username + ')');
                        break;
                    case 45:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('房产付款(' + data.username + ')');
                        break;
                    case 46:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('机械设备付款(' + data.username + ')');
                        break;
                    case 47:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('电器/仪器/机具付款(' + data.username + ')');
                        break;
                    case 48:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('行政办公设备/车辆付款(' + data.username + ')');
                        break;
                    case 49:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('设备维修/改装/运输费用付款(' + data.username + ')');
                        break;
                    case 50:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('设备部劳务班组费用付款(' + data.username + ')');
                        break;
                    case 51:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('周转材料付款(' + data.username + ')');
                        break;
                    case 52:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('设备维修配件/改装配件/桩机配件采购付款(' + data.username + ')');
                        break;
                    case 53:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('节假日福利费付款(' + data.username + ')');
                        break;
                    case 55:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('差旅费付款(' + data.username + ')');
                        break;
                    case 56:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('项目差旅费付款(' + data.username + ')');
                        break;
                    case 57:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('项目生产类押金付款(' + data.username + ')');
                        break;
                    case 58:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('非生产类押金付款(' + data.username + ')');
                        break;
                    case 19041:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('IPO费用(差旅住宿)付款(' + data.username + ')');
                        break;
                    case 19042:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('IPO费用(非差旅住宿)付款(' + data.username + ')');
                        break;
                    case 19043:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('礼品、酒付款(' + data.username + ')');
                        break;
                    case 19044:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('电脑、打印机维修付款(' + data.username + ')');
                        break;
                    case 19045:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('办公/职工宿舍房租、水电、物业付款(' + data.username + ')');
                        break;
                    case 19046:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('会务费、保险费等其他可控管理费付款(' + data.username + ')');
                        break;
                    case 19047:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('研发其他费用付款(' + data.username + ')');
                        break;
                    case 19048:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('保险理赔款付款(' + data.username + ')');
                        break;
                    case 19049:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('保理、承兑等金融手续费付款(' + data.username + ')');
                        break;
                    case 190410:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('个税付款(' + data.username + ')');
                        break;
                    case 190411:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('公积金付款(' + data.username + ')');
                        break;
                    case 190412:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('市内交通费付款(' + data.username + ')');
                        break;
                    case 190413:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('项目市内交通费付款(' + data.username + ')');
                        break;
                    case 190414:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('行政罚款付款(' + data.username + ')');
                        break;
                    case 190415:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('房租费用付款(' + data.username + ')');
                        break;
                    case 190416:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('社保第三方代缴付款(' + data.username + ')');
                        break;
                    case 190417:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('公积金第三方代缴付款(' + data.username + ')');
                        break;
                    case 19091:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('劳务工资付款(' + data.username + ')');
                        break;
                }
                //// 处理部门项目部不展示,职能部展示
                var titl = $('input[name="fm_otherexpenditureinfo.Title"]').val(); 
                if (titl.indexOf("项目") != -1) { 
                    $('input[name="fm_otherexpenditureinfo.dept_name"]').css('display', 'none');
                }
                $('#fm_otherexpenditureinfo_dept_id').css('display', 'none');
              // $(".annex").css('display', 'none');
            }
        });
    }
}
 
 
//ERP获取关联单号已付款金额
var allAmount = 0;//总付款金额
var fkMoney = 0;//已付款金额
var syMoney = 0;//剩余金额
var getpaymoney = function (code) {
    $.ajax({
        url: "/oa/General/GetMoney?orderCode=" + code + "&sysid=" + sysid, async: false, cache: false, dataType: "json",
        success: function (data) {
            allAmount = parseFloat(data.allamount);
            fkMoney = parseFloat(data.paymoney);
            syMoney = parseFloat(data.balance);
 
        }
    });
}
 
 
//计算总金额
var countmoney = function () {
    type = parseInt(getUrlParam('type'));
    if ($.trim(sysid) != '' && initItems != null) {
        type = parseInt(initItems.ExpenditureBusinessTypeID);
    }
 
    var count = 0;
    $.each($('input[name="fm_otherexpenditureinfo_dtl.ExpenditureNotContainTaxAmount"]'), function () {
        var val = $.trim($(this).val());
        val = isNaN(val) ? 0 : val;
        val = val == '' ? 0 : parseFloat(val);
        count += val;
    });
    if (type == 41 || type == 42 || type == 43 || type == 44 || type == 45 || type == 46 || type == 47 || type == 48 || type == 50 || type == 51 || type == 52) {
        if (sysid == '') {
            var nmoney = allAmount - fkMoney;
            $('input[name="fm_otherexpenditureinfo.TotalExpenditure"]').val(nmoney);
            $('input[name="fm_otherexpenditureinfo.CapitalizationTotalExpenditure"]').val(changeMoneyToChinese(nmoney));
            if (nmoney <= 0) {
                $('button[onclick="WF_Submit()"],button[onclick="WF_Save()"]').parent().hide()
            }
        }
        else {
            var nmoeny = parseFloat($('input[name="fm_otherexpenditureinfo.TotalExpenditure"]').val());
            syMoney = nmoeny > syMoney ? syMoney : nmoeny;
            $('input[name="fm_otherexpenditureinfo.TotalExpenditure"]').val(syMoney);
            $('input[name="fm_otherexpenditureinfo.CapitalizationTotalExpenditure"]').val(changeMoneyToChinese(syMoney));
        }
    }
    else {
    $('input[name="fm_otherexpenditureinfo.TotalExpenditure"]').val(count);
    $('input[name="fm_otherexpenditureinfo.CapitalizationTotalExpenditure"]').val(changeMoneyToChinese(count));
    }
}
 
//选择税率后重新计算
$(document).on('change', $('input[name="fm_otherexpenditureinfo_dtl.ExpenditureNotContainTaxAmount"]'), function () {
    countmoney();
});
 
 
 
 
//删除事件回调操作
deleteMethod = function () {
    countmoney();
}
var orderCode = '';
//添加事件回调操作
createMethod = function () {
    
    var ntr = $('select[name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName"]').length;
    if (ntr > 0) {
        $('select[name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName"]').eq(ntr - 1).html(listtypeoptions.join(''));
        $('select[name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName"]').eq(ntr - 1).trigger("chosen:updated");
        if (listtypeoptions.length <= 1)//只有一项一下,禁用选择
        {
            $('select[name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName"]').eq(ntr - 1).attr('disabled', 'disabled');
         
        }
            $('select[name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName"]').eq(ntr - 1).chosen();
        }
    var inputs = '<input type="hidden" name="fm_otherexpenditureinfo_dtl.FundsCostSubjectsID" class="edit" field="FundsCostSubjectsID" value="">';
    $('input[name="fm_otherexpenditureinfo_dtl.FundsCostSubjectsName"]').eq(ntr - 1).after(inputs);
    //财务科目选择后触发
    $('input[name="fm_otherexpenditureinfo_dtl.FundsCostSubjectsName"]').eq(ntr - 1).bind('focus', function (i, r) {
        getCWinfo(this);
    });
    var type = parseInt(getUrlParam('type'));
    if ($.trim(sysid) != '' && initItems != null) {
        type = parseInt(initItems.ExpenditureBusinessTypeID);
    }
    
    changeTextarea();
}
 
//动态添加CSS样式
function addCSS() {
    var str_style = 'td{ position:relative;}\
                    .bl{position: relative;}\
                    .bl .back {position: absolute;top: 0;right: 5px;display: inline-block;}\
                    .bl .backdtl {position: absolute;top: 2px;right:10px;display: inline-block;}';
    if (document.all) { // document.createStyleSheet(url)
        window.style = str_style;
        document.createStyleSheet("javascript:style");
    } else { //document.createElement(style)
        var style = document.createElement('style');
        style.type = 'text/css';
        style.innerHTML = str_style;
        document.getElementsByTagName('HEAD').item(0).appendChild(style);
    }
}
//把input改为textarea
function changeTextarea() {
    //备注
    $('input[name="fm_otherexpenditureinfo_dtl.Remarks"]').each(function (i, input) {
        var value = $.trim($(this).val());
        var textarea = createTextarea("fm_otherexpenditureinfo_dtl", "remarks");
        changeInputCell(input, textarea, value);
    })
}
 
 
 
//替换表格控件元素
function changeInputCell(input, newInput, value) {
    value = value || "";
    var $input = $(input);
    var $newInput = $(newInput);
    var parent = input.parentNode;
    $newInput.val(value);
    var hasEdit = $input.hasClass("edit");
    var isDisbale = $input.prop("disabled");
    isDisbale && newInput.setAttribute("disabled", "disabled");
    newInput.innerHTML = value;
    $input.remove();
    parent.appendChild(newInput);
}
 
 
 
//创建textarea
function createTextarea(table, name) {
    var textarea = document.createElement("textarea");
    textarea.className = "tex_inp";
    textarea.id = table + "_" + name;
    textarea.name = table + "." + name;
    textarea.setAttribute("field", name);
    return textarea;
}
 
//选择供应商后绑定数据
var setCompanyInfo = function (id, name, UserName, Phone, BankName, BankDeposit, BankAccount) {
    $('#fm_otherexpenditureinfo_IncomeUnitID').val($.trim(id));
    $('#fm_otherexpenditureinfo_IncomeUnitName').val(name);
    $('#fm_otherexpenditureinfo_AccountOpenBankAccount').val(BankName);
    $('#fm_otherexpenditureinfo_CashBankName').val(BankDeposit);
    $('#fm_otherexpenditureinfo_ReceivablesAccount').val(BankAccount);
 
    layer.closeAll();
}
 
//收入单位选择
var getmaterielinfo = function () {
    layer.open({
        type: 2,
        title: '收款单位',
        shadeClose: true,
        shade: 0.4,
        area: ['90%', '90%'],
        content: "/oa/General/company"
    });
}
 
//客户单位选择
var getCustomerinfo = function () {
    layer.open({
        type: 2,
        title: '客户单位',
        shadeClose: true,
        shade: 0.4,
        area: ['90%', '90%'],
        content: "/Customer/Search"
    });
}
SetCustomer = function (data) {
    $AccountOpenBankAccount = $('#fm_otherexpenditureinfo_AccountOpenBankAccount');
    $CashBankName = $('#fm_otherexpenditureinfo_CashBankName');
    $ReceivablesAccount = $('#fm_otherexpenditureinfo_ReceivablesAccount');
    $('#fm_otherexpenditureinfo_IncomeUnitName').val(data.Name);
    $AccountOpenBankAccount.val(data.AccountName);
    $CashBankName.val(data.OpenBank);
    $ReceivablesAccount.val(data.BankCardNumber);
    $('#fm_otherexpenditureinfo_IncomeUnitID').val(data.Id || "");
    if (data.AccountName == null || data.AccountName == "")
        $AccountOpenBankAccount.removeAttr("disabled");
    else
        $AccountOpenBankAccount.attr("disabled", "disabled");
    if (data.OpenBank == null || data.OpenBank == "")
        $CashBankName.removeAttr("disabled");
    else
        $CashBankName.attr("disabled", "disabled");
    if (data.BankCardNumber == null || data.BankCardNumber == "")
        $ReceivablesAccount.removeAttr("disabled");
    else
        $ReceivablesAccount.attr("disabled", "disabled");
    layer.closeAll();
}
 
var thisobj = null;
 
//财务科目
var getCWinfo = function (obj) {
    thisobj = obj;
    layer.open({
        type: 2,
        title: '财务科目',
        shadeClose: true,
        shade: 0.4,
        area: ['90%', '90%'],
        content: "/Article/CWindex"
    });
}
 
//选择财务科目后触发
var setCWInfo = function (SubjectEncode, SubjectName) {
    $(thisobj).parent().parent().find('input[name="fm_otherexpenditureinfo_dtl.FundsCostSubjectsName"]').val(SubjectName);
    $(thisobj).parent().parent().find('input[name="fm_otherexpenditureinfo_dtl.FundsCostSubjectsID"]').val(SubjectEncode);
    layer.closeAll();
}
 
//项目改为手动填写
var changeProjectInput = function () {
    var $input_project = $('#fm_otherexpenditureinfo_ProjectID');
    var disable = $input_project.prop("disabled");
    var isEdit = $input_project.hasClass("edit");
    var $parent = $input_project.parent();
    var str_input = '<input type="text" id="fm_otherexpenditureinfo_ProjectName" name="fm_otherexpenditureinfo.ProjectName" field="ProjectName" class="form-control">';
    var $input = $(str_input);
    $input.prop("disabled", disable);
    isEdit && $input.addClass("edit");
    $parent.html($input);
}
 
function JsonDateToDate(jsondate) {
    var date = new Date(parseInt(jsondate.replace("/Date(", "").replace(")/", ""), 10));
    return date;
}
 
Date.prototype.Format = function (formatStr) {
    var str = formatStr;
    var Week = ['日', '一', '二', '三', '四', '五', '六'];
 
    var mt = this.getMonth() + 1;
    str = str.replace(/yyyy|YYYY/, this.getFullYear());
    str = str.replace(/yy|YY/, (this.getYear() % 100) > 9 ? (this.getYear() % 100).toString() : '0' + (this.getYear() % 100));
    str = str.replace(/MM/, mt > 9 ? mt : '0' + mt);
    str = str.replace(/M/g, mt);
    str = str.replace(/w|W/g, Week[this.getDay()]);
    str = str.replace(/dd|DD/, this.getDate() > 9 ? this.getDate().toString() : '0' + this.getDate());
    str = str.replace(/d|D/g, this.getDate());
    str = str.replace(/hh|HH/, this.getHours() > 9 ? this.getHours().toString() : '0' + this.getHours());
    str = str.replace(/h|H/g, this.getHours());
    str = str.replace(/mm/, this.getMinutes() > 9 ? this.getMinutes().toString() : '0' + this.getMinutes());
    str = str.replace(/m/g, this.getMinutes());
 
    str = str.replace(/ss|SS/, this.getSeconds() > 9 ? this.getSeconds().toString() : '0' + this.getSeconds());
    str = str.replace(/s|S/g, this.getSeconds());
    return str;
}
 
var getinfo = function (ntype, sorderCode) {
    var url = '';
    if (ntype == 3) {
        url = '/OA/General/GetInOrderByordeCode?orderCode=' + sorderCode;
    }
    else {
        url = '/OA/General/FindSettlementModelByCode?orderCode=' + sorderCode;
    }
    $.ajax({
        url: url, async: false, cache: false, dataType: "json",
        success: function (data) {
            $('.subtradd_js').hide();
            var arytrs = [];
            var allmoney = 0;
            if (ntype == 3) {
                $.each(data, function (i, r) {
                    var html = '<tr class="body">';
                    html += '<td><input id="fm_otherexpenditureinfo_dtl_ExpenditureTypeName" disabled="disabled" name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName" type="text" value="' + r.materielinfoName + '" class="form-control edit" field="ExpenditureTypeName" isvalid="yes" checkexpession="NotNull"></td>';
                    html += '<td><textarea class="tex_inp" id="fm_otherexpenditureinfo_dtl_remarks" disabled="disabled" name="fm_otherexpenditureinfo_dtl.remarks" field="remarks">数量:' + r.count + '  价格:' + r.price + '</textarea></td>';
                    html += '<td><input id="fm_otherexpenditureinfo_dtl_ExpenditureNotContainTaxAmount" disabled="disabled" name="fm_otherexpenditureinfo_dtl.ExpenditureNotContainTaxAmount" type="text" class="form-control edit" value="' + r.amount + '" field="ExpenditureNotContainTaxAmount" isvalid="yes" checkexpession="Num"></td>';
                    html += '</tr>';
                    arytrs.push(html);
 
                });
            }
            else {
                
                if (parseInt(data.subject) == 1) {
                    if (data.InOrders.length > 0) {
                        $.each(data.InOrders, function (i, r) {
                            if (r.orderDtls.length > 0) {
                                $.each(r.orderDtls, function (ii, rr) {
                                    var html = '<tr class="body">';
                                    html += '<td><input id="fm_otherexpenditureinfo_dtl_ExpenditureTypeName" disabled="disabled" name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName" type="text" value="' + rr.materielinfoName + '" class="form-control edit" field="ExpenditureTypeName" isvalid="yes" checkexpession="NotNull"></td>';
                                    html += '<td><textarea class="tex_inp" id="fm_otherexpenditureinfo_dtl_remarks" disabled="disabled" name="fm_otherexpenditureinfo_dtl.remarks" field="remarks">数量:' + rr.count + '  价格:' + rr.price + '</textarea></td>';
                                    html += '<td><input id="fm_otherexpenditureinfo_dtl_ExpenditureNotContainTaxAmount" disabled="disabled" name="fm_otherexpenditureinfo_dtl.ExpenditureNotContainTaxAmount" type="text" class="form-control edit" value="' + rr.amount + '" field="ExpenditureNotContainTaxAmount" isvalid="yes" checkexpession="Num"></td>';
                                    html += '</tr>';
                                    arytrs.push(html);
                                });
                            }
                        });
                    }
                }
                else {
                    if (data.SettlementDtls.length > 0) {
                        $.each(data.SettlementDtls, function (i, r) {
                            var html = '<tr class="body">';
                            html += '<td><input id="fm_otherexpenditureinfo_dtl_ExpenditureTypeName" disabled="disabled" name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName" type="text" value="' + r.content + '" class="form-control edit" field="ExpenditureTypeName" isvalid="yes" checkexpession="NotNull"></td>';
                            html += '<td><textarea class="tex_inp" id="fm_otherexpenditureinfo_dtl_remarks" disabled="disabled" name="fm_otherexpenditureinfo_dtl.remarks" field="remarks">开始日期:' + JsonDateToDate(r.construction_start_date).Format('yyyy-MM-dd') + '  结算日期:' + JsonDateToDate(r.construction_end_date).Format('yyyy-MM-dd') + '</textarea></td>';
                            html += '<td><input id="fm_otherexpenditureinfo_dtl_ExpenditureNotContainTaxAmount" disabled="disabled" name="fm_otherexpenditureinfo_dtl.ExpenditureNotContainTaxAmount" type="text" class="form-control edit" value="' + r.amount + '" field="ExpenditureNotContainTaxAmount" isvalid="yes" checkexpession="Num"></td>';
                            html += '</tr>';
                            arytrs.push(html);
                        });
                    }
                }
            }
            $('#girdtable tbody').find('.body').remove();
            $('#girdtable tbody').append(arytrs.join(''));
            countmoney();
        }
    });
}
 
var setReadOnly = function () {
    //$(".opinion").hide();
    $(".btn:last").parent().hide();
}
 
///数据加载
var initData = function () {
    addCSS();
    changeTextarea();
    var url = window.location.href;
    type = parseInt(getUrlParam('type'));
    if ($.trim(sysid) != '' && initItems != null) {
        type = parseInt(initItems.ExpenditureBusinessTypeID);
    }
    gettype(type);
   
    var ExpenditureBusinessTypeName = $('#txtTitle').html().replace('付款单', '');
    var orderType = 0;
    var dept_name = "", dept_id = 0;
    var ot = $.trim(getUrlParam('orderType'));
    if (ot != '') {
        orderType = parseInt(ot);
    }
    if (sysid != '' && initItems != null) {
        ExpenditureBusinessTypeName = initItems.ExpenditureBusinessTypeName;
        orderType = parseInt(initItems.orderType);
        orderCode = initItems.SettlementNumber;
      
        dept_id = initItems.dept_id;
        dept_name = initItems.dept_name; 
              // $(".annex").css('display', 'none');
    }
    $('input[name="fm_otherexpenditureinfo.dept_name"]').val(dept_name);
        $('input[name="fm_otherexpenditureinfo.dept_id"]').val(dept_id);
        //// 处理部门项目部不展示,职能部展示
    var titl = $('input[name="fm_otherexpenditureinfo.Title"]').val();
   
    if (titl.indexOf("项目") != -1) {
        $('input[name="fm_otherexpenditureinfo.dept_name"]').css('display', 'none'); 
        }
        $('#fm_otherexpenditureinfo_dept_id').css('display', 'none');
    var inputs = '<input type="hidden" id="fm_otherexpenditureinfo_ExpenditureBusinessTypeID" name="fm_otherexpenditureinfo.ExpenditureBusinessTypeID" field="ExpenditureBusinessTypeID" value="' + type + '">';
    inputs += '<input type="hidden" id="fm_otherexpenditureinfo_ExpenditureBusinessTypeName" name="fm_otherexpenditureinfo.ExpenditureBusinessTypeName" field="ExpenditureBusinessTypeName" value="' + ExpenditureBusinessTypeName + '">';
    $('input[name="fm_otherexpenditureinfo.Code"]').after(inputs);
    
    orderCode = orderCode == '' ? $.trim(getUrlParam('orderCode')) : orderCode;
    
    $('input[name="fm_otherexpenditureinfo.SettlementNumber"]').val(orderCode);
    $('input[name="fm_otherexpenditureinfo.SettlementNumber"]').attr('disabled', 'disabled');
    if ($.trim(orderCode) == '') {
        $('input[name="fm_otherexpenditureinfo.SettlementNumber"]').parent().parent().remove();
    }
    
    
    var lbtype = '';
    switch (orderType) {
        case 1: lbtype = '合同单号'; break;
        case 2: lbtype = '申请单号'; break;
        case 3: lbtype = '入库单号'; break;
        case 4: lbtype = '结算款单号'; break;
        case 5: lbtype = '进度款单号'; break;
    }
 
    if (orderType != '') {
        $('input[name="fm_otherexpenditureinfo.SettlementNumber"]').parent().parent().find('label').html(lbtype);
    }
     inputs = '<input type="hidden" id="fm_otherexpenditureinfo_orderType" name="fm_otherexpenditureinfo.orderType" field="orderType" value="' + orderType + '">';
     $('input[name="fm_otherexpenditureinfo.Code"]').after(inputs);
     var SettlementMethodName = (initItems != null && $.trim(initItems.SettlementMethodName) != '') ? initItems.SettlementMethodName : $('select[name="fm_otherexpenditureinfo.SettlementMethodID"]').find('option:eq(0)').text();
     inputs = '<input type="hidden" id="fm_otherexpenditureinfo_SettlementMethodName" name="fm_otherexpenditureinfo.SettlementMethodName" field="SettlementMethodName" value="' + SettlementMethodName + '">';
     $('select[name="fm_otherexpenditureinfo.SettlementMethodID"]').after(inputs);
     $('select[name="fm_otherexpenditureinfo.SettlementMethodID"]').bind('change', function () {
         var text = $(this).find('option:selected').text();
         $('input[name="fm_otherexpenditureinfo.SettlementMethodName"]').val(text);
     });
 
     inputs = '<input type="hidden" id="fm_otherexpenditureinfo_ProjectName" name="fm_otherexpenditureinfo.ProjectName" field="ProjectName" value="">';
     $('#fm_otherexpenditureinfo_ProjectID').after(inputs);
     if ($.trim(initItems.ProjectName) != '') {
         $('input[name="fm_otherexpenditureinfo.ProjectName"]').val(initItems.ProjectName);
     }
     var projectid = $.trim(getUrlParam('projectid'));
     projectid = projectid == '' ? 0 : projectid;
    if (parseInt(projectid) > 0) {
         $('#fm_otherexpenditureinfo_ProjectID').val(projectid);
         $('#fm_otherexpenditureinfo_ProjectID').trigger("chosen:updated");
         $('#fm_otherexpenditureinfo_ProjectID').attr('disabled', 'disabled');
         var pname = $('#fm_otherexpenditureinfo_ProjectID').find('option:selected').text();
         $('#fm_otherexpenditureinfo_ProjectName').val(pname);
     }
    getusername(type);
    
    if ($.trim(sysid) != '' && initItems.Children != null && initItems.Children != undefined && initItems.Children.length > 0) {
        
        $.each(initItems.Children, function (i, r) {
 
            $('select[name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName"]').eq(i).html(listtypeoptions.join(''));
            $('select[name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName"]').eq(i).val(r.ExpenditureTypeName);
            $('select[name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName"]').eq(i).trigger("chosen:updated");
 
            var inputs = '<input type="hidden"  name="fm_otherexpenditureinfo_dtl.FundsCostSubjectsID" class="edit" field="FundsCostSubjectsID" value="' + r.FundsCostSubjectsID + '">';
            $('input[name="fm_otherexpenditureinfo_dtl.FundsCostSubjectsName"]').eq(i).after(inputs);
        });
    }
    inputs = '<input type="hidden" id="fm_otherexpenditureinfo_IncomeUnitID" name="fm_otherexpenditureinfo.IncomeUnitID" class="edit" field="IncomeUnitID" value="' + $.trim(initItems.IncomeUnitID) + '">';
    $('#fm_otherexpenditureinfo_IncomeUnitName').after(inputs);
    if (type == 34) {
        $('#fm_otherexpenditureinfo_IncomeUnitName').bind('focus', function () {
            getCustomerinfo();
        });
    } else if (type != 6 && type != 26 && type != 36 && type != 39 && type != 40) {
        $('#fm_otherexpenditureinfo_IncomeUnitName').bind('focus', function () {
            getmaterielinfo();
        });
    }
    $('input[name="fm_otherexpenditureinfo.IsInPlan"]:eq(0)').attr("value", '1');
    $('input[name="fm_otherexpenditureinfo.IsInPlan"]:eq(1)').attr("value", '2');
 
    if ($.trim(sysid) != '' && initItems != null) {
        var sprintbtn = '<span style="position: absolute;right:20px;"><a onclick="" href="/oa/General/costprint?id=' + sysid + '" target="_blank" style="font-size:12px;margin-right: 20px;"><img src="../../img/ico/printer.png" />表单打印</a>';
        sprintbtn += '<a onclick="" href="/oa/General/printyj?flowid=' + flowid + '&taskid=' + taskid + '" target="_blank" style="font-size:12px;"><img src="../../img/ico/printer.png" />审核意见打印</a></span>';
        $('#txtTitle').append(sprintbtn);
    }
    if (type == 36) {
        $('#fm_otherexpenditureinfo_CashBankName').parent().parent().find('label').html('付款银行');
        $('#fm_otherexpenditureinfo_ReceivablesAccount').parent().parent().find('label').html('付款账号');
        $('#fm_otherexpenditureinfo_IncomeUnitName').parent().parent().remove();
        $('#fm_otherexpenditureinfo_AccountOpenBankAccount').parent().parent().remove();
    } else if (type == 34) {
        
        if (window.childrenItems.length > 0) {
            if (window.childrenItems[0].BeginTime.length == 0)
                $('input[name="fm_otherexpenditureinfo_dtl.BeginTime"]').attr("value", '');
            if (window.childrenItems[0].EndTime.length == 0)
                $('input[name="fm_otherexpenditureinfo_dtl.EndTime"]').attr("value", '');
        }
        var openType = getUrlParam("openType");
        if (openType == "readonly")
            setReadOnly();
    }
    if (orderType == 3 || orderType == 4 || orderType == 5)
        getpaymoney(orderCode, sysid);
    if (sysid == '' && (orderType == 3 || orderType == 4 || orderType == 5) && orderCode != '') {
        
        getinfo(orderType, orderCode);
    }
    if (sysid != '' && (orderType == 3 || orderType == 4 || orderType == 5) && (type == 41 || type == 42 || type == 43 || type == 44 || type == 45 || type == 46 || type == 47 || type == 48 || type == 49 || type == 50 || type == 51 || type == 52)) {
        $('input[name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName"]').attr('disabled', 'disabled');
        $('input[name="fm_otherexpenditureinfo_dtl.remarks"]').attr('disabled', 'disabled');
        $('textarea[name="fm_otherexpenditureinfo_dtl.remarks"]').attr('disabled', 'disabled');
        $('input[name="fm_otherexpenditureinfo_dtl.ExpenditureNotContainTaxAmount"]').attr('disabled', 'disabled');
        $('.subtradd_js').hide();
    }
    if (sysid == '') {
        var inputs = '<input type="hidden" name="fm_otherexpenditureinfo_dtl.FundsCostSubjectsID" class="edit" field="FundsCostSubjectsID" value="">';
        $('input[name="fm_otherexpenditureinfo_dtl.FundsCostSubjectsName"]').after(inputs);
    }
    //财务科目选择后触发
    $('input[name="fm_otherexpenditureinfo_dtl.FundsCostSubjectsName"]').bind('focus', function (i, r) {
        getCWinfo(this);
    });
    var sProjectName = $('#fm_otherexpenditureinfo_ProjectID').find('option:selected').text();
    $('#fm_otherexpenditureinfo_ProjectName').val(sProjectName);
    $('#fm_otherexpenditureinfo_ProjectID').bind('change', function (i, r) {
        sProjectName = $('#fm_otherexpenditureinfo_ProjectID').find('option:selected').text();
        $('#fm_otherexpenditureinfo_ProjectName').val(sProjectName);
    });
    if (type == 34) {
        var title = $("#txtTitle").html();
        var pjname = $("#fm_otherexpenditureinfo_ProjectID option:selected").html();
        $("#txtTitle").html(pjname + "【" + title + "】");
    }
    ///加载投标保证金默认金额
    if (sysid == '' && type == 34) {
        var bidbondamount = $.trim(getUrlParam('bidbondamount'));
        if (bidbondamount != '') {
            $('input[name="fm_otherexpenditureinfo_dtl.ExpenditureNotContainTaxAmount"]').val(bidbondamount == 0 ? "" : bidbondamount);
            countmoney();
        }
    }
}