To fix the negative inventory issue, you will need to either go through your data file and readjust the dates of the transactions to ensure that purchase transactions come before sales transactions.
...