Mark, this is a great question and one that I did some research on when I first starting getting into trading with TOS.
So if you buy 500 shares long, once you sell 100 shares that is recorded as 1 day trade. If you sell the rest in any faction whether is 1 trade to sell 400 shares or 4 trades, They are consider part of the 1 day trade.
If you buy 500 shares of the stock and then a second order you buy another 500 shares to make it 1,000 shares, when you sell the first 500 shares in any faction (let's say 3 trades) that's consider 1 day trade. If you sell 600 shares in one shot then that's consider 2 day trades. 500 will cover the first order and the 100 shares will cover part of the second order.
Hope this helps. There is a good article I read on this but I couldn't find it. If I do I will post it here.