comparison facturation.py @ 7:b8460b9f4253 draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 55ddb8704457ef6616412bfae382c36191aeab8a-dirty
author artbio
date Thu, 10 Jan 2019 11:19:53 -0500
parents 10333ba7d53a
children e62e3b548b7e
comparison
equal deleted inserted replaced
6:674eae0b423f 7:b8460b9f4253
15 help="input html code to convert to xlsx") 15 help="input html code to convert to xlsx")
16 the_parser.add_argument('--output', '-o', action='store', type=str, 16 the_parser.add_argument('--output', '-o', action='store', type=str,
17 help='xlsx converted file') 17 help='xlsx converted file')
18 the_parser.add_argument('--template', '-t', action='store', type=str, 18 the_parser.add_argument('--template', '-t', action='store', type=str,
19 help='xlsx template file') 19 help='xlsx template file')
20 the_parser.add_argument('--reduction', '-r', action='store', type=float,
21 help='reduction to apply', default=1.0)
20 args = the_parser.parse_args() 22 args = the_parser.parse_args()
21 return args 23 return args
22 24
23 25
24 def main(template, input_file, output_file): 26 def main(template, input_file, output_file, reduction):
25 """Script de parsing des fichiers de facturation de l'IBPS""" 27 """Script de parsing des fichiers de facturation de l'IBPS"""
26 28
27 # ouverture fichier input 29 # ouverture fichier input
28 with open(input_file, 'r') as file_object: 30 with open(input_file, 'r') as file_object:
29 facture_html = file_object.read() 31 facture_html = file_object.read()
84 column=2, 86 column=2,
85 value=elements.iloc[i][u'nombre(s)']).number_format = '0.00' 87 value=elements.iloc[i][u'nombre(s)']).number_format = '0.00'
86 ws.cell( 88 ws.cell(
87 row=element_row, 89 row=element_row,
88 column=4, 90 column=4,
89 value=elements.iloc[i][cout_col]).number_format = '0.00' 91 value=((1-reduction) *
92 elements.iloc[i][cout_col])).number_format = '0.00'
90 93
91 # ajout de l'adresse 94 # ajout de l'adresse
92 address_row = 7 95 address_row = 7
93 for i in range(len(adresse)): 96 for i in range(len(adresse)):
94 address_row += 1 97 address_row += 1
105 return 108 return
106 109
107 110
108 if __name__ == '__main__': 111 if __name__ == '__main__':
109 args = Parser() 112 args = Parser()
110 main(args.template, args.input, args.output) 113 main(args.template, args.input, args.output, args.reduction)