The source is Shulchan Orech [code of Jewish law], Orech Chaim, Section
108. It is also discussed in Kitzur Shulchan Orech 21. The basic rule is:
If one
inadvertently missed or said incorrectly (e.g. he forgot Ya'aleh ve'yavo
on Rosh Chodesh morning) the Shemoneh Esrei he can make it up by repeating
Shemoneh Esrei by the next tefilah. For example if one missed Shacharis
he can repeat shemoneh esrei twice by Mincha. One can only make up a
tefilah in the tefilah which immediately follows it (Shacharis to Mincha
but not Maariv). This procedure only works if one missed the tefilah by
accident, if one skipped the tefilah on purpose then it will not. There
are a number of complications which can arise which require a more
extensive knowledge so I highly recommend you learn (or have someone
teach you) the Kitzur (or, even better, the Mishna Berura) that deals
with these halachos.
I have never heard of the " maxim that if you accidentally violate
Shabbos (the Sabbath) that one should give extra charity during the week"
but at best this is only a custom and it does not actually make up for the
violation whereas the procedure for making up for a missed Shemoneh Esrei
is Halacha and does indeed make up for the missed tefilah.
Lazer