gen_taxes_2021_12.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. 'ASCOMVEL',
  23. 'ASDONAT',
  24. 'ASPRO',
  25. 'ASIONAG',
  26. 'ASIVP',
  27. '_TREND',
  28. 'ALPHA',
  29. 'ASOBS',
  30. 'BREIS',
  31. 'CSAKI',
  32. 'ECOPROT',
  33. 'ENIBEL',
  34. 'FEHER',
  35. 'FORSALE',
  36. 'IDEA',
  37. 'LUXWIN',
  38. 'MATILAND',
  39. 'MOCAN',
  40. 'SCOM',
  41. 'TREND',
  42. 'UNION',
  43. 'CLEAN',
  44. 'ECOS',
  45. 'MEDFAC',
  46. 'MEDCOM',
  47. # 'COMELECT',
  48. 'DATAV'
  49. 'JOART',
  50. # 'RECYC',
  51. ]
  52. head = [
  53. 'Denumire', 'CF', 'J', 'Adresa', 'Oras', 'Judet', 'Prescurtat', 'Admin', 'AdminP', 'RCNP', 'Obs'
  54. ]
  55. my_headers = [
  56. 'Denumire', 'CF', 'J', 'Adresa', 'Oras', 'Judet', 'Prescurtat', 'Admin', 'AdminP', 'RCNP', 'Obs',
  57. 'VAT', 'VAT FINAL', 'INC_TAX', 'DIV_TAX', 'CAS', 'CASS', 'SAL_TAX', 'CAM', 'CA', 'VAT CA', 'PN', 'month'
  58. ]
  59. my_headers2 = [
  60. 'Denumire', 'CF', 'J', 'Adresa', 'Oras', 'Judet', 'Prescurtat',
  61. 'Admin', 'AdminP', 'RCNP', 'Obs', 'divid',
  62. 'divid_current', 'divid_intermed', 'divid_inter_current', 'spons', 'advances', 'deb_div', 'credit_final', 'month'
  63. ]
  64. mentor = WinMentor()
  65. utils = Mentorutils()
  66. # office = mentor.filtered_firmlist('/firme.db', headers=head, ban=exclude)
  67. # utils.gen_turnover('turn_over', 'to', office, n_headers=my_headers)
  68. office = list(mentor.filtered_firmlist(headers=head, ban=exclude))
  69. utils.gen_tax_payable('xlsx/taxes', 'tx', office, m_month=gen_month.group(), n_headers=my_headers, n_headers2=my_headers2) # type: ignore
  70. # utils.gen_txt('/firme.db', 'lista_cf.txt', _attr_index=1)
  71. # check_list('lista_cf.txt')
  72. file_open('xlsx/taxes.xlsm')