Skip to content

Commit

Permalink
Nouveau format Export Filoue
Browse files Browse the repository at this point in the history
  • Loading branch information
bsongis committed Apr 27, 2021
1 parent c70e9d2 commit 033ee3e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
8 changes: 7 additions & 1 deletion database.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import bcrypt
from config import config

DB_VERSION = 130
DB_VERSION = 131

Base = declarative_base()

Expand Down Expand Up @@ -244,6 +244,8 @@ class Creche(Base):
tri_factures = Column(Integer, default=TRI_NOM)
smtp_server = Column(String)
caf_email = Column(String)
numero_caf = Column(String)
numero_dossier_afc = Column(String)
mode_accueil_defaut = Column(Integer, default=MODE_TEMPS_PARTIEL)
gestion_absences_non_prevenues = Column(Boolean, default=False)
gestion_maladie_sans_justificatif = Column(Boolean, default=False)
Expand Down Expand Up @@ -3176,6 +3178,10 @@ def translate(self):
if version < 130:
self.engine.execute("ALTER TABLE creche ADD email_changements_planning STRING")

if version < 131:
self.engine.execute("ALTER TABLE creche ADD numero_caf VARCHAR")
self.engine.execute("ALTER TABLE creche ADD numero_dossier_afc VARCHAR")

# update database version
version_entry.value = DB_VERSION
self.commit()
Expand Down
8 changes: 7 additions & 1 deletion generation/export_filoue.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ def execute(self, text):
result = [lines[0]]
template = lines[1]
for inscrit in database.creche.select_inscrits(self.start, self.end):
if not inscrit.famille.numero_allocataire_caf:
errors[GetPrenomNom(inscrit)] = [u"Le numéro d'allocataire CAF n'est pas renseigné"]
elif not inscrit.famille.numero_allocataire_caf.isdigit():
errors[GetPrenomNom(inscrit)] = [u"Le numéro d'allocataire CAF ne doit comporter que des chiffres"]
regime_caf = 3
heures_realisees = 0
heures_facturees = 0
Expand All @@ -74,6 +78,8 @@ def execute(self, text):
line = template
if facture:
fields = {
"numero-caf": database.creche.numero_caf,
"numero-dossier-afc": database.creche.numero_dossier_afc,
"top-allocataire": 1,
"prenom": inscrit.prenom,
"nom": inscrit.nom,
Expand All @@ -86,7 +92,7 @@ def execute(self, text):
"heures-realisees": "%04.02f" % heures_realisees,
"total-facture": "%06.02f" % total_facture,
"tarif-horaire": "%02.02f" % ((total_facture / heures_facturees) if heures_facturees else 0),
"taux-effort": ("%01.02f" % facture.taux_effort) if facture.taux_effort else None,
"taux-effort": ("%01.03f" % facture.taux_effort) if facture.taux_effort else None,
"premier-jour": max(self.start, min([contrat.debut for contrat in inscrit.get_inscriptions() if contrat.debut and not contrat.preinscription])).strftime("%d/%m/%Y"),
"dernier-jour": min(self.end, max([(contrat.GetFin() if contrat.GetFin() else self.end) for contrat in inscrit.get_inscriptions() if contrat.debut and not contrat.preinscription])).strftime("%d/%m/%Y"),
}
Expand Down
2 changes: 2 additions & 0 deletions panel_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ def __init__(self, parent):
grid_sizer.AddMany([wx.StaticText(self, -1, "E-mail :"), (AutoTextCtrl(self, database.creche, "email"), 0, wx.EXPAND)])
grid_sizer.AddMany([wx.StaticText(self, -1, "Serveur pour l'envoi d'emails :"), (AutoTextCtrl(self, database.creche, "smtp_server"), 0, wx.EXPAND)])
grid_sizer.AddMany([wx.StaticText(self, -1, "Email de la CAF :"), (AutoTextCtrl(self, database.creche, "caf_email"), 0, wx.EXPAND)])
grid_sizer.AddMany([wx.StaticText(self, -1, "Numéro CAF :"), (AutoTextCtrl(self, database.creche, "numero_caf"), 0, wx.EXPAND)])
grid_sizer.AddMany([wx.StaticText(self, -1, "Numéro dossier Sias AFC :"), (AutoTextCtrl(self, database.creche, "numero_dossier_afc"), 0, wx.EXPAND)])
type_structure_choice = AutoChoiceCtrl(self, database.creche, "type", items=TypesCreche)
self.Bind(wx.EVT_CHOICE, self.OnChangementTypeStructure, type_structure_choice)
grid_sizer.AddMany([wx.StaticText(self, -1, "Type :"), (type_structure_choice, 0, wx.EXPAND)])
Expand Down
4 changes: 2 additions & 2 deletions templates_dist/Export Filoue.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
TOP_ALLOC;MATRICULE;REGIME;DATE_NAISSANCE_INDIVIDU;CODE_POSTAL_FAMILLE;VILLE_FAMILLE;NOMBRE_HEURES_FACTUREES;NOMBRE_HEURES_REALISEES;MONTANT_FACTURE;MONTANT_HORAIRE;TAUX_EFFORT;PREMIERJOUR;DERNIERJOUR
<top-allocataire>;<matricule-allocataire>;<regime-caf>;<date-naissance>;<code-postal-famille>;<ville-famille>;<heures-facturees>;<heures-realisees>;<total-facture>;<tarif-horaire>;<taux-effort>;<premier-jour>;<dernier-jour>
NUMERO_CAF;NUMERO_DOSSIER_AFC;TOP_ALLOC;MATRICULE;REGIME;DATE_NAISSANCE_INDIVIDU;CODE_POSTAL_FAMILLE;VILLE_FAMILLE;NOMBRE_HEURES_FACTUREES;NOMBRE_HEURES_REALISEES;MONTANT_FACTURE;MONTANT_HORAIRE;TAUX_EFFORT;PREMIERJOUR;DERNIERJOUR
<numero-caf>;<numero-dossier-afc>;<top-allocataire>;<matricule-allocataire>;<regime-caf>;<date-naissance>;<code-postal-famille>;<ville-famille>;<heures-facturees>;<heures-realisees>;<total-facture>;<tarif-horaire>;<taux-effort>;<premier-jour>;<dernier-jour>
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
# You should have received a copy of the GNU General Public License
# along with Gertrude; if not, see <http://www.gnu.org/licenses/>.

VERSION = '1.22.36'
VERSION = '1.22.37'

0 comments on commit 033ee3e

Please sign in to comment.