Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/intern contractor appraisal #3690

Open
wants to merge 50 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
c5e08be
intern onboarding
GauravGusain98 Jul 22, 2024
4510b83
added header an footer
srivastava-jyoti Jul 22, 2024
660ddf9
cleanups
srivastava-jyoti Jul 22, 2024
216edde
wip
srivastava-jyoti Jul 22, 2024
4887f4d
Merge branch 'release' of https:/ColoredCow/portal into f…
GauravGusain98 Jul 23, 2024
6868897
wip
srivastava-jyoti Jul 25, 2024
ace875c
wip
srivastava-jyoti Jul 26, 2024
f0d8c6c
wip
srivastava-jyoti Jul 26, 2024
03eea0a
Merge branch 'release' of https:/coloredcow/portal into f…
AnirudhAP2k Jul 26, 2024
c76af39
wip
srivastava-jyoti Jul 26, 2024
059b595
Added date of birth input for contractor payroll type users
AnirudhAP2k Jul 29, 2024
5c54d29
CI fixes (removed extra whitespaces)
AnirudhAP2k Jul 29, 2024
58df6d8
CI fixes
AnirudhAP2k Jul 29, 2024
2540cf5
CI fixes
AnirudhAP2k Jul 29, 2024
baa6a55
Romoved extra code
AnirudhAP2k Jul 29, 2024
eafc767
Merge branch 'feature/intern-contractor-appraisal' of https://github.…
GauravGusain98 Jul 29, 2024
7910a37
Display DOB in basic details
AnirudhAP2k Jul 29, 2024
dddd3ae
Merge branch 'feat/inter-contractor-dob' of https:/colore…
AnirudhAP2k Jul 29, 2024
4fb3bfe
Merge pull request #3689 from ColoredCow/feat/inter-contractor-dob
GauravGusain98 Jul 30, 2024
8d5d076
wip
srivastava-jyoti Jul 30, 2024
7227b27
employee address
srivastava-jyoti Jul 30, 2024
0e58dd8
sync with main branch
srivastava-jyoti Jul 30, 2024
510b980
calculated age
srivastava-jyoti Jul 30, 2024
2ffa724
Fixed the non-numeric bug while export
AnirudhAP2k Jul 30, 2024
eb6aa1b
Minor fix
AnirudhAP2k Jul 30, 2024
d005404
CI fix
AnirudhAP2k Jul 30, 2024
d8acdce
Code cleanups
AnirudhAP2k Jul 30, 2024
19e642a
Code cleanups
AnirudhAP2k Jul 30, 2024
f5dd60b
Code cleanups
AnirudhAP2k Jul 30, 2024
772e9b8
CI FIxes
AnirudhAP2k Jul 30, 2024
c56fdd1
wip
srivastava-jyoti Jul 30, 2024
01e80ef
wip
srivastava-jyoti Jul 30, 2024
1470421
added salary and gross salary
srivastava-jyoti Jul 30, 2024
20aaa9d
Merge pull request #3691 from ColoredCow/fix/hr-employee-salary-export
GauravGusain98 Jul 30, 2024
8384a9f
FIxed the salary bug for the employee-type user
AnirudhAP2k Aug 1, 2024
91f894b
Code cleanups
AnirudhAP2k Aug 1, 2024
299716d
CI Fixes
AnirudhAP2k Aug 1, 2024
b5bd518
CI Fixes
AnirudhAP2k Aug 1, 2024
5a38454
Added PAN details for the contractor user-type
AnirudhAP2k Aug 3, 2024
dadf596
Merge pull request #3695 from ColoredCow/feat/employee-contractor-pan…
GauravGusain98 Aug 14, 2024
c37f30d
Merge pull request #3694 from ColoredCow/fix/hr-employee-salary-selec…
GauravGusain98 Aug 24, 2024
a123b9b
cleanups
srivastava-jyoti Sep 3, 2024
ed6dc4b
Merge branch 'release' of https:/ColoredCow/portal into f…
GauravGusain98 Sep 3, 2024
49445f2
resolved conflicts
srivastava-jyoti Sep 4, 2024
16adc2e
Merge pull request #3687 from ColoredCow/contractor-apprisal-letter
srivastava-jyoti Sep 4, 2024
b5f10b7
Merge branch 'feature/intern-contractor-appraisal' of https://github.…
GauravGusain98 Sep 4, 2024
71373d5
Merge branch 'master' of https:/ColoredCow/portal into fe…
GauravGusain98 Sep 13, 2024
343a4be
minor fix
GauravGusain98 Sep 13, 2024
63c6b25
Calculation Fix
GauravGusain98 Sep 13, 2024
fa0a5a2
fix the appraisal letter data calculation
GauravGusain98 Sep 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions Modules/HR/Entities/Employee.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ public function employeeSalaries()

