Try and search the forum this question has been asked a few times, most recently 3 days ago when i answered another post
See the post below containing a link to emres post of a tutorial that does exactly what you want, just amend for it to work on your settle button or wherever it is you want it to happen
Surely you want to print a receipt after bill is paid everytime unless the customer doesnt want a copy? Not because youve already printed a bill
A bill and receipt and two different things, the bill informs the customer what they owe, a receipt shows the customer they have paid for their order with details if payment type and change etc