# coding: utf-8 import sys import re from time import sleep import pywinctl as gw from winmentor import ( WinMentor, Mentorutils, check_list, # @UnusedImport, file_open ) def parse_and_close(title): close_title = gw.getWindowsWithTitle(title)[0] # gw.Win32Window.close() close_title.activate() sleep(2) close_title.close() # gen_month = sys.argv[0][24:-3] gen_month = re.search('[0-9]{4}?_[0-9]{2}?', sys.argv[0]) # print(gen_month.group()) exclude = [ 'ASCOMVEL', 'ASDONAT', 'ASPRO', 'ASIONAG', 'ASIVP', '_TREND', 'ALPHA', 'ASOBS', 'BREIS', 'CSAKI', 'ECOPROT', 'ENIBEL', 'FEHER', 'FORSALE', 'IDEA', 'LUXWIN', 'MATILAND', 'MOCAN', 'SCOM', 'TREND', 'UNION', 'CLEAN', 'ECOS', 'MEDFAC', 'MEDCOM', # 'COMELECT', 'DATAV' 'JOART', # 'RECYC', ] head = [ 'Denumire', 'CF', 'J', 'Adresa', 'Oras', 'Judet', 'Prescurtat', 'Admin', 'AdminP', 'RCNP', 'Obs' ] my_headers = [ 'Denumire', 'CF', 'J', 'Adresa', 'Oras', 'Judet', 'Prescurtat', 'Admin', 'AdminP', 'RCNP', 'Obs', 'VAT', 'VAT FINAL', 'INC_TAX', 'DIV_TAX', 'CAS', 'CASS', 'SAL_TAX', 'CAM', 'CA', 'VAT CA', 'PN', 'month' ] my_headers2 = [ 'Denumire', 'CF', 'J', 'Adresa', 'Oras', 'Judet', 'Prescurtat', 'Admin', 'AdminP', 'RCNP', 'Obs', 'divid', 'divid_current', 'divid_intermed', 'divid_inter_current', 'spons', 'advances', 'deb_div', 'credit_final', 'month' ] mentor = WinMentor() utils = Mentorutils() # office = mentor.filtered_firmlist('/firme.db', headers=head, ban=exclude) # utils.gen_turnover('turn_over', 'to', office, n_headers=my_headers) office = list(mentor.filtered_firmlist(headers=head, ban=exclude)) utils.gen_tax_payable('xlsx/taxes', 'tx', office, m_month=gen_month.group(), n_headers=my_headers, n_headers2=my_headers2) # type: ignore # utils.gen_txt('/firme.db', 'lista_cf.txt', _attr_index=1) # check_list('lista_cf.txt') file_open('xlsx/taxes.xlsm')