yangle
2023-08-03 cba0ef063a24b5b965bfa943cf1c8d2c8acba84a
WebTM/views/¹¤×ʹÜÀí/¿¼Çڻ㱨µ¥/Pay_WorkTimesBillEdit.html
@@ -300,7 +300,6 @@
                });
                var tableReload = table.reload;
                var option = {
                    elem: '#mainTable'
@@ -317,7 +316,7 @@
                        , { field: 'HEmpRate', title: '职员系数', edit: 'text', width: 100 }
                        , { field: 'HPMTimes', title: '下午工时', edit: 'text', width: 100 }
                        , { field: 'HAMTimes', title: '上午工时', edit: 'text', width: 100 }
                        , { field: 'HBaseTimes', title: '基本工时', edit: 'text', width: 100 }
                        , { field: 'HBaseTimes', title: '基本工时', width: 100 }
                        , { field: 'HBaseDays', title: '基本天数', edit: 'text', width: 100 }
                        , { field: 'HOverTimes', title: '加班工时', edit: 'text', width: 100 }
                        , { field: 'HOverDays', title: '加班天数', edit: 'text', width: 100 }
@@ -334,6 +333,12 @@
                        , { field: 'HAbsentDays', title: '旷工天数', edit: 'text', width: 100 }
                        , { field: 'HRestFlag', title: '厂休', edit: 'text', value: "true", width: 100, hide: true }
                        , { field: 'HSchClassID', title: '班次', edit: 'text', width: 100 }
                        , { field: 'HCTPrjID', title: '核算方案代码', edit: 'text', width: 100, hide: true}
                        , { field: 'HCTPrjName', title: '核算方案名称', edit: 'text', event: 'HCTPrjName', width: 100 }
                        , { field: 'HWorkTypeID', title: '工种代码', edit: 'text', width: 100, hide: true}
                        , { field: 'HWorkTypeName', title: '工种名称', edit: 'text', event: 'HWorkTypeName', width: 100 }
                        , { field: 'HPayMoney', title: '小时工资', edit: 'text', width: 100 }
                        , { field: 'HMoney', title: '工资', width: 100 }
                        //, { field: 'HNeedTimes   ', title: '应上班工时', edit: 'text', width: 100 }
                        , { field: 'HRemark', title: '备注', edit: 'text', width: 100 }
                        , { field: 'HMainSourceInterID ', title: '源单主内码', edit: 'text', width: 100, hide: true }
@@ -362,7 +367,8 @@
                        , "HPMTimes": 0, "HAMTimes": 0, "HBaseTimes": 0, "HBaseDays": 0, "HOverTimes": 0
                        , "HOverDays": 0, "HLeaveTimes": 0, "HLeaveDays": 0, "HLateQty": 0, "HLateTimes": 0, "HEarlyQty": 0
                        , "HEarlyTimes": 0, "HOutForEmpQty": 0, "HOutForEmpTimes": 0, "HOutForComQty": 0, "HOutForComTimes": 0, "HAbsentDays": 0
                        , "HRestFlag": "true", "HSchClassID": 0, "HNeedTimes": 0, "HMainSourceInterID": 0, "HMainSourceEntryID": 0, "HMainSourceBillNo": 0
                        , "HRestFlag": "true", "HSchClassID": 0, "HCTPrjID": 0, "HCTPrjName": "", "HWorkTypeID": 0, "HWorkTypeName": "", "HPayMoney": 0,"HMoney":0
                        , "HNeedTimes": 0, "HMainSourceInterID": 0, "HMainSourceEntryID": 0, "HMainSourceBillNo": 0
                        , "HSourceBillType": "", "HRemark": ""
                    }];
                    table.render(option);
