dddqsdddd
parent
26a2444b8f
commit
db0279a8e0
|
@ -1,10 +1,15 @@
|
|||
<?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="dddqsd">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="dddqsdd">
|
||||
<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$/Dashbord_queries/ressources_humaines_tbd_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/ressources_humaines_tbd_qries.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dashbord_queries/session_tbd_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/session_tbd_qries.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -74,13 +79,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00333" summary="17/06/2024 - 21h30">
|
||||
<created>1718656591744</created>
|
||||
<option name="number" value="00333" />
|
||||
<option name="presentableId" value="LOCAL-00333" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1718656591746</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00334" summary="18/06/2024 - 21h30">
|
||||
<created>1718744595262</created>
|
||||
<option name="number" value="00334" />
|
||||
|
@ -417,7 +415,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1724781881429</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="382" />
|
||||
<task id="LOCAL-00382" summary="dddqsdd">
|
||||
<created>1724868784464</created>
|
||||
<option name="number" value="00382" />
|
||||
<option name="presentableId" value="LOCAL-00382" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1724868784465</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="383" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -459,7 +464,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="29/07/2024 - 12h" />
|
||||
<MESSAGE value="29/07/2024 - 21h" />
|
||||
<MESSAGE value="30/07/2024 - 12h" />
|
||||
<MESSAGE value="31/07/2024 - 17h30" />
|
||||
|
@ -484,6 +488,7 @@
|
|||
<MESSAGE value="ss" />
|
||||
<MESSAGE value="ddd" />
|
||||
<MESSAGE value="dddqsd" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="dddqsd" />
|
||||
<MESSAGE value="dddqsdd" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="dddqsdd" />
|
||||
</component>
|
||||
</project>
|
|
@ -28,7 +28,951 @@ from datetime import timedelta
|
|||
import Dashbord_queries.formation_tbd_qries as formation_tbd_qries
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
|
||||
def Get_Qery_Generate_BPF_From_partner_invoice_header(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'periode_start_date', 'periode_end_date', 'filter_value', ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', ]
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
filt_client_id = {}
|
||||
if ("filter_client_id" in diction.keys() and diction['filter_client_id']):
|
||||
filt_client_id = {'order_header_client_id': str(diction['filter_client_id'])}
|
||||
|
||||
filt_periode_start_date = ""
|
||||
if ("periode_start_date" in diction.keys() and diction['periode_start_date']):
|
||||
filt_periode_start_date = str(diction['periode_start_date'])[0:10]
|
||||
local_status = mycommon.CheckisDate(filt_periode_start_date)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le filtre : 'date de debut' n'est pas au format jj/mm/aaaa.")
|
||||
return False, " Le filtre : 'date de debut' n'est pas au format jj/mm/aaaa."
|
||||
|
||||
filt_periode_end_date = ""
|
||||
if ("periode_end_date" in diction.keys() and diction['periode_end_date']):
|
||||
filt_periode_end_date = str(diction['periode_end_date'])[0:10]
|
||||
local_status = mycommon.CheckisDate(filt_periode_end_date)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le filtre : 'date de fin' n'est pas au format jj/mm/aaaa.")
|
||||
return False, " Le filtre : 'date de fin' n'est pas au format jj/mm/aaaa."
|
||||
|
||||
"""
|
||||
Si la valeur de 'filter_value' est m0 ou m1, on va aller recuperer les date du mois correspondant.
|
||||
On ecrase les valeur de filt_session_start_date et filt_session_end_date
|
||||
"""
|
||||
if ('filter_value' in diction.keys()):
|
||||
# print(" filter_value = ", diction['filter_value'])
|
||||
if (str(diction['filter_value']) == "m0"):
|
||||
# On recupere les date du mois en cours
|
||||
local_status, start_current_month_date, end_current_month_date = mycommon.Get_Current_Month_Start_End_Date()
|
||||
if (local_status is False):
|
||||
return local_status, start_current_month_date
|
||||
|
||||
filt_periode_start_date = start_current_month_date
|
||||
filt_periode_end_date = end_current_month_date
|
||||
|
||||
# print(" ### filt_session_start_date = ", filt_session_start_date, " ### filt_session_end_date = ", filt_session_end_date)
|
||||
|
||||
elif (str(diction['filter_value']) == "m1"):
|
||||
# On recupere les date du mois en cours
|
||||
local_status, start_current_month_date, end_current_month_date = mycommon.Get_Previous_Month_Start_End_Date()
|
||||
if (local_status is False):
|
||||
return local_status, start_current_month_date
|
||||
|
||||
filt_periode_start_date = start_current_month_date
|
||||
filt_periode_end_date = end_current_month_date
|
||||
|
||||
filt_periode_start_date_ISODATE = datetime.strptime(str(filt_periode_start_date), '%d/%m/%Y')
|
||||
filt_periode_end_date_ISODATE = datetime.strptime(str(filt_periode_end_date), '%d/%m/%Y')
|
||||
|
||||
RetObject = {}
|
||||
val_tmp = 0
|
||||
|
||||
"""
|
||||
C1 – Quelles sont vos ressources provenant directement des entreprises pour la formation de leurs salariés ?
|
||||
|
||||
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'},
|
||||
|
||||
{
|
||||
'mysy_invoice_date': {'$gte': filt_periode_start_date_ISODATE,
|
||||
'$lte': filt_periode_end_date_ISODATE}}, ]}
|
||||
|
||||
"""
|
||||
TRAITEMENT DU PAVE CCCC
|
||||
"""
|
||||
|
||||
bpf_c1_entreprise = []
|
||||
C1_pipe_qry_invoice_header_partner__invoice_line_detail__is_client_1_is_financeur_0_is_company_1 = ([
|
||||
{"$addFields": {
|
||||
"mysy_invoice_date": {
|
||||
'$dateFromString': {
|
||||
'dateString': '$invoice_date',
|
||||
'format': "%d/%m/%Y"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{'$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']}}},
|
||||
{'$lookup': {
|
||||
'from': 'partner_invoice_line_detail',
|
||||
"let": {"invoice_header_id": {'$toString': "$_id"},
|
||||
'partner_invoice_line_partner_owner_recid': '$partner_owner_recid',
|
||||
'partner_invoice_line_invoice_header_ref_interne': '$invoice_header_ref_interne'},
|
||||
'pipeline': [
|
||||
{'$match':
|
||||
{'$expr':
|
||||
{'$and':
|
||||
[
|
||||
{'$eq': ["$valide", "1"]},
|
||||
{'$eq': ["$invoice_header_ref_interne",
|
||||
'$$partner_invoice_line_invoice_header_ref_interne']},
|
||||
{'$eq': ["$partner_owner_recid", '$$partner_invoice_line_partner_owner_recid']},
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
],
|
||||
'as': 'collection_partner_invoice_line'
|
||||
}
|
||||
},
|
||||
{
|
||||
'$unwind': '$collection_partner_invoice_line'
|
||||
},
|
||||
|
||||
|
||||
|
||||
{'$group': {
|
||||
'_id': { },
|
||||
"TotalAmount_HT": {
|
||||
"$sum": {'$toDouble': '$collection_partner_invoice_line.order_line_invoiced_amount'}},
|
||||
"count": {"$sum": 1}
|
||||
}
|
||||
},
|
||||
{
|
||||
'$sort': {'count': -1}
|
||||
},
|
||||
|
||||
])
|
||||
for retval in MYSY_GV.dbname['partner_invoice_header'].aggregate(
|
||||
C1_pipe_qry_invoice_header_partner__invoice_line_detail__is_client_1_is_financeur_0_is_company_1):
|
||||
print(" ### retval = ", retval)
|
||||
node = {}
|
||||
node['bpf_c1_entreprise'] = retval['TotalAmount_HT']
|
||||
bpf_c1_entreprise.append(node)
|
||||
RetObject['bpf_c1_entreprise'] = bpf_c1_entreprise
|
||||
|
||||
|
||||
C2_pipe_qry_invoice_header_partner__invoice_line_detail__partner_type_organisme_financement__type_apprenant = ([
|
||||
{"$addFields": {
|
||||
"mysy_invoice_date": {
|
||||
'$dateFromString': {
|
||||
'dateString': '$invoice_date',
|
||||
'format': "%d/%m/%Y"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{'$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' ]} } },
|
||||
{'$lookup': {
|
||||
'from': 'partner_invoice_line_detail',
|
||||
"let": {"invoice_header_id": {'$toString': "$_id"},
|
||||
'partner_invoice_line_partner_owner_recid': '$partner_owner_recid',
|
||||
'partner_invoice_line_invoice_header_ref_interne': '$invoice_header_ref_interne'},
|
||||
'pipeline': [
|
||||
{'$match':
|
||||
{'$expr':
|
||||
{'$and':
|
||||
[
|
||||
{'$eq': ["$valide", "1"]},
|
||||
{'$eq': ["$invoice_header_ref_interne",
|
||||
'$$partner_invoice_line_invoice_header_ref_interne']},
|
||||
{'$eq': ["$partner_owner_recid", '$$partner_invoice_line_partner_owner_recid']},
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
],
|
||||
'as': 'collection_partner_invoice_line'
|
||||
}
|
||||
},
|
||||
{
|
||||
'$unwind': '$collection_partner_invoice_line'
|
||||
},
|
||||
|
||||
{'$lookup': {
|
||||
'from': 'type_organisme_financement',
|
||||
"let": {'type_financeur_id': "$order_header_type_financeur_id",
|
||||
|
||||
},
|
||||
'pipeline': [
|
||||
{'$match':
|
||||
{'$expr':
|
||||
{'$and':
|
||||
[
|
||||
|
||||
{'$eq': ["$_id", {'$convert': {
|
||||
'input': "$$type_financeur_id",
|
||||
'to': "objectId",
|
||||
'onError': {'error': 'true'},
|
||||
'onNull': {'isnull': 'true'}
|
||||
}}]},
|
||||
|
||||
{'$eq': ["$valide", "1"]},
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
],
|
||||
'as': 'type_organisme_financement_collection'
|
||||
}
|
||||
},
|
||||
{
|
||||
'$unwind': '$type_organisme_financement_collection'
|
||||
},
|
||||
|
||||
{'$lookup': {
|
||||
'from': 'type_apprenant',
|
||||
"let": {'type_apprenant_code': "$collection_partner_invoice_line.order_line_inscription_type_apprenant",
|
||||
|
||||
},
|
||||
'pipeline': [
|
||||
{'$match':
|
||||
{'$expr':
|
||||
{'$and':
|
||||
[
|
||||
{'$eq': ["$valide", "1"]},
|
||||
{'$eq': ["$code", '$$type_apprenant_code']},
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
],
|
||||
'as': 'type_apprenante_collection'
|
||||
}
|
||||
},
|
||||
{
|
||||
'$unwind': '$type_apprenante_collection'
|
||||
},
|
||||
|
||||
{'$group': {
|
||||
'_id': {
|
||||
"Type_Apprenant": "$collection_partner_invoice_line.order_line_inscription_type_apprenant",
|
||||
"Type_Apprenant_Description": "$type_apprenante_collection.description",
|
||||
},
|
||||
"TotalAmount_HT": {
|
||||
"$sum": {'$toDouble': '$collection_partner_invoice_line.order_line_invoiced_amount'}},
|
||||
"count": {"$sum": 1}
|
||||
}
|
||||
},
|
||||
{
|
||||
'$sort': {'count': -1}
|
||||
},
|
||||
|
||||
])
|
||||
|
||||
print(" ### Get_Qery_Generate_BPF C2_pipe_qry_invoice_header_partner__invoice_line_detail__partner_type_organisme_financement__type_apprenant = ", C2_pipe_qry_invoice_header_partner__invoice_line_detail__partner_type_organisme_financement__type_apprenant)
|
||||
|
||||
bpf_c2_type_apprenant = []
|
||||
total_bpf_c_type_apprenant = 0
|
||||
for retval in MYSY_GV.dbname['partner_invoice_header'].aggregate(C2_pipe_qry_invoice_header_partner__invoice_line_detail__partner_type_organisme_financement__type_apprenant):
|
||||
print(" ### retval = ", retval)
|
||||
node = {}
|
||||
node['Type_Apprenant_Code'] = retval['_id']['Type_Apprenant']
|
||||
node['Type_Apprenant_Desc'] = retval['_id']['Type_Apprenant_Description']
|
||||
node['TotalAmount_HT'] = retval['TotalAmount_HT']
|
||||
|
||||
total_bpf_c_type_apprenant = total_bpf_c_type_apprenant + mycommon.tryFloat(retval['TotalAmount_HT'])
|
||||
bpf_c2_type_apprenant.append(node)
|
||||
|
||||
RetObject['bpf_c2_type_apprenant'] = bpf_c2_type_apprenant
|
||||
RetObject['total_bpf_c_type_apprenant'] = round(total_bpf_c_type_apprenant, 2)
|
||||
|
||||
|
||||
C3_C8_pipe_qry_invoice_header_partner__invoice_line_detail__partner_type_pouvoir_public = ([
|
||||
{"$addFields": {
|
||||
"mysy_invoice_date": {
|
||||
'$dateFromString': {
|
||||
'dateString': '$invoice_date',
|
||||
'format': "%d/%m/%Y"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{'$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' ]} } },
|
||||
{'$lookup': {
|
||||
'from': 'partner_invoice_line_detail',
|
||||
"let": {"invoice_header_id": {'$toString': "$_id"},
|
||||
'partner_invoice_line_partner_owner_recid': '$partner_owner_recid',
|
||||
'partner_invoice_line_invoice_header_ref_interne': '$invoice_header_ref_interne'},
|
||||
'pipeline': [
|
||||
{'$match':
|
||||
{'$expr':
|
||||
{'$and':
|
||||
[
|
||||
{'$eq': ["$valide", "1"]},
|
||||
{'$eq': ["$invoice_header_ref_interne",
|
||||
'$$partner_invoice_line_invoice_header_ref_interne']},
|
||||
{'$eq': ["$partner_owner_recid", '$$partner_invoice_line_partner_owner_recid']},
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
],
|
||||
'as': 'collection_partner_invoice_line'
|
||||
}
|
||||
},
|
||||
{
|
||||
'$unwind': '$collection_partner_invoice_line'
|
||||
},
|
||||
|
||||
{'$lookup': {
|
||||
'from': 'type_pouvoir_public',
|
||||
"let": {'order_header_type_pouvoir_public_id': "$order_header_type_pouvoir_public_id",
|
||||
|
||||
},
|
||||
'pipeline': [
|
||||
{'$match':
|
||||
{'$expr':
|
||||
{'$and':
|
||||
[
|
||||
|
||||
{'$eq': ["$_id", {'$convert': {
|
||||
'input': "$$order_header_type_pouvoir_public_id",
|
||||
'to': "objectId",
|
||||
'onError': {'error': 'true'},
|
||||
'onNull': {'isnull': 'true'}
|
||||
}}]},
|
||||
|
||||
{'$eq': ["$valide", "1"]},
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
],
|
||||
'as': 'type_pouvoir_public_collection'
|
||||
}
|
||||
},
|
||||
{
|
||||
'$unwind': '$type_pouvoir_public_collection'
|
||||
},
|
||||
|
||||
{'$group': {
|
||||
'_id': {
|
||||
|
||||
"Type_pouvoir_public_desc": "$type_pouvoir_public_collection.description",
|
||||
},
|
||||
"TotalAmount_HT": {
|
||||
"$sum": {'$toDouble': '$collection_partner_invoice_line.order_line_invoiced_amount'}},
|
||||
"count": {"$sum": 1}
|
||||
}
|
||||
},
|
||||
{
|
||||
'$sort': {'count': -1}
|
||||
},
|
||||
|
||||
])
|
||||
|
||||
|
||||
bpf_c3_c8_type_pouvoir_public = []
|
||||
total_bpf_c3_c8_type_pouvoir_public = 0
|
||||
for retval in MYSY_GV.dbname['partner_invoice_header'].aggregate(
|
||||
C3_C8_pipe_qry_invoice_header_partner__invoice_line_detail__partner_type_pouvoir_public):
|
||||
print(" bpf_c3_c8_type_pouvoir_public ### retval = ", retval)
|
||||
node = {}
|
||||
node['Type_pouvoir_public_desc'] = retval['_id']['Type_pouvoir_public_desc']
|
||||
node['TotalAmount_HT'] = retval['TotalAmount_HT']
|
||||
|
||||
total_bpf_c3_c8_type_pouvoir_public = total_bpf_c3_c8_type_pouvoir_public + mycommon.tryFloat(retval['TotalAmount_HT'])
|
||||
bpf_c3_c8_type_pouvoir_public.append(node)
|
||||
|
||||
RetObject['bpf_c3_c8_type_pouvoir_public'] = bpf_c3_c8_type_pouvoir_public
|
||||
RetObject['total_bpf_c3_c8_type_pouvoir_public'] = round(total_bpf_c3_c8_type_pouvoir_public, 2)
|
||||
|
||||
|
||||
|
||||
C9_pipe_qry_invoice_header_partner__invoice_line_detail__is_company_0 = ([
|
||||
{"$addFields": {
|
||||
"mysy_invoice_date": {
|
||||
'$dateFromString': {
|
||||
'dateString': '$invoice_date',
|
||||
'format': "%d/%m/%Y"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{'$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']}}},
|
||||
{'$lookup': {
|
||||
'from': 'partner_invoice_line_detail',
|
||||
"let": {"invoice_header_id": {'$toString': "$_id"},
|
||||
'partner_invoice_line_partner_owner_recid': '$partner_owner_recid',
|
||||
'partner_invoice_line_invoice_header_ref_interne': '$invoice_header_ref_interne'},
|
||||
'pipeline': [
|
||||
{'$match':
|
||||
{'$expr':
|
||||
{'$and':
|
||||
[
|
||||
{'$eq': ["$valide", "1"]},
|
||||
{'$eq': ["$invoice_header_ref_interne",
|
||||
'$$partner_invoice_line_invoice_header_ref_interne']},
|
||||
{'$eq': ["$partner_owner_recid", '$$partner_invoice_line_partner_owner_recid']},
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
],
|
||||
'as': 'collection_partner_invoice_line'
|
||||
}
|
||||
},
|
||||
{
|
||||
'$unwind': '$collection_partner_invoice_line'
|
||||
},
|
||||
|
||||
{'$group': {
|
||||
'_id': {
|
||||
"Type_Client": "$order_header_is_company",
|
||||
"Type_Client_Desc": "Client Type Particulier",
|
||||
},
|
||||
"TotalAmount_HT": {
|
||||
"$sum": {'$toDouble': '$collection_partner_invoice_line.order_line_invoiced_amount'}},
|
||||
"count": {"$sum": 1}
|
||||
}
|
||||
},
|
||||
{
|
||||
'$sort': {'count': -1}
|
||||
},
|
||||
|
||||
])
|
||||
|
||||
bpf_c9_is_company_particulier = []
|
||||
total_bpf_c9_is_company_particulier = 0
|
||||
|
||||
for retval in MYSY_GV.dbname['partner_invoice_header'].aggregate(C9_pipe_qry_invoice_header_partner__invoice_line_detail__is_company_0):
|
||||
print(" ### retval = ", retval)
|
||||
node = {}
|
||||
node['Type_Client_Desc'] = retval['_id']['Type_Client_Desc']
|
||||
node['TotalAmount_HT'] = retval['TotalAmount_HT']
|
||||
|
||||
total_bpf_c_type_apprenant = total_bpf_c_type_apprenant + mycommon.tryFloat(retval['TotalAmount_HT'])
|
||||
bpf_c9_is_company_particulier.append(node)
|
||||
|
||||
RetObject['bpf_c9_is_company_particulier'] = bpf_c9_is_company_particulier
|
||||
RetObject['total_bpf_c9_is_company_particulier'] = round(total_bpf_c9_is_company_particulier, 2)
|
||||
|
||||
"""
|
||||
FIN TRAITEMENT DU PAVE CCCC
|
||||
"""
|
||||
|
||||
"""
|
||||
TRAITEMENT DU PAVE EEE
|
||||
"""
|
||||
E_pipe_qry_ressource_humaine__ressource_humaine_contrat = ([
|
||||
{
|
||||
"$project": {
|
||||
"_id": 1, "partner_recid": 1, "nom": 1, "prenom": 1, "fonction": 1, "email": 1, "email": 1,
|
||||
"email": 1, "email": 1, "email": 1,
|
||||
}
|
||||
},
|
||||
{'$lookup': {
|
||||
'from': 'ressource_humaine_contrat',
|
||||
'let': {'rh_id': {'$toString': '$_id'}, 'rh_partner_owner_recid': '$partner_recid'},
|
||||
'pipeline': [
|
||||
{"$addFields": {
|
||||
"mysy_contrat_date_debut": {
|
||||
'$dateFromString': {
|
||||
'dateString': '$date_debut',
|
||||
'format': "%d/%m/%Y"
|
||||
}
|
||||
},
|
||||
|
||||
"mysy_contrat_date_fin": {
|
||||
'$dateFromString': {
|
||||
'dateString': '$date_fin',
|
||||
'format': "%d/%m/%Y"
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
{'$match':
|
||||
{'$expr':
|
||||
{'$and':
|
||||
[ {'$eq': ['$valide', '1']},
|
||||
{'$eq': ['$rh_id', '$$rh_id']},
|
||||
{'$eq': ['$partner_owner_recid', '$$rh_partner_owner_recid']},
|
||||
|
||||
{"$or":
|
||||
[
|
||||
{'$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]}
|
||||
]
|
||||
},
|
||||
|
||||
],
|
||||
|
||||
},
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$project": {
|
||||
"_id": 1, "rh_id": 1, "date_debut": 1, "date_fin": 1, "type_contrat": 1, "type_employe": 1,
|
||||
"cout": 1, "periodicite": 1, "mysy_contrat_date_debut": 1, "mysy_contrat_date_fin": 1
|
||||
}
|
||||
},
|
||||
|
||||
],
|
||||
|
||||
'as': 'collection_ressource_humaine_contrat'
|
||||
}
|
||||
},
|
||||
{
|
||||
'$unwind': '$collection_ressource_humaine_contrat'
|
||||
},
|
||||
|
||||
{'$lookup': {
|
||||
'from': 'agenda',
|
||||
"let": {"rh_id": {'$toString': "$_id"}, 'rh_partner_owner_recid': '$partner_recid'},
|
||||
'pipeline': [
|
||||
{'$match':
|
||||
{'$expr':
|
||||
{'$and':
|
||||
[
|
||||
|
||||
{'$eq': ["$valide", "1"]},
|
||||
{'$eq': ["$related_collection_recid", '$$rh_id']},
|
||||
{'$eq': ["$partner_owner_recid", '$$rh_partner_owner_recid']},
|
||||
{'$eq': ["$event_type", 'planning']},
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
],
|
||||
'as': 'collection_agenda'
|
||||
}
|
||||
},
|
||||
])
|
||||
|
||||
tab_formateur_rh_id_interne = []
|
||||
tab_formateur_rh_interne_nom_prenom_mail = []
|
||||
tab_formateur_rh_interne_total_heure = 0
|
||||
|
||||
tab_formateur_rh_id_sous_traitant = []
|
||||
tab_formateur_rh_sous_traitant_nom_prenom_mail = []
|
||||
tab_formateur_rh_sous_traitant_total_heure = 0
|
||||
|
||||
|
||||
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']
|
||||
|
||||
|
||||
total_duration = 0
|
||||
for agenda_retval in retval['collection_agenda']:
|
||||
#print(" ### pour formateur_data = ", formateur_data)
|
||||
#print(" ### AGENDA : ", agenda_retval)
|
||||
event_duration_second = datetime.strptime( str(agenda_retval['event_end'])[0:16], '%Y-%m-%dT%H:%M') - datetime.strptime(str(agenda_retval['event_start'])[0:16],'%Y-%m-%dT%H:%M')
|
||||
event_duration_second = event_duration_second.total_seconds()
|
||||
|
||||
event_duration_hour = round(divmod(event_duration_second, 3600)[0] + divmod(event_duration_second, 3600)[1] / 3600, 2)
|
||||
|
||||
"""
|
||||
Gerer les eventuels cas d'erreur sur une date de fin event < debut event
|
||||
"""
|
||||
if( event_duration_hour < 0 ):
|
||||
event_duration_hour = 0
|
||||
|
||||
total_duration = total_duration + event_duration_hour
|
||||
|
||||
|
||||
|
||||
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']))
|
||||
tab_formateur_rh_sous_traitant_nom_prenom_mail.append(str(formateur_data))
|
||||
tab_formateur_rh_sous_traitant_total_heure = tab_formateur_rh_sous_traitant_total_heure + total_duration
|
||||
|
||||
elif( formateur_contrat_type and formateur_contrat_type not in ['vacataire', 'vacataire_qty']):
|
||||
if (formateur_id not in tab_formateur_rh_id_interne):
|
||||
tab_formateur_rh_id_interne.append(str(retval['_id']))
|
||||
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
|
||||
RetObject['tab_formateur_rh_interne_total_heure'] = tab_formateur_rh_interne_total_heure
|
||||
"""
|
||||
|
||||
RetObject['bpf_e1_nb_formateurs_internee'] = str(len(tab_formateur_rh_id_interne))
|
||||
RetObject['bpf_e1_nb_heures_formateurs_internes'] = tab_formateur_rh_interne_total_heure
|
||||
|
||||
"""
|
||||
RetObject['tab_formateur_rh_id_sous_traitant'] = tab_formateur_rh_id_sous_traitant
|
||||
RetObject['tab_formateur_rh_sous_traitant_nom_prenom_mail'] = tab_formateur_rh_sous_traitant_nom_prenom_mail
|
||||
RetObject['tab_formateur_rh_sous_traitant_total_heure'] = tab_formateur_rh_sous_traitant_total_heure
|
||||
"""
|
||||
|
||||
RetObject['bpf_e2_nb_formateurs_externes'] = str(len(tab_formateur_rh_id_sous_traitant))
|
||||
RetObject['bpf_e2_nb_heures_formateurs_externes'] = tab_formateur_rh_sous_traitant_total_heure
|
||||
|
||||
F1_qery_match = {'$and': [{"partner_owner_recid": str(my_partner['recid'])}, {"valide": '1', 'status':'1'},
|
||||
]}
|
||||
|
||||
F1_pipe_qry_stagiaire_par_class_level = ([
|
||||
|
||||
{'$project': {'_id': 1, 'email': 1, 'session_id': 1, 'nom': 1, 'prenom': 1, 'partner_owner_recid': 1,
|
||||
'valide': 1, 'type_apprenant': 1, 'status':1}},
|
||||
{'$match': F1_qery_match},
|
||||
{'$lookup': {
|
||||
'from': 'session_formation',
|
||||
'let': {'session_id': "$session_id", 'partner_owner_recid': '$partner_owner_recid'},
|
||||
'pipeline': [
|
||||
{
|
||||
"$addFields": {
|
||||
"mysy_date_debut_session": {
|
||||
"$dateFromString": {
|
||||
"dateString": "$date_debut",
|
||||
"format": "%d/%m/%Y"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{'$project': {'_id': 1, 'code_session': 1, 'class_internal_url': 1, 'date_debut': 1, 'date_fin': 1,
|
||||
'nb_participant': 1, 'partner_owner_recid': 1, 'valide': 1, 'mysy_date_debut_session':1}},
|
||||
{'$match':
|
||||
{'$expr':
|
||||
{'$and':
|
||||
[
|
||||
|
||||
{'$eq': ["$_id", {'$convert': {
|
||||
'input': "$$session_id",
|
||||
'to': "objectId",
|
||||
'onError': {'error': 'true'},
|
||||
'onNull': {'isnull': 'true'}
|
||||
}}]},
|
||||
|
||||
{'$eq': ["$valide", "1"]},
|
||||
{'$eq': ["$partner_owner_recid", '$$partner_owner_recid']},
|
||||
{'$gte': [{'$toDate': "$mysy_date_debut_session"}, filt_periode_start_date_ISODATE]},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
],
|
||||
'as': 'session_formation_collection'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
'$unwind': '$session_formation_collection'
|
||||
},
|
||||
|
||||
{
|
||||
"$lookup": {
|
||||
'from': 'myclass',
|
||||
'localField': 'session_formation_collection.class_internal_url',
|
||||
'foreignField': 'internal_url',
|
||||
"pipeline": [
|
||||
{'$project': {'title': 1, 'internal_url': 1, 'external_code': 1, 'published': 1,
|
||||
'duration': 1, 'duration_unit': 1, 'class_level':1, 'partner_owner_recid':1}},
|
||||
|
||||
{'$match': {'partner_owner_recid': str(my_partner['recid'])}},
|
||||
|
||||
],
|
||||
"as": "myclass_collection"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
'$unwind': '$myclass_collection'
|
||||
},
|
||||
|
||||
{'$lookup': {
|
||||
'from': 'class_niveau_formation',
|
||||
"let": {'class_level_code': "$myclass_collection.class_level",
|
||||
|
||||
},
|
||||
'pipeline': [
|
||||
{'$project': {'_id': 1, 'code': 1, 'description': 1, 'valide': 1}},
|
||||
{'$match':
|
||||
{'$expr':
|
||||
{'$and':
|
||||
[
|
||||
{'$eq': ["$valide", "1"]},
|
||||
{'$eq': ["$code", '$$class_level_code']},
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
],
|
||||
'as': 'class_niveau_formation_collection'
|
||||
}
|
||||
},
|
||||
{
|
||||
'$unwind': '$class_niveau_formation_collection'
|
||||
},
|
||||
{'$group': {
|
||||
'_id': {
|
||||
"Class_Level_Code": "$class_niveau_formation_collection.code",
|
||||
"Class_Level_Desc": "$class_niveau_formation_collection.description",
|
||||
|
||||
},
|
||||
"TotalAmount_HT": {
|
||||
"$sum": 1},
|
||||
"count": {"$sum": 1}
|
||||
}
|
||||
},
|
||||
{
|
||||
'$sort': {'count': -1}
|
||||
},
|
||||
|
||||
|
||||
])
|
||||
|
||||
print(" ### F1_pipe_qry_stagiaire_par_class_level = ", F1_pipe_qry_stagiaire_par_class_level)
|
||||
|
||||
bpf_f_class_niveau_formation = []
|
||||
total_bpf_f_class_niveau_formation = 0
|
||||
|
||||
"""
|
||||
Recuperer la configuration de conversion des semaines, mois, années en nombre d'heures
|
||||
"""
|
||||
local_conversion_heure_status, local_nb_heure_par_jour, local_nb_heure_par_sem, local_nb_heure_par_mois, local_nb_heure_par_annee = mycommon.Get_Config_Conversion_Heures(str(my_partner['recid']))
|
||||
|
||||
|
||||
for retval in MYSY_GV.dbname['inscription'].aggregate(F1_pipe_qry_stagiaire_par_class_level):
|
||||
print(" ### retval = ", retval)
|
||||
node = {}
|
||||
|
||||
node['Class_Level_Desc'] = retval['_id']['Class_Level_Desc']
|
||||
node['Nb_Apprenant_By_Class_Level'] = retval['count']
|
||||
|
||||
"""
|
||||
Aller chercher le nombre d'heures de formation des formations concernées par niveau
|
||||
"""
|
||||
pipe_concerned_class = ([
|
||||
|
||||
{'$project': {'_id': 1, 'email': 1, 'session_id': 1, 'nom': 1, 'prenom': 1, 'partner_owner_recid': 1,
|
||||
'valide': 1, 'type_apprenant': 1, 'status':1}},
|
||||
{'$match': F1_qery_match},
|
||||
{'$lookup': {
|
||||
'from': 'session_formation',
|
||||
'let': {'session_id': "$session_id", 'partner_owner_recid': '$partner_owner_recid'},
|
||||
'pipeline': [
|
||||
{
|
||||
"$addFields": {
|
||||
"mysy_date_debut_session": {
|
||||
"$dateFromString": {
|
||||
"dateString": "$date_debut",
|
||||
"format": "%d/%m/%Y"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{'$project': {'_id': 1, 'code_session': 1, 'class_internal_url': 1, 'date_debut': 1,
|
||||
'date_fin': 1,
|
||||
'nb_participant': 1, 'partner_owner_recid': 1, 'valide': 1, 'mysy_date_debut_session':1}},
|
||||
{'$match':
|
||||
{'$expr':
|
||||
{'$and':
|
||||
[
|
||||
|
||||
{'$eq': ["$_id", {'$convert': {
|
||||
'input': "$$session_id",
|
||||
'to': "objectId",
|
||||
'onError': {'error': 'true'},
|
||||
'onNull': {'isnull': 'true'}
|
||||
}}]},
|
||||
|
||||
{'$eq': ["$valide", "1"]},
|
||||
{'$eq': ["$partner_owner_recid", '$$partner_owner_recid']},
|
||||
{'$gte': [{'$toDate': "$mysy_date_debut_session"},
|
||||
filt_periode_start_date_ISODATE]},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
],
|
||||
'as': 'session_formation_collection'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
'$unwind': '$session_formation_collection'
|
||||
},
|
||||
|
||||
{
|
||||
"$lookup": {
|
||||
'from': 'myclass',
|
||||
'localField': 'session_formation_collection.class_internal_url',
|
||||
'foreignField': 'internal_url',
|
||||
"pipeline": [
|
||||
{'$project': {'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'])}},
|
||||
|
||||
],
|
||||
"as": "myclass_collection"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
'$unwind': '$myclass_collection'
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
])
|
||||
print(" ### pipe_concerned_class = ", pipe_concerned_class)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
elif (str(local_duration_unit) == "semaine"):
|
||||
total_nb_formation_by_level = total_nb_heure_formation_by_level + (local_duration * local_nb_heure_par_sem)
|
||||
|
||||
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)
|
||||
|
||||
node['total_nb_heure_formation_by_level'] = str(total_nb_heure_formation_by_level)
|
||||
|
||||
|
||||
|
||||
total_bpf_f_class_niveau_formation = total_bpf_f_class_niveau_formation + mycommon.tryFloat(retval['count'])
|
||||
bpf_f_class_niveau_formation.append(node)
|
||||
|
||||
RetObject['bpf_f_class_niveau_formation'] = bpf_f_class_niveau_formation
|
||||
RetObject['total_bpf_f_class_niveau_formation'] = round(total_bpf_f_class_niveau_formation, 2)
|
||||
|
||||
|
||||
|
||||
|
||||
return True, RetObject
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer les données "
|
||||
|
||||
|
||||
|
||||
def Get_Qery_Generate_BPF_From_partner_invoice_header_work(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
|
|
|
@ -289,6 +289,13 @@ def Get_Humain_Ressource_With_Planning(diction):
|
|||
new_node['agenda_event_end'] = ""
|
||||
|
||||
event_duration_second = datetime.strptime(str(agenda_retval['event_end'])[0:16], '%Y-%m-%dT%H:%M') - datetime.strptime(str(agenda_retval['event_start'])[0:16],'%Y-%m-%dT%H:%M')
|
||||
|
||||
"""
|
||||
Gerer les eventuels cas d'erreur sur une date de fin event < debut event
|
||||
"""
|
||||
if (event_duration_second < 0):
|
||||
event_duration_second = 0
|
||||
|
||||
event_duration_second = event_duration_second.total_seconds()
|
||||
|
||||
event_duration_hour = round(divmod(event_duration_second, 3600)[0]+divmod(event_duration_second, 3600)[1]/3600, 2)
|
||||
|
|
|
@ -524,7 +524,8 @@ def Get_Qery_Session_By_Trainer_By_Periode(diction):
|
|||
filt_session_end_date_ISODATE = datetime.strptime(str(filt_session_end_date), '%d/%m/%Y')
|
||||
|
||||
|
||||
qery_match = {'$and': [ {"partner_owner_recid":str(my_partner['recid']) }, {"valide":'1'}, {"formateur_id": { "$exists": True } }, { 'mysy_date_debut_session': { '$gte': filt_session_start_date_ISODATE, '$lte': filt_session_end_date_ISODATE } } , ]}
|
||||
qery_match = {'$and': [ {"partner_owner_recid":str(my_partner['recid']) }, {"valide":'1'}, {"formateur_id": { "$exists": True } },
|
||||
{ 'mysy_date_debut_session': { '$gte': filt_session_start_date_ISODATE, '$lte': filt_session_end_date_ISODATE } } , ]}
|
||||
|
||||
pipe_qry = ([
|
||||
{"$addFields": {
|
||||
|
|
3340
Log/log_file.log
3340
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -10757,17 +10757,17 @@ def Invoice_Partner_From_Session_By_Inscription_Id( diction):
|
|||
order_header_type_financeur_id = partner_client_id_data['type_financeur_id']
|
||||
partner_invoice_header_data['order_header_type_financeur_id'] = order_header_type_financeur_id
|
||||
|
||||
order_header_is_financeur = ""
|
||||
order_header_is_financeur = "0"
|
||||
if ("is_financeur" in partner_client_id_data.keys()):
|
||||
order_header_is_financeur = partner_client_id_data['is_financeur']
|
||||
partner_invoice_header_data['order_header_is_financeur'] = order_header_is_financeur
|
||||
|
||||
order_header_is_client = ""
|
||||
order_header_is_client = "0"
|
||||
if ("is_client" in partner_client_id_data.keys()):
|
||||
order_header_is_client = partner_client_id_data['is_client']
|
||||
partner_invoice_header_data['order_header_is_client'] = order_header_is_client
|
||||
|
||||
order_header_is_fournisseur = ""
|
||||
order_header_is_fournisseur = "0"
|
||||
if ("is_fournisseur" in partner_client_id_data.keys()):
|
||||
order_header_is_fournisseur = partner_client_id_data['is_fournisseur']
|
||||
partner_invoice_header_data['order_header_is_fournisseur'] = order_header_is_fournisseur
|
||||
|
@ -11293,17 +11293,17 @@ def Invoice_Splited_Partner_From_Session_By_Inscription_Id( diction):
|
|||
order_header_type_financeur_id = partner_client_id_data['type_financeur_id']
|
||||
partner_invoice_header_data['order_header_type_financeur_id'] = order_header_type_financeur_id
|
||||
|
||||
order_header_is_financeur = ""
|
||||
order_header_is_financeur = "0"
|
||||
if ("is_financeur" in partner_client_id_data.keys()):
|
||||
order_header_is_financeur = partner_client_id_data['is_financeur']
|
||||
partner_invoice_header_data['order_header_is_financeur'] = order_header_is_financeur
|
||||
|
||||
order_header_is_client = ""
|
||||
order_header_is_client = "0"
|
||||
if ("is_client" in partner_client_id_data.keys()):
|
||||
order_header_is_client = partner_client_id_data['is_client']
|
||||
partner_invoice_header_data['order_header_is_client'] = order_header_is_client
|
||||
|
||||
order_header_is_fournisseur = ""
|
||||
order_header_is_fournisseur = "0"
|
||||
if ("is_fournisseur" in partner_client_id_data.keys()):
|
||||
order_header_is_fournisseur = partner_client_id_data['is_fournisseur']
|
||||
partner_invoice_header_data['order_header_is_fournisseur'] = order_header_is_fournisseur
|
||||
|
|
15
main.py
15
main.py
|
@ -94,6 +94,7 @@ import suivi_pedagogique_mgt as suivi_pedagogique_mgt
|
|||
import partner_produit_service_mgt as partner_produit_service_mgt
|
||||
import model_planning_sequence_mgt as model_planning_sequence_mgt
|
||||
import base_partner_catalog_config as base_partner_catalog_config
|
||||
import Dashbord_queries.BPF as BPF
|
||||
|
||||
app = Flask(__name__)
|
||||
cors = CORS(app, resources={r"/foo": {"origins": "*"}})
|
||||
|
@ -11023,6 +11024,20 @@ def Get_Partner_Catalog_Pub_Config():
|
|||
|
||||
|
||||
|
||||
"""
|
||||
API/ BPF / C rubrique Data
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Qery_Generate_BPF_From_partner_invoice_header/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Qery_Generate_BPF_From_partner_invoice_header():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Qery_Generate_BPF_From_partner_invoice_header payload = ",payload)
|
||||
status, retval = BPF.Get_Qery_Generate_BPF_From_partner_invoice_header(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(" debut api")
|
||||
|
|
|
@ -6581,3 +6581,63 @@ def Get_List_Type_Pouvoir_Public(diction):
|
|||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer la liste des categories de formation "
|
||||
|
||||
"""
|
||||
Cette fonction retourne la conversion en heures de
|
||||
- jour, semaine, mois, année
|
||||
"""
|
||||
def Get_Config_Conversion_Heures(locl_partner_owner_recid):
|
||||
try:
|
||||
local_nb_heure_par_jour = 0
|
||||
tmp_nb_heure_par_jour = MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(locl_partner_owner_recid),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'config_name': 'nb_heure_par_jour'})
|
||||
|
||||
if( tmp_nb_heure_par_jour and "config_value" in tmp_nb_heure_par_jour.keys() and tmp_nb_heure_par_jour['config_value']):
|
||||
local_nb_heure_par_jour = tryFloat(str(tmp_nb_heure_par_jour['config_value']))
|
||||
|
||||
local_nb_heure_par_semaine = 0
|
||||
tmp_nb_heure_par_sem = MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(locl_partner_owner_recid),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'config_name': 'nb_heure_par_semaine'})
|
||||
|
||||
if (tmp_nb_heure_par_sem and "config_value" in tmp_nb_heure_par_sem.keys() and tmp_nb_heure_par_sem[
|
||||
'config_value']):
|
||||
local_nb_heure_par_semaine = tryFloat(str(tmp_nb_heure_par_sem['config_value']))
|
||||
|
||||
local_nb_heure_par_mois = 0
|
||||
tmp_nb_heure_par_mois = MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(locl_partner_owner_recid),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'config_name': 'nb_heure_par_mois'})
|
||||
|
||||
if (tmp_nb_heure_par_mois and "config_value" in tmp_nb_heure_par_mois.keys() and tmp_nb_heure_par_mois[
|
||||
'config_value']):
|
||||
local_nb_heure_par_mois = tryFloat(str(tmp_nb_heure_par_mois['config_value']))
|
||||
|
||||
local_nb_heure_par_annee = 0
|
||||
tmp_nb_heure_par_annee = MYSY_GV.dbname['base_partner_setup'].find_one(
|
||||
{'partner_owner_recid': str(locl_partner_owner_recid),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'config_name': 'nb_heure_par_annee'})
|
||||
|
||||
if (tmp_nb_heure_par_annee and "config_value" in tmp_nb_heure_par_annee.keys() and tmp_nb_heure_par_annee[
|
||||
'config_value']):
|
||||
local_nb_heure_par_annee = tryFloat(str(tmp_nb_heure_par_mois['config_value']))
|
||||
|
||||
|
||||
|
||||
|
||||
return True, local_nb_heure_par_jour, local_nb_heure_par_semaine, local_nb_heure_par_mois, local_nb_heure_par_annee
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer la conversion des heure "
|
Loading…
Reference in New Issue