ajout chantier_lookup.pt
This commit is contained in:
@@ -26,48 +26,37 @@ def get_users_agenda(request):
|
||||
results = request.dbsession.execute(query).fetchall()
|
||||
return results
|
||||
|
||||
def get_table(code):
|
||||
if code == 'DD':
|
||||
table = 'dem_devis'
|
||||
elif code == 'OS':
|
||||
table = 'ordres'
|
||||
else:
|
||||
table = 'rdvous'
|
||||
return table
|
||||
|
||||
def get_table_details(code):
|
||||
if code == 'DD':
|
||||
table = 'dem_lig'
|
||||
elif code == 'OS':
|
||||
table = 'ordres_lig'
|
||||
else:
|
||||
table = 'rdvous_lig'
|
||||
return table
|
||||
|
||||
|
||||
def get_dossier_by_no(request,nodossier):
|
||||
societe = nodossier[0:2]
|
||||
table = get_table(nodossier[3:5])
|
||||
no_id = nodossier[6:]
|
||||
no_id = nodossier[3:]
|
||||
query = """
|
||||
SELECT d.*, c.*, a.NOM as nom_cabinet, e.NOM as nom_expert FROM %s d
|
||||
SELECT d.*, c.*, a.NOM as nom_cabinet, e.NOM as nom_expert FROM dem_devis d
|
||||
INNER JOIN clients c ON d.societe = c.societe and d.cd_cli = c.cd_cli
|
||||
INNER JOIN p_cabinet a ON d.cabinet = a.code
|
||||
INNER JOIN p_experts e ON d.cabinet = e.code_cab and d.expert = e.code_exp
|
||||
where d.societe = '%s' and d.no_id=%s;""" % (table, societe, no_id);
|
||||
where d.societe = '%s' and d.no_id=%s;""" % (societe, no_id);
|
||||
results = request.dbsession.execute(query).first()
|
||||
return results
|
||||
|
||||
def get_dossier_rdv_by_no(request,nodossier, nolig):
|
||||
societe = nodossier[0:2]
|
||||
table = get_table_details(nodossier[3:5])
|
||||
no_id = nodossier[6:]
|
||||
no_id = nodossier[3:]
|
||||
|
||||
if nolig == '0':
|
||||
query = "SELECT * FROM %s where societe = '%s' and no_id=%s;" % (table, societe, no_id)
|
||||
query = "SELECT * FROM dem_lig where societe = '%s' and no_id=%s;" % (societe, no_id)
|
||||
results = request.dbsession.execute(query).fetchall()
|
||||
else:
|
||||
query = "SELECT * FROM %s where societe = '%s' and no_id=%s and nolig=%s;" % (table, societe, no_id, nolig)
|
||||
query = "SELECT * FROM dem_lig where societe = '%s' and no_id=%s and nolig=%s;" % (societe, no_id, nolig)
|
||||
results = request.dbsession.execute(query).first()
|
||||
|
||||
return results
|
||||
|
||||
def get_documents_byChantier(request,nodossier):
|
||||
societe = nodossier[0:2]
|
||||
no_id = nodossier[3:]
|
||||
|
||||
query = "CALL spGET_DOSSIERS_byNumeo('%s',%s);" % (societe, no_id)
|
||||
results = request.dbsession.execute(query).fetchall()
|
||||
return results
|
||||
|
||||
def get_rendez_vous(request, itc):
|
||||
@@ -77,7 +66,7 @@ def get_rendez_vous(request, itc):
|
||||
datedeb = d.strftime('%Y-%m-01')
|
||||
|
||||
# lire les rdv de l'ITC
|
||||
query = """SELECT CONCAT(l.societe,"-DD-",l.no_id) as nodossier, l.rdv_debut, l.rdv_fin, e.c_nom FROM dem_lig l
|
||||
query = """SELECT CONCAT(l.societe,"-",l.no_id) as nodossier, l.rdv_debut, l.rdv_fin, e.c_nom FROM dem_lig l
|
||||
INNER JOIN dem_devis e ON l.societe=e.societe AND l.no_id=e.no_id
|
||||
WHERE l.datevi >= :datedeb AND l.liste=:itc ORDER BY l.datevi, l.heurevi
|
||||
"""
|
||||
@@ -86,16 +75,14 @@ def get_rendez_vous(request, itc):
|
||||
|
||||
def delete_rdv(request, nodossier, nolig):
|
||||
societe = nodossier[0:2]
|
||||
table = get_table_details(nodossier[3:5])
|
||||
no_id = nodossier[6:]
|
||||
no_id = nodossier[3:]
|
||||
|
||||
query = "DELETE FROM %s where societe = '%s' and no_id=%s and nolig=%s;" % (table, societe, no_id, nolig)
|
||||
query = "DELETE FROM dem_lig where societe = '%s' and no_id=%s and nolig=%s;" % (societe, no_id, nolig)
|
||||
execute_query(request, query, {})
|
||||
|
||||
def update_rdv(request, nodossier, nolig, comment, commentvi, date_rdv):
|
||||
societe = nodossier[0:2]
|
||||
table = get_table_details(nodossier[3:5])
|
||||
no_id = nodossier[6:]
|
||||
no_id = nodossier[3:]
|
||||
|
||||
# formater les champs
|
||||
ddate = datetime.strptime(date_rdv, '%d-%m-%Y %H:%M')
|
||||
@@ -104,9 +91,9 @@ def update_rdv(request, nodossier, nolig, comment, commentvi, date_rdv):
|
||||
auj = date.today().strftime("%Y-%m-%d")
|
||||
|
||||
if nolig == '0':
|
||||
query = "INSERT INTO %s SET societe='%s',no_id=%s,date='%s',datevi='%s',heurevi='%s',comment='%s',commentvi='%s'" % (table, societe, no_id,auj,datevi, heurevi, comment, commentvi)
|
||||
query = "INSERT INTO dem_devis SET societe='%s',no_id=%s,date='%s',datevi='%s',heurevi='%s',comment='%s',commentvi='%s'" % (societe, no_id,auj,datevi, heurevi, comment, commentvi)
|
||||
else:
|
||||
query = "UPDATE %s SET datevi='%s', heurevi='%s', comment='%s', commentvi='%s' where societe = '%s' and no_id=%s and nolig=%s;" % (table, datevi, heurevi, comment, commentvi, societe, no_id, nolig)
|
||||
query = "UPDATE dem_ligs SET datevi='%s', heurevi='%s', comment='%s', commentvi='%s' where societe = '%s' and no_id=%s and nolig=%s;" % (datevi, heurevi, comment, commentvi, societe, no_id, nolig)
|
||||
|
||||
execute_query(request, query, {})
|
||||
|
||||
|
||||
@@ -81,3 +81,9 @@ def delete_membre(request, cd_uti):
|
||||
query = "DELETE FROM p_users WHERE cd_uti = :cd_uti ;"
|
||||
execute_query(request, query, {'cd_uti': cd_uti})
|
||||
|
||||
def get_chantiers_byName(request, societe, name, tous):
|
||||
|
||||
query = "CALL spGET_CHANTIERS_byName('%s','%s');" % (societe, name)
|
||||
results = request.dbsession.execute(query).fetchall()
|
||||
return results
|
||||
|
||||
|
||||
Reference in New Issue
Block a user