[Home] [Help]
603:
604: cursor c_fund_sched_exist(p_loan_id number) is
605: select decode(loan.loan_class_code,
606: 'DIRECT', (select count(1) from lns_disb_headers where loan_id = p_loan_id and status is null and PAYMENT_REQUEST_DATE is not null),
607: 'ERS', (select count(1) from lns_loan_lines where loan_id = p_loan_id and (status is null or status = 'PENDING') and end_date is null))
608: from lns_loan_headers_all loan
609: where loan.loan_id = p_loan_id;
610:
611: BEGIN
2507:
2508: cursor c_fund_sched_exist(p_loan_id number) is
2509: select decode(loan.loan_class_code,
2510: 'DIRECT', (select count(1) from lns_disb_headers where loan_id = p_loan_id and status is null and PAYMENT_REQUEST_DATE is not null),
2511: 'ERS', (select count(1) from lns_loan_lines where loan_id = p_loan_id and (status is null or status = 'PENDING') and end_date is null))
2512: from lns_loan_headers_all loan
2513: where loan.loan_id = p_loan_id;
2514:
2515: cursor c_get_bill_opt(p_loan_id number) is
3898:
3899: cursor c_fund_sched_exist(p_loan_id number) is
3900: select decode(loan.loan_class_code,
3901: 'DIRECT', (select count(1) from lns_disb_headers where loan_id = p_loan_id and status is null and PAYMENT_REQUEST_DATE is not null),
3902: 'ERS', (select count(1) from lns_loan_lines where loan_id = p_loan_id and (status is null or status = 'PENDING') and end_date is null))
3903: from lns_loan_headers_all loan
3904: where loan.loan_id = p_loan_id;
3905:
3906: cursor c_get_bill_opt(p_loan_id number) is
5134:
5135: cursor c_fund_sched_exist(p_loan_id number) is
5136: select decode(loan.loan_class_code,
5137: 'DIRECT', (select count(1) from lns_disb_headers where loan_id = p_loan_id and status is null and PAYMENT_REQUEST_DATE is not null),
5138: 'ERS', (select count(1) from lns_loan_lines where loan_id = p_loan_id and (status is null or status = 'PENDING') and end_date is null))
5139: from lns_loan_headers_all loan
5140: where loan.loan_id = p_loan_id;
5141:
5142: -- get sum of all add int for last billed installment
10284: 'DIRECT', (select nvl(sum(disb_line.LINE_AMOUNT), 0) from lns_disb_lines disb_line, lns_disb_headers disb_hdr
10285: where disb_hdr.loan_id = loan.loan_id and /*disb_hdr.phase = 'TERM' and */
10286: disb_hdr.disb_header_id = disb_line.disb_header_id and disb_line.STATUS = 'FULLY_FUNDED' and
10287: trunc(disb_line.DISBURSEMENT_DATE) <= trunc(p_date)),
10288: 'ERS', (select nvl(sum(lines.REQUESTED_AMOUNT), 0) from lns_loan_lines lines
10289: where lines.loan_id = loan.loan_id and lines.STATUS = 'APPROVED' and lines.end_date is null and
10290: trunc(lines.ADJUSTMENT_DATE) <= trunc(p_date)))
10291: from lns_loan_headers_all loan
10292: where loan.loan_id = p_loan_id;
10297: 'DIRECT', (select nvl(sum(disb_hdr.HEADER_AMOUNT), 0) from lns_disb_headers disb_hdr
10298: where disb_hdr.loan_id = loan.loan_id and
10299: disb_hdr.STATUS is null and
10300: (disb_hdr.PAYMENT_REQUEST_DATE is null or trunc(disb_hdr.PAYMENT_REQUEST_DATE) <= trunc(p_date))),
10301: 'ERS', (select nvl(sum(lines.REQUESTED_AMOUNT), 0) from lns_loan_lines lines
10302: where lines.loan_id = loan.loan_id and (lines.STATUS is null or lines.STATUS = 'PENDING') and
10303: lines.end_date is null))
10304: from lns_loan_headers_all loan
10305: where loan.loan_id = p_loan_id;
10310: 'DIRECT', loan.requested_amount + nvl(loan.ADD_REQUESTED_AMOUNT, 0) /* +
10311: (select nvl(sum(adj.ADJUSTMENT_AMOUNT), 0) from LNS_LOAN_AMOUNT_ADJS adj
10312: where adj.LOAN_ID = loan.loan_id and adj.STATUS = 'APPROVED' and
10313: trunc(adj.EFFECTIVE_DATE) <= trunc(p_date))*/,
10314: 'ERS', (select nvl(sum(lines.REQUESTED_AMOUNT), 0) from lns_loan_lines lines
10315: where lines.loan_id = loan.loan_id and (lines.STATUS is null or lines.STATUS = 'PENDING') and
10316: lines.end_date is null))
10317: from lns_loan_headers_all loan
10318: where loan.loan_id = p_loan_id;
10602: from
10603: (select p_from_date activity_date
10604: ,nvl(sum(REQUESTED_AMOUNT),0)
10605: ,3 display_order
10606: from lns_loan_lines
10607: where loan_id = p_loan_id
10608: and (status is null or status = 'PENDING')
10609: and end_date is null) lines,
10610: lns_loan_headers_all loan