tracker issue leave expence asset emp leave
This commit is contained in:
parent
517611d8e4
commit
2f8556de64
@ -75,14 +75,14 @@
|
||||
|
||||
$db['default'] = array(
|
||||
'dsn' => '',
|
||||
// 'hostname' => 'localhost',
|
||||
// 'username' => 'root',
|
||||
// 'password' => '',
|
||||
// 'database' => 'test',
|
||||
'hostname' => '119.18.54.85',
|
||||
'username' => 'venbaehn_ams',
|
||||
'password' => 'L;nD7Z@f)1ZT',
|
||||
'database' => 'venbaehn_ams',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'root',
|
||||
'password' => '',
|
||||
'database' => 'testbbone',
|
||||
// 'hostname' => '119.18.54.85',
|
||||
// 'username' => 'venbaehn_ams',
|
||||
// 'password' => 'L;nD7Z@f)1ZT',
|
||||
// 'database' => 'venbaehn_ams',
|
||||
'dbdriver' => 'mysqli',
|
||||
'dbprefix' => '',
|
||||
'pconnect' => FALSE,
|
||||
|
||||
@ -38,14 +38,14 @@ public function __construct()
|
||||
//print_r($business);die();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->layout->set('users', "gowtham");
|
||||
$this->layout->buffer('main_content', 'Asset/index');
|
||||
$this->layout->render('default_layout');
|
||||
$this->layout->render('default_layout');
|
||||
}
|
||||
|
||||
|
||||
public function addAsset($id='empty')
|
||||
{
|
||||
if($id != 'empty')
|
||||
@ -58,10 +58,10 @@ public function addAsset($id='empty')
|
||||
$this->layout->set('locationsData', $this->MY_Model->select_by_business_id('locations',user()->business_id));
|
||||
$this->layout->set('categoriesData', $this->MY_Model->select_by_business_id('categories',user()->business_id));
|
||||
$this->layout->set('statusData', $this->MY_Model->select('status'));
|
||||
|
||||
|
||||
$this->layout->buffer('main_content', 'Asset/add_asset');
|
||||
$this->layout->render('default_layout');
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function assetLandingPage()
|
||||
@ -71,12 +71,12 @@ public function assetLandingPage()
|
||||
$this->layout->set('tableData', $assets_list);
|
||||
$this->layout->buffer('main_content', 'Asset/asset_landing_page');
|
||||
$this->layout->render('default_layout');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function assetList($category , $purchase_date_from = null , $purchase_date_to = null)
|
||||
{
|
||||
|
||||
|
||||
$table = 'asset';
|
||||
$assets_list = $this->Asset_model->get_assets(user()->business_id , $category );
|
||||
foreach ($assets_list as $key => $value) {
|
||||
@ -94,13 +94,13 @@ public function assetList($category , $purchase_date_from = null , $purchase_dat
|
||||
// echo $nxt_year;die();
|
||||
// echo $interval->y; die();
|
||||
// year intervel greater than 0
|
||||
if($interval->y > 0)
|
||||
if($interval->y > 0)
|
||||
{
|
||||
$curr_month = date('n', strtotime($value->purchase_date));
|
||||
|
||||
|
||||
// echo $curr_month;die();
|
||||
$month_array_for_50_percentage = array(10 , 11 , 12 , 1 , 2 ,3);
|
||||
if (in_array($curr_month, $month_array_for_50_percentage) && date('Y-m-d') > $nxt_year)
|
||||
if (in_array($curr_month, $month_array_for_50_percentage) && date('Y-m-d') > $nxt_year)
|
||||
{
|
||||
$cost = $value->cost;
|
||||
// get depreciation value
|
||||
@ -111,8 +111,8 @@ public function assetList($category , $purchase_date_from = null , $purchase_dat
|
||||
$cost = abs($depreciate_value - $cost);
|
||||
// echo $cost;die();
|
||||
$category_percentage = $this->Asset_model->get_by_category_id($value->category);
|
||||
for ($i=0 ; $i < $interval->y ; $i++)
|
||||
{
|
||||
for ($i=0 ; $i < $interval->y ; $i++)
|
||||
{
|
||||
// $category_percentage = $this->Asset_model->get_by_category_id($value->category);
|
||||
$category_per = $category_percentage[0]['depreciation_percentage'];
|
||||
$depreciate_value = $cost * $category_per / 100;
|
||||
@ -134,8 +134,8 @@ public function assetList($category , $purchase_date_from = null , $purchase_dat
|
||||
// $cost = $value->cost;
|
||||
// get depreciation value
|
||||
$category_percentage = $this->Asset_model->get_by_category_id($value->category);
|
||||
for ($i=0 ; $i < $interval->y ; $i++)
|
||||
{
|
||||
for ($i=0 ; $i < $interval->y ; $i++)
|
||||
{
|
||||
$category_per = $category_percentage[0]['depreciation_percentage'];
|
||||
$depreciate_value = $cost * $category_per / 100;
|
||||
// echo $depreciate_value; die();
|
||||
@ -143,14 +143,14 @@ public function assetList($category , $purchase_date_from = null , $purchase_dat
|
||||
$editCurrentValue = $this->MY_Model->edit_option($data, $value->id, $table);
|
||||
$cost = abs($depreciate_value - $cost);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// year intervel less than 0
|
||||
else
|
||||
else
|
||||
{
|
||||
$curr_month = date('n', strtotime($value->purchase_date));
|
||||
$month_array_for_50_percentage = array(10 , 11 , 12 , 1 , 2 , 3);
|
||||
if (in_array($curr_month, $month_array_for_50_percentage))
|
||||
if (in_array($curr_month, $month_array_for_50_percentage))
|
||||
{
|
||||
$cost = $value->cost;
|
||||
// get depreciation value
|
||||
@ -183,19 +183,19 @@ public function assetList($category , $purchase_date_from = null , $purchase_dat
|
||||
$this->layout->set('tableData', $assets_list);
|
||||
$this->layout->buffer('main_content', 'Asset/asset_list');
|
||||
$this->layout->render('default_layout');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function createAssets()
|
||||
{
|
||||
|
||||
|
||||
$data=$this->input->post();
|
||||
$data['business_id'] = user()->business_id;
|
||||
$data['created_by'] = user()->name;
|
||||
$date = date_create($this->input->post('purchase_date'));
|
||||
$data['purchase_date'] = date_format($date,"Y-m-d");
|
||||
|
||||
|
||||
//file upload confic
|
||||
$asset_image['upload_path'] = APPPATH. '../assets/uploads/';
|
||||
$asset_image['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
@ -210,10 +210,10 @@ public function createAssets()
|
||||
$upload_asset_image = $this->upload->data();
|
||||
$data['asset_img'] = $upload_asset_image['file_name'];
|
||||
}
|
||||
|
||||
|
||||
$table="asset";
|
||||
|
||||
|
||||
|
||||
|
||||
//create asset
|
||||
$create_assets = $this->MY_Model->insert($data,$table);
|
||||
|
||||
@ -230,17 +230,17 @@ public function createAssets()
|
||||
$this->audit->set('table',$table);
|
||||
//fetch new_data after post data insert
|
||||
$this->audit->fetch('new_data');
|
||||
//audit history generation for insert
|
||||
//audit history generation for insert
|
||||
$test = $this->audit->create_history('insert');
|
||||
}
|
||||
|
||||
|
||||
redirect('Asset/assetList/'.md5($this->input->post('category')));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function editAsset($id)
|
||||
{
|
||||
{
|
||||
//select dropdown values
|
||||
$this->layout->set('manufacturerData', $this->MY_Model->select_by_business_id_and_type('third_parties',user()->business_id,1));
|
||||
$this->layout->set('suppliorData', $this->MY_Model->select_by_business_id_and_type('third_parties',user()->business_id,2));
|
||||
@ -262,19 +262,19 @@ public function editAsset($id)
|
||||
$this->layout->set('editData', $assetData);
|
||||
$this->layout->buffer('main_content', 'Asset/edit_asset');
|
||||
$this->layout->render('default_layout');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function editAssets()
|
||||
{
|
||||
|
||||
$table="asset";
|
||||
$action = $this->input->post();
|
||||
|
||||
|
||||
$date = date_create($this->input->post('purchase_date'));
|
||||
$action['purchase_date'] = date_format($date,"Y-m-d");
|
||||
|
||||
|
||||
|
||||
|
||||
$id = $this->input->post('id');
|
||||
//file upload confic
|
||||
$asset_image['upload_path'] = APPPATH. '../assets/uploads/';
|
||||
@ -286,14 +286,14 @@ public function editAssets()
|
||||
if ( ! $this->upload->do_upload('asset_img'))
|
||||
{
|
||||
$error = array('error' => $this->upload->display_errors());
|
||||
|
||||
|
||||
unset($action['asset_img']);
|
||||
} else{
|
||||
$upload_asset_image = $this->upload->data();
|
||||
$action['asset_img'] = $upload_asset_image['file_name'];
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// print_r( $action);die();
|
||||
//set id $ table name for audit history
|
||||
$this->audit->set('id',$this->input->post('id'));
|
||||
@ -306,11 +306,11 @@ public function editAssets()
|
||||
{
|
||||
//fetch new_data after post data update
|
||||
$this->audit->fetch('new_data');
|
||||
//audit history generation for update
|
||||
//audit history generation for update
|
||||
$test = $this->audit->create_history('update');
|
||||
}
|
||||
redirect('Asset/assetList/'.md5($this->input->post('category')));
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function deleteAsset()
|
||||
@ -320,7 +320,7 @@ public function deleteAsset()
|
||||
$Data = $this->Asset_model->delete_by_md5_id($id,user()->business_id,'asset');
|
||||
redirect('Asset/assetList/'.md5($assetdata->category));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function deleteMultipleAsset()
|
||||
{
|
||||
@ -342,16 +342,16 @@ public function view_qrcode()
|
||||
array_push($output , $qr);
|
||||
}
|
||||
$data['data'] = $output;
|
||||
$data['htmlPage'] = $this->load->view('view_qr.php',$data,true);
|
||||
$data['htmlPage'] = $this->load->view('view_qr.php',$data,true);
|
||||
$data['csrf_hash'] = $this->security->get_csrf_hash();
|
||||
echo json_encode($data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function view_asset_details($id)
|
||||
{
|
||||
$tab = $this->session->flashdata();
|
||||
{
|
||||
// $tab = $this->session->flashdata();
|
||||
// $tab = 1;
|
||||
//print_r($tab);die();
|
||||
// select asset value by id
|
||||
@ -371,16 +371,16 @@ public function view_asset_details($id)
|
||||
$this->layout->set('viewData', 1);
|
||||
$this->layout->buffer('main_content', 'Asset/edit_asset');
|
||||
$this->layout->render('default_layout');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// public function getAssetDetails($id)
|
||||
// {
|
||||
// $asset_value = $this->Asset_model->get_by_asset_id($id,'asset_value',user()->business_id);
|
||||
// $asset_usage = $this->Asset_model->get_by_asset_id($id,'asset_usage',user()->business_id);
|
||||
// $asset_amc = $this->Asset_model->get_by_asset_id($id,'amc',user()->business_id);
|
||||
// $data = array('asset_value' => $asset_value ,'asset_usage' => $asset_usage , 'asset_amc' =>$asset_amc);
|
||||
|
||||
|
||||
// $htmlPage = $this->load->view('asset_sub_value_list.php',$data,true);
|
||||
// echo json_encode($htmlPage);
|
||||
// }
|
||||
@ -389,18 +389,18 @@ public function view_asset_details($id)
|
||||
|
||||
public function getAssetValueForm($id)
|
||||
{
|
||||
|
||||
|
||||
$split = preg_split('/_/', $id);
|
||||
if(count($split) > 1)
|
||||
{
|
||||
{
|
||||
$data = array('asset_id'=> $split[0], 'heading'=>'Add Asset Value' , 'submit_button_title'=>'Submit');
|
||||
}else{
|
||||
$asset_value_data = $this->MY_Model->get_by_md5_id($id,'asset_value');
|
||||
$data = array('assetValueData'=>$asset_value_data ,'heading'=>'Edit Asset Value' , 'submit_button_title'=>'Update');
|
||||
}
|
||||
|
||||
|
||||
$htmlPage = $this->load->view('asset_value_form.php',$data,true);
|
||||
echo json_encode($htmlPage);
|
||||
echo json_encode($htmlPage);
|
||||
}
|
||||
|
||||
|
||||
@ -411,7 +411,7 @@ public function add_or_edit_asset_value()
|
||||
{
|
||||
$value = $this->input->post();
|
||||
unset($value['asset_id_for_add']);
|
||||
|
||||
|
||||
//set id $ table name for audit history
|
||||
$this->audit->set('id',$this->input->post('id'));
|
||||
$this->audit->set('table','asset_value');
|
||||
@ -423,10 +423,10 @@ public function add_or_edit_asset_value()
|
||||
{
|
||||
//fetch new_data after post data update
|
||||
$this->audit->fetch('new_data');
|
||||
//audit history generation for update
|
||||
//audit history generation for update
|
||||
$this->audit->create_history('update');
|
||||
}
|
||||
|
||||
|
||||
$this->session->set_flashdata('msg', "asset_value");
|
||||
redirect('Asset/view_asset_details/'.md5($this->input->post('asset_id')));
|
||||
}else{
|
||||
@ -456,23 +456,23 @@ public function add_or_edit_asset_value()
|
||||
$this->audit->set('table','asset_value');
|
||||
//fetch new_data after post data insert
|
||||
$this->audit->fetch('new_data');
|
||||
//audit history generation for insert
|
||||
//audit history generation for insert
|
||||
$this->audit->create_history('insert');
|
||||
}
|
||||
$this->session->set_flashdata(1); $this->session->set_flashdata('msg', "asset_value");
|
||||
redirect('Asset/view_asset_details/'.md5($this->input->post('asset_id_for_add')));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function getAssetUsageForm($id)
|
||||
{
|
||||
$split = preg_split('/_/', $id);
|
||||
|
||||
|
||||
if(count($split) > 1)
|
||||
{
|
||||
{
|
||||
//month year for dropdown
|
||||
$date_output = array();
|
||||
$start = new DateTime;
|
||||
@ -502,9 +502,9 @@ public function getAssetUsageForm($id)
|
||||
$asset_usage_data = $this->MY_Model->get_by_md5_id($id,'asset_usage');
|
||||
$data = array('assetUsageData'=>$asset_usage_data ,'heading'=>'Edit Asset Usage' , 'submit_button_title'=>'Update');
|
||||
}
|
||||
|
||||
|
||||
$htmlPage = $this->load->view('asset_usage_form.php',$data,true);
|
||||
echo json_encode($htmlPage);
|
||||
echo json_encode($htmlPage);
|
||||
}
|
||||
|
||||
|
||||
@ -514,7 +514,7 @@ public function add_or_edit_asset_usage()
|
||||
{
|
||||
$value = $this->input->post();
|
||||
unset($value['asset_id_for_add']);
|
||||
|
||||
|
||||
//set id $ table name for audit history
|
||||
$this->audit->set('id',$this->input->post('id'));
|
||||
$this->audit->set('table','asset_usage');
|
||||
@ -526,7 +526,7 @@ public function add_or_edit_asset_usage()
|
||||
{
|
||||
//fetch new_data after post data update
|
||||
$this->audit->fetch('new_data');
|
||||
//audit history generation for update
|
||||
//audit history generation for update
|
||||
$this->audit->create_history('update');
|
||||
}
|
||||
$this->session->set_flashdata('msg', "asset_usage");
|
||||
@ -547,7 +547,7 @@ public function add_or_edit_asset_usage()
|
||||
$this->audit->set('table','asset_usage');
|
||||
//fetch new_data after post data insert
|
||||
$this->audit->fetch('new_data');
|
||||
//audit history generation for insert
|
||||
//audit history generation for insert
|
||||
$this->audit->create_history('insert');
|
||||
}
|
||||
$this->session->set_flashdata('msg', "asset_usage");
|
||||
@ -564,15 +564,15 @@ public function getAssetAMCForm($id)
|
||||
$split = preg_split('/_/', $id);
|
||||
$serviceProviderData = $this->MY_Model->select_by_business_id_and_type('third_parties',user()->business_id,3);
|
||||
if(count($split) > 1)
|
||||
{
|
||||
{
|
||||
$data = array('asset_id'=> $split[0], 'serviceProviderData'=>$serviceProviderData, 'heading'=>'Add AMC' , 'submit_button_title'=>'Submit');
|
||||
}else{
|
||||
$asset_amc_data = $this->Asset_model->get_amc_by_id_with_join($id);
|
||||
$data = array('serviceProviderData'=>$serviceProviderData,'assetAMCData'=>$asset_amc_data ,'heading'=>'Edit AMC' , 'submit_button_title'=>'Update');
|
||||
}
|
||||
|
||||
|
||||
$htmlPage = $this->load->view('asset_amc_form.php',$data,true);
|
||||
echo json_encode($htmlPage);
|
||||
echo json_encode($htmlPage);
|
||||
}
|
||||
|
||||
|
||||
@ -586,7 +586,7 @@ public function add_or_edit_asset_amc()
|
||||
$valid_to = date_create($this->input->post('valid_to'));
|
||||
$value['valid_to'] = date_format($valid_to,"Y-m-d");
|
||||
unset($value['asset_id_for_add']);
|
||||
|
||||
|
||||
//set id $ table name for audit history
|
||||
$this->audit->set('id',$this->input->post('id'));
|
||||
$this->audit->set('table','amc');
|
||||
@ -598,7 +598,7 @@ public function add_or_edit_asset_amc()
|
||||
{
|
||||
//fetch new_data after post data update
|
||||
$this->audit->fetch('new_data');
|
||||
//audit history generation for update
|
||||
//audit history generation for update
|
||||
$this->audit->create_history('update');
|
||||
}
|
||||
$this->session->set_flashdata('msg', "asset_amc");
|
||||
@ -615,7 +615,7 @@ public function add_or_edit_asset_amc()
|
||||
$data['valid_to'] = date_format($valid_to,"Y-m-d");
|
||||
$data['created_by'] = user()->id;
|
||||
$data['type'] = 3; //(amc service provider type = 3 * in third_parties table)
|
||||
|
||||
|
||||
$createAMCData = $this->MY_Model->insert($data, 'amc');
|
||||
if($createAMCData)
|
||||
{
|
||||
@ -624,7 +624,7 @@ public function add_or_edit_asset_amc()
|
||||
$this->audit->set('table','amc');
|
||||
//fetch new_data after post data insert
|
||||
$this->audit->fetch('new_data');
|
||||
//audit history generation for insert
|
||||
//audit history generation for insert
|
||||
$this->audit->create_history('insert');
|
||||
}
|
||||
$this->session->set_flashdata('msg', "asset_amc");
|
||||
@ -639,15 +639,15 @@ public function getAssetInsuranceForm($id)
|
||||
$split = preg_split('/_/', $id);
|
||||
$insuranceData = $this->MY_Model->select_by_business_id_and_type('third_parties',user()->business_id,4);
|
||||
if(count($split) > 1)
|
||||
{
|
||||
{
|
||||
$data = array('asset_id'=> $split[0], 'insuranceData'=>$insuranceData, 'heading'=>'Add Insurence' , 'submit_button_title'=>'Submit');
|
||||
}else{
|
||||
$asset_insurance_data = $this->Asset_model->get_insurance_by_id_with_join($id);
|
||||
$data = array('insuranceData'=>$insuranceData,'assetInsuranceData'=>$asset_insurance_data ,'heading'=>'Edit Insurence' , 'submit_button_title'=>'Update');
|
||||
}
|
||||
|
||||
|
||||
$htmlPage = $this->load->view('asset_insurance_form.php',$data,true);
|
||||
echo json_encode($htmlPage);
|
||||
echo json_encode($htmlPage);
|
||||
}
|
||||
|
||||
|
||||
@ -663,7 +663,7 @@ public function add_or_edit_asset_insurance()
|
||||
$valid_to = date_create($this->input->post('valid_to'));
|
||||
$value['valid_to'] = date_format($valid_to,"Y-m-d");
|
||||
unset($value['asset_id_for_add']);
|
||||
|
||||
|
||||
//set id $ table name for audit history
|
||||
$this->audit->set('id',$this->input->post('id'));
|
||||
$this->audit->set('table','amc');
|
||||
@ -675,7 +675,7 @@ public function add_or_edit_asset_insurance()
|
||||
{
|
||||
//fetch new_data after post data update
|
||||
$this->audit->fetch('new_data');
|
||||
//audit history generation for update
|
||||
//audit history generation for update
|
||||
$this->audit->create_history('update');
|
||||
}
|
||||
$this->session->set_flashdata('msg', "asset_insurance");
|
||||
@ -700,34 +700,34 @@ public function add_or_edit_asset_insurance()
|
||||
$this->audit->set('table','amc');
|
||||
//fetch new_data after post data insert
|
||||
$this->audit->fetch('new_data');
|
||||
//audit history generation for insert
|
||||
//audit history generation for insert
|
||||
$this->audit->create_history('insert');
|
||||
}
|
||||
$this->session->set_flashdata('msg', "asset_insurance");
|
||||
redirect('Asset/view_asset_details/'.md5($this->input->post('asset_id_for_add')));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function getAssetImageForm($id)
|
||||
{
|
||||
|
||||
|
||||
$data = array('asset_id'=> $id, 'heading'=>'Add File' , 'submit_button_title'=>'Submit');
|
||||
$htmlPage = $this->load->view('asset_image_form.php',$data,true);
|
||||
echo json_encode($htmlPage);
|
||||
echo json_encode($htmlPage);
|
||||
}
|
||||
|
||||
public function add_asset_image()
|
||||
{
|
||||
|
||||
|
||||
$data['business_id'] = user()->business_id;
|
||||
$data['created_by'] = user()->id;
|
||||
$data['asset_id'] = $this->input->post('asset_id');
|
||||
|
||||
|
||||
//file upload confic
|
||||
$asset_image['upload_path'] = APPPATH. '../assets/uploads/';
|
||||
$asset_image['allowed_types'] = 'gif|jpg|png|jpeg|pdf';
|
||||
@ -747,7 +747,7 @@ public function add_asset_image()
|
||||
$create_assets = $this->MY_Model->insert($data,$table);
|
||||
$this->session->set_flashdata('msg', "asset_image");
|
||||
redirect('Asset/view_asset_details/'.md5($this->input->post('asset_id')));
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function deleteAssetValue($id)
|
||||
@ -806,31 +806,31 @@ public function depreciation_report()
|
||||
$this->layout->set('tableData', $Data);
|
||||
$this->layout->buffer('main_content', 'Asset/depreciation_list');
|
||||
$this->layout->render('default_layout');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function amc_report()
|
||||
{
|
||||
$Data = $this->Asset_model->amc_insurance_report(3,user()->business_id);
|
||||
$this->layout->set('tableData', $Data);
|
||||
$this->layout->buffer('main_content', 'Asset/amc_reports_list');
|
||||
$this->layout->render('default_layout');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function insurance_report()
|
||||
{
|
||||
$Data = $this->Asset_model->amc_insurance_report(4,user()->business_id);
|
||||
$this->layout->set('tableData', $Data);
|
||||
$this->layout->buffer('main_content', 'Asset/insurance_reports_list');
|
||||
$this->layout->render('default_layout');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function masterDataList()
|
||||
{
|
||||
$this->layout->set('manufacturerData', $this->Asset_model->get_third_party_value_by_md5_id(user()->business_id,1));
|
||||
@ -844,29 +844,29 @@ public function masterDataList()
|
||||
$this->layout->set('enum_value', $this->MY_Model->select_by_department_data('enum',user()->business_id));
|
||||
$this->layout->buffer('main_content', 'Asset/master_list');
|
||||
$this->layout->render('default_layout');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getThirdPartyForm($id)
|
||||
{
|
||||
|
||||
|
||||
$state = $this->MY_Model->select('state');
|
||||
if ($id == "manufacture") {
|
||||
$data = array('heading'=> "Manufacturer Details", 'type' => 1 , 'states' => $state , 'submit_button_title'=>'Add' );
|
||||
$htmlPage = $this->load->view('third_party_master_form.php',$data,true);
|
||||
echo json_encode($htmlPage);
|
||||
}
|
||||
}
|
||||
else if ($id == "supplier") {
|
||||
$data = array('heading'=> "supplier Details", 'type' => 2 , 'states' => $state , 'submit_button_title'=>'Add' );
|
||||
$htmlPage = $this->load->view('third_party_master_form.php',$data,true);
|
||||
echo json_encode($htmlPage);
|
||||
}
|
||||
}
|
||||
else if ($id == "service_privoder") {
|
||||
$data = array('heading'=> "Service Privoder Details", 'type' => 3 , 'states' => $state , 'submit_button_title'=>'Add' );
|
||||
$htmlPage = $this->load->view('third_party_master_form.php',$data,true);
|
||||
echo json_encode($htmlPage);
|
||||
}
|
||||
}
|
||||
else if ($id == "insurence") {
|
||||
$data = array('heading'=> "Insurence Details", 'type' => 4 , 'states' => $state , 'submit_button_title'=>'Add' );
|
||||
$htmlPage = $this->load->view('third_party_master_form.php',$data,true);
|
||||
@ -879,8 +879,8 @@ public function getThirdPartyForm($id)
|
||||
$htmlPage = $this->load->view('third_party_master_form.php',$data,true);
|
||||
echo json_encode($htmlPage);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -900,7 +900,7 @@ public function add_or_edit_ThirdPartyForm()
|
||||
// $this->session->set_flashdata('msg', $type);
|
||||
redirect('Asset/masterDataList');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getLocationForm($id)
|
||||
@ -936,7 +936,7 @@ public function add_or_edit_LocationForm()
|
||||
// $this->session->set_flashdata('msg', "location");
|
||||
redirect('Asset/masterDataList');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -975,7 +975,7 @@ public function add_or_edit_CategoriesForm()
|
||||
// $this->session->set_flashdata('msg', "categories");
|
||||
redirect('Asset/masterDataList');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getDepartmentForm($id)
|
||||
@ -1013,7 +1013,7 @@ public function add_or_edit_DepartmentForm()
|
||||
// $this->session->set_flashdata('msg', "department");
|
||||
redirect('Asset/masterDataList');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function deleteDepartmentFormData()
|
||||
@ -1063,7 +1063,7 @@ public function add_or_edit_LeaveForm()
|
||||
// $this->session->set_flashdata('msg', "leave");
|
||||
redirect('Asset/masterDataList');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function deleteLeaveFormData()
|
||||
@ -1075,7 +1075,7 @@ public function deleteLeaveFormData()
|
||||
redirect('Asset/masterDataList');
|
||||
}
|
||||
|
||||
/// decline reason
|
||||
/// decline reason
|
||||
|
||||
public function getDeclineForm($id)
|
||||
{
|
||||
@ -1112,7 +1112,7 @@ public function add_or_edit_DeclineForm()
|
||||
// $this->session->set_flashdata('msg', "decline");
|
||||
redirect('Asset/masterDataList');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1126,7 +1126,7 @@ public function deleteDeclineFormData()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function deleteThirdPartyData()
|
||||
{
|
||||
@ -1153,7 +1153,7 @@ public function getDeleteConfirmationPopup()
|
||||
{
|
||||
$data = array();
|
||||
$htmlPage = $this->load->view('confirmation_popup.php',$data,true);
|
||||
echo json_encode($htmlPage);
|
||||
echo json_encode($htmlPage);
|
||||
}
|
||||
|
||||
public function filterAssets()
|
||||
|
||||
@ -27,15 +27,15 @@
|
||||
</div>
|
||||
<div class="x_content">
|
||||
<br />
|
||||
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url();?>Asset/createAssets" enctype="multipart/form-data">
|
||||
<form id="myForm" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url();?>Asset/createAssets" enctype="multipart/form-data">
|
||||
|
||||
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>">
|
||||
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>">
|
||||
|
||||
|
||||
<div class="item form-group">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Name<a style="color:red;">*</a> </label>
|
||||
<div class="col-md-5 col-sm-5 ">
|
||||
<input type="text" id="name" name="name" value="<?php if(isset($assetData)) { echo $assetData->name; } ?>" required="required" class="form-control ">
|
||||
@ -115,7 +115,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br /> <h6>Order Related Information</h6> <div class="x_title"> </div> <br />
|
||||
<br /> <h6>Order Related Information</h6> <div class="x_title"> </div> <br />
|
||||
|
||||
|
||||
<div class="item form-group">
|
||||
@ -135,7 +135,7 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -160,7 +160,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<br /> <h6>Additional Information</h6> <div class="x_title"> </div> <br />
|
||||
<br /> <h6>Additional Information</h6> <div class="x_title"> </div> <br />
|
||||
|
||||
<div class="item form-group">
|
||||
|
||||
@ -189,7 +189,7 @@
|
||||
<div class="ln_solid"></div>
|
||||
<div class="item form-group">
|
||||
<div class=" offset-md-8">
|
||||
<button class="btn btn-secondary" onclick="history.back()">Cancel</button>
|
||||
<button type="button" class="btn btn-secondary" onclick="history.back()">Cancel</button>
|
||||
<button class="btn btn-primary" type="reset">Reset</button>
|
||||
<button type="submit" class="btn btn-success">Submit</button>
|
||||
</div>
|
||||
@ -207,8 +207,8 @@
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Body page content -->
|
||||
<script>
|
||||
function checkFileFormat() {
|
||||
@ -225,4 +225,22 @@ function checkFileFormat() {
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
<script>
|
||||
let formSubmitted = false;
|
||||
|
||||
document.getElementById('myForm').addEventListener('submit', function(event) {
|
||||
if (formSubmitted) {
|
||||
event.preventDefault(); // Prevent the form from being submitted again
|
||||
return false;
|
||||
}
|
||||
|
||||
formSubmitted = true;
|
||||
document.getElementById('submitBtn').setAttribute('disabled', 'disabled');
|
||||
|
||||
// You might want to show a message or change button text to indicate submission
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
|
||||
|
||||
<form id="otp-form">
|
||||
<input type="hidden" id="csrf" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>">
|
||||
<input type="hidden" id="csrf" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>">
|
||||
</form>
|
||||
<div class="col-md-12 col-sm-12 ">
|
||||
|
||||
<div class="x_panel">
|
||||
<div class="x_title">
|
||||
<h2>Assets Details </h2>
|
||||
|
||||
|
||||
<ul class="nav navbar-right panel_toolbox">
|
||||
<?php if(user()->action_permit != 'view' ) { ?>
|
||||
<a href="<?php echo base_url();?>Asset/addAsset" class="btn btn-sm btn-primary">Add Asset</a>
|
||||
@ -23,7 +23,7 @@
|
||||
<div class="x_content">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="card-box table-responsive">
|
||||
<div class="card-box table-responsive">
|
||||
<form class="" method="post" action="<?php echo base_url()?>Asset/filterAssets">
|
||||
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>" >
|
||||
<input type="hidden" name="category" value="<?php echo $tableData[0]->category; ?>" >
|
||||
@ -34,7 +34,7 @@
|
||||
<div class="control-group ">
|
||||
<div class="controls">
|
||||
<div class="input-prepend input-group">
|
||||
|
||||
|
||||
<input type="text" style="width: 200px" name="reservation" id="reservation" class="form-control" value="" />
|
||||
</div>
|
||||
</div>
|
||||
@ -93,13 +93,14 @@
|
||||
<td class=" "><?php echo $value->location_name; ?></td> -->
|
||||
<td style=" text-align: center; font-size: 16px;">
|
||||
<?php if(user()->action_permit != 'view' ) { ?>
|
||||
|
||||
|
||||
|
||||
|
||||
<a href="<?php echo base_url()?>Asset/editAsset/<?php echo md5($value->id);?>" ><i class="fa fa-pencil" title="Edit"></i></a>
|
||||
|
||||
<a href="<?php echo base_url()?>Asset/addAsset/<?php echo md5($value->id);?>" ><i class="fa fa-copy" title="Copy"></i></a>
|
||||
|
||||
<a onclick="myFunction()"><i class="fa fa-trash " data-toggle="modal" data-target=".bs-example-modal-sm" id="<?php echo md5($value->id);?>" ></i></a>
|
||||
<a href="#" class="deleteAsset" id="<?php echo md5($value->id); ?>"> <i class="fa fa-trash" title="Delete"></i></a>
|
||||
|
||||
<!-- <a href="<?php echo base_url()?>Asset/deleteAsset/<?php echo md5($value->id);?>" ><i class="fa fa-trash" title="Delete"></i></a> -->
|
||||
|
||||
<?php } ?>
|
||||
@ -112,8 +113,8 @@
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -136,15 +137,16 @@ function myFunction() {
|
||||
// var inputValue = document.getElementById("myInput").value;
|
||||
var id = $(this).attr('id');
|
||||
var url = "<?php echo base_url()?>Asset/deleteAsset";
|
||||
console.log($(this).attr('id'));
|
||||
console.log('before api call');
|
||||
$.ajax({
|
||||
$.ajax({
|
||||
url: "<?php echo base_url()?>Asset/getDeleteConfirmationPopup",
|
||||
type:"GET",
|
||||
success:function(data){
|
||||
console.log('api success');
|
||||
$('#popup').html(JSON.parse(data));
|
||||
$('.delete_id').attr('value',id);
|
||||
$('.delete_url').attr('action',url);
|
||||
$('.delete_url').attr('action',url);
|
||||
}
|
||||
});
|
||||
|
||||
@ -169,17 +171,22 @@ function myFunction() {
|
||||
|
||||
|
||||
$('.deleteAsset').click(function() {
|
||||
alert("hello");
|
||||
// alert($(this).attr('id'));
|
||||
var id = $(this).attr('id');
|
||||
var url = "<?php echo base_url()?>Asset/deleteAsset";
|
||||
|
||||
$.ajax({
|
||||
$.ajax({
|
||||
url: "<?php echo base_url()?>Asset/getDeleteConfirmationPopup",
|
||||
type:"GET",
|
||||
success:function(data){
|
||||
$('#popup').html(JSON.parse(data));
|
||||
$('#popup').modal('show');
|
||||
console.log(data);
|
||||
|
||||
$('.delete_id').attr('value',id);
|
||||
$('.delete_url').attr('action',url);
|
||||
console.log(id);
|
||||
$('.delete_url').attr('action',url);
|
||||
console.log(url);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -194,14 +201,14 @@ function deleteRow() {
|
||||
console.log("tes----"+e.parentNode.parentNode);
|
||||
});
|
||||
console.log(delete_id);
|
||||
$.ajax({
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "<?php echo base_url()?>Asset/deleteMultipleAsset",
|
||||
data: {data:delete_id,'<?php echo $this->security->get_csrf_token_name(); ?>': $('#csrf').val()},
|
||||
json: true,
|
||||
success: function(response) {
|
||||
response = jQuery.parseJSON(response);
|
||||
$('input[name=csrf_test_name]').val(response.csrf_hash);
|
||||
$('input[name=csrf_test_name]').val(response.csrf_hash);
|
||||
console.log('success');
|
||||
},
|
||||
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
|
||||
@ -216,14 +223,14 @@ function viewQr() {
|
||||
view_qr_id.push(e.value)
|
||||
});
|
||||
console.log(view_qr_id);
|
||||
$.ajax({
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "<?php echo base_url()?>Asset/view_qrcode",
|
||||
data: {data:view_qr_id,'<?php echo $this->security->get_csrf_token_name(); ?>': $('#csrf').val()},
|
||||
json: true,
|
||||
success: function(response) {
|
||||
response = jQuery.parseJSON(response);
|
||||
$('input[name=csrf_test_name]').val(response.csrf_hash);
|
||||
$('input[name=csrf_test_name]').val(response.csrf_hash);
|
||||
console.log('success');
|
||||
$('.bs-example-modal-lg').html(response.htmlPage);
|
||||
$('.bs-example-modal-lg').modal("show");
|
||||
@ -238,14 +245,14 @@ function viewQr() {
|
||||
view_qr_id = [];
|
||||
var id = $(this).attr("id");
|
||||
view_qr_id.push(id)
|
||||
$.ajax({
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "<?php echo base_url()?>Asset/view_qrcode",
|
||||
data: {data:view_qr_id,'<?php echo $this->security->get_csrf_token_name(); ?>': $('#csrf').val()},
|
||||
json: true,
|
||||
success: function(response) {
|
||||
response = jQuery.parseJSON(response);
|
||||
$('input[name=csrf_test_name]').val(response.csrf_hash);
|
||||
$('input[name=csrf_test_name]').val(response.csrf_hash);
|
||||
console.log('success');
|
||||
$('.bs-example-modal-lg').html(response.htmlPage);
|
||||
$('.bs-example-modal-lg').modal("show");
|
||||
@ -263,7 +270,7 @@ function viewQr() {
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#datatable-buttons').DataTable({
|
||||
|
||||
|
||||
"order": [
|
||||
[0, 'desc']
|
||||
],
|
||||
@ -295,4 +302,3 @@ function viewQr() {
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@ -25,8 +25,8 @@
|
||||
<div class="x_content">
|
||||
<br />
|
||||
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url();?>Asset/editAssets" enctype="multipart/form-data">
|
||||
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>">
|
||||
<input type="hidden" name="id" value="<?php echo $editData->id; ?>">
|
||||
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>">
|
||||
<input type="hidden" name="id" value="<?php echo $editData->id; ?>">
|
||||
<div class="item form-group">
|
||||
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Name </label>
|
||||
<div class="col-md-5 col-sm-5 ">
|
||||
@ -105,7 +105,7 @@
|
||||
<div class="col-md-11 col-sm-11 ">
|
||||
<textarea id="notes" name="notes" class="form-control" type="text" <?php if(isset($viewData)) { echo "readonly"; } ?> ><?php echo $editData->notes; ?></textarea></div>
|
||||
</div>
|
||||
<br /> <h6>Order Related Information</h6> <div class="x_title"> </div> <br />
|
||||
<br /> <h6>Order Related Information</h6> <div class="x_title"> </div> <br />
|
||||
|
||||
<div class="item form-group">
|
||||
|
||||
@ -118,7 +118,7 @@
|
||||
<div class="col-md-5 col-sm-5 ">
|
||||
<div class="form-group">
|
||||
<div class='input-group date' id='myDatepicker'>
|
||||
<input type='text' class="form-control" name="purchase_date"
|
||||
<input type='text' class="form-control" name="purchase_date"
|
||||
value="<?php echo date("d-m-Y", strtotime($editData->purchase_date)); ?>" <?php if(isset($viewData)) { echo "readonly"; } ?>/>
|
||||
<span class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-calendar"></span>
|
||||
@ -148,9 +148,9 @@
|
||||
<div class="col-md-5 col-sm-5 ">
|
||||
<input id="cost" name="cost" value="<?php echo $editData->cost; ?>" class="form-control" type="text" name="middle-name" <?php if(isset($viewData)) { echo "readonly"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br /> <h6>Additional Information</h6> <div class="x_title"> </div> <br />
|
||||
<br /> <h6>Additional Information</h6> <div class="x_title"> </div> <br />
|
||||
<div class="item form-group">
|
||||
|
||||
<label class="control-label col-md-1 col-sm-1 " for="last-name">Warranty Information</label>
|
||||
@ -161,14 +161,14 @@
|
||||
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Main Image </label>
|
||||
|
||||
<div class="col-md-5 col-sm-5 ">
|
||||
<?php if(isset($viewData)) {
|
||||
<?php if(isset($viewData)) {
|
||||
if($editData->asset_img == null || $editData->asset_img == '') { ?>
|
||||
<img src="<?php echo base_url(); ?>assets/uploads/defauld-img.jpg" width="180" height="150">
|
||||
<?php } else {?>
|
||||
<img src="<?php echo base_url(); ?>assets/uploads/<?php echo $editData->asset_img; ?>" width="180" height="150">
|
||||
<?php } }
|
||||
<?php } }
|
||||
else { ?>
|
||||
<input id="formFile" name="asset_img" class="typeFile" type="file" >
|
||||
<input id="formFile" name="asset_img" class="typeFile" type="file"accept=".png, .jpg, .jpeg" onchange="checkFileFormat()" >
|
||||
|
||||
<?php if($editData->asset_img == null || $editData->asset_img == '') { ?>
|
||||
<img src="<?php echo base_url(); ?>assets/uploads/defauld-img.jpg" width="180" height="150">
|
||||
@ -197,11 +197,11 @@
|
||||
|
||||
|
||||
|
||||
<?php if(isset($viewData)) { }else{ ?>
|
||||
<?php if(isset($viewData)) { }else{ ?>
|
||||
<div class="ln_solid"></div>
|
||||
<div class="item form-group">
|
||||
<div class="offset-md-8">
|
||||
<button class="btn btn-primary" onclick="history.back()">Cancel</button>
|
||||
<button type="button"class="btn btn-primary" onclick="history.back()">Cancel</button>
|
||||
<button type="submit" class="btn btn-success">Update</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -228,20 +228,20 @@
|
||||
<?php echo $sub_asset_value_htmlPage; ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Body page content -->
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).on('change','#formFile',function(){
|
||||
|
||||
|
||||
const file = this.files[0];
|
||||
if (file){
|
||||
let reader = new FileReader();
|
||||
reader.onload = function(event){
|
||||
|
||||
|
||||
$('#image').attr('src', event.target.result);
|
||||
}
|
||||
reader.readAsDataURL(file);
|
||||
@ -250,7 +250,7 @@
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
if ($('#change_active').val() == "asset_value") {
|
||||
setTimeout(() => { $('#chevron').click(); }, 500);
|
||||
$('#asset_value-tab').removeClass('nav-link').addClass('nav-link active');
|
||||
@ -281,3 +281,19 @@
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function checkFileFormat() {
|
||||
var input = document.getElementById('formFile');
|
||||
var fileName = input.value;
|
||||
var allowedFormats = ['.png', '.jpg', '.jpeg'];
|
||||
|
||||
if (fileName) {
|
||||
var fileExtension = fileName.slice((fileName.lastIndexOf(".") - 1 >>> 0) + 2);
|
||||
|
||||
if (allowedFormats.indexOf(fileExtension.toLowerCase()) === -1) {
|
||||
alert('Please choose a valid image file (PNG, JPG, JPEG).');
|
||||
input.value = ''; // Clear the file input to allow choosing a new file
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -182,7 +182,7 @@
|
||||
<input id="email" name="email"
|
||||
value="<?php if(isset($editData)){ echo $editData->email; } ?>" required="required"
|
||||
class="form-control" type="email"
|
||||
pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}"
|
||||
|
||||
oninvalid="setCustomValidity('Enter a Valid E-mail Address.')"
|
||||
oninput="setCustomValidity('')" onkeyup="check_if_exists(this.id, this.value, this.name)">
|
||||
</div>
|
||||
@ -593,18 +593,18 @@ function check_if_exists(id, value, name) {
|
||||
data: { value: value, name: name },
|
||||
success:function(response)
|
||||
{
|
||||
if (response == true)
|
||||
{
|
||||
if (response == true)
|
||||
{
|
||||
new PNotify({
|
||||
title: 'Warning',
|
||||
text: 'That given details Already Exists',
|
||||
styling: 'bootstrap3'
|
||||
});
|
||||
$("#"+id).val('');
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$('#password').keyup(function() {
|
||||
@ -652,3 +652,23 @@ function check_if_exists(id, value, name) {
|
||||
});
|
||||
|
||||
</script>
|
||||
<script>
|
||||
function validateEmail(email) {
|
||||
const regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
||||
return regex.test(email);
|
||||
}
|
||||
|
||||
$(document).on('blur', '#email', function() {
|
||||
const emailValue = $(this).val();
|
||||
|
||||
if (!validateEmail(emailValue)) {
|
||||
new PNotify({
|
||||
text: 'Enter a valid email address.',
|
||||
type: 'error',
|
||||
styling: 'bootstrap3'
|
||||
});
|
||||
$(this).val('');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ public function __construct()
|
||||
$this->load->helper(array('form', 'url'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function expence_form()
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
@ -53,32 +53,32 @@ public function expence_form()
|
||||
|
||||
public function get_emp_name()
|
||||
{
|
||||
$emp = $this->Expence_model->get_employee_name(user()->business_id);
|
||||
$html = '<option value="">--select Employee--</option>';
|
||||
foreach($emp as $val)
|
||||
$emp = $this->Expence_model->get_employee_name(user()->business_id);
|
||||
$html = '<option value="">--select Employee--</option>';
|
||||
foreach($emp as $val)
|
||||
{
|
||||
if($val->user_id != user()->id)
|
||||
{
|
||||
$html .='<option id="'.$val->manager.'" value="'.$val->user_id.'">'.$val->name.'</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
echo json_encode($html);
|
||||
}
|
||||
|
||||
public function rise_expence_request()
|
||||
{
|
||||
{
|
||||
|
||||
$data = $this->input->post('emp_id');
|
||||
if(!empty($data)){
|
||||
if(!empty($data)){
|
||||
$emp_id =$this->input->post('emp_id');
|
||||
}else{
|
||||
$emp_id = user()->id;
|
||||
}
|
||||
}
|
||||
$get_manager_id = $this->Expence_model->get_manager_id($emp_id);
|
||||
|
||||
|
||||
if($get_manager_id[0]->manager == null){
|
||||
|
||||
$manager = 0;
|
||||
|
||||
$manager = 0;
|
||||
}else{
|
||||
|
||||
$manager = $get_manager_id[0]->manager;
|
||||
@ -95,11 +95,11 @@ public function rise_expence_request()
|
||||
);
|
||||
$table="expense";
|
||||
$create_Expence = $this->MY_Model->insert($data1,$table);
|
||||
|
||||
|
||||
$count = count($this->input->post('date_of_expence'));
|
||||
for($i=0;$i<$count;$i++)
|
||||
for($i=0;$i<$count;$i++)
|
||||
{
|
||||
|
||||
|
||||
$data2 = array(
|
||||
'expense_id' => $create_Expence,
|
||||
'emp_id'=>$emp_id ,
|
||||
@ -122,30 +122,30 @@ public function rise_expence_request()
|
||||
$_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'))
|
||||
|
||||
$this->upload->initialize($config);
|
||||
if ($this->upload->do_upload('userfile'))
|
||||
{
|
||||
$upload_image = $this->upload->data();
|
||||
$data2['bill'] = $upload_image['file_name'];
|
||||
}
|
||||
else
|
||||
$data2['bill'] = $upload_image['file_name'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = $this->upload->display_errors();
|
||||
}
|
||||
|
||||
$table="expense_child";
|
||||
$create_expence_list = $this->MY_Model->insert($data2,$table);
|
||||
$create_expence_list = $this->MY_Model->insert($data2,$table);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$this->session->set_flashdata('Create', '1');
|
||||
redirect('Expence/Emp_Expence_List');
|
||||
}
|
||||
|
||||
|
||||
public function edit_expence($id)
|
||||
{
|
||||
{
|
||||
$expense_data = $this->Expence_model->get_expense_data($id);
|
||||
$expense_child_data = $this->Expence_model->get_expense_child_data($id);
|
||||
$this->layout->set('expense_data', $expense_data);
|
||||
@ -156,19 +156,19 @@ public function edit_expence($id)
|
||||
|
||||
|
||||
public function edit_rise_expence_request()
|
||||
{
|
||||
{
|
||||
$id = $this->input->post('expense_pid');
|
||||
$data = $this->input->post('emp_id');
|
||||
if(!empty($data)){
|
||||
if(!empty($data)){
|
||||
$emp_id =$this->input->post('emp_id');
|
||||
}else{
|
||||
$emp_id = user()->id;
|
||||
}
|
||||
}
|
||||
$get_manager_id = $this->Expence_model->get_manager_id($emp_id);
|
||||
|
||||
|
||||
if($get_manager_id[0]->manager == null){
|
||||
|
||||
$manager = 0;
|
||||
|
||||
$manager = 0;
|
||||
}else{
|
||||
|
||||
$manager = $get_manager_id[0]->manager;
|
||||
@ -186,9 +186,9 @@ public function edit_rise_expence_request()
|
||||
);
|
||||
$table="expense";
|
||||
$create_Expence = $this->MY_Model->edit_option($data1, $id, $table);
|
||||
|
||||
|
||||
$count = count($this->input->post('date_of_expence'));
|
||||
for($i=0;$i<$count;$i++)
|
||||
for($i=0;$i<$count;$i++)
|
||||
{
|
||||
$expense_child_id = $this->input->post('expense_child_id')[$i];
|
||||
$data2 = array(
|
||||
@ -208,31 +208,31 @@ public function edit_rise_expence_request()
|
||||
$_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'))
|
||||
|
||||
$this->upload->initialize($config);
|
||||
if ($this->upload->do_upload('userfile'))
|
||||
{
|
||||
$upload_image = $this->upload->data();
|
||||
$data2['bill'] = $upload_image['file_name'];
|
||||
}
|
||||
else
|
||||
$data2['bill'] = $upload_image['file_name'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = $this->upload->display_errors();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$table="expense_child";
|
||||
$update_expence_list = $this->MY_Model->edit_option($data2, $expense_child_id, $table);
|
||||
|
||||
$update_expence_list = $this->MY_Model->edit_option($data2, $expense_child_id, $table);
|
||||
|
||||
}
|
||||
|
||||
if($this->input->post('date_of_expence2'))
|
||||
{
|
||||
|
||||
$count = count($this->input->post('date_of_expence2'));
|
||||
for($i=0;$i<$count;$i++)
|
||||
for($i=0;$i<$count;$i++)
|
||||
{
|
||||
|
||||
|
||||
$data2 = array(
|
||||
'expense_id' => $this->input->post('expense_pid'),
|
||||
'emp_id'=>$emp_id ,
|
||||
@ -255,31 +255,31 @@ public function edit_rise_expence_request()
|
||||
$_FILES['userfile']['tmp_name'] = $_FILES['bill2']['tmp_name'][$i];
|
||||
$_FILES['userfile']['error'] = $_FILES['bill2']['error'][$i];
|
||||
$_FILES['userfile']['size'] = $_FILES['bill2']['size'][$i];
|
||||
|
||||
$this->upload->initialize($config);
|
||||
if ($this->upload->do_upload('userfile'))
|
||||
|
||||
$this->upload->initialize($config);
|
||||
if ($this->upload->do_upload('userfile'))
|
||||
{
|
||||
$upload_image = $this->upload->data();
|
||||
$data2['bill'] = $upload_image['file_name'];
|
||||
}
|
||||
else
|
||||
$data2['bill'] = $upload_image['file_name'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = $this->upload->display_errors();
|
||||
}
|
||||
|
||||
$table="expense_child";
|
||||
$create_expence_list = $this->MY_Model->insert($data2,$table);
|
||||
//print_r($this->db->last_query()); die;
|
||||
//print_r($this->db->last_query()); die;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
redirect('Expence/Emp_Expence_List');
|
||||
|
||||
}
|
||||
|
||||
public function expence_list()
|
||||
{
|
||||
{
|
||||
$business_id = user()->business_id;
|
||||
$expence_list = $this->Expence_model->get_expence_list($business_id);
|
||||
$get_count_amount = $this->Expence_model->get_count_amount();
|
||||
@ -291,13 +291,13 @@ public function expence_list()
|
||||
}
|
||||
|
||||
public function expence_list_view($id)
|
||||
{
|
||||
{
|
||||
$expence_list = $this->Expence_model->get_expense_child_data2($id);
|
||||
$get_expense_name = $this->Expence_model->get_expense_data_not_md5($id);
|
||||
$expence_list_with_delegation = $this->Expence_model->get_all_leave_request_by_manager_id_with_delegation(user()->business_id, user()->id);
|
||||
$expence_list_with_delegation = $this->Expence_model->get_all_leave_request_by_manager_id_with_delegation(user()->business_id, user()->id);
|
||||
if($expence_list_with_delegation == NULL){
|
||||
$expence_list_with_delegation = [];
|
||||
}
|
||||
}
|
||||
$this->layout->set('tableData', $expence_list);
|
||||
$this->layout->set('expense_name', $get_expense_name);
|
||||
$this->layout->buffer('main_content', 'Expence/expence_list_view');
|
||||
@ -305,14 +305,14 @@ public function expence_list_view($id)
|
||||
}
|
||||
|
||||
public function expence_list2()
|
||||
{
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
$expence_list2 = $this->Expence_model->get_expence_child_list($id);
|
||||
echo json_encode($expence_list2);
|
||||
}
|
||||
|
||||
public function Emp_Expence_List()
|
||||
{
|
||||
{
|
||||
$business_id = user()->business_id;
|
||||
$expence_list = $this->Expence_model->get_expence_list_all($business_id);
|
||||
$get_count_amount = $this->Expence_model->get_count_amount();
|
||||
@ -323,7 +323,7 @@ public function Emp_Expence_List()
|
||||
}
|
||||
|
||||
public function Emp_Expence_List_view($id)
|
||||
{
|
||||
{
|
||||
$expence_list = $this->Expence_model->get_expense_child_data2($id);
|
||||
$get_expense_name = $this->Expence_model->get_expense_data_not_md5($id);
|
||||
$this->layout->set('tableData', $expence_list);
|
||||
@ -336,13 +336,13 @@ public function getDeleteConfirmationPopup()
|
||||
{
|
||||
$data = array();
|
||||
$htmlPage = $this->load->view('confirmation_popup.php',$data,true);
|
||||
echo json_encode($htmlPage);
|
||||
echo json_encode($htmlPage);
|
||||
}
|
||||
|
||||
public function Approve_Expence()
|
||||
{
|
||||
$id=$this->input->post('id');
|
||||
// echo $id; die;
|
||||
$id=$this->input->post('id');
|
||||
// echo $id; die;
|
||||
$action['status'] = 'Approved';
|
||||
$action['approved_by']= user()->name;
|
||||
$action['approved_at'] = date('Y-m-d h:i:s');
|
||||
@ -359,14 +359,23 @@ public function Approve_Expence()
|
||||
}
|
||||
|
||||
public function Approve_Child_Expence()
|
||||
{
|
||||
{
|
||||
if($this->input->post('declinedata'))
|
||||
{
|
||||
$id=$this->input->post('id');
|
||||
$expense_id=$this->input->post('expence_id');
|
||||
// echo $this->input->post('expence_id');
|
||||
// var_dump($this->input->post('expence_id'));
|
||||
// print_r($this->input->post('declinedata'));
|
||||
// echo $this->input->post('expence_id');
|
||||
// die;
|
||||
|
||||
$id=$this->input->post('id');
|
||||
$expense_id=$this->input->post('expence_id');
|
||||
$decline_action['status'] = 'Declined';
|
||||
$decline_action['decline_by'] = user()->name;
|
||||
$decline_action['decline_reason'] = $this->input->post('declinedata');
|
||||
|
||||
// echo $this->input->post('expence_id');
|
||||
|
||||
$is_decline = $this->Expence_model->approve_child_expense_2($decline_action, $id);
|
||||
|
||||
if($is_decline == true)
|
||||
@ -387,27 +396,28 @@ public function Approve_Child_Expence()
|
||||
$type = 'Email';
|
||||
$this->notification->sendNotificationForExpense($expense_id, $code, $type);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if($count->declined_count >= 1 && $count->approve_count == 0 && $count->pending_count == 0)
|
||||
{
|
||||
|
||||
|
||||
$status_update['status'] = 'Declined';
|
||||
$status_update['decline_by'] = user()->name;
|
||||
return $this->MY_Model->edit_option($status_update, $expense_id, $table);
|
||||
$this->MY_Model->edit_option($status_update, $expense_id, $table);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
redirect(base_url('Expence/expence_list_view/'.$this->input->post('expence_id')));
|
||||
|
||||
|
||||
redirect('Expence/expence_list_view/'.$this->input->post('expence_id'));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$id=$this->input->post('id');
|
||||
$expense_id=$this->input->post('expence_id');
|
||||
$id=$this->input->post('id');
|
||||
$expense_id=$this->input->post('expence_id');
|
||||
$action['status'] = 'Approved';
|
||||
$action['approved_at'] = date('Y-m-d h:i:s');
|
||||
$action['approved_by']= user()->name;
|
||||
$is_approve = $this->Expence_model->approve_child_expense_2($action, $id);
|
||||
$is_approve = $this->Expence_model->approve_child_expense_2($action, $id);
|
||||
if($is_approve == true)
|
||||
{
|
||||
$count = $this->Expence_model->get_status_update($expense_id);
|
||||
@ -435,8 +445,8 @@ public function Approve_Child_Expence()
|
||||
$status_update['approved_by'] = user()->name;
|
||||
$this->MY_Model->edit_option($status_update, $expense_id, $table);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
redirect('Expence/expence_list_view/'.$this->input->post('expence_id'));
|
||||
}
|
||||
@ -449,11 +459,11 @@ public function getDeclineConfirmationPopup()
|
||||
{
|
||||
$data = array();
|
||||
$htmlPage = $this->load->view('confirmation_popup_2.php',$data,true);
|
||||
echo json_encode($htmlPage);
|
||||
echo json_encode($htmlPage);
|
||||
}
|
||||
|
||||
public function Decline_expence()
|
||||
{
|
||||
{
|
||||
$id=$this->input->post('id');
|
||||
// echo $id; die;
|
||||
$data['status'] = 'Declined';
|
||||
@ -474,11 +484,11 @@ public function getCancelConfirmationPopup()
|
||||
{
|
||||
$data = array();
|
||||
$htmlPage = $this->load->view('confirmation_popup.php',$data,true);
|
||||
echo json_encode($htmlPage);
|
||||
echo json_encode($htmlPage);
|
||||
}
|
||||
|
||||
public function cancled_expence()
|
||||
{
|
||||
{
|
||||
$id=$this->input->post('id');
|
||||
$data['status'] = 'Cancelled';
|
||||
$data['cancelled_at'] = date('Y-m-d h:i:s');
|
||||
@ -488,7 +498,7 @@ public function cancled_expence()
|
||||
}
|
||||
|
||||
public function remove_row()
|
||||
{
|
||||
{
|
||||
$get_count_from_child = $this->Expence_model->get_expense_child_data(md5($this->input->post('expence_id')));
|
||||
$count = count($get_count_from_child);
|
||||
if($count === 1)
|
||||
@ -502,11 +512,11 @@ public function remove_row()
|
||||
$delete = $this->Expence_model->remove_row($id);
|
||||
redirect('Expence/edit_expence/'.md5($this->input->post('expence_id')));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function submit()
|
||||
{
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$table1 = 'expense';
|
||||
$data['status'] = "pending";
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
.alert-success {
|
||||
background-color: #dff0d8;
|
||||
color: #3c763d;
|
||||
border-color: #d6e9c6;
|
||||
border-color: #d6e9c6;
|
||||
}
|
||||
|
||||
.flash-message {
|
||||
@ -22,7 +22,7 @@
|
||||
}
|
||||
|
||||
.hide-arrow {
|
||||
|
||||
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
@ -86,19 +86,19 @@
|
||||
<br />
|
||||
<form id="expenceForm" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url();?>Expence/rise_expence_request" enctype="multipart/form-data">
|
||||
|
||||
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>">
|
||||
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>">
|
||||
|
||||
<div class="x_panel">
|
||||
<div class="item form-group">
|
||||
<label class="control-label col-md-2 col-sm-2 label-align" for="last-name">Expense Requisted For</label>
|
||||
<label class="control-label col-md-2 col-sm-2 label-align" for="last-name">Expense Requested For</label>
|
||||
<div class="col-md-4 col-sm-4">
|
||||
|
||||
|
||||
<input type="radio" name="created_by" value="self (<?php echo user()->id;?>)"style="margin:10px;"checked /><b>Self</b>
|
||||
|
||||
<input type="radio" name="created_by" value="<?php echo user()->name;?> (<?php echo user()->id;?>)" style="margin: 10px;" /><b>Others</b>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<label class="control-label col-md-1 col-sm-1 label-align" for="last-name"> Employee Name <a style="color:red;">*</a></label>
|
||||
<div class="col-md-5 col-sm-5 ">
|
||||
<select id="user_dropdown" name="emp_id" style="margin-top: 10px;padding-bottom: 10px;" class="form-control manager" ></select>
|
||||
@ -115,7 +115,7 @@
|
||||
<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 />
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name">Business Reason</label>
|
||||
@ -123,7 +123,7 @@
|
||||
<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'/>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -131,7 +131,7 @@
|
||||
|
||||
<div class="x_panel">
|
||||
<div class="x_title">
|
||||
<!-- <ul class="nav navbar-right panel_toolbox">
|
||||
<!-- <ul class="nav navbar-right panel_toolbox">
|
||||
<button type="button" id="add-button" onclick="createAndAppendFormGroup()" class="btn btn-info" style="font-size:small;" >Add</button>
|
||||
</ul> -->
|
||||
<div class="clearfix"></div>
|
||||
@ -146,7 +146,7 @@
|
||||
<div class="form-group">
|
||||
<input type='date' id='ExpenseDate' class="form-control" placeholder="DD-MM-YYYY" required name="date_of_expence[]" value="<?php echo $value->date_of_expense ?>" autocomplete='off' /><i class="fa fa-calendar"></i>
|
||||
</div>
|
||||
|
||||
|
||||
<input type="hidden" name="expense_pid" value="<?php echo $expense_data[0]->id; ?>">
|
||||
|
||||
</div>
|
||||
@ -161,7 +161,7 @@
|
||||
<label class="control-label col-md-1 col-sm-1 label-align" for="last-name">Description</label>
|
||||
<div class="col-md-5 col-sm-3">
|
||||
<textarea id="comments" name="description[]" value="" class="form-control" style="height:50px !important;" type="text" ><?php echo $value->description ?></textarea>
|
||||
|
||||
|
||||
<!-- <input type="hidden" id="manager_id" name="manager" value=""> -->
|
||||
|
||||
</div>
|
||||
@ -178,7 +178,7 @@
|
||||
|
||||
<?php } } else { ?>
|
||||
|
||||
|
||||
|
||||
<div class="item form-group">
|
||||
|
||||
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Date of Expense<a style="color:red;">*</a></label>
|
||||
@ -187,7 +187,7 @@
|
||||
<input type='text' id='ExpenseDate' class="form-control" placeholder="DD-MM-YYYY" required name="date_of_expence[]" value="" autocomplete='off'/>
|
||||
<i class="fa fa-calendar" style=" position: absolute; right: 25px; top: 12px;z-index: 0;"></i>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Amount <a style="color:red;">*</a></label>
|
||||
<div class="col-md-5 col-sm-5 ">
|
||||
@ -205,7 +205,7 @@
|
||||
|
||||
<label class="control-label col-md-1 col-sm-1 label-align" required for="first-name">Recipt</label>
|
||||
<div class="col-md-5 col-sm-5 ">
|
||||
<input id="formFile" name="bill[]" onchange="validateFile(this)" class="typeFile" type="file" value="" multiple></div>
|
||||
<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>
|
||||
<?php } ?>
|
||||
|
||||
@ -225,17 +225,17 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- /Body page content -->
|
||||
|
||||
<script>
|
||||
|
||||
// hide the dropdown arrow
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
// hide the dropdown arrow
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$("#user_dropdown").addClass("hide-arrow");
|
||||
$("input[name='created_by']").on("change", function() {
|
||||
@ -253,19 +253,19 @@
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
const datepickerInput = document.getElementById('ExpenseDate');
|
||||
|
||||
flatpickr(datepickerInput, {
|
||||
dateFormat: 'd-m-Y',
|
||||
dateFormat: 'd-m-Y',
|
||||
maxDate: new Date(),
|
||||
allowInput: true,
|
||||
autoclose:true,
|
||||
|
||||
|
||||
onChange: function(selectedDates, dateStr) {
|
||||
console.log('Selected date: ', dateStr);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function validateFile(input) {
|
||||
@ -300,17 +300,17 @@ function matchnum(event)
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
var currentUserName = '<?php echo user()->name; ?>';
|
||||
var currentUserId = '<?php echo user()->id; ?>';
|
||||
$('#user_dropdown').append('<option value="' + currentUserId + '">' +
|
||||
$('#user_dropdown').append('<option value="' + currentUserId + '">' +
|
||||
currentUserName + '</option>');
|
||||
$('#user_dropdown').prop('disabled', true);
|
||||
|
||||
$('#user_dropdown').on('change',function() {
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
@ -322,7 +322,7 @@ function matchnum(event)
|
||||
$userDropdown.empty();
|
||||
|
||||
if (selectedValue === 'self (<?php echo user()->id;?>)') {
|
||||
|
||||
|
||||
var currentUserName = '<?php echo user()->name; ?>';
|
||||
var currentUserId = '<?php echo user()->id; ?>';
|
||||
$userDropdown.append('<option value="' + currentUserId + '">' + currentUserName + '</option>');
|
||||
@ -333,15 +333,15 @@ function matchnum(event)
|
||||
$('#user_dropdown').attr('required', true);
|
||||
console.log($('#user_dropdown').prop('required'));
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('Expence/get_emp_name/')?>"',
|
||||
url: '<?php echo base_url('Expence/get_emp_name/')?>"',
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
$('#user_dropdown').append(response);
|
||||
|
||||
|
||||
|
||||
|
||||
$('#user_dropdown').prop('disabled', false);
|
||||
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(error);
|
||||
@ -349,7 +349,7 @@ function matchnum(event)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
@ -370,7 +370,7 @@ function matchnum(event)
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
//get manager id from the dropdown employee assign the value to $("#manager_id") input field
|
||||
|
||||
$("#user_dropdown").on("change", function(){
|
||||
@ -380,7 +380,7 @@ function matchnum(event)
|
||||
|
||||
$("#manager_id").val(manager_id);
|
||||
|
||||
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
@ -419,7 +419,7 @@ function createAndAppendFormGroup() {
|
||||
|
||||
const datepickerInput = document.getElementById('datepicker'+i);
|
||||
flatpickr(datepickerInput, {
|
||||
dateFormat: 'd-m-Y',
|
||||
dateFormat: 'd-m-Y',
|
||||
maxDate: new Date(),
|
||||
autoclose:true,
|
||||
allowInput: true,
|
||||
@ -445,7 +445,7 @@ function removebutton(index) {
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
function remove_row(id)
|
||||
{
|
||||
$.ajax({
|
||||
@ -454,17 +454,17 @@ function remove_row(id)
|
||||
url:"<?php echo base_url('Expence/remove_row');?>",
|
||||
type:"get",
|
||||
success: function(response) {
|
||||
|
||||
|
||||
if(response==true);
|
||||
{
|
||||
location.reload(true)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
|
||||
<head>
|
||||
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css'>
|
||||
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css'>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
|
||||
@ -92,7 +92,7 @@
|
||||
<a href="<?php echo base_url();?>Expence/expence_list" class="btn btn-sm btn-primary" style="margin-top: 20px;">Back</a>
|
||||
</ul>
|
||||
<h3>Expense Approval List </h3>
|
||||
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
|
||||
@ -102,7 +102,7 @@
|
||||
<div class="col-md-5 col-sm-5 ">
|
||||
<div class="form-group">
|
||||
<input readonly type='text' class="form-control" name="expense_name" value="<?php if(isset($expense_name[0]->id)){echo $expense_name[0]->created_name; } ?>" autocomplete='off' required />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="control-label col-md-1 col-sm-1 " for="first-name">Requested For</label>
|
||||
@ -110,7 +110,7 @@
|
||||
<div class="form-group">
|
||||
<input readonly type='text' class="form-control" name="business_reason" value="<?php if(isset($expense_name[0]->id)){echo $expense_name[0]->requested_name; } ?>" autocomplete='off'/>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -121,7 +121,7 @@
|
||||
<div class="col-md-5 col-sm-5 ">
|
||||
<div class="form-group">
|
||||
<input readonly type='text' class="form-control" name="expense_name" value="<?php if(isset($expense_name[0]->id)){echo $expense_name[0]->expense_name; } ?>" autocomplete='off' required />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" id="expense_id" name="expense_pid" value="<?php echo $expense_name[0]->id; ?>">
|
||||
@ -131,7 +131,7 @@
|
||||
<div class="form-group">
|
||||
<input readonly type='text' class="form-control" name="business_reason" value="<?php if(isset($expense_name[0]->id)){echo $expense_name[0]->business_reason; } ?>" autocomplete='off'/>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -154,11 +154,11 @@
|
||||
else
|
||||
{
|
||||
echo $expense_name[0]->status;
|
||||
}
|
||||
}
|
||||
?>"
|
||||
}
|
||||
}
|
||||
?>"
|
||||
autocomplete='off' required />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="control-label col-md-1 col-sm-1 " for="first-name">Submitted Date</label>
|
||||
@ -166,7 +166,7 @@
|
||||
<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'/>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -183,8 +183,8 @@
|
||||
<div class="col-sm-12" style="overflow: auto;">
|
||||
<table class="table table-striped" width="100%">
|
||||
<thead>
|
||||
<tr class="headings">
|
||||
<th hidden class="column-title">id</th>
|
||||
<tr class="headings">
|
||||
<th hidden class="column-title">id</th>
|
||||
<th class="column-title">Claim Date</th>
|
||||
<th class="column-title">Date of Expense</th>
|
||||
<th class="column-title">Amount</th>
|
||||
@ -214,14 +214,14 @@
|
||||
<td style="color:darkcyan;"><?php echo $value->status; ?> at <br><?php echo $value->cancelled_at; ?></td>
|
||||
<?php }
|
||||
else if($value->status == 'Draft'){?>
|
||||
|
||||
|
||||
<td style="color:#0000e6;"><?php echo $value->status; ?></td>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<td style=" text-align: center; font-size: 16px;">
|
||||
|
||||
<a onclick="openModal('<?php echo base_url(); ?>assets/uploads/Expence_Bill/<?php echo $value->bill; ?>')" title="ViewBill"><i class="fa fa-eye" aria-hidden="true"></i></a><br>
|
||||
<a onclick="openModal('<?php echo base_url(); ?>assets/uploads/Expence_Bill/<?php echo $value->bill; ?>')" title="ViewBill"><i class="fa fa-eye" aria-hidden="true"></i></a><br>
|
||||
|
||||
<?php if($value->status == 'pending') { ?>
|
||||
|
||||
@ -246,7 +246,7 @@
|
||||
<h3>Decline Reason</h3>
|
||||
<input list="browsers" style="padding:20px; margin:6px;" id="decline_reason" required name="myBrowser" />
|
||||
<button onclick="submitCustomPrompt()" type="button" class="btn btn-primary">Submit</button>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
@ -263,14 +263,14 @@
|
||||
var expence_id = document.getElementById('expense_id').value;
|
||||
var url = "<?php echo base_url()?>Expence/Approve_Child_Expence";
|
||||
|
||||
$.ajax({
|
||||
$.ajax({
|
||||
url: "<?php echo base_url()?>Expence/getDeleteConfirmationPopup",
|
||||
type:"GET",
|
||||
success:function(data){
|
||||
$('#popup').html(JSON.parse(data));
|
||||
$('.delete_id').attr('value',id);
|
||||
$('.expence_id').attr('value',expence_id);
|
||||
$('.delete_url').attr('action',url);
|
||||
$('.delete_url').attr('action',url);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -280,14 +280,14 @@
|
||||
var expence_id = document.getElementById('expense_id').value;
|
||||
var url = "<?php echo base_url()?>Expence/Approve_Child_Expence";
|
||||
|
||||
$.ajax({
|
||||
$.ajax({
|
||||
url: "<?php echo base_url()?>Expence/getDeclineConfirmationPopup",
|
||||
type:"GET",
|
||||
success:function(data){
|
||||
$('#popup').html(JSON.parse(data));
|
||||
$('.delete_id').attr('value',id);
|
||||
$('.expence_id').attr('value',expence_id);
|
||||
$('.delete_url').attr('action',url);
|
||||
$('.delete_url').attr('action',url);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -302,7 +302,7 @@ function showCustomPrompt() {
|
||||
}
|
||||
|
||||
function submitCustomPrompt() {
|
||||
|
||||
|
||||
var id = $('.test').attr("id");
|
||||
var reason = document.getElementById("decline_reason").value;
|
||||
var expence_id = document.getElementById('expense_id').value;
|
||||
@ -314,22 +314,22 @@ function submitCustomPrompt() {
|
||||
url:"<?php echo base_url('Expence/Approve_Child_Expence');?>",
|
||||
type:"get",
|
||||
success: function(response) {
|
||||
|
||||
|
||||
console.log(response);
|
||||
window.location ="<?php echo base_url()?>Expence/expence_list_view/"+expence_id;
|
||||
console.log(response);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
else
|
||||
});
|
||||
else
|
||||
|
||||
alert('Decline Reason is required');
|
||||
}
|
||||
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="myModal" class="modal modal_default">
|
||||
<span class="close">×</span>
|
||||
<img id="modalImage" src="" alt="Image">
|
||||
|
||||
@ -40,19 +40,19 @@ public function __construct()
|
||||
$this->load->helper(array('form', 'url'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
|
||||
$this->layout->set('users', "gowtham");
|
||||
$this->layout->buffer('main_content', 'Asset/index');
|
||||
$this->layout->render('Employee_Layout');
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function leaveList()
|
||||
{
|
||||
|
||||
|
||||
$business_id = user()->business_id;
|
||||
$leave_list = $this->Leave_model->get_leave_with_emp_name(user()->business_id);
|
||||
$leave_type = $this->Leave_model->get_leave_type($business_id);
|
||||
@ -65,7 +65,7 @@ public function leaveList()
|
||||
}
|
||||
|
||||
public function applyLeave($update = null)
|
||||
{
|
||||
{
|
||||
$business_id = user()->business_id;
|
||||
$user_id = user()->id;
|
||||
$emp = $this->Emp_model->get_employee(user()->business_id);
|
||||
@ -81,46 +81,46 @@ public function applyLeave($update = null)
|
||||
}
|
||||
|
||||
public function get_emp_leave_count()
|
||||
{
|
||||
$business_id = user()->business_id;
|
||||
{
|
||||
$business_id = user()->business_id;
|
||||
$emp_id = $this->input->get('emp_id');
|
||||
$type_id = $this->input->get('type_id');
|
||||
$emp_leave_count = $this->Leave_model->get_count($emp_id, $business_id, $type_id);
|
||||
echo json_encode($emp_leave_count);
|
||||
echo json_encode($emp_leave_count);
|
||||
}
|
||||
|
||||
public function get_leave_master_count()
|
||||
{
|
||||
$business_id = user()->business_id;
|
||||
$business_id = user()->business_id;
|
||||
$type_id = $this->input->get('type_id');
|
||||
// $year = $this->input->get('fromDate');
|
||||
// $emp_id = $this->input->get('emp_id');
|
||||
$emp_leave_count = $this->Leave_model->get_leave_master_count($type_id, $business_id);
|
||||
echo json_encode($emp_leave_count);
|
||||
echo json_encode($emp_leave_count);
|
||||
}
|
||||
|
||||
public function get_emp_name()
|
||||
{
|
||||
$emp = $this->Leave_model->get_employee(user()->business_id);
|
||||
$html = '<option value="" >--Select Employee--</option>';
|
||||
foreach($emp as $val)
|
||||
$emp = $this->Leave_model->get_employee(user()->business_id);
|
||||
$html = '<option value="" >--Select Employee--</option>';
|
||||
foreach($emp as $val)
|
||||
{
|
||||
if($val->user_id != user()->id)
|
||||
{
|
||||
$html .='<option id="'.$val->manager.'" value="'.$val->user_id.'">'.$val->name.'</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
echo json_encode($html);
|
||||
}
|
||||
|
||||
public function createLeave()
|
||||
{
|
||||
{
|
||||
//permission type create part
|
||||
|
||||
if(!empty($this->input->post('from_time')))
|
||||
{
|
||||
{
|
||||
$perm_data = $this->input->post();
|
||||
if(isset($perm_data['emp_id'])){
|
||||
if(isset($perm_data['emp_id'])){
|
||||
$emp_id =$this->input->post('emp_id');
|
||||
}else{
|
||||
$emp_id = user()->id;
|
||||
@ -136,9 +136,9 @@ public function createLeave()
|
||||
|
||||
$manager = employee()->manager;
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
|
||||
$manager = $this->input->post('manager');
|
||||
}
|
||||
$perm_data['manager'] = $manager;
|
||||
@ -146,12 +146,12 @@ public function createLeave()
|
||||
$perm_data['status'] = 'pending';
|
||||
$perm_data['created_date'] = date('d-m-Y');
|
||||
$perm_data['created_time'] = date('H:i A');
|
||||
unset($perm_data['from_date']);
|
||||
unset($perm_data['from_date']);
|
||||
unset($perm_data['to_date']);
|
||||
$table="leave_list";
|
||||
// print_r($perm_data);die;
|
||||
$create_permission = $this->MY_Model->insert($perm_data,$table);
|
||||
|
||||
|
||||
//for notification
|
||||
if($create_permission){
|
||||
$code = 'LEAVE_PERMISSION';
|
||||
@ -163,21 +163,21 @@ public function createLeave()
|
||||
redirect('Leave/LeaveHistory');
|
||||
}
|
||||
//end of permission
|
||||
|
||||
|
||||
|
||||
//Leave create part
|
||||
$data = $this->input->post();
|
||||
unset($data['perm_date']);
|
||||
unset($data['from_time']);
|
||||
unset($data['from_time']);
|
||||
unset($data['to_time']);
|
||||
|
||||
if(isset($data['emp_id'])){
|
||||
if(isset($data['emp_id'])){
|
||||
$emp_id =$this->input->post('emp_id');
|
||||
}else{
|
||||
$emp_id = user()->id;
|
||||
}
|
||||
$data['emp_id'] = $emp_id;
|
||||
|
||||
|
||||
if($data['manager']==""){
|
||||
if(employee()->manager == null)
|
||||
{
|
||||
@ -188,9 +188,9 @@ public function createLeave()
|
||||
|
||||
$manager = employee()->manager;
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
|
||||
$manager = $this->input->post('manager');
|
||||
}
|
||||
$data['manager'] = $manager;
|
||||
@ -198,51 +198,51 @@ public function createLeave()
|
||||
$data['status'] = 'pending';
|
||||
$data['created_date'] = date('d-m-Y');
|
||||
$data['created_time'] = date('H:i A');
|
||||
$leave_year = date('Y', strtotime($this->input->post('from_date')));
|
||||
$leave_year = date('Y', strtotime($this->input->post('from_date')));
|
||||
|
||||
//get employee's leave count
|
||||
//get employee's leave count
|
||||
$emp_leave_count = $this->Leave_model->get_leave( $emp_id , user()->business_id , "emp_leave_days", $leave_year, $this->input->post('type'));
|
||||
$leave_master_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// count number of days between two dates
|
||||
$days_between = ceil(abs(strtotime($this->input->post('to_date')) - strtotime($this->input->post('from_date'))) / 86400);
|
||||
$data['no_of_days'] = $days_between + 1;
|
||||
$noofdays = $days_between + 1;
|
||||
$noofdays = $days_between + 1;
|
||||
|
||||
|
||||
//this part is create and update leave data
|
||||
if (count($emp_leave_count) != 0)
|
||||
{
|
||||
|
||||
if (count($emp_leave_count) != 0)
|
||||
{
|
||||
|
||||
if($noofdays > $emp_leave_count[0]->remaining_days)
|
||||
{
|
||||
{
|
||||
$this->session->set_flashdata('error', '1');
|
||||
redirect('Leave/applyLeave/'.'update');
|
||||
redirect('Leave/applyLeave/'.'update');
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
//this part is update if date inculeded in emp_leave_days table
|
||||
$data['leave_bal'] = $emp_leave_count[0]->remaining_days;
|
||||
$days['remaining_days'] = $emp_leave_count[0]->remaining_days;
|
||||
$this->Leave_model->update_leave($days, $emp_id , 'emp_leave_days', $leave_year, $this->input->post('type'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
if($noofdays > $leave_master_count[0]->days)
|
||||
{
|
||||
{
|
||||
$this->session->set_flashdata('error', '1');
|
||||
redirect('Leave/applyLeave/'.'update');
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$all_leave_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
|
||||
$data['leave_bal'] = $all_leave_count[0]->days;
|
||||
$days['remaining_days'] = $all_leave_count[0]->days;
|
||||
|
||||
|
||||
$days['business_id'] = user()->business_id;
|
||||
$days['emp_id'] = $emp_id;
|
||||
$days['total_days'] = $all_leave_count[0]->days;
|
||||
@ -263,19 +263,19 @@ public function createLeave()
|
||||
|
||||
if ($from_date >= $j_date && $from_date <= $to_date) {
|
||||
$table="leave_list";
|
||||
$create_leave = $this->MY_Model->insert($data,$table);
|
||||
$create_leave = $this->MY_Model->insert($data,$table);
|
||||
} else {
|
||||
$this->session->set_flashdata('error', '1');
|
||||
redirect('Leave/applyLeave/'.'update');
|
||||
|
||||
}
|
||||
|
||||
|
||||
if($create_leave){
|
||||
$code = 'APPLY_LEAVE';
|
||||
$type = 'Email';
|
||||
$this->notification->sendNotification($create_leave, $code, $type);
|
||||
}
|
||||
|
||||
|
||||
//audit
|
||||
if($create_leave)
|
||||
{
|
||||
@ -284,7 +284,7 @@ public function createLeave()
|
||||
$this->audit->set('table',$table);
|
||||
//fetch new_data after post data insert
|
||||
$this->audit->fetch('new_data');
|
||||
//audit history generation for insert
|
||||
//audit history generation for insert
|
||||
$test = $this->audit->create_history('insert');
|
||||
}
|
||||
$this->session->set_flashdata('Success', '1');
|
||||
@ -293,13 +293,13 @@ public function createLeave()
|
||||
|
||||
|
||||
public function edit_leave_function()
|
||||
{
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
$emp_leave_count = $this->Leave_model->get("emp_leave_days");
|
||||
$emp = $this->Emp_model->get_employee(user()->business_id);
|
||||
$business_id = user()->business_id;
|
||||
$leavetype = $this->Leave_model->getLeaveType($business_id);
|
||||
|
||||
|
||||
$editleave = $this->Leave_model->editleave($id);
|
||||
// print_r($leavetype);
|
||||
// print_r($id);
|
||||
@ -315,23 +315,23 @@ public function edit_leave_function()
|
||||
}
|
||||
|
||||
public function editleave()
|
||||
{
|
||||
{
|
||||
|
||||
if($this->input->post('type') === '9')
|
||||
{
|
||||
if($this->input->post('type') === '1')
|
||||
{
|
||||
$action = $this->input->post();
|
||||
unset($action['from_date']);
|
||||
unset($action['to_date']);
|
||||
$id = $this->input->post('id');
|
||||
|
||||
if(isset($action['emp_id'])){
|
||||
if(isset($action['emp_id'])){
|
||||
$emp_id =$this->input->post('emp_id');
|
||||
}else{
|
||||
$emp_id = user()->id;
|
||||
}
|
||||
$action['emp_id'] = $emp_id;
|
||||
if($action['manager']){
|
||||
$manager = $this->input->post('manager');
|
||||
$manager = $this->input->post('manager');
|
||||
}else{
|
||||
$manager = employee()->manager;
|
||||
}
|
||||
@ -345,12 +345,12 @@ public function editleave()
|
||||
$this->session->set_flashdata('update', '0');
|
||||
redirect('Leave/LeaveHistory');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$action = $this->input->post();
|
||||
$id = $this->input->post('id');
|
||||
if(isset($action['emp_id'])){
|
||||
if(isset($action['emp_id'])){
|
||||
$emp_id =$this->input->post('emp_id');
|
||||
}else{
|
||||
$emp_id = user()->id;
|
||||
@ -362,46 +362,46 @@ public function editleave()
|
||||
$emp_leave_count = $this->Leave_model->get_leave( $emp_id , user()->business_id , "emp_leave_days", $leave_year, $this->input->post('type'));
|
||||
$leave_master_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
|
||||
|
||||
|
||||
|
||||
// count number of days between two dates
|
||||
$days_between = ceil(abs(strtotime($this->input->post('to_date')) - strtotime($this->input->post('from_date'))) / 86400);
|
||||
$action['no_of_days'] = $days_between + 1;
|
||||
$noofdays = $days_between + 1;
|
||||
$action['no_of_days'] = $days_between + 1;
|
||||
$noofdays = $days_between + 1;
|
||||
$leave_id = $this->input->post('id');
|
||||
if (count($emp_leave_count) != 0)
|
||||
{
|
||||
if (count($emp_leave_count) != 0)
|
||||
{
|
||||
if($noofdays > $emp_leave_count[0]->remaining_days)
|
||||
{
|
||||
{
|
||||
$this->session->set_flashdata('error', '1');
|
||||
redirect('Leave/edit_leave_function?id='.md5($leave_id));
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
//this part is update if date inculeded in emp_leave_days table
|
||||
$action['leave_bal'] = $emp_leave_count[0]->remaining_days;
|
||||
$days['remaining_days'] = $emp_leave_count[0]->remaining_days;
|
||||
$this->Leave_model->update_leave($days, $emp_id , 'emp_leave_days', $leave_year, $this->input->post('type'));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
if($noofdays > $leave_master_count[0]->days)
|
||||
{ $this->session->set_flashdata('error', '1');
|
||||
redirect('Leave/edit_leave_function?id='.md5($leave_id));
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$all_leave_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
|
||||
$data['leave_bal'] = $all_leave_count[0]->days;
|
||||
$days['remaining_days'] = $all_leave_count[0]->days;
|
||||
|
||||
|
||||
$days['business_id'] = user()->business_id;
|
||||
$days['emp_id'] = $emp_id;
|
||||
$days['total_days'] = $all_leave_count[0]->days;
|
||||
$days['type'] = $all_leave_count[0]->id;
|
||||
$days['year'] = $leave_year;
|
||||
$this->MY_Model->insert($days,'emp_leave_days');
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -422,7 +422,7 @@ public function editleave()
|
||||
redirect('Leave/applyLeave/'.'update');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function get_leave_count()
|
||||
@ -434,7 +434,7 @@ public function get_leave_count()
|
||||
echo json_encode($emp_leave_count);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function get_all_leave_count()
|
||||
@ -442,21 +442,21 @@ public function get_all_leave_count()
|
||||
$id = $this->input->get('type_id');
|
||||
$all_leave_count = $this->Leave_model->get_id( $id , user()->business_id , "leave_master");
|
||||
echo json_encode($all_leave_count);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getDeleteConfirmationPopup()
|
||||
{
|
||||
$data = array();
|
||||
$htmlPage = $this->load->view('confirmation_popup.php',$data,true);
|
||||
echo json_encode($htmlPage);
|
||||
echo json_encode($htmlPage);
|
||||
}
|
||||
|
||||
public function getDeclineConfirmationPopup()
|
||||
{
|
||||
$data = array();
|
||||
$htmlPage = $this->load->view('confirmation_popup_2.php',$data,true);
|
||||
echo json_encode($htmlPage);
|
||||
echo json_encode($htmlPage);
|
||||
}
|
||||
|
||||
public function ApproveLeave()
|
||||
@ -472,18 +472,18 @@ public function ApproveLeave()
|
||||
{
|
||||
$remaining_days = $this->Leave_model->remaining_days($emp_id, user()->business_id, $leave_year, $no_of_days->type);
|
||||
$balance_days = $remaining_days[0]->remaining_days - $no_of_days->no_of_days;
|
||||
|
||||
|
||||
$data['leave_bal'] = $balance_days;
|
||||
$days['remaining_days'] = $balance_days;
|
||||
$this->Leave_model->emp_leave_days_update($emp_id, $days, $leave_year, $business_id, $no_of_days->type);
|
||||
}
|
||||
|
||||
|
||||
$data['status'] = 'Approved';
|
||||
$data['approved_by']= user()->id;
|
||||
$data['approved_at'] = date('d-m-Y H:i:s');
|
||||
$leave_approve = $this->Leave_model->LeaveApprove($id, $data);
|
||||
if($leave_approve){
|
||||
|
||||
|
||||
if($leave_type->leave_code === 'permission'){
|
||||
$code = 'APPROVE_PERMISSION';
|
||||
}
|
||||
@ -494,14 +494,14 @@ public function ApproveLeave()
|
||||
$this->notification->sendNotification($id, $code, $type);
|
||||
}
|
||||
redirect('Leave/leaveList');
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getManagerConfirmationPopup()
|
||||
{
|
||||
$data = array();
|
||||
$htmlPage = $this->load->view('confirmation_popup.php',$data,true);
|
||||
echo json_encode($htmlPage);
|
||||
echo json_encode($htmlPage);
|
||||
}
|
||||
public function ManagerLeaveApprove()
|
||||
{
|
||||
@ -518,14 +518,14 @@ public function ManagerLeaveApprove()
|
||||
$data['leave_bal'] = $balance_days;
|
||||
$days['remaining_days'] = $balance_days;
|
||||
$this->Leave_model->emp_leave_days_update($emp_id, $days, $leave_year, $business_id, $no_of_days->type);
|
||||
|
||||
|
||||
|
||||
$data['status'] = 'Approved';
|
||||
$data['approved_by']= user()->name;
|
||||
$data['approved_at'] = date('d-m-Y H:i:s');
|
||||
$leave_approve = $this->Leave_model->LeaveApprove($id, $data);
|
||||
if($leave_approve){
|
||||
|
||||
|
||||
if($leave_type->leave_code === 'permission'){
|
||||
$code = 'APPROVE_PERMISSION';
|
||||
}
|
||||
@ -534,12 +534,12 @@ public function ManagerLeaveApprove()
|
||||
}
|
||||
$type = 'Email';
|
||||
$this->notification->sendNotification($id, $code, $type);
|
||||
}
|
||||
redirect('Leave/manager_approvel');
|
||||
}
|
||||
redirect('Leave/manager_approvel');
|
||||
}
|
||||
|
||||
public function Decline()
|
||||
{
|
||||
{
|
||||
$id=$this->input->post('id');
|
||||
$data['status'] = 'Declined';
|
||||
$data['declined_by']= user()->name;
|
||||
@ -555,7 +555,7 @@ public function Decline()
|
||||
$code = 'DECLINE_LEAVE';
|
||||
}
|
||||
$type = 'Email';
|
||||
$return = $this->notification->sendNotification($id, $code, $type);
|
||||
$return = $this->notification->sendNotification($id, $code, $type);
|
||||
|
||||
}
|
||||
redirect('Leave/leaveList');
|
||||
@ -563,7 +563,7 @@ public function Decline()
|
||||
}
|
||||
|
||||
public function managerDecline()
|
||||
{
|
||||
{
|
||||
$id=$this->input->post('id');
|
||||
$data['status'] = 'Declined';
|
||||
$data['declined_by']= user()->name;
|
||||
@ -579,7 +579,7 @@ public function managerDecline()
|
||||
$code = 'DECLINE_LEAVE';
|
||||
}
|
||||
$type = 'Email';
|
||||
$return = $this->notification->sendNotification($id, $code, $type);
|
||||
$return = $this->notification->sendNotification($id, $code, $type);
|
||||
|
||||
}
|
||||
redirect('Leave/manager_approvel');
|
||||
@ -588,7 +588,7 @@ public function managerDecline()
|
||||
|
||||
|
||||
public function cancled()
|
||||
{
|
||||
{
|
||||
$id=$this->input->get('id');
|
||||
$data['status'] = 'canceled';
|
||||
$data['cancled_at'] = date('d-m-Y H:i:s');
|
||||
@ -598,7 +598,7 @@ public function cancled()
|
||||
}
|
||||
|
||||
public function LeaveHistory()
|
||||
{
|
||||
{
|
||||
$business_id = user()->business_id;
|
||||
$leave_list = $this->Leave_model->get_leave_with_emp_name(user()->business_id);
|
||||
$leave_type = $this->Leave_model->get_leave_type($business_id);
|
||||
@ -610,17 +610,17 @@ public function LeaveHistory()
|
||||
|
||||
|
||||
public function manager_approvel()
|
||||
{
|
||||
|
||||
{
|
||||
|
||||
$business_id = user()->business_id;
|
||||
$user_id = user()->id;
|
||||
$manager = $this->Leave_model->under_emp_manager($user_id, $business_id);
|
||||
$decline_dropdown = $this->Leave_model->decline_dropdown($business_id);
|
||||
$leave_list = $this->Leave_model->get_all_leave_request_by_manager_id(user()->business_id, user()->id);
|
||||
$leave_list_with_delegation = $this->Leave_model->get_all_leave_request_by_manager_id_with_delegation(user()->business_id, user()->id);
|
||||
$leave_list_with_delegation = $this->Leave_model->get_all_leave_request_by_manager_id_with_delegation(user()->business_id, user()->id);
|
||||
if($leave_list_with_delegation == NULL){
|
||||
$leave_list_with_delegation = [];
|
||||
}
|
||||
}
|
||||
$mergedArray = array_merge($leave_list, $leave_list_with_delegation);
|
||||
$this->layout->set('tableData', $mergedArray);
|
||||
$this->layout->set('dropdown', $decline_dropdown);
|
||||
@ -631,4 +631,4 @@ public function manager_approvel()
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
<!-- bootstrap-daterangepicker -->
|
||||
<script src="https://localhost/ams//assets/default/moment/min/moment.min.js"></script>
|
||||
<script src="https://localhost/ams//assets/default/bootstrap-daterangepicker/daterangepicker.js"></script>
|
||||
<!-- bootstrap-datetimepicker -->
|
||||
<!-- bootstrap-datetimepicker -->
|
||||
<script src="https://localhost/ams//assets/default/bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>
|
||||
|
||||
<!-- bootstrap-daterangepicker -->
|
||||
@ -61,7 +61,7 @@
|
||||
type: 'error',
|
||||
styling: 'bootstrap3'
|
||||
});">Error</button>
|
||||
<input type="hidden" id="error" value="<?php echo $this->session->userdata('error');?>" >
|
||||
<input type="hidden" id="error" value="<?php echo $this->session->userdata('error');?>" >
|
||||
<?php echo $this->session->unset_userdata('error');?>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
@ -71,8 +71,8 @@
|
||||
$('#button').click();
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<div class="">
|
||||
@ -95,24 +95,24 @@
|
||||
<div class="x_content">
|
||||
<br />
|
||||
|
||||
<?php if(!empty($editleave)) { ?>
|
||||
|
||||
<?php if(!empty($editleave)) { ?>
|
||||
|
||||
<?php foreach( $editleave as $leave) { ?>
|
||||
|
||||
<form id="myForm" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url()?>Leave/editleave" enctype="multipart/form-data">
|
||||
|
||||
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>">
|
||||
|
||||
|
||||
|
||||
<div class="item form-group">
|
||||
|
||||
|
||||
<label class="control-label col-md-2 col-sm-2 " for="last-name">Leave Applied For</label>
|
||||
<div class="col-md-5 col-sm-5 ">
|
||||
|
||||
|
||||
<input type="radio" name="risedby" value="self"style="margin:10px;"checked /><b>Self</b>
|
||||
|
||||
<input type="radio" name="risedby" value="<?php echo user()->name;?>" style="margin: 10px;" /><b>Others</b>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="item form-group">
|
||||
@ -120,21 +120,21 @@
|
||||
<div class="col-md-5 col-sm-5 ">
|
||||
<select id="user_dropdown" name="emp_id" style="margin-top: 10px;padding-bottom: 10px;" class="form-control" > </select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item form-group">
|
||||
|
||||
<label class="control-label col-md-2 col-sm-2 " for="last-name">Leave Type<a style="color:red;">*</a> </label>
|
||||
<div class="col-md-5 col-sm-5 ">
|
||||
<select id="type" name="type" required class="form-control" onchange="permission(this.id)" >
|
||||
<select id="type" name="type" required class="form-control" >
|
||||
<?php foreach ($leavetype as $key => $val) { ?>
|
||||
<?php if ($leave->type == $val->id) { ?>
|
||||
<option value="<?php echo $leave->type; ?>" selected><?php echo $val->type; ?></option>
|
||||
<option name="leaveCode" id="<?php echo $val->code; ?>" value="<?php echo $leave->type; ?>" selected><?php echo $val->type; ?></option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php foreach ($leavetype as $key => $value) { ?>
|
||||
<?php if ($leave->type != $value->id) { ?>
|
||||
<option id="<?php echo $value->id; ?>" value="<?php echo $value->id; ?>"><?php echo $value->type; ?></option>
|
||||
<option name="leaveCode2" id="<?php echo $value->code; ?>" value="<?php echo $value->id; ?>"><?php echo $value->type; ?></option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
@ -179,9 +179,9 @@
|
||||
<label class="control-label col-md-2 col-sm-2 " for="first-name">Date<a style="color:red;">*</a> </label>
|
||||
<div class="col-md-5 col-sm-5 ">
|
||||
<div class='input-group date'>
|
||||
<input type='text' class="form-control" required name="perm_date" placeholder="DD-MM-YYYY" value="<?php echo $leave->perm_date; ?>" id='myDatepicker'/></div>
|
||||
<input type='text' class="form-control" required name="perm_date" placeholder="DD-MM-YYYY" value="<?php echo $leave->perm_date; ?>" id='myDatepicker'/></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item form-group" id="showtime" >
|
||||
|
||||
@ -191,7 +191,7 @@
|
||||
<option value="<?php echo $leave->from_time; ?>"><?php echo $leave->from_time; ?></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<label class="control-label col-md-1 col-sm-1 " for="last-name">To<a style="color:red;">*</a> </label>
|
||||
<div class="col-md-2 col-sm-2 ">
|
||||
<select id="to_time" class="custom-select" name="to_time" required>
|
||||
@ -206,7 +206,7 @@
|
||||
<label class="control-label col-md-2 col-sm-2 " for="last-name">Note</label>
|
||||
<div class="col-md-5 col-sm-5">
|
||||
<textarea id="comments" name="comments" value="" class="form-control" style="height:100px !important;" type="text" ><?php echo $leave->comments; ?></textarea>
|
||||
|
||||
|
||||
<input type="hidden" name="manager" value="<?php echo employee()->manager ?>">
|
||||
<input type="hidden" name="id" value="<?php echo $leave->id; ?>">
|
||||
|
||||
@ -230,8 +230,8 @@
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Body page content -->
|
||||
|
||||
|
||||
@ -241,42 +241,44 @@
|
||||
|
||||
var currentUserName = '<?php echo user()->name; ?>';
|
||||
var currentUserId = '<?php echo user()->id; ?>';
|
||||
$('#user_dropdown').append('<option value="' + currentUserId + '">' +
|
||||
$('#user_dropdown').append('<option value="' + currentUserId + '">' +
|
||||
currentUserName + '</option>');
|
||||
$('#user_dropdown').prop('disabled', true);
|
||||
|
||||
$('#user_dropdown').on('change',function() {
|
||||
|
||||
|
||||
$('#type').prop('selectedIndex',0);
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('#type').on('change',function() {
|
||||
let id = $("#user_dropdown").val();
|
||||
|
||||
var type_id = $('option:selected', this).attr('id');
|
||||
var type_id = $('option:selected', this).val();
|
||||
console.log('type_id : ', type_id)
|
||||
var fromdate = document.getElementById("fromdate").value;
|
||||
console.log('userID : ', id)
|
||||
|
||||
|
||||
if (id)
|
||||
{
|
||||
$.ajax({
|
||||
data: {id : id, type_id : type_id},
|
||||
$.ajax({
|
||||
data: {id : id, type_id : type_id},
|
||||
type: 'get',
|
||||
url: "<?php echo base_url()?>Leave/get_leave_count/",
|
||||
success: function(response) {
|
||||
response = JSON.parse(response);
|
||||
if(response.length == 0 )
|
||||
{
|
||||
$.ajax({
|
||||
{
|
||||
$.ajax({
|
||||
type: "get",
|
||||
data: {type_id : type_id},
|
||||
url: "<?php echo base_url()?>Leave/get_all_leave_count/",
|
||||
success: function(response) {
|
||||
response = JSON.parse(response);
|
||||
$('#leave_bal').val( response[0].days + ' days');
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
else
|
||||
@ -288,7 +290,7 @@
|
||||
else
|
||||
{
|
||||
$('#leave_bal').val(response[0].remaining_days + ' days');
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -307,15 +309,15 @@
|
||||
$userDropdown.empty();
|
||||
|
||||
if (selectedValue === 'self') {
|
||||
|
||||
|
||||
var currentUserName = '<?php echo user()->name; ?>';
|
||||
var currentUserId = '<?php echo user()->id; ?>';
|
||||
$userDropdown.append('<option value="' + currentUserId + '">' + currentUserName + '</option>');
|
||||
$userDropdown.prop('disabled', true);
|
||||
} else if (selectedValue === '<?php echo user()->name; ?>') {
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('Leave/get_emp_name/')?>"',
|
||||
url: '<?php echo base_url('Leave/get_emp_name/')?>"',
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
@ -328,12 +330,12 @@
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
function get_all_count(id) {
|
||||
|
||||
$.ajax({
|
||||
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "<?php echo base_url()?>Leave/get_all_leave_count/"+id,
|
||||
success: function(response) {
|
||||
@ -371,13 +373,13 @@ function get_all_count(id) {
|
||||
dateFormat: dateFormat,
|
||||
changeYear: true,
|
||||
changeMonth: true,
|
||||
minDate: 0,
|
||||
minDate: 0,
|
||||
onSelect: function (dateText, inst) {
|
||||
calculateDateDifference();
|
||||
DateValidate();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Function to validate the date range
|
||||
function validateDateRange() {
|
||||
var fromDate = fromDateInput.datepicker("getDate");
|
||||
@ -414,25 +416,29 @@ function calculateDateDifference() {
|
||||
{
|
||||
$("#dateDifference").val(difference + ' days');
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
$("#dateDifference").val("");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$('#showtime').hide()
|
||||
$('#showdate').hide()
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function() {
|
||||
|
||||
let type = $('#type').val();
|
||||
|
||||
|
||||
var element = $('[name="leaveCode"]');
|
||||
var id = element.attr('id');
|
||||
|
||||
console.log($('#showtime').val())
|
||||
|
||||
if( type === '1' ){
|
||||
|
||||
if( id === 'permission' ){
|
||||
|
||||
$('#hidedate').hide()
|
||||
$('#balance').hide()
|
||||
@ -453,7 +459,7 @@ function calculateDateDifference() {
|
||||
$('#balance').show()
|
||||
$('#leave_bal').show()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
$('#showtime').hide()
|
||||
@ -464,6 +470,10 @@ function calculateDateDifference() {
|
||||
$('#todate').val('');
|
||||
|
||||
var selectedOptionId = $(this).find(":selected").attr("id");
|
||||
var element2 = $('[name="leaveCode2"]');
|
||||
var id2 = element2.attr('id');
|
||||
console.log('ID:', selectedOptionId);
|
||||
|
||||
if( selectedOptionId === 'permission'){
|
||||
|
||||
$('#hidedate').hide();
|
||||
@ -471,7 +481,7 @@ function calculateDateDifference() {
|
||||
$('#leave_bal').hide();
|
||||
$('#fromdate').removeAttr('required');
|
||||
$('#todate').removeAttr('required');
|
||||
$('#myDatepicker').prop('required', true);
|
||||
$('#myDatepicker').prop('required', true);
|
||||
$('#showtime').show();
|
||||
$('#showdate').show();
|
||||
$('#from_time').prop('required', true);
|
||||
@ -489,7 +499,7 @@ function calculateDateDifference() {
|
||||
$('#leave_bal').show();
|
||||
$('#fromdate').prop('required', true);
|
||||
$('#todate').prop('required', true);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -520,7 +530,7 @@ function filterTimeSlots(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);
|
||||
@ -547,14 +557,14 @@ function filterTimeSlots(startingTime, numberOfHours) {
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user