Created
September 11, 2017 12:01
-
-
Save gunar/b74c72bdb18c86cac66465adfa7bf9ae to your computer and use it in GitHub Desktop.
IRPF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function aliquota(x) { | |
if (x < 22847.77) return 0 | |
else if (x < 33919.81) return 7.5/100 | |
else if (x < 45012.61) return 15/100 | |
else if (x < 55976.16) return 22.5/100 | |
else return 27.5/100 | |
} | |
function aDeduzir(x) { | |
if (x < 22847.77) return 0 | |
else if (x < 33919.81) return 1713.58 | |
else if (x < 45012.61) return 4257.57 | |
else if (x < 55976.16) return 7633.51 | |
else return 10432.32 | |
} | |
function irpf(x) { | |
var descontoSimplificado = 0.2 * x | |
var baseCalculo = x - descontoSimplificado | |
return baseCalculo * aliquota(baseCalculo) - aDeduzir(baseCalculo) | |
} | |
function subPf(x) { | |
var salariosCell = SpreadsheetApp.getActiveSpreadsheet().getNamedRanges().filter(function (x) { return x.getName() === 'Salarios' })[0] | |
var salarios = salariosCell.getRange().getValue() | |
return x - irpf(salarios + x) | |
} | |
function subPj(x) { | |
return x * (1 - 14.33/100) // custo aproximado de se ter um CNPJ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment