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