

SELECT jreceipt.jobcard_no,jreceipt.receipt_no,jreceipt.receipt_dt,jreceipt.amount,jreceipt.Bill_no,;
	jreceipt.cheque_no,jreceipt.bank_nam,(receipt.othrAdjAmt + jreceipt.amount + job_mast.amt_remain) as amount_remain,;
	job_mast.amt_remain as eff_remain,job_mast.bill_amt,receipt.othrAdjAmt,NVL(transect.detail,SPACE(254))as detail,;
	client.client,NVL(ledger.account,SPACE(40)) as client_ac,NVL(ledger_a.account,SPACE(40)) as bank_ac,;
	NVL(ledger_b.account,SPACE(40)) as adj_ac;
FROM jreceipt JOIN job_mast ON jreceipt.jobcard_no = job_mast.jobcard_no ;
	JOIN client ON jreceipt.client_no = client.client_no ;
	left  join ledger ON jreceipt.credit_ac = ledger.account_no;
	left join transect on jreceipt.receipt_no = transect.voucher_no ; 
	left join ledger ledger_a jreceipt.debit_ac = ledger_a.account_no;
	left join ledger ledger_b jreceipt.othradj_ac = ledger_b.account_no;
order by jreceipt.receipt_dt;
into cursor query
		
	
	
	WHERE source = 'JMR' AND voucher_no = lcreceipt_no ;
	