trabalho_remoto 0.1.0.pre.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +39 -0
- data/LICENSE.txt +21 -0
- data/README.md +45 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docs/regras.md +45 -0
- data/exe/trabalho_remoto +25 -0
- data/lib/trabalho_remoto.rb +12 -0
- data/lib/trabalho_remoto/account.rb +33 -0
- data/lib/trabalho_remoto/deposit.rb +10 -0
- data/lib/trabalho_remoto/item.rb +20 -0
- data/lib/trabalho_remoto/pj_simples/aliquota_inss.rb +22 -0
- data/lib/trabalho_remoto/pj_simples/aliquota_irrf.rb +22 -0
- data/lib/trabalho_remoto/pj_simples/aliquota_sobre_notas_fiscais.rb +23 -0
- data/lib/trabalho_remoto/pj_simples/irrf_discount.rb +23 -0
- data/lib/trabalho_remoto/pj_simples/simulator.rb +72 -0
- data/lib/trabalho_remoto/version.rb +3 -0
- data/lib/trabalho_remoto/withdraw.rb +10 -0
- data/trabalho_remoto.gemspec +37 -0
- metadata +128 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: c7b434e50b2d4ef7b300756bfdb4733245d27e9f
|
|
4
|
+
data.tar.gz: 3e18d8536f38e9cf6cfc00873258626b0293a618
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: fc052c0d5069aaed68353995ec0d821217701e81c7c0b8b14f2f7ebea4062e8ef10783a0e24b3d75f35fb4539382081157966095568c820178537844e4e91fe9
|
|
7
|
+
data.tar.gz: cae5b7c33c56e22328e73643cdfc5a5a13882c8424711dc0e0042a5b4be39fe94214e4b669e980aaf93175c99450d8150a43df1f05589afb8e8899069a231373
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.4
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at marcelo.jacobus@gmail.com. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: http://contributor-covenant.org
|
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
trabalho_remoto (0.1.0.pre.beta)
|
|
5
|
+
terminal-table
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
diff-lcs (1.3)
|
|
11
|
+
rake (10.5.0)
|
|
12
|
+
rspec (3.7.0)
|
|
13
|
+
rspec-core (~> 3.7.0)
|
|
14
|
+
rspec-expectations (~> 3.7.0)
|
|
15
|
+
rspec-mocks (~> 3.7.0)
|
|
16
|
+
rspec-core (3.7.1)
|
|
17
|
+
rspec-support (~> 3.7.0)
|
|
18
|
+
rspec-expectations (3.7.0)
|
|
19
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
20
|
+
rspec-support (~> 3.7.0)
|
|
21
|
+
rspec-mocks (3.7.0)
|
|
22
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
23
|
+
rspec-support (~> 3.7.0)
|
|
24
|
+
rspec-support (3.7.1)
|
|
25
|
+
terminal-table (1.8.0)
|
|
26
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
|
27
|
+
unicode-display_width (1.4.0)
|
|
28
|
+
|
|
29
|
+
PLATFORMS
|
|
30
|
+
ruby
|
|
31
|
+
|
|
32
|
+
DEPENDENCIES
|
|
33
|
+
bundler (~> 1.16)
|
|
34
|
+
rake (~> 10.0)
|
|
35
|
+
rspec (~> 3.0)
|
|
36
|
+
trabalho_remoto!
|
|
37
|
+
|
|
38
|
+
BUNDLED WITH
|
|
39
|
+
1.16.2
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Marcelo Jacobus
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Trabalho Remoto
|
|
2
|
+
|
|
3
|
+
CLI Util com o propósito de simular qual a melhor opção de PF ou PJ para um desenvolvedor, baseado no salário.
|
|
4
|
+
|
|
5
|
+
Consulte um contador. Os mantenedores desta gem não se responsabilizam em mantê-la atualizada, e como sabem, as regras contábeis mudam.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add this line to your application's Gemfile:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
gem 'trabalho_remoto'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
And then execute:
|
|
16
|
+
|
|
17
|
+
$ bundle
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
$ gem install trabalho_remoto
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
trabalho_remoto simulate --salary=14000 # 14 mil reais
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Development
|
|
30
|
+
|
|
31
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
32
|
+
|
|
33
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
34
|
+
|
|
35
|
+
## Contributing
|
|
36
|
+
|
|
37
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mjacobus/trabalho_remoto. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
38
|
+
|
|
39
|
+
## License
|
|
40
|
+
|
|
41
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
42
|
+
|
|
43
|
+
## Code of Conduct
|
|
44
|
+
|
|
45
|
+
Everyone interacting in the TrabalhoRemoto project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/mjacobus/trabalho_remoto/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "trabalho_remoto"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/docs/regras.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
## Empresa individual Simples, dentro do artigo 3 do simples nacional
|
|
2
|
+
|
|
3
|
+
Exemplos:
|
|
4
|
+
|
|
5
|
+
- `+ 15.000,00` - Total mensal em notas: 15.000,00
|
|
6
|
+
- `- 900` Imposto sobre nota (6% **\*A**)
|
|
7
|
+
- `- 4.200,00` - Pro-labore (28%) - Necessário para que o percentual acima seja apenas 6% - Artigo 3
|
|
8
|
+
- `+ 4.200,00` - Pro-labore (28%) - Sai de um lado, entra no outro
|
|
9
|
+
- `- 945,00` - IRRF (22,5% **\*B**)
|
|
10
|
+
- `+ 636,13` - Parcela a deduzir do IRRF do Pro-Labore (636,13 **\C**)
|
|
11
|
+
- `- 462,00` - INSS sobre Pro-Labore (11% **\*D**)
|
|
12
|
+
|
|
13
|
+
- Sobra: 13.329,13
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
**\*A** - Alíquota baseada no ano anterior (??)
|
|
17
|
+
|
|
18
|
+
Se no ano recebeu
|
|
19
|
+
|
|
20
|
+
- Até 180.000,00 - 6%
|
|
21
|
+
- De 180.000,00 a (?) - 11,20%
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
**\*B** - Alíquota IRRF
|
|
25
|
+
|
|
26
|
+
- Até 1.903,98 -0%
|
|
27
|
+
- De 1.903,99 até 2.826,65 - 7,50%
|
|
28
|
+
- De 2.826,66 até 3.751,05 - 15%
|
|
29
|
+
- De 3.751,06 até 4.664,68 - 22,50%
|
|
30
|
+
- Acima de 4.664,69 - 27,50%
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
**\*C** - Parcela a deduzir do imposto em R$
|
|
34
|
+
|
|
35
|
+
- Até 1.903,98 -0%
|
|
36
|
+
- De 1.903,99 até 2.826,65 - 142,8
|
|
37
|
+
- De 2.826,66 até 3.751,05 - 354,8
|
|
38
|
+
- De 3.751,06 até 4.664,68 - 636,13
|
|
39
|
+
- Acima de 4.664,68 - 869,36
|
|
40
|
+
|
|
41
|
+
**\*D** - INSS - Máximo 621,04, aparentemente - ou 5.465,80
|
|
42
|
+
|
|
43
|
+
- Até 1.693,62 - 8%
|
|
44
|
+
- De 1.693,63 a 2.822,90 - 9%
|
|
45
|
+
- De 2.822,91 a ? 11%
|
data/exe/trabalho_remoto
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require 'bundler/setup'
|
|
5
|
+
require 'trabalho_remoto'
|
|
6
|
+
require 'terminal-table'
|
|
7
|
+
|
|
8
|
+
args = ARGV.dup
|
|
9
|
+
|
|
10
|
+
salary = Float(args.first.to_s.delete(','))
|
|
11
|
+
|
|
12
|
+
simulator = TrabalhoRemoto::PjSimples::Simulator.new
|
|
13
|
+
account = simulator.simulate(salary)
|
|
14
|
+
|
|
15
|
+
puts "Salário: #{salary}"
|
|
16
|
+
puts "Sobra: #{account.balance.round(2)}"
|
|
17
|
+
|
|
18
|
+
table = Terminal::Table.new
|
|
19
|
+
table.add_row(%w[Valor Descrição Referência])
|
|
20
|
+
|
|
21
|
+
account.items.each do |item|
|
|
22
|
+
table.add_row([item.amount.round(2), item.description, item.link])
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
puts table
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'trabalho_remoto/version'
|
|
4
|
+
require 'trabalho_remoto/item'
|
|
5
|
+
require 'trabalho_remoto/deposit'
|
|
6
|
+
require 'trabalho_remoto/withdraw'
|
|
7
|
+
require 'trabalho_remoto/account'
|
|
8
|
+
require 'trabalho_remoto/pj_simples/aliquota_sobre_notas_fiscais'
|
|
9
|
+
require 'trabalho_remoto/pj_simples/simulator'
|
|
10
|
+
require 'trabalho_remoto/pj_simples/aliquota_irrf'
|
|
11
|
+
require 'trabalho_remoto/pj_simples/irrf_discount'
|
|
12
|
+
require 'trabalho_remoto/pj_simples/aliquota_inss'
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module TrabalhoRemoto
|
|
4
|
+
class Account
|
|
5
|
+
attr_reader :items
|
|
6
|
+
|
|
7
|
+
def initialize(items: [])
|
|
8
|
+
@items = items
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def withdraw(item)
|
|
12
|
+
item = Withdraw.new(amount: item.amount, description: item.description, link: item.link)
|
|
13
|
+
add_item(item)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def deposit(item)
|
|
17
|
+
item = Deposit.new(amount: item.amount, description: item.description, link: item.link)
|
|
18
|
+
add_item(item)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def balance
|
|
22
|
+
items.inject(0) do |sum, item|
|
|
23
|
+
sum + item.amount
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def add_item(item)
|
|
30
|
+
@items << item
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module TrabalhoRemoto
|
|
4
|
+
class Item
|
|
5
|
+
attr_reader :amount
|
|
6
|
+
attr_reader :description
|
|
7
|
+
attr_reader :link
|
|
8
|
+
|
|
9
|
+
def initialize(amount:, description: nil, link: nil)
|
|
10
|
+
@amount = amount
|
|
11
|
+
@description = description
|
|
12
|
+
@link = link
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def to_s
|
|
16
|
+
signal = amount.positive? ? '+' : ''
|
|
17
|
+
"#{signal}#{amount} - #{description} (#{link})"
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module TrabalhoRemoto
|
|
4
|
+
module PjSimples
|
|
5
|
+
class AliquotaInss
|
|
6
|
+
# TODO: 5.465,80 parece ser o máximo. Então se 11% for maior que isto,
|
|
7
|
+
# o programa não funciona, mas a surpresa vai ser boa ;-)
|
|
8
|
+
def for_monthly_amount(amount)
|
|
9
|
+
ranges = [
|
|
10
|
+
[Range.new(0, 1_692.92), 0.08],
|
|
11
|
+
[Range.new(1_692.93, 2_822.90), 0.09]
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
ranges.each do |range, aliquota|
|
|
15
|
+
return aliquota if range.include?(amount)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
0.11
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module TrabalhoRemoto
|
|
4
|
+
module PjSimples
|
|
5
|
+
class AliquotaIrrf
|
|
6
|
+
def for_monthly_amount(amount)
|
|
7
|
+
ranges = [
|
|
8
|
+
[Range.new(0, 1_903.98), 0],
|
|
9
|
+
[Range.new(1_903.99, 2_826.65), 0.075],
|
|
10
|
+
[Range.new(2_826.66, 3_751.05), 0.15],
|
|
11
|
+
[Range.new(3_751.06, 4_664.68), 0.225]
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
ranges.each do |range, aliquota|
|
|
15
|
+
return aliquota if range.include?(amount)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
0.27
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module TrabalhoRemoto
|
|
3
|
+
module PjSimples
|
|
4
|
+
class AliquotaSobreNotasFiscais
|
|
5
|
+
def for_monthly_amount(amount)
|
|
6
|
+
for_yearly_amount(amount * 12)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def for_yearly_amount(amount)
|
|
10
|
+
if amount <= 180_000
|
|
11
|
+
# 6%
|
|
12
|
+
return 0.06
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# 11.20%
|
|
16
|
+
return 0.112
|
|
17
|
+
|
|
18
|
+
# TODO: figure out the other ranges
|
|
19
|
+
# there are other ranges, but I do not know them all at the moment
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module TrabalhoRemoto
|
|
5
|
+
module PjSimples
|
|
6
|
+
class IrrfDiscount
|
|
7
|
+
def for_monthly_amount(amount)
|
|
8
|
+
ranges = [
|
|
9
|
+
[Range.new(0, 1_903.98), 0],
|
|
10
|
+
[Range.new(1_903.99, 2_826.65), 142.8],
|
|
11
|
+
[Range.new(2_826.66, 3_751.05), 354.8],
|
|
12
|
+
[Range.new(3_751.06, 4_664.68), 636.13]
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
ranges.each do |range, aliquota|
|
|
16
|
+
return aliquota if range.include?(amount)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
869.36
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module TrabalhoRemoto
|
|
4
|
+
module PjSimples
|
|
5
|
+
class Simulator
|
|
6
|
+
def initialize
|
|
7
|
+
@aliquota_policy = AliquotaSobreNotasFiscais.new
|
|
8
|
+
@irrf_policy = AliquotaIrrf.new
|
|
9
|
+
@irrf_discount_policy = IrrfDiscount.new
|
|
10
|
+
@inss_policy = AliquotaInss.new
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def simulate(income)
|
|
14
|
+
Account.new.tap do |account|
|
|
15
|
+
notas = Item.new(amount: income, description: 'Total em notas fiscais')
|
|
16
|
+
prolabore = Item.new(amount: notas.amount * 0.28, description: 'Pro-Labore (28%)')
|
|
17
|
+
|
|
18
|
+
account.deposit(notas)
|
|
19
|
+
account.withdraw(imposto_sobre_notas(notas))
|
|
20
|
+
account.withdraw(prolabore)
|
|
21
|
+
account.deposit(prolabore)
|
|
22
|
+
account.withdraw(irrf(prolabore))
|
|
23
|
+
account.deposit(irrf_discount(prolabore))
|
|
24
|
+
account.withdraw(inss(prolabore))
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
def imposto_sobre_notas(notas)
|
|
31
|
+
aliquota = @aliquota_policy.for_monthly_amount(notas.amount)
|
|
32
|
+
|
|
33
|
+
Item.new(
|
|
34
|
+
amount: notas.amount * aliquota,
|
|
35
|
+
description: 'Imposto sobre nota'
|
|
36
|
+
)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def irrf(prolabore)
|
|
40
|
+
aliquota = @irrf_policy.for_monthly_amount(prolabore.amount)
|
|
41
|
+
|
|
42
|
+
Item.new(
|
|
43
|
+
amount: prolabore.amount * aliquota,
|
|
44
|
+
description: "IRRF sobre Pro-Labore (#{format_percentage(aliquota)})"
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def irrf_discount(prolabore)
|
|
49
|
+
discount = @irrf_discount_policy.for_monthly_amount(prolabore.amount)
|
|
50
|
+
|
|
51
|
+
Item.new(
|
|
52
|
+
amount: discount,
|
|
53
|
+
description: 'Parcela a deduzir do IRRF do Pro-Labore'
|
|
54
|
+
)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def inss(prolabore)
|
|
58
|
+
percentage = @inss_policy.for_monthly_amount(prolabore.amount)
|
|
59
|
+
|
|
60
|
+
Item.new(
|
|
61
|
+
amount: prolabore.amount * percentage,
|
|
62
|
+
description: "INSS sobre Pro-Labore (#{format_percentage(percentage)})"
|
|
63
|
+
)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def format_percentage(percentage)
|
|
67
|
+
percentage = format('%.2f', (percentage * 100))
|
|
68
|
+
"#{percentage}%"
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "trabalho_remoto"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "trabalho_remoto"
|
|
8
|
+
spec.version = TrabalhoRemoto::VERSION
|
|
9
|
+
spec.authors = ["Marcelo Jacobus"]
|
|
10
|
+
spec.email = ["marcelo.jacobus@gmail.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{Utilitários para calcular para trabalho remoto}
|
|
13
|
+
spec.description = %q{Utilitários para calcular para trabalho remoto}
|
|
14
|
+
spec.homepage = "https://github.com/mjacobus/trabalho_remoto"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
19
|
+
if spec.respond_to?(:metadata)
|
|
20
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
21
|
+
else
|
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
|
23
|
+
"public gem pushes."
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
|
28
|
+
end
|
|
29
|
+
spec.bindir = "exe"
|
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
31
|
+
spec.require_paths = ["lib"]
|
|
32
|
+
|
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
|
34
|
+
spec.add_dependency 'terminal-table'
|
|
35
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
36
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
37
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: trabalho_remoto
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0.pre.beta
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Marcelo Jacobus
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2018-06-06 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.16'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.16'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: terminal-table
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rake
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '10.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '10.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rspec
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '3.0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '3.0'
|
|
69
|
+
description: Utilitários para calcular para trabalho remoto
|
|
70
|
+
email:
|
|
71
|
+
- marcelo.jacobus@gmail.com
|
|
72
|
+
executables:
|
|
73
|
+
- trabalho_remoto
|
|
74
|
+
extensions: []
|
|
75
|
+
extra_rdoc_files: []
|
|
76
|
+
files:
|
|
77
|
+
- ".gitignore"
|
|
78
|
+
- ".rspec"
|
|
79
|
+
- ".ruby-version"
|
|
80
|
+
- ".travis.yml"
|
|
81
|
+
- CODE_OF_CONDUCT.md
|
|
82
|
+
- Gemfile
|
|
83
|
+
- Gemfile.lock
|
|
84
|
+
- LICENSE.txt
|
|
85
|
+
- README.md
|
|
86
|
+
- Rakefile
|
|
87
|
+
- bin/console
|
|
88
|
+
- bin/setup
|
|
89
|
+
- docs/regras.md
|
|
90
|
+
- exe/trabalho_remoto
|
|
91
|
+
- lib/trabalho_remoto.rb
|
|
92
|
+
- lib/trabalho_remoto/account.rb
|
|
93
|
+
- lib/trabalho_remoto/deposit.rb
|
|
94
|
+
- lib/trabalho_remoto/item.rb
|
|
95
|
+
- lib/trabalho_remoto/pj_simples/aliquota_inss.rb
|
|
96
|
+
- lib/trabalho_remoto/pj_simples/aliquota_irrf.rb
|
|
97
|
+
- lib/trabalho_remoto/pj_simples/aliquota_sobre_notas_fiscais.rb
|
|
98
|
+
- lib/trabalho_remoto/pj_simples/irrf_discount.rb
|
|
99
|
+
- lib/trabalho_remoto/pj_simples/simulator.rb
|
|
100
|
+
- lib/trabalho_remoto/version.rb
|
|
101
|
+
- lib/trabalho_remoto/withdraw.rb
|
|
102
|
+
- trabalho_remoto.gemspec
|
|
103
|
+
homepage: https://github.com/mjacobus/trabalho_remoto
|
|
104
|
+
licenses:
|
|
105
|
+
- MIT
|
|
106
|
+
metadata:
|
|
107
|
+
allowed_push_host: https://rubygems.org
|
|
108
|
+
post_install_message:
|
|
109
|
+
rdoc_options: []
|
|
110
|
+
require_paths:
|
|
111
|
+
- lib
|
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - ">="
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: '0'
|
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
|
+
requirements:
|
|
119
|
+
- - ">"
|
|
120
|
+
- !ruby/object:Gem::Version
|
|
121
|
+
version: 1.3.1
|
|
122
|
+
requirements: []
|
|
123
|
+
rubyforge_project:
|
|
124
|
+
rubygems_version: 2.6.14.1
|
|
125
|
+
signing_key:
|
|
126
|
+
specification_version: 4
|
|
127
|
+
summary: Utilitários para calcular para trabalho remoto
|
|
128
|
+
test_files: []
|