Kailath loan serial number issue

From Origami_Wiki
Jump to navigation Jump to search

The client has reported that the serial number/receipt number displayed in the release slip in Kailath is showing as NA. The solution is to regenerate the serial number for all loans in all the branches. The query for regenerating the serial number for a single branch is as follows

<source lang="sql" highlight="3"> UPDATE erp_goldloan SET goldloan_sl_no = slnoranks.row_num FROM (SELECT *, ROW_NUMBER() OVER(ORDER BY goldloan_releasedate ASC, t_modified ASC) row_num FROM erp_goldloan WHERE deleted=0 AND goldloan_status!=0 AND t_modified IS NOT NULL AND goldloan_branchid=28 AND goldloan_releasedate >='2018-04-01 00:00:00' AND goldloan_releasedate <='2019-03-30 23:59:59') slnoranks WHERE erp_goldloan.goldloan_id=slnoranks.goldloan_id; </source>

It must be noted that the serial number will be reset to 1 at the start of every financial year.