Feature/inv rules from stockcounts

Sorry about the lack of tests and tmp code; fix it after demo i swear...