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

对账单修改

parent 989e2f6a
......@@ -76,7 +76,7 @@ public class ConExportServiceImpl implements ConExportService {
URL resource = classLoader.getResource("/");
String path = resource.getPath();
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);
} catch (IOException e) {
......@@ -87,69 +87,69 @@ public class ConExportServiceImpl implements ConExportService {
SXSSFDrawing patriarch = sheet.createDrawingPatriarch();
//Drawing patriarch = sheet.createDrawingPatriarch();
//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));
//插入图片
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);
CellStyle header = ExcelFormatUtil.headSytle(wb);// cell样式
CellStyle content = ExcelFormatUtil.contentStyle(wb);// 报表体样式
CellStyle contentLine = ExcelFormatUtil.contentStyleLine(wb);// 报表体样式
CellStyle contentTable = ExcelFormatUtil.contentTableStyle(wb);
// 头部分
CellStyle style1 = wb.createCellStyle();// cell样式
style1.setAlignment(HorizontalAlignment.CENTER );// 设置单元格字体显示居中(左右方向)
style1.setVerticalAlignment(VerticalAlignment.CENTER);
CellStyle content = ExcelFormatUtil.contentStyle(wb);// 黑体居左显示
CellStyle contentLine = ExcelFormatUtil.contentStyleLine(wb);// 黑体加下边框线显示
CellStyle contentTable = ExcelFormatUtil.contentTableStyle(wb);// 等线居中加边框显示
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);
cellTitle.setCellValue(contentTitle);
cellTitle.setCellStyle(style1);
CellRangeAddress regionTitle = new CellRangeAddress(5, 5, 3, 6);
cellTitle.setCellStyle(ExcelFormatUtil.contentCenterStyle(wb));// 黑体居中
CellRangeAddress regionTitle = new CellRangeAddress(3, 3, 3, 6);
sheet.addMergedRegion(regionTitle);
contentTitle = "中国上海市浦东新区迎春路96号";
SXSSFRow rowTitle1 = sheet.createRow(6);
SXSSFCell cellTitle1 = rowTitle1.createCell(4);
SXSSFRow rowTitle1 = sheet.createRow(4);
SXSSFCell cellTitle1 = rowTitle1.createCell(3);
cellTitle1.setCellValue(contentTitle);
cellTitle1.setCellStyle(style1);
CellRangeAddress regionTitle1 = new CellRangeAddress(6, 6, 4, 5);
cellTitle1.setCellStyle(ExcelFormatUtil.contentCenterStyle(wb));// 黑体居中
CellRangeAddress regionTitle1 = new CellRangeAddress(4, 4, 3, 6);
sheet.addMergedRegion(regionTitle1);
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);
cellTitle2.setCellValue(contentTitle);
cellTitle2.setCellStyle(style1);
CellRangeAddress regionTitle2 = new CellRangeAddress(7, 7, 3, 6);
cellTitle2.setCellStyle(ExcelFormatUtil.contentCenterStyle(wb));// 黑体居中
CellRangeAddress regionTitle2 = new CellRangeAddress(5, 5, 3, 6);
sheet.addMergedRegion(regionTitle2);
SXSSFRow rowTitle3 = sheet.createRow(8);
SXSSFRow rowTitle3 = sheet.createRow(6);
for (int i = 0; i < 10; i++) {
SXSSFCell cellTitle3 = rowTitle3.createCell(i);
cellTitle3.setCellValue("");
cellTitle3.setCellStyle(contentLine);
}
CellRangeAddress regionTitle3 = new CellRangeAddress(8, 8, 0, 9);
CellRangeAddress regionTitle3 = new CellRangeAddress(6, 6, 0, 9);
sheet.addMergedRegion(regionTitle3);
ExcelFormatUtil.initTitle(sheet, header, "对账单", 9, 0);
ExcelFormatUtil.initTitle(sheet, ExcelFormatUtil.headSytle(wb), "对账单", 7, 0);
String contentExcel = "(承租人)";
SXSSFRow rowBpName = sheet.createRow(12);
String contentExcel = "(承租人)" + map.get("BP_NAME");
SXSSFRow rowBpName = sheet.createRow(10);
SXSSFCell cellBpName = rowBpName.createCell(0);
//设置每一列的字段名
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);
//设置每一列的字段名
cellBpValue.setCellValue(contentExcel);
cellBpValue.setCellStyle(contentLine);
cellBpValue.setCellValue(bpName);
cellBpValue.setCellStyle(contentLine);*/
SXSSFCell cellBpValue1 = rowBpName.createCell(1);
cellBpValue1.setCellValue("");
cellBpValue1.setCellStyle(contentLine);
SXSSFCell cellBpValue2 = rowBpName.createCell(2);
cellBpValue2.setCellValue("");
cellBpValue2.setCellStyle(contentLine);
......@@ -162,97 +162,96 @@ public class ConExportServiceImpl implements ConExportService {
cellBpValue4.setCellValue(":");
cellBpValue4.setCellStyle(content);
CellRangeAddress region = new CellRangeAddress(12, 12, 1, 3);
CellRangeAddress region = new CellRangeAddress(10, 10, 0, 3);
sheet.addMergedRegion(region);
contentExcel = "依据您与宏菱融资租赁(上海)有限公司签订的《融资租赁合同》,(合同号:" +
(String) map.get("CONTRACT_NUMBER") + ";机号:" + (String) map.get("MACHINE_NUMBER") + ")";
ExcelFormatUtil.initContent(sheet, content, contentExcel, 14, 1);
contentExcel = " 依据您与宏菱融资租赁(上海)有限公司签订的《融资租赁合同》,(合同号:" +
map.get("CONTRACT_NUMBER") + ";机号:" + map.get("MACHINE_NUMBER") + ")";
ExcelFormatUtil.initContent(sheet, content, contentExcel, 12, 0);
contentExcel = "我公司已经按约向您交付了租赁物,截止" +
(String) map.get("TODAY") + ",您已支付我公司以下性质和金额的款项:";
ExcelFormatUtil.initContent(sheet, content, contentExcel, 16, 0);
map.get("TODAY") + ",您已支付我公司以下性质和金额的款项:";
ExcelFormatUtil.initContent(sheet, content, contentExcel, 14, 0);
sheet.setColumnWidth(9, 3000);
if (list != null && list.size() > 1) {
//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(">>>>>>>>>>>>>>>>>>>>表头样式设置完成>>>>>>>>>>");
for (int i = 0; i < list.size(); 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;
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")); // 款项性质
}else{
} else {
cell.setCellValue(""); // 款项性质
}
cell.setCellStyle(contentTable);
cell = row.createCell(j++);
if(map1.get("TIMES") != null){
if (map1.get("TIMES") != null) {
cell.setCellValue(ExcelFormatUtil.getBigDecimal(map1.get("TIMES")).toString()); // 期次
}else{
} else {
cell.setCellValue(""); // 期次
}
cell.setCellStyle(contentTable);
cell = row.createCell(j++);
if(map1.get("DUE_DATE") != null){
if (map1.get("DUE_DATE") != null) {
cell.setCellValue((String) map1.get("DUE_DATE")); // 应付日
}else{
} else {
cell.setCellValue(""); // 应付日
}
cell.setCellStyle(contentTable);
cell = row.createCell(j++);
if(map1.get("DUE_AMOUNT") != null){
if (map1.get("DUE_AMOUNT") != null) {
cell.setCellValue((String) map1.get("DUE_AMOUNT")); // 应付金额
}else{
} else {
cell.setCellValue(""); // 应付金额
}
cell.setCellStyle(contentTable);
cell = row.createCell(j++);
if(map1.get("TRANSACTION_DATE") != null){
if (map1.get("TRANSACTION_DATE") != null) {
cell.setCellValue((String) map1.get("TRANSACTION_DATE")); // 实际收款日
}else{
} else {
cell.setCellValue(""); // 实际收款日
}
cell.setCellStyle(contentTable);
cell = row.createCell(j++);
if(map1.get("RECEIVED_AMOUNT") != null){
if (map1.get("RECEIVED_AMOUNT") != null) {
cell.setCellValue((String) map1.get("RECEIVED_AMOUNT")); // 收款金额
}else{
} else {
cell.setCellValue(""); // 收款金额
}
cell.setCellStyle(contentTable);
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")); // 实收违约金
}else{
} else {
cell.setCellValue(""); // 实收违约金
}
cell.setCellStyle(contentTable);
cell = row.createCell(j++);
if(map1.get("UNRECEIVED_AMOUNT") != null){
if (map1.get("UNRECEIVED_AMOUNT") != null) {
cell.setCellValue((String) map1.get("UNRECEIVED_AMOUNT")); // 未收金额
}else{
} else {
cell.setCellValue(""); // 未收金额
}
cell.setCellStyle(contentTable);
......@@ -261,19 +260,19 @@ public class ConExportServiceImpl implements ConExportService {
//logger.info(">>>>>>>>>>>>>>>>>>>>结束遍历数据组装单元格内容>>>>>>>>>>");
contentExcel = "由于入账处理需要时间,以上还款金额可能未包含最近一次的还款记录。";
ExcelFormatUtil.initContent(sheet, content, contentExcel, list.size() + 18 + 2, 1);
ExcelFormatUtil.initContent(sheet, content, contentExcel, list.size() + 16 + 2, 1);
contentExcel = "请参考。";
ExcelFormatUtil.initContent(sheet, content, contentExcel, list.size() + 18 + 4, 1);
ExcelFormatUtil.initContent(sheet, content, contentExcel, list.size() + 16 + 4, 1);
contentExcel = "宏菱融资租赁(上海)有限公司";
ExcelFormatUtil.initContent(sheet, content, contentExcel, list.size() + 18 + 6, 6);
ExcelFormatUtil.initContent(sheet, ExcelFormatUtil.contentCenterStyle(wb), contentExcel, list.size() + 16 + 6, 6);
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");
ExcelFormatUtil.initContent(sheet, content, contentExcel, list.size() + 18 + 9, 6);
ExcelFormatUtil.initContent(sheet, ExcelFormatUtil.contentCenterStyle(wb), contentExcel, list.size() + 16 + 10, 6);
try {
outputResponse(response, wb, "对账单(" + (String) map.get("BP_NAME") + (String) map.get("CONTRACT_NUMBER") + ").xlsx");
} catch (Exception e) {
......
......@@ -19,11 +19,6 @@ import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import java.math.BigDecimal;
import java.math.BigInteger;
/**
* excle样式工具类
* @author linry
*
*/
public class ExcelFormatUtil {
/**
* 设置报表头样式
......@@ -31,26 +26,15 @@ public class ExcelFormatUtil {
* @return
*/
public static CellStyle headSytle(SXSSFWorkbook workbook){
// 设置style1的样式,此样式运用在第二行
CellStyle style1 = workbook.createCellStyle();// cell样式
// 设置单元格背景色,设置单元格背景色以下两句必须同时设置
/*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();// 创建一个字体对象
CellStyle style1 = workbook.createCellStyle();
Font font1 = workbook.createFont();
font1.setBold(true);
//font1.setBoldweight((short) 16);// 设置字体的宽度
font1.setFontHeightInPoints((short) 16);// 设置字体的高度
font1.setFontName("等线");
//font1.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);// 粗体显示
style1.setFont(font1);// 设置style1的字体
style1.setWrapText(true);// 设置自动换行
style1.setAlignment(HorizontalAlignment.CENTER);// 设置单元格字体显示居中(左右方向)
style1.setVerticalAlignment(VerticalAlignment.CENTER);// 设置单元格字体显示居中(上下方向)
font1.setFontHeightInPoints((short) 16);
font1.setFontName("黑体");
style1.setFont(font1);
style1.setWrapText(true);
style1.setAlignment(HorizontalAlignment.CENTER);
style1.setVerticalAlignment(VerticalAlignment.CENTER);
return style1;
}
/**
......@@ -58,89 +42,69 @@ public class ExcelFormatUtil {
* @param wb
* @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){
// 设置style1的样式,此样式运用在第二行
CellStyle style1 = wb.createCellStyle();// cell样式
// 设置单元格上、下、左、右的边框线
/*style1.setBorderBottom(HSSFCellStyle.BORDER_THIN);
style1.setBorderLeft(HSSFCellStyle.BORDER_THIN);
style1.setBorderRight(HSSFCellStyle.BORDER_THIN);
style1.setBorderTop(HSSFCellStyle.BORDER_THIN);*/
//style1.setWrapText(true);// 设置自动换行
style1.setAlignment(HorizontalAlignment.LEFT);// 设置单元格字体显示居中(左右方向)
style1.setVerticalAlignment(VerticalAlignment.CENTER);// 设置单元格字体显示居中(上下方向)
CellStyle style1 = wb.createCellStyle();
Font font1 = wb.createFont();
font1.setFontName("黑体");
style1.setFont(font1);
//style1.setWrapText(true);
style1.setAlignment(HorizontalAlignment.LEFT);
style1.setVerticalAlignment(VerticalAlignment.CENTER);
return style1;
}
public static CellStyle contentStyleLine(SXSSFWorkbook wb){
// 设置style1的样式,此样式运用在第二行
CellStyle style1 = wb.createCellStyle();// cell样式
// 设置单元格上、下、左、右的边框线
style1.setBorderBottom(BorderStyle.THIN);
/* style1.setBorderBottom(HSSFCellStyle.BORDER_THIN);
style1.setBorderLeft(HSSFCellStyle.BORDER_THIN);
style1.setBorderRight(HSSFCellStyle.BORDER_THIN);
style1.setBorderTop(HSSFCellStyle.BORDER_THIN);*/
style1.setWrapText(true);// 设置自动换行
style1.setAlignment(HorizontalAlignment.LEFT);// 设置单元格字体显示居中(左右方向)
style1.setVerticalAlignment(VerticalAlignment.CENTER);// 设置单元格字体显示居中(上下方向)
// 黑体居中显示
public static CellStyle contentCenterStyle(SXSSFWorkbook wb){
CellStyle style1 = wb.createCellStyle();
Font font1 = wb.createFont();
font1.setFontName("黑体");
style1.setFont(font1);
style1.setWrapText(true);
style1.setAlignment(HorizontalAlignment.CENTER);
style1.setVerticalAlignment(VerticalAlignment.CENTER);
return style1;
}
public static CellStyle contentTableStyle(SXSSFWorkbook wb){
// 设置style1的样式,此样式运用在第二行
CellStyle style1 = wb.createCellStyle();// cell样式
// 设置单元格上、下、左、右的边框线
// 黑体加下边框线显示
public static CellStyle contentStyleLine(SXSSFWorkbook wb){
CellStyle style1 = wb.createCellStyle();
Font font1 = wb.createFont();
font1.setFontName("黑体");
style1.setFont(font1);
style1.setBorderBottom(BorderStyle.THIN);
style1.setBorderLeft(BorderStyle.THIN);
style1.setBorderRight(BorderStyle.THIN);
style1.setBorderTop(BorderStyle.THIN);
style1.setWrapText(true);// 设置自动换行
style1.setAlignment(HorizontalAlignment.CENTER);// 设置单元格字体显示居中(左右方向)
style1.setVerticalAlignment(VerticalAlignment.CENTER);// 设置单元格字体显示居中(上下方向)
//style1.setWrapText(true);
style1.setAlignment(HorizontalAlignment.LEFT);
style1.setVerticalAlignment(VerticalAlignment.CENTER);
return style1;
}
/**
* 设置报表标题样式
* @param workbook
* @return
*/
public static HSSFCellStyle titleSytle(HSSFWorkbook workbook,short color,short fontSize){
// 设置style1的样式,此样式运用在第二行
HSSFCellStyle style1 = workbook.createCellStyle();// cell样式
// 设置单元格背景色,设置单元格背景色以下两句必须同时设置
//style1.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);// 设置填充样式
//short fcolor = color;
// 设置单元格上、下、左、右的边框线
// 列表维持原等线字体
public static CellStyle contentTableStyle(SXSSFWorkbook wb){
CellStyle style1 = wb.createCellStyle();
Font font1 = wb.createFont();
font1.setFontName("等线");
style1.setFont(font1);
style1.setBorderBottom(BorderStyle.THIN);
style1.setBorderLeft(BorderStyle.THIN);
style1.setBorderRight(BorderStyle.THIN);
style1.setBorderTop(BorderStyle.THIN);
HSSFFont font1 = workbook.createFont();// 创建一个字体对象
font1.setBold(true);
font1.setFontHeightInPoints(fontSize);// 设置字体的高度
style1.setFont(font1);// 设置style1的字体
style1.setWrapText(true);// 设置自动换行
style1.setAlignment(HorizontalAlignment.CENTER);// 设置单元格字体显示居中(左右方向)
style1.setVerticalAlignment(VerticalAlignment.CENTER);// 设置单元格字体显示居中(上下方向)
style1.setWrapText(true);
style1.setAlignment(HorizontalAlignment.CENTER);
style1.setVerticalAlignment(VerticalAlignment.CENTER);
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 @@
Where t1.transaction_date = t2.transaction_date (+)
And t1.times = t2.times (+)
Union
Select
nvl(t1.contract_id, t2.contract_id) contract_id,
Select nvl(t1.contract_id, t2.contract_id) contract_id,
nvl(t1.cashflow_id, t2.cashflow_id) cashflow_id,
nvl(t1.write_off_id, t2.write_off_id) write_off_id,
nvl(t1.cf_item,
......@@ -151,7 +150,8 @@
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;)) cf_item,
And cc2.cf_status = &apos;RELEASE&apos;
And rownum = 1)) cf_item,
nvl(t1.cf_item_n,
(Select h.description
From con_contract_cashflow cc2, hls_cashflow_item h
......@@ -160,7 +160,8 @@
And cc2.cf_item Not In (0, 9)
And cc2.cf_direction = &apos;INFLOW&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.due_date,
(Select to_char(cc2.due_date, &apos;yyyy-mm-dd&apos;)
......@@ -169,37 +170,51 @@
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;)) due_date,
And cc2.cf_status = &apos;RELEASE&apos;
And rownum = 1)) due_date,
nvl(t1.due_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;)) 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.write_off_date, t2.write_off_date) write_off_date,
nvl(t1.received_amount, 0) As received_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;)) 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,
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,
From (Select c.contract_id,
cwo.cashflow_id,
cwo.write_off_id,
ccc.cf_item,
(Select h.description
From hls_cashflow_item h
......@@ -241,11 +256,9 @@
ccc.cf_item,
t.transaction_date,
cwo.write_off_id) t1,
(Select
c.contract_id,
(Select c.contract_id,
cwo.cashflow_id,
cwo.write_off_id,
ccc.cf_item,
(Select h.description
From hls_cashflow_item h
......@@ -285,8 +298,8 @@
ccc.cf_item,
t.transaction_date,
cwo.write_off_id) t2
Where t1.transaction_date (+) = t2.transaction_date
And t1.times (+) = t2.times
Where t1.transaction_date(+) = t2.transaction_date
And t1.times(+) = t2.times
Union
Select
......@@ -462,8 +475,7 @@
Where t1.transaction_date = t2.transaction_date (+)
And t1.times = t2.times (+)
Union
Select
nvl(t1.contract_id, t2.contract_id) contract_id,
Select nvl(t1.contract_id, t2.contract_id) contract_id,
nvl(t1.cashflow_id, t2.cashflow_id) cashflow_id,
nvl(t1.write_off_id, t2.write_off_id) write_off_id,
nvl(t1.cf_item,
......@@ -473,17 +485,18 @@
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;)) cf_item,
And cc2.cf_status = &apos;RELEASE&apos;
And rownum = 1)) cf_item,
nvl(t1.cf_item_n,
(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
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 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.due_date,
(Select to_char(cc2.due_date, &apos;yyyy-mm-dd&apos;)
......@@ -492,37 +505,51 @@
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;)) due_date,
And cc2.cf_status = &apos;RELEASE&apos;
And rownum = 1)) due_date,
nvl(t1.due_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;)) 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.write_off_date, t2.write_off_date) write_off_date,
nvl(t1.received_amount, 0) As received_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
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;)) As unreceived_amount,
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,
From (Select c.contract_id,
cwo.cashflow_id,
cwo.write_off_id,
ccc.cf_item,
(Select h.description
From hls_cashflow_item h
......@@ -533,8 +560,7 @@
nvl((Select Sum(tn.write_off_due_amount)
From csh_write_off tn
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,
--收款日
to_char(t.transaction_date, &apos;yyyy-mm-dd&apos;) transaction_date,
......@@ -545,8 +571,7 @@
nvl((Select Sum(tn.write_off_due_amount)
From csh_write_off tn
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
From con_contract_cashflow ccc,
con_contract c,
......@@ -566,11 +591,9 @@
ccc.cf_item,
t.transaction_date,
cwo.write_off_id) t1,
(Select
c.contract_id,
(Select c.contract_id,
cwo.cashflow_id,
cwo.write_off_id,
ccc.cf_item,
(Select h.description
From hls_cashflow_item h
......@@ -581,8 +604,7 @@
nvl((Select Sum(tn.write_off_due_amount)
From csh_write_off tn
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,
--收款日
to_char(t.transaction_date, &apos;yyyy-mm-dd&apos;) transaction_date,
......@@ -593,8 +615,7 @@
nvl((Select Sum(tn.write_off_due_amount)
From csh_write_off tn
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
From con_contract_cashflow ccc,
con_contract c,
......@@ -612,8 +633,8 @@
ccc.cf_item,
t.transaction_date,
cwo.write_off_id) t2
Where t1.transaction_date (+) = t2.transaction_date
And t1.times (+) = t2.times
Where t1.transaction_date(+) = t2.transaction_date
And t1.times(+) = t2.times
Union
Select
......
......@@ -3,7 +3,7 @@
<bm:operations>
<bm:operation name="query">
<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.purchase_amount,
v.down_payment,
......@@ -11,7 +11,7 @@
nvl(v.purchase_amount, 0) + nvl(down_payment, 0) +
nvl(lease_amount, 0) total_amount,
outflow_amount
FROM (SELECT t.calendar_date,
From (Select t.calendar_date,
decode(to_char(t.calendar_date, 'd'),
1,
'日',
......@@ -27,38 +27,44 @@
'金',
7,
'土') named_day,
(SELECT SUM(ccc.due_amount - nvl(ccc.received_amount, 0))
FROM con_contract_cashflow ccc
WHERE ccc.cf_item = 8
AND ccc.due_date = t.calendar_date
AND EXISTS
(SELECT 1
FROM con_contract ct
WHERE ct.contract_status IN
('INCEPT', 'PENDING','ETING', 'REPURING')
AND ct.contract_id = ccc.contract_id)) purchase_amount, --留购金
(SELECT SUM(ccc.due_amount - nvl(ccc.received_amount, 0))
FROM con_contract_cashflow ccc
WHERE ccc.cf_item = 2
AND ccc.due_date = t.calendar_date
AND EXISTS
(SELECT 1
FROM con_contract ct
WHERE ct.contract_status IN
('INCEPT', 'PENDING','ETING', 'REPURING')
AND ct.contract_id = ccc.contract_id)) down_payment, --首付款
(SELECT SUM(ccc.due_amount)
FROM con_contract_cashflow ccc
WHERE ccc.cf_item = 1
AND ccc.due_date = t.calendar_date
AND EXISTS
(SELECT 1
FROM con_contract ct
WHERE ct.contract_status IN
('INCEPT', 'PENDING','ETING', 'REPURING')
AND ct.contract_id = ccc.contract_id)) lease_amount, --租金
(CASE
WHEN to_char(SYSDATE, 'dd') <= 20 AND
(Select Sum(ccc.due_amount - nvl(ccc.received_amount, 0))
From con_contract_cashflow ccc
Where ccc.cf_item = 8
And ccc.due_date = t.calendar_date
And ccc.cf_status = 'RELEASE'
And Exists
(Select 1
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')) purchase_amount, --留购金
(Select Sum(ccc.due_amount - nvl(ccc.received_amount, 0))
From con_contract_cashflow ccc
Where ccc.cf_item = 2
And ccc.due_date = t.calendar_date
And ccc.cf_status = 'RELEASE'
And Exists
(Select 1
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')) down_payment, --首付款
(Select Sum(ccc.due_amount)
From con_contract_cashflow ccc
Where ccc.cf_item In (1, 200, 250, 11)
And ccc.due_date = t.calendar_date
And ccc.cf_status = 'RELEASE'
And Exists
(Select 1
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(Sysdate, 'yyyymm') ||
decode(to_char(to_date(to_char(Sysdate, 'yyyymm') || 20,
......@@ -68,26 +74,30 @@
18,
7,
19,
20) THEN
20) Then
--当月的二十号统计数据
NVL((SELECT SUM(nvl(c.lease_item_amount, 0))
FROM con_contract c
WHERE c.contract_status <> 'CANCEL'
AND c.data_class='NORMAL'
AND to_char(add_months(c.lease_start_date, 1),
'yyyymm') = to_char(SYSDATE, 'yyyymm')
AND nvl(c.payment_deduction, 'NO_DEDUCTION') =
'NO_DEDUCTION'),0) +
NVL((SELECT SUM(nvl(c.lease_item_amount, 0) -
NVL((Select Sum(nvl(c.lease_item_amount, 0))
From con_contract c
Where c.contract_status <> 'CANCEL'
And c.data_class = 'NORMAL'
And to_char(add_months(c.lease_start_date, 1),
'yyyymm') = to_char(Sysdate, 'yyyymm')
And nvl(c.payment_deduction, 'NO_DEDUCTION') =
'NO_DEDUCTION'
And nvl(c.secondary_lease, 'NO') = 'NO'),
0) +
NVL((Select Sum(nvl(c.lease_item_amount, 0) -
nvl(c.down_payment, 0))
FROM con_contract c
WHERE c.contract_status <> 'CANCEL'
AND c.data_class='NORMAL'
AND to_char(add_months(c.lease_start_date, 1),
'yyyymm') = to_char(SYSDATE, 'yyyymm')
AND nvl(c.payment_deduction, 'NO_DEDUCTION') <>
'NO_DEDUCTION'),0)
WHEN to_char(SYSDATE, 'dd') > 20 AND
From con_contract c
Where c.contract_status <> 'CANCEL'
And c.data_class = 'NORMAL'
And to_char(add_months(c.lease_start_date, 1),
'yyyymm') = to_char(Sysdate, 'yyyymm')
And nvl(c.payment_deduction, 'NO_DEDUCTION') <>
'NO_DEDUCTION'
And nvl(c.secondary_lease, 'NO') = 'NO'),
0)
When to_char(Sysdate, 'dd') > 20 And
to_char(t.calendar_date, 'yyyymmdd') =
decode(to_char(to_date((to_char(add_months(Sysdate, 1),
'yyyymm') || 20),
......@@ -97,43 +107,49 @@
to_char(add_months(Sysdate, 1), 'yyyymm') || 18,
7,
to_char(add_months(Sysdate, 1), 'yyyymm') || 19,
to_char(add_months(Sysdate, 1), 'yyyymm') || 20)
THEN
NVL((SELECT SUM(nvl(c.lease_item_amount, 0))
FROM con_contract c
WHERE c.contract_status <> 'CANCEL'
AND c.data_class='NORMAL'
AND to_char(c.lease_start_date, 'yyyymm') =
to_char(SYSDATE, 'yyyymm')
AND nvl(c.payment_deduction, 'NO_DEDUCTION') =
'NO_DEDUCTION'),0)+
NVL((SELECT SUM(nvl(c.lease_item_amount, 0) -
to_char(add_months(Sysdate, 1), 'yyyymm') || 20) Then
NVL((Select Sum(nvl(c.lease_item_amount, 0))
From con_contract c
Where c.contract_status <> 'CANCEL'
And c.data_class = 'NORMAL'
And to_char(c.lease_start_date, 'yyyymm') =
to_char(Sysdate, 'yyyymm')
And nvl(c.payment_deduction, 'NO_DEDUCTION') =
'NO_DEDUCTION'
And nvl(c.secondary_lease, 'NO') = 'NO'),
0) + NVL((Select Sum(nvl(c.lease_item_amount, 0) -
nvl(c.down_payment, 0))
FROM con_contract c
WHERE c.contract_status <> 'CANCEL'
AND c.data_class='NORMAL'
AND to_char(c.lease_start_date, 'yyyymm') =
to_char(SYSDATE, 'yyyymm')
AND nvl(c.payment_deduction, 'NO_DEDUCTION') <>
'NO_DEDUCTION'),0)
ELSE
null
END) outflow_amount
FROM (SELECT s.calendar_date
FROM fnd_calendar_details s
WHERE trunc(s.calendar_date) >= trunc(SYSDATE)
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
From con_contract c
Where c.contract_status <> 'CANCEL'
And c.data_class = 'NORMAL'
And to_char(c.lease_start_date, 'yyyymm') =
to_char(Sysdate, 'yyyymm')
And nvl(c.payment_deduction, 'NO_DEDUCTION') <>
'NO_DEDUCTION'
And nvl(c.secondary_lease, 'NO') = 'NO'),
0)
Else
Null
End) outflow_amount
From (Select s.calendar_date
From fnd_calendar_details s
Where trunc(s.calendar_date) >= trunc(Sysdate)
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 name="update">
......
......@@ -3,14 +3,14 @@
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
SELECT v.monthly,
SUM(NVL(purchase_amount, 0)) total_purchase_amount,
SUM(NVL(down_payment, 0)) total_down_payment,
SUM(NVL(lease_amount, 0)) total_lease_amount,
(SUM(NVL(purchase_amount, 0)) + SUM(NVL(down_payment, 0)) +
SUM(NVL(lease_amount, 0))) total_amount,
SUM(NVL(outflow_amount, 0)) total_outflow_amount
FROM (SELECT to_char(t.calendar_date, 'yyyy/mm') monthly,
Select v.monthly,
Sum(NVL(purchase_amount, 0)) total_purchase_amount,
Sum(NVL(down_payment, 0)) total_down_payment,
Sum(NVL(lease_amount, 0)) total_lease_amount,
(Sum(NVL(purchase_amount, 0)) + Sum(NVL(down_payment, 0)) +
Sum(NVL(lease_amount, 0))) total_amount,
Sum(NVL(outflow_amount, 0)) total_outflow_amount
From (Select to_char(t.calendar_date, 'yyyy/mm') monthly,
t.calendar_date,
decode(to_char(t.calendar_date, 'd'),
1,
......@@ -27,112 +27,115 @@
'金',
7,
'土') named_day,
(SELECT SUM(ccc.due_amount - nvl(ccc.received_amount, 0))
FROM con_contract_cashflow ccc
WHERE ccc.cf_item = 8
AND ccc.due_date = t.calendar_date
AND EXISTS
(SELECT 1
FROM con_contract ct
WHERE ct.contract_status IN
(Select Sum(ccc.due_amount - nvl(ccc.received_amount, 0))
From con_contract_cashflow ccc
Where ccc.cf_item = 8
And ccc.due_date = t.calendar_date
And ccc.cf_status = 'RELEASE'
And Exists
(Select 1
From con_contract ct
Where ct.contract_status In
('INCEPT', 'PENDING', 'ETING', 'REPURING')
AND ct.contract_id = ccc.contract_id)) purchase_amount, --留购金
(SELECT SUM(ccc.due_amount - nvl(ccc.received_amount, 0))
FROM con_contract_cashflow ccc
WHERE ccc.cf_item = 2
AND ccc.due_date = t.calendar_date
AND EXISTS
(SELECT 1
FROM con_contract ct
WHERE ct.contract_status IN
And ct.contract_id = ccc.contract_id
And ct.data_class = 'NORMAL')) purchase_amount, --留购金
(Select Sum(due_amount - nvl(received_amount, 0))
From con_contract_cashflow ccc
Where ccc.cf_item = 2
And ccc.due_date = t.calendar_date
And ccc.cf_status = 'RELEASE'
And Exists
(Select 1
From con_contract ct
Where ct.contract_status In
('INCEPT', 'PENDING', 'ETING', 'REPURING')
AND ct.contract_id = ccc.contract_id)) down_payment, --首付款
(SELECT SUM(ccc.due_amount)
FROM con_contract_cashflow ccc
WHERE ccc.cf_item = 1
AND ccc.due_date = t.calendar_date
AND EXISTS
(SELECT 1
FROM con_contract ct
WHERE ct.contract_status IN
And ct.contract_id = ccc.contract_id
And ct.data_class = 'NORMAL')) down_payment, --首付款
(Select Sum(due_amount)
From con_contract_cashflow ccc
Where ccc.cf_item In (1, 200, 250, 11)
And ccc.due_date = t.calendar_date
And ccc.cf_status = 'RELEASE'
And Exists
(Select 1
From con_contract ct
Where ct.contract_status In
('INCEPT', 'PENDING', 'ETING', 'REPURING')
AND ct.contract_id = ccc.contract_id)) lease_amount, --租金
(CASE
WHEN to_char(SYSDATE, 'dd') <= 20 AND
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(SYSDATE, 'yyyymm') || 20 THEN
to_char(Sysdate, 'yyyymm') || 20 Then
--当月的二十号统计数据
NVL((SELECT SUM(nvl(c.lease_item_amount, 0))
FROM con_contract c
WHERE c.contract_status <> 'CANCEL'
AND c.data_class = 'NORMAL'
AND to_char(add_months(c.lease_start_date, 1),
'yyyymm') =
to_char(SYSDATE,
'yyyymm')
AND nvl(c.payment_deduction, 'NO_DEDUCTION') =
'NO_DEDUCTION'),
NVL((Select Sum(nvl(c.lease_item_amount, 0))
From con_contract c
Where c.contract_status <> 'CANCEL'
And c.data_class = 'NORMAL'
And to_char(add_months(c.lease_start_date, 1),
'yyyymm') = to_char(Sysdate, 'yyyymm')
And nvl(c.payment_deduction, 'NO_DEDUCTION') =
'NO_DEDUCTION'
And nvl(c.secondary_lease, 'NO') = 'NO'),
0) +
NVL((SELECT SUM(nvl(c.lease_item_amount, 0) -
NVL((Select Sum(nvl(c.lease_item_amount, 0) -
nvl(c.down_payment, 0))
FROM con_contract c
WHERE c.contract_status <> 'CANCEL'
AND c.data_class = 'NORMAL'
AND to_char(add_months(c.lease_start_date, 1),
'yyyymm') =
to_char(SYSDATE,
'yyyymm')
AND nvl(c.payment_deduction, 'NO_DEDUCTION') <>
'NO_DEDUCTION'),
From con_contract c
Where c.contract_status <> 'CANCEL'
And c.data_class = 'NORMAL'
And to_char(add_months(c.lease_start_date, 1),
'yyyymm') = to_char(Sysdate, 'yyyymm')
And nvl(c.payment_deduction, 'NO_DEDUCTION') <>
'NO_DEDUCTION'
And nvl(c.secondary_lease, 'NO') = 'NO'),
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(SYSDATE, 'yyyymm') || 20 THEN
NVL((SELECT SUM(nvl(c.lease_item_amount, 0))
FROM con_contract c
WHERE c.contract_status <> 'CANCEL'
AND c.data_class = 'NORMAL'
AND to_char(c.lease_start_date, 'yyyymm') =
to_char(SYSDATE,
'yyyymm')
AND nvl(c.payment_deduction, 'NO_DEDUCTION') =
'NO_DEDUCTION'),
0) +
NVL((SELECT SUM(nvl(c.lease_item_amount, 0) -
to_char(Sysdate, 'yyyymm') || 20 Then
NVL((Select Sum(nvl(c.lease_item_amount, 0))
From con_contract c
Where c.contract_status <> 'CANCEL'
And c.data_class = 'NORMAL'
And to_char(c.lease_start_date, 'yyyymm') =
to_char(Sysdate, 'yyyymm')
And nvl(c.payment_deduction, 'NO_DEDUCTION') =
'NO_DEDUCTION'
And nvl(c.secondary_lease, 'NO') = 'NO'),
0) + NVL((Select Sum(nvl(c.lease_item_amount, 0) -
nvl(c.down_payment, 0))
FROM con_contract c
WHERE c.contract_status <> 'CANCEL'
AND c.data_class = 'NORMAL'
AND to_char(c.lease_start_date, 'yyyymm') =
to_char(SYSDATE,
'yyyymm')
AND nvl(c.payment_deduction, 'NO_DEDUCTION') <>
'NO_DEDUCTION'),
From con_contract c
Where c.contract_status <> 'CANCEL'
And c.data_class = 'NORMAL'
And to_char(c.lease_start_date, 'yyyymm') =
to_char(Sysdate, 'yyyymm')
And nvl(c.payment_deduction, 'NO_DEDUCTION') <>
'NO_DEDUCTION'
And nvl(c.secondary_lease, 'NO') = 'NO'),
0)
ELSE
Else
0
END) outflow_amount
FROM (SELECT s.calendar_date
FROM fnd_calendar_details s
WHERE trunc(s.calendar_date) >=
trunc(SYSDATE)
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
End) outflow_amount
From (Select s.calendar_date
From fnd_calendar_details s
Where trunc(s.calendar_date) >= trunc(Sysdate)
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
GROUP BY v.monthly
ORDER BY monthly
And t.contract_id = ccc.contract_id
And t.data_class = 'NORMAL'))
Order By s.calendar_date) t) v
Group By v.monthly
Order By monthly
]]></bm:query-sql>
</bm:operation>
</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