@@ -404,7 +410,8 @@
                        , "HPMTimes": 0, "HAMTimes": 0, "HBaseTimes": 0, "HBaseDays": 0, "HOverTimes": 0
                        , "HOverDays": 0, "HLeaveTimes": 0, "HLeaveDays": 0, "HLateQty": 0, "HLateTimes": 0, "HEarlyQty": 0
                        , "HEarlyTimes": 0, "HOutForEmpQty": 0, "HOutForEmpTimes": 0, "HOutForComQty": 0, "HOutForComTimes": 0, "HAbsentDays": 0
                        , "HRestFlag": "true", "HSchClassID": 0, "HNeedTimes": 0, "HMainSourceInterID": 0, "HMainSourceEntryID": 0, "HMainSourceBillNo": 0
                        , "HRestFlag": "true", "HSchClassID": 0, "HCTPrjID": 0, "HCTPrjName": "", "HWorkTypeID": 0, "HWorkTypeName": "", "HPayMoney": 0, "HMoney": 0
                        , "HNeedTimes": 0, "HMainSourceInterID": 0, "HMainSourceEntryID": 0, "HMainSourceBillNo": 0
                        , "HSourceBillType": "", "HRemark": ""
                    };
                    switch (obj.event) {
@@ -469,7 +476,7 @@
                                    , btn1: function (index, layero) {
                                        //按钮【按钮一】的回调
                                        var iframeWindow = window['layui-layer-iframe' + index];
                                        var checkStatus = iframeWindow.layui.table.checkStatus('ck-table');
                                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');
                                        if (checkStatus.data.length === 0) {
                                            return layer.msg('请选择数据');
                                        }
@@ -486,6 +493,54 @@
                                    }
                                });
                            }
                            if (obj.event === 'HCTPrjName') {//核算方案
                                layer.open({
                                    type: 2//弹窗类型
                                    , skin: 'layui-layer-rim' //加上边框
                                    , area: ['90%', '90%']//大小
                                    , title: '核算方式列表'//标题
                                    , shift: 2//弹出动画
                                    , content: ['../../../views/Baseset/基础资料/Gy_ClassTimePrjList.html', 'yes']
                                    , btn: ['确定', '取消']
                                    , btn1: function (index, layero) {//按钮【按钮一】的回调
                                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                                        if (checkStatus.data.length === 0) {
                                            return layer.msg('请选择数据');
                                        }
                                        obj.update({
                                            HCTPrjName: checkStatus.data[0].HName
                                            , HCTPrjID: checkStatus.data[0].HItemID
                                        });
                                        layer.close(layer.index);
                                    }
                                    , btn2: function (index, layero) { }
                                })
                            }
                            if (obj.event === 'HWorkTypeName') {//工种
                                layer.open({
                                    type: 2//弹窗类型
                                    , skin: 'layui-layer-rim' //加上边框
                                    , area: ['90%', '90%']//大小
                                    , title: '工种列表'//标题
                                    , shift: 2//弹出动画
                                    , content: ['../../../views/Baseset/基础资料/Gy_WorkTypeList.html', 'yes']
                                    , btn: ['确定', '取消']
                                    , btn1: function (index, layero) {//按钮【按钮一】的回调
                                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                                        if (checkStatus.data.length === 0) {
                                            return layer.msg('请选择数据');
                                        }
                                        obj.update({
                                            HWorkTypeName: checkStatus.data[0].HName
                                            , HWorkTypeID: checkStatus.data[0].HItemID
                                        });
                                        layer.close(layer.index);
                                    }
                                    , btn2: function (index, layero) { }
                                })
                            }
                            //if (obj.event === 'HMaterCheck')  //模具信息
                            //{
@@ -504,7 +559,7 @@
                            //            //按钮【按钮一】的回调
                            //            var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                            //            var checkStatus = iframeWindow.layui.table.checkStatus('ck-table');//获取table的elem:"#test"
                            //            var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                            //            if (checkStatus.data.length === 0) {
                            //                return layer.msg('请选择数据');
                            //            }
@@ -547,7 +602,7 @@
                            //        , btn1: function (index, layero) {
                            //            //按钮【按钮一】的回调
                            //            var iframeWindow = window['layui-layer-iframe' + index];
                            //            var checkStatus = iframeWindow.layui.table.checkStatus('ck-table');
                            //            var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');
                            //            if (checkStatus.data.length === 0) {
                            //                return layer.msg('请选择数据');
                            //            }
@@ -582,7 +637,7 @@
                            //            //按钮【按钮一】的回调
                            //            var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                            //            var checkStatus = iframeWindow.layui.table.checkStatus('ck-table');//获取table的elem:"#test"
                            //            var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                            //            if (checkStatus.data.length === 0) {
                            //                return layer.msg('请选择数据');
                            //            }
