Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
41 | { |
||
42 | if ($this->payslip) { |
||
43 | $employee = $this->payslip->employee; |
||
44 | $salary = $employee->salary; |
||
45 | $payroll = $this->payslip->payroll; |
||
|
|||
46 | $earnings = $this->payslip->earnings; |
||
47 | $deductions = $this->payslip->deductions; |
||
48 | |||
49 | $this->payslip->basic_salary = $salary->amount; |
||
50 | $this->payslip->gross_salary = $gross_salary = ($earnings->sum('amount') + $salary->amount); |
||
51 | $this->payslip->net_salary = $gross_salary - $deductions->sum('amount'); |
||
52 | |||
53 | $this->payslip->save(); |
||
54 | } |
||
55 | |||
56 | return $this; |
||
57 | } |
||
58 | } |
||
59 |