Published on : June 05, 2020

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

Frontend URL : https://loantap.in/banking/manage-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 IS NULL  OR loan_entries.field1 ='')
				

Description :

1) Get all records whose head is ‘Bank’
AND success_ref IS NULL
AND txn_ref IS NOT NULL
AND sublan_id NOT ‘LAN’
AND credit is greater then 0
AND field1 is empty
AND id are selected id’s
2) Joined to sublan table on sublan_id and get columns
Lapp_id

Columns Used In UI

From Lapp:
ecs_bank
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 Column have action link: open transaction page in new window

User Interaction based (UI):
Generate Login Disbursement Excel Sheet Button – To generate the excel sheet of selected loans to use for bank disbursal

Bank Download Queries:
//** Collect selected IDs **//
[template.set ids=”{request.selected_data}”/] 

Main 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	 
	AND (loan_entries.field1 IS NULL OR loan_entries.field1 ='')
	AND loan_entries.ID IN ([template.ids.comma.quote_comma/]) 

Update rows which downloaded :

UPDATE
	loan_entries 
SET 
	field1='bank-downloaded' 
WHERE 
	ID IN ([template.ids.comma.quote_comma/]) 
	AND loan_entries.sublan_id!='LAN'