zzr99
2022-02-16 ede7e32d1ed1b4966cd5ed9d3fb68f5b1176932f
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) {
@@ -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')  //模具信息
                            //{
@@ -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:
                    }