diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/BudgetActuRptQueryPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/BudgetActuRptQueryPlugin.java index 33b4cc4..54bd1a8 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/BudgetActuRptQueryPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/BudgetActuRptQueryPlugin.java @@ -236,7 +236,8 @@ public class BudgetActuRptQueryPlugin extends AbstractReportListDataPlugin { m.put("correspondenceTotal",correspondenceTotal); m.put("totalAmountTotal",totalAmountTotal); countMap.put(year+"a",m); - }else{ + } + else{ Map m = new HashMap<>(); m.put("travelTotal",stringBigDecimalMap.get("travelTotal")); m.put("healthTotal",stringBigDecimalMap.get("healthTotal")); @@ -262,7 +263,6 @@ public class BudgetActuRptQueryPlugin extends AbstractReportListDataPlugin { BigDecimal entertainTotal = BigDecimal.ZERO;//业务招待费 BigDecimal totalAmountTotal = BigDecimal.ZERO;//金额合计 for (Row itemRow : bdMaterialDataSet) { - //TODO 继续补充其他费用类型 //汇总国内差旅费 FYXM0015.001、防疫费 FYXM002-CUS.001 String itemnumber = itemRow.getString("itemnumber"); String happendateStr = dateFormat.format(itemRow.getDate("happendate")); @@ -281,24 +281,44 @@ public class BudgetActuRptQueryPlugin extends AbstractReportListDataPlugin { //统计国内差旅费 er_tripreimbursebill //报销金额(费用项目:差旅报销单-差旅费)没有勾选了“因公临时出国”的差旅报销单报销金额 - //travelRealTotal = travelRealTotal.add(expenseamount); - + DataSet tripreimburseDataSet = getTripreimburseDataSet(userId, year, false); + for (Row itemRow : tripreimburseDataSet) { + //国内差旅费 + BigDecimal orientryamount = itemRow.getBigDecimal("orientryamount"); + travelRealTotal = travelRealTotal.add(orientryamount); + } //统计因公临时出国费 //报销金额(费用报销单报销金额,勾选了“因公临时出国”) er_dailyreimbursebill - //报销金额(差旅报销单报销金额,勾选了“因公临时出国”) er_tripreimbursebill //实际-统计因公临时出国费用报销单数据 DataSet bdMaterialForeignDataSet = getDailyreimbursebillDataSet(userId, year,true); + for (Row itemRow : bdMaterialForeignDataSet) { + //获取因公临时出国报销金额 + BigDecimal expenseamount = itemRow.getBigDecimal("expenseamount"); + abroadTravelTotal = abroadTravelTotal.add(expenseamount); + } + //报销金额(差旅报销单报销金额,勾选了“因公临时出国”) er_tripreimbursebill + DataSet tripreimburseForeignDataSet = getTripreimburseDataSet(userId, year, true); + for (Row itemRow : tripreimburseForeignDataSet) { + //获取因公临时出国报销金额 + BigDecimal orientryamount = itemRow.getBigDecimal("orientryamount"); + abroadTravelTotal = abroadTravelTotal.add(orientryamount); + } Object [] tempRealData = new Object [FIELDS.length]; tempRealData[0] = userId; tempRealData[1] = username; tempRealData[2] = year+"年实际发生"; - tempRealData[3]=travelRealTotal; - tempRealData[4]=healthRealTotal; - BigDecimal totalRealAmount = travelRealTotal.add(healthRealTotal); - tempRealData[9] = totalRealAmount; + tempRealData[3]=travelRealTotal; //国内差旅费 + tempRealData[4]=healthRealTotal; //防疫费 + tempRealData[5]=abroadTravelTotal; //因公临时出国费 + tempRealData[6]=correspondenceTotal; //通信费 + tempRealData[7]=trainingTotal; //培训费 + tempRealData[8]=entertainTotal; //业务招待费 + BigDecimal totalRealAmountTotal = travelRealTotal.add(healthRealTotal).add(abroadTravelTotal) + .add(correspondenceTotal).add(trainingTotal).add(entertainTotal); + tempRealData[9] = totalRealAmountTotal; coll.add(tempRealData); if(countMap.containsKey(year+"b") ){//预算汇总,和实际的区分为:年份+a,例如:2024a @@ -309,7 +329,7 @@ public class BudgetActuRptQueryPlugin extends AbstractReportListDataPlugin { BigDecimal correspondenceTotalMap = m.get("correspondenceTotal"); BigDecimal trainingTotalMap = m.get("trainingTotal"); BigDecimal entertainTotalMap = m.get("entertainTotal"); - BigDecimal totalAmountTotalMap = m.get("totalAmountTotal"); + BigDecimal totalAmountTotalMap = m.get("totalRealAmountTotal"); travelRealTotal = travelTotalMap.add(travelRealTotal); healthRealTotal = healthTotalMap.add(healthRealTotal); @@ -317,7 +337,7 @@ public class BudgetActuRptQueryPlugin extends AbstractReportListDataPlugin { correspondenceTotal = correspondenceTotalMap.add(correspondenceTotal); trainingTotal = trainingTotalMap.add(trainingTotal); entertainTotal= entertainTotalMap.add(entertainTotal); - totalAmountTotal= totalAmountTotalMap.add(totalRealAmount); + totalAmountTotal= totalAmountTotalMap.add(totalRealAmountTotal); m.put("travelTotal",travelRealTotal); m.put("healthTotal",healthRealTotal); @@ -325,7 +345,7 @@ public class BudgetActuRptQueryPlugin extends AbstractReportListDataPlugin { m.put("trainingTotal",trainingTotal); m.put("entertainTotal",entertainTotal); m.put("correspondenceTotal",correspondenceTotal); - m.put("totalAmountTotal",totalAmountTotal); + m.put("totalRealAmountTotal",totalAmountTotal); countMap.put(year+"b",m); }else{ Map m = new HashMap<>(); @@ -335,7 +355,7 @@ public class BudgetActuRptQueryPlugin extends AbstractReportListDataPlugin { m.put("trainingTotal",trainingTotal); m.put("entertainTotal",entertainTotal); m.put("correspondenceTotal",correspondenceTotal); - m.put("totalAmountTotal",totalAmountTotal); + m.put("totalRealAmountTotal",totalRealAmountTotal); countMap.put(year+"b",m); } } @@ -373,7 +393,7 @@ public class BudgetActuRptQueryPlugin extends AbstractReportListDataPlugin { totalRealTempData[6] = stringBigDecimalMapReal.get("correspondenceTotal"); totalRealTempData[7] = stringBigDecimalMapReal.get("trainingTotal"); totalRealTempData[8] = stringBigDecimalMapReal.get("entertainTotal"); - totalRealTempData[9] = stringBigDecimalMapReal.get("totalAmountTotal"); + totalRealTempData[9] = stringBigDecimalMapReal.get("totalRealAmountTotal"); } coll.add(totalRealTempData); } @@ -381,7 +401,7 @@ public class BudgetActuRptQueryPlugin extends AbstractReportListDataPlugin { } /** - * 获取差旅报销单数据 + * 获取费用报销单数据 * @param userId 用户id * @param year 统计年份 * @param isBusinessForeign 是否因公临时出国 @@ -405,6 +425,32 @@ public class BudgetActuRptQueryPlugin extends AbstractReportListDataPlugin { return bdMaterialDataSet; } + /** + * 获取差旅报销单数据 + * @param userId 用户id + * @param year 统计年份 + * @param isBusinessForeign 是否因公临时出国 + * @return 数据集 + */ + private DataSet getTripreimburseDataSet(Long userId, Integer year,Boolean isBusinessForeign) { + LocalDate firstDay = getFirstDayOfYear(year); + LocalDate lastDay = getLastDayOfYear(year); + List searchFilterList = new ArrayList<>(); + //searchFilterList.add(new QFilter(DEV_KEY+"_year", QCP.equals, getFirstDayOfYear(year))); + searchFilterList.add(new QFilter("applier", QCP.equals, userId)); + searchFilterList.add(new QFilter("tripentry.startdate", QCP.large_equals, firstDay)); + searchFilterList.add(new QFilter("tripentry.startdate", QCP.less_equals, lastDay)); + searchFilterList.add(new QFilter(DEV_KEY+"_is_business_foreign", QCP.equals, isBusinessForeign)); + + DataSet bdMaterialDataSet = QueryServiceHelper.queryDataSet( + this.getClass().getName(), + "er_tripreimbursebill", + "id,applier,tripentry.startdate as startdate,tripentry.entryentity.orientryamount as orientryamount" , + searchFilterList.toArray(new QFilter [] {}), null + ).orderBy(new String[]{"applier", "startdate"}); + return bdMaterialDataSet; + } + // 获取某年份的第一天 public static LocalDate getFirstDayOfYear(int year) { return LocalDate.of(year, 1, 1);