60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
description TEXT NULL,
amount INTEGER NULL,
formula TEXT NULL, -- Formule de calcul du montant de la cotisation, si cotisation dynamique (exemple : membres.revenu_imposable * 0.01)
id_service INTEGER NOT NULL REFERENCES services (id) ON DELETE CASCADE,
id_account INTEGER NULL REFERENCES acc_accounts (id) ON DELETE SET NULL CHECK (id_account IS NULL OR id_year IS NOT NULL), -- NULL if fee is not linked to accounting, this is reset using a trigger if the year is deleted
id_year INTEGER NULL REFERENCES acc_years (id) ON DELETE SET NULL -- NULL if fee is not linked to accounting
);
CREATE TABLE IF NOT EXISTS services_users
-- Enregistrement des cotisations et activités
(
id INTEGER NOT NULL PRIMARY KEY,
id_user INTEGER NOT NULL REFERENCES membres (id) ON DELETE CASCADE,
|
|
>
|
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
description TEXT NULL,
amount INTEGER NULL,
formula TEXT NULL, -- Formule de calcul du montant de la cotisation, si cotisation dynamique (exemple : membres.revenu_imposable * 0.01)
id_service INTEGER NOT NULL REFERENCES services (id) ON DELETE CASCADE,
id_account INTEGER NULL REFERENCES acc_accounts (id) ON DELETE SET NULL CHECK (id_account IS NULL OR id_year IS NOT NULL), -- NULL if fee is not linked to accounting, this is reset using a trigger if the year is deleted
id_year INTEGER NULL REFERENCES acc_years (id) ON DELETE SET NULL, -- NULL if fee is not linked to accounting
id_analytical INTEGER NULL REFERENCES acc_accounts (id) ON DELETE SET NULL
);
CREATE TABLE IF NOT EXISTS services_users
-- Enregistrement des cotisations et activités
(
id INTEGER NOT NULL PRIMARY KEY,
id_user INTEGER NOT NULL REFERENCES membres (id) ON DELETE CASCADE,
|