Feature/inv rules from stockcounts

Sorry about the lack of tests and tmp code; fix it after demo i swear... closes item:398 refs item:378