i have to deduct the bill amount against a invoice made.

i have to deduct the bill amount against a invoice made.

 Actually i am buying the part from customer and value adding and again invoicing it to the same customer. Customer pays only for the service added. 
1. How i have to close the payment for the bill generated for part received from customer and 
2. How i have to close the invoice with payment receipt from customer and balance payment against bill raised.