public function getCurrentSalary()
{
return $this->employeeSalaries()->where('commencement_date', '<=', today())->latest('commencement_date')->first();
$salaryType = $this->payroll_type == config('salary.payroll_type.full_time.slug') ? config('salary.type.employee_salary.slug') : config('salary.type.contractor_fee.slug');
return $this->employeeSalaries()->where('salary_type', $salaryType)->where('commencement_date', '<=', today())->latest('commencement_date')->first();
}

public function scopeContractorSalary($query)
Expand All @@ -109,9 +110,27 @@ public function scopeEmployeeSalary($query)
return $query->where('salary_type', config('salary.type.employee_salary.slug'));
}

public function getLatestSalary()
public function getLatestSalary($payRollType = null)
{
return $this->employeeSalaries()->latest('commencement_date')->first();
$latestEmployeeSalary = $this->employeeSalaries()->latest('commencement_date')->first();

if (! $latestEmployeeSalary) {
return 0;
}

if ($payRollType) {
if ($payRollType === config('salary.payroll_type.full_time.slug') && $latestEmployeeSalary->salary_type === 'employee-salary') {
return $latestEmployeeSalary;
}

if ($payRollType === config('salary.payroll_type.contractor.slug') && $latestEmployeeSalary->salary_type === 'contractor-fee') {
return $latestEmployeeSalary;
}

return 0;
}

return $latestEmployeeSalary;
}

public function getPreviousSalary($salaryType = 'employee-salary')
Expand Down
5 changes: 5 additions & 0 deletions Modules/Project/Resources/views/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,11 @@
},
markStageAsUpdated(stage) {
if (stage.id) stage.isUpdated = true;
if(stage.start_date && ! stage.end_date){
stage.status = 'started';
} else if (stage.end_date){
stage.status = 'completed';
}
},
updateStatus(status, index) {
const stage = this.stages[index];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<td>
<p class="fz-16 font-weight-bold">Start Date</p>
<input v-if="isEditing(index)" @input="markStageAsUpdated(stage)" type="datetime-local" v-model="stage.start_date" class="form-control fz-14" :disabled="!isEditing(index)">
<p v-else class="fz-16">@{{ formatDisplayDate(stage.start_date) }}</p>
<p v-else-if="stage.start_date" class="fz-16">@{{ formatDisplayDate(stage.start_date) }}</p>
</td>
<td>
<p class="fz-16 font-weight-bold field-required">Expected End Date</p>
Expand All @@ -30,7 +30,7 @@
<td>
<p class="fz-16 font-weight-bold">Actual End Date</p>
<input v-if="isEditing(index)" @input="markStageAsUpdated(stage)" type="datetime-local" v-model="stage.end_date" class="form-control fz-14" :disabled="!isEditing(index)">
<p v-else class="fz-16">@{{ formatDisplayDate(stage.end_date) }}</p>
<p v-else-if="stage.end_date" class="fz-16">@{{ formatDisplayDate(stage.end_date) }}</p>
</td>
<td>
<p class="fz-16 font-weight-bold">Status</p>
Expand Down
30 changes: 30 additions & 0 deletions Modules/Salary/Config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,34 @@
'slug' => 'contractor-fee',
],
],

'payroll_type' => [
'contractor' => [
'label' => 'Contractor',
'slug' => 'contractor',
],
'full_time' => [
'label' => 'Full Time',
'slug' => 'full-time',
],
],

