77
88
99def fill_invoice_items (settings , items ):
10+ """
11+ Calculates the items which will appear on the invoice, as well as the total_gross,
12+ total_net and total_vat value.
13+ """
1014 invoice_total_net = float ()
1115 invoice_total_vat = float ()
1216 invoice_total_gross = float ()
@@ -36,6 +40,13 @@ def fill_invoice_items(settings, items):
3640
3741
3842def generate_invoice (settings , contract , year , month ):
43+ """
44+ Creates an invoice, i.e. calls the fill_invoice_items function, to get
45+ all the numbers right, as well as filling all the remaining required meta
46+ information about the customer.
47+
48+ It returns the invoice dict.
49+ """
3950 invoice_items , net , vat , gross = fill_invoice_items (settings , contract ["items" ])
4051
4152 invoice_data = {}
@@ -68,6 +79,9 @@ def iterate_invoices(settings):
6879
6980
7081def render_invoices (settings ):
82+ """
83+ Renders all invoices and saves pdfs to settings.invoices_dir.
84+ """
7185 template = get_template (settings .invoice_template_file )
7286
7387 for contract_invoice_dir , filename in iterate_invoices (settings ):
@@ -98,6 +112,9 @@ def render_invoices(settings):
98112
99113
100114def save_invoice_yaml (settings , invoice_data , force = False ):
115+ """
116+ Saves the invoice_data to a yaml file in settings.invoices_dir.
117+ """
101118 invoice_contract_dir = settings .invoices_dir / invoice_data ["cid" ]
102119
103120 if not invoice_contract_dir .is_dir ():
@@ -112,6 +129,9 @@ def save_invoice_yaml(settings, invoice_data, force=False):
112129
113130
114131def create_invoices (settings , year , month , cid_only = None , force = False ):
132+ """
133+ Bulk creates invoice yaml files for a specific month-year-combination.
134+ """
115135 if force :
116136 print ("Force create enabled" )
117137
@@ -126,6 +146,9 @@ def create_invoices(settings, year, month, cid_only=None, force=False):
126146
127147
128148def send_invoices (settings , year , month , cid_only , force ):
149+ """
150+ Sends emails with the invoices as attachment.
151+ """
129152 mail_template = get_template (settings .invoice_mail_template_file )
130153
131154 if force :
0 commit comments