username@email.com
2025-04-27 15eb82df2d6ec539e9d4245bfe08d531e8eb6379
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
$paytype = 0;
//获取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 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>');
            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 54:
            $('#txtTitle').html('运输费付款单');
            listtypeoptions.push('<option value="运输费">运输费</option>');
            break;
        case 4801:
            $('#txtTitle').html('行政办公设备付款单');
            listtypeoptions.push('<option value="行政办公设备">行政办公设备</option>');
            listtypeoptions.push('<option value="行政办公设备">行政办公设备</option>');
            break;
        case 4802:
            $('#txtTitle').html('行政车辆付款单');
            listtypeoptions.push('<option value="行政车辆">行政车辆</option>');
            listtypeoptions.push('<option value="行政车辆">行政车辆</option>');
            break;
        case 4803:
            $('#txtTitle').html('电脑/打印机/会议系统付款单');
            listtypeoptions.push('<option value="电脑/打印机/会议系统">电脑/打印机/会议系统</option>');
            listtypeoptions.push('<option value="电脑/打印机/会议系统">电脑/打印机/会议系统</option>');
            break;
        case 4901:
            $('#txtTitle').html('设备委外维修付款单');
            listtypeoptions.push('<option value="设备委外维修">设备委外维修</option>');
            listtypeoptions.push('<option value="设备委外维修">设备委外维修</option>');
            break;
        case 4902:
            $('#txtTitle').html('设备改造付款单');
            listtypeoptions.push('<option value="设备改造">设备改造</option>');
            listtypeoptions.push('<option value="设备改造">设备改造</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 setpaytype = function (ntype) {
    switch (ntype) {
        case 41: $paytype = 1; break;
        case 42: $paytype = 2; break;
        case 43: $paytype = 3; break;
        case 45: $paytype = 4; break;
        case 46: $paytype = 5; break;
        case 47: $paytype = 6; break;
        case 51: $paytype = 7; break;
        case 48: $paytype = 8; break;
        case 49: $paytype = 9; break;
        case 52: $paytype = 10; break;
        case 50: $paytype = 11; break;
        case 54: $paytype = 13; break;
        case 4801: $paytype = 801; break;
        case 4802: $paytype = 802; break;
        case 4803: $paytype = 803; break;
        case 4901: $paytype = 901; break;
        case 4902: $paytype = 902; break;
    }
}
 
// 金额转大写
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");
                switch (type) {
 
                    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 54:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('运输费付款(' + data.username + ')');
                        break;
                    case 4801:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('行政办公设备付款(' + data.username + ')');
                        break;
                    case 4802:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('行政车辆付款(' + data.username + ')');
                        break;
                    case 4803:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('电脑/打印机/会议系统付款(' + data.username + ')');
                        break;
                    case 4901:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('设备委外维修付款(' + data.username + ')');
                        break;
                    case 4902:
                        $('input[name="fm_otherexpenditureinfo.Title"]').val('设备改造付款(' + data.username + ')');
                        break;
 
                }
            }
        });
    }
}
 
 
var orderCode = '';
 
 
//选择供应商后绑定数据
var setCompanyInfo = function (id, name, UserName, Phone, BankName, BankDeposit, BankAccount) {
    $('#fm_otherexpenditureinfo_IncomeUnitID').val(id);
    $('#fm_otherexpenditureinfo_IncomeUnitName').val(name);
    $('#fm_otherexpenditureinfo_AccountOpenBankAccount').val(BankName);
    $('#fm_otherexpenditureinfo_CashBankName').val(BankDeposit);
    $('#fm_otherexpenditureinfo_ReceivablesAccount').val(BankAccount);
    loadHt($.trim(initItems.Code));
    layer.closeAll();
}
 
//收入单位选择
var getcompanyinfo = function () {
    layer.open({
        type: 2,
        title: '收款单位',
        shadeClose: true,
        shade: 0.4,
        area: ['90%', '90%'],
        content: "/oa/General/company"
    });
}
 
//加载项目和供应商之间的合同信息
var loadHt = function (ordercodes) {
    var projectid = $.trim($('#fm_otherexpenditureinfo_ProjectID').val());
    var PartyBId = $('#fm_otherexpenditureinfo_IncomeUnitID').val();
    var IsFinish = $('input:radio[name="fm_otherexpenditureinfo.IsFinish"]:checked').val();
    var isCY = false;
    if (getUrlParam('isCY') == '1') {
        isCY = true;
    }
    $.ajax({
        url: '/oa/General/GetHtOfProjectAndGYS?type=' + $paytype + '&&projectid=' + projectid + '&&PartyBId=' + PartyBId + '&&ordercodes=' + $.trim(ordercodes) + '&fukuantype=' + IsFinish + '&isCY=' + isCY, async: false, cache: false, dataType: "json",
        success: function (data) {
            var aryoptions = [];
            var defaultOption = '<option value="" paymoney="" balance=""  >请选择</option>';
            aryoptions.push(defaultOption);
 
            if (data.length > 0) {
                $.each(data, function (i, r) {
                    var options = '<option value="' + r.orderCode + '" paymoney="' + r.paymoney + '" balance="' + r.balance + '"  >' + r.orderCode + '</option>';
                    if ($.trim(r.orderCode) != '') {
                        aryoptions.push(options);
                    }
                    if (i == 0) {
                        $('#fm_otherexpenditureinfo_sumpaymoney').val(r.paymoney);
                        $('#fm_otherexpenditureinfo_balance').val(r.balance);
                        $('#fm_otherexpenditureinfo_TotalExpenditure').val(r.balance);
                        $('#fm_otherexpenditureinfo_CapitalizationTotalExpenditure').val(changeMoneyToChinese(r.balance));
                    }
                });
            }
            else {
                $('#fm_otherexpenditureinfo_sumpaymoney').val(0);
                $('#fm_otherexpenditureinfo_balance').val(0);
                $('#fm_otherexpenditureinfo_TotalExpenditure').val(0);
                $('#fm_otherexpenditureinfo_CapitalizationTotalExpenditure').val(changeMoneyToChinese(0));
            }
            $('#fm_otherexpenditureinfo_SettlementNumber').html(aryoptions.join(''));
            $('#fm_otherexpenditureinfo_SettlementNumber').trigger("chosen:updated");
 
        }
    });
}
 
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 ShowDtl = function (id) {
    $.ajax({
        url: '/OA/General/GetcontractpretrialUrl?ordercode=' + id,
        //data: search,
        type: 'Get',
        success: function (data) {
            if (data != null && $.trim(data) != '') {
                var url = '/WorkFlowRun/Index' + "?flowid=" + data.FlowId + '&taskid=' + data.TaskId;
                var inputs = '<a id="todetail" style="display:none;" href="' + url + '"></a>';
                $('#fm_otherexpenditureinfo_SettlementNumber').after(inputs);
                $('#fm_otherexpenditureinfo_SettlementNumber').parent().on('click', function () {
                    var href = $('#todetail').attr('href');
                    console.log(href);
                    appendTabByUrl(href, "查看单据详情");
                });
            }
        },
        error: function (data) {
        },
        complete: function () {
        }
    });
}
 
///数据加载
var initData = function () {
    var url = window.location.href;
    type = parseInt(getUrlParam('type'));
    if (getUrlParam('isCY') == '1') {
        var hiddenHtml = '<input type="hidden" id="fm_otherexpenditureinfo_order_flag" name="fm_otherexpenditureinfo.order_flag"  field="order_flag" class="form-control" isvalid="yes" value="2">';
        $("[name='fm_otherexpenditureinfo.Code']").after(hiddenHtml);
    }
    if ($.trim(sysid) != '' && initItems != null) {
        type = parseInt(initItems.ExpenditureBusinessTypeID);
    }
    if (type == 42) {
        $('#fm_otherexpenditureinfo_SettlementNumber').parent().parent().remove();
    }
    setpaytype(type);
    gettype(type);
    var ExpenditureBusinessTypeName = $('#txtTitle').html().replace('付款单', '');
    if (sysid != '' && initItems != null) {
        ExpenditureBusinessTypeName = initItems.ExpenditureBusinessTypeName;
    }
    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);
 
    inputs = '<input type="hidden" id="fm_otherexpenditureinfo_orderType" name="fm_otherexpenditureinfo.orderType" field="orderType" value="0">';
    $('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);
    }
 
    inputs = '<input type="hidden" id="fm_otherexpenditureinfo_IncomeUnitID" name="fm_otherexpenditureinfo.IncomeUnitID" field="IncomeUnitID" value="0">';
    $('#fm_otherexpenditureinfo_IncomeUnitName').after(inputs);
    if ($.trim(initItems.IncomeUnitID) != '') {
        $('input[name="fm_otherexpenditureinfo.IncomeUnitID"]').val(initItems.IncomeUnitID);
    }
    $('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);
    }
    getusername(type);
    //绑定收款单位改变触发事件
    $('#fm_otherexpenditureinfo_IncomeUnitName').bind('focus', function () {
        getcompanyinfo();
    });
    //绑定金额改变触发事件
    $('#fm_otherexpenditureinfo_TotalExpenditure').bind('change', function () {
        var isfinish = $.trim($(':radio[name="fm_otherexpenditureinfo.IsFinish"]:checked').val());
        isfinish = isfinish == '' ? 0 : parseInt(isfinish);
        var money = $.trim($(this).val());
        money = money == '' ? 0 : money;
        if (isfinish == 1) {
            var yue = $.trim($('#fm_otherexpenditureinfo_balance').val());
            yue = yue == '' ? 0 : yue;
            if (parseFloat(money) > parseFloat(yue))//输入金额>合同应付余额
                money = yue;
        }
        $('#fm_otherexpenditureinfo_TotalExpenditure').val(money);
        $('#fm_otherexpenditureinfo_CapitalizationTotalExpenditure').val(changeMoneyToChinese(money));
    });
    //绑定项目改变触发事件
    $('#fm_otherexpenditureinfo_ProjectID').bind('change', function () {
        var projectname = $('#fm_otherexpenditureinfo_ProjectID').find('option:selected').text();
        $('#fm_otherexpenditureinfo_ProjectName').val(projectname);
        loadHt($.trim(initItems.Code));
    });
 
    //绑定合同改变触发事件
    $('#fm_otherexpenditureinfo_SettlementNumber').bind('change', function () {
        var yue = $.trim($('#fm_otherexpenditureinfo_SettlementNumber').find('option:selected').attr('balance'));
        $('#fm_otherexpenditureinfo_TotalExpenditure').val(yue);
        $('#fm_otherexpenditureinfo_CapitalizationTotalExpenditure').val(changeMoneyToChinese(yue));
 
        var allpay = $.trim($('#fm_otherexpenditureinfo_SettlementNumber').find('option:selected').attr('paymoney'));
        $('#fm_otherexpenditureinfo_sumpaymoney').val(allpay);
        $('#fm_otherexpenditureinfo_balance').val(yue);
    });
 
    //付款分类改变触发事件
    $('input[name="fm_otherexpenditureinfo.IsFinish"]').bind('change', function () {
        var isfinish = $(this).val();
        var money = $.trim($('#fm_otherexpenditureinfo_TotalExpenditure').val());
        money = money == '' ? 0 : money;
        if (parseInt(isfinish) == 1)//结算付款要判断金额
        {
            var yue = $.trim($('#fm_otherexpenditureinfo_balance').val());
            yue = yue == '' ? 0 : yue;
            if (parseFloat(money) > parseFloat(yue))//输入金额>合同应付余额
                money = yue;
 
        }
        $('#fm_otherexpenditureinfo_TotalExpenditure').val(money);
        $('#fm_otherexpenditureinfo_CapitalizationTotalExpenditure').val(changeMoneyToChinese(money));
    });
 
    if (sysid != '') {
 
        loadHt(initItems.Code);
        if (parseInt(type) != 42) {
            $('#fm_otherexpenditureinfo_SettlementNumber').val(initItems.SettlementNumber);
            $('#fm_otherexpenditureinfo_SettlementNumber').trigger("chosen:updated");
            var yue = $.trim($('#fm_otherexpenditureinfo_SettlementNumber').find('option:selected').attr('balance'));
            var allpay = $.trim($('#fm_otherexpenditureinfo_SettlementNumber').find('option:selected').attr('paymoney'));
            $('#fm_otherexpenditureinfo_sumpaymoney').val(allpay);
            $('#fm_otherexpenditureinfo_balance').val(yue);
           
        }
        else {
        }
        $('#fm_otherexpenditureinfo_TotalExpenditure').val(initItems.TotalExpenditure);
        $('#fm_otherexpenditureinfo_CapitalizationTotalExpenditure').val(initItems.CapitalizationTotalExpenditure);
    }
    else {
        var projectname = $('#fm_otherexpenditureinfo_ProjectID').find('option:selected').text();
        $('#fm_otherexpenditureinfo_ProjectName').val(projectname);
    }
    if (type == 45 || type == 48 || type == 4801 || type == 4802 || type == 4803) {
        $('#fm_otherexpenditureinfo_ProjectID').parent().parent().remove();
    }
 
    if (type != 50 && type != 41 && type != 42 && type != 43) {
        $('input[name="fm_otherexpenditureinfo.IsFinish"][value="1"]').parent().remove();
        $('input[name="fm_otherexpenditureinfo.balance"]').parent().parent().remove();
    }
    else {
        $('input[name="fm_otherexpenditureinfo.IsFinish"][value="3"]').parent().remove();
        
    }
 
    $('input:radio[name="fm_otherexpenditureinfo.IsFinish"]').change(function () {
        loadHt($.trim(initItems.Code));
    });
 
    var isdisabled = $('#fm_otherexpenditureinfo_SettlementNumber').attr('disabled');
    var sSettlementNumber = $.trim(initItems.SettlementNumber);
    if (isdisabled == 'disabled' && sSettlementNumber != '') {
        ShowDtl(initItems.SettlementNumber);
        
    }
}