'staff_type' => [
'employee' => [
'label' => 'Employee',
'slug' => 'Employee',
],
'contractor' => [
'label' => 'Contractor',
'slug' => 'Contractor',
],
'support_staff' => [
'label' => 'Support Staff',
'slug' => 'Support Staff',
],
'intern' => [
'label' => 'Intern',
'slug' => 'Intern',
],
]
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddOldDesignationIdAndNewDesignationIdColumnToEmployeeSalaryTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('employee_salaries', function (Blueprint $table) {
$table->bigInteger('old_designation_id')->unsigned()->nullable();
$table->bigInteger('new_designation_id')->unsigned()->nullable();
$table->foreign('old_designation_id')->references('id')->on('hr_job_designation');
$table->foreign('new_designation_id')->references('id')->on('hr_job_designation');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('employee_salaries', function (Blueprint $table) {
$table->dropForeign('new_designation_id');
$table->dropForeign('old_designation_id');
$table->dropColumn(['new_designation_id', 'old_designation_id']);
});
}
}
37 changes: 37 additions & 0 deletions Modules/Salary/Emails/SendContractorIncrementLetterMail.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace Modules\Salary\Emails;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class SendContractorIncrementLetterMail extends Mailable
{
use Queueable, SerializesModels;

public $employee;
public $pdf;
public $commencementDateFormat;

public function __construct($employee, $pdf, $commencementDateFormat)
{
$this->employee = $employee;
$this->pdf = $pdf;
$this->commencementDateFormat = $commencementDateFormat;
}

public function build()
{
$ccEmails = array_map('trim', explode(',', $this->employee['ccemails']));
$ccEmails = array_filter($ccEmails);

return $this->from(config('salary.default.email'), config('salary.default.name'))
->subject('Increment Letter - ' . $this->employee['employeeName'])
->view('salary::emails.contractorIncrementLetterMail', $this->employee)
->attachData($this->pdf, $this->employee['employeeName'] . 'Increment Letter_' . $this->commencementDateFormat . '.pdf', ['mime' => 'application/pdf'])
->when(! empty($ccEmails) && is_array($ccEmails), function ($message) use ($ccEmails) {
$message->cc($ccEmails);
});
}
}
37 changes: 37 additions & 0 deletions Modules/Salary/Emails/SendContractorOnboardingLetterMail.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace Modules\Salary\Emails;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class SendContractorOnboardingLetterMail extends Mailable
{
use Queueable, SerializesModels;

public $employee;
public $pdf;
public $commencementDateFormat;

public function __construct($employee, $pdf, $commencementDateFormat)
{
$this->employee = $employee;
$this->pdf = $pdf;
$this->commencementDateFormat = $commencementDateFormat;
}

public function build()
{
$ccEmails = array_map('trim', explode(',', $this->employee['ccemails']));
$ccEmails = array_filter($ccEmails);

return $this->from(config('salary.default.email'), config('salary.default.name'))
->subject('Onboarding Letter - ' . $this->employee['employeeName'])
->view('salary::emails.contractorOnboardingLetterMail', $this->employee)
->attachData($this->pdf, $this->employee['employeeName'] . 'Onboarding Letter_' . $this->commencementDateFormat . '.pdf', ['mime' => 'application/pdf'])
->when(! empty($ccEmails) && is_array($ccEmails), function ($message) use ($ccEmails) {
$message->cc($ccEmails);
});
}
}
15 changes: 13 additions & 2 deletions Modules/Salary/Entities/EmployeeSalary.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class EmployeeSalary extends Model
{
use Encryptable;

protected $fillable = ['employee_id', 'monthly_gross_salary', 'commencement_date', 'tds', 'salary_type', 'monthly_fee'];
protected $guarded = [];

protected $dates = ['commencement_date'];

Expand All @@ -21,6 +21,17 @@ public function employee()
return $this->belongsTo(Employee::class);
}

public function getMonthlyGrossSalaryAttribute($monthlyGrossSalary)
{
if (is_null($monthlyGrossSalary) || empty($monthlyGrossSalary)) {
return 0;
}

$decryptedMonthlyGrossSalary = $this->decryptValue($monthlyGrossSalary);

return (float) $decryptedMonthlyGrossSalary;
}

public function getBasicSalaryAttribute()
{
$salaryConf = new SalaryConfiguration;
Expand Down Expand Up @@ -72,7 +83,7 @@ public function getFoodAllowanceAttribute()

public function getOtherAllowanceAttribute()
{
return $this->monthly_gross_salary - $this->basic_salary - $this->hra - $this->transport_allowance - $this->food_allowance;
return (float) $this->monthly_gross_salary - $this->basic_salary - $this->hra - $this->transport_allowance - $this->food_allowance;
}

public function getTotalSalaryAttribute()
Expand Down
Loading
Loading