1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- '''Created 15 Jun 2023 Levi'''
- # from datetime import date
- import os
- from jinja2 import (Environment, PackageLoader)
- from pymt940 import (PaymentsProcessorRncb, 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', 'CHRPRI')
- currency = 'ron'
- # currency = 'eur'
- # currency = 'usd'
- # currency = 'huf'
- acc_currency = 'accountron'
- # acc_currency = 'accounteur'
- # acc_currency = 'accountusd'
- # acc_currency = 'accounthuf'
- processor = PaymentsProcessorRncb(os.path.join(downloads_dir, private.CHRYS[currency]), private.CHRYS['name'],
- account_name=private.CHRYS[acc_currency]['name'],
- account_number=private.CHRYS[acc_currency]['number'],
- currency=private.CHRYS[acc_currency]['currency'],
- account_location=private.CHRYS['location'],
- account_agency=private.CHRYS['agency'],
- account_symbol=private.CHRYS['symbol'])
- if __name__ == '__main__':
- if 'incomes' in body_template:
- processor.process_income_data(day_slice=(0, 2))
- symbol = 411.01
- kind = 'TotalIncasari'
- output_file = os.path.join(downloads_dir, 'mentor_incasari.txt')
- else:
- processor.process_payment_data(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='_CHRYSOPEEA SRL', acc_symbol=symbol)
- output = template.render(data)
- print(output)
- with open(output_file, 'w') as text:
- text.write(output)
|