As Mickey said, this is easy and fairly common.
You just have to sample the flowrate measurement on some time interval, this will provide you the instantaneous flow rate. Simply accumulate this value. The trick is aligning the time units of your flowrate with the time units you are sampling.
Say you want to sample every 1 minute. If the flowrate is 300 gal/min, then after 1 minute your totalized flow is 300 gallons. After 2 minutes it is now 600 gallons, after 5 minutes it is 1500 gallons. Of course sampling every minute will be very erroneous especially if it is not a steady state, however it makes the totalization obvious w/o having to adjust for the time unit.
To adjust for the time unit, you just need to do some math prior to accumulating the instantaneous flowrate. If you wish to sample every 1/4 of a second (250ms) you need to convert the flowrate measurement from gal/min to gal/250ms. Then accumulate the result.
Depending on the PLC platform you may have to be aware of how you will trigger the time sample. For me, using a ControlLogix I would put the logic into a periodic task and set it to run at 250ms.
As Mickey mentioned, additional code will be required to reset, enable, hold the totalizer, depending on the requirements of the process. For example, if you have a recirculation loop with a flowmeter you may only need to totalize when certain valves are open which divert flow from the recirculation loop to the destination routes. So you have enable conditions, perhaps you don't reset it until the next delivery occurs, maybe you reset it right away. If you have an alarm occur during the process, and the valves close, the flowmeter will still be reading the recirculation flow and you need to 'hold' the current total until the delivery is resumed or the deliver is aborted.
With that said, I've been very accurate with batching applications and using 4-20mA with this method.