Skip to content

Commit

Permalink
prepare bpjs dan pph21
Browse files Browse the repository at this point in the history
  • Loading branch information
ad3n committed Nov 17, 2017
1 parent 2619a2e commit 8f70fec
Show file tree
Hide file tree
Showing 18 changed files with 241 additions and 45 deletions.
10 changes: 10 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ SEMART_OVERTIME_INVALID_MESSAGE="semarthris.invalid_data"
SEMART_OVERTIME_UPLOAD_PATH="/overtimes"
SEMART_OVERTIME_BENEFIT_CODE="OT"

### PAYROLL CONFIG
SEMART_PAYROLL_BPJS_JHT_CODE_PLUS="JHTP"
SEMART_PAYROLL_BPJS_JHT_CODE_MINUS="JHTM"
SEMART_PAYROLL_BPJS_JKK_CODE_PLUS="JKKP"
SEMART_PAYROLL_BPJS_JKK_CODE_MINUS="JKKM"
SEMART_PAYROLL_BPJS_JP_CODE_PLUS="JPP"
SEMART_PAYROLL_BPJS_JP_CODE_MINUS="JPM"
SEMART_PAYROLL_BPJS_JKM_CODE_PLUS="JKMP"
SEMART_PAYROLL_BPJS_JKM_CODE_MINUS="JKMM"

###> symfony/framework-bundle ###
APP_ENV=dev
APP_DEBUG=1
Expand Down
2 changes: 1 addition & 1 deletion .php_cs.cache

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@
- [ ] BPJS Kesehatan
- [ ] BPJS Ketenagakerjaan
- [ ] PPH21
- [ ] Pecah Salary Processor dan Tambahkan Result Cache pada Fixed Salary
- [ ] Mini Accounting untuk Mencatat Pengeluaran Perusahaan untuk Gaji
- [ ] Prevent Remove Mutation When Job History is Exist
- [ ] Prevent Remove Placement When Job History is Exist
- [ ] Created and Updated Log in List
2 changes: 1 addition & 1 deletion data/employee.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- { joinDate: 'date:17-03-2017', employeeStatus: 'p', contract: 'ref:contract#emp1', company: 'ref:company#ssi', department: 'ref:department#itmis', jobLevel: 'ref:job_level#stf', jobTitle: 'ref:job_title#stfit', code: 'MIS000001', fullName: 'Muhamad Surya Iksanudin', gender: 'm', , regionOfBirth: 'ref:region#dki', cityOfBirth: 'ref:city#jakut', dateOfBirth: 'date:01-01-1987', identityNumber: '331012321', identityType: 'k', maritalStatus: 'm', email: 'admin@ssi.com', taxGroup: 'k2', haveOvertimeBenefit: true }
- { joinDate: 'date:17-03-2017', employeeStatus: 'p', contract: 'ref:contract#emp1', company: 'ref:company#ssi', department: 'ref:department#itmis', jobLevel: 'ref:job_level#stf', jobTitle: 'ref:job_title#stfit', code: 'MIS000001', fullName: 'Muhamad Surya Iksanudin', gender: 'm', , regionOfBirth: 'ref:region#dki', cityOfBirth: 'ref:city#jakut', dateOfBirth: 'date:01-01-1987', identityNumber: '331012321', identityType: 'k', maritalStatus: 'm', email: 'admin@ssi.com', taxGroup: 'k2', haveOvertimeBenefit: true, riskRatio: 'vlr' }
10 changes: 0 additions & 10 deletions src/Component/Bpjs/Model/BpjsInterface.php

This file was deleted.

5 changes: 5 additions & 0 deletions src/Component/Employee/Model/EmployeeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ public function getTaxGroup(): string;
*/
public function isHaveOvertimeBenefit(): bool;

/**
* @return string
*/
public function getRiskRatio(): ? string;

/**
* @return bool
*/
Expand Down
21 changes: 21 additions & 0 deletions src/Component/Employee/RiskRatio.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace KejawenLab\Application\SemartHris\Component\Employee;

/**
* @author Muhamad Surya Iksanudin <surya.iksanudin@kejawenlab.com>
*/
class RiskRatio
{
const RISK_VERY_HIGH = 'vhr';
const RISK_HIGH = 'hr';
const RISK_NORMAL = 'nr';
const RISK_LOW = 'lr';
const RISK_VERY_LOW = 'vlr';

const RISK_VERY_HIGH_VALUE = 0.0174;
const RISK_HIGH_VALUE = 0.0127;
const RISK_NORMAL_VALUE = 0.0089;
const RISK_LOW_VALUE = 0.0054;
const RISK_VERY_LOW_VALUE = 0.0024;
}
33 changes: 33 additions & 0 deletions src/Component/Employee/Service/RiskRatioConverter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace KejawenLab\Application\SemartHris\Component\Employee\Service;

