31082024
parent
c33426eb74
commit
2b1d9ed044
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="dddqsdddd">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="dddqsddddss">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dashbord_queries/BPF.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/BPF.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||
|
@ -74,13 +74,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00335" summary="ss">
|
||||
<created>1718903703379</created>
|
||||
<option name="number" value="00335" />
|
||||
<option name="presentableId" value="LOCAL-00335" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1718903703380</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00336" summary="21/06/24 - 22h30">
|
||||
<created>1719001828472</created>
|
||||
<option name="number" value="00336" />
|
||||
|
@ -417,7 +410,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1725013352921</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="384" />
|
||||
<task id="LOCAL-00384" summary="dddqsddddss">
|
||||
<created>1725026643840</created>
|
||||
<option name="number" value="00384" />
|
||||
<option name="presentableId" value="LOCAL-00384" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1725026643840</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="385" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -459,7 +459,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="30/07/2024 - 12h" />
|
||||
<MESSAGE value="31/07/2024 - 17h30" />
|
||||
<MESSAGE value="01/08/2024 - 17h30" />
|
||||
<MESSAGE value="02/08/2024 - 12h" />
|
||||
|
@ -484,6 +483,7 @@
|
|||
<MESSAGE value="dddqsd" />
|
||||
<MESSAGE value="dddqsdd" />
|
||||
<MESSAGE value="dddqsdddd" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="dddqsdddd" />
|
||||
<MESSAGE value="dddqsddddss" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="dddqsddddss" />
|
||||
</component>
|
||||
</project>
|
|
@ -128,9 +128,11 @@ def Get_Qery_Generate_BPF_From_partner_invoice_header(diction):
|
|||
On recherche le CA venant des client : is_client = 1, is_financeur != 1
|
||||
|
||||
"""
|
||||
C1_qery_match = {'$and': [{"partner_owner_recid": str(my_partner['recid'])},
|
||||
{"valide": '1'},
|
||||
|
||||
C1_qery_match = {'$and': [
|
||||
{"valide": '1', 'invoice_header_type': 'facture',
|
||||
'credit_note_ref': {'$exists': False},
|
||||
"partner_owner_recid": str(my_partner['recid'])
|
||||
},
|
||||
{
|
||||
'mysy_invoice_date': {'$gte': filt_periode_start_date_ISODATE,
|
||||
'$lte': filt_periode_end_date_ISODATE}}, ]}
|
||||
|
@ -151,12 +153,9 @@ def Get_Qery_Generate_BPF_From_partner_invoice_header(diction):
|
|||
}
|
||||
},
|
||||
|
||||
{'$match': {'invoice_header_type': 'facture',
|
||||
'credit_note_ref': {'$exists': False},
|
||||
'order_header_is_client':'1', 'order_header_is_company':'1',
|
||||
'invoice_header_ref_interne': {
|
||||
'$in': ['Invoice_588', 'Invoice_589', 'Invoice_590', 'Invoice_591', 'Invoice_592',
|
||||
'Invoice_593', 'Invoice_594', 'Invoice_595']}}},
|
||||
{'$match': C1_qery_match
|
||||
|
||||
},
|
||||
{'$lookup': {
|
||||
'from': 'partner_invoice_line_detail',
|
||||
"let": {"invoice_header_id": {'$toString': "$_id"},
|
||||
|
@ -219,10 +218,7 @@ def Get_Qery_Generate_BPF_From_partner_invoice_header(diction):
|
|||
}
|
||||
},
|
||||
|
||||
{'$match': {'invoice_header_type': 'facture',
|
||||
'credit_note_ref': {'$exists': False},
|
||||
'invoice_header_ref_interne': {
|
||||
'$in': ['Invoice_588', 'Invoice_589', 'Invoice_590', 'Invoice_591', 'Invoice_592', 'Invoice_593', 'Invoice_594', 'Invoice_595' ]} } },
|
||||
{'$match': C1_qery_match },
|
||||
{'$lookup': {
|
||||
'from': 'partner_invoice_line_detail',
|
||||
"let": {"invoice_header_id": {'$toString': "$_id"},
|
||||
|
@ -355,10 +351,8 @@ def Get_Qery_Generate_BPF_From_partner_invoice_header(diction):
|
|||
}
|
||||
},
|
||||
|
||||
{'$match': {'invoice_header_type': 'facture',
|
||||
'credit_note_ref': {'$exists': False},
|
||||
'invoice_header_ref_interne': {
|
||||
'$in': ['Invoice_588', 'Invoice_589', 'Invoice_590', 'Invoice_591', 'Invoice_592', 'Invoice_593', 'Invoice_594', 'Invoice_595' ]} } },
|
||||
{'$match': C1_qery_match
|
||||
},
|
||||
{'$lookup': {
|
||||
'from': 'partner_invoice_line_detail',
|
||||
"let": {"invoice_header_id": {'$toString': "$_id"},
|
||||
|
@ -465,12 +459,7 @@ def Get_Qery_Generate_BPF_From_partner_invoice_header(diction):
|
|||
}
|
||||
},
|
||||
|
||||
{'$match': {'invoice_header_type': 'facture',
|
||||
'credit_note_ref': {'$exists': False},
|
||||
'order_header_is_company': '0',
|
||||
'invoice_header_ref_interne': {
|
||||
'$in': ['Invoice_588', 'Invoice_589', 'Invoice_590', 'Invoice_591', 'Invoice_592',
|
||||
'Invoice_593', 'Invoice_594', 'Invoice_595']}}},
|
||||
{'$match': C1_qery_match},
|
||||
{'$lookup': {
|
||||
'from': 'partner_invoice_line_detail',
|
||||
"let": {"invoice_header_id": {'$toString': "$_id"},
|
||||
|
@ -573,18 +562,18 @@ def Get_Qery_Generate_BPF_From_partner_invoice_header(diction):
|
|||
{'$eq': ['$rh_id', '$$rh_id']},
|
||||
{'$eq': ['$partner_owner_recid', '$$rh_partner_owner_recid']},
|
||||
|
||||
{"$or":
|
||||
{"$and":
|
||||
[
|
||||
{'$and':[
|
||||
{'$gte': [{'$toDate': "$mysy_contrat_date_debut"}, filt_periode_start_date_ISODATE]},
|
||||
{'$lt': [{'$toDate': "$mysy_contrat_date_debut"}, filt_periode_end_date_ISODATE]}
|
||||
]
|
||||
},
|
||||
{'$and':[
|
||||
{'$gt': [{'$toDate': "$mysy_contrat_date_fin"}, filt_periode_start_date_ISODATE]},
|
||||
{'$lte': [{'$toDate': "$mysy_contrat_date_fin"}, filt_periode_end_date_ISODATE]}
|
||||
]
|
||||
},
|
||||
{"$gt": [
|
||||
{
|
||||
"$toDate": "$mysy_contrat_date_fin"
|
||||
},filt_periode_start_date_ISODATE
|
||||
]},
|
||||
{"$lt": [
|
||||
{
|
||||
"$toDate": "$mysy_contrat_date_debut"
|
||||
},filt_periode_end_date_ISODATE
|
||||
]},
|
||||
|
||||
],
|
||||
|
||||
|
@ -614,6 +603,24 @@ def Get_Qery_Generate_BPF_From_partner_invoice_header(diction):
|
|||
'from': 'agenda',
|
||||
"let": {"rh_id": {'$toString': "$_id"}, 'rh_partner_owner_recid': '$partner_recid'},
|
||||
'pipeline': [
|
||||
{
|
||||
"$addFields": {
|
||||
"agenda_event_date_debut": {
|
||||
"$dateFromString": {
|
||||
'dateString': {"$substr": ["$event_start", 0, 10]},
|
||||
"format": "%Y-%m-%d"
|
||||
}
|
||||
},
|
||||
"agenda_event_date_fin": {
|
||||
"$dateFromString": {
|
||||
'dateString': {"$substr": ["$event_end", 0, 10]},
|
||||
"format": "%Y-%m-%d"
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
{'$match':
|
||||
{'$expr':
|
||||
{'$and':
|
||||
|
@ -623,6 +630,8 @@ def Get_Qery_Generate_BPF_From_partner_invoice_header(diction):
|
|||
{'$eq': ["$related_collection_recid", '$$rh_id']},
|
||||
{'$eq': ["$partner_owner_recid", '$$rh_partner_owner_recid']},
|
||||
{'$eq': ["$event_type", 'planning']},
|
||||
{'$gte': [{'$toDate': "$agenda_event_date_debut"},filt_periode_start_date_ISODATE]},
|
||||
{'$lt': [{'$toDate': "$agenda_event_date_fin"}, filt_periode_end_date_ISODATE]}
|
||||
|
||||
]
|
||||
}
|
||||
|
@ -647,12 +656,13 @@ def Get_Qery_Generate_BPF_From_partner_invoice_header(diction):
|
|||
print(" ### E_pipe_qry_ressource_humaine__ressource_humaine_contrat = ", E_pipe_qry_ressource_humaine__ressource_humaine_contrat)
|
||||
for retval in MYSY_GV.dbname['ressource_humaine'].aggregate(
|
||||
E_pipe_qry_ressource_humaine__ressource_humaine_contrat):
|
||||
|
||||
#print(" ### retval (employé ayant un contrat valide) = ", retval)
|
||||
formateur_id = str(retval['_id'])
|
||||
formateur_data = str(retval['nom']) + " " + str(retval['prenom']) + " - " + str(retval['email']) + " - " + str(retval['_id'])
|
||||
formateur_contrat_type = ""
|
||||
if( "collection_ressource_humaine_contrat" in retval.keys() and "type_contrat" in retval['collection_ressource_humaine_contrat'].keys()):
|
||||
formateur_contrat_type = retval['collection_ressource_humaine_contrat']
|
||||
formateur_contrat_type = retval['collection_ressource_humaine_contrat']["type_contrat"]
|
||||
|
||||
|
||||
total_duration = 0
|
||||
|
@ -676,7 +686,6 @@ def Get_Qery_Generate_BPF_From_partner_invoice_header(diction):
|
|||
|
||||
formateur_data = formateur_data+" - Nb_heure = "+str(total_duration)+" heure "
|
||||
|
||||
|
||||
if( formateur_contrat_type and formateur_contrat_type in ['vacataire', 'vacataire_qty']):
|
||||
if( formateur_id not in tab_formateur_rh_id_sous_traitant ):
|
||||
tab_formateur_rh_id_sous_traitant.append(str(retval['_id']))
|
||||
|
@ -689,6 +698,7 @@ def Get_Qery_Generate_BPF_From_partner_invoice_header(diction):
|
|||
tab_formateur_rh_interne_nom_prenom_mail.append(str(formateur_data))
|
||||
tab_formateur_rh_interne_total_heure = tab_formateur_rh_interne_total_heure + total_duration
|
||||
|
||||
|
||||
"""
|
||||
RetObject['tab_formateur_rh_id_interne'] = tab_formateur_rh_id_interne
|
||||
RetObject['tab_formateur_rh_interne_nom_prenom_mail'] = tab_formateur_rh_interne_nom_prenom_mail
|
||||
|
@ -746,6 +756,7 @@ def Get_Qery_Generate_BPF_From_partner_invoice_header(diction):
|
|||
{'$eq': ["$valide", "1"]},
|
||||
{'$eq': ["$partner_owner_recid", '$$partner_owner_recid']},
|
||||
{'$gte': [{'$toDate': "$mysy_date_debut_session"}, filt_periode_start_date_ISODATE]},
|
||||
{'$lt': [{'$toDate': "$mysy_date_debut_session"}, filt_periode_end_date_ISODATE]},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -836,7 +847,7 @@ def Get_Qery_Generate_BPF_From_partner_invoice_header(diction):
|
|||
|
||||
|
||||
for retval in MYSY_GV.dbname['inscription'].aggregate(F1_pipe_qry_stagiaire_par_class_level):
|
||||
print(" ### retval = ", retval)
|
||||
#print(" ### retval = ", retval)
|
||||
node = {}
|
||||
|
||||
node['Class_Level_Desc'] = retval['_id']['Class_Level_Desc']
|
||||
|
@ -883,6 +894,8 @@ def Get_Qery_Generate_BPF_From_partner_invoice_header(diction):
|
|||
{'$eq': ["$partner_owner_recid", '$$partner_owner_recid']},
|
||||
{'$gte': [{'$toDate': "$mysy_date_debut_session"},
|
||||
filt_periode_start_date_ISODATE]},
|
||||
{'$lt': [{'$toDate': "$mysy_date_debut_session"},
|
||||
filt_periode_end_date_ISODATE]},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -903,7 +916,7 @@ def Get_Qery_Generate_BPF_From_partner_invoice_header(diction):
|
|||
'localField': 'session_formation_collection.class_internal_url',
|
||||
'foreignField': 'internal_url',
|
||||
"pipeline": [
|
||||
{'$project': {'title': 1, 'internal_url': 1, 'external_code': 1, 'published': 1,
|
||||
{'$project': {'_id':1, 'title': 1, 'internal_url': 1, 'external_code': 1, 'published': 1,
|
||||
'duration': 1, 'duration_unit': 1, 'class_level': 1, 'partner_owner_recid':1}},
|
||||
{'$match': {'class_level': str(retval['_id']['Class_Level_Code']) , 'partner_owner_recid': str(my_partner['recid'])}},
|
||||
|
||||
|
@ -920,34 +933,57 @@ def Get_Qery_Generate_BPF_From_partner_invoice_header(diction):
|
|||
|
||||
|
||||
])
|
||||
print(" ### pipe_concerned_class = ", pipe_concerned_class)
|
||||
#print(" ### pipe_concerned_class = ", pipe_concerned_class)
|
||||
|
||||
tab_class_info = []
|
||||
tab_class_id = []
|
||||
|
||||
total_nb_heure_formation_by_level = 0
|
||||
if( local_conversion_heure_status is True ):
|
||||
for retval_pipe_concerned_class in MYSY_GV.dbname['inscription'].aggregate(pipe_concerned_class):
|
||||
|
||||
print(" ### retval_pipe_concerned_class = ", retval_pipe_concerned_class)
|
||||
#print(" ### retval_pipe_concerned_class = ", retval_pipe_concerned_class)
|
||||
|
||||
if( "myclass_collection" in retval_pipe_concerned_class.keys() and
|
||||
"duration" in retval_pipe_concerned_class['myclass_collection'].keys() and retval_pipe_concerned_class['myclass_collection']['duration'] and
|
||||
"duration_unit" in retval_pipe_concerned_class['myclass_collection'].keys() and retval_pipe_concerned_class['myclass_collection']['duration_unit'] ):
|
||||
|
||||
local_duration = mycommon.tryFloat(str(retval_pipe_concerned_class['myclass_collection']['duration']))
|
||||
local_duration_unit = str(retval_pipe_concerned_class['myclass_collection']['duration_unit'])
|
||||
|
||||
if( str(local_duration_unit) == "heure"):
|
||||
total_nb_formation_by_level = total_nb_heure_formation_by_level + local_duration
|
||||
|
||||
elif( str(local_duration_unit) == "jour"):
|
||||
total_nb_formation_by_level = total_nb_heure_formation_by_level + ( local_duration * local_nb_heure_par_jour)
|
||||
#print(" ### local_duration = ", str(local_duration), " duration_unit = ", str(local_duration_unit) )
|
||||
|
||||
elif (str(local_duration_unit) == "semaine"):
|
||||
total_nb_formation_by_level = total_nb_heure_formation_by_level + (local_duration * local_nb_heure_par_sem)
|
||||
if( str(retval_pipe_concerned_class['myclass_collection']['_id']) not in tab_class_id ):
|
||||
tab_class_id.append((str(retval_pipe_concerned_class['myclass_collection']['_id'])))
|
||||
local_node = {}
|
||||
local_node['class_id'] = str(retval_pipe_concerned_class['myclass_collection']['_id'])
|
||||
local_node['class_duration'] = str(local_duration)
|
||||
local_node['class_duration_unit'] = local_duration_unit
|
||||
tab_class_info.append(local_node)
|
||||
|
||||
elif (str(local_duration_unit) == "mois"):
|
||||
total_nb_formation_by_level = total_nb_heure_formation_by_level + (local_duration * local_nb_heure_par_mois)
|
||||
|
||||
elif (str(local_duration_unit) == "annee"):
|
||||
total_nb_formation_by_level = total_nb_heure_formation_by_level + (local_duration * local_nb_heure_par_annee)
|
||||
for local_retval in tab_class_info :
|
||||
#print( " ### local_retval = ",local_retval)
|
||||
local_duration = mycommon.tryFloat(str(local_retval['class_duration']))
|
||||
local_duration_unit = str(local_retval['class_duration_unit'])
|
||||
|
||||
|
||||
if( str(local_duration_unit) == "heure"):
|
||||
total_nb_heure_formation_by_level = total_nb_heure_formation_by_level + local_duration
|
||||
|
||||
elif( str(local_duration_unit) == "jour"):
|
||||
total_nb_heure_formation_by_level = total_nb_heure_formation_by_level + ( local_duration * local_nb_heure_par_jour)
|
||||
|
||||
elif (str(local_duration_unit) == "semaine"):
|
||||
total_nb_heure_formation_by_level = total_nb_heure_formation_by_level + (local_duration * local_nb_heure_par_sem)
|
||||
|
||||
elif (str(local_duration_unit) == "mois"):
|
||||
total_nb_heure_formation_by_level = total_nb_heure_formation_by_level + (local_duration * local_nb_heure_par_mois)
|
||||
|
||||
elif (str(local_duration_unit) == "annee"):
|
||||
total_nb_heure_formation_by_level = total_nb_heure_formation_by_level + (local_duration * local_nb_heure_par_annee)
|
||||
|
||||
|
||||
node['total_nb_heure_formation_by_level'] = str(total_nb_heure_formation_by_level)
|
||||
|
||||
|
@ -960,6 +996,7 @@ def Get_Qery_Generate_BPF_From_partner_invoice_header(diction):
|
|||
RetObject['total_bpf_f_class_niveau_formation'] = round(total_bpf_f_class_niveau_formation, 2)
|
||||
|
||||
|
||||
print(" ### RetObject = ", RetObject)
|
||||
RetObject = mycommon.JSONEncoder().encode(RetObject)
|
||||
|
||||
return True, RetObject
|
||||
|
|
2176
Log/log_file.log
2176
Log/log_file.log
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue