Compare commits
10 Commits
2108ca2c0c
...
effd342cd9
| Author | SHA1 | Date | |
|---|---|---|---|
| effd342cd9 | |||
| fc57a9f4d0 | |||
| 9dda22a558 | |||
| ed34242db7 | |||
| dd8d8be3c0 | |||
| c04ddd41a9 | |||
| e226cca142 | |||
| 3300e42a01 | |||
| a1606f58b3 | |||
| 2519f1abae |
@ -58,7 +58,8 @@
|
|||||||
|
|
|
|
||||||
| $autoload['libraries'] = array('user_agent' => 'ua');
|
| $autoload['libraries'] = array('user_agent' => 'ua');
|
||||||
*/
|
*/
|
||||||
$autoload['libraries'] = array('session','database','email');
|
|
||||||
|
$autoload['libraries'] = array('session','database','email','security');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| -------------------------------------------------------------------
|
| -------------------------------------------------------------------
|
||||||
@ -132,3 +133,6 @@
|
|||||||
| $autoload['model'] = array('first_model' => 'first');
|
| $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');
|
||||||
@ -58,7 +58,7 @@
|
|||||||
|
|
|
|
||||||
| $autoload['libraries'] = array('user_agent' => 'ua');
|
| $autoload['libraries'] = array('user_agent' => 'ua');
|
||||||
*/
|
*/
|
||||||
$autoload['libraries'] = array('session','database','email');
|
$autoload['libraries'] = array('session','database','email','security');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| -------------------------------------------------------------------
|
| -------------------------------------------------------------------
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
| a PHP script and you can easily do that on your own.
|
| 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']);
|
$base .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
|
||||||
$config['base_url'] = $base;
|
$config['base_url'] = $base;
|
||||||
|
|
||||||
|
|||||||
@ -71,37 +71,14 @@
|
|||||||
| the query builder class.
|
| the query builder class.
|
||||||
*/
|
*/
|
||||||
$active_group = 'default';
|
$active_group = 'default';
|
||||||
$active_group = 'testingDB';
|
|
||||||
$query_builder = TRUE;
|
$query_builder = TRUE;
|
||||||
|
|
||||||
$db['default'] = array(
|
$db['default'] = array(
|
||||||
'dsn' => '',
|
'dsn' => '',
|
||||||
'hostname' => 'localhost',
|
'hostname' => 'localhost',
|
||||||
'username' => '',
|
'username' => 'venbaehn_venba_ams_live_usr1',
|
||||||
'password' => '',
|
'password' => '7+IRJp7VVG6$',
|
||||||
'database' => '',
|
'database' => 'venbaehn_venba_ams_live',
|
||||||
'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',
|
|
||||||
'dbdriver' => 'mysqli',
|
'dbdriver' => 'mysqli',
|
||||||
'dbprefix' => '',
|
'dbprefix' => '',
|
||||||
'pconnect' => FALSE,
|
'pconnect' => FALSE,
|
||||||
|
|||||||
@ -58,7 +58,8 @@
|
|||||||
|
|
|
|
||||||
| $autoload['libraries'] = array('user_agent' => 'ua');
|
| $autoload['libraries'] = array('user_agent' => 'ua');
|
||||||
*/
|
*/
|
||||||
$autoload['libraries'] = array('session','database','email');
|
|
||||||
|
$autoload['libraries'] = array('session','database','email','security');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| -------------------------------------------------------------------
|
| -------------------------------------------------------------------
|
||||||
|
|||||||
@ -224,7 +224,7 @@
|
|||||||
| your log files will fill up very fast.
|
| your log files will fill up very fast.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['log_threshold'] = 0;
|
$config['log_threshold'] = 4;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|||||||
@ -77,13 +77,12 @@ function send_emails($to, $subject, $body, $aliasName = '', $cc = null, $bcc = n
|
|||||||
|
|
||||||
if (!function_exists('send_emails_forgot_password')) {
|
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', 'send_mail_helper_loadded');
|
||||||
log_message('error', 'Receiptent mail - ' . $to . ' - subject - ' . $subject . ' - body - ' . $body);
|
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 {
|
try {
|
||||||
$mailer = new PHPMailer(true);
|
$mailer = new PHPMailer(true);
|
||||||
@ -91,14 +90,14 @@ function send_emails_forgot_password($to, $subject, $body, $aliasName = '', $cc
|
|||||||
|
|
||||||
$mailer->isSMTP();
|
$mailer->isSMTP();
|
||||||
$mailer->CharSet = 'utf-8';
|
$mailer->CharSet = 'utf-8';
|
||||||
$mailer->Host = business()->mail_hostname;
|
$mailer->Host = $mailCredentials->mail_hostname;
|
||||||
$mailer->SMTPSecure = business()->mail_security;
|
$mailer->SMTPSecure = $mailCredentials->mail_security;
|
||||||
$mailer->SMTPAuth = true;
|
$mailer->SMTPAuth = true;
|
||||||
$mailer->SMTPDebug = false;
|
$mailer->SMTPDebug = false;
|
||||||
$mailer->Username = business()->mail_username;
|
$mailer->Username = $mailCredentials->mail_username;
|
||||||
$mailer->Password = business()->mail_password;
|
$mailer->Password = $mailCredentials->mail_password;
|
||||||
$mailer->Port = business()->mail_port_no;
|
$mailer->Port = $mailCredentials->mail_port_no;
|
||||||
$mailer->setFrom(business()->sender_mail, $aliasName);
|
$mailer->setFrom($mailCredentials->sender_mail, $aliasName);
|
||||||
$mailer->addAddress($to);
|
$mailer->addAddress($to);
|
||||||
|
|
||||||
// Add CC recipients
|
// Add CC recipients
|
||||||
|
|||||||
@ -150,13 +150,15 @@ public function sendOTP(){
|
|||||||
$otp = $this->input->get('otp');
|
$otp = $this->input->get('otp');
|
||||||
$where = 'email';
|
$where = 'email';
|
||||||
$user = $this->auth_model->validateUserForOtp($mail, $where);
|
$user = $this->auth_model->validateUserForOtp($mail, $where);
|
||||||
|
$mailCredentials = $this->auth_model->validateBusiness($user->business_id);
|
||||||
|
|
||||||
$id = $user->id;
|
$id = $user->id;
|
||||||
$data['csrf_hash'] = $this->security->get_csrf_hash();
|
$data['csrf_hash'] = $this->security->get_csrf_hash();
|
||||||
$data['id'] = $id;
|
$data['id'] = $id;
|
||||||
$data['email'] = $mail;
|
$data['email'] = $mail;
|
||||||
|
|
||||||
|
|
||||||
$body =`
|
$body = <<<EOD
|
||||||
<body style="font-family: Arial, sans-serif;">
|
<body style="font-family: Arial, sans-serif;">
|
||||||
|
|
||||||
<div style="max-width: 600px; margin: 0 auto; padding: 20px; border: 1px solid #ccc; border-radius: 5px;">
|
<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>Hello,</p>
|
||||||
<p>Your One-Time Password (OTP) for verification is:</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;">
|
<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>
|
</div>
|
||||||
<p>This OTP is valid for a short period. Please do not share it with anyone.</p>
|
<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>If you did not request this OTP, please ignore this email.</p>
|
||||||
<p>Thank you!</p>
|
<p>Thank you!</p>
|
||||||
<hr style="border: 1px solid #ccc; margin-top: 20px; margin-bottom: 20px;">
|
<hr style="border: 1px solid #ccc; margin-top: 20px; margin-bottom: 20px;">
|
||||||
<p style="text-align: center; color: #777;">© 2023 </p>
|
<p style="text-align: center; color: #777;">© 2023 $mailCredentials->business_name </p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</body>
|
||||||
</body>`;
|
EOD;
|
||||||
|
|
||||||
$subject = 'Forgot Password OTP Send';
|
$subject = 'Forgot Password OTP Send';
|
||||||
|
|
||||||
$result = send_emails_forgot_password($mail, $subject, $body);
|
$result = send_emails_forgot_password($mail, $subject, $body,$mailCredentials);
|
||||||
|
|
||||||
if($result){
|
if($result){
|
||||||
$data['csrf_hash'] = $this->security->get_csrf_hash();
|
$data['csrf_hash'] = $this->security->get_csrf_hash();
|
||||||
$data['status'] = "success";
|
$data['status'] = "success";
|
||||||
$data['id'] = $id;
|
$data['id'] = $id;
|
||||||
$data['email'] = $mail;
|
$data['email'] = $mail;
|
||||||
|
$data['result'] = $result;
|
||||||
echo json_encode($data);
|
echo json_encode($data);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@ -60,7 +60,7 @@
|
|||||||
<section class="login_content">
|
<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">
|
<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="hidden_otp" name="hidden_otp" class="form-control" value="" />
|
||||||
<input type="hidden" id="id" name="id" value="">
|
<input type="hidden" id="id" name="id" value="">
|
||||||
<input type="hidden" id="email1" name="email" value="">
|
<input type="hidden" id="email1" name="email" value="">
|
||||||
@ -149,7 +149,7 @@ function send_otp() {
|
|||||||
json: true,
|
json: true,
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
response = jQuery.parseJSON(response)
|
response = jQuery.parseJSON(response)
|
||||||
alert(response);
|
// alert(response);
|
||||||
if (response.status == "failed") {
|
if (response.status == "failed") {
|
||||||
new PNotify({
|
new PNotify({
|
||||||
title: 'OTP Send Failed',
|
title: 'OTP Send Failed',
|
||||||
@ -196,12 +196,12 @@ function send_otp() {
|
|||||||
|
|
||||||
$(document).ready(function() {
|
$(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") {
|
if (status === "failed") {
|
||||||
$('#id').val(id);
|
$('#id').val(id);
|
||||||
@ -212,7 +212,7 @@ function send_otp() {
|
|||||||
$('#otp_span_msg').html('Pls enter correct OTP').css('color', 'red');
|
$('#otp_span_msg').html('Pls enter correct OTP').css('color', 'red');
|
||||||
$('#sendotpbtn').html('Resend OTP');
|
$('#sendotpbtn').html('Resend OTP');
|
||||||
|
|
||||||
} else if (response.status === "success") {
|
} else if (status === "success") {
|
||||||
|
|
||||||
$('input[name=csrf_test_name]').val(csrf_hash);
|
$('input[name=csrf_test_name]').val(csrf_hash);
|
||||||
$('#id').val(id);
|
$('#id').val(id);
|
||||||
|
|||||||
@ -68,85 +68,72 @@ public function get_emp_name()
|
|||||||
public function rise_expence_request()
|
public function rise_expence_request()
|
||||||
{
|
{
|
||||||
|
|
||||||
$data = $this->input->post('emp_id');
|
## Logged In Variables
|
||||||
if(!empty($data)){
|
$logged_in_user = user()->id;
|
||||||
$emp_id =$this->input->post('emp_id');
|
$logged_in_business = user()->business_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){
|
|
||||||
|
|
||||||
$manager = 0;
|
## Form Requested Data
|
||||||
}else{
|
$requested_data = $this->input->post();
|
||||||
|
|
||||||
$manager = $get_manager_id[0]->manager;
|
//Employee id
|
||||||
}
|
$employee_id = (isset($requested_data['emp_id']) && !empty($requested_data['emp_id'])) ? $requested_data['emp_id'] : $logged_in_user;
|
||||||
|
|
||||||
$data1 = array(
|
//Manager id
|
||||||
'created_by'=>user()->id,
|
$get_manager_details = $this->Expence_model->get_manager_id($employee_id);
|
||||||
'requested_for'=>$emp_id ,
|
$manager_id = ((!empty($get_manager_details)) && $get_manager_details[0]->manager != null) ? $get_manager_details[0]->manager : 0;
|
||||||
'expense_name'=>$this->input->post('expense_name'),
|
|
||||||
'business_reason'=>$this->input->post('business_reason'),
|
// Table Name Declarations
|
||||||
'manager_id' => $manager,
|
$expense_master_table = "expense";
|
||||||
'business_id' => user()->business_id,
|
$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',
|
'status'=>'Draft',
|
||||||
);
|
);
|
||||||
$table="expense";
|
|
||||||
$create_Expence = $this->MY_Model->insert($data1,$table);
|
|
||||||
|
|
||||||
// $count = count($this->input->post('date_of_expence'));
|
## Retrive the Inserted ID from Master Table
|
||||||
$count = ($this->input->post('date_of_expence_new')) ? count($this->input->post('date_of_expence_new')) : 1;
|
$create_expence = $this->MY_Model->insert($expense_master_arr,$expense_master_table);
|
||||||
// echo json_encode($this->input->post());die;
|
|
||||||
for($i=0;$i<$count;$i++)
|
|
||||||
{
|
|
||||||
|
|
||||||
$data2 = array(
|
$first = $requested_data['date_of_expence_new'];
|
||||||
'expense_id' => $create_Expence,
|
## Get the Count for Child Expence
|
||||||
'emp_id'=>$emp_id ,
|
$count = (gettype($first) == 'array') ? count($first) : 0;
|
||||||
'business_id' => user()->business_id,
|
if ($count > 0) {
|
||||||
'manager_id' => $manager,
|
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',
|
'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])),
|
'date_of_expense_new' => date('Y-m-d', strtotime($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],
|
||||||
);
|
);
|
||||||
// print_r($data2);die;
|
|
||||||
$this->load->library('upload');
|
|
||||||
|
|
||||||
$config['upload_path'] = APPPATH. '../assets/uploads/Expence_Bill/';
|
if (!empty($_FILES['bill']['name'][$i])) {
|
||||||
$config['allowed_types'] = 'jpg|png|jpeg|pdf';
|
$upload_result = $this->upload_file($_FILES['bill'], $i);
|
||||||
$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 ($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');
|
$this->session->set_flashdata('Create', '1');
|
||||||
redirect('Expence/Emp_Expence_List');
|
redirect('Expence/Emp_Expence_List');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function edit_expence($id)
|
public function edit_expence($id)
|
||||||
@ -162,15 +149,22 @@ public function edit_expence($id)
|
|||||||
|
|
||||||
public function edit_rise_expence_request()
|
public function edit_rise_expence_request()
|
||||||
{
|
{
|
||||||
// Expense primary key
|
## Logged In Variables
|
||||||
$id = $this->input->post('expense_pid');
|
$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
|
// 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 id
|
||||||
$manager = $this->Expence_model->get_manager_id($emp_id);
|
$get_manager_details = $this->Expence_model->get_manager_id($employee_id);
|
||||||
$manager_id = (!empty($manager)) ? $manager[0]->manager : 0;
|
$manager_id = ((!empty($get_manager_details)) && $get_manager_details[0]->manager != null) ? $get_manager_details[0]->manager : 0;
|
||||||
|
|
||||||
// Table Name Declarations
|
// Table Name Declarations
|
||||||
$expense_master_table = "expense";
|
$expense_master_table = "expense";
|
||||||
@ -178,25 +172,26 @@ public function edit_rise_expence_request()
|
|||||||
|
|
||||||
// Array formation for updating the master details
|
// Array formation for updating the master details
|
||||||
$expense_master_arr = array(
|
$expense_master_arr = array(
|
||||||
'created_by' => user()->id,
|
'created_by' => $logged_in_user,
|
||||||
'requested_for' => $emp_id,
|
'requested_for' => $employee_id,
|
||||||
'expense_name' => $this->input->post('expense_name'),
|
'expense_name' => $requested_data['expense_name'],
|
||||||
'business_reason' => $this->input->post('business_reason'),
|
'business_reason' => $requested_data['business_reason'],
|
||||||
'manager_id' => $manager_id,
|
'manager_id' => $manager_id,
|
||||||
'business_id' => user()->business_id,
|
'business_id' => $logged_in_business,
|
||||||
'status' => 'Draft',
|
'status' => 'Draft',
|
||||||
);
|
);
|
||||||
|
|
||||||
// Update process for master
|
// Update process for master
|
||||||
$update_expense = $this->MY_Model->edit_option($expense_master_arr, $id, $expense_master_table);
|
$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);
|
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;
|
$count = (gettype($first) == 'array') ? count($first) : 0;
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
for ($i = 0; $i < $count; $i++) {
|
for ($i = 0; $i < $count; $i++) {
|
||||||
$expense_child_id = $this->input->post('expense_child_id')[$i];
|
$expense_child_id = $this->input->post('expense_child_id')[$i];
|
||||||
$first_child = array(
|
$first_child = array(
|
||||||
'date_of_expense' => $this->input->post('date_of_expence_new')[$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],
|
'amount' => $this->input->post('amount')[$i],
|
||||||
'description' => $this->input->post('description')[$i],
|
'description' => $this->input->post('description')[$i],
|
||||||
);
|
);
|
||||||
@ -207,22 +202,24 @@ public function edit_rise_expence_request()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Details gathering from JavaScript new entries
|
// 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;
|
$additional_count = (gettype($second) == 'array') ? count($second) : 0;
|
||||||
if ($additional_count > 0) {
|
if ($additional_count > 0) {
|
||||||
for ($j = 0; $j < $additional_count; $j++) {
|
for ($j = 0; $j < $additional_count; $j++) {
|
||||||
$second_child = array(
|
$second_child = array(
|
||||||
'expense_id' => $id,
|
'expense_id' => $id,
|
||||||
'emp_id' => $emp_id,
|
'emp_id' => $employee_id,
|
||||||
'business_id' => user()->business_id,
|
'business_id' => user()->business_id,
|
||||||
'manager_id' => $manager_id,
|
'manager_id' => $manager_id,
|
||||||
'status' => 'Draft',
|
'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],
|
'amount' => $this->input->post('amount2')[$j],
|
||||||
'description' => $this->input->post('description2')[$j],
|
'description' => $this->input->post('description2')[$j],
|
||||||
);
|
);
|
||||||
if (!empty($_FILES['bill2']['name'][$j])) {
|
if (!empty($_FILES['bill2']['name'][$j])) {
|
||||||
$upload_result = $this->upload_file($_FILES['bill2'], $j);
|
$upload_result = $this->upload_file($_FILES['bill2'], $j);
|
||||||
|
|
||||||
if ($upload_result['success']) {
|
if ($upload_result['success']) {
|
||||||
$second_child['bill'] = $upload_result['file_name'];
|
$second_child['bill'] = $upload_result['file_name'];
|
||||||
} else {
|
} else {
|
||||||
@ -237,11 +234,13 @@ public function edit_rise_expence_request()
|
|||||||
redirect('Expence/Emp_Expence_List');
|
redirect('Expence/Emp_Expence_List');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function upload_file($file_data, $index)
|
public function upload_file($file_data, $index)
|
||||||
{
|
{
|
||||||
$this->load->library('upload');
|
$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['allowed_types'] = 'jpg|png|jpeg|pdf';
|
||||||
$config['max_size'] = 80000;
|
$config['max_size'] = 80000;
|
||||||
$config['file_name'] = time() . '_' . $file_data['name'][$index];
|
$config['file_name'] = time() . '_' . $file_data['name'][$index];
|
||||||
@ -320,7 +319,8 @@ public function Emp_Expence_List_view($id)
|
|||||||
|
|
||||||
public function getDeleteConfirmationPopup()
|
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);
|
$htmlPage = $this->load->view('confirmation_popup.php',$data,true);
|
||||||
echo json_encode($htmlPage);
|
echo json_encode($htmlPage);
|
||||||
}
|
}
|
||||||
@ -344,6 +344,24 @@ public function Approve_Expence()
|
|||||||
redirect('Expence/expence_list');
|
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()
|
public function Approve_Child_Expence()
|
||||||
{
|
{
|
||||||
if($this->input->post('declinedata'))
|
if($this->input->post('declinedata'))
|
||||||
@ -468,7 +486,8 @@ public function Decline_expence()
|
|||||||
|
|
||||||
public function getCancelConfirmationPopup()
|
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);
|
$htmlPage = $this->load->view('confirmation_popup.php',$data,true);
|
||||||
echo json_encode($htmlPage);
|
echo json_encode($htmlPage);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,6 +30,7 @@ public function get_expence_list($business_id)
|
|||||||
$this->db->or_where('A.status', 'Approved');
|
$this->db->or_where('A.status', 'Approved');
|
||||||
$this->db->or_where('A.status', 'Declined');
|
$this->db->or_where('A.status', 'Declined');
|
||||||
$this->db->or_where('A.status', 'Partially approved');
|
$this->db->or_where('A.status', 'Partially approved');
|
||||||
|
$this->db->or_where('A.status', 'Reimbursed');
|
||||||
$this->db->order_by('A.id', 'DESC');
|
$this->db->order_by('A.id', 'DESC');
|
||||||
$query = $this->db->get();
|
$query = $this->db->get();
|
||||||
$query = $query->result();
|
$query = $query->result();
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
|
|
||||||
<div class="modal-header">
|
<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 type="button" id="close-form" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span> -->
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -134,10 +134,10 @@
|
|||||||
|
|
||||||
<div class="item form-group">
|
<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="col-md-5 col-sm-5 ">
|
||||||
<div class="form-group">
|
<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;
|
echo $expense_data[0]->expense_name;
|
||||||
} ?>" autocomplete='off' required />
|
} ?>" autocomplete='off' required />
|
||||||
|
|
||||||
@ -145,10 +145,10 @@
|
|||||||
|
|
||||||
</div>
|
</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="col-md-5 col-sm-5 ">
|
||||||
<div class="form-group">
|
<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;
|
echo $expense_data[0]->business_reason;
|
||||||
} ?>" autocomplete='off' />
|
} ?>" autocomplete='off' />
|
||||||
|
|
||||||
@ -174,23 +174,18 @@
|
|||||||
foreach ($expense_child_data as $key => $value) { ?>
|
foreach ($expense_child_data as $key => $value) { ?>
|
||||||
|
|
||||||
<div class="item form-group">
|
<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">
|
<div class="col-md-5 col-sm-5">
|
||||||
<input id="cost" class="form-control" readonly name="middle-name" autocomplete='off' value="
|
<input id="temporary_status" class="form-control" readonly name="temporary_status" autocomplete='off'
|
||||||
<?php if ($value->status == "Approved") {
|
value="<?php if ($value->status == "Approved") {
|
||||||
echo $value->status . ' By ' . $value->approved_by . ' - ' . date('d-m-Y h:i:s', strtotime($value->approved_at));
|
echo $value->status . ' By ' . $value->approved_by . ' - ' . date('d-m-Y h:i:s', strtotime($value->approved_at));
|
||||||
} else if ($value->status == "Declined") {
|
} else if ($value->status == "Declined") {
|
||||||
echo $value->status . ' By ' . $value->decline_by . ' ( ' . $value->decline_reason . ' )';
|
echo $value->status . ' By ' . $value->decline_by . ' ( ' . $value->decline_reason . ' )';
|
||||||
} else if ($value->status == "Cancelled") {
|
} else if ($value->status == "Cancelled") {
|
||||||
echo $value->status . ' at ' . date('d-m-Y h:i:s', strtotime($value->cancelled_at));
|
echo $value->status . ' at ' . date('d-m-Y h:i:s', strtotime($value->cancelled_at));
|
||||||
} else {
|
} else {
|
||||||
echo $value->status;
|
echo trim($value->status);
|
||||||
}
|
} ?>">
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -210,7 +205,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</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">
|
<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'>
|
<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>
|
</div>
|
||||||
@ -225,11 +220,19 @@
|
|||||||
|
|
||||||
</div>
|
</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 ">
|
<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>
|
<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>
|
</div>
|
||||||
|
|
||||||
<?php if ($expense_data[0]->status == 'Draft') { ?>
|
<?php if ($expense_data[0]->status == 'Draft') { ?>
|
||||||
@ -440,8 +443,8 @@ 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 " for="first-name"> Date of Expense<a style="color:red;">*</a></label>';
|
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 += '<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="first-name"> Expense Cost <a style="color:red;">*</a></label>';
|
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 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>';
|
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 += '<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 += '<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 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>'
|
||||||
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>'
|
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>'
|
||||||
|
|||||||
@ -132,22 +132,19 @@
|
|||||||
<td style="color:#e68a00"><?php echo $value->status; ?></td>
|
<td style="color:#e68a00"><?php echo $value->status; ?></td>
|
||||||
<?php }
|
<?php }
|
||||||
else if($value->status == 'Approved'){ ?>
|
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 }
|
<?php }
|
||||||
else if($value->status == 'Declined'){ ?>
|
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>
|
<td style="color:red"><?php echo $value->status; ?> by <?php echo $value->decline_by; ?> <br><?php echo $value->decline_reason; ?></td>
|
||||||
<?php }
|
<?php }
|
||||||
else if($value->status == 'Cancelled'){ ?>
|
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 }
|
<?php }
|
||||||
else if($value->status == 'Draft'){?>
|
else if($value->status == 'Draft'){?>
|
||||||
|
|
||||||
<td style="color:#0000e6;"><?php echo $value->status; ?></td>
|
<td style="color:#0000e6;"><?php echo $value->status; ?></td>
|
||||||
|
<?php }
|
||||||
<?php } else if($value->status == 'Partially approved'){?>
|
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>
|
||||||
<td style="color:#0000e6;"><?php echo $value->status; ?></td>
|
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<td style=" text-align: center; font-size: 16px;">
|
<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>
|
<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>
|
||||||
|
|
||||||
<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>
|
<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>
|
||||||
|
|
||||||
<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>
|
<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>
|
||||||
|
|
||||||
<!-- <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> -->
|
<!-- <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> -->
|
||||||
|
|
||||||
@ -234,6 +231,7 @@ function openModal(url) {
|
|||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "<?php echo base_url()?>Expence/getCancelConfirmationPopup",
|
url: "<?php echo base_url()?>Expence/getCancelConfirmationPopup",
|
||||||
|
data: { title: "Are you sure to cancel this expense?" },
|
||||||
type:"GET",
|
type:"GET",
|
||||||
success:function(data){
|
success:function(data){
|
||||||
$('#popup').html(JSON.parse(data));
|
$('#popup').html(JSON.parse(data));
|
||||||
@ -250,6 +248,7 @@ function openModal(url) {
|
|||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "<?php echo base_url()?>Expence/getCancelConfirmationPopup",
|
url: "<?php echo base_url()?>Expence/getCancelConfirmationPopup",
|
||||||
|
data: { title: "Are you sure to submit this expense?" },
|
||||||
type:"GET",
|
type:"GET",
|
||||||
success:function(data){
|
success:function(data){
|
||||||
$('#popup').html(JSON.parse(data));
|
$('#popup').html(JSON.parse(data));
|
||||||
|
|||||||
@ -114,13 +114,16 @@
|
|||||||
<td style="color:#e68a00"><?php echo $value->status; ?></td>
|
<td style="color:#e68a00"><?php echo $value->status; ?></td>
|
||||||
<?php }
|
<?php }
|
||||||
else if($value->status == 'Approved'){ ?>
|
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 }
|
<?php }
|
||||||
else if($value->status == 'Declined'){ ?>
|
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>
|
<td style="color:red"><?php echo $value->status; ?> by <?php echo $value->decline_by; ?> <br><?php echo $value->decline_reason; ?></td>
|
||||||
<?php }
|
<?php }
|
||||||
else if($value->status == 'Cancelled'){ ?>
|
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 }
|
<?php }
|
||||||
else if($value->status == 'Draft'){?>
|
else if($value->status == 'Draft'){?>
|
||||||
|
|
||||||
|
|||||||
@ -109,7 +109,7 @@
|
|||||||
|
|
||||||
<div class="item form-group">
|
<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="col-md-5 col-sm-5 ">
|
||||||
<div class="form-group">
|
<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 />
|
<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>
|
</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="col-md-5 col-sm-5 ">
|
||||||
<div class="form-group">
|
<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>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -155,7 +155,7 @@
|
|||||||
<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; ?>">
|
||||||
|
|
||||||
</div>
|
</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 ">
|
<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'>
|
<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>
|
</div>
|
||||||
@ -171,7 +171,7 @@
|
|||||||
|
|
||||||
</div>
|
</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 ">
|
<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>
|
<input id="formFile" name="bill[]" onchange="validateFile(this)" class="typeFile" type="file" value="<?php echo $value->bill ?>" multiple>
|
||||||
</div>
|
</div>
|
||||||
@ -194,7 +194,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</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 ">
|
<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'>
|
<input id="cost" name="amount[]" required value="" class="form-control" onkeypress = "return matchnum(event)" type="number" name="middle-name" autocomplete='off'>
|
||||||
</div>
|
</div>
|
||||||
@ -208,7 +208,7 @@
|
|||||||
|
|
||||||
</div>
|
</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 ">
|
<div class="col-md-5 col-sm-5 ">
|
||||||
<input id="formFile" name="bill[]" onchange="validateFile(this)" class="typeFile" type="file" value="" multiple></div>
|
<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>
|
</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 += '<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_new[]" 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="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 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>';
|
||||||
|
|
||||||
@ -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 += '<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 += '<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 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>'
|
||||||
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>'
|
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>'
|
||||||
|
|||||||
@ -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>',
|
text: '<html><h2>Expense Approved<h2></html>',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
styling: 'bootstrap3'
|
styling: 'bootstrap3'
|
||||||
@ -101,20 +101,21 @@
|
|||||||
type: 'success',
|
type: 'success',
|
||||||
styling: 'bootstrap3'
|
styling: 'bootstrap3'
|
||||||
});">Success</button>
|
});">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');?>" >
|
<input type="hidden" id="error" value="<?php echo $this->session->userdata('Create');?>" >
|
||||||
<?php $this->session->unset_userdata('Create');?>
|
<?php $this->session->unset_userdata('Create');?>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
switch($('#error').val()){
|
||||||
if($('#error').val() == 1 )
|
case 1: $('#button').click(); break;
|
||||||
{
|
case 2: $('#button2').click(); break;
|
||||||
$('#button').click();
|
case 3: $('#button3').click(); break;
|
||||||
}
|
}
|
||||||
else if($('#error').val() == 2)
|
})
|
||||||
{
|
|
||||||
$('#button2').click();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -168,24 +169,25 @@
|
|||||||
|
|
||||||
<?php } } ?>
|
<?php } } ?>
|
||||||
<?php if($value->status == 'pending'){ ?>
|
<?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 }
|
<?php }
|
||||||
else if($value->status == 'Approved'){ ?>
|
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 }
|
<?php }
|
||||||
else if($value->status == 'Declined'){ ?>
|
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>
|
<td style="color:red"><?php echo $value->status; ?> by <?php echo $value->decline_by; ?> <br><?php echo $value->decline_reason; ?></td>
|
||||||
<?php }
|
<?php }
|
||||||
else if($value->status == 'Cancelled'){ ?>
|
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'){?>
|
<?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>
|
<td style="color:#0000e6;"><?php echo $value->status; ?></td>
|
||||||
|
<?php }
|
||||||
<?php } else if($value->status == 'Partially approved'){?>
|
else if($value->status == 'Partially approved'){?>
|
||||||
|
<td style="color:#FFCC00;"><?php echo $value->status; ?></td>
|
||||||
<td style="color:#0000e6;"><?php echo $value->status; ?></td>
|
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<td style=" text-align: center; font-size: 16px;">
|
<td style=" text-align: center; font-size: 16px;">
|
||||||
@ -198,9 +200,12 @@
|
|||||||
|
|
||||||
|
|
||||||
<?php if($value->status == 'pending') { ?>
|
<?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>
|
||||||
<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>
|
<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>
|
||||||
<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>
|
<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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <a><i class="fa fa-times test" aria-hidden="true" title="Decline" onclick="showCustomPrompt()" id= "<?php echo $value->id; ?>"></i></a> -->
|
<!-- <a><i class="fa fa-times test" aria-hidden="true" title="Decline" onclick="showCustomPrompt()" id= "<?php echo $value->id; ?>"></i></a> -->
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</td>
|
</td>
|
||||||
@ -259,6 +264,22 @@
|
|||||||
<div style="display:none" id="sub-value">
|
<div style="display:none" id="sub-value">
|
||||||
|
|
||||||
<script>
|
<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() {
|
$('.approveexpense').click(function() {
|
||||||
var id = $(this).attr('id');
|
var id = $(this).attr('id');
|
||||||
var url = "<?php echo base_url()?>Expence/Approve_Expence";
|
var url = "<?php echo base_url()?>Expence/Approve_Expence";
|
||||||
|
|||||||
@ -145,7 +145,7 @@
|
|||||||
{
|
{
|
||||||
if($expense_name[0]->status == "Approved")
|
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")
|
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>
|
<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="col-md-5 col-sm-5 ">
|
||||||
<div class="form-group">
|
<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>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -174,7 +174,9 @@
|
|||||||
</div>
|
</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>
|
<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>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -205,18 +207,19 @@
|
|||||||
<td style="color:#e68a00"><?php echo $value->status; ?></td>
|
<td style="color:#e68a00"><?php echo $value->status; ?></td>
|
||||||
<?php }
|
<?php }
|
||||||
else if($value->status == 'Approved'){ ?>
|
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 }
|
<?php }
|
||||||
else if($value->status == 'Declined'){ ?>
|
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>
|
<td style="color:red"><?php echo $value->status; ?> by <?php echo $value->decline_by; ?> <br><?php echo $value->decline_reason; ?></td>
|
||||||
<?php }
|
<?php }
|
||||||
else if($value->status == 'Cancelled'){ ?>
|
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 }
|
<?php }
|
||||||
else if($value->status == 'Draft'){?>
|
else if($value->status == 'Draft'){?>
|
||||||
|
|
||||||
<td style="color:#0000e6;"><?php echo $value->status; ?></td>
|
<td style="color:#0000e6;"><?php echo $value->status; ?></td>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<td style=" text-align: center; font-size: 16px;">
|
<td style=" text-align: center; font-size: 16px;">
|
||||||
|
|||||||
@ -91,12 +91,17 @@
|
|||||||
|
|
||||||
<li class="nav-item dropdown open" style="padding-left: 15px;">
|
<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">
|
<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) { ?>
|
<?php $defaultProfilePicture = base_url() . '/assets/uploads/profile_picture/profile.jpg';
|
||||||
<img src="<?php echo base_url(); ?>/assets/uploads/profile_picture/profile.jpg" alt="">
|
$FinalProfilePicture = "";
|
||||||
|
if(user()->profile_image == '' || user()->profile_image == null) {
|
||||||
<?php } else { ?>
|
$FinalProfilePicture = $defaultProfilePicture;
|
||||||
<img src="<?php echo base_url(); ?>/assets/uploads/profile_picture/<?php echo user()->profile_image; ?>" alt="">
|
}else{
|
||||||
<?php } ?>
|
$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; }?>
|
<?php if(check_auth() && is_admin() || is_user()){echo user()->name;}else{echo user()->name; }?>
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-menu dropdown-usermenu pull-right" aria-labelledby="navbarDropdown">
|
<div class="dropdown-menu dropdown-usermenu pull-right" aria-labelledby="navbarDropdown">
|
||||||
|
|||||||
@ -92,12 +92,18 @@
|
|||||||
|
|
||||||
<li class="nav-item dropdown open" style="padding-left: 15px;">
|
<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">
|
<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) { ?>
|
<?php $defaultProfilePicture = base_url() . '/assets/uploads/profile_picture/profile.jpg';
|
||||||
<img src="<?php echo base_url(); ?>/assets/uploads/profile_picture/profile.jpg" alt="">
|
$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 } else { ?>
|
|
||||||
<img src="<?php echo base_url(); ?>/assets/uploads/profile_picture/<?php echo user()->profile_image; ?>" alt="">
|
|
||||||
<?php } ?>
|
|
||||||
<?php if(check_auth() && is_admin() || is_user()){echo user()->name;}else{echo user()->name; }?>
|
<?php if(check_auth() && is_admin() || is_user()){echo user()->name;}else{echo user()->name; }?>
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-menu dropdown-usermenu pull-right" aria-labelledby="navbarDropdown">
|
<div class="dropdown-menu dropdown-usermenu pull-right" aria-labelledby="navbarDropdown">
|
||||||
|
|||||||
@ -30,14 +30,17 @@
|
|||||||
<!-- menu profile quick info -->
|
<!-- menu profile quick info -->
|
||||||
<div class="profile clearfix">
|
<div class="profile clearfix">
|
||||||
<div class="profile_pic">
|
<div class="profile_pic">
|
||||||
<?php if(user()->profile_image == '' || user()->profile_image == null) { ?>
|
<?php $defaultProfilePicture = base_url() . '/assets/uploads/profile_picture/profile.jpg';
|
||||||
<img src="<?php echo base_url(); ?>/assets/uploads/profile_picture/profile.jpg" alt="..." class="img-circle profile_img">
|
$FinalProfilePicture = "";
|
||||||
<?php } else { ?>
|
if(user()->profile_image == '' || user()->profile_image == null) {
|
||||||
<img src="<?php echo base_url(); ?>/assets/uploads/profile_picture/<?php echo user()->profile_image; ?>"
|
$FinalProfilePicture = $defaultProfilePicture;
|
||||||
alt="..." class="img-circle profile_img">
|
}else{
|
||||||
|
$personProfilePicture = base_url() . '/assets/uploads/profile_picture/'.user()->profile_image;
|
||||||
<?php } ?>
|
$persContents = @file_get_contents($personProfilePicture);
|
||||||
|
$FinalProfilePicture = ($persContents !== false) ? $personProfilePicture : $defaultProfilePicture;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<img src="<?php echo $FinalProfilePicture; ?>" alt="..." class="img-circle profile_img">
|
||||||
</div>
|
</div>
|
||||||
<div class="profile_info">
|
<div class="profile_info">
|
||||||
<span>Welcome,</span>
|
<span>Welcome,</span>
|
||||||
|
|||||||
@ -188,8 +188,7 @@ public function createLeave()
|
|||||||
$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('Y-m-d');
|
$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['from_date']);
|
||||||
unset($perm_data['to_date']);
|
unset($perm_data['to_date']);
|
||||||
unset($perm_data['from_date_new']);
|
unset($perm_data['from_date_new']);
|
||||||
@ -247,7 +246,7 @@ public function createLeave()
|
|||||||
$data['status'] = 'pending';
|
$data['status'] = 'pending';
|
||||||
// $data['created_date'] = date('d-m-Y');
|
// $data['created_date'] = date('d-m-Y');
|
||||||
$data['created_date_new'] = date('Y-m-d');
|
$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')));
|
$leave_year = date('Y', strtotime($this->input->post('from_date_new')));
|
||||||
|
|
||||||
//get employee's leave count
|
//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['perm_date_new'] = date('Y-m-d', strtotime($this->input->post('perm_date_new')));
|
||||||
|
|
||||||
$action['created_date'] = date('d-m-Y');
|
$action['created_date'] = date('d-m-Y');
|
||||||
$action['created_time'] = date('H:i A');
|
$action['created_time'] = date('h:i a');
|
||||||
$table="leave_list";
|
$table="leave_list";
|
||||||
$create_permission = $this->MY_Model->edit_option($action, $id, $table);
|
$create_permission = $this->MY_Model->edit_option($action, $id, $table);
|
||||||
|
|
||||||
@ -467,7 +466,6 @@ public function editleave()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
echo "else stss";
|
|
||||||
$all_leave_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
|
$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;
|
$data['leave_bal'] = $all_leave_count[0]->days;
|
||||||
$days['remaining_days'] = $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'));
|
$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)
|
if($get_from_date == 0)
|
||||||
{
|
{
|
||||||
echo"update fun:";
|
|
||||||
$table="leave_list";
|
$table="leave_list";
|
||||||
$update_leave = $this->MY_Model->edit_option($action,$id,$table);
|
$update_leave = $this->MY_Model->edit_option($action,$id,$table);
|
||||||
|
|
||||||
@ -816,7 +812,7 @@ public function dashboard()
|
|||||||
// $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);
|
$data['weekApprovedData'] = $this->Leave_model->get_week_leave_approved_count($business_id);
|
||||||
// echo print_r($data['weekData']);die;
|
// 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,6 @@
|
|||||||
<?php
|
<?php
|
||||||
class Leave_model extends MY_Model {
|
class Leave_model extends MY_Model {
|
||||||
|
// status // Approved
|
||||||
public function get_all_leave($business_id)
|
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->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,
|
YEAR(IF(A.from_date_new is not null, A.from_date_new ,A.perm_date_new)) as final_date_year,
|
||||||
GROUP_CONCAT(
|
GROUP_CONCAT(
|
||||||
CASE
|
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 ''
|
ELSE ''
|
||||||
END
|
END
|
||||||
) AS date_range,
|
) AS date_range,
|
||||||
@ -625,8 +625,7 @@ public function get_approved_leaves_cur_week()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function get_week_leave_approved_count($business_id)
|
||||||
public function get_week_leave_count($business_id)
|
|
||||||
{
|
{
|
||||||
$startOfWeek = date('Y-m-d', strtotime('monday this week'));
|
$startOfWeek = date('Y-m-d', strtotime('monday this week'));
|
||||||
$endOfWeek = date('Y-m-d', strtotime('sunday 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.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->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->join('users U1', 'U1.id = A.emp_id', 'left');
|
||||||
|
$this->db->where('A.status', 'Approved');
|
||||||
$query = $this->db->get();
|
$query = $this->db->get();
|
||||||
$leaveRecords = $query->result();
|
$leaveRecords = $query->result();
|
||||||
// echo json_encode($leaveRecords);die;
|
// echo json_encode($leaveRecords);die;
|
||||||
|
|||||||
@ -171,9 +171,9 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</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 ">
|
<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>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -394,12 +394,11 @@ function get_all_count(id) {
|
|||||||
|
|
||||||
$('#type').change(function() {
|
$('#type').change(function() {
|
||||||
|
|
||||||
var selectedOptionId = $(this).find(":selected").attr("id");
|
var selectedOptionId = $(this).find(":selected").attr("id");
|
||||||
if( selectedOptionId === 'permission'){
|
if( selectedOptionId === 'permission'){
|
||||||
|
|
||||||
$('#hidedate').hide();
|
$('#hidedate').hide();
|
||||||
$('#balance').hide();
|
$('.balance').hide();
|
||||||
$('#leave_bal').hide();
|
|
||||||
$('#fromdate').removeAttr('required');
|
$('#fromdate').removeAttr('required');
|
||||||
$('#todate').removeAttr('required');
|
$('#todate').removeAttr('required');
|
||||||
$('#perm_id').prop('required', true);
|
$('#perm_id').prop('required', true);
|
||||||
@ -416,8 +415,7 @@ function get_all_count(id) {
|
|||||||
$('#hidedate').show();
|
$('#hidedate').show();
|
||||||
$('#showtime').hide();
|
$('#showtime').hide();
|
||||||
$('#showdate').hide();
|
$('#showdate').hide();
|
||||||
$('#balance').show();
|
$('.balance').show();
|
||||||
$('#leave_bal').show();
|
|
||||||
$('#fromdate').prop('required', true);
|
$('#fromdate').prop('required', true);
|
||||||
$('#todate').prop('required', true);
|
$('#todate').prop('required', true);
|
||||||
}
|
}
|
||||||
@ -453,55 +451,47 @@ function get_all_count(id) {
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(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++) {
|
var selectField = $('#from_time');
|
||||||
selectField.append('<option value="' + options[i] + '">' + options[i] + '</option>');
|
selectField.on('click', function() {
|
||||||
}
|
var selectedValue = $(this).val();
|
||||||
});
|
|
||||||
|
|
||||||
var selectField = $('#from_time');
|
// 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'];
|
||||||
selectField.on('click', function() {
|
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) {
|
||||||
var selectedValue = $(this).val();
|
// Find the index of the starting time in the array
|
||||||
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
|
|
||||||
console.log(startingTime,numberOfHours);
|
console.log(startingTime,numberOfHours);
|
||||||
const startIndex = timeSlots.findIndex(time => time === startingTime);
|
const startIndex = timeSlots.findIndex(time => time === startingTime);
|
||||||
console.log(startIndex);
|
console.log(startIndex);
|
||||||
if (startIndex !== -1) {
|
if (startIndex !== -1) {
|
||||||
|
const endIndex = startIndex + (numberOfHours * 2) - 1;
|
||||||
|
return timeSlots.slice(startIndex, endIndex + 2);
|
||||||
|
}else{ return []; }
|
||||||
|
}
|
||||||
|
|
||||||
const endIndex = startIndex + (numberOfHours * 2) - 1;
|
// Usage example
|
||||||
|
const startingTime = selectedValue;
|
||||||
|
const numberOfHours = 2 ;
|
||||||
|
const filteredTimeSlots = filterTimeSlots(startingTime, numberOfHours);
|
||||||
|
|
||||||
return timeSlots.slice(startIndex, endIndex + 2);
|
filteredTimeSlots.shift();
|
||||||
}
|
var totime = $('#to_time');
|
||||||
return [];
|
totime.empty();
|
||||||
}
|
for (var i = 0; i < filteredTimeSlots.length; i++) {
|
||||||
|
totime.append('<option value="' + filteredTimeSlots[i] + '">' + filteredTimeSlots[i] + '</option>');
|
||||||
|
|
||||||
// Usage example
|
}
|
||||||
const startingTime = selectedValue;
|
console.log(filteredTimeSlots);
|
||||||
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);
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@ -97,17 +97,17 @@
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
// Remove duplicate
|
// Remove duplicate
|
||||||
foreach ($weekData as &$dayData) {
|
foreach ($weekApprovedData as &$dayData) {
|
||||||
$dayData = array_unique($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 '<tr>';
|
||||||
echo '<td>' . implode(',<br>', $weekData['monday']) . '</td>';
|
echo '<td>' . implode(',<br>', $weekApprovedData['monday']) . '</td>';
|
||||||
echo '<td>' . implode(',<br>', $weekData['tuesday']) . '</td>';
|
echo '<td>' . implode(',<br>', $weekApprovedData['tuesday']) . '</td>';
|
||||||
echo '<td>' . implode(',<br>', $weekData['wednesday']) . '</td>';
|
echo '<td>' . implode(',<br>', $weekApprovedData['wednesday']) . '</td>';
|
||||||
echo '<td>' . implode(',<br>', $weekData['thursday']) . '</td>';
|
echo '<td>' . implode(',<br>', $weekApprovedData['thursday']) . '</td>';
|
||||||
echo '<td>' . implode(',<br>', $weekData['friday']) . '</td>';
|
echo '<td>' . implode(',<br>', $weekApprovedData['friday']) . '</td>';
|
||||||
echo '<td>' . implode(',<br>', $weekData['saturday']) . '</td>';
|
echo '<td>' . implode(',<br>', $weekApprovedData['saturday']) . '</td>';
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -141,9 +141,9 @@
|
|||||||
|
|
||||||
</div>
|
</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 ">
|
<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>
|
||||||
|
|
||||||
</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>
|
<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 ">
|
<div class="col-md-2 col-sm-2 ">
|
||||||
<select class="custom-select" id="from_time" name=from_time required >
|
<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>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<label class="control-label col-md-1 col-sm-1 " for="last-name">To<a style="color:red;">*</a> </label>
|
<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 ">
|
<div class="col-md-2 col-sm-2 ">
|
||||||
<select id="to_time" class="custom-select" name="to_time" required>
|
<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>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -445,9 +445,8 @@ function calculateDateDifference() {
|
|||||||
|
|
||||||
if( id === 'permission' ){
|
if( id === 'permission' ){
|
||||||
|
|
||||||
$('#hidedate').hide()
|
$('#hidedate').hide();
|
||||||
$('#balance').hide()
|
$('.balance').hide();
|
||||||
$('#leave_bal').hide()
|
|
||||||
$('#fromdate').removeAttr('required');
|
$('#fromdate').removeAttr('required');
|
||||||
$('#todate').removeAttr('required');
|
$('#todate').removeAttr('required');
|
||||||
$('#showtime').show();
|
$('#showtime').show();
|
||||||
@ -461,8 +460,8 @@ function calculateDateDifference() {
|
|||||||
$('#hidedate').show();
|
$('#hidedate').show();
|
||||||
$('#showtime').hide();
|
$('#showtime').hide();
|
||||||
$('#showdate').hide();
|
$('#showdate').hide();
|
||||||
$('#balance').show()
|
$('.balance').show();
|
||||||
$('#leave_bal').show()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,8 +481,7 @@ function calculateDateDifference() {
|
|||||||
if( selectedOptionId === 'permission'){
|
if( selectedOptionId === 'permission'){
|
||||||
|
|
||||||
$('#hidedate').hide();
|
$('#hidedate').hide();
|
||||||
$('#balance').hide();
|
$('.balance').hide();
|
||||||
$('#leave_bal').hide();
|
|
||||||
$('#fromdate').removeAttr('required');
|
$('#fromdate').removeAttr('required');
|
||||||
$('#todate').removeAttr('required');
|
$('#todate').removeAttr('required');
|
||||||
$('#myDatepicker').prop('required', true);
|
$('#myDatepicker').prop('required', true);
|
||||||
@ -500,8 +498,7 @@ function calculateDateDifference() {
|
|||||||
$('#hidedate').show();
|
$('#hidedate').show();
|
||||||
$('#showtime').hide();
|
$('#showtime').hide();
|
||||||
$('#showdate').hide();
|
$('#showdate').hide();
|
||||||
$('#balance').show();
|
$('.balance').show();
|
||||||
$('#leave_bal').show();
|
|
||||||
$('#fromdate').prop('required', true);
|
$('#fromdate').prop('required', true);
|
||||||
$('#todate').prop('required', true);
|
$('#todate').prop('required', true);
|
||||||
}
|
}
|
||||||
@ -510,53 +507,70 @@ function calculateDateDifference() {
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var selectField = $('#from_time');
|
var selectField = $('#from_time');
|
||||||
|
var selectToField = $('#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 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 = [ '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++) {
|
for (var i = 0; i < options.length; i++) {
|
||||||
selectField.append('<option value="' + options[i] + '">' + options[i] + '</option>');
|
selectField.append('<option value="' + options[i] + '"' + ((SelectedFromTime !== '' && options[i] === SelectedFromTime) ? ' selected' : '') + '>' + options[i] + '</option>');
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
var selectField = $('#from_time');
|
|
||||||
selectField.on('click', function() {
|
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.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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();
|
var selectedValue = $(this).val();
|
||||||
console.log(selectedValue);
|
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) {
|
filteredTimeSlots.shift();
|
||||||
// Find the index of the starting time in the array
|
var totime = $('#to_time');
|
||||||
console.log(startingTime,numberOfHours);
|
totime.empty();
|
||||||
const startIndex = timeSlots.findIndex(time => time === startingTime);
|
for (var i = 0; i < filteredTimeSlots.length; i++) {
|
||||||
console.log(startIndex);
|
totime.append('<option value="' + filteredTimeSlots[i] + '">' + filteredTimeSlots[i] + '</option>');
|
||||||
if (startIndex !== -1) {
|
}
|
||||||
|
|
||||||
const endIndex = startIndex + (numberOfHours * 2) - 1;
|
console.log(filteredTimeSlots);
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -241,7 +241,7 @@ public function preprocessTemplateData($leaveData, $templateData){
|
|||||||
else{
|
else{
|
||||||
if(empty($managerName->name)){
|
if(empty($managerName->name)){
|
||||||
$fromDate = date('d-m-Y', strtotime($leaveData->from_date_new));
|
$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];
|
$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));
|
$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 = [$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) {
|
foreach ($placeholders as $index => $placeholder) {
|
||||||
$result[] = ['placeholder' => '[' . trim($placeholder, '[]') . ']', 'strval' => $values[$index]];
|
$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);
|
return $body = replaceTemplateWithData($templateData->content,$result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.0 KiB |
Loading…
Reference in New Issue
Block a user