|
@@ -0,0 +1,51 @@
|
|
|
+'''Created 15 Jun 2023 Levi'''
|
|
|
+
|
|
|
+# from datetime import date
|
|
|
+import os
|
|
|
+from jinja2 import (Environment, PackageLoader)
|
|
|
+from pymt940.languages import LANG
|
|
|
+from pymt940 import (PaymentsProcessorBtrl, private) # utils
|
|
|
+
|
|
|
+templates = Environment(loader=PackageLoader('pymt940', 'templates'))
|
|
|
+# body_template = 'body_incomes.txt'
|
|
|
+body_template = 'body_payments.txt'
|
|
|
+template = templates.get_template(body_template)
|
|
|
+home = os.path.expanduser('~')
|
|
|
+downloads_dir = os.path.join(home, 'Downloads', 'mentor', 'import', 'RIDEWAVE')
|
|
|
+
|
|
|
+currency = 'ron'
|
|
|
+# currency = 'eur'
|
|
|
+# currency = 'usd'
|
|
|
+# currency = 'huf'
|
|
|
+acc_currency = 'accountron'
|
|
|
+# acc_currency = 'accounteur'
|
|
|
+# acc_currency = 'accountusd'
|
|
|
+# acc_currency = 'accounthuf'
|
|
|
+
|
|
|
+processor = PaymentsProcessorBtrl(os.path.join(downloads_dir, private.RIDEW[currency]), private.RIDEW['name'],
|
|
|
+ account_name=private.RIDEW[acc_currency]['name'],
|
|
|
+ account_number=private.RIDEW[acc_currency]['number'],
|
|
|
+ currency=private.RIDEW[acc_currency]['currency'],
|
|
|
+ account_location=private.RIDEW['location'],
|
|
|
+ account_agency=private.RIDEW['agency'],
|
|
|
+ account_symbol=private.RIDEW['symbol'])
|
|
|
+
|
|
|
+
|
|
|
+if __name__ == '__main__':
|
|
|
+ if 'incomes' in body_template:
|
|
|
+ processor.process_income_data(lang=LANG.RO, day_slice=(0, 2))
|
|
|
+ symbol = 411.01
|
|
|
+ kind = 'TotalIncasari'
|
|
|
+ output_file = os.path.join(downloads_dir, 'mentor_incasari.txt')
|
|
|
+ else:
|
|
|
+ processor.process_payment_data(lang=LANG.RO, day_slice=(0, 2))
|
|
|
+ symbol = 401
|
|
|
+ kind = 'TotalPlati'
|
|
|
+ output_file = os.path.join(downloads_dir, 'mentor_plati.txt')
|
|
|
+
|
|
|
+ data = processor.to_dict(kind=kind, month_back=1,
|
|
|
+ std_client='_RIDEWAVE SRL', acc_symbol=symbol)
|
|
|
+ output = template.render(data)
|
|
|
+ print(output)
|
|
|
+ with open(output_file, 'w') as text:
|
|
|
+ text.write(output)
|