Mercurial > repos > artbio > facturation_ibps
annotate facturation.py @ 0:27f2ef353554 draft
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
author | artbio |
---|---|
date | Mon, 11 May 2020 19:42:27 -0400 |
parents | |
children | e93bf8bd0e93 |
rev | line source |
---|---|
0
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
1 # -*- coding: utf-8 -*- |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
2 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
3 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
4 import argparse |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
5 import re |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
6 import warnings |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
7 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
8 import openpyxl |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
9 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
10 import pandas as pd |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
11 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
12 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
13 warnings.filterwarnings("ignore") |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
14 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
15 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
16 def Parser(): |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
17 the_parser = argparse.ArgumentParser() |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
18 the_parser.add_argument('--input', '-i', action='store', type=str, |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
19 help="input html code to convert to xlsx") |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
20 the_parser.add_argument('--output', '-o', action='store', type=str, |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
21 help='xlsx converted file') |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
22 the_parser.add_argument('--template', '-t', action='store', type=str, |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
23 help='xlsx template file') |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
24 the_parser.add_argument('--reduction', '-r', action='store', type=float, |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
25 help='reduction to apply', default=1.0) |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
26 args = the_parser.parse_args() |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
27 return args |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
28 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
29 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
30 def main(template, input_file, output_file, reduction): |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
31 """Script de parsing des fichiers de facturation de l'IBPS""" |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
32 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
33 # ouverture fichier input |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
34 with open(input_file, 'rb') as file_object: |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
35 facture_html = file_object.read() |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
36 # convert to unicode utf-8, remove   and € |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
37 facture_html = facture_html.decode('utf-8') |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
38 facture_html = facture_html.replace(r' ', r' ') |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
39 facture_html = facture_html.replace(r' €', '') |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
40 facture_html = facture_html.replace(u' \u20ac', '') |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
41 # parsing de la référence, de la date et de la période de facturation |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
42 date = re.search(r'Paris le (.*?)</p>', |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
43 facture_html).group(1) |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
44 periode = re.search(r'de la prestation (.*?)</p>', |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
45 facture_html).group(1) |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
46 ref = re.search(r'rence interne d.*? :\s*(.*?)<', |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
47 facture_html).group(1) |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
48 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
49 # parsing des tableaux html avec pandas |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
50 facture_parsed = pd.read_html( |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
51 facture_html, |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
52 thousands='', |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
53 decimal='.', |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
54 flavor='bs4') |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
55 # remove 'Adresse de l'appel à facturation : ' (\xa0:\xa0) |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
56 adresse = facture_parsed[0].replace( |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
57 r"Adresse de l\'appel \xe0 facturation : ", r'', regex=True) |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
58 adresse = adresse.replace( |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
59 r"Adresse du client : ", r'', regex=True) |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
60 elements = facture_parsed[1] |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
61 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
62 # conversion des noms de colonnes |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
63 elements_col = elements.iloc[0] |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
64 cout_col = elements_col.str.extract(r'(cout.*)', |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
65 expand=False).dropna().iloc[0] |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
66 elements = elements.rename(columns=elements_col).drop( |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
67 elements.index[0]) |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
68 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
69 # changement du type des éléments numériques du tableau |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
70 elements[u'nombre(s)'] = pd.to_numeric(elements[u'nombre(s)']) |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
71 elements[cout_col] = pd.to_numeric(elements[cout_col]) |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
72 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
73 # ouverture fichier output |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
74 facture_output = openpyxl.load_workbook( |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
75 template, data_only='True', keep_vba=False) |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
76 ws = facture_output.worksheets[0] |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
77 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
78 # rajout de l'image de SU qui ne survit pas à la conversion |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
79 img = openpyxl.drawing.image.Image('template_SU.jpg') |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
80 img.anchor = "A1" |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
81 ws.add_image(img) |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
82 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
83 # ajout des éléments facturés dans le tableau |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
84 element_row = 23 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
85 for i in range(len(elements)): |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
86 element_row += 1 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
87 ws.cell(row=element_row, column=1, value=elements.iloc[i][u'Objet']) |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
88 ws.cell( |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
89 row=element_row, |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
90 column=2, |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
91 value=elements.iloc[i][u'nombre(s)']).number_format = '0.00' |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
92 ws.cell( |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
93 row=element_row, |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
94 column=4, |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
95 value=((1-reduction) * |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
96 elements.iloc[i][cout_col])).number_format = '0.00' |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
97 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
98 # ajout de l'adresse |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
99 address_row = 7 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
100 for i in range(len(adresse)): |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
101 address_row += 1 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
102 ws.cell(row=address_row, column=3, |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
103 value=adresse.iloc[i, 0].encode('utf-8')) |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
104 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
105 # ajout de la référence/période/date |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
106 ws.cell(row=2, column=3, value=ref.encode('utf-8')) |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
107 ws.cell(row=5, column=5, value=periode.encode('utf-8')) |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
108 ws.cell(row=21, column=5, value=date.encode('utf-8')) |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
109 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
110 # export fichier output |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
111 facture_output.save(output_file) |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
112 return |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
113 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
114 |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
115 if __name__ == '__main__': |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
116 args = Parser() |
27f2ef353554
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
artbio
parents:
diff
changeset
|
117 main(args.template, args.input, args.output, args.reduction) |