We had accounting jokes about drinking too much. Credit stomach, debit pavement 
Re your question, during the course of the year you'll have already debited the BS by net profits, each time you make an entry (e.g. Credit revenue Debit debtors/cash). At the end of the year in your computer software we just need to move the current year p&l out of current year earnings (already shown within equity as a net credit) and move it into another equity account called retained earnings b/f. Therefore debit current year earnings to bring it to zero (ready for the new year's transactions) and debit b/f retained earnings.
I love T accounts. I still resort to them every now and then 20 years after doing my exams.