Payment to be Receive Issue

Dear Sir


We created a page, where users input  

Payment Receivable ...........Users input (say 10000)

Payment Received-.....I want to fetch the received amount  from customer ledger entry or customer card.while passing the bank receipt voucher.(say 5000)

Payment to be receivable:(Payment Receivable-Payment Received)------should be display-----5000.

Manual when we entry the amounts it is calculating. But i do not know how to like payment received amount to customer card or customer ledger entry. Also i want to drill down on payment received when users click on the like the ledger should be open.

Where and how to create the like and sort the issues.

Please do the needful