Commit 3a81b600 authored by liyuan.chen's avatar liyuan.chen

对账单修改

parent 989e2f6a
...@@ -76,7 +76,7 @@ public class ConExportServiceImpl implements ConExportService { ...@@ -76,7 +76,7 @@ public class ConExportServiceImpl implements ConExportService {
URL resource = classLoader.getResource("/"); URL resource = classLoader.getResource("/");
String path = resource.getPath(); String path = resource.getPath();
System.out.println(path); System.out.println(path);
bufferImg = ImageIO.read(new File(path +"com/hand/hls/hlcm/cont/img/HonglingNew.jpg")); bufferImg = ImageIO.read(new File(path + "com/hand/hls/hlcm/cont/img/HonglingNew.jpg"));
ImageIO.write(bufferImg, "jpg", byteArrayOut); ImageIO.write(bufferImg, "jpg", byteArrayOut);
} catch (IOException e) { } catch (IOException e) {
...@@ -87,69 +87,69 @@ public class ConExportServiceImpl implements ConExportService { ...@@ -87,69 +87,69 @@ public class ConExportServiceImpl implements ConExportService {
SXSSFDrawing patriarch = sheet.createDrawingPatriarch(); SXSSFDrawing patriarch = sheet.createDrawingPatriarch();
//Drawing patriarch = sheet.createDrawingPatriarch(); //Drawing patriarch = sheet.createDrawingPatriarch();
//anchor主要用于设置图片的属性 //anchor主要用于设置图片的属性
XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 255, 255,(short) 3, 1, (short) 7, 4); XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 255, 255, (short) 3, 0, (short) 7, 3);
anchor.setAnchorType(ClientAnchor.AnchorType.byId(3)); anchor.setAnchorType(ClientAnchor.AnchorType.byId(3));
//插入图片 //插入图片
patriarch.createPicture(anchor, wb.addPicture(byteArrayOut.toByteArray(), HSSFWorkbook.PICTURE_TYPE_JPEG)); patriarch.createPicture(anchor, wb.addPicture(byteArrayOut.toByteArray(), HSSFWorkbook.PICTURE_TYPE_JPEG));
CellRangeAddress regionTitle0 = new CellRangeAddress(0, 3, 0, 9); CellRangeAddress regionTitle0 = new CellRangeAddress(0, 2, 0, 9);
sheet.addMergedRegion(regionTitle0); sheet.addMergedRegion(regionTitle0);
CellStyle header = ExcelFormatUtil.headSytle(wb);// cell样式 CellStyle content = ExcelFormatUtil.contentStyle(wb);// 黑体居左显示
CellStyle content = ExcelFormatUtil.contentStyle(wb);// 报表体样式 CellStyle contentLine = ExcelFormatUtil.contentStyleLine(wb);// 黑体加下边框线显示
CellStyle contentLine = ExcelFormatUtil.contentStyleLine(wb);// 报表体样式 CellStyle contentTable = ExcelFormatUtil.contentTableStyle(wb);// 等线居中加边框显示
CellStyle contentTable = ExcelFormatUtil.contentTableStyle(wb);
// 头部分
CellStyle style1 = wb.createCellStyle();// cell样式
style1.setAlignment(HorizontalAlignment.CENTER );// 设置单元格字体显示居中(左右方向)
style1.setVerticalAlignment(VerticalAlignment.CENTER);
String contentTitle = "96 Ying Chun Road, Pudong New Area Shanghai, China 200127"; String contentTitle = "96 Ying Chun Road, Pudong New Area Shanghai, China 200127";
SXSSFRow rowTitle = sheet.createRow(5); SXSSFRow rowTitle = sheet.createRow(3);
SXSSFCell cellTitle = rowTitle.createCell(3); SXSSFCell cellTitle = rowTitle.createCell(3);
cellTitle.setCellValue(contentTitle); cellTitle.setCellValue(contentTitle);
cellTitle.setCellStyle(style1); cellTitle.setCellStyle(ExcelFormatUtil.contentCenterStyle(wb));// 黑体居中
CellRangeAddress regionTitle = new CellRangeAddress(5, 5, 3, 6); CellRangeAddress regionTitle = new CellRangeAddress(3, 3, 3, 6);
sheet.addMergedRegion(regionTitle); sheet.addMergedRegion(regionTitle);
contentTitle = "中国上海市浦东新区迎春路96号"; contentTitle = "中国上海市浦东新区迎春路96号";
SXSSFRow rowTitle1 = sheet.createRow(6); SXSSFRow rowTitle1 = sheet.createRow(4);
SXSSFCell cellTitle1 = rowTitle1.createCell(4); SXSSFCell cellTitle1 = rowTitle1.createCell(3);
cellTitle1.setCellValue(contentTitle); cellTitle1.setCellValue(contentTitle);
cellTitle1.setCellStyle(style1); cellTitle1.setCellStyle(ExcelFormatUtil.contentCenterStyle(wb));// 黑体居中
CellRangeAddress regionTitle1 = new CellRangeAddress(6, 6, 4, 5); CellRangeAddress regionTitle1 = new CellRangeAddress(4, 4, 3, 6);
sheet.addMergedRegion(regionTitle1); sheet.addMergedRegion(regionTitle1);
contentTitle = "Tel:+86-(0)21-5056-3050\tFax:+86-(0)21-5056-3077"; contentTitle = "Tel:+86-(0)21-5056-3050\tFax:+86-(0)21-5056-3077";
SXSSFRow rowTitle2 = sheet.createRow(7); SXSSFRow rowTitle2 = sheet.createRow(5);
SXSSFCell cellTitle2 = rowTitle2.createCell(3); SXSSFCell cellTitle2 = rowTitle2.createCell(3);
cellTitle2.setCellValue(contentTitle); cellTitle2.setCellValue(contentTitle);
cellTitle2.setCellStyle(style1); cellTitle2.setCellStyle(ExcelFormatUtil.contentCenterStyle(wb));// 黑体居中
CellRangeAddress regionTitle2 = new CellRangeAddress(7, 7, 3, 6); CellRangeAddress regionTitle2 = new CellRangeAddress(5, 5, 3, 6);
sheet.addMergedRegion(regionTitle2); sheet.addMergedRegion(regionTitle2);
SXSSFRow rowTitle3 = sheet.createRow(8); SXSSFRow rowTitle3 = sheet.createRow(6);
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
SXSSFCell cellTitle3 = rowTitle3.createCell(i); SXSSFCell cellTitle3 = rowTitle3.createCell(i);
cellTitle3.setCellValue(""); cellTitle3.setCellValue("");
cellTitle3.setCellStyle(contentLine); cellTitle3.setCellStyle(contentLine);
} }
CellRangeAddress regionTitle3 = new CellRangeAddress(8, 8, 0, 9); CellRangeAddress regionTitle3 = new CellRangeAddress(6, 6, 0, 9);
sheet.addMergedRegion(regionTitle3); sheet.addMergedRegion(regionTitle3);
ExcelFormatUtil.initTitle(sheet, header, "对账单", 9, 0); ExcelFormatUtil.initTitle(sheet, ExcelFormatUtil.headSytle(wb), "对账单", 7, 0);
String contentExcel = "(承租人)"; String contentExcel = "(承租人)" + map.get("BP_NAME");
SXSSFRow rowBpName = sheet.createRow(12); SXSSFRow rowBpName = sheet.createRow(10);
SXSSFCell cellBpName = rowBpName.createCell(0); SXSSFCell cellBpName = rowBpName.createCell(0);
//设置每一列的字段名
cellBpName.setCellValue(contentExcel); cellBpName.setCellValue(contentExcel);
cellBpName.setCellStyle(content); cellBpName.setCellStyle(ExcelFormatUtil.contentBpStyle(wb));// 这部分加粗居左显示
sheet.setColumnWidth(0, 2000);
contentExcel = (String) map.get("BP_NAME") ; /*String bpName = (String) map.get("BP_NAME");
System.out.println(bpName);
SXSSFCell cellBpValue = rowBpName.createCell(1); SXSSFCell cellBpValue = rowBpName.createCell(1);
//设置每一列的字段名 cellBpValue.setCellValue(bpName);
cellBpValue.setCellValue(contentExcel); cellBpValue.setCellStyle(contentLine);*/
cellBpValue.setCellStyle(contentLine);
SXSSFCell cellBpValue1 = rowBpName.createCell(1);
cellBpValue1.setCellValue("");
cellBpValue1.setCellStyle(contentLine);
SXSSFCell cellBpValue2 = rowBpName.createCell(2); SXSSFCell cellBpValue2 = rowBpName.createCell(2);
cellBpValue2.setCellValue(""); cellBpValue2.setCellValue("");
cellBpValue2.setCellStyle(contentLine); cellBpValue2.setCellStyle(contentLine);
...@@ -162,97 +162,96 @@ public class ConExportServiceImpl implements ConExportService { ...@@ -162,97 +162,96 @@ public class ConExportServiceImpl implements ConExportService {
cellBpValue4.setCellValue(":"); cellBpValue4.setCellValue(":");
cellBpValue4.setCellStyle(content); cellBpValue4.setCellStyle(content);
CellRangeAddress region = new CellRangeAddress(12, 12, 1, 3); CellRangeAddress region = new CellRangeAddress(10, 10, 0, 3);
sheet.addMergedRegion(region); sheet.addMergedRegion(region);
contentExcel = "依据您与宏菱融资租赁(上海)有限公司签订的《融资租赁合同》,(合同号:" + contentExcel = " 依据您与宏菱融资租赁(上海)有限公司签订的《融资租赁合同》,(合同号:" +
(String) map.get("CONTRACT_NUMBER") + ";机号:" + (String) map.get("MACHINE_NUMBER") + ")"; map.get("CONTRACT_NUMBER") + ";机号:" + map.get("MACHINE_NUMBER") + ")";
ExcelFormatUtil.initContent(sheet, content, contentExcel, 14, 1); ExcelFormatUtil.initContent(sheet, content, contentExcel, 12, 0);
contentExcel = "我公司已经按约向您交付了租赁物,截止" + contentExcel = "我公司已经按约向您交付了租赁物,截止" +
(String) map.get("TODAY") + ",您已支付我公司以下性质和金额的款项:"; map.get("TODAY") + ",您已支付我公司以下性质和金额的款项:";
ExcelFormatUtil.initContent(sheet, content, contentExcel, 16, 0); ExcelFormatUtil.initContent(sheet, content, contentExcel, 14, 0);
sheet.setColumnWidth(9, 3000);
if (list != null && list.size() > 1) { if (list != null && list.size() > 1) {
//logger.info(">>>>>>>>>>>>>>>>>>>>开始遍历数据组装单元格内容>>>>>>>>>>"); //logger.info(">>>>>>>>>>>>>>>>>>>>开始遍历数据组装单元格内容>>>>>>>>>>");
// 每一列字段名 // 每一列字段名
String[] strs = new String[]{"款项性质", "期次", "约定支付日", "应付金额(人民币)", "实际收款日", "收款金额", "实收违约金", "未收金额"}; String[] strs = new String[]{"款项性质", "期次", "约定支付日", "应付金额", "实际收款日", "收款金额", "实收违约金", "未收金额"};
// 字段名所在表格的宽度 // 字段名所在表格的宽度
int[] ints = new int[]{5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000}; int[] ints = new int[]{2500, 1800, 3000, 3000, 3000, 3000, 3000, 3000};
// 设置表头样式 // 设置表头样式
ExcelFormatUtil.initColumn(sheet, contentTable, strs, ints, 18); ExcelFormatUtil.initColumn(sheet, contentTable, strs, ints, 16);
//logger.info(">>>>>>>>>>>>>>>>>>>>表头样式设置完成>>>>>>>>>>"); //logger.info(">>>>>>>>>>>>>>>>>>>>表头样式设置完成>>>>>>>>>>");
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
LinkedHashMap<String, Object> map1 = (LinkedHashMap<String, Object>) list.get(i); LinkedHashMap<String, Object> map1 = (LinkedHashMap<String, Object>) list.get(i);
SXSSFRow row = sheet.createRow(i + 19); SXSSFRow row = sheet.createRow(i + 17);
int j = 1; int j = 1;
SXSSFCell cell = row.createCell(j++); SXSSFCell cell = row.createCell(j++);
if(map1.get("CF_ITEM_N") != null){ if (map1.get("CF_ITEM_N") != null) {
cell.setCellValue((String) map1.get("CF_ITEM_N")); // 款项性质 cell.setCellValue((String) map1.get("CF_ITEM_N")); // 款项性质
}else{ } else {
cell.setCellValue(""); // 款项性质 cell.setCellValue(""); // 款项性质
} }
cell.setCellStyle(contentTable); cell.setCellStyle(contentTable);
cell = row.createCell(j++); cell = row.createCell(j++);
if(map1.get("TIMES") != null){ if (map1.get("TIMES") != null) {
cell.setCellValue(ExcelFormatUtil.getBigDecimal(map1.get("TIMES")).toString()); // 期次 cell.setCellValue(ExcelFormatUtil.getBigDecimal(map1.get("TIMES")).toString()); // 期次
}else{ } else {
cell.setCellValue(""); // 期次 cell.setCellValue(""); // 期次
} }
cell.setCellStyle(contentTable); cell.setCellStyle(contentTable);
cell = row.createCell(j++); cell = row.createCell(j++);
if(map1.get("DUE_DATE") != null){ if (map1.get("DUE_DATE") != null) {
cell.setCellValue((String) map1.get("DUE_DATE")); // 应付日 cell.setCellValue((String) map1.get("DUE_DATE")); // 应付日
}else{ } else {
cell.setCellValue(""); // 应付日 cell.setCellValue(""); // 应付日
} }
cell.setCellStyle(contentTable); cell.setCellStyle(contentTable);
cell = row.createCell(j++); cell = row.createCell(j++);
if(map1.get("DUE_AMOUNT") != null){ if (map1.get("DUE_AMOUNT") != null) {
cell.setCellValue((String) map1.get("DUE_AMOUNT")); // 应付金额 cell.setCellValue((String) map1.get("DUE_AMOUNT")); // 应付金额
}else{ } else {
cell.setCellValue(""); // 应付金额 cell.setCellValue(""); // 应付金额
} }
cell.setCellStyle(contentTable); cell.setCellStyle(contentTable);
cell = row.createCell(j++); cell = row.createCell(j++);
if(map1.get("TRANSACTION_DATE") != null){ if (map1.get("TRANSACTION_DATE") != null) {
cell.setCellValue((String) map1.get("TRANSACTION_DATE")); // 实际收款日 cell.setCellValue((String) map1.get("TRANSACTION_DATE")); // 实际收款日
}else{ } else {
cell.setCellValue(""); // 实际收款日 cell.setCellValue(""); // 实际收款日
} }
cell.setCellStyle(contentTable); cell.setCellStyle(contentTable);
cell = row.createCell(j++); cell = row.createCell(j++);
if(map1.get("RECEIVED_AMOUNT") != null){ if (map1.get("RECEIVED_AMOUNT") != null) {
cell.setCellValue((String) map1.get("RECEIVED_AMOUNT")); // 收款金额 cell.setCellValue((String) map1.get("RECEIVED_AMOUNT")); // 收款金额
}else{ } else {
cell.setCellValue(""); // 收款金额 cell.setCellValue(""); // 收款金额
} }
cell.setCellStyle(contentTable); cell.setCellStyle(contentTable);
cell = row.createCell(j++); cell = row.createCell(j++);
if(map1.get("RECEIVED_AMOUNT_9") != null){ if (map1.get("RECEIVED_AMOUNT_9") != null) {
cell.setCellValue((String) map1.get("RECEIVED_AMOUNT_9")); // 实收违约金 cell.setCellValue((String) map1.get("RECEIVED_AMOUNT_9")); // 实收违约金
}else{ } else {
cell.setCellValue(""); // 实收违约金 cell.setCellValue(""); // 实收违约金
} }
cell.setCellStyle(contentTable); cell.setCellStyle(contentTable);
cell = row.createCell(j++); cell = row.createCell(j++);
if(map1.get("UNRECEIVED_AMOUNT") != null){ if (map1.get("UNRECEIVED_AMOUNT") != null) {
cell.setCellValue((String) map1.get("UNRECEIVED_AMOUNT")); // 未收金额 cell.setCellValue((String) map1.get("UNRECEIVED_AMOUNT")); // 未收金额
}else{ } else {
cell.setCellValue(""); // 未收金额 cell.setCellValue(""); // 未收金额
} }
cell.setCellStyle(contentTable); cell.setCellStyle(contentTable);
...@@ -261,19 +260,19 @@ public class ConExportServiceImpl implements ConExportService { ...@@ -261,19 +260,19 @@ public class ConExportServiceImpl implements ConExportService {
//logger.info(">>>>>>>>>>>>>>>>>>>>结束遍历数据组装单元格内容>>>>>>>>>>"); //logger.info(">>>>>>>>>>>>>>>>>>>>结束遍历数据组装单元格内容>>>>>>>>>>");
contentExcel = "由于入账处理需要时间,以上还款金额可能未包含最近一次的还款记录。"; contentExcel = "由于入账处理需要时间,以上还款金额可能未包含最近一次的还款记录。";
ExcelFormatUtil.initContent(sheet, content, contentExcel, list.size() + 18 + 2, 1); ExcelFormatUtil.initContent(sheet, content, contentExcel, list.size() + 16 + 2, 1);
contentExcel = "请参考。"; contentExcel = "请参考。";
ExcelFormatUtil.initContent(sheet, content, contentExcel, list.size() + 18 + 4, 1); ExcelFormatUtil.initContent(sheet, content, contentExcel, list.size() + 16 + 4, 1);
contentExcel = "宏菱融资租赁(上海)有限公司"; contentExcel = "宏菱融资租赁(上海)有限公司";
ExcelFormatUtil.initContent(sheet, content, contentExcel, list.size() + 18 + 6, 6); ExcelFormatUtil.initContent(sheet, ExcelFormatUtil.contentCenterStyle(wb), contentExcel, list.size() + 16 + 6, 6);
contentExcel = "(公章)"; contentExcel = "(公章)";
ExcelFormatUtil.initContent(sheet, content, contentExcel, list.size() + 18 + 8, 5); ExcelFormatUtil.initContent(sheet, ExcelFormatUtil.contentCenterStyle(wb), contentExcel, list.size() + 16 + 8, 6);
contentExcel = (String) map.get("TODAY"); contentExcel = (String) map.get("TODAY");
ExcelFormatUtil.initContent(sheet, content, contentExcel, list.size() + 18 + 9, 6); ExcelFormatUtil.initContent(sheet, ExcelFormatUtil.contentCenterStyle(wb), contentExcel, list.size() + 16 + 10, 6);
try { try {
outputResponse(response, wb, "对账单(" + (String) map.get("BP_NAME") + (String) map.get("CONTRACT_NUMBER") + ").xlsx"); outputResponse(response, wb, "对账单(" + (String) map.get("BP_NAME") + (String) map.get("CONTRACT_NUMBER") + ").xlsx");
} catch (Exception e) { } catch (Exception e) {
......
...@@ -19,11 +19,6 @@ import org.apache.poi.xssf.streaming.SXSSFWorkbook; ...@@ -19,11 +19,6 @@ import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
/**
* excle样式工具类
* @author linry
*
*/
public class ExcelFormatUtil { public class ExcelFormatUtil {
/** /**
* 设置报表头样式 * 设置报表头样式
...@@ -31,26 +26,15 @@ public class ExcelFormatUtil { ...@@ -31,26 +26,15 @@ public class ExcelFormatUtil {
* @return * @return
*/ */
public static CellStyle headSytle(SXSSFWorkbook workbook){ public static CellStyle headSytle(SXSSFWorkbook workbook){
// 设置style1的样式,此样式运用在第二行 CellStyle style1 = workbook.createCellStyle();
CellStyle style1 = workbook.createCellStyle();// cell样式 Font font1 = workbook.createFont();
// 设置单元格背景色,设置单元格背景色以下两句必须同时设置
/*style1.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);// 设置填充样式
style1.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);// 设置填充色*/
// 设置单元格上、下、左、右的边框线
/*style1.setBorderBottom(HSSFCellStyle.BORDER_THIN);
style1.setBorderLeft(HSSFCellStyle.BORDER_THIN);
style1.setBorderRight(HSSFCellStyle.BORDER_THIN);
style1.setBorderTop(HSSFCellStyle.BORDER_THIN);*/
Font font1 = workbook.createFont();// 创建一个字体对象
font1.setBold(true); font1.setBold(true);
//font1.setBoldweight((short) 16);// 设置字体的宽度 font1.setFontHeightInPoints((short) 16);
font1.setFontHeightInPoints((short) 16);// 设置字体的高度 font1.setFontName("黑体");
font1.setFontName("等线"); style1.setFont(font1);
//font1.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);// 粗体显示 style1.setWrapText(true);
style1.setFont(font1);// 设置style1的字体 style1.setAlignment(HorizontalAlignment.CENTER);
style1.setWrapText(true);// 设置自动换行 style1.setVerticalAlignment(VerticalAlignment.CENTER);
style1.setAlignment(HorizontalAlignment.CENTER);// 设置单元格字体显示居中(左右方向)
style1.setVerticalAlignment(VerticalAlignment.CENTER);// 设置单元格字体显示居中(上下方向)
return style1; return style1;
} }
/** /**
...@@ -58,89 +42,69 @@ public class ExcelFormatUtil { ...@@ -58,89 +42,69 @@ public class ExcelFormatUtil {
* @param wb * @param wb
* @return * @return
*/ */
// 黑体加粗居左显示
public static CellStyle contentBpStyle(SXSSFWorkbook wb){
CellStyle style1 = wb.createCellStyle();
Font font1 = wb.createFont();
font1.setBold(true);
font1.setFontName("黑体");
style1.setFont(font1);
//style1.setBorderBottom(BorderStyle.THIN);
style1.setWrapText(true);
style1.setAlignment(HorizontalAlignment.LEFT);
style1.setVerticalAlignment(VerticalAlignment.CENTER);
return style1;
}
// 黑体居左显示
public static CellStyle contentStyle(SXSSFWorkbook wb){ public static CellStyle contentStyle(SXSSFWorkbook wb){
// 设置style1的样式,此样式运用在第二行 CellStyle style1 = wb.createCellStyle();
CellStyle style1 = wb.createCellStyle();// cell样式 Font font1 = wb.createFont();
// 设置单元格上、下、左、右的边框线 font1.setFontName("黑体");
/*style1.setBorderBottom(HSSFCellStyle.BORDER_THIN); style1.setFont(font1);
style1.setBorderLeft(HSSFCellStyle.BORDER_THIN); //style1.setWrapText(true);
style1.setBorderRight(HSSFCellStyle.BORDER_THIN); style1.setAlignment(HorizontalAlignment.LEFT);
style1.setBorderTop(HSSFCellStyle.BORDER_THIN);*/ style1.setVerticalAlignment(VerticalAlignment.CENTER);
//style1.setWrapText(true);// 设置自动换行
style1.setAlignment(HorizontalAlignment.LEFT);// 设置单元格字体显示居中(左右方向)
style1.setVerticalAlignment(VerticalAlignment.CENTER);// 设置单元格字体显示居中(上下方向)
return style1; return style1;
} }
// 黑体居中显示
public static CellStyle contentStyleLine(SXSSFWorkbook wb){ public static CellStyle contentCenterStyle(SXSSFWorkbook wb){
// 设置style1的样式,此样式运用在第二行 CellStyle style1 = wb.createCellStyle();
CellStyle style1 = wb.createCellStyle();// cell样式 Font font1 = wb.createFont();
// 设置单元格上、下、左、右的边框线 font1.setFontName("黑体");
style1.setBorderBottom(BorderStyle.THIN); style1.setFont(font1);
/* style1.setBorderBottom(HSSFCellStyle.BORDER_THIN); style1.setWrapText(true);
style1.setBorderLeft(HSSFCellStyle.BORDER_THIN); style1.setAlignment(HorizontalAlignment.CENTER);
style1.setBorderRight(HSSFCellStyle.BORDER_THIN); style1.setVerticalAlignment(VerticalAlignment.CENTER);
style1.setBorderTop(HSSFCellStyle.BORDER_THIN);*/
style1.setWrapText(true);// 设置自动换行
style1.setAlignment(HorizontalAlignment.LEFT);// 设置单元格字体显示居中(左右方向)
style1.setVerticalAlignment(VerticalAlignment.CENTER);// 设置单元格字体显示居中(上下方向)
return style1; return style1;
} }
// 黑体加下边框线显示
public static CellStyle contentTableStyle(SXSSFWorkbook wb){ public static CellStyle contentStyleLine(SXSSFWorkbook wb){
// 设置style1的样式,此样式运用在第二行 CellStyle style1 = wb.createCellStyle();
CellStyle style1 = wb.createCellStyle();// cell样式 Font font1 = wb.createFont();
// 设置单元格上、下、左、右的边框线 font1.setFontName("黑体");
style1.setFont(font1);
style1.setBorderBottom(BorderStyle.THIN); style1.setBorderBottom(BorderStyle.THIN);
style1.setBorderLeft(BorderStyle.THIN); //style1.setWrapText(true);
style1.setBorderRight(BorderStyle.THIN); style1.setAlignment(HorizontalAlignment.LEFT);
style1.setBorderTop(BorderStyle.THIN); style1.setVerticalAlignment(VerticalAlignment.CENTER);
style1.setWrapText(true);// 设置自动换行
style1.setAlignment(HorizontalAlignment.CENTER);// 设置单元格字体显示居中(左右方向)
style1.setVerticalAlignment(VerticalAlignment.CENTER);// 设置单元格字体显示居中(上下方向)
return style1; return style1;
} }
/** // 列表维持原等线字体
* 设置报表标题样式 public static CellStyle contentTableStyle(SXSSFWorkbook wb){
* @param workbook CellStyle style1 = wb.createCellStyle();
* @return Font font1 = wb.createFont();
*/ font1.setFontName("等线");
public static HSSFCellStyle titleSytle(HSSFWorkbook workbook,short color,short fontSize){ style1.setFont(font1);
// 设置style1的样式,此样式运用在第二行
HSSFCellStyle style1 = workbook.createCellStyle();// cell样式
// 设置单元格背景色,设置单元格背景色以下两句必须同时设置
//style1.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);// 设置填充样式
//short fcolor = color;
// 设置单元格上、下、左、右的边框线
style1.setBorderBottom(BorderStyle.THIN); style1.setBorderBottom(BorderStyle.THIN);
style1.setBorderLeft(BorderStyle.THIN); style1.setBorderLeft(BorderStyle.THIN);
style1.setBorderRight(BorderStyle.THIN); style1.setBorderRight(BorderStyle.THIN);
style1.setBorderTop(BorderStyle.THIN); style1.setBorderTop(BorderStyle.THIN);
HSSFFont font1 = workbook.createFont();// 创建一个字体对象 style1.setWrapText(true);
font1.setBold(true); style1.setAlignment(HorizontalAlignment.CENTER);
font1.setFontHeightInPoints(fontSize);// 设置字体的高度 style1.setVerticalAlignment(VerticalAlignment.CENTER);
style1.setFont(font1);// 设置style1的字体
style1.setWrapText(true);// 设置自动换行
style1.setAlignment(HorizontalAlignment.CENTER);// 设置单元格字体显示居中(左右方向)
style1.setVerticalAlignment(VerticalAlignment.CENTER);// 设置单元格字体显示居中(上下方向)
return style1; return style1;
} }
/**
*设置表头
* @param sheet
*/
public static void initTitleEX(SXSSFSheet sheet, CellStyle header,String title[],int titleLength[]) {
SXSSFRow row0 = sheet.createRow(0);
row0.setHeight((short) 800);
for(int j = 0;j<title.length; j++) {
SXSSFCell cell = row0.createCell(j);
//设置每一列的字段名
cell.setCellValue(title[j]);
cell.setCellStyle(header);
sheet.setColumnWidth(j, titleLength[j]);
}
}
/** /**
*设置表头 *设置表头
......
...@@ -140,94 +140,109 @@ ...@@ -140,94 +140,109 @@
Where t1.transaction_date = t2.transaction_date (+) Where t1.transaction_date = t2.transaction_date (+)
And t1.times = t2.times (+) And t1.times = t2.times (+)
Union Union
Select Select nvl(t1.contract_id, t2.contract_id) contract_id,
nvl(t1.contract_id, t2.contract_id) contract_id, nvl(t1.cashflow_id, t2.cashflow_id) cashflow_id,
nvl(t1.cashflow_id, t2.cashflow_id) cashflow_id, nvl(t1.write_off_id, t2.write_off_id) write_off_id,
nvl(t1.write_off_id, t2.write_off_id) write_off_id, nvl(t1.cf_item,
nvl(t1.cf_item, (Select cc2.cf_item
(Select cc2.cf_item From con_contract_cashflow cc2
From con_contract_cashflow cc2 Where cc2.contract_id = t2.contract_id
Where cc2.contract_id = t2.contract_id And cc2.times = t2.times
And cc2.times = t2.times And cc2.cf_item Not In (0, 9)
And cc2.cf_item Not In (0, 9) And cc2.cf_direction = &apos;INFLOW&apos;
And cc2.cf_direction = &apos;INFLOW&apos; And cc2.cf_status = &apos;RELEASE&apos;
And cc2.cf_status = &apos;RELEASE&apos;)) cf_item, And rownum = 1)) cf_item,
nvl(t1.cf_item_n, nvl(t1.cf_item_n,
(Select h.description (Select h.description
From con_contract_cashflow cc2, hls_cashflow_item h From con_contract_cashflow cc2, hls_cashflow_item h
Where cc2.contract_id = t2.contract_id Where cc2.contract_id = t2.contract_id
And cc2.times = t2.times And cc2.times = t2.times
And cc2.cf_item Not In (0, 9) And cc2.cf_item Not In (0, 9)
And cc2.cf_direction = &apos;INFLOW&apos; And cc2.cf_direction = &apos;INFLOW&apos;
And cc2.cf_status = &apos;RELEASE&apos; And cc2.cf_status = &apos;RELEASE&apos;
And h.cf_item = cc2.cf_item)) cf_item_n, And h.cf_item = cc2.cf_item
nvl(t1.times, t2.times) As times, And rownum = 1)) cf_item_n,
nvl(t1.due_date, nvl(t1.times, t2.times) As times,
(Select to_char(cc2.due_date, &apos;yyyy-mm-dd&apos;) nvl(t1.due_date,
From con_contract_cashflow cc2 (Select to_char(cc2.due_date, &apos;yyyy-mm-dd&apos;)
Where cc2.contract_id = t2.contract_id From con_contract_cashflow cc2
And cc2.times = t2.times Where cc2.contract_id = t2.contract_id
And cc2.cf_item Not In (0, 9) And cc2.times = t2.times
And cc2.cf_direction = &apos;INFLOW&apos; And cc2.cf_item Not In (0, 9)
And cc2.cf_status = &apos;RELEASE&apos;)) due_date, And cc2.cf_direction = &apos;INFLOW&apos;
And cc2.cf_status = &apos;RELEASE&apos;
nvl(t1.due_amount, And rownum = 1)) due_date,
(Select cc2.due_amount - nvl(cc2.received_amount, 0) nvl(t1.due_amount,
From con_contract_cashflow cc2 (Select cc2.due_amount
Where cc2.contract_id = t2.contract_id From con_contract_cashflow cc2
And cc2.times = t2.times Where cc2.contract_id = t2.contract_id
And cc2.cf_item Not In (0, 9) And cc2.times = t2.times
And cc2.cf_direction = &apos;INFLOW&apos; And cc2.cf_item Not In (0, 9)
And cc2.cf_status = &apos;RELEASE&apos;)) As due_amount, And cc2.cf_direction = &apos;INFLOW&apos;
And cc2.cf_status = &apos;RELEASE&apos;
And rownum = 1) - nvl((Select nvl(Sum(cc2.received_amount), 0)
From con_contract_cashflow cc2
Where cc2.contract_id = t2.contract_id
And cc2.times = t2.times
And cc2.cf_item Not In (0, 9)
And cc2.cf_direction = &apos;INFLOW&apos;
And cc2.cf_status = &apos;RELEASE&apos;),
0)) As due_amount,
nvl(t1.transaction_date, t2.transaction_date) transaction_date, nvl(t1.transaction_date, t2.transaction_date) transaction_date,
nvl(t1.write_off_date, t2.write_off_date) write_off_date, nvl(t1.write_off_date, t2.write_off_date) write_off_date,
nvl(t1.received_amount, 0) As received_amount, nvl(t1.received_amount, 0) As received_amount,
nvl(t1.unreceived_amount, nvl(t1.unreceived_amount,
(Select cc2.due_amount - nvl(cc2.received_amount, 0) (Select cc2.due_amount
From con_contract_cashflow cc2 From con_contract_cashflow cc2
Where cc2.contract_id = t2.contract_id Where cc2.contract_id = t2.contract_id
And cc2.times = t2.times And cc2.times = t2.times
And cc2.cf_item Not In (0, 9) And cc2.cf_item Not In (0, 9)
And cc2.cf_direction = &apos;INFLOW&apos; And cc2.cf_direction = &apos;INFLOW&apos;
And cc2.cf_status = &apos;RELEASE&apos;)) As unreceived_amount, And cc2.cf_status = &apos;RELEASE&apos;
t2.times As times_9, And rownum = 1) - nvl((Select nvl(Sum(cc2.received_amount), 0)
nvl(t2.due_amount, 0) As due_amount_9, From con_contract_cashflow cc2
nvl(t2.received_amount, 0) As received_amount_9, Where cc2.contract_id = t2.contract_id
nvl(t2.unreceived_amount, 0) As unreceived_amount_9 And cc2.times = t2.times
From (Select And cc2.cf_item Not In (0, 9)
c.contract_id, And cc2.cf_direction = &apos;INFLOW&apos;
And cc2.cf_status = &apos;RELEASE&apos;),
0)) As unreceived_amount,
t2.times As times_9,
nvl(t2.due_amount, 0) As due_amount_9,
nvl(t2.received_amount, 0) As received_amount_9,
nvl(t2.unreceived_amount, 0) As unreceived_amount_9
From (Select c.contract_id,
cwo.cashflow_id, cwo.cashflow_id,
cwo.write_off_id, cwo.write_off_id,
ccc.cf_item, ccc.cf_item,
(Select h.description (Select h.description
From hls_cashflow_item h From hls_cashflow_item h
Where h.cf_item = ccc.cf_item) cf_item_n, Where h.cf_item = ccc.cf_item) cf_item_n,
ccc.times, ccc.times,
to_char(ccc.due_date, &apos;yyyy-mm-dd&apos;) due_date, to_char(ccc.due_date, &apos;yyyy-mm-dd&apos;) due_date,
(ccc.due_amount - (ccc.due_amount -
nvl((Select Sum(tn.write_off_due_amount) nvl((Select Sum(tn.write_off_due_amount)
From csh_write_off tn From csh_write_off tn
Where tn.cashflow_id = cwo.cashflow_id Where tn.cashflow_id = cwo.cashflow_id
And tn.creation_date &lt;= cwo.creation_date), And tn.creation_date &lt;= cwo.creation_date),
0) + cwo.write_off_due_amount) As due_amount, 0) + cwo.write_off_due_amount) As due_amount,
--收款日 --收款日
to_char(t.transaction_date, &apos;yyyy-mm-dd&apos;) transaction_date, to_char(t.transaction_date, &apos;yyyy-mm-dd&apos;) transaction_date,
to_char(cwo.write_off_date, &apos;yyyy-mm-dd&apos;) write_off_date, to_char(cwo.write_off_date, &apos;yyyy-mm-dd&apos;) write_off_date,
--实收金额 --实收金额
cwo.write_off_due_amount received_amount, cwo.write_off_due_amount received_amount,
(ccc.due_amount - (ccc.due_amount -
nvl((Select Sum(tn.write_off_due_amount) nvl((Select Sum(tn.write_off_due_amount)
From csh_write_off tn From csh_write_off tn
Where tn.cashflow_id = cwo.cashflow_id Where tn.cashflow_id = cwo.cashflow_id
And tn.creation_date &lt;= cwo.creation_date), And tn.creation_date &lt;= cwo.creation_date),
0)) As unreceived_amount 0)) As unreceived_amount
From con_contract_cashflow ccc, From con_contract_cashflow ccc,
con_contract c, con_contract c,
hls_bp_master h, hls_bp_master h,
csh_write_off cwo, csh_write_off cwo,
csh_transaction t csh_transaction t
Where cwo.cashflow_id = ccc.cashflow_id Where cwo.cashflow_id = ccc.cashflow_id
And ccc.contract_id = c.contract_id And ccc.contract_id = c.contract_id
And cwo.csh_transaction_id = t.transaction_id And cwo.csh_transaction_id = t.transaction_id
...@@ -241,38 +256,36 @@ ...@@ -241,38 +256,36 @@
ccc.cf_item, ccc.cf_item,
t.transaction_date, t.transaction_date,
cwo.write_off_id) t1, cwo.write_off_id) t1,
(Select (Select c.contract_id,
c.contract_id,
cwo.cashflow_id, cwo.cashflow_id,
cwo.write_off_id, cwo.write_off_id,
ccc.cf_item, ccc.cf_item,
(Select h.description (Select h.description
From hls_cashflow_item h From hls_cashflow_item h
Where h.cf_item = ccc.cf_item) cf_item_n, Where h.cf_item = ccc.cf_item) cf_item_n,
ccc.times, ccc.times,
to_char(ccc.due_date, &apos;yyyy-mm-dd&apos;) due_date, to_char(ccc.due_date, &apos;yyyy-mm-dd&apos;) due_date,
(ccc.due_amount - (ccc.due_amount -
nvl((Select Sum(tn.write_off_due_amount) nvl((Select Sum(tn.write_off_due_amount)
From csh_write_off tn From csh_write_off tn
Where tn.cashflow_id = cwo.cashflow_id Where tn.cashflow_id = cwo.cashflow_id
And tn.creation_date &lt;= cwo.creation_date), And tn.creation_date &lt;= cwo.creation_date),
0) + cwo.write_off_due_amount) As due_amount, 0) + cwo.write_off_due_amount) As due_amount,
--收款日 --收款日
to_char(t.transaction_date, &apos;yyyy-mm-dd&apos;) transaction_date, to_char(t.transaction_date, &apos;yyyy-mm-dd&apos;) transaction_date,
to_char(cwo.write_off_date, &apos;yyyy-mm-dd&apos;) write_off_date, to_char(cwo.write_off_date, &apos;yyyy-mm-dd&apos;) write_off_date,
--实收金额 --实收金额
cwo.write_off_due_amount received_amount, cwo.write_off_due_amount received_amount,
(ccc.due_amount - (ccc.due_amount -
nvl((Select Sum(tn.write_off_due_amount) nvl((Select Sum(tn.write_off_due_amount)
From csh_write_off tn From csh_write_off tn
Where tn.cashflow_id = cwo.cashflow_id Where tn.cashflow_id = cwo.cashflow_id
And tn.creation_date &lt;= cwo.creation_date), And tn.creation_date &lt;= cwo.creation_date),
0)) As unreceived_amount 0)) As unreceived_amount
From con_contract_cashflow ccc, From con_contract_cashflow ccc,
con_contract c, con_contract c,
csh_write_off cwo, csh_write_off cwo,
csh_transaction t csh_transaction t
Where cwo.cashflow_id = ccc.cashflow_id Where cwo.cashflow_id = ccc.cashflow_id
And ccc.contract_id = c.contract_id And ccc.contract_id = c.contract_id
And cwo.csh_transaction_id = t.transaction_id And cwo.csh_transaction_id = t.transaction_id
...@@ -285,8 +298,8 @@ ...@@ -285,8 +298,8 @@
ccc.cf_item, ccc.cf_item,
t.transaction_date, t.transaction_date,
cwo.write_off_id) t2 cwo.write_off_id) t2
Where t1.transaction_date (+) = t2.transaction_date Where t1.transaction_date(+) = t2.transaction_date
And t1.times (+) = t2.times And t1.times(+) = t2.times
Union Union
Select Select
...@@ -462,97 +475,109 @@ ...@@ -462,97 +475,109 @@
Where t1.transaction_date = t2.transaction_date (+) Where t1.transaction_date = t2.transaction_date (+)
And t1.times = t2.times (+) And t1.times = t2.times (+)
Union Union
Select Select nvl(t1.contract_id, t2.contract_id) contract_id,
nvl(t1.contract_id, t2.contract_id) contract_id, nvl(t1.cashflow_id, t2.cashflow_id) cashflow_id,
nvl(t1.cashflow_id, t2.cashflow_id) cashflow_id, nvl(t1.write_off_id, t2.write_off_id) write_off_id,
nvl(t1.write_off_id, t2.write_off_id) write_off_id, nvl(t1.cf_item,
nvl(t1.cf_item, (Select cc2.cf_item
(Select cc2.cf_item From con_contract_cashflow cc2
From con_contract_cashflow cc2 Where cc2.contract_id = t2.contract_id
Where cc2.contract_id = t2.contract_id And cc2.times = t2.times
And cc2.times = t2.times And cc2.cf_item Not In (0, 9)
And cc2.cf_item Not In (0, 9) And cc2.cf_direction = &apos;INFLOW&apos;
And cc2.cf_direction = &apos;INFLOW&apos; And cc2.cf_status = &apos;RELEASE&apos;
And cc2.cf_status = &apos;RELEASE&apos;)) cf_item, And rownum = 1)) cf_item,
nvl(t1.cf_item_n, nvl(t1.cf_item_n,
(Select h.description (Select h.description
From con_contract_cashflow cc2, From con_contract_cashflow cc2, hls_cashflow_item h
hls_cashflow_item h Where cc2.contract_id = t2.contract_id
Where cc2.contract_id = t2.contract_id And cc2.times = t2.times
And cc2.times = t2.times And cc2.cf_item Not In (0, 9)
And cc2.cf_item Not In (0, 9) And cc2.cf_direction = &apos;INFLOW&apos;
And cc2.cf_direction = &apos;INFLOW&apos; And cc2.cf_status = &apos;RELEASE&apos;
And cc2.cf_status = &apos;RELEASE&apos; And h.cf_item = cc2.cf_item
And h.cf_item = cc2.cf_item)) cf_item_n, And rownum = 1)) cf_item_n,
nvl(t1.times, t2.times) As times, nvl(t1.times, t2.times) As times,
nvl(t1.due_date, nvl(t1.due_date,
(Select to_char(cc2.due_date, &apos;yyyy-mm-dd&apos;) (Select to_char(cc2.due_date, &apos;yyyy-mm-dd&apos;)
From con_contract_cashflow cc2 From con_contract_cashflow cc2
Where cc2.contract_id = t2.contract_id Where cc2.contract_id = t2.contract_id
And cc2.times = t2.times And cc2.times = t2.times
And cc2.cf_item Not In (0, 9) And cc2.cf_item Not In (0, 9)
And cc2.cf_direction = &apos;INFLOW&apos; And cc2.cf_direction = &apos;INFLOW&apos;
And cc2.cf_status = &apos;RELEASE&apos;)) due_date, And cc2.cf_status = &apos;RELEASE&apos;
And rownum = 1)) due_date,
nvl(t1.due_amount,
(Select cc2.due_amount
From con_contract_cashflow cc2
Where cc2.contract_id = t2.contract_id
And cc2.times = t2.times
And cc2.cf_item Not In (0, 9)
And cc2.cf_direction = &apos;INFLOW&apos;
And cc2.cf_status = &apos;RELEASE&apos;
And rownum = 1) - nvl((Select nvl(Sum(cc2.received_amount), 0)
From con_contract_cashflow cc2
Where cc2.contract_id = t2.contract_id
And cc2.times = t2.times
And cc2.cf_item Not In (0, 9)
And cc2.cf_direction = &apos;INFLOW&apos;
And cc2.cf_status = &apos;RELEASE&apos;),
0)) As due_amount,
nvl(t1.due_amount, nvl(t1.transaction_date, t2.transaction_date) transaction_date,
(Select cc2.due_amount - nvl(cc2.received_amount, 0) nvl(t1.write_off_date, t2.write_off_date) write_off_date,
From con_contract_cashflow cc2 nvl(t1.received_amount, 0) As received_amount,
Where cc2.contract_id = t2.contract_id nvl(t1.unreceived_amount,
And cc2.times = t2.times (Select cc2.due_amount
And cc2.cf_item Not In (0, 9) From con_contract_cashflow cc2
And cc2.cf_direction = &apos;INFLOW&apos; Where cc2.contract_id = t2.contract_id
And cc2.cf_status = &apos;RELEASE&apos;)) As due_amount, And cc2.times = t2.times
And cc2.cf_item Not In (0, 9)
nvl(t1.transaction_date, t2.transaction_date) transaction_date, And cc2.cf_direction = &apos;INFLOW&apos;
nvl(t1.write_off_date, t2.write_off_date) write_off_date, And cc2.cf_status = &apos;RELEASE&apos;
nvl(t1.received_amount, 0) As received_amount, And rownum = 1) - nvl((Select nvl(Sum(cc2.received_amount), 0)
nvl(t1.unreceived_amount, From con_contract_cashflow cc2
(Select cc2.due_amount - nvl(cc2.received_amount, 0) Where cc2.contract_id = t2.contract_id
From con_contract_cashflow cc2 And cc2.times = t2.times
Where cc2.contract_id = t2.contract_id And cc2.cf_item Not In (0, 9)
And cc2.times = t2.times And cc2.cf_direction = &apos;INFLOW&apos;
And cc2.cf_item Not In (0, 9) And cc2.cf_status = &apos;RELEASE&apos;),
And cc2.cf_direction = &apos;INFLOW&apos; 0)) As unreceived_amount,
And cc2.cf_status = &apos;RELEASE&apos;)) As unreceived_amount, t2.times As times_9,
t2.times As times_9, nvl(t2.due_amount, 0) As due_amount_9,
nvl(t2.due_amount, 0) As due_amount_9, nvl(t2.received_amount, 0) As received_amount_9,
nvl(t2.received_amount, 0) As received_amount_9, nvl(t2.unreceived_amount, 0) As unreceived_amount_9
nvl(t2.unreceived_amount, 0) As unreceived_amount_9 From (Select c.contract_id,
From (Select
c.contract_id,
cwo.cashflow_id, cwo.cashflow_id,
cwo.write_off_id, cwo.write_off_id,
ccc.cf_item, ccc.cf_item,
(Select h.description (Select h.description
From hls_cashflow_item h From hls_cashflow_item h
Where h.cf_item = ccc.cf_item) cf_item_n, Where h.cf_item = ccc.cf_item) cf_item_n,
ccc.times, ccc.times,
to_char(ccc.due_date, &apos;yyyy-mm-dd&apos;) due_date, to_char(ccc.due_date, &apos;yyyy-mm-dd&apos;) due_date,
(ccc.due_amount - (ccc.due_amount -
nvl((Select Sum(tn.write_off_due_amount) nvl((Select Sum(tn.write_off_due_amount)
From csh_write_off tn From csh_write_off tn
Where tn.cashflow_id = cwo.cashflow_id Where tn.cashflow_id = cwo.cashflow_id
And tn.creation_date &lt;= And tn.creation_date &lt;= cwo.creation_date),
cwo.creation_date), 0) + cwo.write_off_due_amount) As due_amount,
0) + cwo.write_off_due_amount) As due_amount,
--收款日 --收款日
to_char(t.transaction_date, &apos;yyyy-mm-dd&apos;) transaction_date, to_char(t.transaction_date, &apos;yyyy-mm-dd&apos;) transaction_date,
to_char(cwo.write_off_date, &apos;yyyy-mm-dd&apos;) write_off_date, to_char(cwo.write_off_date, &apos;yyyy-mm-dd&apos;) write_off_date,
--实收金额 --实收金额
cwo.write_off_due_amount received_amount, cwo.write_off_due_amount received_amount,
(ccc.due_amount - (ccc.due_amount -
nvl((Select Sum(tn.write_off_due_amount) nvl((Select Sum(tn.write_off_due_amount)
From csh_write_off tn From csh_write_off tn
Where tn.cashflow_id = cwo.cashflow_id Where tn.cashflow_id = cwo.cashflow_id
And tn.creation_date &lt;= And tn.creation_date &lt;= cwo.creation_date),
cwo.creation_date), 0)) As unreceived_amount
0)) As unreceived_amount
From con_contract_cashflow ccc, From con_contract_cashflow ccc,
con_contract c, con_contract c,
hls_bp_master h, hls_bp_master h,
csh_write_off cwo, csh_write_off cwo,
csh_transaction t csh_transaction t
Where cwo.cashflow_id = ccc.cashflow_id Where cwo.cashflow_id = ccc.cashflow_id
And ccc.contract_id = c.contract_id And ccc.contract_id = c.contract_id
And cwo.csh_transaction_id = t.transaction_id And cwo.csh_transaction_id = t.transaction_id
...@@ -566,40 +591,36 @@ ...@@ -566,40 +591,36 @@
ccc.cf_item, ccc.cf_item,
t.transaction_date, t.transaction_date,
cwo.write_off_id) t1, cwo.write_off_id) t1,
(Select (Select c.contract_id,
c.contract_id,
cwo.cashflow_id, cwo.cashflow_id,
cwo.write_off_id, cwo.write_off_id,
ccc.cf_item, ccc.cf_item,
(Select h.description (Select h.description
From hls_cashflow_item h From hls_cashflow_item h
Where h.cf_item = ccc.cf_item) cf_item_n, Where h.cf_item = ccc.cf_item) cf_item_n,
ccc.times, ccc.times,
to_char(ccc.due_date, &apos;yyyy-mm-dd&apos;) due_date, to_char(ccc.due_date, &apos;yyyy-mm-dd&apos;) due_date,
(ccc.due_amount - (ccc.due_amount -
nvl((Select Sum(tn.write_off_due_amount) nvl((Select Sum(tn.write_off_due_amount)
From csh_write_off tn From csh_write_off tn
Where tn.cashflow_id = cwo.cashflow_id Where tn.cashflow_id = cwo.cashflow_id
And tn.creation_date &lt;= And tn.creation_date &lt;= cwo.creation_date),
cwo.creation_date), 0) + cwo.write_off_due_amount) As due_amount,
0) + cwo.write_off_due_amount) As due_amount,
--收款日 --收款日
to_char(t.transaction_date, &apos;yyyy-mm-dd&apos;) transaction_date, to_char(t.transaction_date, &apos;yyyy-mm-dd&apos;) transaction_date,
to_char(cwo.write_off_date, &apos;yyyy-mm-dd&apos;) write_off_date, to_char(cwo.write_off_date, &apos;yyyy-mm-dd&apos;) write_off_date,
--实收金额 --实收金额
cwo.write_off_due_amount received_amount, cwo.write_off_due_amount received_amount,
(ccc.due_amount - (ccc.due_amount -
nvl((Select Sum(tn.write_off_due_amount) nvl((Select Sum(tn.write_off_due_amount)
From csh_write_off tn From csh_write_off tn
Where tn.cashflow_id = cwo.cashflow_id Where tn.cashflow_id = cwo.cashflow_id
And tn.creation_date &lt;= And tn.creation_date &lt;= cwo.creation_date),
cwo.creation_date), 0)) As unreceived_amount
0)) As unreceived_amount
From con_contract_cashflow ccc, From con_contract_cashflow ccc,
con_contract c, con_contract c,
csh_write_off cwo, csh_write_off cwo,
csh_transaction t csh_transaction t
Where cwo.cashflow_id = ccc.cashflow_id Where cwo.cashflow_id = ccc.cashflow_id
And ccc.contract_id = c.contract_id And ccc.contract_id = c.contract_id
And cwo.csh_transaction_id = t.transaction_id And cwo.csh_transaction_id = t.transaction_id
...@@ -612,8 +633,8 @@ ...@@ -612,8 +633,8 @@
ccc.cf_item, ccc.cf_item,
t.transaction_date, t.transaction_date,
cwo.write_off_id) t2 cwo.write_off_id) t2
Where t1.transaction_date (+) = t2.transaction_date Where t1.transaction_date(+) = t2.transaction_date
And t1.times (+) = t2.times And t1.times(+) = t2.times
Union Union
Select Select
......
...@@ -3,138 +3,154 @@ ...@@ -3,138 +3,154 @@
<bm:operations> <bm:operations>
<bm:operation name="query"> <bm:operation name="query">
<bm:query-sql><![CDATA[ <bm:query-sql><![CDATA[
SELECT to_char(v.calendar_date,'yyyy/mm/dd')calendar_date, Select to_char(v.calendar_date, 'yyyy/mm/dd') calendar_date,
v.named_day, v.named_day,
v.purchase_amount, v.purchase_amount,
v.down_payment, v.down_payment,
v.lease_amount, v.lease_amount,
nvl(v.purchase_amount, 0) + nvl(down_payment, 0) + nvl(v.purchase_amount, 0) + nvl(down_payment, 0) +
nvl(lease_amount, 0) total_amount, nvl(lease_amount, 0) total_amount,
outflow_amount outflow_amount
FROM (SELECT t.calendar_date, From (Select t.calendar_date,
decode(to_char(t.calendar_date, 'd'), decode(to_char(t.calendar_date, 'd'),
1, 1,
'日', '日',
2, 2,
'月', '月',
3, 3,
'火', '火',
4, 4,
'水', '水',
5, 5,
'木', '木',
6, 6,
'金', '金',
7, 7,
'土') named_day, '土') named_day,
(SELECT SUM(ccc.due_amount - nvl(ccc.received_amount, 0)) (Select Sum(ccc.due_amount - nvl(ccc.received_amount, 0))
FROM con_contract_cashflow ccc From con_contract_cashflow ccc
WHERE ccc.cf_item = 8 Where ccc.cf_item = 8
AND ccc.due_date = t.calendar_date And ccc.due_date = t.calendar_date
AND EXISTS And ccc.cf_status = 'RELEASE'
(SELECT 1 And Exists
FROM con_contract ct (Select 1
WHERE ct.contract_status IN From con_contract ct
('INCEPT', 'PENDING','ETING', 'REPURING') Where ct.contract_status In
AND ct.contract_id = ccc.contract_id)) purchase_amount, --留购金 ('INCEPT', 'PENDING', 'ETING', 'REPURING')
(SELECT SUM(ccc.due_amount - nvl(ccc.received_amount, 0)) And ct.contract_id = ccc.contract_id
FROM con_contract_cashflow ccc And ct.data_class = 'NORMAL')) purchase_amount, --留购金
WHERE ccc.cf_item = 2 (Select Sum(ccc.due_amount - nvl(ccc.received_amount, 0))
AND ccc.due_date = t.calendar_date From con_contract_cashflow ccc
AND EXISTS Where ccc.cf_item = 2
(SELECT 1 And ccc.due_date = t.calendar_date
FROM con_contract ct And ccc.cf_status = 'RELEASE'
WHERE ct.contract_status IN And Exists
('INCEPT', 'PENDING','ETING', 'REPURING') (Select 1
AND ct.contract_id = ccc.contract_id)) down_payment, --首付款 From con_contract ct
(SELECT SUM(ccc.due_amount) Where ct.contract_status In
FROM con_contract_cashflow ccc ('INCEPT', 'PENDING', 'ETING', 'REPURING')
WHERE ccc.cf_item = 1 And ct.contract_id = ccc.contract_id
AND ccc.due_date = t.calendar_date And ct.data_class = 'NORMAL')) down_payment, --首付款
AND EXISTS (Select Sum(ccc.due_amount)
(SELECT 1 From con_contract_cashflow ccc
FROM con_contract ct Where ccc.cf_item In (1, 200, 250, 11)
WHERE ct.contract_status IN And ccc.due_date = t.calendar_date
('INCEPT', 'PENDING','ETING', 'REPURING') And ccc.cf_status = 'RELEASE'
AND ct.contract_id = ccc.contract_id)) lease_amount, --租金 And Exists
(CASE (Select 1
WHEN to_char(SYSDATE, 'dd') <= 20 AND From con_contract ct
to_char(t.calendar_date, 'yyyymmdd') = Where ct.contract_status In
to_char(Sysdate, 'yyyymm') || ('INCEPT', 'PENDING', 'ETING', 'REPURING')
decode(to_char(to_date(to_char(Sysdate, 'yyyymm') || 20, And ct.contract_id = ccc.contract_id
'yyyymmdd'), And ct.data_class = 'NORMAL')) lease_amount, --租金
'd'), (Case
1, When to_char(Sysdate, 'dd') <= 20 And
18, to_char(t.calendar_date, 'yyyymmdd') =
7, to_char(Sysdate, 'yyyymm') ||
19, decode(to_char(to_date(to_char(Sysdate, 'yyyymm') || 20,
20) THEN 'yyyymmdd'),
--当月的二十号统计数据 'd'),
NVL((SELECT SUM(nvl(c.lease_item_amount, 0)) 1,
FROM con_contract c 18,
WHERE c.contract_status <> 'CANCEL' 7,
AND c.data_class='NORMAL' 19,
AND to_char(add_months(c.lease_start_date, 1), 20) Then
'yyyymm') = to_char(SYSDATE, 'yyyymm') --当月的二十号统计数据
AND nvl(c.payment_deduction, 'NO_DEDUCTION') = NVL((Select Sum(nvl(c.lease_item_amount, 0))
'NO_DEDUCTION'),0) + From con_contract c
NVL((SELECT SUM(nvl(c.lease_item_amount, 0) - Where c.contract_status <> 'CANCEL'
nvl(c.down_payment, 0)) And c.data_class = 'NORMAL'
FROM con_contract c And to_char(add_months(c.lease_start_date, 1),
WHERE c.contract_status <> 'CANCEL' 'yyyymm') = to_char(Sysdate, 'yyyymm')
AND c.data_class='NORMAL' And nvl(c.payment_deduction, 'NO_DEDUCTION') =
AND to_char(add_months(c.lease_start_date, 1), 'NO_DEDUCTION'
'yyyymm') = to_char(SYSDATE, 'yyyymm') And nvl(c.secondary_lease, 'NO') = 'NO'),
AND nvl(c.payment_deduction, 'NO_DEDUCTION') <> 0) +
'NO_DEDUCTION'),0) NVL((Select Sum(nvl(c.lease_item_amount, 0) -
WHEN to_char(SYSDATE, 'dd') > 20 AND nvl(c.down_payment, 0))
to_char(t.calendar_date, 'yyyymmdd') = From con_contract c
decode(to_char(to_date((to_char(add_months(Sysdate, 1), Where c.contract_status <> 'CANCEL'
'yyyymm') || 20), And c.data_class = 'NORMAL'
'yyyymmdd'), And to_char(add_months(c.lease_start_date, 1),
'd'), 'yyyymm') = to_char(Sysdate, 'yyyymm')
1, And nvl(c.payment_deduction, 'NO_DEDUCTION') <>
to_char(add_months(Sysdate, 1), 'yyyymm') || 18, 'NO_DEDUCTION'
7, And nvl(c.secondary_lease, 'NO') = 'NO'),
to_char(add_months(Sysdate, 1), 'yyyymm') || 19, 0)
to_char(add_months(Sysdate, 1), 'yyyymm') || 20) When to_char(Sysdate, 'dd') > 20 And
THEN to_char(t.calendar_date, 'yyyymmdd') =
NVL((SELECT SUM(nvl(c.lease_item_amount, 0)) decode(to_char(to_date((to_char(add_months(Sysdate, 1),
FROM con_contract c 'yyyymm') || 20),
WHERE c.contract_status <> 'CANCEL' 'yyyymmdd'),
AND c.data_class='NORMAL' 'd'),
AND to_char(c.lease_start_date, 'yyyymm') = 1,
to_char(SYSDATE, 'yyyymm') to_char(add_months(Sysdate, 1), 'yyyymm') || 18,
AND nvl(c.payment_deduction, 'NO_DEDUCTION') = 7,
'NO_DEDUCTION'),0)+ to_char(add_months(Sysdate, 1), 'yyyymm') || 19,
NVL((SELECT SUM(nvl(c.lease_item_amount, 0) - to_char(add_months(Sysdate, 1), 'yyyymm') || 20) Then
nvl(c.down_payment, 0)) NVL((Select Sum(nvl(c.lease_item_amount, 0))
FROM con_contract c From con_contract c
WHERE c.contract_status <> 'CANCEL' Where c.contract_status <> 'CANCEL'
AND c.data_class='NORMAL' And c.data_class = 'NORMAL'
AND to_char(c.lease_start_date, 'yyyymm') = And to_char(c.lease_start_date, 'yyyymm') =
to_char(SYSDATE, 'yyyymm') to_char(Sysdate, 'yyyymm')
AND nvl(c.payment_deduction, 'NO_DEDUCTION') <> And nvl(c.payment_deduction, 'NO_DEDUCTION') =
'NO_DEDUCTION'),0) 'NO_DEDUCTION'
ELSE And nvl(c.secondary_lease, 'NO') = 'NO'),
null 0) + NVL((Select Sum(nvl(c.lease_item_amount, 0) -
END) outflow_amount nvl(c.down_payment, 0))
FROM (SELECT s.calendar_date From con_contract c
FROM fnd_calendar_details s Where c.contract_status <> 'CANCEL'
WHERE trunc(s.calendar_date) >= trunc(SYSDATE) And c.data_class = 'NORMAL'
AND trunc(s.calendar_date) <= ANY And to_char(c.lease_start_date, 'yyyymm') =
(SELECT trunc(due_date) to_char(Sysdate, 'yyyymm')
FROM con_contract_cashflow ccc And nvl(c.payment_deduction, 'NO_DEDUCTION') <>
WHERE ccc.cf_status = 'RELEASE' 'NO_DEDUCTION'
AND EXISTS And nvl(c.secondary_lease, 'NO') = 'NO'),
(SELECT 1 0)
FROM con_contract t Else
WHERE t.contract_status IN Null
('INCEPT', 'PENDING','ETING', 'REPURING') End) outflow_amount
AND t.contract_id = ccc.contract_id From (Select s.calendar_date
AND t.data_class = 'NORMAL')) From fnd_calendar_details s
ORDER BY s.calendar_date) t) v Where trunc(s.calendar_date) >= trunc(Sysdate)
]]></bm:query-sql> And trunc(s.calendar_date) <= Any
(Select trunc(due_date)
From con_contract_cashflow ccc
Where ccc.cf_status = 'RELEASE'
And Exists
(Select 1
From con_contract t
Where t.contract_status In
('INCEPT',
'PENDING',
'ETING',
'REPURING')
And t.contract_id = ccc.contract_id
And t.data_class = 'NORMAL'))
Order By s.calendar_date) t) v
]]></bm:query-sql>
</bm:operation> </bm:operation>
<bm:operation name="update"> <bm:operation name="update">
<bm:update-sql><![CDATA[ <bm:update-sql><![CDATA[
......
...@@ -3,137 +3,140 @@ ...@@ -3,137 +3,140 @@
<bm:operations> <bm:operations>
<bm:operation name="query"> <bm:operation name="query">
<bm:query-sql><![CDATA[ <bm:query-sql><![CDATA[
SELECT v.monthly, Select v.monthly,
SUM(NVL(purchase_amount, 0)) total_purchase_amount, Sum(NVL(purchase_amount, 0)) total_purchase_amount,
SUM(NVL(down_payment, 0)) total_down_payment, Sum(NVL(down_payment, 0)) total_down_payment,
SUM(NVL(lease_amount, 0)) total_lease_amount, Sum(NVL(lease_amount, 0)) total_lease_amount,
(SUM(NVL(purchase_amount, 0)) + SUM(NVL(down_payment, 0)) + (Sum(NVL(purchase_amount, 0)) + Sum(NVL(down_payment, 0)) +
SUM(NVL(lease_amount, 0))) total_amount, Sum(NVL(lease_amount, 0))) total_amount,
SUM(NVL(outflow_amount, 0)) total_outflow_amount Sum(NVL(outflow_amount, 0)) total_outflow_amount
FROM (SELECT to_char(t.calendar_date, 'yyyy/mm') monthly, From (Select to_char(t.calendar_date, 'yyyy/mm') monthly,
t.calendar_date, t.calendar_date,
decode(to_char(t.calendar_date, 'd'), decode(to_char(t.calendar_date, 'd'),
1, 1,
'日', '日',
2, 2,
'月', '月',
3, 3,
'火', '火',
4, 4,
'水', '水',
5, 5,
'木', '木',
6, 6,
'金', '金',
7, 7,
'土') named_day, '土') named_day,
(SELECT SUM(ccc.due_amount - nvl(ccc.received_amount, 0)) (Select Sum(ccc.due_amount - nvl(ccc.received_amount, 0))
FROM con_contract_cashflow ccc From con_contract_cashflow ccc
WHERE ccc.cf_item = 8 Where ccc.cf_item = 8
AND ccc.due_date = t.calendar_date And ccc.due_date = t.calendar_date
AND EXISTS And ccc.cf_status = 'RELEASE'
(SELECT 1 And Exists
FROM con_contract ct (Select 1
WHERE ct.contract_status IN From con_contract ct
('INCEPT', 'PENDING', 'ETING', 'REPURING') Where ct.contract_status In
AND ct.contract_id = ccc.contract_id)) purchase_amount, --留购金 ('INCEPT', 'PENDING', 'ETING', 'REPURING')
(SELECT SUM(ccc.due_amount - nvl(ccc.received_amount, 0)) And ct.contract_id = ccc.contract_id
FROM con_contract_cashflow ccc And ct.data_class = 'NORMAL')) purchase_amount, --留购金
WHERE ccc.cf_item = 2 (Select Sum(due_amount - nvl(received_amount, 0))
AND ccc.due_date = t.calendar_date From con_contract_cashflow ccc
AND EXISTS Where ccc.cf_item = 2
(SELECT 1 And ccc.due_date = t.calendar_date
FROM con_contract ct And ccc.cf_status = 'RELEASE'
WHERE ct.contract_status IN And Exists
('INCEPT', 'PENDING', 'ETING', 'REPURING') (Select 1
AND ct.contract_id = ccc.contract_id)) down_payment, --首付款 From con_contract ct
(SELECT SUM(ccc.due_amount) Where ct.contract_status In
FROM con_contract_cashflow ccc ('INCEPT', 'PENDING', 'ETING', 'REPURING')
WHERE ccc.cf_item = 1 And ct.contract_id = ccc.contract_id
AND ccc.due_date = t.calendar_date And ct.data_class = 'NORMAL')) down_payment, --首付款
AND EXISTS (Select Sum(due_amount)
(SELECT 1 From con_contract_cashflow ccc
FROM con_contract ct Where ccc.cf_item In (1, 200, 250, 11)
WHERE ct.contract_status IN And ccc.due_date = t.calendar_date
('INCEPT', 'PENDING', 'ETING', 'REPURING') And ccc.cf_status = 'RELEASE'
AND ct.contract_id = ccc.contract_id)) lease_amount, --租金 And Exists
(CASE (Select 1
WHEN to_char(SYSDATE, 'dd') <= 20 AND From con_contract ct
to_char(t.calendar_date, 'yyyymmdd') = Where ct.contract_status In
to_char(SYSDATE, 'yyyymm') || 20 THEN ('INCEPT', 'PENDING', 'ETING', 'REPURING')
--当月的二十号统计数据 And ct.contract_id = ccc.contract_id
NVL((SELECT SUM(nvl(c.lease_item_amount, 0)) And ct.data_class = 'NORMAL')) lease_amount, --租金
FROM con_contract c (Case
WHERE c.contract_status <> 'CANCEL' When to_char(Sysdate, 'dd') <= 20 And
AND c.data_class = 'NORMAL' to_char(t.calendar_date, 'yyyymmdd') =
AND to_char(add_months(c.lease_start_date, 1), to_char(Sysdate, 'yyyymm') || 20 Then
'yyyymm') = --当月的二十号统计数据
to_char(SYSDATE, NVL((Select Sum(nvl(c.lease_item_amount, 0))
'yyyymm') From con_contract c
AND nvl(c.payment_deduction, 'NO_DEDUCTION') = Where c.contract_status <> 'CANCEL'
'NO_DEDUCTION'), And c.data_class = 'NORMAL'
0) + And to_char(add_months(c.lease_start_date, 1),
NVL((SELECT SUM(nvl(c.lease_item_amount, 0) - 'yyyymm') = to_char(Sysdate, 'yyyymm')
nvl(c.down_payment, 0)) And nvl(c.payment_deduction, 'NO_DEDUCTION') =
FROM con_contract c 'NO_DEDUCTION'
WHERE c.contract_status <> 'CANCEL' And nvl(c.secondary_lease, 'NO') = 'NO'),
AND c.data_class = 'NORMAL' 0) +
AND to_char(add_months(c.lease_start_date, 1), NVL((Select Sum(nvl(c.lease_item_amount, 0) -
'yyyymm') = nvl(c.down_payment, 0))
to_char(SYSDATE, From con_contract c
'yyyymm') Where c.contract_status <> 'CANCEL'
AND nvl(c.payment_deduction, 'NO_DEDUCTION') <> And c.data_class = 'NORMAL'
'NO_DEDUCTION'), And to_char(add_months(c.lease_start_date, 1),
0) 'yyyymm') = to_char(Sysdate, 'yyyymm')
WHEN to_char(SYSDATE, 'dd') > 20 AND And nvl(c.payment_deduction, 'NO_DEDUCTION') <>
to_char(add_months(t.calendar_date, -1), 'yyyymmdd') = 'NO_DEDUCTION'
to_char(SYSDATE, 'yyyymm') || 20 THEN And nvl(c.secondary_lease, 'NO') = 'NO'),
NVL((SELECT SUM(nvl(c.lease_item_amount, 0)) 0)
FROM con_contract c When to_char(Sysdate, 'dd') > 20 And
WHERE c.contract_status <> 'CANCEL' to_char(add_months(t.calendar_date, -1), 'yyyymmdd') =
AND c.data_class = 'NORMAL' to_char(Sysdate, 'yyyymm') || 20 Then
AND to_char(c.lease_start_date, 'yyyymm') = NVL((Select Sum(nvl(c.lease_item_amount, 0))
to_char(SYSDATE, From con_contract c
'yyyymm') Where c.contract_status <> 'CANCEL'
AND nvl(c.payment_deduction, 'NO_DEDUCTION') = And c.data_class = 'NORMAL'
'NO_DEDUCTION'), And to_char(c.lease_start_date, 'yyyymm') =
0) + to_char(Sysdate, 'yyyymm')
NVL((SELECT SUM(nvl(c.lease_item_amount, 0) - And nvl(c.payment_deduction, 'NO_DEDUCTION') =
nvl(c.down_payment, 0)) 'NO_DEDUCTION'
FROM con_contract c And nvl(c.secondary_lease, 'NO') = 'NO'),
WHERE c.contract_status <> 'CANCEL' 0) + NVL((Select Sum(nvl(c.lease_item_amount, 0) -
AND c.data_class = 'NORMAL' nvl(c.down_payment, 0))
AND to_char(c.lease_start_date, 'yyyymm') = From con_contract c
to_char(SYSDATE, Where c.contract_status <> 'CANCEL'
'yyyymm') And c.data_class = 'NORMAL'
AND nvl(c.payment_deduction, 'NO_DEDUCTION') <> And to_char(c.lease_start_date, 'yyyymm') =
'NO_DEDUCTION'), to_char(Sysdate, 'yyyymm')
0) And nvl(c.payment_deduction, 'NO_DEDUCTION') <>
ELSE 'NO_DEDUCTION'
0 And nvl(c.secondary_lease, 'NO') = 'NO'),
END) outflow_amount 0)
FROM (SELECT s.calendar_date Else
FROM fnd_calendar_details s 0
WHERE trunc(s.calendar_date) >= End) outflow_amount
trunc(SYSDATE) From (Select s.calendar_date
AND trunc(s.calendar_date) <= ANY From fnd_calendar_details s
(SELECT trunc(due_date) Where trunc(s.calendar_date) >= trunc(Sysdate)
FROM con_contract_cashflow ccc And trunc(s.calendar_date) <= Any
WHERE ccc.cf_status = 'RELEASE' (Select trunc(due_date)
AND EXISTS From con_contract_cashflow ccc
(SELECT 1 Where ccc.cf_status = 'RELEASE'
FROM con_contract t And Exists
WHERE t.contract_status IN (Select 1
('INCEPT', From con_contract t
'PENDING', Where t.contract_status In
'ETING', ('INCEPT',
'REPURING') 'PENDING',
AND t.contract_id = ccc.contract_id 'ETING',
AND t.data_class = 'NORMAL')) 'REPURING')
ORDER BY s.calendar_date) t) v And t.contract_id = ccc.contract_id
GROUP BY v.monthly And t.data_class = 'NORMAL'))
ORDER BY monthly Order By s.calendar_date) t) v
]]></bm:query-sql> Group By v.monthly
Order By monthly
]]></bm:query-sql>
</bm:operation> </bm:operation>
</bm:operations> </bm:operations>
</bm:model> </bm:model>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment