Tracking sales and purchases for a customer who is also a supplier
You need two separate cards for this customer: one as a customer, and one as a supplier. Then, instead of actually paying and collecting money for these purchases and sales, it may be more convenient to apply debit and credit transactions to your payable and receivables accounts for this customer.
For the detailed procedure, see To track sales and purchases made with the same contact.