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,8 +140,7 @@ ...@@ -140,8 +140,7 @@
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,
...@@ -151,7 +150,8 @@ ...@@ -151,7 +150,8 @@
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;)) cf_item, And cc2.cf_status = &apos;RELEASE&apos;
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
...@@ -160,7 +160,8 @@ ...@@ -160,7 +160,8 @@
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
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;)
...@@ -169,37 +170,51 @@ ...@@ -169,37 +170,51 @@
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, nvl(t1.due_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 due_amount, 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;
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 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 From (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
...@@ -241,11 +256,9 @@ ...@@ -241,11 +256,9 @@
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
...@@ -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,8 +475,7 @@ ...@@ -462,8 +475,7 @@
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,
...@@ -473,17 +485,18 @@ ...@@ -473,17 +485,18 @@
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;)) cf_item, And cc2.cf_status = &apos;RELEASE&apos;
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)) cf_item_n, And h.cf_item = cc2.cf_item
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;)
...@@ -492,37 +505,51 @@ ...@@ -492,37 +505,51 @@
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, nvl(t1.due_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 due_amount, 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
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 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;),
0)) 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 From (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
...@@ -533,8 +560,7 @@ ...@@ -533,8 +560,7 @@
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,
...@@ -545,8 +571,7 @@ ...@@ -545,8 +571,7 @@
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,
...@@ -566,11 +591,9 @@ ...@@ -566,11 +591,9 @@
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
...@@ -581,8 +604,7 @@ ...@@ -581,8 +604,7 @@
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,
...@@ -593,8 +615,7 @@ ...@@ -593,8 +615,7 @@
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,
...@@ -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,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<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,
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
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,
'日', '日',
...@@ -27,38 +27,44 @@ ...@@ -27,38 +27,44 @@
'金', '金',
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
Where ct.contract_status In
('INCEPT', 'PENDING', 'ETING', 'REPURING')
And ct.contract_id = ccc.contract_id
And ct.data_class = 'NORMAL')) lease_amount, --租金
(Case
When to_char(Sysdate, 'dd') <= 20 And
to_char(t.calendar_date, 'yyyymmdd') = to_char(t.calendar_date, 'yyyymmdd') =
to_char(Sysdate, 'yyyymm') || to_char(Sysdate, 'yyyymm') ||
decode(to_char(to_date(to_char(Sysdate, 'yyyymm') || 20, decode(to_char(to_date(to_char(Sysdate, 'yyyymm') || 20,
...@@ -68,26 +74,30 @@ ...@@ -68,26 +74,30 @@
18, 18,
7, 7,
19, 19,
20) THEN 20) Then
--当月的二十号统计数据 --当月的二十号统计数据
NVL((SELECT SUM(nvl(c.lease_item_amount, 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(add_months(c.lease_start_date, 1), And to_char(add_months(c.lease_start_date, 1),
'yyyymm') = to_char(SYSDATE, 'yyyymm') 'yyyymm') = to_char(Sysdate, 'yyyymm')
AND nvl(c.payment_deduction, 'NO_DEDUCTION') = And nvl(c.payment_deduction, 'NO_DEDUCTION') =
'NO_DEDUCTION'),0) + 'NO_DEDUCTION'
NVL((SELECT SUM(nvl(c.lease_item_amount, 0) - And nvl(c.secondary_lease, 'NO') = 'NO'),
0) +
NVL((Select Sum(nvl(c.lease_item_amount, 0) -
nvl(c.down_payment, 0)) nvl(c.down_payment, 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(add_months(c.lease_start_date, 1), And to_char(add_months(c.lease_start_date, 1),
'yyyymm') = to_char(SYSDATE, 'yyyymm') 'yyyymm') = to_char(Sysdate, 'yyyymm')
AND nvl(c.payment_deduction, 'NO_DEDUCTION') <> And nvl(c.payment_deduction, 'NO_DEDUCTION') <>
'NO_DEDUCTION'),0) 'NO_DEDUCTION'
WHEN to_char(SYSDATE, 'dd') > 20 AND And nvl(c.secondary_lease, 'NO') = 'NO'),
0)
When to_char(Sysdate, 'dd') > 20 And
to_char(t.calendar_date, 'yyyymmdd') = to_char(t.calendar_date, 'yyyymmdd') =
decode(to_char(to_date((to_char(add_months(Sysdate, 1), decode(to_char(to_date((to_char(add_months(Sysdate, 1),
'yyyymm') || 20), 'yyyymm') || 20),
...@@ -97,43 +107,49 @@ ...@@ -97,43 +107,49 @@
to_char(add_months(Sysdate, 1), 'yyyymm') || 18, to_char(add_months(Sysdate, 1), 'yyyymm') || 18,
7, 7,
to_char(add_months(Sysdate, 1), 'yyyymm') || 19, to_char(add_months(Sysdate, 1), 'yyyymm') || 19,
to_char(add_months(Sysdate, 1), 'yyyymm') || 20) to_char(add_months(Sysdate, 1), 'yyyymm') || 20) Then
THEN NVL((Select Sum(nvl(c.lease_item_amount, 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'
'NO_DEDUCTION'),0)+ And nvl(c.secondary_lease, 'NO') = 'NO'),
NVL((SELECT SUM(nvl(c.lease_item_amount, 0) - 0) + NVL((Select Sum(nvl(c.lease_item_amount, 0) -
nvl(c.down_payment, 0)) nvl(c.down_payment, 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)
END) outflow_amount Else
FROM (SELECT s.calendar_date Null
FROM fnd_calendar_details s End) outflow_amount
WHERE trunc(s.calendar_date) >= 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', 'PENDING','ETING', 'REPURING') From con_contract t
AND t.contract_id = ccc.contract_id Where t.contract_status In
AND t.data_class = 'NORMAL')) ('INCEPT',
ORDER BY s.calendar_date) t) v '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:query-sql>
</bm:operation> </bm:operation>
<bm:operation name="update"> <bm:operation name="update">
......
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
<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,
...@@ -27,112 +27,115 @@ ...@@ -27,112 +27,115 @@
'金', '金',
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
Where ct.contract_status In
('INCEPT', 'PENDING', 'ETING', 'REPURING') ('INCEPT', 'PENDING', 'ETING', 'REPURING')
AND ct.contract_id = ccc.contract_id)) purchase_amount, --留购金 And ct.contract_id = ccc.contract_id
(SELECT SUM(ccc.due_amount - nvl(ccc.received_amount, 0)) And ct.data_class = 'NORMAL')) purchase_amount, --留购金
FROM con_contract_cashflow ccc (Select Sum(due_amount - nvl(received_amount, 0))
WHERE ccc.cf_item = 2 From con_contract_cashflow ccc
AND ccc.due_date = t.calendar_date Where ccc.cf_item = 2
AND EXISTS And ccc.due_date = t.calendar_date
(SELECT 1 And ccc.cf_status = 'RELEASE'
FROM con_contract ct And Exists
WHERE ct.contract_status IN (Select 1
From con_contract ct
Where ct.contract_status In
('INCEPT', 'PENDING', 'ETING', 'REPURING') ('INCEPT', 'PENDING', 'ETING', 'REPURING')
AND ct.contract_id = ccc.contract_id)) down_payment, --首付款 And ct.contract_id = ccc.contract_id
(SELECT SUM(ccc.due_amount) And ct.data_class = 'NORMAL')) down_payment, --首付款
FROM con_contract_cashflow ccc (Select Sum(due_amount)
WHERE ccc.cf_item = 1 From con_contract_cashflow ccc
AND ccc.due_date = t.calendar_date Where ccc.cf_item In (1, 200, 250, 11)
AND EXISTS And ccc.due_date = t.calendar_date
(SELECT 1 And ccc.cf_status = 'RELEASE'
FROM con_contract ct And Exists
WHERE ct.contract_status IN (Select 1
From con_contract ct
Where ct.contract_status In
('INCEPT', 'PENDING', 'ETING', 'REPURING') ('INCEPT', 'PENDING', 'ETING', 'REPURING')
AND ct.contract_id = ccc.contract_id)) lease_amount, --租金 And ct.contract_id = ccc.contract_id
(CASE And ct.data_class = 'NORMAL')) lease_amount, --租金
WHEN to_char(SYSDATE, 'dd') <= 20 AND (Case
When to_char(Sysdate, 'dd') <= 20 And
to_char(t.calendar_date, 'yyyymmdd') = to_char(t.calendar_date, 'yyyymmdd') =
to_char(SYSDATE, 'yyyymm') || 20 THEN to_char(Sysdate, 'yyyymm') || 20 Then
--当月的二十号统计数据 --当月的二十号统计数据
NVL((SELECT SUM(nvl(c.lease_item_amount, 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(add_months(c.lease_start_date, 1), And to_char(add_months(c.lease_start_date, 1),
'yyyymm') = 'yyyymm') = to_char(Sysdate, 'yyyymm')
to_char(SYSDATE, And nvl(c.payment_deduction, 'NO_DEDUCTION') =
'yyyymm') 'NO_DEDUCTION'
AND nvl(c.payment_deduction, 'NO_DEDUCTION') = And nvl(c.secondary_lease, 'NO') = 'NO'),
'NO_DEDUCTION'),
0) + 0) +
NVL((SELECT SUM(nvl(c.lease_item_amount, 0) - NVL((Select Sum(nvl(c.lease_item_amount, 0) -
nvl(c.down_payment, 0)) nvl(c.down_payment, 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(add_months(c.lease_start_date, 1), And to_char(add_months(c.lease_start_date, 1),
'yyyymm') = 'yyyymm') = to_char(Sysdate, 'yyyymm')
to_char(SYSDATE, And nvl(c.payment_deduction, 'NO_DEDUCTION') <>
'yyyymm') 'NO_DEDUCTION'
AND nvl(c.payment_deduction, 'NO_DEDUCTION') <> And nvl(c.secondary_lease, 'NO') = 'NO'),
'NO_DEDUCTION'),
0) 0)
WHEN to_char(SYSDATE, 'dd') > 20 AND When to_char(Sysdate, 'dd') > 20 And
to_char(add_months(t.calendar_date, -1), 'yyyymmdd') = to_char(add_months(t.calendar_date, -1), 'yyyymmdd') =
to_char(SYSDATE, 'yyyymm') || 20 THEN to_char(Sysdate, 'yyyymm') || 20 Then
NVL((SELECT SUM(nvl(c.lease_item_amount, 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, to_char(Sysdate, 'yyyymm')
'yyyymm') And nvl(c.payment_deduction, 'NO_DEDUCTION') =
AND nvl(c.payment_deduction, 'NO_DEDUCTION') = 'NO_DEDUCTION'
'NO_DEDUCTION'), And nvl(c.secondary_lease, 'NO') = 'NO'),
0) + 0) + NVL((Select Sum(nvl(c.lease_item_amount, 0) -
NVL((SELECT SUM(nvl(c.lease_item_amount, 0) -
nvl(c.down_payment, 0)) nvl(c.down_payment, 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, to_char(Sysdate, 'yyyymm')
'yyyymm') And nvl(c.payment_deduction, 'NO_DEDUCTION') <>
AND nvl(c.payment_deduction, 'NO_DEDUCTION') <> 'NO_DEDUCTION'
'NO_DEDUCTION'), And nvl(c.secondary_lease, 'NO') = 'NO'),
0) 0)
ELSE Else
0 0
END) outflow_amount End) outflow_amount
FROM (SELECT s.calendar_date From (Select s.calendar_date
FROM fnd_calendar_details s From fnd_calendar_details s
WHERE trunc(s.calendar_date) >= Where trunc(s.calendar_date) >= trunc(Sysdate)
trunc(SYSDATE) And trunc(s.calendar_date) <= Any
AND trunc(s.calendar_date) <= ANY (Select trunc(due_date)
(SELECT trunc(due_date) From con_contract_cashflow ccc
FROM con_contract_cashflow ccc Where ccc.cf_status = 'RELEASE'
WHERE ccc.cf_status = 'RELEASE' And Exists
AND EXISTS (Select 1
(SELECT 1 From con_contract t
FROM con_contract t Where t.contract_status In
WHERE t.contract_status IN
('INCEPT', ('INCEPT',
'PENDING', 'PENDING',
'ETING', 'ETING',
'REPURING') 'REPURING')
AND t.contract_id = ccc.contract_id And t.contract_id = ccc.contract_id
AND t.data_class = 'NORMAL')) And t.data_class = 'NORMAL'))
ORDER BY s.calendar_date) t) v Order By s.calendar_date) t) v
GROUP BY v.monthly Group By v.monthly
ORDER BY monthly Order By monthly
]]></bm:query-sql> ]]></bm:query-sql>
</bm:operation> </bm:operation>
</bm:operations> </bm:operations>
......
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