gen_society.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # coding: utf-8
  2. import sys
  3. import re
  4. from time import sleep
  5. import pywinctl as gw
  6. from winmentor import (
  7. WinMentor,
  8. Mentorutils,
  9. check_list, # @UnusedImport,
  10. file_open
  11. )
  12. def parse_and_close(title):
  13. close_title = gw.getWindowsWithTitle(title)[0]
  14. # gw.Win32Window.close()
  15. close_title.activate()
  16. sleep(2)
  17. close_title.close()
  18. # gen_month = sys.argv[0][24:-3]
  19. gen_month = re.search('[0-9]{4}?_[0-9]{2}?', sys.argv[0])
  20. # print(gen_month.group())
  21. exclude = [
  22. 'ASIVP', 'ASOBS', 'CLEAN', 'ECOS', 'MEDFAC', 'MEDCOM',
  23. 'COMELECT', 'DATAV', 'ECOPROT', 'JOART', 'CRH', 'RECYC', 'QCLINIC'
  24. ]
  25. head = [
  26. 'Denumire', 'CF', 'J', 'Adresa', 'Oras', 'Judet', 'Prescurtat', 'Admin', 'AdminP', 'RCNP', 'Obs'
  27. ]
  28. my_headers = [
  29. 'Denumire', 'CF', 'J', 'Adresa', 'Oras', 'Judet', 'Prescurtat', 'Admin', 'AdminP', 'RCNP', 'Obs',
  30. 'VAT', 'VAT FINAL', 'INC_TAX', 'DIV_TAX', 'CAS', 'CASS', 'SAL_TAX', 'CAM', 'CA', 'PN', 'year', 'month'
  31. ]
  32. mentor = WinMentor()
  33. utils = Mentorutils()
  34. # office = mentor.filtered_firmlist('/firme.db', headers=head, ban=exclude)
  35. # utils.gen_turnover('turn_over', 'to', office, n_headers=my_headers)
  36. office = mentor.filtered_firmlist(headers=head, ban=exclude)
  37. utils.gen_society('society', 'tx', list(office), 'CONSDEN', n_headers=my_headers, range_year='2017-2019', range_month='10-12')
  38. # utils.gen_txt('/firme.db', 'lista_cf.txt', _attr_index=1)
  39. # check_list('lista_cf.txt')
  40. file_open('society.xlsm')