本文整理汇总了Python中outils.Outils.format_heure方法的典型用法代码示例。如果您正苦于以下问题:Python Outils.format_heure方法的具体用法?Python Outils.format_heure怎么用?Python Outils.format_heure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类outils.Outils
的用法示例。
在下文中一共展示了Outils.format_heure方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ligne_res
# 需要导入模块: from outils import Outils [as 别名]
# 或者: from outils.Outils import format_heure [as 别名]
def ligne_res(res, machine):
"""
création d'une ligne de tableau pour une réservation
:param res: réservation particulière
:param machine: machine concernée
:return: ligne de tableau latex
"""
p7 = round(machine['t_h_reservation_hp_p'] * res['duree_fact_hp'] / 60, 2)
p8 = round(machine['t_h_reservation_hp_np'] * res['duree_fact_hp'] / 60, 2)
p9 = round(machine['t_h_reservation_hc_p'] * res['duree_fact_hc'] / 60, 2)
p10 = round(machine['t_h_reservation_hc_np'] * res['duree_fact_hc'] / 60, 2)
login = Latex.echappe_caracteres(res['date_debut']).split()
temps = login[0].split('-')
date = temps[0]
for pos in range(1, len(temps)):
date = temps[pos] + '.' + date
if len(login) > 1:
heure = login[1]
else:
heure = ""
dico = {'date': date, 'heure': heure,
'machine': Latex.echappe_caracteres(res['nom_machine']),
'reserve': Latex.echappe_caracteres(res['date_reservation']),
'supprime': Latex.echappe_caracteres(res['date_suppression']),
'shp': Outils.format_heure(res['duree_hp']), 'shc': Outils.format_heure(res['duree_hc']),
'fhp': Outils.format_heure(res['duree_fact_hp']), 'fhc': Outils.format_heure(res['duree_fact_hc']),
't7': "%d" % machine['t_h_reservation_hp_p'], 't8': "%d" % machine['t_h_reservation_hp_np'],
't9': "%d" % machine['t_h_reservation_hc_p'], 't10': "%d" % machine['t_h_reservation_hc_np'],
'p7': Outils.format_si_nul(p7), 'p8': Outils.format_si_nul(p8), 'p9': Outils.format_si_nul(p9),
'p10': Outils.format_si_nul(p10)}
nb = 0
if res['duree_fact_hp'] > 0:
nb += 1
if res['duree_fact_hc'] > 0:
nb += 1
if nb == 0:
return "", [0, 0]
if res['date_suppression'] != "":
nb += 1
if nb == 1:
ligne = r'''%(date)s & %(heure)s''' % dico
else:
ligne = r'''\multirow{''' + str(nb) + r'''}{*}{%(date)s} & \multirow{''' % dico
ligne += str(nb) + r'''}{*}{%(heure)s}''' % dico
nb = 0
if res['duree_fact_hp'] > 0:
ligne += r''' & %(machine)s & HP & %(shp)s & %(fhp)s & %(t7)s & %(t8)s & %(p7)s & %(p8)s \\
''' % dico
nb += 1
if res['duree_fact_hc'] > 0:
if nb > 0:
ligne += r'''& &'''
else:
ligne += r'''& %(machine)s ''' % dico
ligne += r''' & HC & %(shc)s & %(fhc)s & %(t9)s & %(t10)s & %(p9)s & %(p10)s \\
''' % dico
if res['date_suppression'] != "":
ligne += r'''\cline{3-10}
& & \multicolumn{8}{l|}{Supprimé le : %(supprime)s} \\
''' % dico
ligne += r'''\hline
'''
return ligne, [(p7 + p9), (p8 + p10)]
示例2: ligne_cae
# 需要导入模块: from outils import Outils [as 别名]
# 或者: from outils.Outils import format_heure [as 别名]
def ligne_cae(cae, machine, coefmachine):
"""
création d'une ligne de tableau pour un accès
:param cae: accès particulier
:param machine: machine concernée
:param coefmachine: coefficients machine concernée
:return: ligne de tableau latex
"""
t1 = machine['t_h_machine_hp_p'] * coefmachine['coef_p']
t2 = machine['t_h_machine_hp_np'] * coefmachine['coef_np']
t3 = machine['t_h_operateur_hp_mo'] * coefmachine['coef_mo']
t4 = machine['t_h_machine_hc_p'] * coefmachine['coef_p']
t5 = machine['t_h_machine_hc_np'] * coefmachine['coef_np']
t6 = machine['t_h_operateur_hc_mo'] * coefmachine['coef_mo']
p1 = round(t1 * cae['duree_machine_hp'] / 60, 2)
p2 = round(t2 * cae['duree_machine_hp'] / 60, 2)
p3 = round(t3 * cae['duree_operateur_hp'] / 60, 2)
p4 = round(t4 * cae['duree_machine_hc'] / 60, 2)
p5 = round(t5 * cae['duree_machine_hc'] / 60, 2)
p6 = round(t6 * cae['duree_operateur_hc'] / 60, 2)
login = Latex.echappe_caracteres(cae['date_login']).split()
temps = login[0].split('-')
date = temps[0]
for pos in range(1, len(temps)):
date = temps[pos] + '.' + date
if len(login) > 1:
heure = login[1]
else:
heure = ""
dico = {'date': date, 'heure': heure,
'machine': Latex.echappe_caracteres(cae['nom_machine']),
'operateur': Latex.echappe_caracteres(cae['nom_op']),
'rem_op': Latex.echappe_caracteres(cae['remarque_op']),
'rem_staff': Latex.echappe_caracteres(cae['remarque_staff']),
'deq_hp': Outils.format_heure(cae['duree_machine_hp']),
'dmo_hp': Outils.format_heure(cae['duree_operateur_hp']),
'deq_hc': Outils.format_heure(cae['duree_machine_hc']),
'dmo_hc': Outils.format_heure(cae['duree_operateur_hc']),
't1': "%d" % t1, 't2': "%d" % t2, 't3': "%d" % t3, 't4': "%d" % t4, 't5': "%d" % t5, 't6': "%d" % t6,
'p1': Outils.format_si_nul(p1), 'p2': Outils.format_si_nul(p2), 'p3': Outils.format_si_nul(p3),
'p4': Outils.format_si_nul(p4), 'p5': Outils.format_si_nul(p5), 'p6': Outils.format_si_nul(p6)}
nb = 0
if (cae['duree_machine_hp'] > 0) or (cae['duree_operateur_hp'] > 0):
nb += 1
if (cae['duree_machine_hc'] > 0) or (cae['duree_operateur_hc'] > 0):
nb += 1
if nb == 0:
return "", [0, 0, 0]
if (cae['remarque_staff'] != "") or (cae['remarque_op'] != ""):
nb += 1
if nb == 1:
ligne = r'''%(date)s & %(heure)s''' % dico
else:
ligne = r'''\multirow{''' + str(nb) + r'''}{*}{%(date)s} & \multirow{''' % dico
ligne += str(nb) + r'''}{*}{%(heure)s}''' % dico
nb = 0
if (cae['duree_machine_hp'] > 0) or (cae['duree_operateur_hp'] > 0):
ligne += r''' & %(machine)s & HP & %(deq_hp)s & %(dmo_hp)s & %(t1)s & %(t2)s & %(t3)s &
%(p1)s & %(p2)s & %(p3)s \\
''' % dico
nb += 1
if (cae['duree_machine_hc'] > 0) or (cae['duree_operateur_hc'] > 0):
if nb > 0:
ligne += r'''& &'''
else:
ligne += r'''& %(machine)s ''' % dico
ligne += r''' & HC & %(deq_hc)s & %(dmo_hc)s & %(t4)s & %(t5)s & %(t6)s &
%(p4)s & %(p5)s & %(p6)s \\
''' % dico
if (cae['remarque_staff'] != "") or (cae['remarque_op'] != ""):
ligne += r'''\cline{3-12}
& & \multicolumn{10}{l|}{%(operateur)s ; %(rem_op)s ; %(rem_staff)s}\\
''' % dico
ligne += r'''\hline
'''
return ligne, [(p1 + p4), (p2 + p5), (p3 + p6)]
示例3: contenu_client
# 需要导入模块: from outils import Outils [as 别名]
# 或者: from outils.Outils import format_heure [as 别名]
#.........这里部分代码省略.........
resultats = 0
for categorie in generaux.codes_d3():
if categorie in liv_proj_cat:
livs = liv_proj_cat[categorie]
for liv in livs:
nombre_liv += 1
ligne, resultat = Annexes.ligne_liv(liv)
resultats += resultat
contenu_liv += ligne
contenu_liv += r'''
\multicolumn{7}{|r|}{Total} & ''' + Outils.format_si_nul(resultats) + r'''\\
\hline
'''
if nombre_liv > 0:
contenu_projet += Latex.long_tableau(contenu_liv, structure_liv, legende_liv)
# ## liv
if nombre_cae > 0 or nombre_res > 0:
structure_stat_machines = r'''{|l|l|l|l|l|}'''
legende_stat_machines = r'''Statistiques de réservation/utilisation par machine : ''' + \
intitule_compte + r''' / ''' + intitule_projet
contenu_stat_machines = r'''
\hline
Equipement & & Utilisation & Res. Slot & Res. Effect. \\
\hline
'''
for machine_t in sorted(machines_utilisees.items(), key=lambda k_v: k_v[1]['machine']):
machine = machine_t[1]
dico_stat_machines = {
'machine': Latex.echappe_caracteres(machine['machine']),
'usage_hp': Outils.format_heure(machine['usage_hp']),
'reservation_hp': Outils.format_heure(machine['reservation_hp']),
'facture_hp': Outils.format_heure(machine['facture_hp']),
'usage_hc': Outils.format_heure(machine['usage_hc']),
'reservation_hc': Outils.format_heure(machine['reservation_hc']),
'facture_hc': Outils.format_heure(machine['facture_hc'])}
if machine['facture_hp'] > 0 or \
machine['reservation_hp'] or machine['usage_hp']:
contenu_stat_machines += r'''%(machine)s & HP & %(usage_hp)s & %(reservation_hp)s & %(facture_hp)s \\
\hline
''' % dico_stat_machines
if machine['facture_hc'] > 0 or \
machine['reservation_hc'] or machine['usage_hc']:
contenu_stat_machines += r'''%(machine)s & HC & %(usage_hc)s & %(reservation_hc)s & %(facture_hc)s \\
\hline
''' % dico_stat_machines
contenu_projet += Latex.tableau(contenu_stat_machines, structure_stat_machines,
legende_stat_machines)
# ## projet
sco = sommes.sommes_comptes[code_client][id_compte]
dico_recap_projet = {'plafond': "%.2f" % sco['somme_j_pm'], 'non_plafond': "%.2f" % sco['somme_j_nm'],
'prj': "%.2f" % sco['prj'], 'nrj': "%.2f" % sco['nrj'], 'pj': "%.2f" % sco['pj'],
'nj': "%.2f" % sco['nj']}
ligne1 = r'''\hline
Montant article & %(plafond)s & %(non_plafond)s''' % dico_recap_projet
ligne2 = r'''Plafonnement & %(prj)s & %(nrj)s''' % dico_recap_projet
ligne3 = r'''Total article & %(pj)s & %(nj)s''' % dico_recap_projet
示例4: ligne_res
# 需要导入模块: from outils import Outils [as 别名]
# 或者: from outils.Outils import format_heure [as 别名]
def ligne_res(res):
"""
création d'une ligne de tableau pour une réservation
:param res: réservation particulière
:return: ligne de tableau latex
"""
login = Latex.echappe_caracteres(res['date_debut']).split()
temps = login[0].split('-')
date = temps[0]
for pos in range(1, len(temps)):
date = temps[pos] + '.' + date
if len(login) > 1:
heure = login[1]
else:
heure = ""
dico = {'date': date, 'heure': heure,
'machine': Latex.echappe_caracteres(res['nom_machine']),
'reserve': Latex.echappe_caracteres(res['date_reservation']),
'supprime': Latex.echappe_caracteres(res['date_suppression']),
'shp': Outils.format_heure(res['duree_hp']), 'shc': Outils.format_heure(res['duree_hc']),
'fhp': Outils.format_heure(res['duree_fact_hp']), 'fhc': Outils.format_heure(res['duree_fact_hc'])}
nb = 0
if res['duree_fact_hp'] > 0:
nb += 1
if res['duree_fact_hc'] > 0:
nb += 1
if nb == 0:
return ""
if res['date_suppression'] != "":
nb += 1
if nb == 1:
ligne = r'''%(date)s & %(heure)s''' % dico
else:
ligne = r'''\multirow{''' + str(nb) + r'''}{*}{%(date)s} & \multirow{''' % dico
ligne += str(nb) + r'''}{*}{%(heure)s}''' % dico
nb = 0
if res['duree_fact_hp'] > 0:
ligne += r''' & %(machine)s & HP & %(shp)s & %(fhp)s\\
''' % dico
nb += 1
if res['duree_fact_hc'] > 0:
if nb > 0:
ligne += r'''& &'''
else:
ligne += r'''& %(machine)s ''' % dico
ligne += r''' & HC & %(shc)s & %(fhc)s \\
''' % dico
if res['date_suppression'] != "":
ligne += r'''\cline{3-6}
& & \multicolumn{4}{l|}{Supprimé le : %(supprime)s} \\
''' % dico
ligne += r'''\hline
'''
return ligne
示例5: ligne_cae
# 需要导入模块: from outils import Outils [as 别名]
# 或者: from outils.Outils import format_heure [as 别名]
def ligne_cae(cae, machine, coefmachine):
"""
création d'une ligne de tableau pour un accès
:param cae: accès particulier
:param machine: machine concernée
:param coefmachine: coefficients machine concernée
:return: ligne de tableau latex
"""
login = Latex.echappe_caracteres(cae['date_login']).split()
temps = login[0].split('-')
date = temps[0]
for pos in range(1, len(temps)):
date = temps[pos] + '.' + date
if len(login) > 1:
heure = login[1]
else:
heure = ""
mai_hp = round(cae['duree_machine_hp']/60 * cae['pum'], 2)
mai_hc = round(cae['duree_machine_hc']/60 * cae['pum'], 2)
dsi_hp = round(cae['duree_machine_hp']/60 * coefmachine['coef_d'] * machine['d_h_machine_d'], 2)
dsi_hc = round(cae['duree_machine_hc']/60 * coefmachine['coef_d'] * machine['d_h_machine_d'], 2)
dhi = cae['dhi']
moi_hp = round(cae['duree_operateur_hp']/60 * cae['puo_hp'], 2)
moi_hc = round(cae['duree_operateur_hc']/60 * cae['puo_hc'], 2)
m_hp = mai_hp + moi_hp - dsi_hp
m_hc = mai_hc + moi_hc - dsi_hc - dhi
dico = {'date': date, 'heure': heure,
'machine': Latex.echappe_caracteres(cae['nom_machine']),
'operateur': Latex.echappe_caracteres(cae['nom_op']),
'rem_op': Latex.echappe_caracteres(cae['remarque_op']),
'rem_staff': Latex.echappe_caracteres(cae['remarque_staff']),
'tm_hp': Outils.format_heure(cae['duree_machine_hp']),
'to_hp': Outils.format_heure(cae['duree_operateur_hp']),
'tm_hc': Outils.format_heure(cae['duree_machine_hc']),
'to_hc': Outils.format_heure(cae['duree_operateur_hc']),
'pum': cae['pum'], 'puo_hp': cae['puo_hp'], 'puo_hc': cae['puo_hc'], 'mai_hp': "%.2f" % mai_hp,
'mai_hc': "%.2f" % mai_hc, 'dsi_hp': Outils.format_si_nul(dsi_hp),
'dsi_hc': Outils.format_si_nul(dsi_hc), 'dhi_hp': '-', 'dhi_hc': Outils.format_si_nul(dhi),
'moi_hp': "%.2f" % moi_hp, 'moi_hc': "%.2f" % moi_hc, 'm_hp': "%.2f" % m_hp, 'm_hc': "%.2f" % m_hc}
nb = 0
if (cae['duree_machine_hp'] > 0) or (cae['duree_operateur_hp'] > 0):
nb += 1
if (cae['duree_machine_hc'] > 0) or (cae['duree_operateur_hc'] > 0):
nb += 1
if nb == 0:
return "", [0, 0, 0, 0, 0]
if (cae['remarque_staff'] != "") or (cae['remarque_op'] != ""):
nb += 1
if nb == 1:
ligne = r'''%(date)s & %(heure)s''' % dico
else:
ligne = r'''\multirow{''' + str(nb) + r'''}{*}{%(date)s} & \multirow{''' % dico
ligne += str(nb) + r'''}{*}{%(heure)s}''' % dico
nb = 0
if (cae['duree_machine_hp'] > 0) or (cae['duree_operateur_hp'] > 0):
ligne += r''' & %(machine)s & HP & %(tm_hp)s & %(to_hp)s & %(pum)s & %(puo_hp)s & %(mai_hp)s &
%(dsi_hp)s & %(dhi_hp)s & %(moi_hp)s & %(m_hp)s \\
''' % dico
nb += 1
if (cae['duree_machine_hc'] > 0) or (cae['duree_operateur_hc'] > 0):
if nb > 0:
ligne += r'''& &'''
else:
ligne += r'''& %(machine)s ''' % dico
ligne += r''' & HC & %(tm_hc)s & %(to_hc)s & %(pum)s & %(puo_hc)s & %(mai_hc)s &
%(dsi_hc)s & %(dhi_hc)s & %(moi_hc)s & %(m_hc)s \\
''' % dico
if (cae['remarque_staff'] != "") or (cae['remarque_op'] != ""):
ligne += r'''\cline{3-13}
& & \multicolumn{11}{l|}{%(operateur)s ; %(rem_op)s ; %(rem_staff)s}\\
''' % dico
ligne += r'''\hline
'''
return ligne, [(mai_hp + mai_hc), (dsi_hp + dsi_hc), dhi, (moi_hp + moi_hc), (m_hp + m_hc)]
示例6: contenu_client
# 需要导入模块: from outils import Outils [as 别名]
# 或者: from outils.Outils import format_heure [as 别名]
#.........这里部分代码省略.........
Equipement & & Slot rés. & Slot ann. & Taux & Utilisation minimale & Machine & Pénalités [h] \\
\hline
'''
for machine_t in sorted(machines_utilisees.items(), key=lambda k_v: k_v[1]['machine']):
machine = machine_t[1]
id_machine = machine_t[0]
taux_hp = machines.donnees[id_machine]['tx_occ_eff_hp']
taux_hc = machines.donnees[id_machine]['tx_occ_eff_hc']
duree_hp = 0
duree_hc = 0
res_hp = 0
res_hc = 0
ann_hp = 0
ann_hc = 0
if id_machine in somme_cae_compte:
duree_hp = somme_cae_compte[id_machine]['duree_hp']
duree_hc = somme_cae_compte[id_machine]['duree_hc']
if id_machine in somme_res_compte:
res_hp = somme_res_compte[id_machine]['res_hp']
res_hc = somme_res_compte[id_machine]['res_hc']
ann_hp = somme_res_compte[id_machine]['ann_hp']
ann_hc = somme_res_compte[id_machine]['ann_hc']
min_hp = (res_hp + ann_hp) * taux_hp / 100
min_hc = (res_hc + ann_hc) * taux_hc / 100
pen_hp = min_hp - duree_hp
pen_hc = min_hc - duree_hc
dico_stat_machines = {
'machine': Latex.echappe_caracteres(machine['machine']),
'res_hp': Outils.format_heure(res_hp), 'res_hc': Outils.format_heure(res_hc),
'ann_hp': Outils.format_heure(ann_hp), 'ann_hc': Outils.format_heure(ann_hc),
'duree_hp': Outils.format_heure(duree_hp), 'duree_hc': Outils.format_heure(duree_hc),
'taux_hp': str(int(taux_hp)) + '\%', 'taux_hc': str(int(taux_hc)) + '\%',
'min_hp': Outils.format_heure(min_hp), 'min_hc': Outils.format_heure(min_hc),
'pen_hp': "%.1f" % round(pen_hp/60, 1), 'pen_hc': "%.1f" % round(pen_hc/60, 1)}
if res_hp > 0 or ann_hp or duree_hp:
contenu_stat_machines += r'''%(machine)s & HP & %(res_hp)s & %(ann_hp)s & %(taux_hp)s &
%(min_hp)s & %(duree_hp)s & %(pen_hp)s \\
\hline
''' % dico_stat_machines
if res_hc > 0 or ann_hc or duree_hc:
contenu_stat_machines += r'''%(machine)s & HC & %(res_hc)s & %(ann_hc)s & %(taux_hc)s &
%(min_hc)s & %(duree_hc)s & %(pen_hc)s \\
\hline
''' % dico_stat_machines
contenu_compte += Latex.tableau(contenu_stat_machines, structure_stat_machines,
legende_stat_machines)
contenu_compte += contenu_projet
# ## compte
dic_entete = {'code': code_client, 'code_sap': client['code_sap'],
'nom': Latex.echappe_caracteres(client['abrev_labo']),
'date': edition.mois_txt + " " + str(edition.annee)}
entete = r'''
%(code)s - %(code_sap)s - %(nom)s - %(date)s
''' % dic_entete
contenu += entete