Think about it a little bit first... How does a totalizer work? Can you draw it up in a flow chart or write an explanation of it???
Now, plc's really don't totalize an analog signal very well. It's an extremely difficult application to do accurately. Basically, what you want to do is to periodically take a look at the flow rate, calculate the volume over the time period, then add it to a totalizer. See any problem with that??? (What happens if the flow rate changes during the period...??) So, you take more readings more often. How accurate do you need to be? How fast can you tolerate to make the calculations?
Obviously, we don't know what flow meter you're using, but there's an easier way -- depending on the meter. Alot of flow meters can also be configured to give a pulse/volume. This makes it very easy -- you just count pulses. I.e. -- you need 1500 gallons in your batch. The flow meter is configured to give 1 pulse / 5 gallons. You simply count 500 pulses. This tends to be more accurate that having the PLC totalize.