use KejawenLab\Application\SemartHris\Component\Employee\RiskRatio;

/**
* @author Muhamad Surya Iksanudin <surya.iksanudin@kejawenlab.com>
*/
class RiskRatioConverter
{
/**
* @param string $riskRatioCode
*
* @return float
*/
public static function getValue(string $riskRatioCode): float
{
$map = [
RiskRatio::RISK_VERY_LOW => RiskRatio::RISK_VERY_LOW_VALUE,
RiskRatio::RISK_LOW => RiskRatio::RISK_LOW_VALUE,
RiskRatio::RISK_NORMAL => RiskRatio::RISK_NORMAL_VALUE,
RiskRatio::RISK_HIGH => RiskRatio::RISK_HIGH_VALUE,
RiskRatio::RISK_VERY_HIGH => RiskRatio::RISK_VERY_HIGH_VALUE,
];

if (!in_array($riskRatioCode, $map)) {
return RiskRatio::RISK_VERY_LOW_VALUE;
}

return $map[$riskRatioCode];
}
}
2 changes: 1 addition & 1 deletion src/Component/Salary/Processor/AttendanceProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/**
* @author Muhamad Surya Iksanudin <surya.iksanudin@kejawenlab.com>
*/
class AttendanceProcessor implements ProcessorInterface
class AttendanceProcessor implements PayrollProcessorInterface
{
const CUT_OFF_LAST_DATE = -1;

Expand Down
60 changes: 60 additions & 0 deletions src/Component/Salary/Processor/BpjsProcessor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

namespace KejawenLab\Application\SemartHris\Component\Salary\Processor;

use KejawenLab\Application\SemartHris\Component\Employee\Model\EmployeeInterface;
use KejawenLab\Application\SemartHris\Component\Employee\Service\RiskRatioConverter;
use KejawenLab\Application\SemartHris\Component\Salary\Model\PayrollInterface;

/**
* @author Muhamad Surya Iksanudin <surya.iksanudin@kejawenlab.com>
*/
class BpjsProcessor implements SalaryProcessorInterface
{
/**
* @param PayrollInterface $payroll
* @param EmployeeInterface $employee
* @param \DateTimeInterface $date
* @param float $fixedSalary
*
* @return float
*/
public function process(PayrollInterface $payroll, EmployeeInterface $employee, \DateTimeInterface $date, float $fixedSalary): float
{
$riskRatioValue = RiskRatioConverter::getValue($employee->getRiskRatio());

return $fixedSalary;
}

/**
* @param float $riskRatioValue
* @param float $fixedSalary
*/
private function processJkk(float $riskRatioValue, float $fixedSalary): void
{
}

/**
* @param float $riskRatioValue
* @param float $fixedSalary
*/
private function processJkm(float $riskRatioValue, float $fixedSalary): void
{
}

/**
* @param float $riskRatioValue
* @param float $fixedSalary
*/
private function processJp(float $riskRatioValue, float $fixedSalary): void
{
}

/**
* @param float $riskRatioValue
* @param float $fixedSalary
*/
private function processJht(float $riskRatioValue, float $fixedSalary): void
{
}
}
25 changes: 25 additions & 0 deletions src/Component/Salary/Processor/OvertimeProcessor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace KejawenLab\Application\SemartHris\Component\Salary\Processor;

use KejawenLab\Application\SemartHris\Component\Employee\Model\EmployeeInterface;
use KejawenLab\Application\SemartHris\Component\Salary\Model\PayrollInterface;

/**
* @author Muhamad Surya Iksanudin <surya.iksanudin@kejawenlab.com>
*/
class OvertimeProcessor implements SalaryProcessorInterface
{
/**
* @param PayrollInterface $payroll
* @param EmployeeInterface $employee
* @param \DateTimeInterface $date
* @param float $fixedSalary
*
* @return float
*/
public function process(PayrollInterface $payroll, EmployeeInterface $employee, \DateTimeInterface $date, float $fixedSalary): float
{
return $fixedSalary;
}
}
8 changes: 4 additions & 4 deletions src/Component/Salary/Processor/PayrollProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
/**
* @author Muhamad Surya Iksanudin <surya.iksanudin@kejawenlab.com>
*/
class PayrollProcessor implements ProcessorInterface
class PayrollProcessor implements PayrollProcessorInterface
{
const SEMARTHRIS_PAYROLL_PROCESSOR = 'semarthris.payroll_processor';

/**
* @var ProcessorInterface[]
* @var PayrollProcessorInterface[]
*/
private $processors;

Expand All @@ -39,9 +39,9 @@ public function process(EmployeeInterface $employee, \DateTimeInterface $date):
}

/**
* @param ProcessorInterface $processor
* @param PayrollProcessorInterface $processor
*/
private function addProcessor(ProcessorInterface $processor): void
private function addProcessor(PayrollProcessorInterface $processor): void
{
$this->processors[] = $processor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* @author Muhamad Surya Iksanudin <surya.iksanudin@kejawenlab.com>
*/
interface ProcessorInterface
interface PayrollProcessorInterface
{
/**
* @param EmployeeInterface $employee
Expand Down
4 changes: 3 additions & 1 deletion src/Component/Salary/Processor/SalaryProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
/**
* @author Muhamad Surya Iksanudin <surya.iksanudin@kejawenlab.com>
*/
class SalaryProcessor implements ProcessorInterface
class SalaryProcessor implements PayrollProcessorInterface
{
const SEMARTHRIS_PAYROLL_PROCESSOR = 'semarthris.salary_processor';

/**
* @var Encryptor
*/
Expand Down
22 changes: 22 additions & 0 deletions src/Component/Salary/Processor/SalaryProcessorInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace KejawenLab\Application\SemartHris\Component\Salary\Processor;

use KejawenLab\Application\SemartHris\Component\Employee\Model\EmployeeInterface;
use KejawenLab\Application\SemartHris\Component\Salary\Model\PayrollInterface;

/**
* @author Muhamad Surya Iksanudin <surya.iksanudin@kejawenlab.com>
*/
interface SalaryProcessorInterface
{
/**
* @param PayrollInterface $payroll
* @param EmployeeInterface $employee
* @param \DateTimeInterface $date
* @param float $fixedSalary
*
* @return float
*/
public function process(PayrollInterface $payroll, EmployeeInterface $employee, \DateTimeInterface $date, float $fixedSalary): float;
}
8 changes: 4 additions & 4 deletions src/Component/Salary/Service/PayrollProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use KejawenLab\Application\SemartHris\Component\Employee\Model\EmployeeInterface;
use KejawenLab\Application\SemartHris\Component\Salary\Processor\InvalidPayrollPeriodException;
use KejawenLab\Application\SemartHris\Component\Salary\Processor\ProcessorInterface;
use KejawenLab\Application\SemartHris\Component\Salary\Processor\PayrollProcessorInterface;
use KejawenLab\Application\SemartHris\Component\Salary\Repository\PayrollPeriodRepositoryInterface;

/**
Expand All @@ -13,7 +13,7 @@
class PayrollProcessor
{
/**
* @var ProcessorInterface
* @var PayrollProcessorInterface
*/
private $payrollProcessor;

Expand All @@ -23,10 +23,10 @@ class PayrollProcessor
private $payrollPeriodRepository;

/**
* @param ProcessorInterface $processor
* @param PayrollProcessorInterface $processor
* @param PayrollPeriodRepositoryInterface $repository
*/
public function __construct(ProcessorInterface $processor, PayrollPeriodRepositoryInterface $repository)
public function __construct(PayrollProcessorInterface $processor, PayrollPeriodRepositoryInterface $repository)
{
$this->payrollProcessor = $processor;
$this->payrollPeriodRepository = $repository;
Expand Down
26 changes: 26 additions & 0 deletions src/Entity/Employee.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use KejawenLab\Application\SemartHris\Component\Contract\Model\Contractable;
use KejawenLab\Application\SemartHris\Component\Contract\Model\ContractInterface;
use KejawenLab\Application\SemartHris\Component\Employee\Model\Superviseable;
use KejawenLab\Application\SemartHris\Component\Employee\RiskRatio;
use KejawenLab\Application\SemartHris\Component\Employee\Service\ValidateContractType;
use KejawenLab\Application\SemartHris\Component\Employee\Service\ValidateGender;
use KejawenLab\Application\SemartHris\Component\Employee\Service\ValidateIdentityType;
Expand Down Expand Up @@ -338,6 +339,15 @@ class Employee implements Superviseable, Contractable, UserInterface, \Serializa
*/
private $haveOvertimeBenefit;

/**
* @Groups({"read", "write"})
*
* @ORM\Column(type="string", length=3)
*
* @var string
*/
private $riskRatio;

/**
* @Groups({"read"})
*
Expand Down Expand Up @@ -842,6 +852,22 @@ public function setHaveOvertimeBenefit(bool $haveOvertimeBenefit): void
$this->haveOvertimeBenefit = $haveOvertimeBenefit;
}

/**
* @return string
*/
public function getRiskRatio(): string
{
return $this->riskRatio ?? RiskRatio::RISK_VERY_LOW;
}

/**
* @param string $riskRatio
*/
public function setRiskRatio(string $riskRatio): void
{
$this->riskRatio = $riskRatio;
}

/**
* @return string
*/
Expand Down
Loading

0 comments on commit 8f70fec

Please sign in to comment.