That is similar to what my code does. Differences are that my code would have the channels in the order of:
Channel 1
Channel 2

Totals:

and my code uses a dialog interface, which I presumed you already had, since your code had dialog commands in it.

If you don't want it in a dialog, specify how you want the information displayed (ie: to all in channel, to you in channel, or some other method).

BTW: Please be careful when posting, you accidentally (I hope) posted your reply twice.