diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/ExpenseReport.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/ExpenseReport.java index 24a5029..375a3e1 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/ExpenseReport.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/ExpenseReport.java @@ -22,11 +22,13 @@ class ExpenseReport { private BigDecimal correspondence = BigDecimal.ZERO;//通信费用 private BigDecimal training = BigDecimal.ZERO;//培训费用 private BigDecimal total = BigDecimal.ZERO;//合计 + private String billType; - public ExpenseReport(Long reimburser, String billNumber, String happenDateStr) { + public ExpenseReport(Long reimburser, String billNumber, String happenDateStr,String billType) { this.reimburser = reimburser; this.billNumber = billNumber; this.happenDateStr = happenDateStr; + this.billType = billType; } public Long getReimburser() { @@ -157,6 +159,14 @@ class ExpenseReport { this.total = total; } + public String getBillType() { + return billType; + } + + public void setBillType(String billType) { + this.billType = billType; + } + public Object[] toRow() { return new Object[]{ this.reimburser, @@ -174,7 +184,8 @@ class ExpenseReport { this.health, this.correspondence, this.training, - this.total + this.total, + this.billType }; } } \ No newline at end of file diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/PositionFeesRptListPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/PositionFeesRptListPlugin.java index d7aa071..fecb28e 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/PositionFeesRptListPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/PositionFeesRptListPlugin.java @@ -1,18 +1,29 @@ package zcgj.zcdev.zcdev.fs.plugin.report; +import kd.bos.bill.BillShowParameter; import kd.bos.context.RequestContext; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.entity.datamodel.IDataModel; import kd.bos.entity.datamodel.events.PackageDataEvent; import kd.bos.entity.report.FilterInfo; +import kd.bos.entity.report.ReportColumn; import kd.bos.entity.report.ReportQueryParam; +import kd.bos.form.FormShowParameter; +import kd.bos.form.ShowType; +import kd.bos.form.StyleCss; +import kd.bos.form.events.HyperLinkClickEvent; +import kd.bos.form.events.HyperLinkClickListener; +import kd.bos.orm.query.QFilter; +import kd.bos.report.ReportList; import kd.bos.report.events.CellStyleRule; import kd.bos.report.events.SortAndFilterEvent; import kd.bos.report.plugin.AbstractReportFormPlugin; +import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.sdk.plugin.Plugin; import zcgj.zcdev.zcdev.fs.utils.OrgCheckUtils; import java.util.Date; +import java.util.EventObject; import java.util.List; /** @@ -21,8 +32,8 @@ import java.util.List; */ public class PositionFeesRptListPlugin extends AbstractReportFormPlugin implements Plugin { - private static final String MERGECOLUM= "shxr_username";//合并单元格字段 - private static final String CONDITION_FIELD="shxr_username";//条件字段 + private static final String MERGECOLUM= "zcgj_username";//合并单元格字段 + private static final String CONDITION_FIELD="zcgj_username";//条件字段 private static final String DEV_KEY="zcgj"; private static final String[] FIELDS = { @@ -36,7 +47,8 @@ public class PositionFeesRptListPlugin extends AbstractReportFormPlugin implemen }; @Override public void setMergeColums(List columns) { - columns.add(MERGECOLUM); + columns.add(DEV_KEY+"_bill_number"); + columns.add(DEV_KEY+"_username"); super.setMergeColums(columns); } @@ -68,6 +80,27 @@ public class PositionFeesRptListPlugin extends AbstractReportFormPlugin implemen @Override public void packageData(PackageDataEvent packageDataEvent) { + ReportColumn c = (ReportColumn)packageDataEvent.getSource(); + if(((DEV_KEY+"_username").equals(c.getFieldKey()) || (DEV_KEY+"_bill_number").equals(c.getFieldKey()))){ + if(packageDataEvent.getFormatValue()!=null && "人员合计".equals(packageDataEvent.getFormatValue().toString())){ + packageDataEvent.getNoMergeKey().add(c.getFieldKey()); + } + } + + /*ReportColumn c = (ReportColumn) packageDataEvent.getSource(); + String fieldKey = c.getFieldKey(); + if (fieldKey.equals(DEV_KEY+"_bill_number")) { + if(packageDataEvent.getFormatValue()!=null){ + String s = packageDataEvent.getFormatValue().toString(); + String condition_prevalue = this.getPageCache().get("rpt_billno"); + if (condition_prevalue == null || condition_prevalue.isEmpty()) { + ; + } else if (!condition_prevalue.equals(s)) { + packageDataEvent.getNoMergeKey().add(DEV_KEY+"_bill_number"); + } + this.getPageCache().put("rpt_billno", s); + } + }*/ super.packageData(packageDataEvent); } @@ -94,18 +127,36 @@ public class PositionFeesRptListPlugin extends AbstractReportFormPlugin implemen super.setCellStyleRules(cellStyleRules); } - /** - * 设置过滤排序列 - * - * @param allColumns 报表列 - */ - /*@Override - public void setSortAndFilter(List allColumns) { - super.setSortAndFilter(allColumns); - for (SortAndFilterEvent ent : allColumns) { - ent.setFilter(true); - ent.setSort(true); - } - }*/ + @Override + public void registerListener(EventObject e) { + //监听报表超链接点击事件 + super.registerListener(e); + ReportList reportList = getControl("reportlistap"); + reportList.addHyperClickListener(new HyperLinkClickListener() { + @Override + public void hyperLinkClick(HyperLinkClickEvent hyperLinkClickEvent) { + String fieldName = hyperLinkClickEvent.getFieldName(); + int rowIndex = hyperLinkClickEvent.getRowIndex(); + if(rowIndex > 0){ + ReportList reportList = getView().getControl("reportlistap"); + DynamicObject rowData = reportList.getReportModel().getRowData(rowIndex); + //row.getString() + if(rowData!=null && rowData.get("zcgj_bill_number") != null){ + String billNo = (String)rowData.get("zcgj_bill_number"); + String billType = (String)rowData.get("zcgj_billtype"); + QFilter filter = new QFilter("billno", "=", billNo); + DynamicObject billData = BusinessDataServiceHelper.loadSingle(billType, "id", new QFilter[]{filter}); + + BillShowParameter billShowParameter= new BillShowParameter();; + billShowParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage); + billShowParameter.setFormId(billType); + billShowParameter.setPkId(billData.get("id")); + getView().showForm(billShowParameter); + + } + } + } + }); + } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/PositionFeesRptQueryPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/PositionFeesRptQueryPlugin.java index e00fd59..17daaa5 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/PositionFeesRptQueryPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/report/PositionFeesRptQueryPlugin.java @@ -79,7 +79,7 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin { DEV_KEY+"_serve_souvenir",DEV_KEY+"_serve_total", DEV_KEY+"_travel",DEV_KEY+"_abroad_travel", DEV_KEY+"_health",DEV_KEY+"_correspondence",DEV_KEY+"_training", - DEV_KEY+"_total" + DEV_KEY+"_total",DEV_KEY+"_billtype" }; DataType[] DATATYPES = { DataType.LongType,DataType.StringType, DataType.StringType,DataType.StringType, @@ -88,7 +88,7 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin { DataType.BigDecimalType,DataType.BigDecimalType, DataType.BigDecimalType,DataType.BigDecimalType, DataType.BigDecimalType,DataType.BigDecimalType,DataType.BigDecimalType, - DataType.BigDecimalType + DataType.BigDecimalType,DataType.StringType }; Set itemSet = new HashSet<>(); itemSet.add(FYF); @@ -134,7 +134,6 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin { for (Long userId : allUsersOfOrg) { //费用报销单数据-费用归属领导数据 DynamicObject[] dailyreimbursebillDataSet = getDailyreimbursebillDataSet(userId, year); - for (DynamicObject dynamicObject : dailyreimbursebillDataSet) { String billno = dynamicObject.getString("billno");//单据编号 //判罚是否因公出国 @@ -170,7 +169,7 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin { // 根据键获取报表对象 ExpenseReport report = reportMap.get(key); if (report == null) { - report = new ExpenseReport(userId, billno, happendateStr); + report = new ExpenseReport(userId, billno, happendateStr,"er_dailyreimbursebill");//费用报销单 reportMap.put(key, report); } if(!isBusinessForeign){ @@ -255,7 +254,7 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin { // 根据键获取报表对象 ExpenseReport report = reportMap.get(key); if (report == null) { - report = new ExpenseReport(userId, billno, happendateStr); + report = new ExpenseReport(userId, billno, happendateStr,"er_publicreimbursebill");//对公报销 reportMap.put(key, report); } // 为该行添加费用 @@ -299,6 +298,7 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin { } } } + //费用报销单申请人查询 if(positionfeesstaffingList != null && positionfeesstaffingList.contains(userId)){ DynamicObject[] dailyreimbursebillDataSetByApplier = getDailyreimbursebillDataSetByApplier(userId, year); @@ -337,7 +337,7 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin { // 根据键获取报表对象 ExpenseReport report = reportMap.get(key); if (report == null) { - report = new ExpenseReport(userId, billno, happendateStr); + report = new ExpenseReport(userId, billno, happendateStr,"er_dailyreimbursebill");//费用报销单 reportMap.put(key, report); } if(!isBusinessForeign){ @@ -413,7 +413,7 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin { // 根据键获取报表对象 ExpenseReport report = reportMap.get(key); if (report == null) { - report = new ExpenseReport(userId, billno, happendateStr); + report = new ExpenseReport(userId, billno, happendateStr,"er_tripreimbursebill"); reportMap.put(key, report); } if(!isBusinessForeign){ @@ -431,7 +431,7 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin { } } //合计汇总 - ExpenseReport totalReport = new ExpenseReport(null, null, null); + ExpenseReport totalReport = new ExpenseReport(null, null, null,null); Set strings = reportMap.keySet(); @@ -456,7 +456,8 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin { for (Long userId : userIdDataMap.keySet()) { Map stringExpenseReportMap = userIdDataMap.get(userId); ArrayList reportsList = new ArrayList<>(stringExpenseReportMap.values()); - ExpenseReport userTotalReport = new ExpenseReport(null, null, null); + sortByBillNumber(reportsList);//增加排序 + ExpenseReport userTotalReport = new ExpenseReport(null, null, null,null); // 打印每一行报表 for (ExpenseReport report : reportsList) { @@ -524,6 +525,7 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin { totalReport.setTotal(totalReport.getTotal().add(total)); userTotalReport.setTotal(userTotalReport.getTotal().add(total)); tempData[16] = total; + tempData[17] = report.getBillType(); } Object [] tempDataUserTotal = new Object [FIELDS.length]; coll.add(tempDataUserTotal); @@ -541,6 +543,7 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin { tempDataUserTotal[14] = userTotalReport.getCorrespondence(); tempDataUserTotal[15] = userTotalReport.getTraining(); tempDataUserTotal[16] = userTotalReport.getTotal(); + tempDataUserTotal[17] = "-"; } @@ -548,6 +551,8 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin { Object [] tempData = new Object [FIELDS.length]; coll.add(tempData); tempData[1] = "合计"; + tempData[2] = "-"; + tempData[3] = "-"; tempData[4] = totalReport.getBusinessEntertainment(); tempData[5] = totalReport.getForeignEntertainment(); tempData[6] = totalReport.getImportantOfficial(); @@ -561,6 +566,7 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin { tempData[14] = totalReport.getCorrespondence(); tempData[15] = totalReport.getTraining(); tempData[16] = totalReport.getTotal(); + tempData[17] = "-"; return resultDataSet; @@ -735,4 +741,12 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin { .toLocalDate(); } + public static void sortByBillNumber(ArrayList list) { + Collections.sort(list, new Comparator() { + @Override + public int compare(ExpenseReport e1, ExpenseReport e2) { + return e1.getBillNumber().compareTo(e2.getBillNumber()); + } + }); + } }