@@ -623,55 +678,56 @@
                    //layer.msg('[ID: ' + data.id + '] ' + field + ' å­—段更改为:' + value);
                    switch (field) {
                        case "HDesignLife":  //设计寿命
                        case "HPMTimes":  //下午工时
                            value = isNaN(value) ? 0 : value;
                            var HUseLife = isNaN(data.HUseLife) ? 0 : data.HUseLife;
                            //基本工时=上午工时+下午工时
                            var HBaseTimes = Number(isNaN(data.HAMTimes) ? 0 : data.HAMTimes) + Number(value);
                            //工资=小时工资*基本工时
                            var HMoney = Number(isNaN(data.HPayMoney) ? 0 : data.HPayMoney) * HBaseTimes;
                            //同步更新表格和缓存对应的值
                            obj.update({
                                HDesignLife: value,                          //设计寿命
                                HLeaveLife: value - HUseLife,           //剩余寿命=设计寿命-使用寿命
                                HPMTimes: value,                  //下午工时
                                HBaseTimes: HBaseTimes,           //基本工时
                                HMoney: HMoney, //工资
                            });
                            break;
                        case "HLeaveLife":  //剩余寿命
                            var HDesignLife = isNaN(data.HDesignLife) ? 0 : data.HDesignLife;
                            var HUseLife = isNaN(data.HUseLife) ? 0 : data.HUseLife;
                            //同步更新表格和缓存对应的值
                            obj.tr.find('td[data-field=HLeaveLife] input').val(HDesignLife - HUseLife);
                            obj.update({
                                HLeaveLife: HDesignLife - HUseLife,   //剩余寿命=设计寿命-使用寿命
                            });
                            break;
                        case "HUseLife":    //使用寿命
                            var HDesignLife = isNaN(data.HDesignLife) ? 0 : data.HDesignLife;
                        case "HAMTimes":  //上午工时
                            value = isNaN(value) ? 0 : value;
                            //基本工时=上午工时+下午工时
                            var HBaseTimes = Number(value) + Number(isNaN(data.HPMTimes) ? 0 : data.HPMTimes);
                            //工资=小时工资*基本工时
                            var HMoney = Number(isNaN(data.HPayMoney) ? 0 : data.HPayMoney) * HBaseTimes;
                            //同步更新表格和缓存对应的值
                            obj.update({
                                HLeaveLife: HDesignLife - value, //剩余寿命=设计寿命-使用寿命
                                HAMTimes: value,                  //上午工时
                                HBaseTimes: HBaseTimes,           //基本工时
                                HMoney: HMoney, //工资
                            });
                            break;
                        case "HQty":        //实发数量
                        case "HPayMoney":        //小时工资
                            value = isNaN(value) ? 0 : value;
                            var HPrice = isNaN(data.HPrice) ? 0 : data.HPrice;
                            //工资=小时工资*基本工时
                            var HMoney = Number(value) * Number(isNaN(data.HBaseTimes) ? 0 : data.HBaseTimes);
                            //console.log(HMoney);
                            //同步更新表格和缓存对应的值
                            obj.update({
                                HMoney: value * HPrice, //金额=实收数量*单价
                                HMoney: HMoney, //工资
                            });
                            break;
                        case "HPrice":      //单价
                        case "HMoney":         //工资
                            value = isNaN(value) ? 0 : value;
                            var HQty = isNaN(data.HQty) ? 0 : data.HQty;
                            if (data.HPayMoney == 0 || data.HPayMoney == null)
                            {
                                value = 0;
                            }
                            //工资=小时工资*基本工时
                            var HMoney = Number(isNaN(data.HPayMoney) ? 0 : data.HPayMoney) * Number(isNaN(data.HBaseTimes) ? 0 : data.HBaseTimes);
                            console.log(HMoney);
                            //同步更新表格和缓存对应的值
                            obj.update({
                                HMoney: value * HQty, //金额=实收数量*单价
                                HMoney: HMoney, //工资
                            });
                            break;
                        case "HMoney":     //金额
                            var HPrice = isNaN(data.HPrice) ? 0 : data.HPrice;
                            var HQty = isNaN(data.HQty) ? 0 : data.HQty;
                            //同步更新表格和缓存对应的值
                            obj.update({
                                HMoney: HPrice * HQty, //金额=实收数量*单价
                            });
                            break;
                        default:
                    }
