职务消费台账功能调整

This commit is contained in:
zhangzhiguo 2024-12-20 18:00:32 +08:00
parent 108b3ebbfd
commit 605eecdcb3
2 changed files with 128 additions and 55 deletions

View File

@ -68,13 +68,32 @@ public class PositionFeesRptListPlugin extends AbstractReportFormPlugin implemen
@Override
public void setCellStyleRules(List<CellStyleRule> cellStyleRules) {
String[] FIELDS = {
DEV_KEY+"_user", DEV_KEY+"_username", DEV_KEY+"_date",DEV_KEY+"_bill_number",
DEV_KEY+"_serve_business", DEV_KEY+"_serve_outside",DEV_KEY+"_serve_significant",
DEV_KEY+"_serve_other_business",DEV_KEY+"_serve_lodging",
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"
};
for (String field : FIELDS) {
CellStyleRule cellStyleRuleUser = new CellStyleRule();
cellStyleRuleUser.setFieldKey(field);// 字段标识
cellStyleRuleUser.setForeColor("#666666");// 前景色
cellStyleRuleUser.setBackgroundColor("#FFE5CC");// 背景色
cellStyleRuleUser.setDegree(100);// 透明度
cellStyleRuleUser.setCondition("zcgj_username = '人员合计'");// 前置条件值与表达式计算器一致
cellStyleRules.add(cellStyleRuleUser);
CellStyleRule cellStyleRule = new CellStyleRule();
cellStyleRule.setFieldKey(field);// 字段标识
cellStyleRule.setForeColor("#666666");// 前景色
cellStyleRule.setBackgroundColor("#ffc000");// 背景色
cellStyleRule.setDegree(100);// 透明度
cellStyleRule.setCondition("shxr_username = '合计'");// 前置条件值与表达式计算器一致
cellStyleRule.setCondition("zcgj_username = '合计'");// 前置条件值与表达式计算器一致
cellStyleRules.add(cellStyleRule);
}

View File

@ -90,7 +90,16 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin {
DataType.BigDecimalType,DataType.BigDecimalType,DataType.BigDecimalType,
DataType.BigDecimalType
};
Set<String> itemSet = new HashSet<>();
itemSet.add(FYF);
itemSet.add(TXF);
itemSet.add(PXF);
itemSet.add(YWZD_SWZD);
itemSet.add(YWZD_WSZD);
itemSet.add(YWZD_ZYGW);
itemSet.add(YWZD_ZS);
itemSet.add(YWZD_JNP);
itemSet.add(YWZD_QT);
// 初始化 DataSet
RowMeta rowMeta = RowMetaFactory.createRowMeta(FIELDS, DATATYPES);
Collection<Object[]> coll = new ArrayList<>();
@ -130,6 +139,9 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin {
}
Date happendate = entry.getDate("happendate");//费用发生日期
String itemNumber = expenseitemObj.getString("number");//费用项目编码
if(!itemSet.contains(itemNumber)){
continue;
}
String happendateStr = dateFormat.format(happendate);//费用发生日期str
BigDecimal expenseamount = BigDecimal.ZERO;
if(istax){
@ -247,13 +259,25 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin {
for (Long userId : userSet) {
for (String string : strings) {
if(string.startsWith(userId+"")){
// userIdDataMap.put(userId,reportMap.get(string));
if(userIdDataMap.containsKey(userId)){
Map<String, ExpenseReport> stringExpenseReportMap = userIdDataMap.get(userId);
stringExpenseReportMap.put(string,reportMap.get(string));
//userIdDataMap.put(userId,stringExpenseReportMap);
}else{
Map<String, ExpenseReport> data= new HashMap<>();
data.put(string,reportMap.get(string));
userIdDataMap.put(userId,data);
}
}
}
}
ArrayList<ExpenseReport> reportsList = new ArrayList<>(reportMap.values());
// 打印每一行报表
for (Long userId : userIdDataMap.keySet()) {
Map<String, ExpenseReport> stringExpenseReportMap = userIdDataMap.get(userId);
ArrayList<ExpenseReport> reportsList = new ArrayList<>(stringExpenseReportMap.values());
ExpenseReport userTotalReport = new ExpenseReport(null, null, null);
// 打印每一行报表
for (ExpenseReport report : reportsList) {
Map<String, Object> userInfoByID = UserServiceHelper.getUserInfoByID(report.getReimburser());
String username = String.valueOf(userInfoByID.get("name"));//报销人
@ -266,47 +290,77 @@ public class PositionFeesRptQueryPlugin extends AbstractReportListDataPlugin {
tempData[3] = report.getBillNumber();
BigDecimal businessEntertainment = report.getBusinessEntertainment();
totalReport.setBusinessEntertainment(totalReport.getBusinessEntertainment().add(businessEntertainment));
userTotalReport.setBusinessEntertainment(userTotalReport.getBusinessEntertainment().add(businessEntertainment));
tempData[4] = businessEntertainment;
BigDecimal foreignEntertainment = report.getForeignEntertainment();
totalReport.setForeignEntertainment(totalReport.getForeignEntertainment().add(foreignEntertainment));
userTotalReport.setForeignEntertainment(userTotalReport.getForeignEntertainment().add(foreignEntertainment));
tempData[5] = foreignEntertainment;
BigDecimal importantOfficial = report.getImportantOfficial();
totalReport.setImportantOfficial(totalReport.getImportantOfficial().add(importantOfficial));
userTotalReport.setImportantOfficial(userTotalReport.getImportantOfficial().add(importantOfficial));
tempData[6] = importantOfficial;
BigDecimal other = report.getOther();
totalReport.setOther(totalReport.getOther().add(other));
userTotalReport.setOther(userTotalReport.getOther().add(other));
tempData[7] = other;
BigDecimal accommodation = report.getAccommodation();
totalReport.setAccommodation(totalReport.getAccommodation().add(accommodation));
userTotalReport.setAccommodation(userTotalReport.getAccommodation().add(accommodation));
tempData[8] = accommodation;
BigDecimal souvenirs = report.getSouvenirs();
totalReport.setSouvenirs(totalReport.getSouvenirs().add(souvenirs));
userTotalReport.setSouvenirs(userTotalReport.getSouvenirs().add(souvenirs));
tempData[9] = souvenirs;
BigDecimal subtotal = businessEntertainment.add(foreignEntertainment)
.add(importantOfficial).add(other)
.add(accommodation).add(souvenirs);
totalReport.setSubtotal(totalReport.getSubtotal().add(subtotal));
userTotalReport.setSubtotal(userTotalReport.getSubtotal().add(subtotal));
tempData[10] = subtotal;
BigDecimal travel = report.getTravel();
totalReport.setTravel(totalReport.getTravel().add(travel));
userTotalReport.setTravel(userTotalReport.getTravel().add(travel));
tempData[11] = travel;//travel
BigDecimal abroadTravel = report.getAbroadTravel();
totalReport.setAbroadTravel(totalReport.getAbroadTravel().add(abroadTravel));
userTotalReport.setAbroadTravel(userTotalReport.getAbroadTravel().add(abroadTravel));
tempData[12] = abroadTravel;
BigDecimal health = report.getHealth();
totalReport.setHealth(totalReport.getHealth().add(health));
userTotalReport.setHealth(userTotalReport.getHealth().add(health));
tempData[13] = health;
BigDecimal correspondence = report.getCorrespondence();
totalReport.setCorrespondence(totalReport.getCorrespondence().add(correspondence));
userTotalReport.setCorrespondence(userTotalReport.getCorrespondence().add(correspondence));
tempData[14] = correspondence;
BigDecimal training = report.getTraining();
totalReport.setTraining(totalReport.getTraining().add(training));
userTotalReport.setTraining(userTotalReport.getTraining().add(training));
tempData[15] = training;
BigDecimal total = subtotal.add(travel).add(abroadTravel).add(health).add(correspondence).add(training);
totalReport.setTotal(totalReport.getTotal().add(total));
userTotalReport.setTotal(userTotalReport.getTotal().add(total));
tempData[16] = total;
}
Object [] tempDataUserTotal = new Object [FIELDS.length];
coll.add(tempDataUserTotal);
tempDataUserTotal[1] = "人员合计";
tempDataUserTotal[4] = userTotalReport.getBusinessEntertainment();
tempDataUserTotal[5] = userTotalReport.getForeignEntertainment();
tempDataUserTotal[6] = userTotalReport.getImportantOfficial();
tempDataUserTotal[7] = userTotalReport.getOther();
tempDataUserTotal[8] = userTotalReport.getAccommodation();
tempDataUserTotal[9] = userTotalReport.getSouvenirs();
tempDataUserTotal[10] = userTotalReport.getSubtotal();
tempDataUserTotal[11] = userTotalReport.getTravel();
tempDataUserTotal[12] = userTotalReport.getAbroadTravel();
tempDataUserTotal[13] = userTotalReport.getHealth();
tempDataUserTotal[14] = userTotalReport.getCorrespondence();
tempDataUserTotal[15] = userTotalReport.getTraining();
tempDataUserTotal[16] = userTotalReport.getTotal();
}