All you have to do is deposit the money in your bank and record Bank $5000(DR), Revenue $5000(CR).
When preparing your P/L, the account will look like below"
Dr. COGS $4950
Dr. Acct Recv. $50
CR Revenue $5000
2nd case
Dr COGS $4850
Dr. Discount given $100
Dr. Acct Recv. $50
Cr.Revenue $5000
The above suggestion applies to small business not subject to IFRS rules.
Balance Sheeet.
Asumming you deposit the money in your bank in case 1 above:
Dr Bank $5000
CR Inventory 5000
When you write a cheque of $4950 to pay Sunuco,after deducting your $50, bank decerease by $4950(CR), Current liability decrease by $5000(DR), Acct recev decerase by 50(CR).
U can address the discount issue the same way. depending on how your account is set up. It could be a reduction in revenue or just as expence. either way just cut $4850 for Sunuco'