| 1 | 2 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | package Finance::Salary::Rate; | ||
| 3 | 2 | our $VERSION = '0.001'; | |
| 4 | 2 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 2 | ▶ | use Types::Standard qw(Num); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 2 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | # ABSTRACT: Calculate hourly rates for small businesses | ||
| 9 | |||
| 10 | 2 | has monthly_income => ( | |
| 11 | is => 'ro', | ||
| 12 | isa => Num, | ||
| 13 | required => 1, | ||
| 14 | ); | ||
| 15 | |||
| 16 | 2 | has vacation_perc => ( | |
| 17 | is => 'ro', | ||
| 18 | isa => Num, | ||
| 19 | default => 0, | ||
| 20 | ); | ||
| 21 | |||
| 22 | 2 | has tax_perc => ( | |
| 23 | is => 'ro', | ||
| 24 | isa => Num, | ||
| 25 | default => 0, | ||
| 26 | ); | ||
| 27 | |||
| 28 | 2 | has healthcare_perc => ( | |
| 29 | is => 'ro', | ||
| 30 | isa => Num, | ||
| 31 | default => 0, | ||
| 32 | ); | ||
| 33 | |||
| 34 | 2 | has declarable_days_perc => ( | |
| 35 | is => 'ro', | ||
| 36 | isa => Num, | ||
| 37 | default => 60, | ||
| 38 | ); | ||
| 39 | |||
| 40 | 2 | has working_days => ( | |
| 41 | is => 'ro', | ||
| 42 | isa => Num, | ||
| 43 | default => 230, | ||
| 44 | ); | ||
| 45 | |||
| 46 | 2 | has expenses => ( | |
| 47 | is => 'ro', | ||
| 48 | isa => Num, | ||
| 49 | default => 0, | ||
| 50 | ); | ||
| 51 | |||
| 52 | 7 | ▶ | sub gross_income { |
|
Subroutine
gross_income: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 53 | 7 | my $self = shift; | |
| 54 | 7 | return $self->income * (1 + $self->_get_perc($self->tax_perc)); | |
| 55 | } | ||
| 56 | |||
| 57 | 20 | ▶ | sub _get_perc { |
|
Subroutine
_get_perc: called CC=1 SCAR=0.0
| |||
| 58 | 20 | my ($self, $perc) = @_; | |
| 59 | 20 | return $perc / 100; | |
| 60 | } | ||
| 61 | |||
| 62 | 1 | ▶ | sub get_healthcare_fee { |
|
Subroutine
get_healthcare_fee: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 63 | 1 | my $self = shift; | |
| 64 | 1 | return $self->gross_income * $self->_get_perc($self->healthcare_perc) | |
| 65 | } | ||
| 66 | |||
| 67 | 3 | ▶ | sub workable_hours { |
|
Subroutine
workable_hours: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 68 | 3 | my $self = shift; | |
| 69 | return | ||
| 70 | 3 | $self->working_days * 8 | |
| 71 | * $self->_get_perc($self->declarable_days_perc); | ||
| 72 | } | ||
| 73 | |||
| 74 | 3 | ▶ | sub required_income { |
|
Subroutine
required_income: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 75 | 3 | my $self = shift; | |
| 76 | 3 | return $self->gross_income + $self->expenses; | |
| 77 | } | ||
| 78 | |||
| 79 | 1 | ▶ | sub hourly_rate { |
|
Subroutine
hourly_rate: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 80 | 1 | my $self = shift; | |
| 81 | 1 | return $self->required_income / $self->workable_hours; | |
| 82 | } | ||
| 83 | |||
| 84 | 0 | ▶ | sub vacation_pay { |
|
Subroutine
vacation_pay: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 85 | 0 | my $self = shift; | |
| 86 | 0 | return $self->_get_perc($self->healthcare_perc) | |
| 87 | } | ||
| 88 | |||
| 89 | 9 | ▶ | sub income { |
|
Subroutine
income: called CC=1 SCAR=0.0
Pod
documented
| |||
| 90 | 9 | my $self = shift; | |
| 91 | 9 | my $income = $self->monthly_income * 12; | |
| 92 | 9 | return $income * ( 1 + $self->_get_perc($self->vacation_perc)); | |
| 93 | } | ||
| 94 | |||
| 95 | 2 | 1; | |
| 96 | |||
| 97 | __END__ | ||