dbread.py 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. '''
  2. Created on Jun 21, 2018 @author: levente.marton
  3. '''
  4. import os
  5. import shutil
  6. import re
  7. import datetime
  8. from dataclasses import dataclass
  9. from pypxlib import Table
  10. @dataclass
  11. class Company:
  12. name: str
  13. vat_code: str
  14. reg_number: str
  15. address: str
  16. location: str
  17. county: str
  18. shortname: str
  19. obs: str
  20. adm: str
  21. admp: str
  22. admcnp: str
  23. mail: str = None
  24. price: int = None
  25. @dataclass
  26. class Account:
  27. clasa: str
  28. simbol: str
  29. denumire: str
  30. soldid: str = None
  31. soldic: str = None
  32. precedentd: str = None
  33. precedentc: str = None
  34. curentd: str = None
  35. curentc: str = None
  36. def soldf(self, type_):
  37. if type_ == 'd':
  38. return round((self.soldid + self.precedentd + self.curentd) -
  39. (self.soldic + self.precedentc + self.curentc))
  40. elif type_ == 'c':
  41. return round((self.soldic + self.precedentc + self.curentc) -
  42. (self.soldid + self.precedentd + self.curentd))
  43. class WinMentor(object):
  44. '''
  45. Class to read winmentor database
  46. '''
  47. def __init__(self, winment_path=os.getenv('WINMENT', 'c:/winment/data/').replace('\\', '/')):
  48. '''
  49. Constructor
  50. '''
  51. self.winment_path = winment_path
  52. @property
  53. def get_winment_path(self):
  54. return self.winment_path
  55. @get_winment_path.setter
  56. def set_winment_path(self, value):
  57. # self.value = value
  58. self.winment_path = value
  59. return self.winment_path
  60. def update_copy(self, db_file) -> str:
  61. '''returns the updated version of a .db file
  62. :param db_file is a .db from winmentor'''
  63. # self._to_file = db_file
  64. _, file_name = os.path.split(db_file)
  65. dir_list = db_file.split('/')
  66. # !!NOTE: if path is ?/winment/data/ then this must be 3 & 5
  67. # if is ?/winment/winment/data/ then 4 & 6
  68. dir_to_file = dir_list[4]
  69. if len(dir_list) != 6:
  70. os.makedirs(os.path.join('cash', dir_to_file), exist_ok=True)
  71. cashed_copy_mtime = -1
  72. if os.path.isfile(os.path.join('./cash/', dir_to_file, file_name)):
  73. cashed_copy_mtime = os.stat(os.path.join('./cash/', dir_to_file, file_name)).st_mtime
  74. if os.stat(db_file).st_mtime != cashed_copy_mtime:
  75. shutil.copy2(db_file, os.path.join('./cash', dir_to_file))
  76. return(os.path.join('./cash/', dir_to_file, file_name))
  77. else:
  78. os.makedirs('cash', exist_ok=True)
  79. cashed_copy_mtime = -1
  80. if os.path.isfile('./cash/' + file_name):
  81. cashed_copy_mtime = os.stat('./cash/' + file_name).st_mtime
  82. if os.stat(db_file).st_mtime != cashed_copy_mtime:
  83. shutil.copy2(db_file, './cash')
  84. return('./cash/' + file_name)
  85. def make_list(self, db_file, headers) -> list:
  86. '''returns a list of lists with elements from a given db file
  87. :param db_file is .db file from winmentor
  88. :param headers are the fields of the specified db file'''
  89. file_name = self.update_copy(db_file)
  90. with Table(file_name) as table:
  91. m_list = []
  92. for row in table:
  93. item = []
  94. for header in headers:
  95. element = row[header]
  96. if type(element) == datetime.date:
  97. if element < datetime.date(1999, 1, 1):
  98. element = ''
  99. item.append(element)
  100. m_list.append(item)
  101. return m_list
  102. def make_sal_list(self, file_1, file_2) -> list:
  103. '''returns list with all_ employees in current month
  104. :param file_1 is npers.db from shortname
  105. :param file_2 is likisal.db shortname/current_month'''
  106. file_name1 = self.update_copy(self.winment_path + file_1)
  107. file_name2 = self.update_copy(self.winment_path + file_2)
  108. with Table(file_name1) as perss, Table(file_name2) as sals:
  109. empl_all = []
  110. # for field in perss.fields:
  111. for sal in sals:
  112. for pers in perss:
  113. # print(pers)
  114. if pers.Cod == sal.Cod:
  115. empl = []
  116. empl.append(pers.Cod)
  117. empl.append(f'{pers.Nume} {pers.Prenume}')
  118. empl.append(pers.DataAngF.strftime('%d-%m-%Y'))
  119. empl.append(sal.VenitBrut)
  120. empl.append(sal.SalRealizat)
  121. empl.append(sal.CO)
  122. empl.append(round(sal.SalOra, 2))
  123. empl.append(sal.ContribAngajat)
  124. empl.append(round(sal.ContribAngajator, 2))
  125. empl.append(sal.VenitNet)
  126. empl.append(sal.Impozit)
  127. empl.append(sal.SalarNet)
  128. empl.append(sal.OreLucrate)
  129. empl.append(sal.ZileLuk)
  130. empl.append(sal.ZileCO)
  131. empl_all.append(empl)
  132. # dict_ = {}
  133. # dict_['Cod'] = pers.Cod
  134. # dict_['Nume'] = f'{pers.Nume} {pers.Prenume}'
  135. # dict_['DataAngF'] = pers.DataAngF.strftime('%d-%m-%Y')
  136. # dict_['VenitBrut'] = sal.VenitBrut
  137. # dict_['SalRealizat'] = sal.SalRealizat
  138. # dict_['CO'] = sal.CO
  139. # dict_['SalOra'] = round(sal.SalOra, 2)
  140. # dict_['ContribAngajat'] = sal.ContribAngajat
  141. # dict_['ContribAngajator'] = round(sal.ContribAngajator, 2)
  142. # dict_['VenitNet'] = sal.VenitNet
  143. # dict_['Impozit'] = sal.Impozit
  144. # dict_['SalarNet'] = sal.SalarNet
  145. # dict_['OreLucrate'] = sal.OreLucrate
  146. # dict_['ZileLuk'] = sal.ZileLuk
  147. # dict_['ZileCO'] = sal.ZileCO
  148. # empl.append(dict_)
  149. return empl_all
  150. def gen_firms(self, db_file, headers) -> list:
  151. '''generates company list from firme.db file
  152. :param db_file is firme.db from winment/data folder'''
  153. file_db = self.update_copy(self.winment_path + db_file)
  154. with Table(file_db) as table:
  155. for row in table:
  156. yield [row[header] for header in headers]
  157. def firmlist(self, headers, db_file='/firme.db', ban=None) -> list:
  158. '''returns company list from firme.db file
  159. :param db_file is firme.db from winment/data folder
  160. :param list headers is the fields from firme.db file
  161. :param list|str ban companies excluded from list'''
  162. comp_list = []
  163. for a_company in self.gen_firms(db_file, headers):
  164. company = Company(
  165. name=a_company[0],
  166. vat_code=a_company[1],
  167. reg_number=a_company[2],
  168. address=a_company[3],
  169. location=a_company[4],
  170. county=a_company[5],
  171. shortname=a_company[6],
  172. adm=a_company[7],
  173. admp=a_company[8],
  174. admcnp=a_company[9],
  175. obs=a_company[10])
  176. comp_list.append(company)
  177. if ban:
  178. if type(ban) is list:
  179. for r in comp_list:
  180. for company_shortname in ban:
  181. if company_shortname == r.shortname:
  182. comp_list.remove(r)
  183. else:
  184. for r in comp_list:
  185. if r == ban:
  186. comp_list.remove(r)
  187. return comp_list
  188. def filtered_firmlist(self, headers, db_file='/firme.db', ban=None) -> list:
  189. '''generates company list from firme.db file
  190. :param db_file is firme.db from winment/data folder
  191. :param list headers is the fields from firme.db file
  192. :param list|str ban companies excluded from list'''
  193. if ban:
  194. if type(ban) is list:
  195. for a_company in self.gen_firms(db_file, headers):
  196. company = Company(
  197. name=a_company[0],
  198. vat_code=a_company[1],
  199. reg_number=a_company[2],
  200. address=a_company[3],
  201. location=a_company[4],
  202. county=a_company[5],
  203. shortname=a_company[6],
  204. adm=a_company[7],
  205. admp=a_company[8],
  206. admcnp=a_company[9],
  207. obs=a_company[10])
  208. if a_company[6] not in ban:
  209. yield [company.name, company.vat_code, company.reg_number,
  210. company.address, company.location, company.county,
  211. company.shortname, company.adm, company.admp,
  212. company.admcnp, company.obs]
  213. else:
  214. for a_company in self.gen_firms(db_file, headers):
  215. company = Company(
  216. name=a_company[0],
  217. vat_code=a_company[1],
  218. reg_number=a_company[2],
  219. address=a_company[3],
  220. location=a_company[4],
  221. county=a_company[5],
  222. shortname=a_company[6],
  223. adm=a_company[7],
  224. admp=a_company[8],
  225. admcnp=a_company[9],
  226. obs=a_company[10])
  227. yield [company.name, company.vat_code, company.reg_number,
  228. company.address, company.location, company.county,
  229. company.shortname, company.adm, company.admp,
  230. company.admcnp, company.obs]
  231. def get_last_month(self, short_name) -> str:
  232. '''returns last month of a company in format YYYY_MM
  233. :param str short_name is the company shortname'''
  234. short_name = self.winment_path + short_name
  235. month_folders = [f for f in os.listdir(short_name) if re.match(r'[0-9_]+$', f)]
  236. month_folders.reverse()
  237. return month_folders[0]
  238. def get_bank_accounts(self, short_name, db_file='/nbanca.db'):
  239. #.......................................................................
  240. # TO DO: put an all_ parameter to yield all_ accounts or
  241. # just one,
  242. # make a named tuple with bank accounts.
  243. #.......................................................................
  244. headers = ['Codbanca', 'Denumire', 'NrCont']
  245. headers2 = ['COD', 'DENUMIRE']
  246. short_name = self.winment_path + short_name
  247. nbanks = self.update_copy(short_name + '/nbanci.db')
  248. file_db = self.update_copy(short_name + db_file)
  249. bank_codes = {}
  250. with Table(file_db) as table, Table(nbanks) as nbanks:
  251. # tables = zip(table, nbanks)
  252. for bank in nbanks:
  253. data = [bank[header] for header in headers2]
  254. bdict = {data[i]: data[i + 1] for i in range(0, len(data), 2)}
  255. bank_codes.update(bdict)
  256. for row in table:
  257. if row.NrCont:
  258. bank_account = [row[header] for header in headers]
  259. bank_account.append(bank_codes[bank_account[0]])
  260. if bank_account[2].startswith(' '):
  261. yield bank_account
  262. def get_oblig(self, short_name, db_file='/ObligPI.DB'):
  263. headers = ['Part', 'TipDoc', 'Doc', 'NrDoc', 'DataDoc', 'Valoare', 'Rest']
  264. short_name = self.winment_path + short_name
  265. # nbanks = self.update_copy(short_name + '/nbanci.db')
  266. oblig_db = self.update_copy(short_name + db_file)
  267. bank_codes = {}
  268. with Table(oblig_db) as table: # , Table(nbanks) as nbanks
  269. all_ = []
  270. parts = []
  271. tips = []
  272. docs = []
  273. nrs = []
  274. dates = []
  275. values = []
  276. rests = []
  277. for row in table:
  278. if row.TipDoc == 1:
  279. parts.append(row.Part)
  280. all_.append(parts)
  281. tips.append(row.TipDoc)
  282. all_.append(tips)
  283. docs.append(row.Doc)
  284. all_.append(docs)
  285. nrs.append(row.NrDoc)
  286. all_.append(nrs)
  287. dates.append(row.DataDoc)
  288. all_.append(dates)
  289. values.append(row.Valoare)
  290. all_.append(values)
  291. rests.append(row.Rest)
  292. all_.append(rests)
  293. df_dict = dict(zip(headers, all_))
  294. print(df_dict)
  295. def corp_list(self, name=None):
  296. '''returns company list from actual shortnames from winmwnt/data folder
  297. '''
  298. dir_list = [f.name for f in os.scandir(self.winment_path) if f.is_dir() and '@' not in f.name]
  299. if name:
  300. if type(name) is list:
  301. for r in name:
  302. dir_list.remove(r)
  303. else:
  304. dir_list.remove(name)
  305. return dir_list
  306. def verif_corp(self, file_='/firme.db', ban=None):
  307. headers = ['Denumire', 'CF', 'J', 'Adresa', 'Oras', 'Judet', 'Prescurtat', 'Obs']
  308. corplist = self.make_list(self.winment_path + file_, headers) # dbRead.make_list(m_path + '/FIRME.DB', headers)
  309. if ban:
  310. if type(ban) is list:
  311. for r in corplist:
  312. for i in ban:
  313. if i == r[6]:
  314. corplist.remove(r)
  315. else:
  316. for r in corplist:
  317. if r == ban:
  318. corplist.remove(r)
  319. return corplist
  320. def verif_cont(self, file_) -> list:
  321. '''returns an account with its values from the balance
  322. :param file_ is shortname/ncont.db'''
  323. accounts = []
  324. headers = ['Clasa', 'Simbol', 'Denumire', 'SoldID', 'SoldIC', 'PrecedentD', 'PrecedentC', 'CurentD', 'CurentC']
  325. accountlist = self.make_list(self.winment_path + file_, headers) # + lunaCurenta
  326. for elem in accountlist:
  327. account = Account(clasa=elem[0],
  328. simbol=elem[1],
  329. denumire=elem[2],
  330. soldid=elem[3],
  331. soldic=elem[4],
  332. precedentd=elem[5],
  333. precedentc=elem[6],
  334. curentd=elem[7],
  335. curentc=elem[8])
  336. accounts.append(account)
  337. return accountlist
  338. def an_inc(self, account_list, boolind, ind2, ind3):
  339. '''returns the annual turnover in given year
  340. :param int boolind:account class number
  341. :param int ind2, ind3:debit or credit position in balance
  342. (6-rulaj curent debit, 8-rulaj cumulat debit, index starting from 0)'''
  343. tt = 0
  344. for account in account_list:
  345. # n = len(account[boolind]) == 3 and account[boolind] != '...' and int(account[boolind]) > 700 and int(account[boolind]) < 760
  346. n = account[boolind] == 7
  347. can = account[1][:2] != '76'
  348. # print(account[1][:2])
  349. if n and can:
  350. tt += int(account[ind2]) + int(account[ind3])
  351. return tt
  352. def divid(self, account_list, account='457') -> int:
  353. '''returns dividends/year
  354. :param account_list is account from ncont.db'''
  355. div_ = 0
  356. for acc in account_list:
  357. if acc[1][:3] == account:
  358. div_ += acc[8] + acc[6]
  359. return round(div_)
  360. def divid_current(self, account_list, account='457') -> int:
  361. '''returns dividends from current month
  362. :param account_list is account from ncont.db'''
  363. div_ = 0
  364. for acc in account_list:
  365. if acc[1][:3] == account:
  366. div_ += acc[8]
  367. return round(div_)
  368. def divid_intermed(self, account_list, account='463') -> int:
  369. '''returns dividends from current result/year
  370. :param account_list is account from ncont.db'''
  371. div_ = 0
  372. for acc in account_list:
  373. if acc[1][:3] == account:
  374. div_ += acc[7] + acc[5]
  375. return round(div_)
  376. def divid_inter_current(self, account_list, account='463') -> int:
  377. '''returns dividends from current results in the current month
  378. :param account_list is account from ncont.db'''
  379. div_ = 0
  380. for acc in account_list:
  381. if acc[1][:3] == account:
  382. div_ += acc[7]
  383. return round(div_)
  384. def spons(self, account_list, account='658.02') -> int:
  385. '''returns sponsored money/year
  386. :param account_list is account from ncont.db'''
  387. spons_ = 0
  388. for acc in account_list:
  389. if acc[1] == account:
  390. spons_ += acc[8] + acc[6]
  391. return round(spons_)
  392. def result(self, account_list, boolind, ind2, ind3) -> int: # account='121'
  393. '''returns the final result in given year
  394. :param int boolind:account class number
  395. :param int ind2, ind3:debit or credit position in balance
  396. (6-rulaj curent debit, 8-rulaj cumulat debit, index starting from 0)'''
  397. res_minus = res_plus = 0
  398. for r_minus in account_list:
  399. p = r_minus[boolind] == 6
  400. if p:
  401. res_minus += int(r_minus[ind2]) + int(r_minus[ind3])
  402. for r_plus in account_list:
  403. i = r_plus[boolind] == 7
  404. if i:
  405. res_plus += int(r_plus[ind2]) + int(r_plus[ind3])
  406. return res_plus - res_minus
  407. def ins_payable(self, account_list, account='431') -> int:
  408. '''returns insurences payable in current month
  409. :param account_list is account from ncont.db'''
  410. ins = 0
  411. for acc in account_list:
  412. p = acc[1][:3] == account
  413. if p:
  414. ins += acc[8]
  415. return round(ins)
  416. def CAS_payable(self, account_list, accounts=('431.02', '431.05')) -> int:
  417. '''returns CAS payable in current month
  418. :param account_list is account from ncont.db'''
  419. CAS = 0
  420. acc_1, acc_2 = accounts
  421. for acc in account_list:
  422. p = acc[1] == acc_1
  423. d = acc[1] == acc_2
  424. if p: CAS += acc[8]
  425. if d: CAS += acc[8]
  426. return round(CAS)
  427. def CASS_payable(self, account_list, accounts=('431.04', '431.06')) -> int:
  428. '''returns CASS payable in current month
  429. :param account_list is account from ncont.db'''
  430. CASS = 0
  431. acc_1, acc_2 = accounts
  432. for acc in account_list:
  433. p = acc[1] == acc_1
  434. d = acc[1] == acc_2
  435. if p: CASS += acc[8]
  436. if d: CASS += acc[8]
  437. return round(CASS)
  438. def sal_tax_payable(self, account_list, account='431.44') -> int:
  439. '''returns salary tax payable in current month
  440. :param account_list is account from ncont.db'''
  441. tax = 0
  442. for acc in account_list:
  443. p = acc[1] == account
  444. if p:
  445. tax += acc[8]
  446. return round(tax)
  447. def cam_payable(self, account_list, account='436') -> int:
  448. '''returns CAM payable in current month
  449. :param account_list is account from ncont.db'''
  450. cam = 0
  451. for acc in account_list:
  452. p = acc[1][:3] == account
  453. if p:
  454. cam += acc[8]
  455. return round(cam)
  456. def vat_payable(self, account_list, accounts=('442.03', '442.04')) -> int:
  457. '''returns VAT payable in current month
  458. :param account_list is account from ncont.db'''
  459. tt = 0
  460. acc_1, acc_2 = accounts
  461. for acc in account_list:
  462. p = acc[1] == acc_1
  463. d = acc[1] == acc_2
  464. if p:
  465. tt += acc[8]
  466. elif d:
  467. tt -= acc[7] + acc[8]
  468. return round(tt)
  469. def vat_final(self, acc_list, accounts=('442.03', '442.04')) -> int:
  470. '''returns VAT final payable in current month
  471. :param account_list is account from ncont.db'''
  472. tt = 0
  473. acc_1, acc_2 = accounts
  474. for acc in acc_list:
  475. account = Account(clasa=acc[0],
  476. simbol=acc[1],
  477. denumire=acc[2],
  478. soldid=acc[3],
  479. soldic=acc[4],
  480. precedentd=acc[5],
  481. precedentc=acc[6],
  482. curentd=acc[7],
  483. curentc=acc[8])
  484. payable = account.simbol == acc_1
  485. deductible = account.simbol == acc_2
  486. if payable:
  487. tt += account.soldf('c')
  488. elif deductible:
  489. tt -= account.soldf('d')
  490. return round(tt)
  491. def tax_payable(self, account_list, account='441') -> int:
  492. '''returns income TAX payable in current month
  493. :param account_list is account from ncont.db'''
  494. tax = 0
  495. for acc in account_list:
  496. p = acc[1][:3] == account
  497. if p:
  498. tax += acc[8]
  499. return round(tax)
  500. def div_tax_payable(self, acc_list, accounts='446.07') -> int:
  501. '''returns dividend TAX payable in current month
  502. :param account_list is account from ncont.db'''
  503. tt = 0
  504. # acc_1, acc_2 = accounts
  505. for acc in acc_list:
  506. account = Account(clasa=acc[0],
  507. simbol=acc[1],
  508. denumire=acc[2],
  509. soldid=acc[3],
  510. soldic=acc[4],
  511. precedentd=acc[5],
  512. precedentc=acc[6],
  513. curentd=acc[7],
  514. curentc=acc[8])
  515. payable = account.simbol == accounts
  516. # deductible = account.simbol == acc_2
  517. if payable:
  518. tt += account.curentc
  519. # elif deductible:
  520. # tt -= account.soldf('d')
  521. return round(tt)
  522. def advance_final(self, acc_list, accounts='542') -> int:
  523. '''returns final dvances/year
  524. :param account_list is account from ncont.db'''
  525. tt = 0
  526. # acc_1, acc_2 = accounts
  527. for acc in acc_list:
  528. account = Account(clasa=acc[0],
  529. simbol=acc[1],
  530. denumire=acc[2],
  531. soldid=acc[3],
  532. soldic=acc[4],
  533. precedentd=acc[5],
  534. precedentc=acc[6],
  535. curentd=acc[7],
  536. curentc=acc[8])
  537. payable = account.simbol[:3] == accounts
  538. # deductible = account.simbol == acc_2
  539. if payable:
  540. tt += account.soldf('d')
  541. # elif deductible:
  542. # tt -= account.soldf('d')
  543. return round(tt)
  544. def deb_div(self, acc_list, accounts='461') -> int:
  545. '''returns advances transfered to deb. diversi/year
  546. :param account_list is account from ncont.db'''
  547. tt = 0
  548. # acc_1, acc_2 = accounts
  549. for acc in acc_list:
  550. account = Account(clasa=acc[0],
  551. simbol=acc[1],
  552. denumire=acc[2],
  553. soldid=acc[3],
  554. soldic=acc[4],
  555. precedentd=acc[5],
  556. precedentc=acc[6],
  557. curentd=acc[7],
  558. curentc=acc[8])
  559. payable = account.simbol[:3] == accounts
  560. # deductible = account.simbol == acc_2
  561. if payable:
  562. tt += account.soldf('d')
  563. # elif deductible:
  564. # tt -= account.soldf('d')
  565. return round(tt)
  566. def credit_final(self, acc_list, accounts='455') -> int:
  567. '''returns credited ammount/year
  568. :param account_list is account from ncont.db'''
  569. tt = 0
  570. # acc_1, acc_2 = accounts
  571. for acc in acc_list:
  572. account = Account(clasa=acc[0],
  573. simbol=acc[1],
  574. denumire=acc[2],
  575. soldid=acc[3],
  576. soldic=acc[4],
  577. precedentd=acc[5],
  578. precedentc=acc[6],
  579. curentd=acc[7],
  580. curentc=acc[8])
  581. payable = account.simbol[:3] == accounts
  582. # deductible = account.simbol == acc_2
  583. if payable:
  584. tt += account.soldf('d')
  585. # elif deductible:
  586. # tt -= account.soldf('d')
  587. return round(tt)
  588. if __name__ == '__main__':
  589. mentor = WinMentor()
  590. # accounts = list(mentor.get_bank_accounts('WEBS'))
  591. # account_num = [n for n in accounts[1] if n.startswith(' ')]
  592. for account in mentor.get_bank_accounts('WEBS'):
  593. # if account[2].startswith(' '):
  594. print(account)