From ca92a9a7fa7663090638743295981f91e1996d0d Mon Sep 17 00:00:00 2001 From: OathK1per Date: Thu, 4 Aug 2022 17:00:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=80=BB=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/backend/ProjectController.java | 49 + .../java/cn/palmte/work/model/Project.java | 154 +++ .../model/ProjectSettleIncomeRepository.java | 3 + .../work/service/ProjectBudgetService.java | 4 + .../cn/palmte/work/shiro/ShiroConfig.java | 2 +- .../work/utils/excel/ExportExcelUtils.java | 823 ++++++++++++ .../utils/excel/ExportFinalExcelUtils.java | 949 ++++++++++++++ .../utils/excel/ExportSettleExcelUtils.java | 1136 +++++++++++++++++ src/main/resources/application.properties | 2 +- .../templates/admin/project_list.ftl | 5 + 10 files changed, 3125 insertions(+), 2 deletions(-) create mode 100644 src/main/java/cn/palmte/work/utils/excel/ExportExcelUtils.java create mode 100644 src/main/java/cn/palmte/work/utils/excel/ExportFinalExcelUtils.java create mode 100644 src/main/java/cn/palmte/work/utils/excel/ExportSettleExcelUtils.java diff --git a/src/main/java/cn/palmte/work/controller/backend/ProjectController.java b/src/main/java/cn/palmte/work/controller/backend/ProjectController.java index 95917c3..a250688 100644 --- a/src/main/java/cn/palmte/work/controller/backend/ProjectController.java +++ b/src/main/java/cn/palmte/work/controller/backend/ProjectController.java @@ -7,12 +7,14 @@ import cn.palmte.work.service.*; import cn.palmte.work.utils.FreeMarkerUtil; import cn.palmte.work.utils.InterfaceUtil; import cn.palmte.work.utils.Utils; +import cn.palmte.work.utils.excel.ExportExcelUtils; import cn.palmte.work.utils.excel.ExportUtils; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import org.activiti.engine.HistoryService; import org.activiti.engine.history.HistoricProcessInstance; +import org.apache.poi.xssf.usermodel.XSSFSheet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -25,7 +27,9 @@ import org.springframework.web.bind.annotation.*; import top.jfunc.common.db.bean.Page; import top.jfunc.common.utils.CollectionUtil; +import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -44,6 +48,9 @@ public class ProjectController extends BaseController { private static final String PROJECT_ID = "projectId"; private static final String DETAILS = "details"; + private static final int PROJECT_BASE = 19; + private static final int PROJECT_OTHER = 11; + @Autowired private DeptService deptService; @Autowired @@ -115,6 +122,48 @@ public class ProjectController extends BaseController { httpServletResponse.getOutputStream(), (pN, pS) -> projectService.list(searchInfo, pN, pS).getList()); } + /** + * 项目导出 + */ + @RequestMapping("/exportAll") + public void exportAll(HttpServletResponse response, Integer id) throws IOException { + Project project = projectRepository.findOne(id); +// downloadHeader(httpServletResponse, Utils.generateExcelName("项目信息总表"), "application/vnd.ms-excel"); + response.setHeader("Content-Disposition", "attachment;filename=".concat(Utils.generateExcelName("项目信息总表"))); +// response.setHeader("Content-Disposition", "attachment;filename*=UTF-8''" + java.net.URLEncoder.encode("项目信息总表", "UTF-8")); + response.setHeader("Connection", "close"); + response.setHeader("Content-Type", "application/vnd.ms-excel"); + ServletOutputStream outputStream = response.getOutputStream(); + ExportExcelUtils exportExcelUtils = new ExportExcelUtils(); + String[] headers0 = {"部门名称", "项目编号", "项目名称", "项目类型", "项目计划开始时间", "项目计划结束时间", "垫资模式", "项目把握度", "行业场景应用", "客户名称", "终端客户名称", "合同金额", "项目毛利", "项目毛利率", "华智产品金额", "汇智产品金额", "华三产品金额", "其他产品金额", "价值及风险"}; + String[] columns0 = {"deptName", "projectNo", "name", "typeDesc", "startDate", "endDate", "underwrittenModeDesc", "certainty", "industryScenario", "customer", "terminalCustomer", "contractAmount", "grossProfit", "grossProfitMargin", "huazhiProductAmount", "huizhiProductAmount", "huasanProductAmount", "ziguangOtherAmount", "valueRisk"}; + exportExcelUtils.exportProjectExcel(headers0, columns0, project, "yyyy-MM-dd", 0, "项目基本信息", outputStream); + String[] headers1 = {"项目负责人", "预计合同签订时间", "项目计划招标时间", "是否二次合作", "签单方式", "项目解决方案", "垫资利息", "垫资峰值", "主合同收款条款", "主合具体解决方案", "计收计划"}; + String[] columns1 = {"principal", "contractTime", "bidsTime", "isSecond", "signType", "resolvePlan", "advanceInterestAmount", "advancePeakAmount", "mainContractCollectionTerms", "mainContractResolvePlan", "calculationCollection"}; + exportExcelUtils.exportProjectExcel(headers1, columns1, project, "yyyy-MM-dd", 0, "项目其他信息", outputStream); + BudgetBean budgetBean = projectBudgetService.getBudget(project); + if (project.getStatus() < 5) { + exportExcelUtils.end(outputStream); + return; + } + List projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project); + CashFlowBean cashFlowBean = projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails); + exportExcelUtils.exportBudgetExcel(budgetBean, cashFlowBean, 0, "项目预算信息", outputStream, project.getOtherName()); + List timeList = projectSettleIncomeRepository.findAllByProjectIdAndGroupByTime(project.getId()); + for (String time : timeList) { + SettleBean settleBean = projectSettleService.getMonthSettle(project, time); + FormerBean formerBean = projectSettleService.getFormerSettle(project, time); + FormerBean currentBean = projectSettleService.getCurrentSettleBytime(project, time); + exportExcelUtils.exportSettleExcel(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, 0, "项目结算信息" + time, outputStream, project.getOtherName()); + } + FinalBean finalBean = projectFinalSevice.getFinal(project); + if (project.getStatus() >= 15) { + FormerBean settleBean = projectSettleService.getCurrentSettle(project, ""); + exportExcelUtils.exportFinalExcel(budgetBean, cashFlowBean, settleBean, finalBean, 0, "项目决算信息", outputStream, project.getOtherName()); + } + exportExcelUtils.end(outputStream); + } + /** * 新增,至项目概算 diff --git a/src/main/java/cn/palmte/work/model/Project.java b/src/main/java/cn/palmte/work/model/Project.java index 07667f6..15092af 100644 --- a/src/main/java/cn/palmte/work/model/Project.java +++ b/src/main/java/cn/palmte/work/model/Project.java @@ -182,6 +182,48 @@ public class Project { @Column(name = "plan_end_str") private String planEndStr; + @Transient + private String underwrittenModeDesc; + + @Transient + private String certainty; + + @Transient + private BigDecimal grossProfit; + + @Transient + private BigDecimal grossProfitMargin; + + @Transient + private BigDecimal huizhiProductAmount; + + @Transient + private BigDecimal huasanProductAmount; + + @Transient + private String principal; + + @Transient + private Date contractTime; + + @Transient + private Date bidsTime; + + @Transient + private String isSecondStr; + + @Transient + private String signTypeStr; + + @Transient + private String resolvePlanStr; + + @Transient + private String mainContractResolvePlan; + + @Transient + private String CalculationCollection; + public int getId() { return id; } @@ -501,4 +543,116 @@ public class Project { public void setPlanEndStr(String planEndStr) { this.planEndStr = planEndStr; } + + public String getUnderwrittenModeDesc() { + return underwrittenModeDesc; + } + + public void setUnderwrittenModeDesc(String underwrittenModeDesc) { + this.underwrittenModeDesc = underwrittenModeDesc; + } + + public String getCertainty() { + return certainty; + } + + public void setCertainty(String certainty) { + this.certainty = certainty; + } + + public BigDecimal getGrossProfit() { + return grossProfit; + } + + public void setGrossProfit(BigDecimal grossProfit) { + this.grossProfit = grossProfit; + } + + public BigDecimal getGrossProfitMargin() { + return grossProfitMargin; + } + + public void setGrossProfitMargin(BigDecimal grossProfitMargin) { + this.grossProfitMargin = grossProfitMargin; + } + + public BigDecimal getHuizhiProductAmount() { + return huizhiProductAmount; + } + + public void setHuizhiProductAmount(BigDecimal huizhiProductAmount) { + this.huizhiProductAmount = huizhiProductAmount; + } + + public BigDecimal getHuasanProductAmount() { + return huasanProductAmount; + } + + public void setHuasanProductAmount(BigDecimal huasanProductAmount) { + this.huasanProductAmount = huasanProductAmount; + } + + public String getPrincipal() { + return principal; + } + + public void setPrincipal(String principal) { + this.principal = principal; + } + + public Date getContractTime() { + return contractTime; + } + + public void setContractTime(Date contractTime) { + this.contractTime = contractTime; + } + + public Date getBidsTime() { + return bidsTime; + } + + public void setBidsTime(Date bidsTime) { + this.bidsTime = bidsTime; + } + + public String getIsSecondStr() { + return isSecondStr; + } + + public void setIsSecondStr(String isSecondStr) { + this.isSecondStr = isSecondStr; + } + + public String getSignTypeStr() { + return signTypeStr; + } + + public void setSignTypeStr(String signTypeStr) { + this.signTypeStr = signTypeStr; + } + + public String getResolvePlanStr() { + return resolvePlanStr; + } + + public void setResolvePlanStr(String resolvePlanStr) { + this.resolvePlanStr = resolvePlanStr; + } + + public String getMainContractResolvePlan() { + return mainContractResolvePlan; + } + + public void setMainContractResolvePlan(String mainContractResolvePlan) { + this.mainContractResolvePlan = mainContractResolvePlan; + } + + public String getCalculationCollection() { + return CalculationCollection; + } + + public void setCalculationCollection(String calculationCollection) { + CalculationCollection = calculationCollection; + } } diff --git a/src/main/java/cn/palmte/work/model/ProjectSettleIncomeRepository.java b/src/main/java/cn/palmte/work/model/ProjectSettleIncomeRepository.java index b9b5ab9..bb198b8 100644 --- a/src/main/java/cn/palmte/work/model/ProjectSettleIncomeRepository.java +++ b/src/main/java/cn/palmte/work/model/ProjectSettleIncomeRepository.java @@ -44,4 +44,7 @@ public interface ProjectSettleIncomeRepository extends JpaRepository findAllByProjectIds(List projectInt); + + @Query(value = "select time from project_settle_income where project_id = ?1 group by time order by time asc", nativeQuery = true) + List findAllByProjectIdAndGroupByTime(int id); } diff --git a/src/main/java/cn/palmte/work/service/ProjectBudgetService.java b/src/main/java/cn/palmte/work/service/ProjectBudgetService.java index 1b682cf..88b167b 100644 --- a/src/main/java/cn/palmte/work/service/ProjectBudgetService.java +++ b/src/main/java/cn/palmte/work/service/ProjectBudgetService.java @@ -847,4 +847,8 @@ public class ProjectBudgetService { //资金计划明细 clearBudgetPlanDetail(p); } + + public void findAll(Project project) { + + } } diff --git a/src/main/java/cn/palmte/work/shiro/ShiroConfig.java b/src/main/java/cn/palmte/work/shiro/ShiroConfig.java index 830e987..bb2a90f 100644 --- a/src/main/java/cn/palmte/work/shiro/ShiroConfig.java +++ b/src/main/java/cn/palmte/work/shiro/ShiroConfig.java @@ -65,7 +65,7 @@ public class ShiroConfig { // 这个参数是cookie的名称,对应前端的checkbox 的name = rememberMe SimpleCookie simpleCookie = new SimpleCookie("rememberMe"); // - simpleCookie.setMaxAge(1800); + simpleCookie.setMaxAge(259200); return simpleCookie; } diff --git a/src/main/java/cn/palmte/work/utils/excel/ExportExcelUtils.java b/src/main/java/cn/palmte/work/utils/excel/ExportExcelUtils.java new file mode 100644 index 0000000..c5d7a0a --- /dev/null +++ b/src/main/java/cn/palmte/work/utils/excel/ExportExcelUtils.java @@ -0,0 +1,823 @@ +package cn.palmte.work.utils.excel; + +import cn.palmte.work.bean.*; +import cn.palmte.work.model.Project; +import cn.palmte.work.utils.DateKit; +import cn.palmte.work.utils.ObjectKit; +import cn.palmte.work.utils.Utils; +import org.apache.poi.hssf.util.HSSFColor; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.streaming.SXSSFSheet; +import org.apache.poi.xssf.streaming.SXSSFWorkbook; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import top.jfunc.common.db.bean.Record; + +import javax.servlet.ServletOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * created by Yuanping Zhang + * 2022/08/01 + */ +public class ExportExcelUtils { + private XSSFWorkbook workbook; + private CellStyle style2; // 内容样式 + private CellStyle style; // 标题样式 + public ExportExcelUtils(){ + workbook = new XSSFWorkbook(); + style = workbook.createCellStyle(); + // 设置这些样式 + style.setFillForegroundColor(HSSFColor.HSSFColorPredefined.WHITE.getIndex()); + style.setFillBackgroundColor(HSSFColor.HSSFColorPredefined.WHITE.getIndex()); + style.setFillPattern(FillPatternType.SOLID_FOREGROUND); + style.setBorderBottom(BorderStyle.THIN); + style.setBorderLeft(BorderStyle.THIN); + style.setBorderRight(BorderStyle.THIN); + style.setBorderTop(BorderStyle.THIN); + style.setAlignment(HorizontalAlignment.CENTER); + // 生成一个字体 + Font font = workbook.createFont(); + font.setBold(false); + // 把字体应用到当前的样式 + style.setFont(font); + + style2 = workbook.createCellStyle(); + style2.setFillForegroundColor(HSSFColor.HSSFColorPredefined.WHITE.getIndex()); + style2.setFillBackgroundColor(HSSFColor.HSSFColorPredefined.WHITE.getIndex()); + style2.setFillPattern(FillPatternType.SOLID_FOREGROUND); + style2.setBorderBottom(BorderStyle.THIN); + style2.setBorderLeft(BorderStyle.THIN); + style2.setBorderRight(BorderStyle.THIN); + style2.setBorderTop(BorderStyle.THIN); + style2.setAlignment(HorizontalAlignment.LEFT); + style2.setVerticalAlignment(VerticalAlignment.CENTER); + // 生成另一个字体 + Font font2 = workbook.createFont(); + font2.setBold(false); + // 把字体应用到当前的样式 + style2.setFont(font2); + +// // 产生表格标题行 +// Row row = sheet.createRow(0); +// for(short i = 0; i < headers.length; i++){ +// Cell cell = row.createCell(i); +// cell.setCellStyle(style); +// cell.setCellType(CellType.STRING); +// cell.setCellValue(headers[i]); +// } + } + + /** + * 项目管理项目基本信息与其他信息工作簿 + * + * @param pattern + * 如果有时间数据,设定输出格式。默认为"yyyy-MM-dd" + * @param rowIndex + * + * @throws IOException + */ + public void exportProjectExcel(String[] headers, String[] columns, Project project, String pattern, int rowIndex, String sheetName, OutputStream outputStream) throws IOException{ + // 遍历集合数据,产生数据行 + int index = rowIndex; + XSSFSheet sheet = workbook.createSheet(sheetName); + sheet.setDefaultColumnWidth((short)20); + Font font3 = workbook.createFont(); + font3.setColor(HSSFColor.HSSFColorPredefined.BLUE.getIndex()); + for (int i = 0; i < columns.length; i++){ + Row row = sheet.createRow(index++); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue(headers[i]); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + Object value = ObjectKit.get(project, columns[i]); + if(value == null){ + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue(""); + }else{ + if(value instanceof Integer){ + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue((int)value); + } else if(value instanceof Long){ + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue((long)value); + } else if(value instanceof Double){ + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue((double)value); + } else if(value instanceof BigDecimal){ + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(((BigDecimal)value))); + } else if(value instanceof Date){ + secondCell.setCellType(CellType.STRING); + String date_str = DateKit.toStr((Date) value, pattern); + secondCell.setCellValue(date_str); + } else{ + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue(value.toString()); + } + } + } + } + + public void exportBudgetExcel(BudgetBean budgetBean, CashFlowBean cashFlowBean, int rowIndex, String sheetName, ServletOutputStream outputStream, String otherName) { + // 遍历集合数据,产生数据行 + int index = rowIndex; + XSSFSheet sheet = workbook.createSheet(sheetName); + sheet.setDefaultColumnWidth((short)20); + Font font3 = workbook.createFont(); + font3.setColor(HSSFColor.HSSFColorPredefined.BLUE.getIndex()); + // 收入 + Row incomeRow = sheet.createRow(index++); + createTitleRow(incomeRow, "收入"); + index = createIncomeRow(budgetBean, sheet, index); + index = index + 3; + // 成本 + Row costRow = sheet.createRow(index++); + createTitleRow(costRow, "成本"); + index = createCostRow(budgetBean, sheet, index, otherName); + index = index + 3; + // 管理 + Row manageRow = sheet.createRow(index++); + createTitleRow(manageRow, "管理"); + index = createManageRow(budgetBean, sheet, index); + index = index + 3; + // 利润率计算 + Row profitRow = sheet.createRow(index++); + createTitleRow(profitRow, "利润率计算"); + index = createProfitRow(budgetBean, sheet, index); + index = index + 3; + // 现金流量表 + Row cashFLowRow = sheet.createRow(index++); + createTitleRow(cashFLowRow, "现金流量表"); + createCashFlowRow(cashFlowBean, sheet, index); + } + + + private void createTitleRow(Row row, String titleName) { + Cell cell = row.createCell(0); + cell.setCellStyle(style); + cell.setCellType(CellType.STRING); + cell.setCellValue(titleName); + } + + private int createIncomeRow(BudgetBean budgetBean, XSSFSheet sheet, int index) { + createSubTitleIncomeRow(sheet, index++); + createDeviceIncomeRow(budgetBean, sheet, index++); + createEngineerIncomeRow(budgetBean, sheet, index++); + createServiceIncomeRow(budgetBean, sheet, index++); + createTotalIncomeRow(budgetBean, sheet, index++); + return index; + } + + private void createSubTitleIncomeRow(XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("类别"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("费用"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("含税金额(元)"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style); + fourthCell.setCellType(CellType.STRING); + fourthCell.setCellValue("不含税金额(元)"); + } + + private void createDeviceIncomeRow(BudgetBean budgetBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("收入"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("设备类"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(budgetBean.getIncomeDeviceTaxInclude())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getIncomeDeviceTaxExclude())); + } + + private void createEngineerIncomeRow(BudgetBean budgetBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("收入"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("工程类"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(budgetBean.getIncomeEngineerTaxInclude())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getIncomeEngineerTaxExclude())); + } + + private void createServiceIncomeRow(BudgetBean budgetBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("收入"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("服务类"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(budgetBean.getIncomeServiceTaxInclude())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getIncomeServiceTaxExclude())); + } + + private void createTotalIncomeRow(BudgetBean budgetBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("合计"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue(""); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(budgetBean.getIncomeTotalTaxInclude())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getIncomeTotalTaxExclude())); + } + + private int createCostRow(BudgetBean budgetBean, XSSFSheet sheet, int index, String otherName) { + createSubTitleCostRow(sheet, index++); + createDeviceCostRow(budgetBean, sheet, index++); + createEngineerCostRow(budgetBean, sheet, index++); + createServiceCostRow(budgetBean, sheet, index++); + createOtherCostRow(budgetBean, sheet, index++); + createManageCostRow(budgetBean, sheet, index++); + createOtherRow(budgetBean, sheet, index++, otherName); + createTotalCostRow(budgetBean, sheet, index++); + return index; + } + + private void createSubTitleCostRow(XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("类别"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("费用"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("费用项目"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style); + fourthCell.setCellType(CellType.STRING); + fourthCell.setCellValue("含税金额(元)"); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style); + fifthCell.setCellType(CellType.STRING); + fifthCell.setCellValue("不含税金额(元)"); + } + + private void createDeviceCostRow(BudgetBean budgetBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("成本"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("采购成本"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("设备"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getCostPurchaseDeviceTaxInclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(budgetBean.getCostPurchaseDeviceTaxExclude())); + } + + private void createEngineerCostRow(BudgetBean budgetBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("成本"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("采购成本"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("施工"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getCostPurchaseBuildTaxInclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(budgetBean.getCostPurchaseBuildTaxExclude())); + } + + private void createServiceCostRow(BudgetBean budgetBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("成本"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("采购成本"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("服务"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getCostPurchaseServiceTaxInclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(budgetBean.getCostPurchaseServiceTaxExclude())); + } + + private void createOtherCostRow(BudgetBean budgetBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("成本"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("采购成本"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("其他"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getCostPurchaseOtherTaxInclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(budgetBean.getCostPurchaseOtherTaxExclude())); + } + + private void createManageCostRow(BudgetBean budgetBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("成本"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("项目管理成本"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("项目管理成本"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getCostProjectManageTaxInclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(budgetBean.getCostProjectManageTaxExclude())); + } + + private void createOtherRow(BudgetBean budgetBean, XSSFSheet sheet, int index, String otherName) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("成本"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("其他"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue(otherName); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getCostOtherOtherTaxInclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(budgetBean.getCostOtherOtherTaxExclude())); + } + + private void createTotalCostRow(BudgetBean budgetBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("合计"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue(""); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue(""); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getCostTotalTaxInclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(budgetBean.getCostTotalTaxExclude())); + } + + private int createManageRow(BudgetBean budgetBean, XSSFSheet sheet, int index) { + createSubTitleManageRow(sheet, index++); + createExpropriationRow(budgetBean, sheet, index++); + createCompanyManageRow(budgetBean, sheet, index++); + return index; + } + + private void createSubTitleManageRow(XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("类别"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("费用项目"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("不含税金额(元)"); + } + + private void createExpropriationRow(BudgetBean budgetBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("财务费用"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("资金占用成本"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(budgetBean.getCostExpropriationTaxExclude())); + } + + private void createCompanyManageRow(BudgetBean budgetBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("公司管理费用"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue(""); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(budgetBean.getCostCompanyManageTaxExclude())); + } + + private int createProfitRow(BudgetBean budgetBean, XSSFSheet sheet, int index) { + createSubTitleProfitRow(sheet, index++); + createGrossProfitRow(budgetBean, sheet, index++); + createGrossProfitMarginRow(budgetBean, sheet, index++); + createContributionProfitRow(budgetBean, sheet, index++); + createContributionProfitRateRow(budgetBean, sheet, index++); + return index; + } + + private void createSubTitleProfitRow(XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("类别"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue(""); + } + + private void createGrossProfitRow(BudgetBean budgetBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("项目毛利(元)"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(budgetBean.getProjectGrossProfit())); + } + + private void createGrossProfitMarginRow(BudgetBean budgetBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("项目毛利率(%)"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(budgetBean.getProjectGrossProfitRate())); + } + + private void createContributionProfitRow(BudgetBean budgetBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("项目贡献利润(元)"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(budgetBean.getProjectContributionProfit())); + } + + private void createContributionProfitRateRow(BudgetBean budgetBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("项目贡献利润率(%)"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(budgetBean.getProjectContributionProfitRate())); + } + + + private int createCashFlowRow(CashFlowBean cashFlowBean, XSSFSheet sheet, int index) { + createSubTitleCashFlowRow(sheet, index++); + createSaleIncomeCashRow(cashFlowBean, sheet, index++); + createTaxReturnRow(cashFlowBean, sheet, index++); + createEarnestMoneyIncomeRow(cashFlowBean, sheet, index++); + createPurchaseCostRow(cashFlowBean, sheet, index++); + createTaxCostRow(cashFlowBean, sheet, index++); + createEarnestMoneyCostRow(cashFlowBean, sheet, index++); + createNetCashFlowRow(cashFlowBean, sheet, index++); + createCashInflowFromInvestingActivitiesRow(cashFlowBean, sheet, index++); + createCashOutflowFromInvestingActivitiesRow(cashFlowBean, sheet, index++); + createNetCashFromInvestingActivitiesRow(cashFlowBean, sheet, index++); + createFinancingCapitalInflowRow(cashFlowBean, sheet, index++); + createFinancingCapitalOutflowRow(cashFlowBean, sheet, index++); + createFinancingCapitalCashflowRow(cashFlowBean, sheet, index++); + createNetIncreaseMonetaryFundsRow(cashFlowBean, sheet, index++); + return index; + } + + private void createSubTitleCashFlowRow(XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("类别"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("金额(元)"); + } + + private void createSaleIncomeCashRow(CashFlowBean cashFlowBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("销售商品、提供劳务收到的现金"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getSaleIncomeCash())); + } + + private void createTaxReturnRow(CashFlowBean cashFlowBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("收到的税费返还"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("/"); + } + + private void createEarnestMoneyIncomeRow(CashFlowBean cashFlowBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("收到其他与经营活动有关的现金"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getEarnestMoneyIncome())); + } + + private void createPurchaseCostRow(CashFlowBean cashFlowBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("购买商品、接受劳务支付的现金"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getPurchaseCost())); + } + + private void createTaxCostRow(CashFlowBean cashFlowBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("支付的各项税费"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("/"); + } + + private void createEarnestMoneyCostRow(CashFlowBean cashFlowBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("支付其他与经营活动有关的现金"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getEarnestMoneyCost())); + } + + private void createNetCashFlowRow(CashFlowBean cashFlowBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("经营活动产生的现金流量净额"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getNetCashFlow())); + } + + private void createCashInflowFromInvestingActivitiesRow(CashFlowBean cashFlowBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("投资活动现金流入"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("/"); + } + + private void createCashOutflowFromInvestingActivitiesRow(CashFlowBean cashFlowBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("投资活动现金流出"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("/"); + } + + private void createNetCashFromInvestingActivitiesRow(CashFlowBean cashFlowBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("投资活动产生的现金流量净额"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("/"); + } + + private void createFinancingCapitalInflowRow(CashFlowBean cashFlowBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("融资资金流入"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getFinancingCapitalInflow())); + } + + private void createFinancingCapitalOutflowRow(CashFlowBean cashFlowBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("还款资金流出"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getFinancingCapitalOutflow())); + } + + private void createFinancingCapitalCashflowRow(CashFlowBean cashFlowBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("筹资活动产生的现金流量净额"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getFinancingCapitalCashflow())); + } + + private void createNetIncreaseMonetaryFundsRow(CashFlowBean cashFlowBean, XSSFSheet sheet, int index) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("货币资金净增加额"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getNetIncreaseMonetaryFunds())); + } + + public void exportSettleExcel(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, int rowIndex, String sheetName, ServletOutputStream outputStream, String otherName) { + ExportSettleExcelUtils exportSettleExcelUtils = new ExportSettleExcelUtils(); + exportSettleExcelUtils.exportSettleExcel(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, rowIndex, sheetName, outputStream, otherName, workbook, style, style2); + } + + public void exportFinalExcel(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, int rowIndex, String sheetName, ServletOutputStream outputStream, String otherName) { + ExportFinalExcelUtils exportFinalExcelUtils = new ExportFinalExcelUtils(); + exportFinalExcelUtils.exportFinalExcel(budgetBean, cashFlowBean, settleBean, finalBean, rowIndex, sheetName, outputStream, otherName, workbook, style, style2); + } + + public void end(OutputStream out) throws IOException { + workbook.write(out); + out.flush(); + workbook.close(); + out.close(); + } +} diff --git a/src/main/java/cn/palmte/work/utils/excel/ExportFinalExcelUtils.java b/src/main/java/cn/palmte/work/utils/excel/ExportFinalExcelUtils.java new file mode 100644 index 0000000..a429c07 --- /dev/null +++ b/src/main/java/cn/palmte/work/utils/excel/ExportFinalExcelUtils.java @@ -0,0 +1,949 @@ +package cn.palmte.work.utils.excel; + +import cn.palmte.work.bean.*; +import cn.palmte.work.utils.Utils; +import org.apache.poi.hssf.util.HSSFColor; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import javax.servlet.ServletOutputStream; + +public class ExportFinalExcelUtils { + + public void exportFinalExcel(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, int rowIndex, String sheetName, ServletOutputStream outputStream, String otherName, XSSFWorkbook workbook, CellStyle style, CellStyle style2) { + // 遍历集合数据,产生数据行 + int index = rowIndex; + XSSFSheet sheet = workbook.createSheet(sheetName); + sheet.setDefaultColumnWidth((short)20); + Font font3 = workbook.createFont(); + font3.setColor(HSSFColor.HSSFColorPredefined.BLUE.getIndex()); + // 收入 + Row incomeRow = sheet.createRow(index++); + createTitleRow(incomeRow, "收入", style); + index = createIncomeRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index, style, style2); + index = index + 3; + // 成本 + Row costRow = sheet.createRow(index++); + createTitleRow(costRow, "成本", style); + index = createCostRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index, otherName, style, style2); + index = index + 3; + // 管理 + Row manageRow = sheet.createRow(index++); + createTitleRow(manageRow, "管理", style); + index = createManageRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index, style, style2); + index = index + 3; + // 利润率计算 + Row profitRow = sheet.createRow(index++); + createTitleRow(profitRow, "利润率计算", style); + index = createProfitRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index, style, style2); + index = index + 3; + // 现金流量表 + Row cashFLowRow = sheet.createRow(index++); + createTitleRow(cashFLowRow, "现金流量表", style); + createCashFlowRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index, style, style2); + } + + + private void createTitleRow(Row row, String titleName, CellStyle style) { + Cell cell = row.createCell(0); + cell.setCellStyle(style); + cell.setCellType(CellType.STRING); + cell.setCellValue(titleName); + } + + private int createIncomeRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style, CellStyle style2) { + createSubTitleIncomeRow(sheet, index++, style); + createDeviceIncomeRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createEngineerIncomeRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createServiceIncomeRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createTotalIncomeRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + return index; + } + + private void createSubTitleIncomeRow(XSSFSheet sheet, int index, CellStyle style) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("类别"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("费用"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("预算总额(元)"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style); + fourthCell.setCellType(CellType.STRING); + fourthCell.setCellValue("结算总额(元)"); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style); + fifthCell.setCellType(CellType.STRING); + fifthCell.setCellValue("决算总额(元)"); + } + + private void createDeviceIncomeRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("收入"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("设备类"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(budgetBean.getIncomeDeviceTaxExclude())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getIncomeDeviceTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(finalBean.getIncomeDeviceFinalTotal())); + } + + private void createEngineerIncomeRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("收入"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("工程类"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(budgetBean.getIncomeEngineerTaxExclude())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getIncomeEngineerTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(finalBean.getIncomeEngineerFinalTotal())); + } + + private void createServiceIncomeRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("收入"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("服务类"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(budgetBean.getIncomeServiceTaxExclude())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getIncomeServiceTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(finalBean.getIncomeServiceFinalTotal())); + } + + private void createTotalIncomeRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("合计"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue(""); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(budgetBean.getIncomeTotalTaxExclude())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getIncomeTotalTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(finalBean.getIncomeTotal())); + } + + private int createCostRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, String otherName, CellStyle style, CellStyle style2) { + createSubTitleCostRow(sheet, index++, style); + createDeviceCostRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createEngineerCostRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createServiceCostRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createOtherCostRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createManageCostRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createOtherRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, otherName, style2); + createTotalCostRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + return index; + } + + private void createSubTitleCostRow(XSSFSheet sheet, int index, CellStyle style) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("类别"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("费用"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("费用项目"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style); + fourthCell.setCellType(CellType.STRING); + fourthCell.setCellValue("预算总额(元)"); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style); + fifthCell.setCellType(CellType.STRING); + fifthCell.setCellValue("结算总额(元)"); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style); + sixthCell.setCellType(CellType.STRING); + sixthCell.setCellValue("决算总额(元)"); + } + + private void createDeviceCostRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("成本"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("采购成本"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("设备"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getCostPurchaseDeviceTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(settleBean.getCostPurchaseDeviceTaxExclude())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); + sixthCell.setCellValue(Utils.format(finalBean.getCostPurchaseDeviceFinalTotal())); + } + + private void createEngineerCostRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("成本"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("采购成本"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("施工"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getCostPurchaseBuildTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(settleBean.getCostPurchaseBuildTaxExclude())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); + sixthCell.setCellValue(Utils.format(finalBean.getCostPurchaseBuildFinalTotal())); + } + + private void createServiceCostRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("成本"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("采购成本"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("服务"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getCostPurchaseServiceTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(settleBean.getCostPurchaseServiceTaxExclude())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); + sixthCell.setCellValue(Utils.format(finalBean.getCostPurchaseServiceFinalTotal())); + } + + private void createOtherCostRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("成本"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("采购成本"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("其他"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getCostPurchaseOtherTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(settleBean.getCostPurchaseOtherTaxExclude())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); + sixthCell.setCellValue(Utils.format(finalBean.getCostPurchaseOtherFinalTotal())); + } + + private void createManageCostRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("成本"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("项目管理成本"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("项目管理成本"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getCostProjectManageTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(settleBean.getCostProjectManageTaxExclude())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); + sixthCell.setCellValue(Utils.format(finalBean.getCostProjectManageFinalTotal())); + } + + private void createOtherRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, String otherName, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("成本"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("其他"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue(otherName); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getCostOtherOtherTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(settleBean.getCostOtherOtherTaxExclude())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); + sixthCell.setCellValue(Utils.format(finalBean.getCostOtherFinalTotal())); + } + + private void createTotalCostRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("合计"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue(""); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue(""); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getCostTotalTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(settleBean.getCostTotalTaxExclude())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); + sixthCell.setCellValue(Utils.format(finalBean.getCostTotal())); + } + + private int createManageRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style, CellStyle style2) { + createSubTitleManageRow(sheet, index++, style); + createExpropriationRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createCompanyManageRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createCostIncomeTaxRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + return index; + } + + private void createSubTitleManageRow(XSSFSheet sheet, int index, CellStyle style) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("类别"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("费用项目"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("预算总额(元)"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style); + fourthCell.setCellType(CellType.STRING); + fourthCell.setCellValue("结算总额(元)"); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style); + fifthCell.setCellType(CellType.STRING); + fifthCell.setCellValue("决算总额(元)"); + } + + private void createExpropriationRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("财务费用"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("资金占用成本"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(budgetBean.getCostExpropriationTaxExclude())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getCostExpropriationTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(finalBean.getCostExpropriationFinalTotal())); + } + + private void createCompanyManageRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("公司管理费用"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue(""); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(budgetBean.getCostCompanyManageTaxExclude())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getCostCompanyManageTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(finalBean.getCostCompanyManageFinalTotal())); + } + + private void createCostIncomeTaxRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("所得税费用"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue(""); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("/"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getCostIncomeTax())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(finalBean.getCostIncomeTaxFinalTotal())); + } + + private int createProfitRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style, CellStyle style2) { + createSubTitleProfitRow(sheet, index++, style); + createGrossProfitRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); +// createGrossProfitMarginRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createContributionProfitRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); +// createContributionProfitRateRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createNetProfitRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + return index; + } + + private void createSubTitleProfitRow(XSSFSheet sheet, int index, CellStyle style) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("类别"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("预算总额(元)"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("结算总额(元)"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style); + fourthCell.setCellType(CellType.STRING); + fourthCell.setCellValue("决算总额(元)"); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style); + fifthCell.setCellType(CellType.STRING); + fifthCell.setCellValue("利润率(%)"); + } + + private void createGrossProfitRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("项目毛利"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(budgetBean.getProjectGrossProfit())); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(settleBean.getProjectGrossProfit())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(finalBean.getGrossProfitFinalTotal())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(finalBean.getGrossProfitProfitMargin())); + } + + private void createContributionProfitRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("项目贡献利润"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(budgetBean.getProjectContributionProfit())); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(settleBean.getProjectContributionProfit())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(finalBean.getContributionMarginFinalTotal())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(finalBean.getContributionMarginProfitMargin())); + } + + private void createNetProfitRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("项目净利润"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("/"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(settleBean.getNetProfit())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(finalBean.getNetMarginFinalTotal())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(finalBean.getNetMarginProfitMargin())); + } + + + private int createCashFlowRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style, CellStyle style2) { + createSubTitleCashFlowRow(sheet, index++, style); + createSaleIncomeCashRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createTaxReturnRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createEarnestMoneyIncomeRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createPurchaseCostRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createTaxCostRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createEarnestMoneyCostRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createNetCashFlowRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createCashInflowFromInvestingActivitiesRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createCashOutflowFromInvestingActivitiesRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createNetCashFromInvestingActivitiesRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createFinancingCapitalInflowRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createFinancingCapitalOutflowRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createFinancingCapitalCashflowRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + createNetIncreaseMonetaryFundsRow(budgetBean, cashFlowBean, settleBean, finalBean, sheet, index++, style2); + return index; + } + + private void createSubTitleCashFlowRow(XSSFSheet sheet, int index, CellStyle style) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("类别"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("预算总额(元)"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("结算总额(元)"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style); + fourthCell.setCellType(CellType.STRING); + fourthCell.setCellValue("决算总额(元)"); + } + + private void createSaleIncomeCashRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("销售商品、提供劳务收到的现金"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getSaleIncomeCash())); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(settleBean.getSaleIncomeCash())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(finalBean.getSaleIncomeCash())); + } + + private void createTaxReturnRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("收到的税费返还"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("/"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(settleBean.getTaxReturn())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(finalBean.getTaxReturn())); + } + + private void createEarnestMoneyIncomeRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("收到其他与经营活动有关的现金"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getEarnestMoneyIncome())); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(settleBean.getEarnestMoneyIncome())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(finalBean.getEarnestMoneyIncome())); + } + + private void createPurchaseCostRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("购买商品、接受劳务支付的现金"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getPurchaseCost())); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(settleBean.getPurchaseCost())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(finalBean.getPurchaseCost())); + } + + private void createTaxCostRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("支付的各项税费"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("/"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(settleBean.getTaxCost())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(finalBean.getTaxCost())); + } + + private void createEarnestMoneyCostRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("支付其他与经营活动有关的现金"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getEarnestMoneyCost())); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(settleBean.getEarnestMoneyCost())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(finalBean.getEarnestMoneyCost())); + } + + private void createNetCashFlowRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("经营活动产生的现金流量净额"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getNetCashFlow())); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(settleBean.getNetCashFlow())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(finalBean.getNetCashFlow())); + } + + private void createCashInflowFromInvestingActivitiesRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("投资活动现金流入"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("/"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(settleBean.getCashInflowFromInvestingActivities())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(finalBean.getCashInflowFromInvestingActivities())); + } + + private void createCashOutflowFromInvestingActivitiesRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("投资活动现金流出"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("/"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(settleBean.getCashOutflowFromInvestingActivities())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(finalBean.getCashOutflowFromInvestingActivities())); + } + + private void createNetCashFromInvestingActivitiesRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("投资活动产生的现金流量净额"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("/"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(settleBean.getNetCashFromInvestingActivities())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(finalBean.getNetCashFromInvestingActivities())); + } + + private void createFinancingCapitalInflowRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("融资资金流入"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getFinancingCapitalInflow())); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(settleBean.getFinancingCapitalInflow())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(finalBean.getFinancingCapitalInflow())); + } + + private void createFinancingCapitalOutflowRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("还款资金流出"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getFinancingCapitalOutflow())); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(settleBean.getFinancingCapitalOutflow())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(finalBean.getFinancingCapitalOutflow())); + } + + private void createFinancingCapitalCashflowRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("筹资活动产生的现金流量净额"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getFinancingCapitalCashflow())); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(settleBean.getFinancingCapitalCashflow())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(finalBean.getFinancingCapitalCashflow())); + } + + private void createNetIncreaseMonetaryFundsRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean settleBean, FinalBean finalBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("货币资金净增加额"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getNetIncreaseMonetaryFunds())); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(settleBean.getNetIncreaseMonetaryFunds())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(finalBean.getNetIncreaseMonetaryFunds())); + } +} diff --git a/src/main/java/cn/palmte/work/utils/excel/ExportSettleExcelUtils.java b/src/main/java/cn/palmte/work/utils/excel/ExportSettleExcelUtils.java new file mode 100644 index 0000000..b32cb97 --- /dev/null +++ b/src/main/java/cn/palmte/work/utils/excel/ExportSettleExcelUtils.java @@ -0,0 +1,1136 @@ +package cn.palmte.work.utils.excel; + +import cn.palmte.work.bean.BudgetBean; +import cn.palmte.work.bean.CashFlowBean; +import cn.palmte.work.bean.FormerBean; +import cn.palmte.work.bean.SettleBean; +import cn.palmte.work.utils.Utils; +import org.apache.poi.hssf.util.HSSFColor; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import javax.servlet.ServletOutputStream; +import java.math.BigDecimal; + +public class ExportSettleExcelUtils { + + public void exportSettleExcel(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, int rowIndex, String sheetName, ServletOutputStream outputStream, String otherName, XSSFWorkbook workbook, CellStyle style, CellStyle style2) { + // 遍历集合数据,产生数据行 + int index = rowIndex; + XSSFSheet sheet = workbook.createSheet(sheetName); + sheet.setDefaultColumnWidth((short)20); + Font font3 = workbook.createFont(); + font3.setColor(HSSFColor.HSSFColorPredefined.BLUE.getIndex()); + // 收入 + Row incomeRow = sheet.createRow(index++); + createTitleRow(incomeRow, "收入", style); + index = createIncomeRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index, style, style2); + index = index + 3; + // 成本 + Row costRow = sheet.createRow(index++); + createTitleRow(costRow, "成本", style); + index = createCostRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index, otherName, style, style2); + index = index + 3; + // 管理 + Row manageRow = sheet.createRow(index++); + createTitleRow(manageRow, "管理", style); + index = createManageRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index, style, style2); + index = index + 3; + // 利润率计算 + Row profitRow = sheet.createRow(index++); + createTitleRow(profitRow, "利润率计算", style); + index = createProfitRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index, style, style2); + index = index + 3; + // 现金流量表 + Row cashFLowRow = sheet.createRow(index++); + createTitleRow(cashFLowRow, "现金流量表", style); + createCashFlowRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index, style, style2); + } + + + private void createTitleRow(Row row, String titleName, CellStyle style) { + Cell cell = row.createCell(0); + cell.setCellStyle(style); + cell.setCellType(CellType.STRING); + cell.setCellValue(titleName); + } + + private int createIncomeRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style, CellStyle style2) { + createSubTitleIncomeRow(sheet, index++, style); + createDeviceIncomeRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createEngineerIncomeRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createServiceIncomeRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createTotalIncomeRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + return index; + } + + private void createSubTitleIncomeRow(XSSFSheet sheet, int index, CellStyle style) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("类别"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("费用"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("预算总额(元)"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style); + fourthCell.setCellType(CellType.STRING); + fourthCell.setCellValue("上月结算总额(元)"); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style); + fifthCell.setCellType(CellType.STRING); + fifthCell.setCellValue("本月结算金额(元)"); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style); + sixthCell.setCellType(CellType.STRING); + sixthCell.setCellValue("结算总额(元)"); + } + + private void createDeviceIncomeRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("收入"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("设备类"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(budgetBean.getIncomeDeviceTaxExclude())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(formerBean.getIncomeDeviceTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(settleBean.getIncomeDevice())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); + sixthCell.setCellValue(Utils.format(currentBean.getIncomeDeviceTaxExclude())); + } + + private void createEngineerIncomeRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("收入"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("工程类"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(budgetBean.getIncomeEngineerTaxExclude())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(formerBean.getIncomeEngineerTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(settleBean.getIncomeEngineer())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); + sixthCell.setCellValue(Utils.format(currentBean.getIncomeEngineerTaxExclude())); + } + + private void createServiceIncomeRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("收入"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("服务类"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(budgetBean.getIncomeServiceTaxExclude())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(formerBean.getIncomeServiceTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(settleBean.getIncomeService())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); + sixthCell.setCellValue(Utils.format(currentBean.getIncomeServiceTaxExclude())); + } + + private void createTotalIncomeRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("合计"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue(""); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(budgetBean.getIncomeTotalTaxExclude())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(formerBean.getIncomeTotalTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(settleBean.getIncomeTotal())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); + sixthCell.setCellValue(Utils.format(currentBean.getIncomeTotalTaxExclude())); + } + + private int createCostRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, String otherName, CellStyle style, CellStyle style2) { + createSubTitleCostRow(sheet, index++, style); + createDeviceCostRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createEngineerCostRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createServiceCostRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createOtherCostRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createManageCostRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createOtherRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, otherName, style2); + createTotalCostRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + return index; + } + + private void createSubTitleCostRow(XSSFSheet sheet, int index, CellStyle style) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("类别"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("费用"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("费用项目"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style); + fourthCell.setCellType(CellType.STRING); + fourthCell.setCellValue("预算总额(元)"); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style); + fifthCell.setCellType(CellType.STRING); + fifthCell.setCellValue("上月结算总额(元)"); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style); + sixthCell.setCellType(CellType.STRING); + sixthCell.setCellValue("本月结算金额(元)"); + Cell seventhCell = row.createCell(6); + seventhCell.setCellStyle(style); + seventhCell.setCellType(CellType.STRING); + seventhCell.setCellValue("结算总额(元)"); + } + + private void createDeviceCostRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("成本"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("采购成本"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("设备"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getCostPurchaseDeviceTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(formerBean.getCostPurchaseDeviceTaxExclude())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); + sixthCell.setCellValue(Utils.format(settleBean.getCostPurchaseDevice())); + Cell seventhCell = row.createCell(6); + seventhCell.setCellStyle(style2); + seventhCell.setCellType(CellType.NUMERIC); + seventhCell.setCellValue(Utils.format(currentBean.getCostPurchaseDeviceTaxExclude())); + } + + private void createEngineerCostRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("成本"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("采购成本"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("施工"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getCostPurchaseBuildTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(formerBean.getCostPurchaseBuildTaxExclude())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); + sixthCell.setCellValue(Utils.format(settleBean.getCostPurchaseBuild())); + Cell seventhCell = row.createCell(6); + seventhCell.setCellStyle(style2); + seventhCell.setCellType(CellType.NUMERIC); + seventhCell.setCellValue(Utils.format(currentBean.getCostPurchaseBuildTaxExclude())); + } + + private void createServiceCostRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("成本"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("采购成本"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("服务"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getCostPurchaseServiceTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(formerBean.getCostPurchaseServiceTaxExclude())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); + sixthCell.setCellValue(Utils.format(settleBean.getCostPurchaseService())); + Cell seventhCell = row.createCell(6); + seventhCell.setCellStyle(style2); + seventhCell.setCellType(CellType.NUMERIC); + seventhCell.setCellValue(Utils.format(currentBean.getCostPurchaseServiceTaxExclude())); + } + + private void createOtherCostRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("成本"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("采购成本"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("其他"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getCostPurchaseOtherTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(formerBean.getCostPurchaseOtherTaxExclude())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); + sixthCell.setCellValue(Utils.format(settleBean.getCostPurchaseOther())); + Cell seventhCell = row.createCell(6); + seventhCell.setCellStyle(style2); + seventhCell.setCellType(CellType.NUMERIC); + seventhCell.setCellValue(Utils.format(currentBean.getCostPurchaseOtherTaxExclude())); + } + + private void createManageCostRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("成本"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("项目管理成本"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("项目管理成本"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getCostProjectManageTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(formerBean.getCostProjectManageTaxExclude())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); + sixthCell.setCellValue(Utils.format(settleBean.getCostProjectManage())); + Cell seventhCell = row.createCell(6); + seventhCell.setCellStyle(style2); + seventhCell.setCellType(CellType.NUMERIC); + seventhCell.setCellValue(Utils.format(currentBean.getCostProjectManageTaxExclude())); + } + + private void createOtherRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, String otherName, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("成本"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("其他"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue(otherName); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getCostOtherOtherTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(formerBean.getCostOtherOtherTaxExclude())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); + sixthCell.setCellValue(Utils.format(settleBean.getCostOther())); + Cell seventhCell = row.createCell(6); + seventhCell.setCellStyle(style2); + seventhCell.setCellType(CellType.NUMERIC); + seventhCell.setCellValue(Utils.format(currentBean.getCostOtherOtherTaxExclude())); + } + + private void createTotalCostRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("合计"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue(""); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue(""); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(budgetBean.getCostTotalTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(formerBean.getCostTotalTaxExclude())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); + sixthCell.setCellValue(Utils.format(settleBean.getCostTotal())); + Cell seventhCell = row.createCell(6); + seventhCell.setCellStyle(style2); + seventhCell.setCellType(CellType.NUMERIC); + seventhCell.setCellValue(Utils.format(currentBean.getCostTotalTaxExclude())); + } + + private int createManageRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style, CellStyle style2) { + createSubTitleManageRow(sheet, index++, style); + createExpropriationRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createCompanyManageRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createCostIncomeTaxRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + return index; + } + + private void createSubTitleManageRow(XSSFSheet sheet, int index, CellStyle style) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("类别"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("费用项目"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("预算总额(元)"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style); + fourthCell.setCellType(CellType.STRING); + fourthCell.setCellValue("上月结算总额(元)"); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style); + fifthCell.setCellType(CellType.STRING); + fifthCell.setCellValue("本月结算金额(元)"); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style); + sixthCell.setCellType(CellType.STRING); + sixthCell.setCellValue("结算总额(元)"); + } + + private void createExpropriationRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("财务费用"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("资金占用成本"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(budgetBean.getCostExpropriationTaxExclude())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(formerBean.getCostExpropriationTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(settleBean.getCostExpropriation())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); + sixthCell.setCellValue(Utils.format(currentBean.getCostExpropriationTaxExclude())); + } + + private void createCompanyManageRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("公司管理费用"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue(""); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(budgetBean.getCostCompanyManageTaxExclude())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(formerBean.getCostCompanyManageTaxExclude())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(settleBean.getCostCompanyManage())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); + sixthCell.setCellValue(Utils.format(currentBean.getCostCompanyManageTaxExclude())); + } + + private void createCostIncomeTaxRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("所得税费用"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue(""); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("/"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(formerBean.getCostIncomeTax())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(settleBean.getCostIncomeTax())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); + sixthCell.setCellValue(Utils.format(currentBean.getCostIncomeTax())); + } + + private int createProfitRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style, CellStyle style2) { + createSubTitleProfitRow(sheet, index++, style); + createGrossProfitRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); +// createGrossProfitMarginRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createContributionProfitRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); +// createContributionProfitRateRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createNetProfitRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + return index; + } + + private void createSubTitleProfitRow(XSSFSheet sheet, int index, CellStyle style) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("类别"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("预算总额(元)"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("上月结算总额(元)"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style); + fourthCell.setCellType(CellType.STRING); + fourthCell.setCellValue("本月结算金额(元)"); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style); + fifthCell.setCellType(CellType.STRING); + fifthCell.setCellValue("结算总额(元)"); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style); + sixthCell.setCellType(CellType.STRING); + sixthCell.setCellValue("利润率(%)"); + } + + private void createGrossProfitRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("项目毛利"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(budgetBean.getProjectGrossProfit())); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(formerBean.getProjectGrossProfit())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getGrossProfit())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(currentBean.getProjectGrossProfit())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); +// if (currentBean.getIncomeTotalTaxExclude().abs().compareTo(BigDecimal.valueOf(0.01)) > 0) { +// +// } else { +// +// } + sixthCell.setCellValue(Utils.format(currentBean.getGrossProfitMargin())); + } + +// private void createGrossProfitMarginRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { +// Row row = sheet.createRow(index); +// Cell firstCell = row.createCell(0); +// firstCell.setCellStyle(style2); +// firstCell.setCellType(CellType.STRING); +// firstCell.setCellValue("项目毛利率(%)"); +// Cell secondCell = row.createCell(1); +// secondCell.setCellStyle(style2); +// secondCell.setCellType(CellType.NUMERIC); +// secondCell.setCellValue(Utils.format(settleBean.getProjectGrossProfitRate())); +// } + + private void createContributionProfitRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("项目贡献利润"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(budgetBean.getProjectContributionProfit())); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(formerBean.getProjectContributionProfit())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getContributionProfit())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(currentBean.getProjectContributionProfit())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); +// if (currentBean.getIncomeTotalTaxExclude().abs().compareTo(BigDecimal.valueOf(0.01)) > 0) { +// +// } else { +// +// } + sixthCell.setCellValue(Utils.format(currentBean.getContributionProfitMargin())); + } + +// private void createContributionProfitRateRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { +// Row row = sheet.createRow(index); +// Cell firstCell = row.createCell(0); +// firstCell.setCellStyle(style2); +// firstCell.setCellType(CellType.STRING); +// firstCell.setCellValue("项目贡献利润率(%)"); +// Cell secondCell = row.createCell(1); +// secondCell.setCellStyle(style2); +// secondCell.setCellType(CellType.NUMERIC); +// secondCell.setCellValue(Utils.format(settleBean.getProjectContributionProfitRate())); +// } + + private void createNetProfitRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("项目净利润"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("/"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(formerBean.getNetProfit())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getNetProfit())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(currentBean.getNetProfit())); + Cell sixthCell = row.createCell(5); + sixthCell.setCellStyle(style2); + sixthCell.setCellType(CellType.NUMERIC); +// if (currentBean.getIncomeTotalTaxExclude().abs().compareTo(BigDecimal.valueOf(0.01)) > 0) { +// +// } else { +// +// } + sixthCell.setCellValue(Utils.format(currentBean.getNetProfitMargin())); + } + + + private int createCashFlowRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style, CellStyle style2) { + createSubTitleCashFlowRow(sheet, index++, style); + createSaleIncomeCashRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createTaxReturnRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createEarnestMoneyIncomeRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createPurchaseCostRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createTaxCostRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createEarnestMoneyCostRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createNetCashFlowRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createCashInflowFromInvestingActivitiesRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createCashOutflowFromInvestingActivitiesRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createNetCashFromInvestingActivitiesRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createFinancingCapitalInflowRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createFinancingCapitalOutflowRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createFinancingCapitalCashflowRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + createNetIncreaseMonetaryFundsRow(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, sheet, index++, style2); + return index; + } + + private void createSubTitleCashFlowRow(XSSFSheet sheet, int index, CellStyle style) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("类别"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("预算总额(元)"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style); + thirdCell.setCellType(CellType.STRING); + thirdCell.setCellValue("上月结算总额(元)"); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style); + fourthCell.setCellType(CellType.STRING); + fourthCell.setCellValue("本月结算金额(元)"); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style); + fifthCell.setCellType(CellType.STRING); + fifthCell.setCellValue("结算总额(元)"); + } + + private void createSaleIncomeCashRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("销售商品、提供劳务收到的现金"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getSaleIncomeCash())); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(formerBean.getSaleIncomeCash())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getSaleIncomeCash())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(currentBean.getSaleIncomeCash())); + } + + private void createTaxReturnRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("收到的税费返还"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("/"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(formerBean.getTaxReturn())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getTaxReturn())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(currentBean.getTaxReturn())); + } + + private void createEarnestMoneyIncomeRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("收到其他与经营活动有关的现金"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getEarnestMoneyIncome())); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(formerBean.getEarnestMoneyIncome())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getEarnestMoneyIncome())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(currentBean.getEarnestMoneyIncome())); + } + + private void createPurchaseCostRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("购买商品、接受劳务支付的现金"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getPurchaseCost())); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(formerBean.getPurchaseCost())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getPurchaseCost())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(currentBean.getPurchaseCost())); + } + + private void createTaxCostRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("支付的各项税费"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("/"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(formerBean.getTaxCost())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getTaxCost())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(currentBean.getTaxCost())); + } + + private void createEarnestMoneyCostRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("支付其他与经营活动有关的现金"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getEarnestMoneyCost())); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(formerBean.getEarnestMoneyCost())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getEarnestMoneyCost())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(currentBean.getEarnestMoneyCost())); + } + + private void createNetCashFlowRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("经营活动产生的现金流量净额"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getNetCashFlow())); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(formerBean.getNetCashFlow())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getNetCashFlow())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(currentBean.getNetCashFlow())); + } + + private void createCashInflowFromInvestingActivitiesRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("投资活动现金流入"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("/"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(formerBean.getCashInflowFromInvestingActivities())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getCashInflowFromInvestingActivities())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(currentBean.getCashInflowFromInvestingActivities())); + } + + private void createCashOutflowFromInvestingActivitiesRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("投资活动现金流出"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("/"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(formerBean.getCashOutflowFromInvestingActivities())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getCashOutflowFromInvestingActivities())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(currentBean.getCashOutflowFromInvestingActivities())); + } + + private void createNetCashFromInvestingActivitiesRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("投资活动产生的现金流量净额"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.STRING); + secondCell.setCellValue("/"); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(formerBean.getNetCashFromInvestingActivities())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getNetCashFromInvestingActivities())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(currentBean.getNetCashFromInvestingActivities())); + } + + private void createFinancingCapitalInflowRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("融资资金流入"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getFinancingCapitalInflow())); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(formerBean.getFinancingCapitalInflow())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getFinancingCapitalInflow())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(currentBean.getFinancingCapitalInflow())); + } + + private void createFinancingCapitalOutflowRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("还款资金流出"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getFinancingCapitalOutflow())); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(formerBean.getFinancingCapitalOutflow())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getFinancingCapitalOutflow())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(currentBean.getFinancingCapitalOutflow())); + } + + private void createFinancingCapitalCashflowRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("筹资活动产生的现金流量净额"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getFinancingCapitalCashflow())); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(formerBean.getFinancingCapitalCashflow())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getFinancingCapitalCashflow())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(currentBean.getFinancingCapitalCashflow())); + } + + private void createNetIncreaseMonetaryFundsRow(BudgetBean budgetBean, CashFlowBean cashFlowBean, FormerBean formerBean, SettleBean settleBean, FormerBean currentBean, XSSFSheet sheet, int index, CellStyle style2) { + Row row = sheet.createRow(index); + Cell firstCell = row.createCell(0); + firstCell.setCellStyle(style2); + firstCell.setCellType(CellType.STRING); + firstCell.setCellValue("货币资金净增加额"); + Cell secondCell = row.createCell(1); + secondCell.setCellStyle(style2); + secondCell.setCellType(CellType.NUMERIC); + secondCell.setCellValue(Utils.format(cashFlowBean.getNetIncreaseMonetaryFunds())); + Cell thirdCell = row.createCell(2); + thirdCell.setCellStyle(style2); + thirdCell.setCellType(CellType.NUMERIC); + thirdCell.setCellValue(Utils.format(formerBean.getNetIncreaseMonetaryFunds())); + Cell fourthCell = row.createCell(3); + fourthCell.setCellStyle(style2); + fourthCell.setCellType(CellType.NUMERIC); + fourthCell.setCellValue(Utils.format(settleBean.getNetIncreaseMonetaryFunds())); + Cell fifthCell = row.createCell(4); + fifthCell.setCellStyle(style2); + fifthCell.setCellType(CellType.NUMERIC); + fifthCell.setCellValue(Utils.format(currentBean.getNetIncreaseMonetaryFunds())); + } +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 232578e..fb2157e 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,6 +1,6 @@ spring.application.name=fourcal server.port=8282 -server.session.timeout=21600 +server.session.timeout=-1 server.context-path=/fourcal app.version=0.0.1 spring.profiles.active=sit diff --git a/src/main/resources/templates/admin/project_list.ftl b/src/main/resources/templates/admin/project_list.ftl index 276f480..2856616 100644 --- a/src/main/resources/templates/admin/project_list.ftl +++ b/src/main/resources/templates/admin/project_list.ftl @@ -226,6 +226,11 @@ onclick="projectNo(${list.id})">填写项目编号 + + <#--<@shiro.hasPermission name="PROJECT_EDIT">--> <#-- 项目等于概算状态、概算审核为草稿和不通过状态-->