Published on : June 08, 2020

Backend URL : https://loantap.in/wp-admin/post.php?post=890115&action=edit

Frontend URL : https://loantap.in/banking/manage-suspense-bank-disburse/loantap_credit

Query :

SELECT 
	loan_entries.ID as data_id, 
	loan_entries.entry_date, 
	txn_set_id, 
	account, 
	credit, 
	reason, 
	lan_id, 
	sublan_id, 
	txn_ref, 
	nbfc, 
	sublan.meta_value as lapp_id
FROM 
	loan_entries 				
JOIN 
	sublan 
ON 
	loan_entries.sublan_id=sublan.object_id 
	AND sublan.coll_id='sublan' 
	AND sublan.meta_key="lapp_id"
WHERE                	
  loan_entries.head = 'Bank'	
  AND loan_entries.success_ref IS NULL 
  AND loan_entries.txn_ref IS NOT NULL 
  AND loan_entries.sublan_id!='LAN'
  AND loan_entries.credit > 0
  [if.not_empty env.search.nbfc]
	  AND  loan_entries.nbfc='[env.search.nbfc/]'               
  [/if.not_empty]
   AND loan_entries.field1='bank-downloaded' 

Description :

1) Get all records whose
head is ‘bank’
AND success_ref column is ‘NULL’
AND txn_ref column is NOT ‘NULL’
AND sublan_id is not ‘LAN’
AND credit is greater then 0
AND field1 is ‘bank-downloaded’
2) Joined to sublan table on sublan_id and get
Lapp_id
3) Filter data if NBFC provided in URL

Columns Used in UI:

Lapp:
ecs_cust_name
ecs_bank_acc_no
ecs_ifsc_code
ecs_bank_city
home_zipcode

Direct:
Sublan_id
Lan_id
Lapp_id,
Credit,
Account,
Reason
txn_ref
Nbfc
Entry_date

External action:
Sublan Id have action link: open transaction page in new window 
Update UTR form column
Reset action button

UTR Update

UPDATE 
	loan_entries 
SET 
	success_ref = '[template.success_ref/]' 
WHERE 
	ID = '[template.row_id/]' 
	AND txn_ref='[template.txn_ref/]' 
	AND sublan_id='[template.sublan_id/]' 
	AND loan_entries.sublan_id!='LAN'

Description :
Update Success_ref Column on matching ID, txn_ref, sublan_id Columns and sublan_id not ‘LAN’

Reset back to ready Query:

UPDATE 
	loan_entries
SET 
	field1=NULL
WHERE 
	ID ='[template.req.data-eid/]'
	AND loan_entries.sublan_id!='LAN'

Description :
Update field1 = NULL using matching ID column and sublan_id column is not ‘LAN’