diff 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
line wrap: on
line diff
--- a/facturation.py	Wed Jan 09 18:00:33 2019 -0500
+++ b/facturation.py	Thu Jan 10 11:19:53 2019 -0500
@@ -17,11 +17,13 @@
                             help='xlsx converted file')
     the_parser.add_argument('--template', '-t', action='store', type=str,
                             help='xlsx template file')
+    the_parser.add_argument('--reduction', '-r', action='store', type=float,
+                            help='reduction to apply', default=1.0)
     args = the_parser.parse_args()
     return args
 
 
-def main(template, input_file, output_file):
+def main(template, input_file, output_file, reduction):
     """Script de parsing des fichiers de facturation de l'IBPS"""
 
     # ouverture fichier input
@@ -86,7 +88,8 @@
         ws.cell(
             row=element_row,
             column=4,
-            value=elements.iloc[i][cout_col]).number_format = '0.00'
+            value=((1-reduction) *
+                   elements.iloc[i][cout_col])).number_format = '0.00'
 
     # ajout de l'adresse
     address_row = 7
@@ -107,4 +110,4 @@
 
 if __name__ == '__main__':
     args = Parser()
-    main(args.template, args.input, args.output)
+    main(args.template, args.input, args.output, args.reduction)