if you are an 'investor' reporting your shares under CGT (capital gains tax), you must match up parcels since the only transactions you report in your tax return are in relation to shares sold
you can match a sale with any previous parcel bought. for example, you bought 100 MNS at 20 cents, 200 MNS at 50 cents & sold 150 MNS for $1. you can match the $1 sale with shares from either or both the 20 cent & 50 cent parcel
also, with CGT, you can obtain a 50% tax discount on shares sold after holding those shares for more than 12 months. however, there is a method for calculating your net capital gain. you add up all your gains, from that you subtract all your losses, including any prior year losses, then you apply the discount. at link:
if you are a 'trader' report your shares as a business on revenue account. you get no tax discount. you add up all your sales, subtract your opening stock & purchases, add your closing stock. Each share in your closing stock at 30/6 can be valued at the lower of cost price or market price (which reduces the tax payable)