Module: Mfinante

Defined in:
lib/mfinante.rb,
lib/mfinante/version.rb

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.ani_bilant(cui) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/mfinante.rb', line 45

def self.ani_bilant(cui)
  browser = Watir::Browser.new :chrome, headless: true
  browser.goto 'http://www.mfinante.ro/infocodfiscal.html?cod='+cui
  a=[]
  unless browser.ol.exist? 
    x=browser.select(name: 'an').options.to_a
    x.each do |f|
      a << f.text 
    end
  end
  browser.close
  return a 
end

.bilant(cui, an) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/mfinante.rb', line 59

def self.bilant(cui, an)
  browser = Watir::Browser.new :chrome, headless: true
  browser.goto 'http://www.mfinante.ro/infocodfiscal.html?cod='+cui
  if browser.ol.exist? 
    result = false
  else
    x=browser.select(name: 'an').select(an)
    browser.button(type: 'submit').click
    result = browser.div(id: 'main').table.html
  end
  browser.close
  return result
end

.interogare(cui) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/mfinante.rb', line 4

def self.interogare(cui)
  browser = Watir::Browser.new :chrome,  headless: true
  browser.goto 'http://www.mfinante.ro/infocodfiscal.html?cod='+cui
  if browser.ol.exist? 
     h = false
  else
    h=  {
      name: browser.div(id: 'main').table.row[1].text,
      address: browser.div(id: 'main').table.td(:index => 3).text,
      county: browser.div(id: 'main').table.td(:index => 5).text,
      registration_number: browser.div(id: 'main').table.td(:index => 7).text,
      auth_document: browser.div(id: 'main').table.td(:index => 9).text,
      postal_code: browser.div(id: 'main').table.td(:index => 11).text,
      phone: browser.div(id: 'main').table.td(:index => 13).text,
      fax: browser.div(id: 'main').table.td(:index => 15).text,
      company_state: browser.div(id: 'main').table.td(:index => 17).text,
      company_observation: browser.div(id: 'main').table.td(:index => 19).text,
      latest_declaration_date: browser.div(id: 'main').table.td(:index => 21).text,
      last_processing_date: browser.div(id: 'main').table.td(:index => 23).text,
      date_start_profit_tax: browser.div(id: 'main').table.td(:index => 25).text,
      micro_date_tax: browser.div(id: 'main').table.td(:index => 27).text,
      eccize_date: browser.div(id: 'main').table.td(:index => 29).text,
      tva_date: browser.div(id: 'main').table.td(:index => 31).text,
      social_contribution_date: browser.div(id: 'main').table.td(:index => 33).text,
      insurance_contribution_date: browser.div(id: 'main').table.td(:index => 35).text,
      unemployment_contribution_date: browser.div(id: 'main').table.td(:index => 37).text,
      guarantee_fund_contribution_date: browser.div(id: 'main').table.td(:index => 39).text,
      health_fund_contribution_date: browser.div(id: 'main').table.td(:index => 41).text,
      holiday_contribution_date: browser.div(id: 'main').table.td(:index => 43).text,
      gaming_text_date: browser.div(id: 'main').table.td(:index => 45).text,
      salary_tax_date: browser.div(id: 'main').table.td(:index => 47).text,
      construction_tax_date: browser.div(id: 'main').table.td(:index => 49).text,
      oil_and_gas_internal_production_date: browser.div(id: 'main').table.td(:index => 51).text,
      mining_royalities_date: browser.div(id: 'main').table.td(:index => 53).text,
      oil_royalities_date: browser.div(id: 'main').table.td(:index => 53).text
    }
  end
  browser.close
  return h
end