#!/bin/bash
-#psql bde -c "ALTER TABLE transactions DISABLE TRIGGER ALL;"
#psql bde -c "INSERT INTO transactions (conso, emetteur, destinataire, montant, quantite, valide, remarque) VALUES (1, 2850, 0, 35, 1, true, 'sweat ENS Z');"
#psql bde -c "INSERT INTO transactions (conso, emetteur, destinataire, montant, quantite, valide, remarque) VALUES (1, 3246, 3539, 94.72, 1, true, 'Pot A♡');"
#psql bde -c "INSERT INTO transactions (date, conso, emetteur, destinataire, montant, quantite, valide, remarque) VALUES ('2013-01-17 00:14:56', 44, 2822, 0, 2.00, 6, true, 'Pinte');"
+
+#psql bde -c "ALTER TABLE transactions DISABLE TRIGGER ALL;"
#psql bde -c "ALTER TABLE transactions ENABLE TRIGGER ALL;"
+connard=2187
+recepteur=2798
+quantite=1
+taxe=3.00
+randomreason='Sauce - Menu'
-psql bde -c "INSERT INTO transactions (conso, emetteur, destinataire, montant, quantite, valide, remarque) VALUES (1, 1814, 0, 39.85, 1, true, 'Vidage de note');"
+psql bde -c "UPDATE adherents SET solde=solde + 500 WHERE numcbde = ${connard};"
+psql bde -c "INSERT INTO transactions (conso, emetteur, destinataire, montant, quantite, valide, remarque) VALUES (1, ${connard}, ${recepteur}, ${taxe}, ${quantite}, true, '${randomreason}');"
+psql bde -c "UPDATE adherents SET solde=solde - 500 WHERE numcbde = ${connard};"