I, like bipolar nurse, came to a point where I realized that I could no longer work for an employer, and worked for myself. That worked ok for the last 10 years, as I could decide not to work when I was having a bad day. The last 18 months have been a real struggle and in the last month we (my wife and I) came to the realization that I could no longer work, even for myself.
Having said all that, you have been up til now holding down a job. That is something to be really proud of. You mention that the last four months have been a living hell, but before that you were a really good employee. With that in mind, it might be worth talking with your employer, and telling them how it is. Not only will it give them some insight into what is going on, but they maybe able to lighten your load for a while. It will also help them to see that you are aware of your behavior and it is not due to 'slacking off' but that you are seeking the necessary help and are hoping to get back ontop of things.
As far as your own health and gettting well again, its the same things as bipolar nurse mentioned. Surround yourself with a good team of people who can give you the medication and support you need, stick to your routines the best you can, practice mindfulness and other coping strategies, and most of all, give yourself a break. You are allowed to have depression, it is ok, and it is not always going to be like this.