|
|
@@ -8,7 +8,7 @@ from datetime import datetime
|
|
|
import logging
|
|
|
import sys
|
|
|
|
|
|
-from path import Path
|
|
|
+from path import Path # @UnusedImport
|
|
|
|
|
|
from core import logconf
|
|
|
from core.pde import FacturesDb, AnalytiqueDb, CommunDb, EnTete, Ligne
|
|
|
@@ -41,10 +41,10 @@ commun_db = CommunDb(autocommit=False)
|
|
|
Sql = SqlFormatter()
|
|
|
|
|
|
current = "{:%m/%Y}".format(datetime.now())
|
|
|
-# mois_facturation = input("Veuillez renseigner le mois de facturation [defaut: {}] ('q' pour quitter): ".format(current)) # Format: voir avec jacky
|
|
|
-# if mois_facturation == 'q':
|
|
|
-# sys.exit(1)
|
|
|
-mois_facturation = "01/2018"
|
|
|
+
|
|
|
+mois_facturation = input("Veuillez renseigner le mois de facturation [defaut: {}] ('q' pour quitter): ".format(current)) # Format: voir avec jacky
|
|
|
+if mois_facturation == 'q':
|
|
|
+ sys.exit(1)
|
|
|
|
|
|
sql = """SELECT * FROM tbl_Tarification
|
|
|
WHERE strStatut='A facturer'
|
|
|
@@ -138,10 +138,13 @@ for affaireId, interventions in a_facturer.items():
|
|
|
|
|
|
# Commentaires
|
|
|
entete.memObsEntete = "[Mois : {mois_facturation}]\r\n" \
|
|
|
- "[Lieu de travail : ]{affaire.strLieux}\r\n" \
|
|
|
- "[V/Cde : ] {affaire.Ref} du {affaire.dtmCommande:%d/%m/%Y}\r\n" \
|
|
|
+ "[Lieu de travail : ]{strLieux}\r\n" \
|
|
|
+ "[V/Cde : ] {Ref} du {dtmCommande}\r\n" \
|
|
|
"".format(mois_facturation=mois_facturation,
|
|
|
- affaire=affaire)
|
|
|
+ strLieux=affaire.strLieux,
|
|
|
+ Ref=affaire.Ref,
|
|
|
+ dtmCommande="{:%d/%m/%Y}".format(affaire.dtmCommande) if affaire.dtmCommande else "",
|
|
|
+ )
|
|
|
|
|
|
entete.memObsInterne = "N° Affaire analytique : {}".format(affaire.strLiaisonControle)
|
|
|
|
|
|
@@ -172,9 +175,13 @@ for affaireId, interventions in a_facturer.items():
|
|
|
|
|
|
ligne.dblQte = interv.dblQuantite
|
|
|
|
|
|
- unite = commun_db.first("SELECT * FROM tblUnite WHERE strUniteCourt='{}'".format(interv.strUnite))
|
|
|
- ligne.bytUniteIdQuantite = unite.bytUniteId
|
|
|
- ligne.bytUniteIdPrix = unite.bytUniteId
|
|
|
+ if interv.strUnite:
|
|
|
+ unite = commun_db.first("SELECT * FROM tblUnite WHERE strUniteCourt='{}'".format(interv.strUnite))
|
|
|
+ ligne.bytUniteIdQuantite = unite.bytUniteId
|
|
|
+ ligne.bytUniteIdPrix = unite.bytUniteId
|
|
|
+ else:
|
|
|
+ ligne.bytUniteIdQuantite = 0
|
|
|
+ ligne.bytUniteIdPrix = 0
|
|
|
ligne.dblPUhtBrutDev = interv.dblPrixUnitaire
|
|
|
ligne.dblPUhtNetDev = interv.dblPrixUnitaire
|
|
|
ligne.dblPThtNetDev = interv.dblPrixTotal
|