After making sales invoices we make delivery notes so must take directly quantity of sales invoice when we put sales invoices or customer name
Please do not duplicate questions in different topics. See my response to your other question about purchase orders, purchase invoices, and goods receipts. The answer is the same.