Compare commits

..

10 Commits

28 changed files with 412 additions and 364 deletions

View File

@ -58,7 +58,8 @@
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array('session','database','email');
$autoload['libraries'] = array('session','database','email','security');
/*
| -------------------------------------------------------------------
@ -131,4 +132,7 @@
|
| $autoload['model'] = array('first_model' => 'first');
*/
$autoload['model'] = array('auth/auth_model');
$autoload['model'] = array('auth/auth_model');
// $autoload['model'] = array('Auth/Auth_model');
// $autoload['model'] = array('auth_model' => 'auth/auth_model');
// $autoload['model'] = array('auth_model' => 'Auth/Auth_model');

View File

@ -58,7 +58,7 @@
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array('session','database','email');
$autoload['libraries'] = array('session','database','email','security');
/*
| -------------------------------------------------------------------

View File

@ -23,7 +23,7 @@
| a PHP script and you can easily do that on your own.
|
*/
$base = "http://".$_SERVER['HTTP_HOST'];
$base = "https://".$_SERVER['HTTP_HOST'];
$base .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
$config['base_url'] = $base;

View File

@ -71,37 +71,14 @@
| the query builder class.
*/
$active_group = 'default';
$active_group = 'testingDB';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => '',
'password' => '',
'database' => '',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
$db['testingDB'] = array(
'dsn' => '',
'hostname' => '119.18.54.85',
'username' => 'venbaehn_ams',
'password' => 'L;nD7Z@f)1ZT',
'database' => 'venbaehn_ams',
'username' => 'venbaehn_venba_ams_live_usr1',
'password' => '7+IRJp7VVG6$',
'database' => 'venbaehn_venba_ams_live',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,

View File

@ -58,7 +58,8 @@
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array('session','database','email');
$autoload['libraries'] = array('session','database','email','security');
/*
| -------------------------------------------------------------------

View File

@ -224,7 +224,7 @@
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 0;
$config['log_threshold'] = 4;
/*
|--------------------------------------------------------------------------

View File

@ -77,13 +77,12 @@ function send_emails($to, $subject, $body, $aliasName = '', $cc = null, $bcc = n
if (!function_exists('send_emails_forgot_password')) {
function send_emails_forgot_password($to, $subject, $body, $aliasName = '', $cc = null, $bcc = null, $receipt = null)
function send_emails_forgot_password($to, $subject, $body, $mailCredentials = null, $aliasName = '', $cc = null, $bcc = null, $receipt = null)
{
log_message('error', 'send_mail_helper_loadded');
log_message('error', 'Receiptent mail - ' . $to . ' - subject - ' . $subject . ' - body - ' . $body);
log_message('error', 'Sender mail ' . business()->sender_mail);
log_message('error', 'Sender mail ' . $mailCredentials->sender_mail);
try {
$mailer = new PHPMailer(true);
@ -91,14 +90,14 @@ function send_emails_forgot_password($to, $subject, $body, $aliasName = '', $cc
$mailer->isSMTP();
$mailer->CharSet = 'utf-8';
$mailer->Host = business()->mail_hostname;
$mailer->SMTPSecure = business()->mail_security;
$mailer->Host = $mailCredentials->mail_hostname;
$mailer->SMTPSecure = $mailCredentials->mail_security;
$mailer->SMTPAuth = true;
$mailer->SMTPDebug = false;
$mailer->Username = business()->mail_username;
$mailer->Password = business()->mail_password;
$mailer->Port = business()->mail_port_no;
$mailer->setFrom(business()->sender_mail, $aliasName);
$mailer->Username = $mailCredentials->mail_username;
$mailer->Password = $mailCredentials->mail_password;
$mailer->Port = $mailCredentials->mail_port_no;
$mailer->setFrom($mailCredentials->sender_mail, $aliasName);
$mailer->addAddress($to);
// Add CC recipients

View File

@ -150,13 +150,15 @@ public function sendOTP(){
$otp = $this->input->get('otp');
$where = 'email';
$user = $this->auth_model->validateUserForOtp($mail, $where);
$mailCredentials = $this->auth_model->validateBusiness($user->business_id);
$id = $user->id;
$data['csrf_hash'] = $this->security->get_csrf_hash();
$data['id'] = $id;
$data['email'] = $mail;
$body =`
$body = <<<EOD
<body style="font-family: Arial, sans-serif;">
<div style="max-width: 600px; margin: 0 auto; padding: 20px; border: 1px solid #ccc; border-radius: 5px;">
@ -164,27 +166,27 @@ public function sendOTP(){
<p>Hello,</p>
<p>Your One-Time Password (OTP) for verification is:</p>
<div style="text-align: center; background-color: #f5f5f5; padding: 10px; border-radius: 5px; font-size: 24px; margin-top: 15px;">
<strong>`. $otp .`</strong>
<strong>$otp</strong>
</div>
<p>This OTP is valid for a short period. Please do not share it with anyone.</p>
<p>If you did not request this OTP, please ignore this email.</p>
<p>Thank you!</p>
<hr style="border: 1px solid #ccc; margin-top: 20px; margin-bottom: 20px;">
<p style="text-align: center; color: #777;">&copy; 2023 </p>
<p style="text-align: center; color: #777;">&copy; 2023 $mailCredentials->business_name </p>
</div>
</body>`;
</body>
EOD;
$subject = 'Forgot Password OTP Send';
$result = send_emails_forgot_password($mail, $subject, $body);
$result = send_emails_forgot_password($mail, $subject, $body,$mailCredentials);
if($result){
$data['csrf_hash'] = $this->security->get_csrf_hash();
$data['status'] = "success";
$data['id'] = $id;
$data['email'] = $mail;
$data['result'] = $result;
echo json_encode($data);
}else{

View File

@ -60,7 +60,7 @@
<section class="login_content">
<form id="otp-form" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url();?>Auth/verify_otp" enctype="multipart/form-data">
<input type="hidden" name="csrf_test_name" value="<?php echo $this->security->get_csrf_hash();?>">
<input type="hidden" name="ci_csrf_token" value="<?php echo $this->security->get_csrf_hash();?>">
<input type="hidden" id="hidden_otp" name="hidden_otp" class="form-control" value="" />
<input type="hidden" id="id" name="id" value="">
<input type="hidden" id="email1" name="email" value="">
@ -149,7 +149,7 @@ function send_otp() {
json: true,
success: function(response) {
response = jQuery.parseJSON(response)
alert(response);
// alert(response);
if (response.status == "failed") {
new PNotify({
title: 'OTP Send Failed',
@ -196,12 +196,12 @@ function send_otp() {
$(document).ready(function() {
var id = `<?php echo $id; ?>`;
var val = `<?php echo $id; ?>`;
var email = `<?php echo $email; ?>`;
var status = `<?php echo $status; ?>`;
var csrf_hash = `<?php echo $csrf_hash; ?>`;
var id = `<?php echo isset($id) ? $id : ''; ?>`;
var val = `<?php echo isset($id) ? $id : ''; ?>`;
var email = `<?php echo isset($email) ? $email : ''; ?>`;
var status = `<?php echo isset($status) ? $status : ''; ?>`;
var csrf_hash = `<?php echo isset($csrf_hash) ? $csrf_hash : ''; ?>`;
if (status === "failed") {
$('#id').val(id);
@ -212,7 +212,7 @@ function send_otp() {
$('#otp_span_msg').html('Pls enter correct OTP').css('color', 'red');
$('#sendotpbtn').html('Resend OTP');
} else if (response.status === "success") {
} else if (status === "success") {
$('input[name=csrf_test_name]').val(csrf_hash);
$('#id').val(id);

View File

@ -68,85 +68,72 @@ public function get_emp_name()
public function rise_expence_request()
{
$data = $this->input->post('emp_id');
if(!empty($data)){
$emp_id =$this->input->post('emp_id');
}else{
$emp_id = user()->id;
}
// echo $emp_id;die;
$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){
## Logged In Variables
$logged_in_user = user()->id;
$logged_in_business = user()->business_id;
## Form Requested Data
$requested_data = $this->input->post();
//Employee id
$employee_id = (isset($requested_data['emp_id']) && !empty($requested_data['emp_id'])) ? $requested_data['emp_id'] : $logged_in_user;
$manager = 0;
}else{
//Manager id
$get_manager_details = $this->Expence_model->get_manager_id($employee_id);
$manager_id = ((!empty($get_manager_details)) && $get_manager_details[0]->manager != null) ? $get_manager_details[0]->manager : 0;
$manager = $get_manager_id[0]->manager;
}
$data1 = array(
'created_by'=>user()->id,
'requested_for'=>$emp_id ,
'expense_name'=>$this->input->post('expense_name'),
'business_reason'=>$this->input->post('business_reason'),
'manager_id' => $manager,
'business_id' => user()->business_id,
// Table Name Declarations
$expense_master_table = "expense";
$expense_child_table = "expense_child";
// Array formation for updating the master details
$expense_master_arr = array(
'created_by'=>$logged_in_user,
'requested_for'=>$employee_id,
'expense_name'=>$requested_data['expense_name'],
'business_reason'=>$requested_data['business_reason'],
'manager_id' => $manager_id,
'business_id' => $logged_in_business,
'status'=>'Draft',
);
$table="expense";
$create_Expence = $this->MY_Model->insert($data1,$table);
// $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++)
{
$data2 = array(
'expense_id' => $create_Expence,
'emp_id'=>$emp_id ,
'business_id' => user()->business_id,
'manager_id' => $manager,
## Retrive the Inserted ID from Master Table
$create_expence = $this->MY_Model->insert($expense_master_arr,$expense_master_table);
$first = $requested_data['date_of_expence_new'];
## Get the Count for Child Expence
$count = (gettype($first) == 'array') ? count($first) : 0;
if ($count > 0) {
for ($i = 0; $i < $count; $i++) {
##Preparing Array Stored in Expence child Table
$expense_child_arr = array(
'expense_id' => $create_expence,
'emp_id'=>$employee_id ,
'business_id' => $logged_in_business,
'manager_id' => $manager_id,
'status' => 'Draft',
// 'date_of_expense'=> $this->input->post('date_of_expence')[$i],
'date_of_expense'=> $this->input->post('date_of_expence_new')[$i],
'date_of_expense_new' => date('Y-m-d', strtotime($this->input->post('date_of_expence_new')[$i])),
'amount' => $this->input->post('amount')[$i],
'description' => $this->input->post('description')[$i],
);
// print_r($data2);die;
$this->load->library('upload');
$config['upload_path'] = APPPATH. '../assets/uploads/Expence_Bill/';
$config['allowed_types'] = 'jpg|png|jpeg|pdf';
$config['max_size'] = 80000;
$config['file_name'] = time(). '_' . $_FILES['bill']['name'][$i];
$_FILES['userfile']['name'] = $_FILES['bill']['name'][$i];
$_FILES['userfile']['type'] = $_FILES['bill']['type'][$i];
$_FILES['userfile']['tmp_name'] = $_FILES['bill']['tmp_name'][$i];
$_FILES['userfile']['error'] = $_FILES['bill']['error'][$i];
$_FILES['userfile']['size'] = $_FILES['bill']['size'][$i];
$this->upload->initialize($config);
if ($this->upload->do_upload('userfile'))
{
$upload_image = $this->upload->data();
$data2['bill'] = $upload_image['file_name'];
}
else
{
$error = $this->upload->display_errors();
}
$table="expense_child";
$create_expence_list = $this->MY_Model->insert($data2,$table);
}
);
if (!empty($_FILES['bill']['name'][$i])) {
$upload_result = $this->upload_file($_FILES['bill'], $i);
if ($upload_result['success']) {
$expense_child_arr['bill'] = $upload_result['file_name'];
} else {
log_message('error', $upload_result['error']);
}
}
$create_expence_child = $this->MY_Model->insert($expense_child_arr, $expense_child_table);
}
}
$this->session->set_flashdata('Create', '1');
redirect('Expence/Emp_Expence_List');
}
}
public function edit_expence($id)
@ -162,15 +149,22 @@ public function edit_expence($id)
public function edit_rise_expence_request()
{
// Expense primary key
$id = $this->input->post('expense_pid');
## Logged In Variables
$logged_in_user = user()->id;
$logged_in_business = user()->business_id;
## Form Requested Data
$requested_data = $this->input->post();
## Expense primary key
$id = $requested_data['expense_pid'];
// Employee id
$emp_id = (!empty($this->input->post('emp_id'))) ? $this->input->post('emp_id') : user()->id;
$employee_id = (isset($requested_data['emp_id']) && !empty($requested_data['emp_id'])) ? $requested_data['emp_id'] : $logged_in_user;
// Manager id
$manager = $this->Expence_model->get_manager_id($emp_id);
$manager_id = (!empty($manager)) ? $manager[0]->manager : 0;
$get_manager_details = $this->Expence_model->get_manager_id($employee_id);
$manager_id = ((!empty($get_manager_details)) && $get_manager_details[0]->manager != null) ? $get_manager_details[0]->manager : 0;
// Table Name Declarations
$expense_master_table = "expense";
@ -178,25 +172,26 @@ public function edit_rise_expence_request()
// Array formation for updating the master details
$expense_master_arr = array(
'created_by' => user()->id,
'requested_for' => $emp_id,
'expense_name' => $this->input->post('expense_name'),
'business_reason' => $this->input->post('business_reason'),
'created_by' => $logged_in_user,
'requested_for' => $employee_id,
'expense_name' => $requested_data['expense_name'],
'business_reason' => $requested_data['business_reason'],
'manager_id' => $manager_id,
'business_id' => user()->business_id,
'business_id' => $logged_in_business,
'status' => 'Draft',
);
// Update process for master
$update_expense = $this->MY_Model->edit_option($expense_master_arr, $id, $expense_master_table);
log_message('info', "update_expense_master - expense_id => ".$id." is updated == ".$update_expense);
$first = $this->input->post('date_of_expence_new');
$first = $requested_data['date_of_expence_new'];
$count = (gettype($first) == 'array') ? count($first) : 0;
if ($count > 0) {
for ($i = 0; $i < $count; $i++) {
$expense_child_id = $this->input->post('expense_child_id')[$i];
$first_child = array(
'date_of_expense' => $this->input->post('date_of_expence_new')[$i],
'date_of_expense_new' => date('Y-m-d', strtotime($this->input->post('date_of_expence_new')[$i])),
'amount' => $this->input->post('amount')[$i],
'description' => $this->input->post('description')[$i],
);
@ -207,22 +202,24 @@ public function edit_rise_expence_request()
}
// Details gathering from JavaScript new entries
$second = $this->input->post('date_of_expence2');
$second = $this->input->post('date_of_expence_new2');
$additional_count = (gettype($second) == 'array') ? count($second) : 0;
if ($additional_count > 0) {
for ($j = 0; $j < $additional_count; $j++) {
$second_child = array(
'expense_id' => $id,
'emp_id' => $emp_id,
'emp_id' => $employee_id,
'business_id' => user()->business_id,
'manager_id' => $manager_id,
'status' => 'Draft',
'date_of_expense' => $this->input->post('date_of_expence2')[$j],
'date_of_expense' => date('d-m-Y', strtotime($this->input->post('date_of_expence_new2')[$j])),
'date_of_expense_new' => date('Y-m-d', strtotime($this->input->post('date_of_expence_new2')[$j])),
'amount' => $this->input->post('amount2')[$j],
'description' => $this->input->post('description2')[$j],
);
if (!empty($_FILES['bill2']['name'][$j])) {
$upload_result = $this->upload_file($_FILES['bill2'], $j);
if ($upload_result['success']) {
$second_child['bill'] = $upload_result['file_name'];
} else {
@ -237,11 +234,13 @@ public function edit_rise_expence_request()
redirect('Expence/Emp_Expence_List');
}
private function upload_file($file_data, $index)
public function upload_file($file_data, $index)
{
$this->load->library('upload');
$config['upload_path'] = APPPATH . '../assets/uploads/Expense_Bill/';
$upload_path = APPPATH . '../assets/uploads/Expense_Bill/';
$config['upload_path'] = realpath($upload_path);
$config['allowed_types'] = 'jpg|png|jpeg|pdf';
$config['max_size'] = 80000;
$config['file_name'] = time() . '_' . $file_data['name'][$index];
@ -320,7 +319,8 @@ public function Emp_Expence_List_view($id)
public function getDeleteConfirmationPopup()
{
$data = array();
$title = $this->input->get('title');
$data['title'] = $title ? $title : "Are you sure to Approve this Action";
$htmlPage = $this->load->view('confirmation_popup.php',$data,true);
echo json_encode($htmlPage);
}
@ -344,6 +344,24 @@ public function Approve_Expence()
redirect('Expence/expence_list');
}
public function Reimbursed_Expence()
{
$id=$this->input->post('id');
$action['status'] = 'Reimbursed';
$action['reimbursed_by']= user()->name;
$action['reimbursed_at'] = date('Y-m-d h:i:s');
$table = "expense";
$expence_id = $this->MY_Model->edit_option($action, $id, $table);
$this->Expence_model->approve_child_expense($action, $id);
if($expence_id){
$code = 'REIMBURSED_EXPENCE';
$type = 'Email';
$this->notification->sendNotificationForExpense($id, $code, $type);
}
$this->session->set_flashdata('Create', '3');
redirect('Expence/expence_list');
}
public function Approve_Child_Expence()
{
if($this->input->post('declinedata'))
@ -468,7 +486,8 @@ public function Decline_expence()
public function getCancelConfirmationPopup()
{
$data = array();
$title = $this->input->get('title');
$data['title'] = $title ? $title : "Are you sure to Approve this Action";
$htmlPage = $this->load->view('confirmation_popup.php',$data,true);
echo json_encode($htmlPage);
}

View File

@ -30,6 +30,7 @@ public function get_expence_list($business_id)
$this->db->or_where('A.status', 'Approved');
$this->db->or_where('A.status', 'Declined');
$this->db->or_where('A.status', 'Partially approved');
$this->db->or_where('A.status', 'Reimbursed');
$this->db->order_by('A.id', 'DESC');
$query = $this->db->get();
$query = $query->result();

View File

@ -2,7 +2,7 @@
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="myModalLabel2">Are you sure to Approve this Action</h6>
<h6 class="modal-title" id="myModalLabel2"><?php echo (isset($title) && $title!= "") ? $title : "Are you sure to Approve this Action"; ?></h6>
<!-- <button type="button" id="close-form" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span> -->
</button>
</div>

View File

@ -134,10 +134,10 @@
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name">Expense Name<a style="color:red;">*</a></label>
<label class="control-label col-md-1 col-sm-1 " for="expense_name">Expense Name<a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<div class="form-group">
<input type='text' class="form-control" name="expense_name" value="<?php if (isset($expense_data[0]->id)) {
<input type='text' class="form-control" id="expense_name" name="expense_name" value="<?php if (isset($expense_data[0]->id)) {
echo $expense_data[0]->expense_name;
} ?>" autocomplete='off' required />
@ -145,10 +145,10 @@
</div>
<label class="control-label col-md-1 col-sm-1 " for="first-name">Business Reason</label>
<label class="control-label col-md-1 col-sm-1 " for="business_reason">Business Reason</label>
<div class="col-md-5 col-sm-5 ">
<div class="form-group">
<input type='text' class="form-control" name="business_reason" value="<?php if (isset($expense_data[0]->id)) {
<input type='text' class="form-control" id="business_reason" name="business_reason" value="<?php if (isset($expense_data[0]->id)) {
echo $expense_data[0]->business_reason;
} ?>" autocomplete='off' />
@ -174,23 +174,18 @@
foreach ($expense_child_data as $key => $value) { ?>
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name">Status</label>
<label class="control-label col-md-1 col-sm-1 " for="temporary_status">Status</label>
<div class="col-md-5 col-sm-5">
<input id="cost" class="form-control" readonly name="middle-name" autocomplete='off' value="
<?php if ($value->status == "Approved") {
echo $value->status . ' By ' . $value->approved_by . ' - ' . date('d-m-Y h:i:s', strtotime($value->approved_at));
} else if ($value->status == "Declined") {
echo $value->status . ' By ' . $value->decline_by . ' ( ' . $value->decline_reason . ' )';
} else if ($value->status == "Cancelled") {
echo $value->status . ' at ' . date('d-m-Y h:i:s', strtotime($value->cancelled_at));
} else {
echo $value->status;
}
?>
">
<input id="temporary_status" class="form-control" readonly name="temporary_status" autocomplete='off'
value="<?php if ($value->status == "Approved") {
echo $value->status . ' By ' . $value->approved_by . ' - ' . date('d-m-Y h:i:s', strtotime($value->approved_at));
} else if ($value->status == "Declined") {
echo $value->status . ' By ' . $value->decline_by . ' ( ' . $value->decline_reason . ' )';
} else if ($value->status == "Cancelled") {
echo $value->status . ' at ' . date('d-m-Y h:i:s', strtotime($value->cancelled_at));
} else {
echo trim($value->status);
} ?>">
</div>
</div>
@ -210,7 +205,7 @@
</div>
</div>
<label class="control-label col-md-1 col-sm-1 " for="first-name">Amount<a style="color:red;">*</a></label>
<label class="control-label col-md-1 col-sm-1 " for="cost">Amount<a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5">
<input id="cost" name="amount[]" required value="<?php echo $value->amount ?>" class="form-control" onkeypress="return matchnum(event)" type="number" name="middle-name" autocomplete='off'>
</div>
@ -225,11 +220,19 @@
</div>
<label class="control-label col-md-1 col-sm-1" required for="first-name">Recipt</label>
<label class="control-label col-md-1 col-sm-1" required for="formFile">Recipt</label>
<div class="col-md-5 col-sm-5 ">
<input id="formFile" name="bill[]" onchange="validateFile(this)" class="typeFile" type="file" value="<?php echo $value->bill ?>" multiple><br>
<a href="<?php echo base_url(); ?>assets/uploads/Expence_Bill/<?php echo $value->bill; ?>" target="_blank" class="float-right" style="font-size: x-small; color: darkblue; margin-top: 7px;"><b>View Recipt(<?php echo $value->bill; ?>)</b></a>
<!-- <a href="<?php echo base_url(); ?>assets/uploads/Expence_Bill/<?php echo $value->bill; ?>" target="_blank" class="float-right" style="font-size: x-small; color: darkblue; margin-top: 7px;"><b>View Recipt(<?php echo $value->bill; ?>)</b></a> -->
<?php $bill = "";
if ($value->bill !== '' || $value->bill !== null) {
$billPath = base_url() . 'assets/uploads/Expence_Bill/' . $value->bill;
$billContents = @file_get_contents($billPath);
$bill = ($billContents !== false) ? $billPath : "";
}
if (!$bill) { ?>
<a href="<?php echo $bill; ?>" target="_blank" class="float-right" style="font-size: x-small; color: darkblue; margin-top: 7px;"><b>View Recipt(<?php echo $bill; ?>)</b></a>
<?php } ?>
</div>
<?php if ($expense_data[0]->status == 'Draft') { ?>
@ -440,8 +443,8 @@ function createAndAppendFormGroup() {
html1 += '<br><div class="x_title"></div><br>'
html1 += '<div class="item form-group">';
html1 += '<label class="control-label col-md-1 col-sm-1 " 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="date" id="datepicker' + i + '" class="form-control dates" placeholder="DD-MM-YYYY" required name="date_of_expence2[]" value="" autocomplete="off"/><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 " for="first-name"> Expense Cost <a style="color:red;">*</a></label>';
html1 += '<div class="col-md-5 col-sm-5 "><div class="form-group"><input type="date" id="datepicker' + i + '" class="form-control dates" placeholder="DD-MM-YYYY" required name="date_of_expence_new2[]" value="" autocomplete="off"/><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 " for="cost"> Amount <a style="color:red;">*</a></label>';
html1 += '<div class="col-md-5 col-sm-5 "><input id="cost" name="amount2[]" required class="form-control" onkeypress="return matchnum(event)" type="number" name="middle-name" autocomplete="off"></div>';
html1 += '</div>';
@ -450,7 +453,7 @@ function createAndAppendFormGroup() {
html1 += '<label class="control-label col-md-1 col-sm-1" for="last-name">Description</label>'
html1 += '<div class="col-md-5 col-sm-3"><textarea id="comments" name="description2[]" value="" class="form-control" style="height:50px !important;" type="text" ></textarea></div>'
html1 += '<label class="control-label col-md-1 col-sm-1" required for="first-name">Receipt </label>'
html1 += '<label class="control-label col-md-1 col-sm-1" required for="formFile">Receipt </label>'
html1 += '<div class="col-md-5 col-sm-5 "><input id="formFile" name="bill2[]" multiple onchange="validateFile(this)" class="typeFile" type="file" value="" ></div>'
html1 += '</div>'
html1 += '<div class="col-12"><button type="button" class="float-right btn btn-danger"" id="remove-button" onclick="removebutton(' + i + ')"><i class="fa fa-trash"></i></button></div><button type="button" id="add-button" onclick="createAndAppendFormGroup()" class="btn btn-primary float-right">Add</button></div></br>'

View File

@ -132,22 +132,19 @@
<td style="color:#e68a00"><?php echo $value->status; ?></td>
<?php }
else if($value->status == 'Approved'){ ?>
<td style="color:green"><?php echo $value->status; ?> By <?php echo $value->approved_by; ?><br><?php echo date('d-m-Y h:i:s', strtotime($value->approved_at));?></td>
<td style="color:green"><?php echo $value->status; ?> By <?php echo $value->approved_by; ?><br><?php echo my_date_show_time($value->approved_at);?></td>
<?php }
else if($value->status == 'Declined'){ ?>
<td style="color:red"><?php echo $value->status; ?> by <?php echo $value->decline_by; ?> <br><?php echo $value->decline_reason; ?></td>
<?php }
else if($value->status == 'Cancelled'){ ?>
<td style="color:darkcyan;"><?php echo $value->status; ?> at <br><?php echo date('d-m-Y h:i:s', strtotime($value->cancelled_at));?></td>
<td style="color:darkcyan;"><?php echo $value->status; ?> at <br><?php echo my_date_show_time($value->cancelled_at); ?></td>
<?php }
else if($value->status == 'Draft'){?>
<td style="color:#0000e6;"><?php echo $value->status; ?></td>
<?php } else if($value->status == 'Partially approved'){?>
<td style="color:#0000e6;"><?php echo $value->status; ?></td>
<?php }
else if($value->status == 'Reimbursed'){?>
<td style="color:#00FF00;"><?php echo $value->status; ?> at <br><?php echo my_date_show_time($value->reimbursed_at); ?></td>
<?php } ?>
<td style=" text-align: center; font-size: 16px;">
@ -166,9 +163,9 @@
<a href="<?php echo base_url()?>Expence/edit_expence/<?php echo md5($value->id);?> "><i class="fa fa-edit" aria-hidden="true"title="Edit"></i></a> &nbsp;
<a href="#"><i class="fa fa-ban cancelexpense" aria-hidden="true"title="Cancel" data-toggle="modal" data-target=".bs-example-modal-sm" id="<?php echo md5($value->id);?>"></i></a> &nbsp;
<a href="#"><i class="fa fa-ban cancelexpense" aria-hidden="true" title="Cancel" data-toggle="modal" data-target=".bs-example-modal-sm" id="<?php echo md5($value->id);?>"></i></a> &nbsp;
<a href="#"><i class="fa fa-check Submitexpense" aria-hidden="true"title="Submit" data-toggle="modal" data-target=".bs-example-modal-sm" id="<?php echo $value->id;?>"></i></a> &nbsp;
<a href="#"><i class="fa fa-check Submitexpense" aria-hidden="true" title="Submit/Posted" data-toggle="modal" data-target=".bs-example-modal-sm" id="<?php echo $value->id;?>"></i></a> &nbsp;
<!-- <a href="<?php echo base_url()?>Expence/submit/<?php echo $value->id;?>" onclick="return confirm('Are sure to Submit this Expence')"><i class="fa fa-check" aria-hidden="true"title="Submit All"></i></a> &nbsp; -->
@ -234,6 +231,7 @@ function openModal(url) {
$.ajax({
url: "<?php echo base_url()?>Expence/getCancelConfirmationPopup",
data: { title: "Are you sure to cancel this expense?" },
type:"GET",
success:function(data){
$('#popup').html(JSON.parse(data));
@ -250,6 +248,7 @@ function openModal(url) {
$.ajax({
url: "<?php echo base_url()?>Expence/getCancelConfirmationPopup",
data: { title: "Are you sure to submit this expense?" },
type:"GET",
success:function(data){
$('#popup').html(JSON.parse(data));

View File

@ -114,14 +114,17 @@
<td style="color:#e68a00"><?php echo $value->status; ?></td>
<?php }
else if($value->status == 'Approved'){ ?>
<td style="color:green"><?php echo $value->status; ?> By <?php echo $value->approved_by; ?><br><?php echo $value->approved_at;?></td>
<td style="color:green"><?php echo $value->status; ?> By <?php echo $value->approved_by; ?><br><?php echo my_date_show_time($value->approved_at); ?></td>
<?php }
else if($value->status == 'Declined'){ ?>
<td style="color:red"><?php echo $value->status; ?> by <?php echo $value->decline_by; ?> <br><?php echo $value->decline_reason; ?></td>
<?php }
else if($value->status == 'Cancelled'){ ?>
<td style="color:darkcyan;"><?php echo $value->status; ?> at <br><?php echo $value->cancelled_at; ?></td>
<td style="color:darkcyan;"><?php echo $value->status; ?> at <br><?php echo my_date_show_time($value->cancelled_at); ?></td>
<?php }
else if($value->status == 'Reimbursed'){?>
<td style="color:#00FF00;"><?php echo $value->status; ?> at <br><?php echo my_date_show_time($value->reimbursed_at); ?></td>
<?php }
else if($value->status == 'Draft'){?>
<td style="color:#0000e6;"><?php echo $value->status; ?></td>

View File

@ -109,7 +109,7 @@
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name">Expense Name<a style="color:red;">*</a></label>
<label class="control-label col-md-1 col-sm-1 label-align" for="expense_name">Expense Name<a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<div class="form-group">
<input type='text' id="expense_name" class="form-control" name="expense_name" value="<?php if(isset($expense_data[0]->id)){echo $expense_data[0]->expense_name; } ?>" autocomplete='off' required />
@ -118,10 +118,10 @@
</div>
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name">Business Reason</label>
<label class="control-label col-md-1 col-sm-1 label-align" for="business_reason">Business Reason</label>
<div class="col-md-5 col-sm-5 ">
<div class="form-group">
<input type='text' class="form-control" name="business_reason" value="<?php if(isset($expense_data[0]->id)){echo $expense_data[0]->business_reason; } ?>" autocomplete='off'/>
<input type='text' class="form-control" id="business_reason" name="business_reason" value="<?php if(isset($expense_data[0]->id)){echo $expense_data[0]->business_reason; } ?>" autocomplete='off'/>
</div>
</div>
@ -155,7 +155,7 @@
<input type="hidden" name="expense_pid" value="<?php echo $expense_data[0]->id; ?>">
</div>
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Expense Cost <a style="color:red;">*</a></label>
<label class="control-label col-md-1 col-sm-1 label-align" for="cost"> Expense Cost <a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<input id="cost" name="amount[]" required value="<?php echo $value->amount ?>" class="form-control" onkeypress = "return matchnum(event)" type="number" name="middle-name" autocomplete='off'>
</div>
@ -171,7 +171,7 @@
</div>
<label class="control-label col-md-1 col-sm-1 label-align" required for="first-name">Recipt</label>
<label class="control-label col-md-1 col-sm-1 label-align" required for="formFile">Recipt</label>
<div class="col-md-5 col-sm-5 ">
<input id="formFile" name="bill[]" onchange="validateFile(this)" class="typeFile" type="file" value="<?php echo $value->bill ?>" multiple>
</div>
@ -194,7 +194,7 @@
</div>
</div>
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Amount <a style="color:red;">*</a></label>
<label class="control-label col-md-1 col-sm-1 label-align" for="cost"> Amount <a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<input id="cost" name="amount[]" required value="" class="form-control" onkeypress = "return matchnum(event)" type="number" name="middle-name" autocomplete='off'>
</div>
@ -208,7 +208,7 @@
</div>
<label class="control-label col-md-1 col-sm-1 label-align" required for="first-name">Recipt</label>
<label class="control-label col-md-1 col-sm-1 label-align" required for="formFile">Recipt</label>
<div class="col-md-5 col-sm-5 ">
<input id="formFile" name="bill[]" onchange="validateFile(this)" class="typeFile" type="file" value="" multiple></div>
</div><div class="col-12"><button type="button" id="add-button" onclick="createAndAppendFormGroup()" class="btn btn-primary float-right">Add</button></div>
@ -403,7 +403,7 @@ function createAndAppendFormGroup() {
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 += '<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="cost"> 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>';
@ -412,7 +412,7 @@ function createAndAppendFormGroup() {
html1 += '<label class="control-label col-md-1 col-sm-1 label-align" for="last-name">Description</label>'
html1 += '<div class="col-md-5 col-sm-3"><textarea id="comments" name="description[]" value="" class="form-control" style="height:50px !important;" type="text" ></textarea></div>'
html1 += '<label class="control-label col-md-1 col-sm-1 label-align" required for="first-name">Recipt </label>'
html1 += '<label class="control-label col-md-1 col-sm-1 label-align" required for="formFile">Recipt </label>'
html1 += '<div class="col-md-5 col-sm-5 "><input id="formFile" name="bill[]" multiple onchange="validateFile(this)" class="typeFile" type="file" value="" ></div>'
html1 += '</div>'
html1 += '<div class="col-12"><button type="button" class="float-right btn btn-danger"" id="remove-button" onclick="removebutton('+i+')"><i class="fa fa-trash"></i></button></div><button type="button" id="add-button" onclick="createAndAppendFormGroup()" class="btn btn-primary float-right">Add</button></div>'

View File

@ -91,7 +91,7 @@
<button hidden id="button" class="btn btn-secondary source" onclick="new PNotify({
<button hidden id="button" class="btn btn-secondary source" onclick="new PNotify({
text: '<html><h2>Expense Approved<h2></html>',
type: 'success',
styling: 'bootstrap3'
@ -100,21 +100,22 @@
text: '<html><h2>Expense Declined<h2></html>',
type: 'success',
styling: 'bootstrap3'
});">Success</button>
<button hidden id="button3" class="btn btn-secondary source" onclick="new PNotify({
text: '<html><h2>Reimbursement successfully submitted!<h2></html>',
type: 'success',
styling: 'bootstrap3'
});">Success</button>
<input type="hidden" id="error" value="<?php echo $this->session->userdata('Create');?>" >
<?php $this->session->unset_userdata('Create');?>
<script>
$(document).ready(function(){
if($('#error').val() == 1 )
{
$('#button').click();
}
else if($('#error').val() == 2)
{
$('#button2').click();
}
})
$(document).ready(function(){
switch($('#error').val()){
case 1: $('#button').click(); break;
case 2: $('#button2').click(); break;
case 3: $('#button3').click(); break;
}
})
</script>
@ -168,24 +169,25 @@
<?php } } ?>
<?php if($value->status == 'pending'){ ?>
<td style="color:#e68a00"><?php echo $value->status; ?></td>
<td style="color:#e68a00"><?php echo ucfirst($value->status); ?></td>
<?php }
else if($value->status == 'Approved'){ ?>
<td style="color:green"><?php echo $value->status; ?> By <?php echo $value->approved_by; ?><br><?php echo date('d-m-Y h:i:s', strtotime($value->approved_at));?></td>
<td style="color:green"><?php echo $value->status; ?> By <?php echo $value->approved_by; ?><br><?php echo my_date_show_time($value->approved_at);?></td>
<?php }
else if($value->status == 'Declined'){ ?>
<td style="color:red"><?php echo $value->status; ?> by <?php echo $value->decline_by; ?> <br><?php echo $value->decline_reason; ?></td>
<?php }
else if($value->status == 'Cancelled'){ ?>
<td style="color:darkcyan;"><?php echo $value->status; ?> at <br><?php echo date('d-m-Y h:i:s', strtotime($value->cancelled_at));?></td>
<?php } else if($value->status == 'Draft'){?>
<td style="color:darkcyan;"><?php echo $value->status; ?> at <br><?php echo my_date_show_time($value->cancelled_at);?></td>
<?php }
else if($value->status == 'Reimbursed'){?>
<td style="color:green;"><?php echo $value->status; ?> at <br><?php echo my_date_show_time($value->reimbursed_at); ?></td>
<?php }
else if($value->status == 'Draft'){?>
<td style="color:#0000e6;"><?php echo $value->status; ?></td>
<?php } else if($value->status == 'Partially approved'){?>
<td style="color:#0000e6;"><?php echo $value->status; ?></td>
<?php }
else if($value->status == 'Partially approved'){?>
<td style="color:#FFCC00;"><?php echo $value->status; ?></td>
<?php } ?>
<td style=" text-align: center; font-size: 16px;">
@ -198,9 +200,12 @@
<?php if($value->status == 'pending') { ?>
<a><i class="fa fa-check-circle reimbursedexpense" data-toggle="modal" data-target=".bs-example-modal-sm" title="Re-Imbursed" id="<?php echo $value->id;?>"></i></a>&nbsp;
<a><i class="fa fa-check approveexpense" data-toggle="modal" data-target=".bs-example-modal-sm" title="Approve" id="<?php echo $value->id;?>"></i></a>&nbsp;
<a><i class="fa fa-times test" data-toggle="modal" data-target=".bs-example-modal-sm" title="Decline" id="<?php echo $value->id;?>"></i></a>&nbsp;
<a><i class="fa fa-times test" data-toggle="modal" data-target=".bs-example-modal-sm" title="Decline" id="<?php echo $value->id;?>"></i></a>&nbsp;
<!-- <a><i class="fa fa-times test" aria-hidden="true" title="Decline" onclick="showCustomPrompt()" id= "<?php echo $value->id; ?>"></i></a>&nbsp; -->
<?php } ?>
</td>
@ -259,6 +264,22 @@
<div style="display:none" id="sub-value">
<script>
$('.reimbursedexpense').click(function() {
var id = $(this).attr('id');
var url = "<?php echo base_url()?>Expence/Reimbursed_Expence";
$.ajax({
url: "<?php echo base_url()?>Expence/getDeleteConfirmationPopup",
data: { title: "Confirm Reimbursement Submission" },
type:"GET",
success:function(data){
$('#popup').html(JSON.parse(data));
$('.delete_id').attr('value',id);
$('.delete_url').attr('action',url);
}
});
});
$('.approveexpense').click(function() {
var id = $(this).attr('id');
var url = "<?php echo base_url()?>Expence/Approve_Expence";

View File

@ -145,7 +145,7 @@
{
if($expense_name[0]->status == "Approved")
{
echo $expense_name[0]->status .' By '. $expense_name[0]->approved_by .' - '. date('d-m-Y h:i:s', strtotime($expense_name[0]->approved_at));
echo $expense_name[0]->status .' By '. $expense_name[0]->approved_by .' - '. my_date_show_time($expense_name[0]->approved_at);
}
else if($expense_name[0]->status == "Declined")
{
@ -164,7 +164,7 @@
<label class="control-label col-md-1 col-sm-1 " for="first-name">Submitted Date</label>
<div class="col-md-5 col-sm-5 ">
<div class="form-group">
<input readonly type='text' class="form-control" name="business_reason" value="<?php if(isset($expense_name[0]->id)){echo date('d-m-Y h:i:s', strtotime($expense_name[0]->updated_on)); } ?>" autocomplete='off'/>
<input readonly type='text' class="form-control" name="business_reason" value="<?php if(isset($expense_name[0]->id)){echo date('d-m-Y h:i:s A', strtotime($expense_name[0]->updated_on)); } ?>" autocomplete='off'/>
</div>
</div>
@ -174,7 +174,9 @@
</div>
<?php if($expense_name[0]->status != "Reimbursed") { ?>
<a><i class="fa fa-check approveexpense float-right btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-sm" title="Approve" id ></i></a>&nbsp;
<?php } ?>
</div>
@ -205,18 +207,19 @@
<td style="color:#e68a00"><?php echo $value->status; ?></td>
<?php }
else if($value->status == 'Approved'){ ?>
<td style="color:green"><?php echo $value->status; ?> By <?php echo $value->approved_by; ?><br><?php echo date('d-m-Y h:i:s', strtotime($value->approved_at)) ?></td>
<td style="color:green"><?php echo $value->status; ?> By <?php echo $value->approved_by; ?><br><?php echo my_date_show_time($value->approved_at); ?></td>
<?php }
else if($value->status == 'Declined'){ ?>
<td style="color:red"><?php echo $value->status; ?> by <?php echo $value->decline_by; ?> <br><?php echo $value->decline_reason; ?></td>
<?php }
else if($value->status == 'Cancelled'){ ?>
<td style="color:darkcyan;"><?php echo $value->status; ?> at <br><?php echo $value->cancelled_at; ?></td>
<td style="color:darkcyan;"><?php echo $value->status; ?> at <br><?php echo my_date_show_time($value->cancelled_at); ?></td>
<?php }
else if($value->status == 'Reimbursed'){?>
<td style="color:#00FF00;"><?php echo $value->status; ?> at <br><?php echo my_date_show_time($value->reimbursed_at); ?></td>
<?php }
else if($value->status == 'Draft'){?>
<td style="color:#0000e6;"><?php echo $value->status; ?></td>
<?php } ?>
<td style=" text-align: center; font-size: 16px;">

View File

@ -91,12 +91,17 @@
<li class="nav-item dropdown open" style="padding-left: 15px;">
<a href="javascript:;" class="user-profile dropdown-toggle" aria-haspopup="true" id="navbarDropdown" data-toggle="dropdown" aria-expanded="false">
<?php if(user()->profile_image == '' || user()->profile_image == null) { ?>
<img src="<?php echo base_url(); ?>/assets/uploads/profile_picture/profile.jpg" alt="">
<?php } else { ?>
<img src="<?php echo base_url(); ?>/assets/uploads/profile_picture/<?php echo user()->profile_image; ?>" alt="">
<?php } ?>
<?php $defaultProfilePicture = base_url() . '/assets/uploads/profile_picture/profile.jpg';
$FinalProfilePicture = "";
if(user()->profile_image == '' || user()->profile_image == null) {
$FinalProfilePicture = $defaultProfilePicture;
}else{
$personProfilePicture = base_url() . '/assets/uploads/profile_picture/'.user()->profile_image;
$persContents = @file_get_contents($personProfilePicture);
$FinalProfilePicture = ($persContents !== false) ? $personProfilePicture : $defaultProfilePicture;
}
?>
<img src="<?php echo $FinalProfilePicture; ?>" alt="">
<?php if(check_auth() && is_admin() || is_user()){echo user()->name;}else{echo user()->name; }?>
</a>
<div class="dropdown-menu dropdown-usermenu pull-right" aria-labelledby="navbarDropdown">

View File

@ -92,12 +92,18 @@
<li class="nav-item dropdown open" style="padding-left: 15px;">
<a href="javascript:;" class="user-profile dropdown-toggle" aria-haspopup="true" id="navbarDropdown" data-toggle="dropdown" aria-expanded="false">
<?php if(user()->profile_image == '' || user()->profile_image == null) { ?>
<img src="<?php echo base_url(); ?>/assets/uploads/profile_picture/profile.jpg" alt="">
<?php } else { ?>
<img src="<?php echo base_url(); ?>/assets/uploads/profile_picture/<?php echo user()->profile_image; ?>" alt="">
<?php } ?>
<?php $defaultProfilePicture = base_url() . '/assets/uploads/profile_picture/profile.jpg';
$FinalProfilePicture = "";
if(user()->profile_image == '' || user()->profile_image == null) {
$FinalProfilePicture = $defaultProfilePicture;
}else{
$personProfilePicture = base_url() . '/assets/uploads/profile_picture/'.user()->profile_image;
$persContents = @file_get_contents($personProfilePicture);
$FinalProfilePicture = ($persContents !== false) ? $personProfilePicture : $defaultProfilePicture;
}
?>
<img src="<?php echo $FinalProfilePicture; ?>" alt="">
<?php if(check_auth() && is_admin() || is_user()){echo user()->name;}else{echo user()->name; }?>
</a>
<div class="dropdown-menu dropdown-usermenu pull-right" aria-labelledby="navbarDropdown">

View File

@ -30,14 +30,17 @@
<!-- menu profile quick info -->
<div class="profile clearfix">
<div class="profile_pic">
<?php if(user()->profile_image == '' || user()->profile_image == null) { ?>
<img src="<?php echo base_url(); ?>/assets/uploads/profile_picture/profile.jpg" alt="..." class="img-circle profile_img">
<?php } else { ?>
<img src="<?php echo base_url(); ?>/assets/uploads/profile_picture/<?php echo user()->profile_image; ?>"
alt="..." class="img-circle profile_img">
<?php } ?>
<?php $defaultProfilePicture = base_url() . '/assets/uploads/profile_picture/profile.jpg';
$FinalProfilePicture = "";
if(user()->profile_image == '' || user()->profile_image == null) {
$FinalProfilePicture = $defaultProfilePicture;
}else{
$personProfilePicture = base_url() . '/assets/uploads/profile_picture/'.user()->profile_image;
$persContents = @file_get_contents($personProfilePicture);
$FinalProfilePicture = ($persContents !== false) ? $personProfilePicture : $defaultProfilePicture;
}
?>
<img src="<?php echo $FinalProfilePicture; ?>" alt="..." class="img-circle profile_img">
</div>
<div class="profile_info">
<span>Welcome,</span>

View File

@ -188,8 +188,7 @@ public function createLeave()
$perm_data['status'] = 'pending';
// $perm_data['created_date'] = date('d-m-Y');
$perm_data['created_date_new'] = date('Y-m-d');
$perm_data['created_time'] = date('H:i A');
$perm_data['created_time'] = date('h:i a');
unset($perm_data['from_date']);
unset($perm_data['to_date']);
unset($perm_data['from_date_new']);
@ -247,7 +246,7 @@ public function createLeave()
$data['status'] = 'pending';
// $data['created_date'] = date('d-m-Y');
$data['created_date_new'] = date('Y-m-d');
$data['created_time'] = date('H:i A');
$data['created_time'] = date('h:i a');
$leave_year = date('Y', strtotime($this->input->post('from_date_new')));
//get employee's leave count
@ -401,7 +400,7 @@ public function editleave()
$action['perm_date_new'] = date('Y-m-d', strtotime($this->input->post('perm_date_new')));
$action['created_date'] = date('d-m-Y');
$action['created_time'] = date('H:i A');
$action['created_time'] = date('h:i a');
$table="leave_list";
$create_permission = $this->MY_Model->edit_option($action, $id, $table);
@ -467,7 +466,6 @@ public function editleave()
else
{
echo "else stss";
$all_leave_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
$data['leave_bal'] = $all_leave_count[0]->days;
$days['remaining_days'] = $all_leave_count[0]->days;
@ -483,12 +481,10 @@ public function editleave()
}
$get_from_date = $this->Leave_model->get_from_date($emp_id, $this->input->post('from_date_new'), $this->input->post('to_date_new'));
// echo "<pre>";
if($get_from_date == 0)
{
echo"update fun:";
$table="leave_list";
$update_leave = $this->MY_Model->edit_option($action,$id,$table);
@ -816,7 +812,7 @@ public function dashboard()
// $this->load->view('Leave/dashboard', $data);
// $data['weekData'] = $this->Leave_model->get_approved_leaves_cur_week($business_id);
$data['weekData'] = $this->Leave_model->get_week_leave_count($business_id);
$data['weekApprovedData'] = $this->Leave_model->get_week_leave_approved_count($business_id);
// echo print_r($data['weekData']);die;
$this->layout->buffer('main_content', 'Leave/dashboard',$data);
$this->layout->render('Employee_Layout');

View File

@ -1,6 +1,6 @@
<?php
class Leave_model extends MY_Model {
// status // Approved
public function get_all_leave($business_id)
{
$this->db->select('A.* ,U1.name as emp_name, U2.name as ApproveBy, l1.type as leavetype');
@ -30,7 +30,7 @@ public function get_all_leave_data($business_id) {
YEAR(IF(A.from_date_new is not null, A.from_date_new ,A.perm_date_new)) as final_date_year,
GROUP_CONCAT(
CASE
WHEN A.from_date_new IS NOT NULL THEN CONCAT(' (',A.from_date_new, ' to ', A.to_date_new,') ')
WHEN A.from_date_new IS NOT NULL THEN CONCAT(' (',DATE_FORMAT(A.from_date_new, '%d-%m-%Y'), ' to ', DATE_FORMAT(A.to_date_new, '%d-%m-%Y'),') ')
ELSE ''
END
) AS date_range,
@ -625,8 +625,7 @@ public function get_approved_leaves_cur_week()
}
public function get_week_leave_count($business_id)
public function get_week_leave_approved_count($business_id)
{
$startOfWeek = date('Y-m-d', strtotime('monday this week'));
$endOfWeek = date('Y-m-d', strtotime('sunday this week'));
@ -637,6 +636,7 @@ public function get_week_leave_count($business_id)
$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');
$this->db->where('A.status', 'Approved');
$query = $this->db->get();
$leaveRecords = $query->result();
// echo json_encode($leaveRecords);die;

View File

@ -171,9 +171,9 @@
</select>
</div>
<label class="control-label col-md-1 col-sm-1 " for="first-name" id="balance" > Balance</label>
<label class="control-label col-md-1 col-sm-1 balance" for="balance" > Balance</label>
<div class="col-md-1 col-sm-1 ">
<input type="text" id="leave_bal" name="" value="" style="width:90px;" class="form-control " readonly>
<input type="text" id="leave_bal" name="" value="" style="width:90px;" class="form-control balance" readonly>
</div>
</div>
@ -394,12 +394,11 @@ function get_all_count(id) {
$('#type').change(function() {
var selectedOptionId = $(this).find(":selected").attr("id");
var selectedOptionId = $(this).find(":selected").attr("id");
if( selectedOptionId === 'permission'){
$('#hidedate').hide();
$('#balance').hide();
$('#leave_bal').hide();
$('.balance').hide();
$('#fromdate').removeAttr('required');
$('#todate').removeAttr('required');
$('#perm_id').prop('required', true);
@ -416,8 +415,7 @@ function get_all_count(id) {
$('#hidedate').show();
$('#showtime').hide();
$('#showdate').hide();
$('#balance').show();
$('#leave_bal').show();
$('.balance').show();
$('#fromdate').prop('required', true);
$('#todate').prop('required', true);
}
@ -453,55 +451,47 @@ function get_all_count(id) {
<script>
$(document).ready(function() {
var selectField = $('#from_time');
var selectField = $('#from_time');
var options = [ '12:00 AM', '12:30 AM', '1:00 AM', '1:30 AM', '2:00 AM', '2:30 AM', '3:00 AM', '3:30 AM', '4:00 AM', '4:30 AM', '5:00 AM', '5:30 AM', '6:00 AM', '6:30 AM', '7:00 AM', '7:30 AM', '8:00 AM', '8:30 AM', '9:00 AM', '9:30 AM', '10:00 AM', '10:30 AM', '11:00 AM', '11:30 AM', '12:00 Noon', '12:30 PM', '1:00 PM', '1:30 PM', '2:00 PM', '2:30 PM', '3:00 PM', '3:30 PM', '4:00 PM', '4:30 PM', '5:00 PM', '5:30 PM', '6:00 PM', '6:30 PM', '7:00 PM', '7:30 PM', '8:00 PM', '8:30 PM', '9:00 PM', '9:30 PM', '10:00 PM', '10:30 PM', '11:00 PM', '11:30 PM'];
// var options = [ '12:00 AM', '12:30 AM', '1:00 AM', '1:30 AM', '2:00 AM', '2:30 AM', '3:00 AM', '3:30 AM', '4:00 AM', '4:30 AM', '5:00 AM', '5:30 AM', '6:00 AM', '6:30 AM', '7:00 AM', '7:30 AM', '8:00 AM', '8:30 AM', '9:00 AM', '9:30 AM', '10:00 AM', '10:30 AM', '11:00 AM', '11:30 AM', '12:00 Noon', '12:30 PM', '1:00 PM', '1:30 PM', '2:00 PM', '2:30 PM', '3:00 PM', '3:30 PM', '4:00 PM', '4:30 PM', '5:00 PM', '5:30 PM', '6:00 PM', '6:30 PM', '7:00 PM', '7:30 PM', '8:00 PM', '8:30 PM', '9:00 PM', '9:30 PM', '10:00 PM', '10:30 PM', '11:00 PM', '11:30 PM'];
var options = [ '8:00 AM', '8:30 AM', '9:00 AM', '9:30 AM', '10:00 AM', '10:30 AM', '11:00 AM', '11:30 AM', '12:00 Noon', '12:30 PM', '1:00 PM', '1:30 PM', '2:00 PM', '2:30 PM', '3:00 PM', '3:30 PM', '4:00 PM', '4:30 PM', '5:00 PM', '5:30 PM', '6:00 PM', '6:30 PM'];
for (var i = 0; i < options.length; i++) {
selectField.append('<option value="' + options[i] + '">' + options[i] + '</option>');
}
});
for (var i = 0; i < options.length; i++) {
selectField.append('<option value="' + options[i] + '">' + options[i] + '</option>');
}
});
var selectField = $('#from_time');
selectField.on('click', function() {
var selectedValue = $(this).val();
var selectField = $('#from_time');
selectField.on('click', function() {
var selectedValue = $(this).val();
console.log(selectedValue);
var timeSlots = [ '12:00 AM', '12:30 AM', '1:00 AM', '1:30 AM', '2:00 AM', '2:30 AM', '3:00 AM', '3:30 AM', '4:00 AM', '4:30 AM', '5:00 AM', '5:30 AM', '6:00 AM', '6:30 AM', '7:00 AM', '7:30 AM', '8:00 AM', '8:30 AM', '9:00 AM', '9:30 AM', '10:00 AM', '10:30 AM', '11:00 AM', '11:30 AM', '12:00 Noon', '12:30 PM', '1:00 PM', '1:30 PM', '2:00 PM', '2:30 PM', '3:00 PM', '3:30 PM', '4:00 PM', '4:30 PM', '5:00 PM', '5:30 PM', '6:00 PM', '6:30 PM', '7:00 PM', '7:30 PM', '8:00 PM', '8:30 PM', '9:00 PM', '9:30 PM', '10:00 PM', '10:30 PM', '11:00 PM', '11:30 PM'];
function filterTimeSlots(startingTime, numberOfHours) {
// Find the index of the starting time in the array
// var timeSlots = [ '12:00 AM', '12:30 AM', '1:00 AM', '1:30 AM', '2:00 AM', '2:30 AM', '3:00 AM', '3:30 AM', '4:00 AM', '4:30 AM', '5:00 AM', '5:30 AM', '6:00 AM', '6:30 AM', '7:00 AM', '7:30 AM', '8:00 AM', '8:30 AM', '9:00 AM', '9:30 AM', '10:00 AM', '10:30 AM', '11:00 AM', '11:30 AM', '12:00 Noon', '12:30 PM', '1:00 PM', '1:30 PM', '2:00 PM', '2:30 PM', '3:00 PM', '3:30 PM', '4:00 PM', '4:30 PM', '5:00 PM', '5:30 PM', '6:00 PM', '6:30 PM', '7:00 PM', '7:30 PM', '8:00 PM', '8:30 PM', '9:00 PM', '9:30 PM', '10:00 PM', '10:30 PM', '11:00 PM', '11:30 PM'];
var timeSlots = [ '8:00 AM', '8:30 AM', '9:00 AM', '9:30 AM', '10:00 AM', '10:30 AM', '11:00 AM', '11:30 AM', '12:00 Noon', '12:30 PM', '1:00 PM', '1:30 PM', '2:00 PM', '2:30 PM', '3:00 PM', '3:30 PM', '4:00 PM', '4:30 PM', '5:00 PM', '5:30 PM', '6:00 PM', '6:30 PM'];
function filterTimeSlots(startingTime, numberOfHours) {
// Find the index of the starting time in the array
console.log(startingTime,numberOfHours);
const startIndex = timeSlots.findIndex(time => time === startingTime);
console.log(startIndex);
if (startIndex !== -1) {
const endIndex = startIndex + (numberOfHours * 2) - 1;
const startIndex = timeSlots.findIndex(time => time === startingTime);
console.log(startIndex);
if (startIndex !== -1) {
const endIndex = startIndex + (numberOfHours * 2) - 1;
return timeSlots.slice(startIndex, endIndex + 2);
}else{ return []; }
}
return timeSlots.slice(startIndex, endIndex + 2);
}
return [];
}
// Usage example
const startingTime = selectedValue;
const numberOfHours = 2 ;
const filteredTimeSlots = filterTimeSlots(startingTime, numberOfHours);
filteredTimeSlots.shift();
var totime = $('#to_time');
totime.empty();
for (var i = 0; i < filteredTimeSlots.length; i++) {
totime.append('<option value="' + filteredTimeSlots[i] + '">' + filteredTimeSlots[i] + '</option>');
// Usage example
const startingTime = selectedValue;
const numberOfHours = 4 ;
const filteredTimeSlots = filterTimeSlots(startingTime, numberOfHours);
filteredTimeSlots.shift();
var totime = $('#to_time');
totime.empty();
for (var i = 0; i < filteredTimeSlots.length; i++) {
totime.append('<option value="' + filteredTimeSlots[i] + '">' + filteredTimeSlots[i] + '</option>');
}
console.log(filteredTimeSlots);
});
}
console.log(filteredTimeSlots);
});
</script>
<script>

View File

@ -97,17 +97,17 @@
<?php
// Remove duplicate
foreach ($weekData as &$dayData) {
foreach ($weekApprovedData as &$dayData) {
$dayData = array_unique($dayData);
}
// Assuming $weekData contains the array of arrays you provided
// Assuming $weekApprovedData contains the array of arrays you provided
echo '<tr>';
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 '<td>' . implode(',<br>', $weekApprovedData['monday']) . '</td>';
echo '<td>' . implode(',<br>', $weekApprovedData['tuesday']) . '</td>';
echo '<td>' . implode(',<br>', $weekApprovedData['wednesday']) . '</td>';
echo '<td>' . implode(',<br>', $weekApprovedData['thursday']) . '</td>';
echo '<td>' . implode(',<br>', $weekApprovedData['friday']) . '</td>';
echo '<td>' . implode(',<br>', $weekApprovedData['saturday']) . '</td>';
echo '</tr>';
?>

View File

@ -141,9 +141,9 @@
</div>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Balance</label>
<label class="control-label col-md-1 col-sm-1 balance"> Balance</label>
<div class="col-md-1 col-sm-1 ">
<input type="text" id="leave_bal" name="" value="<?php echo $leave->leave_bal; ?>" style="width:90px;" class="form-control " readonly>
<input type="text" id="leave_bal" name="" value="<?php echo $leave->leave_bal; ?>" style="width:90px;" class="form-control balance" readonly>
</div>
</div>
@ -193,14 +193,14 @@
<label class="control-label col-md-2 col-sm-2 " for="first-name"> From<a style="color:red;">*</a> </label>
<div class="col-md-2 col-sm-2 ">
<select class="custom-select" id="from_time" name=from_time required >
<option value="<?php echo $leave->from_time; ?>"><?php echo $leave->from_time; ?></option>
<!-- <option value="<?php echo $leave->from_time; ?>"><?php echo $leave->from_time; ?></option> -->
</select>
</div>
<label class="control-label col-md-1 col-sm-1 " for="last-name">To<a style="color:red;">*</a> </label>
<div class="col-md-2 col-sm-2 ">
<select id="to_time" class="custom-select" name="to_time" required>
<option value="<?php echo $leave->to_time; ?>"><?php echo $leave->to_time; ?></option>
<!-- <option value="<?php echo $leave->to_time; ?>"><?php echo $leave->to_time; ?></option> -->
</select>
</div>
@ -445,9 +445,8 @@ function calculateDateDifference() {
if( id === 'permission' ){
$('#hidedate').hide()
$('#balance').hide()
$('#leave_bal').hide()
$('#hidedate').hide();
$('.balance').hide();
$('#fromdate').removeAttr('required');
$('#todate').removeAttr('required');
$('#showtime').show();
@ -461,8 +460,8 @@ function calculateDateDifference() {
$('#hidedate').show();
$('#showtime').hide();
$('#showdate').hide();
$('#balance').show()
$('#leave_bal').show()
$('.balance').show();
}
@ -482,8 +481,7 @@ function calculateDateDifference() {
if( selectedOptionId === 'permission'){
$('#hidedate').hide();
$('#balance').hide();
$('#leave_bal').hide();
$('.balance').hide();
$('#fromdate').removeAttr('required');
$('#todate').removeAttr('required');
$('#myDatepicker').prop('required', true);
@ -500,8 +498,7 @@ function calculateDateDifference() {
$('#hidedate').show();
$('#showtime').hide();
$('#showdate').hide();
$('#balance').show();
$('#leave_bal').show();
$('.balance').show();
$('#fromdate').prop('required', true);
$('#todate').prop('required', true);
}
@ -510,53 +507,70 @@ function calculateDateDifference() {
<script>
$(document).ready(function() {
var selectField = $('#from_time');
var selectField = $('#from_time');
var selectToField = $('#to_time');
var SelectedFromTime = '<?php echo $leave->from_time; ?>';
var SelectedToTime = '<?php echo $leave->to_time; ?>';
var options = [ '12:00 AM', '12:30 AM', '1:00 AM', '1:30 AM', '2:00 AM', '2:30 AM', '3:00 AM', '3:30 AM', '4:00 AM', '4:30 AM', '5:00 AM', '5:30 AM', '6:00 AM', '6:30 AM', '7:00 AM', '7:30 AM', '8:00 AM', '8:30 AM', '9:00 AM', '9:30 AM', '10:00 AM', '10:30 AM', '11:00 AM', '11:30 AM', '12:00 Noon', '12:30 PM', '1:00 PM', '1:30 PM', '2:00 PM', '2:30 PM', '3:00 PM', '3:30 PM', '4:00 PM', '4:30 PM', '5:00 PM', '5:30 PM', '6:00 PM', '6:30 PM', '7:00 PM', '7:30 PM', '8:00 PM', '8:30 PM', '9:00 PM', '9:30 PM', '10:00 PM', '10:30 PM', '11:00 PM', '11:30 PM'];
// var options = [ '12:00 AM', '12:30 AM', '1:00 AM', '1:30 AM', '2:00 AM', '2:30 AM', '3:00 AM', '3:30 AM', '4:00 AM', '4:30 AM', '5:00 AM', '5:30 AM', '6:00 AM', '6:30 AM', '7:00 AM', '7:30 AM', '8:00 AM', '8:30 AM', '9:00 AM', '9:30 AM', '10:00 AM', '10:30 AM', '11:00 AM', '11:30 AM', '12:00 Noon', '12:30 PM', '1:00 PM', '1:30 PM', '2:00 PM', '2:30 PM', '3:00 PM', '3:30 PM', '4:00 PM', '4:30 PM', '5:00 PM', '5:30 PM', '6:00 PM', '6:30 PM', '7:00 PM', '7:30 PM', '8:00 PM', '8:30 PM', '9:00 PM', '9:30 PM', '10:00 PM', '10:30 PM', '11:00 PM', '11:30 PM'];
var options = [ '8:00 AM', '8:30 AM', '9:00 AM', '9:30 AM', '10:00 AM', '10:30 AM', '11:00 AM', '11:30 AM', '12:00 Noon', '12:30 PM', '1:00 PM', '1:30 PM', '2:00 PM', '2:30 PM', '3:00 PM', '3:30 PM', '4:00 PM', '4:30 PM', '5:00 PM', '5:30 PM', '6:00 PM', '6:30 PM'];
for (var i = 0; i < options.length; i++) {
selectField.append('<option value="' + options[i] + '"' + ((SelectedFromTime !== '' && options[i] === SelectedFromTime) ? ' selected' : '') + '>' + options[i] + '</option>');
}
for (var i = 0; i < options.length; i++) {
selectField.append('<option value="' + options[i] + '">' + options[i] + '</option>');
}
});
if (SelectedToTime !== '') {
const ToTimeSlots = filterTimeSlots(SelectedFromTime,2,options);
for (var i = 0; i < ToTimeSlots.length; i++) {
selectToField.append('<option value="' + ToTimeSlots[i] + '"' + ((ToTimeSlots[i] === SelectedToTime) ? ' selected' : '') + '>' + ToTimeSlots[i] + '</option>');
}
}else{
console.log("No time slot selected.");
}
});
var selectField = $('#from_time');
selectField.on('click', function() {
function filterTimeSlots(startingTime, numberOfHours,timeSlots) {
// Find the index of the starting time in the array
console.log(startingTime,numberOfHours);
const startIndex = timeSlots.findIndex(time => time === startingTime);
console.log(startIndex);
if (startIndex !== -1) {
const endIndex = startIndex + (numberOfHours * 2) - 1;
return timeSlots.slice(startIndex, endIndex + 2);
}else{
return [];
}
}
var selectField = $('#from_time');
selectField.on('click', function() {
var selectedValue = $(this).val();
console.log(selectedValue);
var timeSlots = [ '12:00 AM', '12:30 AM', '1:00 AM', '1:30 AM', '2:00 AM', '2:30 AM', '3:00 AM', '3:30 AM', '4:00 AM', '4:30 AM', '5:00 AM', '5:30 AM', '6:00 AM', '6:30 AM', '7:00 AM', '7:30 AM', '8:00 AM', '8:30 AM', '9:00 AM', '9:30 AM', '10:00 AM', '10:30 AM', '11:00 AM', '11:30 AM', '12:00 Noon', '12:30 PM', '1:00 PM', '1:30 PM', '2:00 PM', '2:30 PM', '3:00 PM', '3:30 PM', '4:00 PM', '4:30 PM', '5:00 PM', '5:30 PM', '6:00 PM', '6:30 PM', '7:00 PM', '7:30 PM', '8:00 PM', '8:30 PM', '9:00 PM', '9:30 PM', '10:00 PM', '10:30 PM', '11:00 PM', '11:30 PM'];
// var timeSlots = [ '12:00 AM', '12:30 AM', '1:00 AM', '1:30 AM', '2:00 AM', '2:30 AM', '3:00 AM', '3:30 AM', '4:00 AM', '4:30 AM', '5:00 AM', '5:30 AM', '6:00 AM', '6:30 AM', '7:00 AM', '7:30 AM', '8:00 AM', '8:30 AM', '9:00 AM', '9:30 AM', '10:00 AM', '10:30 AM', '11:00 AM', '11:30 AM', '12:00 Noon', '12:30 PM', '1:00 PM', '1:30 PM', '2:00 PM', '2:30 PM', '3:00 PM', '3:30 PM', '4:00 PM', '4:30 PM', '5:00 PM', '5:30 PM', '6:00 PM', '6:30 PM', '7:00 PM', '7:30 PM', '8:00 PM', '8:30 PM', '9:00 PM', '9:30 PM', '10:00 PM', '10:30 PM', '11:00 PM', '11:30 PM'];
var timeSlots = [ '8:00 AM', '8:30 AM', '9:00 AM', '9:30 AM', '10:00 AM', '10:30 AM', '11:00 AM', '11:30 AM', '12:00 Noon', '12:30 PM', '1:00 PM', '1:30 PM', '2:00 PM', '2:30 PM', '3:00 PM', '3:30 PM', '4:00 PM', '4:30 PM', '5:00 PM', '5:30 PM', '6:00 PM', '6:30 PM'];
// Usage example
const startingTime = selectedValue;
const numberOfHours = 2 ;
const filteredTimeSlots = filterTimeSlots(startingTime, numberOfHours,timeSlots);
function filterTimeSlots(startingTime, numberOfHours) {
// Find the index of the starting time in the array
console.log(startingTime,numberOfHours);
const startIndex = timeSlots.findIndex(time => time === startingTime);
console.log(startIndex);
if (startIndex !== -1) {
filteredTimeSlots.shift();
var totime = $('#to_time');
totime.empty();
for (var i = 0; i < filteredTimeSlots.length; i++) {
totime.append('<option value="' + filteredTimeSlots[i] + '">' + filteredTimeSlots[i] + '</option>');
}
const endIndex = startIndex + (numberOfHours * 2) - 1;
return timeSlots.slice(startIndex, endIndex + 2);
}
return [];
}
// Usage example
const startingTime = selectedValue;
const numberOfHours = 4 ;
const filteredTimeSlots = filterTimeSlots(startingTime, numberOfHours);
filteredTimeSlots.shift();
var totime = $('#to_time');
totime.empty();
for (var i = 0; i < filteredTimeSlots.length; i++) {
totime.append('<option value="' + filteredTimeSlots[i] + '">' + filteredTimeSlots[i] + '</option>');
}
console.log(filteredTimeSlots);
console.log(filteredTimeSlots);
});
</script>

View File

@ -241,7 +241,7 @@ public function preprocessTemplateData($leaveData, $templateData){
else{
if(empty($managerName->name)){
$fromDate = date('d-m-Y', strtotime($leaveData->from_date_new));
$toDate = date('d-m-Y', strtotime($leaveData->to_date_new));
$toDate = date('d-m-Y', strtotime($leaveData->to_date_new));
$values = ['Manager', $leaveData->emp_name, $leaveData->no_of_days, $leaveData->leave_type, $fromDate, $toDate, $leaveData->risedby, $leaveData->leave_bal, $leaveData->status, $leaveData->comments];
@ -250,7 +250,7 @@ public function preprocessTemplateData($leaveData, $templateData){
$fromDate = date('d-m-Y', strtotime($leaveData->from_date_new));
$toDate = date('d-m-Y', strtotime($leaveData->to_date_new));
$values = [$managerName->name, $leaveData->emp_name, $leaveData->no_of_days, $leaveData->leave_type, $fromDate, $toDate_new, $leaveData->risedby, $leaveData->leave_bal, $leaveData->status, $leaveData->comments];
$values = [$managerName->name, $leaveData->emp_name, $leaveData->no_of_days, $leaveData->leave_type, $fromDate, $toDate, $leaveData->risedby, $leaveData->leave_bal, $leaveData->status, $leaveData->comments];
}
}
@ -258,7 +258,9 @@ public function preprocessTemplateData($leaveData, $templateData){
foreach ($placeholders as $index => $placeholder) {
$result[] = ['placeholder' => '[' . trim($placeholder, '[]') . ']', 'strval' => $values[$index]];
}
// echo($managerID)."<br>";print_r($managerName); echo "IS".$inputString."<br>";
// echo $templateData->content."<br>";print_r($result);
// die;
return $body = replaceTemplateWithData($templateData->content,$result);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB