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
 
//获取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 tabIndex;
$(document).on("click", "input[name='plc_payment_plan.incomeUnitName']", function () {
    tabIndex = $(this).closest('tr').index();
    getcompanyinfo();
});
var dtN = '';
var firstTime = '';
var secondTime = '';
var thredTime = '';
initData = function () {
    var projectid = parseInt(getUrlParam('projectid'));
    if(projectid>0)
    {
        $('#plc_payment_plan_dtl_projectid').val(projectid);
        $('#plc_payment_plan_dtl_projectid').attr('disabled', 'disabled');
        $('#plc_payment_plan_dtl_projectid').trigger("chosen:updated");
    }
    inputs = '<input type="hidden" id="plc_company_filed_project_id" name="plc_company_filed_project_id" field="project_id" value="' + (sysid == '' ? 0 : initItems.project_id) + '">';
    $('#plc_payment_plan_dtl_projectid').after(inputs);
    if (window.sysid === '') {
        $.ajax({
            url: "/PLC_payment_plan/GetDefault?projectid=" + projectid,
            async: false,
            cache: false,
            dataType: "json",
            success: function(resp) {
                dtN = resp.dtN;
                firstTime = resp.first;
                secondTime = resp.second;
                thredTime = resp.three;
                $("#plc_payment_plan_dtl_code").val(resp.Num);
                $("#plc_payment_plan_dtl_reportmonth").val(resp.dtN);
                $("#plc_payment_plan_dtl_projectname").val(resp.projectname);
                $("#plc_payment_plan_dtl_projectid").val(resp.projectid);
                $('input[name="plc_payment_plan.firstdate"]').eq(0).val(firstTime);
                $('input[name="plc_payment_plan.seconddate"]').eq(0).val(secondTime);
                $('input[name="plc_payment_plan.thirddate"]').eq(0).val(thredTime);
            }
        });
    } else {
        $('input[name="plc_payment_plan.firstdate"]').each(function (i, r) {
            var value = $(r).val();
            if (value!='') {
                var newvalue = Change(value);
                $(r).val(newvalue);
            }
        });
        $('input[name="plc_payment_plan.seconddate"]').each(function (i, r) {
            var value = $(r).val();
            if (value != '') {
                var newvalue = Change(value);
                $(r).val(newvalue);
            }
        });
        $('input[name="plc_payment_plan.thirddate"]').each(function (i, r) {
            var value = $(r).val();
            if (value != '') {
                var newvalue = Change(value);
                $(r).val(newvalue);
            }
        });
 
        var datastarttime = $("#plc_payment_plan_dtl_reportmonth").val();
        if (datastarttime != '') {
            var date = new Date(parseInt(datastarttime.replace("/Date(", "").replace(")/", ""), 10));
            var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
            var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
            var dataStr = date.getFullYear() + "-" + month;
            $("#plc_payment_plan_dtl_reportmonth").val(dataStr);
        }
       
    }
}
 
compute = function (value, date, endDate) {
    dtN = value;
    var dt = new Date(value + '-01');
    firstTime = new Date(dt.getFullYear(), dt.getMonth() + 1).Format('yyyy-MM');
    secondTime = new Date(dt.getFullYear(), dt.getMonth() + 2).Format('yyyy-MM');
    thredTime = new Date(dt.getFullYear(), dt.getMonth() + 3).Format('yyyy-MM');
    $('input[name="plc_payment_plan.firstdate"]').val(firstTime);
    $('input[name="plc_payment_plan.seconddate"]').val(secondTime);
    $('input[name="plc_payment_plan.thirddate"]').val(thredTime);
}
 
createMethod = function () {
    var ntr = $('input[name="plc_payment_plan.firstdate"]').length;
    if(ntr>0)
    {
        $('input[name="plc_payment_plan.firstdate"]').eq(ntr-1).val(firstTime);
        $('input[name="plc_payment_plan.seconddate"]').eq(ntr-1).val(secondTime);
        $('input[name="plc_payment_plan.thirddate"]').eq(ntr-1).val(thredTime);
    }
}
 
var getcompanyinfo = function () {
    layer.open({
        type: 2,
        title: '收款单位',
        shadeClose: true,
        shade: 0.4,
        area: ['90%', '90%'],
        content: "/oa/General/company"
    });
}
 
//选择供应商后绑定数据
var setCompanyInfo = function (id, name, UserName, Phone, BankName, BankDeposit, BankAccount) {
    var $row = $("table tr:eq(" + tabIndex + ")");
    $row.find("input[field='incomeUnitID']").val(id);
    $row.find("input[field='incomeUnitName']").val(name);
    layer.closeAll();
}
 
 
function Change(e) {
    
    var date = new Date(parseInt(e.replace("/Date(", "").replace(")/", ""), 10));
    var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
    var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
    var dataStr = date.getFullYear() + "-" + month;
    return dataStr;
}