diff --git a/antis-ncc-admin/src/views/wageManagement/shop-detail-dialog.vue b/antis-ncc-admin/src/views/wageManagement/shop-detail-dialog.vue index 0591094..dffcecc 100644 --- a/antis-ncc-admin/src/views/wageManagement/shop-detail-dialog.vue +++ b/antis-ncc-admin/src/views/wageManagement/shop-detail-dialog.vue @@ -131,6 +131,38 @@ + +
+
+ + 成本信息 +
+
+
+
+ 销售业绩: + {{ formatMoney(detailData.SalesPerformance) }} +
+
+ 产品物料: + {{ formatMoney(detailData.ProductMaterial) }} +
+
+ 合作项目成本: + {{ formatMoney(detailData.CooperationCost) }} +
+
+ 店内支出: + {{ formatMoney(detailData.StoreExpense) }} +
+
+ 洗毛巾费用: + {{ formatMoney(detailData.LaundryCost) }} +
+
+
+
+
diff --git a/antis-ncc-admin/src/views/wageManagement/shop.vue b/antis-ncc-admin/src/views/wageManagement/shop.vue index cc5a99f..9efc534 100644 --- a/antis-ncc-admin/src/views/wageManagement/shop.vue +++ b/antis-ncc-admin/src/views/wageManagement/shop.vue @@ -229,6 +229,35 @@ + + + + + + + + + + + + + + + + + + + @@ -799,6 +828,11 @@ export default { '消耗是否达标', '未达标指标数', '考核扣款', + '销售业绩', + '产品物料', + '合作项目成本', + '店内支出', + '洗毛巾费用', '毛利', '提成比例', '提成金额', @@ -859,6 +893,11 @@ export default { item.ConsumeReached || '否', item.UnreachedIndicatorCount || '0', this.formatMoney(item.AssessmentDeduction), + this.formatMoney(item.SalesPerformance), + this.formatMoney(item.ProductMaterial), + this.formatMoney(item.CooperationCost), + this.formatMoney(item.StoreExpense), + this.formatMoney(item.LaundryCost), this.formatMoney(item.GrossProfit), this.formatPercent(item.CommissionRate), this.formatMoney(item.CommissionAmount), diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_business_unit_manager_salary_statistics/LqBusinessUnitManagerSalaryStatisticsEntity.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_business_unit_manager_salary_statistics/LqBusinessUnitManagerSalaryStatisticsEntity.cs index 752a004..6e2d8d0 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_business_unit_manager_salary_statistics/LqBusinessUnitManagerSalaryStatisticsEntity.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_business_unit_manager_salary_statistics/LqBusinessUnitManagerSalaryStatisticsEntity.cs @@ -78,7 +78,7 @@ namespace NCC.Extend.Entitys.lq_business_unit_manager_salary_statistics public decimal SalesPerformance { get; set; } /// - /// 产品物料(仓库领用金额,注意11月特殊规则:11月工资算10月数据) + /// 产品物料(仓库领用金额,使用上月数据:计算本月工资时使用上月数据) /// [SugarColumn(ColumnName = "F_ProductMaterial")] public decimal ProductMaterial { get; set; } diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqBusinessUnitManagerSalaryService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqBusinessUnitManagerSalaryService.cs index 417824c..fad11c4 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqBusinessUnitManagerSalaryService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqBusinessUnitManagerSalaryService.cs @@ -272,12 +272,18 @@ namespace NCC.Extend .GroupBy(x => x.Md) .ToDictionary(g => g.Key, g => g.Sum(x => x.ActualRefundAmount ?? x.Tkje ?? 0)); - // 1.7 产品物料统计(仓库领用金额,注意11月特殊规则) + // 1.7 产品物料统计(仓库领用金额,使用上月数据) + // 计算本月工资时,使用上月数据(如:计算12月工资,使用11月数据) var queryMonth = monthStr; - if (month == 11) + if (month == 1) { - // 11月工资算10月数据 - queryMonth = $"{year}10"; + // 1月工资使用上一年12月数据 + queryMonth = $"{year - 1}12"; + } + else + { + // 其他月份使用上一个月数据 + queryMonth = $"{year}{(month - 1):D2}"; } var productMaterialSql = $@" SELECT diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqDirectorSalaryService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqDirectorSalaryService.cs index d2f03c9..5881f37 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqDirectorSalaryService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqDirectorSalaryService.cs @@ -360,12 +360,18 @@ namespace NCC.Extend .ToListAsync(); var attendanceDict = attendanceList.ToDictionary(x => x.UserId, x => x); - // 1.9 产品物料统计(仓库领用金额,注意11月特殊规则) + // 1.9 产品物料统计(仓库领用金额,使用上月数据) + // 计算本月工资时,使用上月数据(如:计算12月工资,使用11月数据) var queryMonth = monthStr; - if (month == 11) + if (month == 1) { - // 11月工资算10月数据 - queryMonth = $"{year}10"; + // 1月工资使用上一年12月数据 + queryMonth = $"{year - 1}12"; + } + else + { + // 其他月份使用上一个月数据 + queryMonth = $"{year}{(month - 1):D2}"; } var productMaterialSql = $@" SELECT @@ -520,7 +526,7 @@ namespace NCC.Extend salary.SalesPerformance = billing - refund; // 2.5 统计各项成本 - // 产品物料(注意11月特殊规则已在查询时处理) + // 产品物料(使用上月数据) salary.ProductMaterial = productMaterialDict.ContainsKey(storeId) ? productMaterialDict[storeId] : 0; // 合作项目成本 diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqStoreManagerSalaryService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqStoreManagerSalaryService.cs index 0316ea8..2296a95 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqStoreManagerSalaryService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqStoreManagerSalaryService.cs @@ -314,12 +314,18 @@ namespace NCC.Extend .ToListAsync(); var attendanceDict = attendanceList.ToDictionary(x => x.UserId, x => x); - // 1.9 产品物料统计(仓库领用金额,注意11月特殊规则) + // 1.9 产品物料统计(仓库领用金额,使用上月数据) + // 计算本月工资时,使用上月数据(如:计算12月工资,使用11月数据) var queryMonth = monthStr; - if (month == 11) + if (month == 1) { - // 11月工资算10月数据 - queryMonth = $"{year}10"; + // 1月工资使用上一年12月数据 + queryMonth = $"{year - 1}12"; + } + else + { + // 其他月份使用上一个月数据 + queryMonth = $"{year}{(month - 1):D2}"; } var productMaterialSql = $@" SELECT @@ -543,7 +549,7 @@ namespace NCC.Extend // 销售业绩 = 开单业绩 - 退款业绩 salary.SalesPerformance = salary.StoreTotalPerformance; - // 产品物料(注意11月特殊规则已在查询时处理) + // 产品物料(使用上月数据) salary.ProductMaterial = productMaterialDict.ContainsKey(storeId) ? productMaterialDict[storeId] : 0; // 合作项目成本 @@ -946,11 +952,11 @@ namespace NCC.Extend // 批量更新 if (lockedCount > 0 || unlockedCount > 0) { - var salariesToUpdate = salaries.Where(s => - (input.IsLocked && s.IsLocked == 0) || + var salariesToUpdate = salaries.Where(s => + (input.IsLocked && s.IsLocked == 0) || (!input.IsLocked && s.IsLocked == 1 && s.EmployeeConfirmStatus != 1) ).ToList(); - + if (salariesToUpdate.Any()) { await _db.Updateable(salariesToUpdate) @@ -962,10 +968,10 @@ namespace NCC.Extend var action = input.IsLocked ? "锁定" : "解锁"; var count = input.IsLocked ? lockedCount : unlockedCount; var message = $"{action}成功:{count}条"; - + if (alreadyLockedCount > 0) message += $",跳过{alreadyLockedCount}条(已是{action}状态)"; - + if (skippedCount > 0) message += $",跳过{skippedCount}条(已确认的记录不能解锁)"; @@ -1004,7 +1010,7 @@ namespace NCC.Extend { if (file == null || file.Length == 0) throw NCCException.Oh("请选择要上传的Excel文件"); - + var allowedExtensions = new[] { ".xlsx", ".xls" }; var fileExtension = Path.GetExtension(file.FileName).ToLowerInvariant(); if (!allowedExtensions.Contains(fileExtension)) @@ -1054,7 +1060,7 @@ namespace NCC.Extend var firstColumnValue = GetColumnValue(0); bool isOldFormat = !string.IsNullOrWhiteSpace(firstColumnValue) && (firstColumnValue == "门店名称" || (!long.TryParse(firstColumnValue, out _) && firstColumnValue.Length > 20)); - + int storeNameIndex = isOldFormat ? 0 : 1; int employeeNameIndex = isOldFormat ? 1 : 2; int offset = isOldFormat ? 0 : 1; @@ -1088,7 +1094,7 @@ namespace NCC.Extend { existing = await _db.Queryable() .Where(x => x.Id == id).FirstAsync(); - + if (existing != null && (existing.IsLocked == 1 || existing.EmployeeConfirmStatus == 1)) { skippedCount++; @@ -1124,50 +1130,55 @@ namespace NCC.Extend entity.ConsumeReached = GetColumnValue(14 + offset); entity.UnreachedIndicatorCount = ParseInt(GetColumnValue(15 + offset)); entity.AssessmentDeduction = ParseDecimal(GetColumnValue(16 + offset)); - entity.GrossProfit = ParseDecimal(GetColumnValue(17 + offset)); - entity.CommissionRate = ParseDecimal(GetColumnValue(18 + offset)); - entity.CommissionAmount = ParseDecimal(GetColumnValue(19 + offset)); - entity.BaseSalary = ParseDecimal(GetColumnValue(20 + offset)); - entity.ActualBaseSalary = ParseDecimal(GetColumnValue(21 + offset)); - entity.GrossSalary = ParseDecimal(GetColumnValue(22 + offset)); - entity.WorkingDays = ParseInt(GetColumnValue(23 + offset)); - entity.LeaveDays = ParseInt(GetColumnValue(24 + offset)); - // Excel中的车补(25)、少休费(26)、全勤奖(27)字段在实体类中没有对应字段,跳过 - entity.MonthlyTrainingSubsidy = ParseDecimal(GetColumnValue(28 + offset)); - entity.MonthlyTransportSubsidy = ParseDecimal(GetColumnValue(29 + offset)); - entity.LastMonthTrainingSubsidy = ParseDecimal(GetColumnValue(30 + offset)); - entity.LastMonthTransportSubsidy = ParseDecimal(GetColumnValue(31 + offset)); - entity.TotalSubsidy = ParseDecimal(GetColumnValue(32 + offset)); - entity.MissingCard = ParseDecimal(GetColumnValue(33 + offset)); - entity.LateArrival = ParseDecimal(GetColumnValue(34 + offset)); - entity.LeaveDeduction = ParseDecimal(GetColumnValue(35 + offset)); - entity.SocialInsuranceDeduction = ParseDecimal(GetColumnValue(36 + offset)); - entity.RewardDeduction = ParseDecimal(GetColumnValue(37 + offset)); - entity.AccommodationDeduction = ParseDecimal(GetColumnValue(38 + offset)); - entity.StudyPeriodDeduction = ParseDecimal(GetColumnValue(39 + offset)); - entity.WorkClothesDeduction = ParseDecimal(GetColumnValue(40 + offset)); - entity.TotalDeduction = ParseDecimal(GetColumnValue(41 + offset)); - entity.Bonus = ParseDecimal(GetColumnValue(42 + offset)); - entity.ReturnPhoneDeposit = ParseDecimal(GetColumnValue(43 + offset)); - entity.ReturnAccommodationDeposit = ParseDecimal(GetColumnValue(44 + offset)); - entity.LastMonthSupplement = ParseDecimal(GetColumnValue(45 + offset)); - entity.ActualSalary = ParseDecimal(GetColumnValue(46 + offset)); - entity.MonthlyPaymentStatus = GetColumnValue(47 + offset); - entity.PaidAmount = ParseDecimal(GetColumnValue(48 + offset)); - entity.PendingAmount = ParseDecimal(GetColumnValue(49 + offset)); - entity.MonthlyTotalPayment = ParseDecimal(GetColumnValue(50 + offset)); + entity.SalesPerformance = ParseDecimal(GetColumnValue(17 + offset)); + entity.ProductMaterial = ParseDecimal(GetColumnValue(18 + offset)); + entity.CooperationCost = ParseDecimal(GetColumnValue(19 + offset)); + entity.StoreExpense = ParseDecimal(GetColumnValue(20 + offset)); + entity.LaundryCost = ParseDecimal(GetColumnValue(21 + offset)); + entity.GrossProfit = ParseDecimal(GetColumnValue(22 + offset)); + entity.CommissionRate = ParseDecimal(GetColumnValue(23 + offset)); + entity.CommissionAmount = ParseDecimal(GetColumnValue(24 + offset)); + entity.BaseSalary = ParseDecimal(GetColumnValue(25 + offset)); + entity.ActualBaseSalary = ParseDecimal(GetColumnValue(26 + offset)); + entity.GrossSalary = ParseDecimal(GetColumnValue(27 + offset)); + entity.WorkingDays = ParseInt(GetColumnValue(28 + offset)); + entity.LeaveDays = ParseInt(GetColumnValue(29 + offset)); + // Excel中的车补(30)、少休费(31)、全勤奖(32)字段在实体类中没有对应字段,跳过 + entity.MonthlyTrainingSubsidy = ParseDecimal(GetColumnValue(33 + offset)); + entity.MonthlyTransportSubsidy = ParseDecimal(GetColumnValue(34 + offset)); + entity.LastMonthTrainingSubsidy = ParseDecimal(GetColumnValue(35 + offset)); + entity.LastMonthTransportSubsidy = ParseDecimal(GetColumnValue(36 + offset)); + entity.TotalSubsidy = ParseDecimal(GetColumnValue(37 + offset)); + entity.MissingCard = ParseDecimal(GetColumnValue(38 + offset)); + entity.LateArrival = ParseDecimal(GetColumnValue(39 + offset)); + entity.LeaveDeduction = ParseDecimal(GetColumnValue(40 + offset)); + entity.SocialInsuranceDeduction = ParseDecimal(GetColumnValue(41 + offset)); + entity.RewardDeduction = ParseDecimal(GetColumnValue(42 + offset)); + entity.AccommodationDeduction = ParseDecimal(GetColumnValue(43 + offset)); + entity.StudyPeriodDeduction = ParseDecimal(GetColumnValue(44 + offset)); + entity.WorkClothesDeduction = ParseDecimal(GetColumnValue(45 + offset)); + entity.TotalDeduction = ParseDecimal(GetColumnValue(46 + offset)); + entity.Bonus = ParseDecimal(GetColumnValue(47 + offset)); + entity.ReturnPhoneDeposit = ParseDecimal(GetColumnValue(48 + offset)); + entity.ReturnAccommodationDeposit = ParseDecimal(GetColumnValue(49 + offset)); + entity.LastMonthSupplement = ParseDecimal(GetColumnValue(50 + offset)); + entity.ActualSalary = ParseDecimal(GetColumnValue(51 + offset)); + entity.MonthlyPaymentStatus = GetColumnValue(52 + offset); + entity.PaidAmount = ParseDecimal(GetColumnValue(53 + offset)); + entity.PendingAmount = ParseDecimal(GetColumnValue(54 + offset)); + entity.MonthlyTotalPayment = ParseDecimal(GetColumnValue(55 + offset)); // 处理门店分类(Excel中可能是"A类"、"B类"、"C类") - var storeCategoryStr = GetColumnValue(51 + offset); + var storeCategoryStr = GetColumnValue(56 + offset); if (!string.IsNullOrWhiteSpace(storeCategoryStr)) { if (storeCategoryStr.Contains("A") || storeCategoryStr == "1") entity.StoreCategory = 1; else if (storeCategoryStr.Contains("B") || storeCategoryStr == "2") entity.StoreCategory = 2; else if (storeCategoryStr.Contains("C") || storeCategoryStr == "3") entity.StoreCategory = 3; } - entity.IsNewStore = GetColumnValue(52 + offset) == "是" ? "是" : "否"; - entity.NewStoreProtectionStage = ParseInt(GetColumnValue(53 + offset)); - // 处理锁定状态(第55列,索引54) - var isLockedStr = GetColumnValue(54 + offset); + entity.IsNewStore = GetColumnValue(57 + offset) == "是" ? "是" : "否"; + entity.NewStoreProtectionStage = ParseInt(GetColumnValue(58 + offset)); + // 处理锁定状态(第60列,索引59) + var isLockedStr = GetColumnValue(59 + offset); if (isLockedStr == "已锁定" || isLockedStr == "1") entity.IsLocked = 1; else entity.IsLocked = 0; @@ -1189,7 +1200,7 @@ namespace NCC.Extend if (!string.IsNullOrEmpty(user.Mdid) && string.IsNullOrWhiteSpace(storeName)) entity.StoreId = user.Mdid; } - + if (!string.IsNullOrWhiteSpace(storeName) && string.IsNullOrEmpty(entity.StoreId)) { var store = await _db.Queryable() @@ -1198,7 +1209,7 @@ namespace NCC.Extend } } } - + entity.UpdateTime = DateTime.Now; if (existing != null) recordsToUpdate.Add(entity); else recordsToInsert.Add(entity);