ss
This commit is contained in:
parent
cb1287ce35
commit
549dc11a9c
@ -78,7 +78,7 @@
|
|||||||
'hostname' => 'localhost',
|
'hostname' => 'localhost',
|
||||||
'username' => 'root',
|
'username' => 'root',
|
||||||
'password' => '',
|
'password' => '',
|
||||||
'database' => 'testbbone',
|
'database' => 'venbaehn_ams',
|
||||||
// 'hostname' => '119.18.54.85',
|
// 'hostname' => '119.18.54.85',
|
||||||
// 'username' => 'venbaehn_ams',
|
// 'username' => 'venbaehn_ams',
|
||||||
// 'password' => 'L;nD7Z@f)1ZT',
|
// 'password' => 'L;nD7Z@f)1ZT',
|
||||||
|
|||||||
@ -19,37 +19,37 @@ function send_emails($to, $subject, $body, $aliasName = '', $cc = null, $bcc = n
|
|||||||
|
|
||||||
$mailer->isSMTP();
|
$mailer->isSMTP();
|
||||||
$mailer->CharSet = 'utf-8';
|
$mailer->CharSet = 'utf-8';
|
||||||
$mailer->Host=business()->mail_hostname;
|
$mailer->Host= 'mail.venbait.in';
|
||||||
$mailer->SMTPSecure = business()->mail_security;
|
$mailer->SMTPSecure = 'ssl';
|
||||||
$mailer->SMTPAuth =true;
|
$mailer->SMTPAuth =true;
|
||||||
$mailer->SMTPDebug = 2;
|
$mailer->SMTPDebug = false;
|
||||||
$mailer->Username=business()->mail_username;
|
$mailer->Username='bbone@venbait.in';
|
||||||
$mailer->Password=business()->mail_password;
|
$mailer->Password='xk!L(N_-R#};';
|
||||||
$mailer->Port=business()->mail_port_no;
|
$mailer->Port=465;
|
||||||
$mailer->setFrom(business()->sender_mail, $aliasName);
|
$mailer->setFrom(business()->sender_mail, $aliasName);
|
||||||
$mailer->addAddress($to);
|
$mailer->addAddress('suseendhiran13@gmail.com');
|
||||||
|
|
||||||
// Add CC recipients
|
// Add CC recipients
|
||||||
if ($cc !== null) {
|
// if ($cc !== null) {
|
||||||
if (is_array($cc)) {
|
// if (is_array($cc)) {
|
||||||
foreach ($cc as $ccRecipient) {
|
// foreach ($cc as $ccRecipient) {
|
||||||
$mailer->addCC($ccRecipient);
|
// $mailer->addCC($ccRecipient);
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
$mailer->addCC($cc);
|
// $mailer->addCC($cc);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Add BCC recipients
|
// Add BCC recipients
|
||||||
if ($bcc !== null) {
|
// if ($bcc !== null) {
|
||||||
if (is_array($bcc)) {
|
// if (is_array($bcc)) {
|
||||||
foreach ($bcc as $bccRecipient) {
|
// foreach ($bcc as $bccRecipient) {
|
||||||
$mailer->addBCC($bccRecipient);
|
// $mailer->addBCC($bccRecipient);
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
$mailer->addBCC($bcc);
|
// $mailer->addBCC($bcc);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
$mailer->Subject=$subject;
|
$mailer->Subject=$subject;
|
||||||
$mailer->isHTML(true);
|
$mailer->isHTML(true);
|
||||||
|
|||||||
@ -74,8 +74,9 @@ public function rise_expence_request()
|
|||||||
}else{
|
}else{
|
||||||
$emp_id = user()->id;
|
$emp_id = user()->id;
|
||||||
}
|
}
|
||||||
|
// echo $emp_id;die;
|
||||||
$get_manager_id = $this->Expence_model->get_manager_id($emp_id);
|
$get_manager_id = $this->Expence_model->get_manager_id($emp_id);
|
||||||
|
// echo $get_manager_id[0]->manager;die;
|
||||||
if($get_manager_id[0]->manager == null){
|
if($get_manager_id[0]->manager == null){
|
||||||
|
|
||||||
$manager = 0;
|
$manager = 0;
|
||||||
@ -96,7 +97,9 @@ public function rise_expence_request()
|
|||||||
$table="expense";
|
$table="expense";
|
||||||
$create_Expence = $this->MY_Model->insert($data1,$table);
|
$create_Expence = $this->MY_Model->insert($data1,$table);
|
||||||
|
|
||||||
$count = count($this->input->post('date_of_expence'));
|
// $count = count($this->input->post('date_of_expence'));
|
||||||
|
$count = ($this->input->post('date_of_expence_new')) ? count($this->input->post('date_of_expence_new')) : 1;
|
||||||
|
// echo json_encode($this->input->post());die;
|
||||||
for($i=0;$i<$count;$i++)
|
for($i=0;$i<$count;$i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -106,7 +109,8 @@ public function rise_expence_request()
|
|||||||
'business_id' => user()->business_id,
|
'business_id' => user()->business_id,
|
||||||
'manager_id' => $manager,
|
'manager_id' => $manager,
|
||||||
'status' => 'Draft',
|
'status' => 'Draft',
|
||||||
'date_of_expense'=> $this->input->post('date_of_expence')[$i],
|
// 'date_of_expense'=> $this->input->post('date_of_expence')[$i],
|
||||||
|
'date_of_expense_new'=> $this->input->post('date_of_expence_new')[$i],
|
||||||
'amount' => $this->input->post('amount')[$i],
|
'amount' => $this->input->post('amount')[$i],
|
||||||
'description' => $this->input->post('description')[$i],
|
'description' => $this->input->post('description')[$i],
|
||||||
);
|
);
|
||||||
|
|||||||
@ -202,7 +202,7 @@
|
|||||||
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Date of Expense<a style="color:red;">*</a></label>
|
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Date of Expense<a style="color:red;">*</a></label>
|
||||||
<div class="col-md-5 col-sm-5 ">
|
<div class="col-md-5 col-sm-5 ">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type='text' id="ExpenseDate<?php echo $i;?>" class="form-control date" placeholder="DD-MM-YYYY" required name="date_of_expence[]" value="<?php echo $value->date_of_expense ?>" autocomplete='off'/><i class="fa fa-calendar" style=" position: absolute; right: 25px; top: 12px;z-index: 0;"></i>
|
<input type='text' id="ExpenseDate<?php echo $i;?>" class="form-control date" placeholder="DD-MM-YYYY" required name="date_of_expence[]" value="<?php echo $value->date_of_expense_new ?>" autocomplete='off'/><i class="fa fa-calendar" style=" position: absolute; right: 25px; top: 12px;z-index: 0;"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -144,7 +144,7 @@
|
|||||||
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Date of Expense<a style="color:red;">*</a></label>
|
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Date of Expense<a style="color:red;">*</a></label>
|
||||||
<div class="col-md-5 col-sm-5 ">
|
<div class="col-md-5 col-sm-5 ">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type='date' id='ExpenseDate' class="form-control" placeholder="DD-MM-YYYY" required name="date_of_expence[]" value="<?php echo $value->date_of_expense ?>" autocomplete='off' /><i class="fa fa-calendar"></i>
|
<input type='date' id='ExpenseDate' class="form-control" placeholder="DD-MM-YYYY" required name="date_of_expence_new[]" value="<?php echo $value->date_of_expense ?>" autocomplete='off' /><i class="fa fa-calendar"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="hidden" name="expense_pid" value="<?php echo $expense_data[0]->id; ?>">
|
<input type="hidden" name="expense_pid" value="<?php echo $expense_data[0]->id; ?>">
|
||||||
@ -184,7 +184,7 @@
|
|||||||
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Date of Expense<a style="color:red;">*</a></label>
|
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Date of Expense<a style="color:red;">*</a></label>
|
||||||
<div class="col-md-5 col-sm-5 ">
|
<div class="col-md-5 col-sm-5 ">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type='text' id='ExpenseDate' class="form-control" placeholder="DD-MM-YYYY" required name="date_of_expence[]" value="" autocomplete='off'/>
|
<input type='text' id='ExpenseDate' class="form-control" placeholder="DD-MM-YYYY" required name="date_of_expence_new[]" value="" autocomplete='off'/>
|
||||||
<i class="fa fa-calendar" style=" position: absolute; right: 25px; top: 12px;z-index: 0;"></i>
|
<i class="fa fa-calendar" style=" position: absolute; right: 25px; top: 12px;z-index: 0;"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -397,7 +397,7 @@ function createAndAppendFormGroup() {
|
|||||||
html1 += '<br><div class="x_title"></div><br>'
|
html1 += '<br><div class="x_title"></div><br>'
|
||||||
html1 += '<div class="item form-group">';
|
html1 += '<div class="item form-group">';
|
||||||
html1 += '<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Date of Expense<a style="color:red;">*</a></label>';
|
html1 += '<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Date of Expense<a style="color:red;">*</a></label>';
|
||||||
html1 += '<div class="col-md-5 col-sm-5 "><div class="form-group"><input type="text" id="datepicker'+i+'" class="form-control date-picker" placeholder="DD-MM-YYYY" name="date_of_expence[]" value="" autocomplete="off" required/><i class="fa fa-calendar" style=" position: absolute; right: 25px; top: 12px;z-index: 0;"></i></div></div>';
|
html1 += '<div class="col-md-5 col-sm-5 "><div class="form-group"><input type="text" id="datepicker'+i+'" class="form-control date-picker" placeholder="DD-MM-YYYY" name="date_of_expence_new[]" value="" autocomplete="off" required/><i class="fa fa-calendar" style=" position: absolute; right: 25px; top: 12px;z-index: 0;"></i></div></div>';
|
||||||
html1 += '<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Amount <a style="color:red;">*</a></label>';
|
html1 += '<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Amount <a style="color:red;">*</a></label>';
|
||||||
html1 += '<div class="col-md-5 col-sm-5 "><input id="cost" name="amount[]" required class="form-control" onkeypress="return matchnum(event)" type="number" name="middle-name" autocomplete="off"></div>';
|
html1 += '<div class="col-md-5 col-sm-5 "><input id="cost" name="amount[]" required class="form-control" onkeypress="return matchnum(event)" type="number" name="middle-name" autocomplete="off"></div>';
|
||||||
html1 += '</div>';
|
html1 += '</div>';
|
||||||
|
|||||||
@ -96,7 +96,9 @@
|
|||||||
<li><a href="<?php echo base_url();?>Leave/applyLeave">Apply Leave</a></li>
|
<li><a href="<?php echo base_url();?>Leave/applyLeave">Apply Leave</a></li>
|
||||||
|
|
||||||
<li><a href="<?php echo base_url();?>Leave/leaveList">My Approvals</a></li>
|
<li><a href="<?php echo base_url();?>Leave/leaveList">My Approvals</a></li>
|
||||||
|
<?php if(check_auth() && is_admin()) { ?>
|
||||||
|
<li><a href="<?php echo base_url();?>Leave/leave_list_report">Leave Report</a></li>
|
||||||
|
<?php } ?>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|||||||
@ -64,6 +64,36 @@ public function leaveList()
|
|||||||
$this->layout->render('Employee_Layout');
|
$this->layout->render('Employee_Layout');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function leave_list_report()
|
||||||
|
{
|
||||||
|
$business_id = user()->business_id;
|
||||||
|
$leave_list = $this->Leave_model->get_all_leave(user()->business_id);
|
||||||
|
$resultArray = [];
|
||||||
|
|
||||||
|
foreach ($leave_list as $entry) {
|
||||||
|
$key = $entry->emp_id . '_' . $entry->type.'_'. date('m-Y', strtotime($entry->from_date_new));
|
||||||
|
if (!isset($resultArray[$key])) {
|
||||||
|
if($entry->from_date_new != '') $entry->from_date_new = '( '.date('d-m-Y', strtotime($entry->from_date_new)).', '.date('d-m-Y', strtotime($entry->to_date_new)).' )';
|
||||||
|
$resultArray[$key] = $entry;
|
||||||
|
} else {
|
||||||
|
foreach ($entry as $field => $value) {
|
||||||
|
if ($field == 'from_date_new' && $value != '') {
|
||||||
|
$resultArray[$key]->$field .= '( '.date('d-m-Y', strtotime($entry->from_date_new)).', '.date('d-m-Y', strtotime($entry->to_date_new)).' )';
|
||||||
|
}
|
||||||
|
if ($field == 'no_of_days') {
|
||||||
|
$resultArray[$key]->$field += $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = array_values($resultArray);
|
||||||
|
// echo json_encode( $result, JSON_PRETTY_PRINT);die;
|
||||||
|
$this->layout->set('leave_list', $result);
|
||||||
|
$this->layout->buffer('main_content', 'Leave/leave_list_report');
|
||||||
|
$this->layout->render('Employee_Layout');
|
||||||
|
}
|
||||||
|
|
||||||
public function applyLeave($update = null)
|
public function applyLeave($update = null)
|
||||||
{
|
{
|
||||||
$business_id = user()->business_id;
|
$business_id = user()->business_id;
|
||||||
@ -116,7 +146,9 @@ public function get_emp_name()
|
|||||||
public function createLeave()
|
public function createLeave()
|
||||||
{
|
{
|
||||||
//permission type create part
|
//permission type create part
|
||||||
|
try {
|
||||||
|
// echo base_url();die;
|
||||||
|
// echo json_encode($this->input->post());die;
|
||||||
if(!empty($this->input->post('from_time')))
|
if(!empty($this->input->post('from_time')))
|
||||||
{
|
{
|
||||||
$perm_data = $this->input->post();
|
$perm_data = $this->input->post();
|
||||||
@ -144,12 +176,15 @@ public function createLeave()
|
|||||||
$perm_data['manager'] = $manager;
|
$perm_data['manager'] = $manager;
|
||||||
$perm_data['business_id'] = user()->business_id;
|
$perm_data['business_id'] = user()->business_id;
|
||||||
$perm_data['status'] = 'pending';
|
$perm_data['status'] = 'pending';
|
||||||
$perm_data['created_date'] = date('d-m-Y');
|
// $perm_data['created_date'] = date('d-m-Y');
|
||||||
|
$perm_data['created_date_new'] = date('d-m-Y');
|
||||||
$perm_data['created_time'] = date('H:i A');
|
$perm_data['created_time'] = date('H:i A');
|
||||||
unset($perm_data['from_date']);
|
unset($perm_data['from_date']);
|
||||||
unset($perm_data['to_date']);
|
unset($perm_data['to_date']);
|
||||||
|
unset($perm_data['from_date_new']);
|
||||||
|
unset($perm_data['to_date_new']);
|
||||||
$table="leave_list";
|
$table="leave_list";
|
||||||
// print_r($perm_data);die;
|
$perm_data['perm_date_new'] = date("Y-m-d", strtotime( $this->input->post('perm_date_new') ));
|
||||||
$create_permission = $this->MY_Model->insert($perm_data,$table);
|
$create_permission = $this->MY_Model->insert($perm_data,$table);
|
||||||
|
|
||||||
//for notification
|
//for notification
|
||||||
@ -168,6 +203,7 @@ public function createLeave()
|
|||||||
//Leave create part
|
//Leave create part
|
||||||
$data = $this->input->post();
|
$data = $this->input->post();
|
||||||
unset($data['perm_date']);
|
unset($data['perm_date']);
|
||||||
|
unset($data['perm_date_new']);
|
||||||
unset($data['from_time']);
|
unset($data['from_time']);
|
||||||
unset($data['to_time']);
|
unset($data['to_time']);
|
||||||
|
|
||||||
@ -196,9 +232,10 @@ public function createLeave()
|
|||||||
$data['manager'] = $manager;
|
$data['manager'] = $manager;
|
||||||
$data['business_id'] = user()->business_id;
|
$data['business_id'] = user()->business_id;
|
||||||
$data['status'] = 'pending';
|
$data['status'] = 'pending';
|
||||||
$data['created_date'] = date('d-m-Y');
|
// $data['created_date'] = date('d-m-Y');
|
||||||
|
$perm_data['created_date_new'] = date('d-m-Y');
|
||||||
$data['created_time'] = date('H:i A');
|
$data['created_time'] = date('H:i A');
|
||||||
$leave_year = date('Y', strtotime($this->input->post('from_date')));
|
$leave_year = date('Y', strtotime($this->input->post('from_date_new')));
|
||||||
|
|
||||||
//get employee's leave count
|
//get employee's leave count
|
||||||
$emp_leave_count = $this->Leave_model->get_leave( $emp_id , user()->business_id , "emp_leave_days", $leave_year, $this->input->post('type'));
|
$emp_leave_count = $this->Leave_model->get_leave( $emp_id , user()->business_id , "emp_leave_days", $leave_year, $this->input->post('type'));
|
||||||
@ -207,7 +244,7 @@ public function createLeave()
|
|||||||
|
|
||||||
|
|
||||||
// count number of days between two dates
|
// count number of days between two dates
|
||||||
$days_between = ceil(abs(strtotime($this->input->post('to_date')) - strtotime($this->input->post('from_date'))) / 86400);
|
$days_between = ceil(abs(strtotime($this->input->post('to_date_new')) - strtotime($this->input->post('from_date_new'))) / 86400);
|
||||||
$data['no_of_days'] = $days_between + 1;
|
$data['no_of_days'] = $days_between + 1;
|
||||||
$noofdays = $days_between + 1;
|
$noofdays = $days_between + 1;
|
||||||
|
|
||||||
@ -254,15 +291,19 @@ public function createLeave()
|
|||||||
}
|
}
|
||||||
|
|
||||||
$get_emp_data = $this->Leave_model->get_emp_data_by_emp_id($emp_id);
|
$get_emp_data = $this->Leave_model->get_emp_data_by_emp_id($emp_id);
|
||||||
|
// echo json_encode( $get_emp_data);die;
|
||||||
// print_r($get_emp_data[0]->j_date); die;
|
// print_r($get_emp_data[0]->j_date); die;
|
||||||
|
|
||||||
$from_date = new DateTime($this->input->post('from_date'));
|
$from_date = new DateTime($this->input->post('from_date_new'));
|
||||||
$j_date = new DateTime($get_emp_data[0]->j_date);
|
$j_date = new DateTime($get_emp_data[0]->j_date);
|
||||||
$to_date = new DateTime($this->input->post('to_date'));
|
$to_date = new DateTime($this->input->post('to_date_new'));
|
||||||
|
|
||||||
|
|
||||||
if ($from_date >= $j_date && $from_date <= $to_date) {
|
if ($from_date >= $j_date && $from_date <= $to_date) {
|
||||||
$table="leave_list";
|
$table="leave_list";
|
||||||
|
$data['from_date_new'] = date("Y-m-d", strtotime( $this->input->post('from_date_new') ));
|
||||||
|
$data['to_date_new'] = date("Y-m-d", strtotime( $this->input->post('to_date_new') ));
|
||||||
|
// echo json_encode($data);die;
|
||||||
$create_leave = $this->MY_Model->insert($data,$table);
|
$create_leave = $this->MY_Model->insert($data,$table);
|
||||||
} else {
|
} else {
|
||||||
$this->session->set_flashdata('error', '1');
|
$this->session->set_flashdata('error', '1');
|
||||||
@ -273,7 +314,7 @@ public function createLeave()
|
|||||||
if($create_leave){
|
if($create_leave){
|
||||||
$code = 'APPLY_LEAVE';
|
$code = 'APPLY_LEAVE';
|
||||||
$type = 'Email';
|
$type = 'Email';
|
||||||
$this->notification->sendNotification($create_leave, $code, $type);
|
$mailres = $this->notification->sendNotification($create_leave, $code, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
//audit
|
//audit
|
||||||
@ -288,7 +329,13 @@ public function createLeave()
|
|||||||
$test = $this->audit->create_history('insert');
|
$test = $this->audit->create_history('insert');
|
||||||
}
|
}
|
||||||
$this->session->set_flashdata('Success', '1');
|
$this->session->set_flashdata('Success', '1');
|
||||||
|
// $this->LeaveHistory();
|
||||||
redirect('Leave/LeaveHistory');
|
redirect('Leave/LeaveHistory');
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo "An error occurred: " . $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -725,7 +772,7 @@ public function ApprovewithdrawLeave()
|
|||||||
// {
|
// {
|
||||||
// redirect('Leave/dashboard');
|
// redirect('Leave/dashboard');
|
||||||
// }
|
// }
|
||||||
public function dashboard()
|
public function dashboard()
|
||||||
{
|
{
|
||||||
$business_id = user()->business_id;
|
$business_id = user()->business_id;
|
||||||
|
|
||||||
@ -733,8 +780,9 @@ public function dashboard()
|
|||||||
// Replace 123 with the actual business_id
|
// Replace 123 with the actual business_id
|
||||||
// $this->load->view('Leave/dashboard', $data);
|
// $this->load->view('Leave/dashboard', $data);
|
||||||
|
|
||||||
$data['weekData'] = $this->Leave_model->get_approved_leaves_cur_week($business_id);
|
// $data['weekData'] = $this->Leave_model->get_approved_leaves_cur_week($business_id);
|
||||||
|
$data['weekData'] = $this->Leave_model->get_week_leave_count($business_id);
|
||||||
|
// echo print_r($data['weekData']);die;
|
||||||
$this->layout->buffer('main_content', 'Leave/dashboard',$data);
|
$this->layout->buffer('main_content', 'Leave/dashboard',$data);
|
||||||
$this->layout->render('Employee_Layout');
|
$this->layout->render('Employee_Layout');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,24 @@
|
|||||||
<?php
|
<?php
|
||||||
class Leave_model extends MY_Model {
|
class Leave_model extends MY_Model {
|
||||||
|
|
||||||
|
public function get_all_leave($business_id)
|
||||||
|
{
|
||||||
|
$this->db->select('A.* ,U1.name as emp_name, U2.name as ApproveBy, l1.type as leavetype');
|
||||||
|
$this->db->from('leave_list A');
|
||||||
|
$this->db->join('users U1', 'U1.id = A.emp_id', 'left');
|
||||||
|
$this->db->join('users U2', 'U2.id = A.approved_by', 'left');
|
||||||
|
$this->db->join('leave_master l1', 'l1.id = A.type', 'left');
|
||||||
|
$this->db->where('A.business_id', $business_id);
|
||||||
|
$this->db->where('A.is_active', 1);
|
||||||
|
$this->db->where('A.approved_by !=', '');
|
||||||
|
$this->db->order_by('A.id','DESC');
|
||||||
|
// $this->db->group_by('A.type,A.emp_id');
|
||||||
|
$query = $this->db->get();
|
||||||
|
$query = $query->result();
|
||||||
|
return $query;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function get_leave_with_emp_name($business_id)
|
public function get_leave_with_emp_name($business_id)
|
||||||
{
|
{
|
||||||
$this->db->select('A.* ,U1.name as emp_name, U2.name as ApproveBy, U3.name as DeclineBy, U4.name as Risedby');
|
$this->db->select('A.* ,U1.name as emp_name, U2.name as ApproveBy, U3.name as DeclineBy, U4.name as Risedby');
|
||||||
@ -564,55 +582,56 @@ public function get_approved_leaves_cur_week()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function get_week_leave_count($business_id)
|
||||||
|
{
|
||||||
|
$startOfWeek = date('Y-m-d', strtotime('monday this week'));
|
||||||
|
$endOfWeek = date('Y-m-d', strtotime('sunday this week'));
|
||||||
|
|
||||||
|
// Query to get leave records for the specified employee within the current week
|
||||||
|
$this->db->select('A.*, U1.name as employee_name');
|
||||||
|
$this->db->from('leave_list A');
|
||||||
|
$this->db->where('A.business_id', $business_id);
|
||||||
|
$this->db->where("(A.from_date_new BETWEEN '$startOfWeek' AND '$endOfWeek' OR A.to_date_new BETWEEN '$startOfWeek' AND '$endOfWeek' OR (A.from_date_new < '$startOfWeek' AND A.to_date_new > '$endOfWeek'))");
|
||||||
|
$this->db->join('users U1', 'U1.id = A.emp_id', 'left');
|
||||||
|
$query = $this->db->get();
|
||||||
|
$leaveRecords = $query->result();
|
||||||
|
// echo json_encode($leaveRecords);die;
|
||||||
|
// Initialize an array to store leave counts for each day of the week
|
||||||
|
$weeklyLeaveCounts = array(
|
||||||
|
'sunday' => [],
|
||||||
|
'monday' => [],
|
||||||
|
'tuesday' => [],
|
||||||
|
'wednesday' => [],
|
||||||
|
'thursday' => [],
|
||||||
|
'friday' => [],
|
||||||
|
'saturday' => []
|
||||||
|
);
|
||||||
|
|
||||||
|
// Iterate over the leave records to count leaves for each day of the week
|
||||||
|
foreach ($leaveRecords as $key => $record) {
|
||||||
|
if($record->from_date_new < $startOfWeek)
|
||||||
|
{
|
||||||
|
$record->from_date_new = $startOfWeek;
|
||||||
|
}
|
||||||
|
|
||||||
// public function get_all_leave_data($business_id){
|
if($record->to_date_new > $endOfWeek)
|
||||||
|
{
|
||||||
// $this->db->select('leave_list.*, employees.*, users.*, leave_master.*, (SELECT MAX(remaining_days) FROM emp_leave_days WHERE emp_id = leave_list.emp_id) as leave_balance');
|
$record->to_date_new = $endOfWeek;
|
||||||
// $this->db->from('leave_list');
|
}
|
||||||
|
|
||||||
// $this->db->join('users', 'leave_list.emp_id = users.id', 'left');
|
|
||||||
// $this->db->join('employees', 'leave_list.emp_id = employees.user_id', 'left');
|
|
||||||
// $this->db->join('leave_master', 'leave_list.type = leave_master.id', 'left');
|
|
||||||
|
|
||||||
// $this->db->select_sum('leave_list.no_of_days', 'total_leave_days');
|
|
||||||
// $this->db->select('SUM(CASE WHEN leave_master.type = "permission" THEN 1 ELSE 0 END) as permission_count');
|
|
||||||
// $this->db->group_by('leave_list.emp_id');
|
|
||||||
|
|
||||||
// $query = $this->db->get();
|
|
||||||
// print_r($this->db->last_query());
|
|
||||||
// return $query->result();
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// public function get_all_leave_data($business_id) {
|
|
||||||
// $this->db->select('leave_list.*, employees.*, users.*, leave_master.*, leave_list.leave_bal');
|
|
||||||
|
|
||||||
// $this->db->from('leave_list');
|
|
||||||
|
|
||||||
// $this->db->join('users', 'leave_list.emp_id = users.id', 'left');
|
|
||||||
// $this->db->join('employees', 'leave_list.emp_id = employees.user_id', 'left');
|
|
||||||
// $this->db->join('leave_master', 'leave_list.type = leave_master.id', 'left');
|
|
||||||
|
|
||||||
// // Subquery to get the last inserted leave balance for each employee
|
|
||||||
// $subquery = $this->db->select('MAX(id) as max_id')
|
|
||||||
// ->from('leave_list ll')
|
|
||||||
// ->where('ll.emp_id = leave_list.emp_id', null, false)
|
|
||||||
// ->get_compiled_select();
|
|
||||||
|
|
||||||
// $this->db->join("($subquery) as latest_leave", 'leave_list.id = latest_leave.max_id', 'left');
|
|
||||||
|
|
||||||
// $this->db->group_by('leave_list.emp_id');
|
|
||||||
|
|
||||||
// $query = $this->db->get();
|
|
||||||
// print_r($this->db->last_query());
|
|
||||||
// return $query->result();
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
$startDate = date('l', strtotime($record->from_date_new));
|
||||||
|
$endDate = date('l', strtotime($record->to_date_new));
|
||||||
|
// Increment leave counts for each day within the leave period
|
||||||
|
while ($startDate !== $endDate) {
|
||||||
|
array_push($weeklyLeaveCounts[strtolower($startDate)], $record->employee_name);
|
||||||
|
$startDate = date('l', strtotime($startDate . ' +1 day'));
|
||||||
|
}
|
||||||
|
array_push($weeklyLeaveCounts[strtolower($startDate)], $record->employee_name); // Increment for the last day
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the array with leave counts for each day of the week
|
||||||
|
return $weeklyLeaveCounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -183,7 +183,7 @@
|
|||||||
<label class="control-label col-md-2 col-sm-2 " for="first-name"> From Date<a style="color:red;">*</a> </label>
|
<label class="control-label col-md-2 col-sm-2 " for="first-name"> From Date<a style="color:red;">*</a> </label>
|
||||||
<div class="col-md-2 col-sm-2 ">
|
<div class="col-md-2 col-sm-2 ">
|
||||||
<div class='input-group date'>
|
<div class='input-group date'>
|
||||||
<input type='text' class="form-control" placeholder="DD-MM-YYYY" id="fromdate" name="from_date" value="" required autocomplete="off" />
|
<input type='text' class="form-control" placeholder="DD-MM-YYYY" id="fromdate" name="from_date_new" value="" required autocomplete="off" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -191,7 +191,7 @@
|
|||||||
<label class="control-label col-md-1 col-sm-1" for="last-name">To Date<a style="color:red;">*</a> </label>
|
<label class="control-label col-md-1 col-sm-1" for="last-name">To Date<a style="color:red;">*</a> </label>
|
||||||
<div class="col-md-2 col-sm-2 ">
|
<div class="col-md-2 col-sm-2 ">
|
||||||
<div class='input-group date' >
|
<div class='input-group date' >
|
||||||
<input type='text' class="form-control" placeholder="DD-MM-YYYY" id="todate" name= "to_date" value="" required autocomplete="off"/>
|
<input type='text' class="form-control" placeholder="DD-MM-YYYY" id="todate" name= "to_date_new" value="" required autocomplete="off"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -209,7 +209,7 @@
|
|||||||
<label class="control-label col-md-2 col-sm-2 " for="first-name">Date<a style="color:red;">*</a> </label>
|
<label class="control-label col-md-2 col-sm-2 " for="first-name">Date<a style="color:red;">*</a> </label>
|
||||||
<div class="col-md-5 col-sm-5 ">
|
<div class="col-md-5 col-sm-5 ">
|
||||||
<div class='input-group date'>
|
<div class='input-group date'>
|
||||||
<input type='text' class="form-control" required name="perm_date" placeholder="DD-MM-YYYY" value="" id='perm_id'/></div>
|
<input type='text' class="form-control" required name="perm_date_new" placeholder="DD-MM-YYYY" value="" id='perm_id'/></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -23,12 +23,18 @@
|
|||||||
/* Add a CSS class for highlighting the current date */
|
/* Add a CSS class for highlighting the current date */
|
||||||
table#datatables th {
|
table#datatables th {
|
||||||
background-color: #C8E4E7;
|
background-color: #C8E4E7;
|
||||||
|
text-align: center;
|
||||||
|
padding: 5px 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the background color of the current date heading */
|
/* Set the background color of the current date heading */
|
||||||
table#datatables th.current-date {
|
table#datatables th.current-date {
|
||||||
background-color: #A8E7CF;
|
background-color: #A8E7CF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
/* table#datatables th:not(.current-date):first-child,
|
/* table#datatables th:not(.current-date):first-child,
|
||||||
table#datatables td:first-child:not(.current-date) {
|
table#datatables td:first-child:not(.current-date) {
|
||||||
background-color: #BEEEE6;
|
background-color: #BEEEE6;
|
||||||
@ -57,7 +63,7 @@
|
|||||||
|
|
||||||
<ul class="nav navbar-right panel_toolbox"></ul>
|
<ul class="nav navbar-right panel_toolbox"></ul>
|
||||||
|
|
||||||
<h1>Employ Leave List</h1>
|
<h1>Leave Dashboard</h1>
|
||||||
|
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -80,7 +86,7 @@
|
|||||||
|
|
||||||
// Display the date and day, but skip Sunday
|
// Display the date and day, but skip Sunday
|
||||||
if ($dayOfWeek !== 'Sunday') {
|
if ($dayOfWeek !== 'Sunday') {
|
||||||
echo '<th' . $class . '><h2>' . $dayOfWeek . '</h2><span>(' . $formattedDate . ')</span></th>';
|
echo '<th' . $class . '><p style="margin:0;">' . $dayOfWeek . '</p><span>(' . $formattedDate . ')</span></th>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move to the next day
|
// Move to the next day
|
||||||
@ -88,74 +94,24 @@
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<?php
|
<?php
|
||||||
// Reset the current date to the start date of the current week
|
// Remove duplicate
|
||||||
$currentDate = date('Y-m-d', strtotime('monday this week'));
|
foreach ($weekData as &$dayData) {
|
||||||
|
$dayData = array_unique($dayData);
|
||||||
// Iterate over the days of the current week
|
|
||||||
for ($i = 0; $i < 7; $i++) {
|
|
||||||
$dayOfWeek = date('l', strtotime($currentDate));
|
|
||||||
|
|
||||||
// Skip Sunday
|
|
||||||
if ($dayOfWeek !== 'Sunday') {
|
|
||||||
echo '<td>';
|
|
||||||
|
|
||||||
// Check if there are leave records for the current day
|
|
||||||
if (array_key_exists($dayOfWeek, $weekData)) {
|
|
||||||
foreach ($weekData[$dayOfWeek] as $leaveRecord) {
|
|
||||||
if (empty($leaveRecord['from_time']) && empty($leaveRecord['to_time'])) {
|
|
||||||
// Display leave records for the day
|
|
||||||
echo $leaveRecord['emp_name'] . '<br>' . $leaveRecord['from_time'] . $leaveRecord['to_time'] . '<br>';
|
|
||||||
}
|
}
|
||||||
}
|
// Assuming $weekData contains the array of arrays you provided
|
||||||
} else {
|
echo '<tr>';
|
||||||
// No leave records for the day
|
echo '<td>' . implode(',<br>', $weekData['monday']) . '</td>';
|
||||||
|
echo '<td>' . implode(',<br>', $weekData['tuesday']) . '</td>';
|
||||||
|
echo '<td>' . implode(',<br>', $weekData['wednesday']) . '</td>';
|
||||||
|
echo '<td>' . implode(',<br>', $weekData['thursday']) . '</td>';
|
||||||
|
echo '<td>' . implode(',<br>', $weekData['friday']) . '</td>';
|
||||||
|
echo '<td>' . implode(',<br>', $weekData['saturday']) . '</td>';
|
||||||
|
echo '</tr>';
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Move to the next day
|
|
||||||
$currentDate = date('Y-m-d', strtotime($currentDate . ' +1 day'));
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<?php
|
|
||||||
// Reset the current date to the start date of the current week
|
|
||||||
$currentDate = date('Y-m-d', strtotime('monday this week'));
|
|
||||||
|
|
||||||
// Iterate over the days of the current week
|
|
||||||
for ($i = 0; $i < 7; $i++) {
|
|
||||||
$dayOfWeek = date('l', strtotime($currentDate));
|
|
||||||
|
|
||||||
// Skip Sunday
|
|
||||||
if ($dayOfWeek !== 'Sunday') {
|
|
||||||
echo '<td>';
|
|
||||||
|
|
||||||
// Check if there are leave records for the current day
|
|
||||||
if (array_key_exists($dayOfWeek, $weekData)) {
|
|
||||||
foreach ($weekData[$dayOfWeek] as $leaveRecord) {
|
|
||||||
if (!empty($leaveRecord['from_time']) && !empty($leaveRecord['to_time'])) {
|
|
||||||
echo $leaveRecord['emp_name'] . '<br>' . $leaveRecord['from_time'] . $leaveRecord['to_time'] . '<br>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// No leave records for the day
|
|
||||||
// echo 'No Leave';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Move to the next day
|
|
||||||
$currentDate = date('Y-m-d', strtotime($currentDate . ' +1 day'));
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -163,13 +119,5 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<!-- Large modal -->
|
|
||||||
<div class="modal fade bs-example-modal-lg" id="ItemModal" tabindex="-1" role="dialog" aria-hidden="true"></div>
|
|
||||||
<div class="modal bs-example-modal-sm" tabindex="-1" role="dialog" aria-hidden="true" id="popup"> </div>
|
|
||||||
|
|
||||||
<div style="display:none" id="sub-value"></div>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -73,20 +73,20 @@
|
|||||||
<?php if($type->id === $value->type ) { ?>
|
<?php if($type->id === $value->type ) { ?>
|
||||||
<tr class="even pointer">
|
<tr class="even pointer">
|
||||||
<td hidden><?php echo $value->id; ?></td>
|
<td hidden><?php echo $value->id; ?></td>
|
||||||
<td class=" "><?php echo $value->created_date; ?><br><?php echo $value->created_time; ?>
|
<td class=" "><?php echo dateFormat('d-m-Y',$value->created_date_new); ?><br><?php echo $value->created_time; ?>
|
||||||
</td>
|
</td>
|
||||||
<td class=" "><?php echo $value->emp_name; ?></td>
|
<td class=" "><?php echo $value->emp_name; ?></td>
|
||||||
<td class=" "><?php echo $value->comments; ?></td>
|
<td class=" "><?php echo $value->comments; ?></td>
|
||||||
<?php if($value->from_date == "" && $value->to_date == "") { ?>
|
<?php if($value->from_date_new == "" && $value->to_date_new == "") { ?>
|
||||||
<td class="">
|
<td class="">
|
||||||
<?php echo dateFormat('d-m-Y',$value->perm_date);?><br>
|
<?php echo dateFormat('d-m-Y',$value->perm_date_new);?><br>
|
||||||
<?php echo timeFormat('h:i a', $value->from_time); ?> to
|
<?php echo timeFormat('h:i a', $value->from_time); ?> to
|
||||||
<?php echo timeFormat('h:i a', $value->to_time);?>
|
<?php echo timeFormat('h:i a', $value->to_time);?>
|
||||||
</td>
|
</td>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
|
|
||||||
<td class=" "> <?php echo dateFormat('d-m-Y',$value->from_date); echo ' to ';?>
|
<td class=" "> <?php echo dateFormat('d-m-Y',$value->from_date_new); echo ' to ';?>
|
||||||
<?php echo dateFormat('d-m-Y',$value->to_date);?> </td>
|
<?php echo dateFormat('d-m-Y',$value->to_date_new);?> </td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<td class=" "><?php echo $type->type; ?></td>
|
<td class=" "><?php echo $type->type; ?></td>
|
||||||
|
|||||||
127
application/modules/Leave/views/leave_list_report.php
Normal file
127
application/modules/Leave/views/leave_list_report.php
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
<head>
|
||||||
|
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css'>
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
|
<script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
|
||||||
|
<script src="https://cdn.datatables.net/1.11.5/js/dataTables.bootstrap4.min.js"></script>
|
||||||
|
<link rel="stylesheet" href="https://cdn.datatables.net/1.11.5/css/dataTables.bootstrap4.min.css">
|
||||||
|
</head>
|
||||||
|
<div class="col-md-12 col-sm-12">
|
||||||
|
<div class="x_panel">
|
||||||
|
<div class="x_title">
|
||||||
|
<h1>Leave Report</h1>
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
</div>
|
||||||
|
<div class="x_content">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12" style="overflow: auto;">
|
||||||
|
<table id="datatables" class="table table-striped table-bordered" width="100%">
|
||||||
|
<thead>
|
||||||
|
<tr class="headings">
|
||||||
|
<th hidden class="column-title">id</th>
|
||||||
|
<th class="column-title">Employee Id</th>
|
||||||
|
<th class="column-title">Employee Name </th>
|
||||||
|
<th class="column-title">Start - End (Date)</th>
|
||||||
|
<th class="column-title">Leave Count </th>
|
||||||
|
<th class="column-title">Leave Type</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($leave_list as $key => $value) { ?>
|
||||||
|
<tr>
|
||||||
|
<td hidden><?php echo $value->id; ?></td>
|
||||||
|
<td><?php echo $value->emp_id; ?></td>
|
||||||
|
<td><?php echo $value->emp_name; ?></td>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
if($value->leavetype == 'Permission')
|
||||||
|
{
|
||||||
|
echo dateFormat('d-m-Y',$value->perm_date_new).' - '.timeFormat('h:i a', $value->from_time). ' to ' .timeFormat('h:i a', $value->to_time);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo $value->from_date_new;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $value->no_of_days; ?></td>
|
||||||
|
<td><?php echo $value->leavetype; ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
var table = $('#datatables').DataTable({
|
||||||
|
"order": [
|
||||||
|
[0, 'desc']
|
||||||
|
],
|
||||||
|
"dom": 'Bfrtip',
|
||||||
|
buttons: [{
|
||||||
|
extend: 'pdfHtml5',
|
||||||
|
title: 'Leave',
|
||||||
|
text: 'PDF',
|
||||||
|
customize: function(doc) {
|
||||||
|
doc.content[1].table.body.forEach(function(row) {
|
||||||
|
// Remove the first and last columns
|
||||||
|
row.splice(0, 1);
|
||||||
|
row.pop();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extend: 'excelHtml5',
|
||||||
|
text: 'Excel',
|
||||||
|
title: 'Leave',
|
||||||
|
exportOptions: {
|
||||||
|
columns: ':not(:last-child)'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"searching": true
|
||||||
|
});
|
||||||
|
|
||||||
|
var currentDate = new Date();
|
||||||
|
var currentYear = currentDate.getFullYear();
|
||||||
|
var currentMonth = currentDate.getMonth() + 1; // Note: January is 0
|
||||||
|
var dateList = [];
|
||||||
|
var dateListView = [];
|
||||||
|
|
||||||
|
var monthNames = ["January", "February", "March", "April", "May", "June",
|
||||||
|
"July", "August", "September", "October", "November", "December"
|
||||||
|
];
|
||||||
|
|
||||||
|
// Generate the past months of the current year
|
||||||
|
for (var month = currentMonth; month > 0; month--) {
|
||||||
|
dateList.push(currentYear + '-' + (month < 10 ? '0' + month : month));
|
||||||
|
dateListView.push(monthNames[month - 1] + ' ' + currentYear);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append the current month
|
||||||
|
dateList.push((currentMonth < 10 ? '0' + currentMonth : currentMonth)+ '-' +currentYear );
|
||||||
|
dateListView.push(monthNames[currentMonth - 1] + ' ' + currentYear);
|
||||||
|
|
||||||
|
// Create dropdown list
|
||||||
|
var select = $('<select class="form-control form-control-sm" style="width: 20%;"><option value="">All</option></select>')
|
||||||
|
.appendTo($('#datatables_wrapper .dataTables_filter'))
|
||||||
|
.on('change', function() {
|
||||||
|
table.column(3).search($(this).val()).draw();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Populate dropdown list options
|
||||||
|
$.each(dateList, function(index, value) {
|
||||||
|
if(index != 0)
|
||||||
|
select.append('<option value="' + value + '">' + dateListView[index] + '</option>');
|
||||||
|
});
|
||||||
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@ -83,17 +83,17 @@
|
|||||||
|
|
||||||
<tr class="even pointer">
|
<tr class="even pointer">
|
||||||
<td hidden class=" "><?php echo $value->id; ?></td>
|
<td hidden class=" "><?php echo $value->id; ?></td>
|
||||||
<td class=" "><?php echo $value->created_date; ?><br><?php echo $value->created_time; ?></td>
|
<td class=" "><?php echo dateFormat('d-m-Y',$value->created_date_new); ?><br><?php echo $value->created_time; ?></td>
|
||||||
<td class=" "><?php echo $type->type; ?></td>
|
<td class=" "><?php echo $type->type; ?></td>
|
||||||
<?php if($value->from_date == "" && $value->to_date == "") { ?>
|
<?php if($value->from_date_new == "" && $value->to_date_new == "") { ?>
|
||||||
<td class="">
|
<td class="">
|
||||||
<?php echo dateFormat('d-m-Y',$value->perm_date);?><br>
|
<?php echo dateFormat('d-m-Y',$value->perm_date_new);?><br>
|
||||||
<?php echo timeFormat('h:i a', $value->from_time); ?> to
|
<?php echo timeFormat('h:i a', $value->from_time); ?> to
|
||||||
<?php echo timeFormat('h:i a', $value->to_time);; ?>
|
<?php echo timeFormat('h:i a', $value->to_time);; ?>
|
||||||
</td>
|
</td>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
|
|
||||||
<td class=" "> <?php echo dateFormat('d-m-Y',$value->from_date); echo ' to ';?> <?php echo dateFormat('d-m-Y',$value->to_date);?> </td>
|
<td class=" "> <?php echo dateFormat('d-m-Y',$value->from_date_new); echo ' to ';?> <?php echo dateFormat('d-m-Y',$value->to_date_new);?> </td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if($value->no_of_days == 0){ ?>
|
<?php if($value->no_of_days == 0){ ?>
|
||||||
<td class=" ">---</td>
|
<td class=" ">---</td>
|
||||||
|
|||||||
@ -35,12 +35,16 @@ public function __construct()
|
|||||||
### The second parameter (optional) is used to call the method.
|
### The second parameter (optional) is used to call the method.
|
||||||
$this->load->model('MY_Model','MY_Model');
|
$this->load->model('MY_Model','MY_Model');
|
||||||
$this->load->model('Notification_model','Notification_model');
|
$this->load->model('Notification_model','Notification_model');
|
||||||
|
$this->load->helper('mail_helper');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Function for Mail Send
|
// Function for Mail Send
|
||||||
public function prepareNotificationData($body,$templateData,$Data,$type,$code){
|
public function prepareNotificationData($body,$templateData,$Data,$type,$code){
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// echo 1;die;
|
||||||
$getBusinessData = $this->Notification_model->get_admin_and_hr_mail_id(user()->business_id);
|
$getBusinessData = $this->Notification_model->get_admin_and_hr_mail_id(user()->business_id);
|
||||||
$managerID = $Data->ManagerId;
|
$managerID = $Data->ManagerId;
|
||||||
$managerMail = $this->Notification_model->get_user_data($managerID);
|
$managerMail = $this->Notification_model->get_user_data($managerID);
|
||||||
@ -103,7 +107,9 @@ public function prepareNotificationData($body,$templateData,$Data,$type,$code){
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo "An error occurred: " . $e->getMessage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prepareNotificationDataForDelegation($body,$templateData,$Data,$type,$code){
|
public function prepareNotificationDataForDelegation($body,$templateData,$Data,$type,$code){
|
||||||
@ -184,7 +190,7 @@ public function prepareNotificationDataForExpence($body,$templateData,$Data,$typ
|
|||||||
|
|
||||||
//Send Mail For Apply Leave and apply Permission also Approve and Decline
|
//Send Mail For Apply Leave and apply Permission also Approve and Decline
|
||||||
public function sendNotification($leave_id, $code, $type){
|
public function sendNotification($leave_id, $code, $type){
|
||||||
|
try {
|
||||||
$leaveData = collectLeaveData($leave_id);
|
$leaveData = collectLeaveData($leave_id);
|
||||||
$templateData = getTempleteData($code, $type);
|
$templateData = getTempleteData($code, $type);
|
||||||
if($code === 'APPLY_LEAVE' || $code === 'LEAVE_PERMISSION'){
|
if($code === 'APPLY_LEAVE' || $code === 'LEAVE_PERMISSION'){
|
||||||
@ -198,7 +204,9 @@ public function sendNotification($leave_id, $code, $type){
|
|||||||
$FormettedTemplateData = $this->preprocessTemplateDataForLeaveDecline($leaveData,$templateData);
|
$FormettedTemplateData = $this->preprocessTemplateDataForLeaveDecline($leaveData,$templateData);
|
||||||
}
|
}
|
||||||
return $this->prepareNotificationData($FormettedTemplateData,$templateData,$leaveData,$type, $code);
|
return $this->prepareNotificationData($FormettedTemplateData,$templateData,$leaveData,$type, $code);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo "An error occurred: " . $e->getMessage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -98,8 +98,8 @@
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'testing':
|
case 'testing':
|
||||||
ini_set('display_errors', 1);
|
// ini_set('display_errors', 1);
|
||||||
//error_reporting(-1);
|
// error_reporting(-1);
|
||||||
// if (version_compare(PHP_VERSION, '5.3', '>=')) {
|
// if (version_compare(PHP_VERSION, '5.3', '>=')) {
|
||||||
// error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
|
// error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
|
||||||
// } else {
|
// } else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user