@@ -770,12 +826,13 @@
                            //按钮【按钮一】的回调
                            var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                            var checkStatus = iframeWindow.layui.table.checkStatus('ck-table');//获取table的elem:"#test"
                            var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                            if (checkStatus.data.length === 0) {
                                return layer.msg('请选择数据');
                            }
                            $("#HGroupName").val(checkStatus.data[0].班组);
                            $("#HGroupID").val(checkStatus.data[0].HItemID);
                            GetEmployee();
                            layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                        }
                        , btn2: function (index, layero) {
@@ -790,45 +847,53 @@
                        }
                    });
                });
                function GetEmployee() {
                    $.ajax({
                        url: GetWEBURL() + "/Pay_WorkTimesBill/GetEmployeeByHGroup",
                        type: "GET",
                        data: { "HGroupID": $("#HGroupID").val() },
                        success: function (result) {
                            if (result != null) {
                                if (result.count == 1) {
                                    var BYData = result.list[0];
                                    var rowdate1 = layui.table.cache["mainTable"];
                                    option.data = [{
                                        "HEmpID": "", "HEmpNumber": "", "HEmpName": "", "HEmpID": "", "HEmpRate": 0
                                        , "HPMTimes": 0, "HAMTimes": 0, "HBaseTimes": 0, "HBaseDays": 0, "HOverTimes": 0
                                        , "HOverDays": 0, "HLeaveTimes": 0, "HLeaveDays": 0, "HLateQty": 0, "HLateTimes": 0, "HEarlyQty": 0
                                        , "HEarlyTimes": 0, "HOutForEmpQty": 0, "HOutForEmpTimes": 0, "HOutForComQty": 0, "HOutForComTimes": 0, "HAbsentDays": 0
                                        , "HRestFlag": "true", "HSchClassID": 0, "HCTPrjID": 0, "HCTPrjName": "", "HWorkTypeID": 0, "HWorkTypeName": "", "HPayMoney": 0, "HMoney": 0
                                        , "HNeedTimes": 0, "HMainSourceInterID": 0, "HMainSourceEntryID": 0, "HMainSourceBillNo": 0
                                        , "HSourceBillType": "", "HRemark": ""
                                    }];
                                    table.render(option);
                                    if (BYData.length != 0)  //表体数据为空时
                                    {
                                        buttonArr = [];//清空数组
                                        for (var i = 0; i < BYData.length; i++) {
                                            var checkrow = {
                                                "HEmpID": BYData[i].HEmpID, "HEmpNumber": BYData[i].HEmpNumber, "HEmpName": BYData[i].HEmpName, "HEmpRate": BYData[i].HEmpRate
                                                , "HPMTimes": rowdate1[i].HPMTimes, "HAMTimes": rowdate1[i].HAMTimes, "HBaseTimes": rowdate1[i].HBaseTimes, "HBaseDays": rowdate1[i].HBaseDays, "HOverTimes": rowdate1[i].HOverTimes
                                                , "HOverDays": rowdate1[i].HOverDays, "HLeaveTimes": rowdate1[i].HLeaveTimes, "HLeaveDays": rowdate1[i].HLeaveDays, "HLateQty": rowdate1[i].HLateQty, "HLateTimes": rowdate1[i].HLateTimes, "HEarlyQty": rowdate1[i].HEarlyQty
                                                , "HEarlyTimes": rowdate1[i].HEarlyTimes, "HOutForEmpQty": rowdate1[i].HOutForEmpQty, "HOutForEmpTimes": rowdate1[i].HOutForEmpTimes, "HOutForComQty": rowdate1[i].HOutForComQty, "HOutForComTimes": rowdate1[i].HOutForComTimes, "HAbsentDays": rowdate1[i].HAbsentDays
                                                , "HRestFlag": "true", "HSchClassID": rowdate1[i].HSchClassID, "HCTPrjID": BYData[i].HCTPrjID, "HCTPrjName": BYData[i].HCTPrjName, "HWorkTypeID": rowdate1[i].HWorkTypeID, "HWorkTypeName": rowdate1[i].HWorkTypeName, "HPayMoney": rowdate1[i].HPayMoney, "HMoney": rowdate1[i].HMoney
                                                , "HNeedTimes": rowdate1[i].HNeedTimes, "HMainSourceInterID": rowdate1[i].HMainSourceInterID, "HMainSourceEntryID": rowdate1[i].HMainSourceEntryID, "HMainSourceBillNo": rowdate1[i].HMainSourceBillNo
                                                , "HSourceBillType": rowdate1[i].HSourceBillType, "HRemark": rowdate1[i].HRemark
                                            };
                                            buttonArr.push(checkrow);  //将之前的数据存储
                                        }
                                        table.reload("mainTable", {
                                            data: buttonArr    //将数据重新载入表格
                                        })
                                    }
                                } else {
                                    layer.alert(result.code + result.Message, { icon: 5 });
                                }
                            }
                        }
                    })
                }
                ////表头信息主管弹窗
                //form.on('submit(Employee)', function () {
                //    //页面层-自定义
                //    layer.open({
                //        type: 2,
                //        skin: 'layui-layer-rim', //加上边框
                //        title: '职员列表',
                //        closeBtn: 1,
                //        shift: 2,
                //        area: ['80%', '80%'],
                //        maxmin: true,
                //        content: ['../../../views/Baseset/基础资料/Gy_EmployeeList.html?Type=HEmpID', 'yes'],
                //        btn: ['确定', '取消']
                //        , btn1: function (index, layero) {
                //            //按钮【按钮一】的回调
                //            var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                //            var checkStatus = iframeWindow.layui.table.checkStatus('ck-table');//获取table的elem:"#test"
                //            if (checkStatus.data.length === 0) {
                //                return layer.msg('请选择数据');
                //            }
                //            $("#HEmpName").val(checkStatus.data[0].HName);
                //            $("#HEmpID").val(checkStatus.data[0].HItemID);
                //            layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                //        }
                //        , btn2: function (index, layero) {
                //            //按钮【按钮二】的回调
                //            //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                //        },
                //        end: function () {
                //        },
                //        success: function (layero, index) {
                //        }
                //    });
                //});
                //表头信息部门弹窗
                form.on('submit(Department)', function () {
                    //页面层-自定义
@@ -846,7 +911,7 @@
                            //按钮【按钮一】的回调
                            var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                            var checkStatus = iframeWindow.layui.table.checkStatus('ck-table');//获取table的elem:"#test"
                            var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                            if (checkStatus.data.length === 0) {
                                return layer.msg('请选择数据');
                            }
@@ -866,43 +931,7 @@
                        }
                    });
                });
                ////表头信息工资类型弹窗
                //form.on('submit(PayType)', function () {
                //    //页面层-自定义
                //    layer.open({
                //        type: 2,
                //        skin: 'layui-layer-rim', //加上边框
                //        title: '工资类型列表',
                //        closeBtn: 1,
                //        shift: 2,
                //        area: ['80%', '80%'],
                //        maxmin: true,
                //        content: ['../../../views/工资管理/Gy_WorkPayTypeBillList.html?Type=HPayTypeID', 'yes'],
                //        btn: ['确定', '取消']
                //        , btn1: function (index, layero) {
                //            //按钮【按钮一】的回调
                //            var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                //            var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                //            if (checkStatus.data.length === 0) {
                //                return layer.msg('请选择数据');
                //            }
                //            $("#HPayTypeName").val(checkStatus.data[0].工资类型名称);
                //            $("#HPayID").val(checkStatus.data[0].HItemID);
                //            layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                //        }
                //        , btn2: function (index, layero) {
                //            //按钮【按钮二】的回调
                //            //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                //        },
                //        end: function () {
                //        },
                //        success: function (layero, index) {
                //        }
                //    });
                //});
                //退出
                form.on('submit(Exit)', function (data) {
                    if (OperationType == 1) {