[verb (ば-form)] + それまでだ [verb た-form] + ら + それまでだ [sentence] + と言えば / と言ってしまえば + それまでだ
ばそれまでだ and たらそれまでだ say that if one thing happens, that is the end: everything before it counts for nothing and there is no going back. それまで is "up to that point and no further". The verb takes the ば-form or the た-form with ら, and the two mean the same.
The sentence is usually a warning or a resigned remark, and the first half often sets up what would be wasted: いくらから~ても, どんなに〜~ても, せっかく〜~ても.
Without the conditional, the sentence does not hold together.
With が, the sentence admits the worst case and then goes on anyway.
After といえば言えば or といってしまえば言ってしまえば, it means "you could sum it up that way and close the subject", and the が goes on to say there is more to it.
ばそれまでだ is written or formal; たらそれまでだ is the one you hear in serious talk. The polite form is それまでです. In casual conversation, 〜~たらおわり終わりだ or 〜~たらおしまいだ say the same thing.