Filtering the date for both sales and purchases will also not work, because a user could've bought something on the 1st of January for example, and just decided to sell it today.
I expect that at every sale you have to match with some purchases you're selling, usually the oldest (
but it's up to the user/your friend to choose; you need a clear rule here, else, if choosing randomly you can even get different result on each run), so, in 2013-06-11 (based on that data and the "oldest" logic) you should have nothing left from 1/1 to sell.
Unfortunately I don't know how to do this directly from SQL, I don't know how to add that much logic into that (maybe at/after/for counting in each buy/sell operation you should create new pair of temporary purchases and sales tables to work with?).
You may need actual code there.