example

table a table b table c 10000 pounds prd 1 prd 1 hour 1 shift 1 1200 hr 1 prd 2 230000 pounds prd 2 prd 1 hour 2 shift 1 10 hr 2 prd 1 prd 2 hour 1 shift 1 100 hr 3 prd 2 shift 2 100 hr 3 prd 2

i would need to subtract 230000 from table c where prd = 2 and shift 1 and subtract 10000 from table c where prd= 1 and shift 1 but the kicker is this needs to happen to each hour so in an 8 hour day i would need 10000 times which ever hour in the day it is by using table c entry and subtract table c amount for that hour and product from the running increment from table a

example:

10000 x 2 for 2 hours in the day for product 2 would be

20000 - 1300 for the 2 hours this is in the table