-
diff --git a/application/config/routes.php b/application/config/routes.php
index 26d98d01..5112a6c2 100644
--- a/application/config/routes.php
+++ b/application/config/routes.php
@@ -69,6 +69,12 @@ $route['assetListing/(:num)'] = "assetdetails/assetListing/$1";
$route['employeeListing'] = 'employeedetails/employeeListing';
$route['employeeListing/(:num)'] = "employeedetails/employeeListing/$1";
+$route['monthlyListings'] = 'monthlypay/monthlyListing';
+$route['monthlyListings/(:num)'] = "monthlypay/monthlyListing/$1";
+
+$route['emppayListings'] = 'emppaydate/emppayListing';
+$route['emppayListings/(:num)'] = 'emppaydate/emppayListing/$1';
+
@@ -143,7 +149,9 @@ $route['checkEmailExists'] = "user/checkEmailExists";
$route['forgotPassword'] = "login/forgotPassword";
$route['ExcelUpload'] = "payslip/viewUpload";
+$route['ExcelUpload2'] = "payslip/viewUpload2";
$route['FileUpload'] = "payslip/uploadExcel";
+$route['FileUpload2'] = "payslip/uploadExcel2";
$route['PrintPdf'] = "payslip/PrintPdf";
$route['ViewPay'] = "payslip/viewGenerator";
diff --git a/application/controllers/emppaydate.php b/application/controllers/emppaydate.php
index a3183713..c11a782b 100644
--- a/application/controllers/emppaydate.php
+++ b/application/controllers/emppaydate.php
@@ -17,117 +17,242 @@ class emppaydate extends BaseController
public function __construct()
{
parent::__construct();
- //$this->load->model('');
+ $this->load->model('emppaydate_model');
$this->load->library('session');
- $this->load->library('form_validation');
+ $this->load->library('form_validation');
//$this->load->library('pagination');
$this->isLoggedIn();
}
+
/**
* This function used to load the first screen of the user
*/
public function index()
{
- $this->global['pageTitle'] = 'Siddharth : Cost';
+ $this->global['pageTitle'] = 'Siddharth : Employee Pay Details';
- $this->loadViews("emppaydate", $this->global);
+ $this->loadViews("emppayListing", $this->global);
}
/**
- * This function is used to load the Cost list
+ * This function is used to load the payment list for a employee.
*/
- /*function monthlypayListing()
+ function emppayListing()
{
-
-
+
+
+ $this->load->model('emppaydate_model');
$searchText = $this->input->post('searchText');
- $data['searchText'] = $searchText;
+ $data['searchText'] = $searchText;
+ $this->load->library('pagination');
- $count = $this->emppaydate_model->CostListingCount($searchText);
+ $count = $this->emppaydate_model->emppayListingCount($searchText);
- $returns = $this->paginationCompress ( "monthlypayListing/", $count, 5 );
+ $returns = $this->paginationCompress ( "emppayListing", $count ,5);
- $data['userRecords'] = $this->emppaydate_model->monthlypayListing($searchText, $returns["page"], $returns["segment"]);
-
- //print_r( $data) ;
- $this->global['pageTitle'] = 'Siddharth : montlypay List';
+ $data['userRecords'] = $this->emppaydate_model->emppayListing($searchText, $returns["page"], $returns["segment"]);
- $this->loadViews("emppaydateListing", $this->global, $data, NULL);
-
+ $this->global['pageTitle'] = 'Siddharth : Employee Pay List';
+
+ $this->loadViews("emppayListing", $this->global, $data, NULL);
}
/**
- * This function is used to load the add new cost Center */
+ * This function is used to load the add new payment for an employee.
+ */
function addemppaydate()
{
-
+ $this->load->model('payroll_model');
+
+ $result['empdetails'] = $this->payroll_model->getEmpID();
//$data['emp_id'] = $this->monthlypay_model->getmonthlypay();
- $this->global['pageTitle'] = 'siddharth : Add Monthly Pay';
+ $this->global['pageTitle'] = 'Siddharth : Add Employee Pay';
- $this->loadViews("addemppaydate", $this->global);
+ $this->loadViews("addemppaydate", $this->global,$result);
- }
-
-
-/*
- function addNewmonthly()
+ }
+
+
+ function addNewemppay()
{
- $this->form_validation->set_rules('pay_data_id','Pay_Data_ID','trim|required');
- $this->form_validation->set_rules('emp_id','emp_id','trim|required');
- $this->form_validation->set_rules('basic_Pay','basic_Pay','trim|required');
- $this->form_validation->set_rules('hra_rate','hra_rate','trim|required');
+ //$this->form_validation->set_rules('Pay_Data_ID','Pay_Data_ID','trim|required');
+ $this->form_validation->set_rules('EmpID','EmpID','trim|required');
+ $this->form_validation->set_rules('Basic_Pay','Basic_Pay','trim|required');
+ $this->form_validation->set_rules('HRA_Rate','HRA_Rate','trim|required');
$this->form_validation->set_rules('OT_Rate','OT_Rate','trim|required');
- $this->form_validation->set_rules('allowances','allowances','trim|required');
+ $this->form_validation->set_rules('Allowances','Allowances','trim|required');
$this->form_validation->set_rules('PF_Rate','PF_Rate','trim|required');
- $this->form_validation->set_rules('ESI_Rate','ESI_Rate','trim|required');
- $this->form_validation->set_rules('All','All','trim|required');
+ $this->form_validation->set_rules('ESI_Rate','ESI_Rate','trim|required');
+ $this->form_validation->set_rules('Food_Allowances','Food_Allowances','trim|requried');
+
if($this->form_validation->run() == FALSE)
{
- $this->addmonthly();
+ $this->addemppaydate();
}
else
{
- $pay_data_id = $this->input->post('pay_data_id');
- $emp_id = $this->input->post('emp_id');
- $LOP_days = $this->input->post('basic_Pay');
- $basic_Pay = $this->input->post('hra_rate');
- $OT_Rate = $this->input->post('OT_Rate');
- $allowances = $this->input->post('allowances');
- $PF_Rate = $this->input->post('PF_Rate');
- $ESI_Rate = $this->input->post('ESI_Rate');
- $All = $this->input->post('All');
+ $Pay_Data_ID=$this->input->post('Pay_Data_ID');
+ $EmpID = $this->input->post('EmpID');
+ $Basic_Pay=$this->input->post('Basic_Pay');
+ $HRA_Rate=$this->input->post('HRA_Rate');
+ $OT_Rate=$this->input->post('OT_Rate');
+ $Allowances=$this->input->post('Allowances');
+ $PF_Rate=$this->input->post('PF_Rate');
+ $ESI_Rate=$this->input->post('ESI_Rate');
+ $Food_Allowances=$this->input->post('Food_Allowances');
+ //$All = $this->input->post('All');
$CreateBy = $this->session->userdata ( 'userId' );
-
- $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
-
- $createddt = $dt->format('Y-m-d H:i:s');
-
- $emppayExists = $this->emppaydate_model->checkemppayExists( $emppay);
-
- if(count($emppay) == 0)
- {
- $emppay = array('pay_data_id'=>$pay_data_id, 'emp_id'=>$emp_id,'basic_Pay'=>$basic_Pay,'hra_rate'=>$hra_rate,'OT_Rate'=>$OT_Rate,'allowances'=>$allowances,'PF_Rate'=>$PF_Rate,'ESI_Rate'=>$ESI_Rate,'All'=>$All,'CreatedBy'=>$CreateBy,'createdDate'=>$createddt);
- $this->monthlypay_model->addNewcost($Cost);
- }
-
-
-
- Print_r('Successfully Created Monthly pay details');
-
+ $chked = $this->input->post('is_Active');
+ $IsActive = '1';
+
+
+
+ //$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
+
+ //$createddt = $dt->format('Y-m-d H:i:s');
+
+ // $emppayExists = $this->emppaydate_model->( $emppay);
+
+ $emppay = array();
+
+
+ $emppay = array('EmpID'=>$EmpID, 'Basic_Pay'=>$Basic_Pay, 'HRA_Rate'=>$HRA_Rate, 'OT_Rate'=>$OT_Rate, 'Allowances'=>$Allowances, 'PF_Rate'=>$PF_Rate, 'ESI_Rate'=>$ESI_Rate ,'Food_Allowances'=>$Food_Allowances,'is_Active'=>$IsActive,'Created_By'=>$CreateBy);
+
+ //print_r($monthdata);
+ $result = $this->emppaydate_model->addNewemppay($emppay);
+
+ if($result > 0)
+ {
+ // $this->session->set_flashdata('success', 'New Asset created successfully');
+
+ redirect('emppaydate/emppayListing','refresh');
+ echo "";
+ }
+ else
+ {
+ redirect('emppaydate/emppayListing','refresh');
+ echo "";
+ }
+
}
}
- /**
+
+ /**
+ * This function is used for editing purpose and it has oldest values only.
+ */
+ function editOldemppay($paydataid= NULL)
+ {
+
+ $data['emppay'] = $this->emppaydate_model->getUserInfo($paydataid);
+ // print_r($data);
+ //$data['monthly_pay_inputs'] = $this->monthlylisting_model->getUserInfo($employeeid);
+
+ $this->global['pageTitle'] = 'Siddharth : Edit Employee Pay Monthly Details ';
+
+ $this->loadViews("editOldemppay", $this->global, $data,NULL);
+
+ }
+
+
+
+ /**
+ * This function is used for stored new values after editing.
+ */
+ function editemppay()
+ {
+
+
+ $this->load->library('form_validation');
+
+ $Pay_Data_ID= $this->input->post('Pay_Data_ID');
+
+ $this->form_validation->set_rules('Pay_Data_ID','Pay_Data_ID','trim|required');
+ $this->form_validation->set_rules('EmpID','EmpID','trim|required');
+ $this->form_validation->set_rules('Basic_Pay','Basic_Pay','trim|required');
+ $this->form_validation->set_rules('HRA_Rate','HRA_Rate','trim|required');
+ $this->form_validation->set_rules('OT_Rate','OT_Rate','trim|required');
+ $this->form_validation->set_rules('Allowances','Allowances','trim|required');
+ $this->form_validation->set_rules('PF_Rate','PF_Rate','trim|required');
+ $this->form_validation->set_rules('ESI_Rate','ESI_Rate','trim|required');
+ $this->form_validation->set_rules('Food_Allowances','Food_Allowances','trim|requried');
+
+
+
+
+ if($this->form_validation->run() == FALSE)
+ {
+
+ $this->editOldemppay();
+
+ }
+
+ else
+ {
+
+ $Pay_Data_ID=$this->input->post('Pay_Data_ID');
+ $EmpID = $this->input->post('EmpID');
+ $Basic_Pay=$this->input->post('Basic_Pay');
+ $HRA_Rate=$this->input->post('HRA_Rate');
+ $OT_Rate=$this->input->post('OT_Rate');
+ $Allowances=$this->input->post('Allowances');
+ $PF_Rate=$this->input->post('PF_Rate');
+ $ESI_Rate=$this->input->post('ESI_Rate');
+ $is_Active=$this->input->post('is_Active');
+ $Last_Mod_By=$this->input->post('Last_Mod_By');
+ $Last_Mod_Time=$this->input->post('Last_Mod_Time');
+ $Food_Allowances=$this->input->post('Food_Allowances');
+ $chked = $this->input->post('is_Active');
+
+ if( $chked != '')
+ {
+ $IsActive = '1';
+ }
+ else
+ {
+ $IsActive = '0';
+ }
+
+
+
+ $emppaydatas = array();
+
+
+ $emppaydatas = array('Pay_Data_ID'=>$Pay_Data_ID, 'EmpID'=>$EmpID, 'Basic_Pay'=>$Basic_Pay, 'HRA_Rate'=>$HRA_Rate, 'OT_Rate'=>$OT_Rate, 'Allowances'=>$Allowances, 'PF_Rate'=>$PF_Rate, 'ESI_Rate'=>$ESI_Rate,'Food_Allowances'=>$Food_Allowances, 'Last_Mod_By'=>$Last_Mod_By, 'Last_Mod_Time'=>$Last_Mod_Time, 'is_Active'=>$IsActive);
+
+
+
+ $result = $this->emppaydate_model->editemppay($emppaydatas);
+
+
+ if($result == true)
+ {
+ $this->session->set_flashdata('success', 'updated successfully');
+ }
+ else
+ {
+ $this->session->set_flashdata('error', 'updation failed');
+ }
+
+
+ redirect('emppaydate/emppayListing');
+ }
+
+ }
+
+
+
+ /**
* This function is used load user edit information
* @param number $userId : Optional : This is user id
*/
diff --git a/application/controllers/monthlypay.php b/application/controllers/monthlypay.php
index ccb3b704..ce596775 100644
--- a/application/controllers/monthlypay.php
+++ b/application/controllers/monthlypay.php
@@ -14,74 +14,80 @@ class monthlypay extends BaseController
/**
* This is default constructor of the class
*/
- public function __construct()
+ public function __construct()
{
parent::__construct();
- //$this->load->model('monthlypay_model');
- $this->load->library('session');
- $this->load->library('form_validation');
- // $this->load->library('pagination');
-
+ $this->load->model('monthlypay_model');
+ $this->load->library('session');
+ $this->load->library('form_validation');
+ // $this->load->library('pagination');
+
$this->isLoggedIn();
}
- /**
+ /**
* This function used to load the first screen of the user
*/
- public function index()
+ public function index()
{
- $this->global['pageTitle'] = 'Siddharth : monthlypay';
+ $this->global['pageTitle'] = 'Siddharth : Monthly Pay Details';
- $this->loadviews('addmonthly',$this->global);
+ $this->loadviews('monthlyListing',$this->global);
}
-
- /**
- * This function is used to load the Cost list
+
+ /**
+ * This function is used to load the monthly list
*/
- /*function monthlypayListing()
+
+ function monthlyListing()
{
-
-
+
+
+ $this->load->model('monthlypay_model');
$searchText = $this->input->post('searchText');
- $data['searchText'] = $searchText;
+ $data['searchText'] = $searchText;
+ $this->load->library('pagination');
- $count = $this->monthlpay_model->CostListingCount($searchText);
+ $count = $this->monthlypay_model->monthlyListingCount($searchText);
- $returns = $this->paginationCompress ( "monthlypayListing/", $count, 5 );
+ $returns = $this->paginationCompress ( "monthlyListing", $count ,5);
- $data['userRecords'] = $this->monthlypay_model->monthlypayListing($searchText, $returns["page"], $returns["segment"]);
-
- //print_r( $data) ;
- $this->global['pageTitle'] = 'Siddharth : montlypay List';
+ $data['userRecords'] = $this->monthlypay_model->monthlyListing($searchText, $returns["page"], $returns["segment"]);
- $this->loadViews("monthlypayListing", $this->global, $data, NULL);
-
- }*/
-
- /**
- * This function is used to load the add new cost Center */
+ $this->global['pageTitle'] = 'Siddharth : Monthly Pay List';
+
+ $this->loadViews("monthlyListing", $this->global, $data, NULL);
+ }
+
+ /**
+ * This function is used to load the filtering monthly list
+ */
+
+
+
+ /**
+ * This function is used to load the add new monthlypay
+ */
function addmonthly()
{
- //$data['emp_id'] = $this->monthlypay_model->getmonthlypay();
+ //$data['emp_id'] = $this->monthlypay_model->getmonthlypay();
$this->global['pageTitle'] = 'siddharth : Add Monthly Pay';
- $this->loadviews('addmontly',$this->global, NULL);
+ $this->loadviews('addMontly',$this->global, NULL);
- }
-
-
-/*
+ }
+
function addNewmonthly()
{
- $this->form_validation->set_rules('month_year','month_year','trim|required');
- $this->form_validation->set_rules('emp_id','emp_id','trim|required');
+ $this->form_validation->set_rules('Month_Year','month_year','trim|required');
+ $this->form_validation->set_rules('EmpID','emp_id','trim|required');
$this->form_validation->set_rules('LOP_days','LOP_days','trim|required');
$this->form_validation->set_rules('OT_Hrs_Worked','OT_Hrs_Worked','trim|required');
$this->form_validation->set_rules('Loan_Recovered','Loan_Recovered','trim|required');
@@ -105,154 +111,124 @@ class monthlypay extends BaseController
$Other_Deductions = $this->input->post('Other_Deductions');
$CreateBy = $this->session->userdata ( 'userId' );
-
- $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
-
- $createddt = $dt->format('Y-m-d H:i:s');
-
- $monthlypayExists = $this->monthlypay_model->checkmonthlypayExists( $monthlypay);
-
- if(count($CodeExists) == 0)
- {
- $montlypay = array('month_year'=>$month_year, 'emp_id'=>$emp_id,'LOP_days'=>$LOP_days,'OT_Hrs_Worked'=>$Loan_Recovered,'Loan_Balance'=>$Loan_Balance,'Incentives'=>$Incentives,'Other_Deductions'=>$Other_Deductions,'CreatedBy'=>$CreateBy,'createdDate'=>$createddt);
- $this->monthlypay_model->addNewmonthly($monthlypay);
- }
-
-
-
- Print_r('Successfully Created Monthly pay details');
+
+ $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
+
+ $createddt = $dt->format('Y-m-d H:i:s');
+
+ $monthlypayExists = $this->monthlypay_model->checkmonthlypayExists( $monthlypay);
+
+ if(count($CodeExists) == 0)
+ {
+ $montlypay = array('month_year'=>$month_year, 'emp_id'=>$emp_id,'LOP_days'=>$LOP_days,'OT_Hrs_Worked'=>$Loan_Recovered,'Loan_Balance'=>$Loan_Balance,'Incentives'=>$Incentives,'Other_Deductions'=>$Other_Deductions,'CreatedBy'=>$CreateBy,'createdDate'=>$createddt);
+ $this->monthlypay_model->addNewmonthly($monthlypay);
+ }
+
+
+
+ Print_r('Successfully Created Monthly pay details');
}
}
- /**
- * This function is used load user edit information
- * @param number $userId : Optional : This is user id
+
+ /**
+ * This function is used for editing purpose and it has oldest values.
*/
- /*function editOldcost($CostCode = NULL)
+
+ function editOldmonthly($EmpID='',$month_year='')
{
-
- if($CostCode == '')
- {
- $CostCenterID = $_GET['CostCode'];
- }
- else
- {
-
- $CostCenterID = $CostCode; }
+ /*if($employeeid == null)
+ {
+
+ redirect('monthlypay/monthlyListing');
+ }*/
- $data['CostMaster'] = $this->costcenter_model->GetCostCenterMaster($CostCenterID);
- $data['CostDepts'] = $this->costcenter_model->GetCostCenterDepartment($CostCenterID);
- $data['CostBudget'] = $this->costcenter_model->GetCostCenterBudget($CostCenterID);
- // $data['DeptList'] = $this->costcenter_model->GetDepartmentNotinCostCenter($CostCenterID);
-
+
- $this->global['pageTitle'] = 'Siddharth : Edit Cost';
+ $data['monthly'] = $this->monthlypay_model->getUserInfo($EmpID,$month_year);
+ //$data['monthly_pay_inputs'] = $this->monthlylisting_model->getUserInfo($employeeid);
+
+ $this->global['pageTitle'] = 'Siddharth : Edit Monthly Listing';
- $this->loadViews("editOldcost", $this->global, $data,NULL);
+ $this->loadViews("editOldmonthly", $this->global, $data,NULL);
}
-
- function ech()
- {
-
- echo $this->input->post('CostCentreID');
- echo $this->input->post('CostName');
- echo $this->input->post('Description');
-
- }
-
- /**
- * This function is used to edit the user information
-
- function editcost()
+
+
+
+ /**
+ * This function is used for stored new values after editing.
+ */
+ function editmonthly()
{
-
+
$this->load->library('form_validation');
- $CostCenterID = $this->input->post('CostCentreID');
-
- $this->form_validation->set_rules('CostName','Cost Name','trim|required|');
- $this->form_validation->set_rules('Description','Description','trim|required|');
-
+ $EmpID= $this->input->post('EmpID');
+ $month_year = $this->input->post('Month_Year');
+ $this->form_validation->set_rules('Month_Year','month_year','trim|required');
+ $this->form_validation->set_rules('EmpID','EmpID','trim|required');
+ $this->form_validation->set_rules('LOP_Days','LOP_Days','trim|required');
+ $this->form_validation->set_rules('OT_Hrs_Worked','OT_Hrs_Worked','trim|required');
+ $this->form_validation->set_rules('Loan_Recovered','Loan_Recovered','trim|required');
+ $this->form_validation->set_rules('Loan_Balance','Loan_Balance','trim|required');
+ $this->form_validation->set_rules('Incentives','Incentives','trim|required');
+ $this->form_validation->set_rules('Other_Deductions','Other_Deductions','trim|required');
+
if($this->form_validation->run() == FALSE)
{
- $this->editcost($CostCenterID);
+
+ $this->editOldmonthly($EmpID,$month_year);
}
+
else
{
- $CostCenterID = $this->input->post('CostCentreID');
- $CostName = ucwords(strtolower($this->input->post('CostName')));
- $Description = $this->input->post('Description');
-
-
-
- //$this->costcenter_model->editcost($Cost);
- $cost = array();
-
+
+ $month_year = $this->input->post('Month_Year');
+ $EmpID = $this->input->post('EmpID');
+ $LOP_Days =$this->input->post('LOP_Days');
+ $OT_Hrs_Worked = $this->input->post('OT_Hrs_Worked');
+ $Loan_Recovered = $this->input->post('Loan_Recovered');
+ $Loan_Balance = $this->input->post('Loan_Balance');
+ $Incentives = $this->input->post('Incentives');
+ $Other_Deductions = $this->input->post('Other_Deductions');
+ $LastModBy = $this->session->userdata ( 'userId' );
+
+ $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
+ $LastModTime = $dt->format('Y-m-d H:i:s');
+
-
- $Cost = array('CostCentreID'=>$CostCenterID,'CostName'=>$CostName, 'Description'=>$Description,'createdDate'=>date('Y-m-d H:i:sa'));
-
-
-
-
- $result = $this->costcenter_model->editcost($Cost, $CostCenterID);
+
+ $monthdata = array();
+
+
+ $monthdata = array('Month_Year'=>$month_year,'EmpID'=>$EmpID,'LOP_Days'=>$LOP_Days,'OT_Hrs_Worked'=>$OT_Hrs_Worked,'Loan_Recovered'=>$Loan_Recovered,'Loan_Balance'=>$Loan_Balance,'Incentives'=>$Incentives,'Other_Deductions'=>$Other_Deductions,'Last_Mod_By'=>$LastModBy,'Last_Mod_Time'=>$LastModTime);
+
+
+
+ $result = $this->monthlypay_model->editmonth($monthdata,$EmpID);
+
if($result == true)
{
- $this->session->set_flashdata('success', 'Cost updated successfully');
+ $this->session->set_flashdata('success', 'updated successfully');
}
else
{
- $this->session->set_flashdata('error', 'Cost updation failed');
+ $this->session->set_flashdata('error', 'updation failed');
}
-
- redirect('costListing');
- }
+ //echo success;
+
+ redirect('monthlyListings');
+ }
}
- function viewcost($CostCenterID = NULL)
- {
-
- if($CostCenterID == null)
- {
- redirect('costListing');
- }
-
- $data['Cost'] = $this->costcenter_model->getuserinfo($CostCenterID);
- //$data['users'] = $this->purchaseorder_model->getusers();
-
- $this->global['pageTitle'] = 'Siddharth : View Cost';
-
- $this->loadViews("viewcost", $this->global, $data,NULL);
-
- }
-
- /**
- * This function is used to delete the user using userId
- * @return boolean $result : TRUE / FALSE
-
- function deletecost()
- {
- if($this->isAdmin() == TRUE)
- {
- echo(json_encode(array('status'=>'access')));
- }
- else
- {
- $CostCenterID = $this->input->Costst('CostCentreID');
- $cost = array('CreateDate'=>date('Y-m-d H:i:sa'));
-
- $result = $this->costcenter_model->deletecost($Cost, $CostCenterID);
-
- if ($result > 0) { echo(json_encode(array('status'=>TRUE))); }
- else { echo(json_encode(array('status'=>FALSE))); }
- }
- }
- */
+
+
+
function pageNotFound()
{
diff --git a/application/controllers/payslip.php b/application/controllers/payslip.php
index 2064b0bf..8817c7c2 100644
--- a/application/controllers/payslip.php
+++ b/application/controllers/payslip.php
@@ -21,6 +21,21 @@ class payslip extends BaseController
$this->load->library('form_validation');
$this->isLoggedIn();
}
+
+
+ /**
+ * This function used to call stored procedure named with final_payroll_data()
+ */
+ public function callsp(){
+
+ $payon = $this->input->post('payon');
+ $employee = $this->input->post('employee');
+ $result = $this->payroll_model->model_sp($payon,$employee);
+ return TRUE;
+ //$this->db->call_function('model_sp');
+
+}
+
/**
* This function used to load the first screen of the user
*/
@@ -32,6 +47,18 @@ class payslip extends BaseController
$this->loadViews("payslipupload", $this->global, null , NULL);
}
+
+ /**
+ * This function used to load the first screen of the user
+ */
+ public function viewUpload2()
+ {
+
+ $this->global['pageTitle'] = 'Siddharth : Payroll Data Upload2';
+
+
+ $this->loadViews("payslipupload2", $this->global, null , NULL);
+ }
/**
* This function used to load the first screen of the user
@@ -40,7 +67,7 @@ class payslip extends BaseController
{
//echo 'inside funtion';
$Data['Payon'] = $this->payroll_model->getPayOn();
- $Data['Emplist'] = $this->payroll_model->getEmployeelist();
+ //$Data['Emplist'] = $this->payroll_model->getEmployeelist();
$this->global['pageTitle'] = 'Siddharth : Payroll Generater';
@@ -66,15 +93,18 @@ class payslip extends BaseController
function getEmployee()
{
-
- $id = $this->input->post('id');
+ $id = $this->input->post('id1');
- $result = $this->payroll_model->getEmployeelist($id );
+ $result = $this->payroll_model->getEmployeelist2($id );
+
$HTML="";
if($result->num_rows() > 0){
+
foreach($result->result() as $list){
- $HTML.="";
+
+
+ $HTML.="";
}
}
echo $HTML;
@@ -325,6 +355,190 @@ function getEmployee()
}
+ }
+
+ /**
+ * This function used to upload the Excel file Details2
+ */
+ function uploadExcel2(){
+
+
+ $PayrollFileName = '';
+
+ //Check whether user upload picture
+ if(!empty($_FILES['userfile']['name']))
+ {
+ //echo 'inside if';
+ $pathinfo = pathinfo($_FILES['userfile']['name']);
+ $config['upload_path'] = 'uploads/files/';
+ $config['allowed_types'] = 'xls|xlsx|csv';
+ $config['file_name'] = $_FILES['userfile']['name'];
+ $config['overwrite'] = true;
+
+ //Load upload library and initialize configuration
+ $this->load->library('upload',$config);
+ $this->upload->initialize($config);
+
+ if (($pathinfo['extension'] == 'xlsx' || $pathinfo['extension'] == 'xls')
+ && $_FILES['userfile']['size'] > 0 )
+ {
+ if($this->upload->do_upload('userfile'))
+ {
+ $uploadData = $this->upload->data();
+ $PayrollFileName = $uploadData['file_name'];
+
+
+ }
+ else
+ {
+ $error = array('error' => $this->upload->display_errors());
+ $PayrollFileName = '';
+ }
+
+ $inputFileName = $_FILES['userfile']['tmp_name'];
+
+ require_once APPPATH .'third_party/PHPExcel/IOFactory.php';
+ $objTpl = PHPExcel_IOFactory::load($inputFileName);
+
+ $sheet = $objTpl->getActiveSheet(0) ;//->toArray(null, NULL, True, True);
+
+ $highestRow = $sheet->getHighestRow();
+ $highestColumn = $sheet->getHighestColumn();
+
+
+ $x = 8;
+ $month=$this->input->post('mon');
+ $year=$this->input->post('yr');
+ $PayOn= $month . "-" . $year;
+ $createdby = $this->session->userdata ( 'userId' );
+
+
+ if($month=='01' || $month=='03' || $month=='05' || $month=='07' || $month=='08' || $month=='10' || $month=='12')
+ {
+ $Totaldays = 31;
+ }
+ else if($month=='04' || $month=='06' || $month=='09' || $month=='11'){
+ $Totaldays = 30;
+ }
+ else{
+ $Totaldays = 28;
+ }
+
+
+ // $Totaldays = 0;
+ //echo $highestRow;
+ $FileDetails = array('PayOn'=>$PayOn,'TotalNoofDays'=>$Totaldays,'FileName'=> $config['file_name'],'CreatedBy'=>$createdby);
+ $result = $this->payroll_model->UploadFileName($FileDetails);
+
+ $fail=0;
+ $success=0;
+ for($x=8;$x<=$highestRow;$x++){
+
+ $EmpId = $sheet->getCell('A'.$x)->getValue();
+ //echo $EmpId;
+
+
+
+ $FileDataExists = $this->payroll_model->checkFileDetailsExists2($PayOn,$EmpId);
+ //echo $FileExists;
+
+ //die();
+
+ //echo $FileDataExists;
+ //die();
+ if ($FileDataExists=='' || $FileDataExists==0)
+ {
+ //$FileDetails = array('PayOn'=>$PayOn,'TotalNoofDays'=>$Totaldays,'FileName'=>$PayrollFileName,'CreatedBy'=>$createdby);
+
+
+
+ // $result = $this->payroll_model->UploadFileName($FileDetails);
+
+
+
+
+
+ //for($x=8; $x <= $highestRow; $x++)
+ //{
+
+
+ $EmpId = $sheet->getCell('A'.$x)->getValue();
+ $LOPDays = $sheet->getCell('B'.$x)->getValue();
+ $OTHoursWorked =$sheet->getCell('C'.$x)->getValue();
+ $loanRecovered=$sheet->getCell('D'.$x)->getValue();
+ $loanBalance=$sheet->getCell('E'.$x)->getValue();
+ $Incentive =$sheet->getCell('F'.$x)->getValue();
+ $Other_Deductions =$sheet->getCell('G'.$x)->getValue();
+
+ if( $EmpId != '')
+ {
+
+ $FileData = array('Month_Year'=>$PayOn,'EmpID'=>$EmpId,'LOP_Days'=>$LOPDays,'OT_Hrs_Worked'=>$OTHoursWorked,'Loan_Recovered'=>$loanRecovered,'Loan_Balance'=>$loanBalance,'Incentives'=>$Incentive,'Other_Deductions'=>$Other_Deductions,'Created_By'=>$createdby,'Created_Time'=>date("Y-m-d h:i:sa"));
+ $result = $this->payroll_model->UploadFileData2($FileData);
+ $success++;
+ }
+
+
+
+ // $data['Success'] = "";
+
+ // $this->global['pageTitle'] = 'Siddharth : Payroll Data Upload';
+
+ // $this->loadViews("payslipupload2", $this->global, $data , NULL);
+
+
+ }
+ else{
+
+ $fail++;
+
+ // $data['Fail'] = "";
+
+ // $this->global['pageTitle'] = 'Siddharth : Payroll Data Upload';
+
+ // $this->loadViews("payslipupload2", $this->global, $data , NULL);
+
+ }
+
+
+
+ } //End of For Loop
+
+ // echo $success;
+ //echo $fail;
+
+ //$data['success'] = "";
+ echo "";
+
+ $this->global['pageTitle'] = 'Siddharth : Payroll Data Upload';
+
+ $this->loadViews("payslipupload2", $this->global , NULL);
+ //redirect('monthlyListings');
+
+
+
+ } else
+ {
+ $data['Fail'] = "";
+ //echo "";
+
+ $this->global['pageTitle'] = 'Siddharth : Payroll Data Upload2';
+
+ //$this->loadViews("payslipupload2", $this->global, $data , NULL);
+ }
+ }
+ else
+ {
+ $data['Fail'] = "";
+ //echo "";
+ $PayrollFileName = '';
+
+ $this->global['pageTitle'] = 'Siddharth : Payroll Data Upload2';
+
+ $this->loadViews("payslipupload2", $this->global, NULL , NULL);
+ }
+
+
}
function updatepayroll()
{
diff --git a/application/models/emppaydate_model.php b/application/models/emppaydate_model.php
new file mode 100644
index 00000000..94f8312a
--- /dev/null
+++ b/application/models/emppaydate_model.php
@@ -0,0 +1,125 @@
+db->select('*');
+ $this->db->from('T_Emp_Pay_Data');
+
+
+ if(!empty($searchText)) {
+ $likeCriteria = "(Pay_Data_ID LIKE '%".$searchText."%'
+ OR EmpID LIKE '%".$searchText."%'
+ OR Basic_Pay LIKE '%".$searchText."%'
+ OR HRA_Rate LIKE '%".$searchText."%'
+ OR OT_Rate LIKE '%".$searchText."%'
+ OR Allowances LIKE '%".$searchText."%'
+ OR PF_Rate LIKE '%".$searchText."%'
+ OR ESI_Rate LIKE '%".$searchText."%'
+ OR is_Active LIKE '%".$searchText."%'
+ OR Food_Allowances LIKE '%".$searchText."%'
+
+ )";
+ $this->db->where($likeCriteria);
+ }
+ //$this->db->where('BaseT.userId !=', 1);
+ $query = $this->db->get();
+
+ return count($query->result());
+ }
+ /**
+ * This function is used to get the user listing count
+ * @param string $searchText : This is optional search text
+ * @param number $page : This is pagination offset
+ * @param number $segment : This is pagination limit
+ * @return array $result : This is result
+ */
+
+
+ function emppayListing($searchText = '', $page, $segment)
+ {
+ $this->db->select('*');
+ $this->db->from('T_Emp_Pay_Data');
+
+
+ if(!empty($searchText)) {
+ $likeCriteria = "(Pay_Data_ID LIKE '%".$searchText."%'
+ OR EmpID LIKE '%".$searchText."%'
+ OR Basic_Pay LIKE '%".$searchText."%'
+ OR HRA_Rate LIKE '%".$searchText."%'
+ OR OT_Rate LIKE '%".$searchText."%'
+ OR Allowances LIKE '%".$searchText."%'
+ OR PF_Rate LIKE '%".$searchText."%'
+ OR ESI_Rate LIKE '%".$searchText."%'
+ OR is_Active LIKE '%".$searchText."%'
+ OR Food_Allowances LIKE '%".$searchText."%'
+
+ )";
+ $this->db->where($likeCriteria);
+ }
+
+ $this->db->limit($page, $segment);
+ $query = $this->db->get();
+
+ $result = $query->result();
+ return $result;
+ }
+
+
+
+
+ function addNewemppay($emppay)
+ {
+ $this->db->trans_start();
+ $this->db->insert('T_Emp_Pay_Data', $emppay);
+
+ $paydataid = $this->db->insert_id();
+
+ $this->db->trans_complete();
+
+ return $emppay;
+ }
+ function getUserInfo($paydataid)
+ {
+ $this->db->select();
+ $this->db->from('T_Emp_Pay_Data');
+ //$this->db->where('isDeleted', 0);
+ //$this->db->where('roleId !=', 1);
+ $this->db->where('Pay_Data_ID', $paydataid);
+ $query = $this->db->get();
+
+ return $query->result();
+ }
+
+
+ function editemppay($emppaydatas)
+ {
+
+ $paydateid=$emppaydatas['Pay_Data_ID'];
+
+ $this->db->where('Pay_Data_ID' ,$paydateid);
+ $this->db->update('T_Emp_Pay_Data',$emppaydatas);
+
+ return TRUE;
+ }
+
+
+ function viewemppay($emppaydata, $paydateid)
+ {
+ $this->db->where('Pay_Data_ID', $paydateid);
+ $this->db->update('T_Emp_Pay_Data', $emppaydata);
+
+ return TRUE;
+ }
+
+
+}
+?>
diff --git a/application/models/monthlypay_model.php b/application/models/monthlypay_model.php
new file mode 100644
index 00000000..f3c63dad
--- /dev/null
+++ b/application/models/monthlypay_model.php
@@ -0,0 +1,123 @@
+db->select('*');
+ $this->db->from('T_Monthly_Pay_Inputs');
+
+
+ if(!empty($searchText)) {
+ $likeCriteria = "(Month_Year LIKE '%".$searchText."%'
+ OR EmpID LIKE '%".$searchText."%'
+ OR LOP_Days LIKE '%".$searchText."%'
+ OR OT_Hrs_Worked LIKE '%".$searchText."%'
+ OR Loan_Recovered LIKE '%".$searchText."%'
+ OR Loan_Balance LIKE '%".$searchText."%'
+ OR Incentives LIKE '%".$searchText."%'
+ OR Other_Deductions LIKE '%".$searchText."%'
+
+
+ )";
+ $this->db->where($likeCriteria);
+ }
+ //$this->db->where('BaseT.userId !=', 1);
+ $query = $this->db->get();
+
+ return count($query->result());
+ }
+ /**
+ * This function is used to get the user listing count
+ * @param string $searchText : This is optional search text
+ * @param number $page : This is pagination offset
+ * @param number $segment : This is pagination limit
+ * @return array $result : This is result
+ */
+ function monthlyListing($searchText = '', $page, $segment)
+ {
+ $this->db->select('*');
+ $this->db->from('T_Monthly_Pay_Inputs');
+ $this->db->order_by("Month_Year", "desc");
+
+
+ if(!empty($searchText)) {
+ $likeCriteria = "(Month_Year LIKE '%".$searchText."%'
+ OR EmpID LIKE '%".$searchText."%'
+ OR LOP_Days LIKE '%".$searchText."%'
+ OR OT_Hrs_Worked LIKE '%".$searchText."%'
+ OR Loan_Recovered LIKE '%".$searchText."%'
+ OR Loan_Balance LIKE '%".$searchText."%'
+ OR Incentives LIKE '%".$searchText."%'
+ OR Other_Deductions LIKE '%".$searchText."%'
+
+ )";
+ $this->db->where($likeCriteria);
+ }
+
+ $this->db->limit($page, $segment);
+ $query = $this->db->get();
+
+ $result = $query->result();
+ return $result;
+ }
+
+
+
+function addNewmonthlisting($m_list)
+ {
+ $this->db->trans_start();
+ $this->db->insert('T_Monthly_Pay_Inputs', $asset);
+
+ $Asset_Code = $this->db->insert_id();
+
+ $this->db->trans_complete();
+
+ return $m_list;
+ }
+ function getUserInfo($EmpID,$month_year)
+ {
+ $this->db->select('Month_Year, EmpID, LOP_Days, OT_Hrs_Worked, Loan_Recovered, Loan_Balance, Incentives, Other_Deductions, Created_By, Created_Time, Last_Mod_By, Last_Mod_Time');
+ $this->db->from('T_Monthly_Pay_Inputs');
+ //$this->db->where('isDeleted', 0);
+ //$this->db->where('roleId !=', 1);
+ $this->db->where('EmpID', $EmpID);
+ $this->db->where('Month_Year', $month_year);
+ $query = $this->db->get();
+
+ return $query->result();
+ }
+
+
+ function editmonth($monthdata, $EmpID)
+ {
+ $monthyear=$monthdata['Month_Year'];
+
+
+ //$this->db->where('EmpID',$employeeid);
+ $this->db->where('EmpID' ,$EmpID);
+ //$this->db->where('Month_Year' ,$EmpID);
+ $this->db->where('Month_Year',$monthyear);
+ $this->db->update('T_Monthly_Pay_Inputs',$monthdata);
+
+ return TRUE;
+ }
+
+
+ function viewmonth($monthdata, $employeeid)
+ {
+ $this->db->order_by('Month_Year');
+ $this->db->where('EmpID', $employeeid);
+ $this->db->update('T_Monthly_Pay_Inputs', $monthdata);
+
+ return TRUE;
+ }
+
+
+}
+?>
diff --git a/application/models/payroll_model.php b/application/models/payroll_model.php
index dc42a23e..ca594491 100644
--- a/application/models/payroll_model.php
+++ b/application/models/payroll_model.php
@@ -15,6 +15,19 @@ class Payroll_model extends CI_Model
$Payon = $this->db->affected_rows();
return $Payon;
+ }
+
+ function model_sp($payon,$employee){
+
+ //echo "";
+ //echo "highlight_file(filename)";
+ //die();
+ $this->db->query("call final_payroll_data('".$payon."','".$employee."')") or die(mysql_error());
+ //$result->next_result()
+ return TRUE;
+
+
+
}
/**
* This function is used to update the File details in which is already exists in the database
@@ -46,6 +59,29 @@ class Payroll_model extends CI_Model
return $query->result();
}
}
+
+ function checkFileDetailsExists2($PayOn,$EmpId)
+ {
+ //echo $EmpId;
+ //die();
+ $this->db->select('Month_Year','EmpID');
+ $this->db->from('T_Monthly_Pay_Inputs');
+ $this->db->where('EmpID',$EmpId);
+ $this->db->where('Month_Year',$PayOn);
+
+
+ $query = $this->db->get();
+ // print_r($this->db->last_query());
+ if ($query->num_rows > 0) {
+ //echo "success";
+ //return $query->result();
+ return TRUE;
+ }
+ else{
+ //echo "fail";
+ return FALSE;
+ }
+ }
/**
* This function is used to insert the File data in database
* @FileDetails array : This will have the set of value which we need to insert into database
@@ -59,6 +95,15 @@ class Payroll_model extends CI_Model
//print_r($this->db->last_query());
return $Payon;
}
+
+ function UploadFileData2($FileData)
+ {
+ $this->db->insert('T_Monthly_Pay_Inputs', $FileData);
+
+ $Payon = $this->db->affected_rows();
+ //print_r($this->db->last_query());
+ return $Payon;
+ }
/**
* This function is used to update the File details in which is already exists in the database
@@ -107,7 +152,7 @@ class Payroll_model extends CI_Model
*/
function getPayOn()
{
- $this->db->select('PayOn');
+ $this->db->select('DISTINCT(PayOn)');
$this->db->from('T_Payroll_File');
$query = $this->db->get();
return $query->result();
@@ -131,6 +176,22 @@ class Payroll_model extends CI_Model
$query = $this->db->get();
return $query;
}
+
+
+ function getEmployeelist2($Payon ='')
+ {
+ $this->db->select('Pay.EmpID as EmpId,Emp.FirstName as Fname,Emp.LastName as Lname');
+ $this->db->from('T_Monthly_Pay_Inputs Pay');
+ $this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID');
+ if($Payon != '')
+ {
+ $this->db->where('Pay.Month_Year', $Payon);
+ }
+ $this->db->order_by("Pay.EmpID", "asc");
+
+ $query = $this->db->get();
+ return $query;
+ }
/* *//**
* This function is used to get the PayOn details from T_Payroll_File
@@ -163,5 +224,13 @@ class Payroll_model extends CI_Model
$this->db->delete('T_Payroll');
}
+
+ function getEmpID()
+ {
+ $this->db->select('EmpID,FirstName,LastName');
+ $this->db->from('T_Employee_Details');
+ $query = $this->db->get();
+ return $query->result();
+ }
}
?>
\ No newline at end of file
diff --git a/application/views/addemppaydate.php b/application/views/addemppaydate.php
index 3632368e..80241a6c 100644
--- a/application/views/addemppaydate.php
+++ b/application/views/addemppaydate.php
@@ -2,72 +2,83 @@
-
-
-
| Pay Data ID | +Employee ID | +Basic Pay | +HRA Rate | +OT Rate | +Allowances | +PF Rate | +ESI Rate | +Food Allowances | +Is Active | + +Edit | +
|---|---|---|---|---|---|---|---|---|---|---|
| Pay_Data_ID ?> | +EmpID ?> | +Basic_Pay ?> | +HRA_Rate ?> | +OT_Rate ?> | +Allowances ?> | +PF_Rate ?> | +ESI_Rate ?> | +Food_Allowances ?> | + +is_Active ? 'Yes' : 'No'?> | + + + ++ + EDIT + + | +
| Month Year | +Employee Id | +LOP Days | +OT Hours Worked | +Loan Recovered | +Loan Balance | +Incentives | +Other Deductions | +Edit | +
|---|---|---|---|---|---|---|---|---|
| Month_Year ?> | +EmpID ?> | +LOP_Days ?> | +OT_Hrs_Worked ?> | +Loan_Recovered ?> | +Loan_Balance ?> | +Incentives ?> | +Other_Deductions ?> | + + ++ + EDIT + + | +