-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathWriteoff Small Balance.sql
More file actions
27 lines (20 loc) · 1.6 KB
/
Writeoff Small Balance.sql
File metadata and controls
27 lines (20 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
SELECT loanacct_payments_due.row_id, loanacct_payments_due.acctrefno, loanacct_payments_due.payment_number, loanacct_payments_due.payment_amount,
loanacct_payments_due.payment_remaining, loanacct.loan_number, loanacct.current_principal_balance, loanacct.status_code_no
FROM loanacct_payments_due INNER JOIN
loanacct ON loanacct_payments_due.acctrefno = loanacct.acctrefno
where current_principal_balance < '10.01' and current_principal_balance >='0.01'-- and status_code_no ='0'
Select '<NLS>'
union all
SELECT '<TRANSACTIONS >' +
'<TRANSACTIONCODE TransactionCode="440" ' +
'LoanNumber="' + loan_number + '" ' +
'EffectiveDate="' + CONVERT(VARCHAR(20), open_date, 101) + '" ' +
'Amount="' + Cast(loanacct.current_principal_balance as varchar(30)) + '"' +
'UserDefined1="CLOSE LOAN" ' +
'/>' +
'</TRANSACTIONS>'
FROM loanacct_payments_due INNER JOIN
loanacct ON loanacct_payments_due.acctrefno = loanacct.acctrefno
where current_principal_balance < '10.01' and >= '0.00' and status_code_no ='0' and loan_number = 'LoanNumber'
union all
Select '</NLS>'