If you can't do all the necessary updates in a single transaction, you'll need an administrative procedure (as opposed to a declarative constraint) to make sure the data is right. For example, you can run a cron job that tests the totals against the details. How often you do that depends on how long the cron job takes to run, and how long a cron job your application can tolerate.
I'd prefer a trigger on the detail table plus a periodic cron job. Let the trigger adjust the total for each transaction. The cron job makes sure no updates were missed. (Most dbms will let you disable triggers for maintenance; the cron job will remind you when you've inevitably forgotten to enable them again.)