diff --git a/application/config/routes.php b/application/config/routes.php index ec54d62e..18389ff5 100644 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -191,9 +191,7 @@ $route['EditStoreRequisition'] = "storerequisitionlist/EditStoreRequistion"; //<-------------IGR page-----------------> $route['Addigr'] = "inwardgateregister/addinwardgateregister"; - $route['ViewigrDetails'] = "inwardgateregister/viewIGRDetails"; - $route['ViewMRIRBilling'] = "MRIRcontroller/viewmrirforbilling"; //<-------------MRIR page-----------------> @@ -233,6 +231,10 @@ $route['Report_year_wise_inward'] = "report/iyear_wise"; $route['Report_supplier_inward'] = "report/ipurchase_supplier"; $route['Report_consolidate_inward'] = "report/iconsolidate"; $route['Report_cumulative_inward'] = "report/icumulative"; +$route['Report_cumulative_raw'] = "report/rawi_cumulative"; +$route['Report_consolidate_category'] = "report/rawi_consolidate"; +$route['Report_cumulative_raw'] = "report/rawi_cumulative"; +$route['Report_consolidate_category'] = "report/rawi_consolidate"; // Company Information $route['companyview'] = 'companycontroller/companyview'; diff --git a/application/controllers/Controller.php b/application/controllers/Controller.php index 0dc76a12..37465b71 100644 --- a/application/controllers/Controller.php +++ b/application/controllers/Controller.php @@ -10,12 +10,10 @@ class Controller extends CI_Controller { $this->load->helper('url'); $this->load->library('grocery_CRUD'); - - } - /* This function used to show the main page of the screen */ + /* To show the main page of the screen */ public function _controller_output($output = null) { $this->load->view('AssetDetails',(array)$output); diff --git a/application/controllers/CostCenter.php b/application/controllers/CostCenter.php index 4c16b50f..362d638c 100644 --- a/application/controllers/CostCenter.php +++ b/application/controllers/CostCenter.php @@ -4,7 +4,7 @@ require APPPATH . '/libraries/BaseController.php'; /** * Class : CostCenter (Cost Center Details - Controller) - * User Class to control all user related operations. + * CostCenter Class to control all Cost Center related operations. * @author : Venba Info Tech - * @version : 1.1 * @since : 18 November 2017 @@ -12,46 +12,42 @@ require APPPATH . '/libraries/BaseController.php'; class CostCenter extends BaseController { /** - * This is default constructor of the class + * default constructor of the class */ public function __construct() { parent::__construct(); $this->load->model('costcenter_model'); - //$this->load->library('session'); - $this->load->library('form_validation'); - $this->load->library('pagination'); - + $this->load->library('form_validation'); + $this->load->library('pagination'); $this->isLoggedIn(); } + /** - * This function used to load the first screen of the user + * Index Page for this controller(default function of the class) */ public function index() { $this->global['pageTitle'] = 'Resico : Cost Details'; - $this->loadViews("costListing", $this->global, NULL , NULL); } /** - * This function is used to load the Cost list + * To load the Cost list */ function CostListing() { $data['userRecords'] = $this->costcenter_model->CostListing(); - - $this->global['pageTitle'] = 'Resico : Cost List'; - $this->loadViews("costListing", $this->global, $data, NULL); } /** - * This function is used to load the add new cost Center */ + * To load the add new cost Center + */ function addCostCenter() { @@ -68,29 +64,29 @@ class CostCenter extends BaseController $this->loadViews("addCostCenter", $this->global,$data, NULL); } - + + /** + * Validation for Selected Department + */ function Dep_SelectedDepartment($selectValue) -{ - //echo 'select_validate method called'; - // 'none' is the first option and the text says something like "-Choose one-" - if(strlen($SelectedDepartment) <= 0 ) { - $this->form_validation->set_message('Dep_SelectedDepartment', 'Please Select Department.'); - return false; + if(strlen($SelectedDepartment) <= 0 ) + { + $this->form_validation->set_message('Dep_SelectedDepartment', 'Please Select Department.'); + return false; + } + else // user picked something + { + return true; + } } - else // user picked something - { - return true; - } -} /** - * This function is used to add new Cost to the system + * To Store the add new Cost center details into DB */ function addNewcost() { - - + $this->form_validation->set_rules('CostCode','CostCode','trim|required'); $this->form_validation->set_rules('CostName','CostName','trim|required'); @@ -149,9 +145,9 @@ class CostCenter extends BaseController } } - /** - * This function is used load user edit information - * @param number $userId : Optional : This is user id + + /** + * To load Exists information and load edit costcenter screen */ function editOldcost($CostCode = NULL) { @@ -162,29 +158,28 @@ class CostCenter extends BaseController } else { - $CostCenterID = $CostCode; - } + } $data['CostMaster'] = $this->costcenter_model->GetCostCenterMaster($CostCenterID); - $data['CostDepts'] = $this->costcenter_model->GetCostCenterDepartment($CostCenterID); - $data['CostBudget'] = $this->costcenter_model->GetCostCenterBudget($CostCenterID); + $data['CostDepts'] = $this->costcenter_model->GetCostCenterDepartment($CostCenterID); + $data['CostBudget'] = $this->costcenter_model->GetCostCenterBudget($CostCenterID); $data['DeptList'] = $this->costcenter_model->GetDepartmentNotinCostCenter($CostCenterID); $data['BudType'] = $this->costcenter_model->GetBudgetTypeNotinCostCenter($CostCenterID,'C004'); $data['BudYear'] = $this->costcenter_model->GetBudgetYear($CostCenterID); - $data['FiscalYear'] = $this->costcenter_model->getFiscalYear(); - //print_r(count($data['BudType'])); + $data['FiscalYear'] = $this->costcenter_model->getFiscalYear(); $this->global['pageTitle'] = 'Resico : Edit Cost'; $this->loadViews("editCostCenter", $this->global, $data,NULL); - } - + + /** + * For display budget related information by using year-wise + */ function GetBudgetForYear() { - //$id = $this->input->post('id'); $BudYear = $_GET['BudYear']; $CostCenterID = $_GET['CostCode']; $result = $this->costcenter_model->GetCostCenterBudgetByYear($CostCenterID, $BudYear); @@ -192,18 +187,17 @@ class CostCenter extends BaseController $HTML=""; $HTML2=""; - $index = 0; - // $HTML2 = $BudList[0]['ConfigValue']; - //if($BudList->num_rows() > 0){ - for ($j = 0; $j < count($BudList); $j++) - { + $index = 0; + + for ($j = 0; $j < count($BudList); $j++) + { $ConfigValue = $BudList[$j]['ConfigValue']; $HTML2.=""; - } + } for ($i = 0; $i < count($result); $i++) - { - $index = $index + 1; + { + $index = $index + 1; $BudgetType = $result[$i]['BudgetType']; $BudgetYear = $result[$i]['BudgetYear']; $BudgetAmount = $result[$i]['BudgetAmount']; @@ -214,26 +208,24 @@ class CostCenter extends BaseController - - ".$BudgetYear." + + ".$BudgetYear." ".$BudgetAmount." ".$Remarks." - -     - "; + + +     + "; + } + $HTML.=""; + die(json_encode(array('Html' => $HTML,'BudYear' => $HTML2))); - - - } - $HTML.=""; - die(json_encode(array('Html' => $HTML,'BudYear' => $HTML2))); - // echo $HTML2; } /** - * This function is used to edit the user information + * To edit the costcenter information */ function editcost() { @@ -250,50 +242,25 @@ class CostCenter extends BaseController $CostCode = strtoupper(trim($this->input->post('CostCode'))); $CostName = strtoupper(trim($this->input->post('CostName'))); $updatedBy = $this->session->userdata ( 'userId' ); - $SelectedDepartment = $this->input->post('txtSelectedDepartment'); - //echo $SelectedDepartment; - //die(); - + $SelectedDepartment = $this->input->post('txtSelectedDepartment'); $ApproverName = $this->input->post('ApprovedBy'); $comma_separated = ""; - //print_r(strlen($SelectedDepartment)); + if(strlen($SelectedDepartment)>0) { $comma_separated = explode(':', $SelectedDepartment); } - //die(); - //echo count($comma_separated); $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - $updateddt = $dt->format('Y-m-d H:i:s'); - $CodeExists = $this->costcenter_model->checkCostDetailsExists($CostCode); - //print_r(count($CodeExists)); + if(count($CodeExists) > 0) { $Cost = array( 'CostCenterName'=>$CostName,'ApprovedBy'=>$ApproverName,'UpdatedBy'=>$updatedBy,'UpdatedDate'=>$updateddt); $this->costcenter_model->EditCost($Cost,$CostCode); } - - if(count($comma_separated)>= 1) - { - - - for ($j = 0; $j < count($comma_separated); $j++) - { - // $DeptCode = $comma_separated[$j]; - - // $this->costcenter_model->DeleteDepartment( $DeptCode,$CostCode); - - //$Dept = array('CostCenterCode'=>$CostCode, 'DEPCode'=>$DeptCode,'CreatedBy'=>$updatedBy,'createdDate'=>$updateddt,'UpdatedBy'=>$updatedBy,'UpdatedDate'=>$updateddt); - - //print_r($Dept); - //$this->costcenter_model->addCostCenterDepartment($Dept); - - } - } $RowCount = $this->input->post('txtRowCount'); @@ -303,20 +270,16 @@ class CostCenter extends BaseController $BudgetYear = $this->input->post('BudgetYear'.$i); $BudgetAmount = $this->input->post('BudgetAmount'.$i); $Remarks = $this->input->post('Remarks'.$i); - // $this->costcenter_model->DeleteBudget($BudgetType,$BudgetYear,$CostCode); - $Budget = array('CostCenterCode'=>$CostCode, 'BudgetType'=>$BudgetType,'BudgetYear'=>$BudgetYear,'BudgetAmount'=>$BudgetAmount,'Remarks'=>$Remarks,'CreatedBy'=>$updatedBy,'createdDate'=>$updateddt,'UpdatedBy'=>$updatedBy,'UpdatedDate'=>$updateddt); + $Budget = array('CostCenterCode'=>$CostCode, 'BudgetType'=>$BudgetType,'BudgetYear'=>$BudgetYear,'BudgetAmount'=>$BudgetAmount,'Remarks'=>$Remarks,'CreatedBy'=>$updatedBy,'createdDate'=>$updateddt,'UpdatedBy'=>$updatedBy,'UpdatedDate'=>$updateddt); $ExistYearBudget = $this->costcenter_model->CheckExistBudget($BudgetType,$BudgetYear,$CostCode); - - // print_r($Budget); - if($ExistYearBudget){ - $this->costcenter_model->updateBudget($Budget,$BudgetType,$BudgetYear,$CostCode); - } - else{ - $this->costcenter_model->addBudget($Budget); - } - - + + if($ExistYearBudget){ + $this->costcenter_model->updateBudget($Budget,$BudgetType,$BudgetYear,$CostCode); + } + else{ + $this->costcenter_model->addBudget($Budget); + } } echo('Successfully Updated Cost details'); @@ -325,11 +288,12 @@ class CostCenter extends BaseController } - + /** + * To Remove/delete costcenter's department details into database + */ function DeleteCostDepartment() { - // echo "dasf"; - // die(); + $CostCode = strtoupper(trim($this->input->post('CostCode'))); $CostName = strtoupper(trim($this->input->post('CostName'))); $updatedBy = $this->session->userdata ( 'userId' ); @@ -338,14 +302,15 @@ class CostCenter extends BaseController echo ("Department Removed Successfully"); } - + /** + * To store/add the costcenter's department details into DB + */ function AddCostDepartment() { $CostCode = strtoupper(trim($this->input->post('CostCode'))); $CostName = strtoupper(trim($this->input->post('CostName'))); $updatedBy = $this->session->userdata ( 'userId' ); $SelectedDepartment = $this->input->post('txtSelectedDepartment'); - // $updatedBy = $this->session->userdata ( 'userId' ); $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $updateddt = $dt->format('Y-m-d H:i:s'); @@ -355,57 +320,9 @@ class CostCenter extends BaseController } - // function AddCostDepartment() - // { - // // echo "343"; - // // die(); - // $CostCode = strtoupper(trim($this->input->post('CostCode'))); - // $CostName = strtoupper(trim($this->input->post('CostName'))); - // $updatedBy = $this->session->userdata ( 'userId' ); - // $SelectedDepartment = $this->input->post('txtSelectedDepartment'); - // //echo $SelectedDepartment; - // //die(); - - // $ApproverName = $this->input->post('ApprovedBy'); - // $comma_separated = ""; - // //print_r(strlen($SelectedDepartment)); - // if(strlen($SelectedDepartment)>0) - // { - - // $comma_separated = explode(':', $SelectedDepartment); - // } - - // //die(); - // //echo count($comma_separated); - // $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - - // $updateddt = $dt->format('Y-m-d H:i:s'); - - - // if(count($comma_separated)>= 1) - // { - - - // for ($j = 0; $j < count($comma_separated); $j++) - // { - // $DeptCode = $comma_separated[$j]; - - // $this->costcenter_model->DeleteDepartment( $DeptCode,$CostCode); - - // $Dept = array('CostCenterCode'=>$CostCode, 'DEPCode'=>$DeptCode,'CreatedBy'=>$updatedBy,'createdDate'=>$updateddt,'UpdatedBy'=>$updatedBy,'UpdatedDate'=>$updateddt); - - // //print_r($Dept); - // $this->costcenter_model->addCostCenterDepartment($Dept); - - // } - // echo "Updated"; - // } - - - - // } - - + /** + * To view costcenter exsits information and load into edit cost coster screen + * */ function viewcost($CostCenterID = NULL) { @@ -415,7 +332,6 @@ class CostCenter extends BaseController } $data['Cost'] = $this->costcenter_model->getuserinfo($CostCenterID); - //$data['users'] = $this->purchaseorder_model->getusers(); $this->global['pageTitle'] = 'Resico : View Cost Details'; @@ -424,8 +340,8 @@ class CostCenter extends BaseController } /** - * This function is used to delete the user using userId - * @return boolean $result : TRUE / FALSE + * To delete costcenter details. + * Note: this function tsemporary not in use. */ function deletecost() { @@ -445,6 +361,10 @@ class CostCenter extends BaseController } } + + /** + * To export report of costcenter details in excel + */ function export_cost(){ @@ -468,14 +388,11 @@ class CostCenter extends BaseController $this->excel->getActiveSheet()->setCellValue('J5', 'BudgetYear'); $this->excel->getActiveSheet()->setCellValue('K5', 'DepartmentName'); $this->excel->getActiveSheet()->setCellValue('L5', 'IsActive'); - //$this->excel->getActiveSheet()->setCellValue('K5', 'Remarks'); $this->excel->getActiveSheet()->setCellValue('M5', 'CreatedBy'); $this->excel->getActiveSheet()->setCellValue('N5', 'UpdatedBy'); $this->excel->getActiveSheet()->setCellValue('O5', 'IsApproved'); $this->excel->getActiveSheet()->setCellValue('P5', 'ApprovedBy'); - - $this->excel->getActiveSheet()->getStyle('G3')->getFont()->setSize(14); $this->excel->getActiveSheet()->getStyle('G3')->getFont()->setBold(true); @@ -507,38 +424,29 @@ class CostCenter extends BaseController $this->excel->getActiveSheet()->getStyle('O5')->getFont()->setBold(true); $this->excel->getActiveSheet()->getStyle('P5')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('P5')->getFont()->setBold(true); - //$this->excel->getActiveSheet()->getStyle('Q5')->getFont()->setSize(12); - //$this->excel->getActiveSheet()->getStyle('Q5')->getFont()->setBold(true); - - $exportData = $this->costcenter_model->export_excel(); - // print_r($exportData);die(); if ($exportData) { $i = 6; $s = 1; foreach ($exportData as $data) { $this->excel->getActiveSheet()->setCellValue('C'. $i,$s); - //$this->excel->getActiveSheet()->setCellValue('C'. $i,$data['AssetCode']); - $this->excel->getActiveSheet()->setCellValue('D'. $i,$data['CostCenterCode']); - $this->excel->getActiveSheet()->setCellValue('E'. $i,$data['CostCenterName']); - $this->excel->getActiveSheet()->setCellValue('F'. $i,$data['capital']); - $this->excel->getActiveSheet()->setCellValue('G'. $i,$data['revenue']); - $this->excel->getActiveSheet()->setCellValue('H'. $i,$data['import']); - $this->excel->getActiveSheet()->setCellValue('I'. $i,$data['service']); - $this->excel->getActiveSheet()->setCellValue('J'. $i,$data['BudgetYear']); - $this->excel->getActiveSheet()->setCellValue('K'. $i,$data['DepartmentName']); - $this->excel->getActiveSheet()->setCellValue('L'. $i,$data['IsActive']); - //$this->excel->getActiveSheet()->setCellValue('K'. $i,$data['Remarks']); - $this->excel->getActiveSheet()->setCellValue('M'. $i,$data['firstname']); - $this->excel->getActiveSheet()->setCellValue('N'. $i,$data['Updated_By']); - $this->excel->getActiveSheet()->setCellValue('O'. $i,$data['IsApproved']); - $this->excel->getActiveSheet()->setCellValue('P'. $i,$data['firstname']); - - - + + $this->excel->getActiveSheet()->setCellValue('D'. $i,$data['CostCenterCode']); + $this->excel->getActiveSheet()->setCellValue('E'. $i,$data['CostCenterName']); + $this->excel->getActiveSheet()->setCellValue('F'. $i,$data['capital']); + $this->excel->getActiveSheet()->setCellValue('G'. $i,$data['revenue']); + $this->excel->getActiveSheet()->setCellValue('H'. $i,$data['import']); + $this->excel->getActiveSheet()->setCellValue('I'. $i,$data['service']); + $this->excel->getActiveSheet()->setCellValue('J'. $i,$data['BudgetYear']); + $this->excel->getActiveSheet()->setCellValue('K'. $i,$data['DepartmentName']); + $this->excel->getActiveSheet()->setCellValue('L'. $i,$data['IsActive']); + $this->excel->getActiveSheet()->setCellValue('M'. $i,$data['firstname']); + $this->excel->getActiveSheet()->setCellValue('N'. $i,$data['Updated_By']); + $this->excel->getActiveSheet()->setCellValue('O'. $i,$data['IsApproved']); + $this->excel->getActiveSheet()->setCellValue('P'. $i,$data['firstname']); $i++; $s++; @@ -557,6 +465,9 @@ class CostCenter extends BaseController } + /** + * To load pagenotfound view + */ function pageNotFound() { $this->global['pageTitle'] = 'Resico : 404 - Page Not Found'; diff --git a/application/controllers/MRIRcontroller.php b/application/controllers/MRIRcontroller.php index 64030f87..df20b208 100644 --- a/application/controllers/MRIRcontroller.php +++ b/application/controllers/MRIRcontroller.php @@ -5,7 +5,7 @@ require APPPATH . '/third_party/mpdf/mpdf.php'; /** * Class : MRIRcontroller (Material Inspection Report - Controller) - * User Class to control all user related operations. + * MRIRcontroller Class to control all MRIR related operations. * @author : Venba Info Tech - Saravana kumar * @version : 1.1 * @since : 18 Novmeber 2017 @@ -13,20 +13,21 @@ require APPPATH . '/third_party/mpdf/mpdf.php'; class MRIRcontroller extends BaseController { /** - * This is default constructor of the class + * default constructor of the class */ public function __construct() { parent::__construct(); - $this->load->model('purchaseorder_model'); + $this->load->model('purchaseorder_model'); $this->load->model('mrir_model'); $this->load->library('session'); $this->load->library('form_validation'); $this->isLoggedIn(); } + /** - * This function used to load the first screen of the user + * Index Page for this controller (default function of the class) */ public function index() { @@ -34,7 +35,9 @@ class MRIRcontroller extends BaseController $this->loadViews("viewmaterialinspectionreport", $this->global,NULL , NULL); } - /* For Entry MRIR Screen*/ + /* + * For New mrir datas + */ function materialinspectionreport($mrir='',$IGRNO='') { $this->global['pageTitle'] = 'Resico : Material Inspection Report'; @@ -46,6 +49,10 @@ class MRIRcontroller extends BaseController $this->loadViews("materialinspectionreport", $this->global,$data,NULL); } + + /* + * For MRIR datas has PDF + */ public function MrirDetailsPrintPdf() { $MrirNo = $_GET['MRIRNO']; @@ -77,21 +84,24 @@ class MRIRcontroller extends BaseController } + /** + * For MRIR datas has in billing screen + */ public function viewmrirforbilling() { $this->global['pageTitle'] = 'Resico : Billing '; - $data['Billing'] = $this->mrir_model->view_mrir_Billing(); - - + $data['Billing'] = $this->mrir_model->view_mrir_Billing(); $this->loadViews("viewmrirforbilling", $this->global,$data , NULL); } -public function viewmMaterialDistributionList() + + /** + * For material issued/distribution list + */ + public function viewmMaterialDistributionList() { $this->global['pageTitle'] = 'Resico : Distribution list '; - $data['Distribution'] = $this->mrir_model->ViewDistributionList(); $data['status'] = $this->mrir_model->getStatus(); - $this->loadViews("MaterialIssueList", $this->global,$data , NULL); } @@ -109,6 +119,10 @@ public function viewmMaterialDistributionList() $this->loadViews("materialinspectionreport", $this->global, $data,NULL); } + + /* + * For view IGR datas.(security login only) + */ function viewinwardgateregister() { @@ -127,14 +141,12 @@ public function viewmMaterialDistributionList() $this->load->model('mrir_model'); $data['viewmrirdatas'] = $this->mrir_model-> view_mrir(); - //old name:mrirdatas2 $this->global['pageTitle'] = 'Resico : View Material Inspection Report'; - //print_r( $data); $this->loadViews("viewmaterialinspectionreport", $this->global,$data,NULL); } - /* FOR Edit MRIR Screen (View folder - edit page)*/ + /* For Editing purpose MRIR datas and its has old values (View folder - edit page)*/ function editmaterialinspectionreport() { @@ -142,8 +154,7 @@ public function viewmMaterialDistributionList() $MrirNo = $_GET['MRIRNO']; - $data['MRIRDetails'] = $this->mrir_model->edit_mrir($MrirNo);//get_MRIR_Values($MrirNo); - //print_r($data['MRIRDetails']); + $data['MRIRDetails'] = $this->mrir_model->edit_mrir($MrirNo); $this->global['pageTitle'] = 'Resico : Edit Material Inspection Report'; @@ -152,8 +163,10 @@ public function viewmMaterialDistributionList() } - /* NEW Values TO Stored in DB (for insert operation) */ - function stored_db()//old name : displaying_values() + /** + * TO Stored new mrir datas into DB (for insert operation) + */ + function stored_db() { $this->load->model('mrir_model'); @@ -200,9 +213,6 @@ public function viewmMaterialDistributionList() //this array to store the value in child table.. $mrirdetailvalues = array('MRIRNO'=>$MRIRNO,'MaterialCode'=>$MaterialCode,'ActualQuantityReceived'=>$ActualQuantityReceived,'StoreInchargeID'=>$StoreIncharge,'Remarks'=>$Remarked); - //print_r($mrirdetailvalues); - //die(); - $mrirdetails = $this->mrir_model->detail_mrir($mrirdetailvalues); } @@ -212,7 +222,9 @@ public function viewmMaterialDistributionList() } - /* Values To Stored in DB (for update operation) */ + /** + * To Stored in edited MRIR datas into DB (for update operation) + */ function updated_db() { @@ -309,7 +321,9 @@ public function viewmMaterialDistributionList() } - /*in view screen we display values for modal (viewmaterialinspectionreport.php)*/ + /** + * For display mrir datas in modal (viewmaterialinspectionreport.php) + */ function displaying_MRIRvalues() { $mrir = $this->input->post("mrirno"); @@ -319,7 +333,10 @@ public function viewmMaterialDistributionList() } - + + /** + * To get igr values form ajax + */ function displaying_IGRvalues() { @@ -329,6 +346,9 @@ public function viewmMaterialDistributionList() echo $obj; } + /** + * For material issued information based on requistion + */ function UpdateReqItemStatus() { $this->load->model('requistion_model'); @@ -374,7 +394,10 @@ public function viewmMaterialDistributionList() echo "Material Issued Successfully for the Requistion: ".$ReqNumber; } - + + /** + * To load pagenotfound view + */ function pageNotFound() { $this->global['pageTitle'] = 'Resico : 404 - Page Not Found'; diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php index a2c64b21..9ae900f8 100755 --- a/application/controllers/cashbook.php +++ b/application/controllers/cashbook.php @@ -3,16 +3,16 @@ require APPPATH . '/libraries/BaseController.php'; require APPPATH . '/third_party/mpdf/mpdf.php'; /** - * Class : cash Book Controller (cash Book) - * User Class to control all user related operations. - * @author : Gandhimathi + * Class : cashbook (Cash Book Controller) + * cashbook Class to control all Cash Book related operations. + * @author : Venba Info Tech - Gandhimathi * @version : 1.1 - * @since : 27 Nov 2017 + * @since : 27 November 2017 */ class cashbook extends BaseController { /** - * This is default constructor of the class + * default constructor of the class */ public function __construct() { @@ -24,72 +24,72 @@ class cashbook extends BaseController } + /** + * To list incomeexpense details + */ function incomeExpenseList() { $aid = $this->uri->segment(3); $str = $this->uri->segment(4); - if(!empty($aid)){ + if(!empty($aid)){ - if(!empty($str)) - { - //echo "PDF"; - $data['company'] = $this->cashbook_model->getCompany(); - - $data['data'] = $this->cashbook_model->getIncomeExpenseList($aid); - //$pic1 = $data['company'][0]->ProfilePic; - //echo $pic1; - //$pic = base_url().'uploads/images'.$pic1; - //echo $pic; - //die(); - $totalamt = $data['data'][0]->total; - $data['amtinwords'] = $this->convertNumber($totalamt); - $mpdf=new mPDF('utf-8','A4-P',7, 10,10, 10, 3, 0, 0, 0); - $mpdf->SetHTMLHeader($HtmlHeading); - $html = $this->load->view('cashbookpdf',$data,true); - $mpdf->SetDisplayMode('fullpage'); - $mpdf->setFooter($HTMLFooter . "Page {PAGENO} of {nb}"); - $mpdf->list_indent_first_level = 1; - $mpdf->setAutoTopMargin = 'stretch'; - $mpdf->setAutoBottomMargin = 'stretch'; - $mpdf->WriteHTML($html); - $filename = "cashbook.pdf"; - $mpdf->Output($filename,I); - } - else - { - - $data['data'] = $this->cashbook_model->getIncomeExpenseList($aid); - //print_r($data['dropdownvalues']);die(); - $this->global['pageTitle'] = 'Resico : Cash Book: View Income Expense '; - $this->loadViews("viewIndIncomeExpense", $this->global, $data , NULL); + if(!empty($str)) + { + + $data['company'] = $this->cashbook_model->getCompany(); + + $data['data'] = $this->cashbook_model->getIncomeExpenseList($aid); + $totalamt = $data['data'][0]->total; + $data['amtinwords'] = $this->convertNumber($totalamt); + $mpdf=new mPDF('utf-8','A4-P',7, 10,10, 10, 3, 0, 0, 0); + $mpdf->SetHTMLHeader($HtmlHeading); + $html = $this->load->view('cashbookpdf',$data,true); + $mpdf->SetDisplayMode('fullpage'); + $mpdf->setFooter($HTMLFooter . "Page {PAGENO} of {nb}"); + $mpdf->list_indent_first_level = 1; + $mpdf->setAutoTopMargin = 'stretch'; + $mpdf->setAutoBottomMargin = 'stretch'; + $mpdf->WriteHTML($html); + $filename = "cashbook.pdf"; + $mpdf->Output($filename,I); + } + else + { + + $data['data'] = $this->cashbook_model->getIncomeExpenseList($aid); + $this->global['pageTitle'] = 'Resico : Cash Book: View Income Expense '; + $this->loadViews("viewIndIncomeExpense", $this->global, $data , NULL); + + } + + } + else + { + $data['list'] = $this->cashbook_model->getIncomeExpenseList(); + $this->global['pageTitle'] = 'Resico : Cash Book: Listing'; + $this->loadViews("income_expense_list", $this->global, $data , NULL); + } + - } - - }else{ - $data['list'] = $this->cashbook_model->getIncomeExpenseList(); - $this->global['pageTitle'] = 'Resico : Cash Book: Listing'; - - $this->loadViews("income_expense_list", $this->global, $data , NULL); - } - - } + /** + * To load add incomeexpense screen + */ function addNewIncomeExpenseLoad() { $data['dropdownvalues'] = $this->cashbook_model->getAccounTypes(); - //print_r($data['dropdownvalues']);die(); $this->global['pageTitle'] = 'Resico : Cash Book: Add New Income Expense '; $this->loadViews("addnewIncomeExpense", $this->global, $data , NULL); } - + /** + * To store added incomeexpense datas + */ function addIncomeExpense() { - //echo "welcome"; - //die(); $accounttype = $this->input->post('myradio'); if($accounttype == 1) { @@ -135,13 +135,11 @@ class cashbook extends BaseController $fs = 0; if(!empty($_FILES['myfile']['name'])) { - //echo "FILE AVAILABLE"; + $config['file_name'] = $_FILES['myfile']['name']; $config['upload_path'] = 'uploads/cashbook/'; $path = $config['upload_path']; - //$filename = $config['file_name']; $document = $path.$filename; - //echo $document; $fs = $this->uploadFile(); $document = $path.$fs; @@ -155,21 +153,18 @@ class cashbook extends BaseController } - + /** + * To store Cashbook revalant file and images + */ function uploadFile() { - //echo "INSIDE UPLOAFD"; - - //$this->load->library('upload') $pathinfo = pathinfo($_FILES['myfile']['name']); $config['upload_path'] = 'uploads/cashbook/'; $config['allowed_types'] = 'png|jpg|jpeg'; $config['file_name'] = $_FILES['myfile']['name']; - // $config['overwrite'] = true; - - //Load upload library and initialize configuration - $this->load->library('upload',$config); + + $this->load->library('upload',$config); $this->upload->initialize($config); @@ -190,18 +185,22 @@ class cashbook extends BaseController } + /** + * To load view Income Expense screen + */ function viewIE() { $aid = $this->uri->segment(3); - $data['data'] = $this->cashbook_model->getAccounutInfo(); - //print_r($data['dropdownvalues']);die(); $this->global['pageTitle'] = 'Resico : Cash Book: View Income Expense '; $this->loadViews("viewIndIncomeExpense", $this->global, $data , NULL); } + /** + * Index Page for this controller(default function of the class) + */ public function index() { $this->global['pageTitle'] = 'Resico : Cashbook Details'; @@ -229,7 +228,6 @@ class cashbook extends BaseController $id = $this->input->post('id'); $tablevalue = json_decode($id,true); - //print_r($tablevalue); foreach($tablevalue as $tv) { if(!empty($tv['AccountCodeType'])){ @@ -251,13 +249,10 @@ class cashbook extends BaseController $acc_createddt = $dt->format('Y-m-d H:i:s'); $cashbookdatas = array('type'=>$acc_type,'code'=>$acc_code,'name'=>$acc_name,'description'=>$acc_desc,'status'=>$acc_status,'created_on'=>$acc_createddt); - //print_r($cashbookdatas); $result = $this->cashbook_model->Cashbook($cashbookdatas); } } - - //redirect('cashbook/cashbookList','refresh'); echo "Successfully Saved!"; @@ -266,99 +261,101 @@ class cashbook extends BaseController } - + /** + * To covert number into words + */ public function convertNumber($amt){ - //echo $amt;die(); -$ShowPaise='0'; -$totalAmt=explode(".",$amt); -$number = $totalAmt[0]; - $no = $number; + $ShowPaise='0'; + $totalAmt=explode(".",$amt); + $number = $totalAmt[0]; + $no = $number; -if(!empty($totalAmt[1]) && $totalAmt[1]!=0){ -$point = $totalAmt[1]; - $ShowPaise='1'; -} - else{ -$point=0; - $ShowPaise='0'; -} + if(!empty($totalAmt[1]) && $totalAmt[1]!=0){ + + $point = $totalAmt[1]; + $ShowPaise='1'; + } + else{ + + $point=0; + $ShowPaise='0'; + } + $hundred = null; + $digits_1 = strlen($no); - $hundred = null; - $digits_1 = strlen($no); + $i = 0; + $str = array(); + $words = array('0' => '', '1' => 'One', '2' => 'Two', + '3' => 'three', '4' => 'Four', '5' => 'Five', '6' => 'Six', + '7' => 'seven', '8' => 'eight', '9' => 'nine', + '10' => 'ten', '11' => 'eleven', '12' => 'twelve', + '13' => 'thirteen', '14' => 'fourteen', + '15' => 'fifteen', '16' => 'sixteen', '17' => 'seventeen', + '18' => 'eighteen', '19' =>'nineteen', '20' => 'twenty', + '30' => 'thirty', '40' => 'fourty', '50' => 'fifty', + '60' => 'sixty', '70' => 'seventy', + '80' => 'eighty', '90' => 'ninety','06'=>'Zero Six','01'=>'Zero One','02'=>'Zero Two' + ,'03'=>'Zero Three','04'=>'Zero Four','05'=>'Zero Five','07'=>'Zero Seven','08'=>'Zero Eight','09'=>'Zero Nine'); + + $words1 = array('2' => 'twenty', + '3' => 'thirty', '4' => 'fourty', + '5' => 'fifty', '6' => 'sixty', '7' => 'seventy', + '8' => 'eighty', '9' =>'ninty'); - $i = 0; - $str = array(); - $words = array('0' => '', '1' => 'One', '2' => 'Two', - '3' => 'three', '4' => 'Four', '5' => 'Five', '6' => 'Six', - '7' => 'seven', '8' => 'eight', '9' => 'nine', - '10' => 'ten', '11' => 'eleven', '12' => 'twelve', - '13' => 'thirteen', '14' => 'fourteen', - '15' => 'fifteen', '16' => 'sixteen', '17' => 'seventeen', - '18' => 'eighteen', '19' =>'nineteen', '20' => 'twenty', - '30' => 'thirty', '40' => 'forty', '50' => 'fifty', - '60' => 'sixty', '70' => 'seventy', - '80' => 'eighty', '90' => 'ninety','06'=>'Zero Six','01'=>'Zero One','02'=>'Zero Two' - ,'03'=>'Zero Three','04'=>'Zero Four','05'=>'Zero Five','07'=>'Zero Seven','08'=>'Zero Eight','09'=>'Zero Nine'); - $words1 = array('2' => 'twenty', - '3' => 'thirty', '4' => 'fourty', - '5' => 'fifty', '6' => 'sixty', '7' => 'seventy', - '8' => 'eighty', '9' =>'ninty'); - $words12 = array('11' => 'eleven', - '12' => 'twelve', '13' => 'thirteen', '14' => 'fourteen', - '15' => 'fifteen', '16' => 'sixteen', '17' => 'seventeen', - '18' => 'eighteen', '19' =>'nineteen', '20' => 'twenty',); - $digits = array('', 'hundred', 'thousand', 'lakh', 'crore'); - while ($i < $digits_1) { - $divider = ($i == 2) ? 10 : 100; - $number = floor($no % $divider); - $no = floor($no / $divider); - $i += ($divider == 10) ? 1 : 2; - if ($number) { - $plural = (($counter = count($str)) && $number > 1) ? 's' : null; - //print_r($plural); - $hundred = ($counter == 1 && $str[0]) ? ' and ' : null; - //print_r($hundred); - $str [] = ($number < 21) ? $words[$number] . - " " . $digits[$counter] . $plural . " " . $hundred - : - $words[floor($number / 10) * 10] - . " " . $words[$number % 10] . " " - . $digits[$counter] . $plural . " " . $hundred; - } else $str[] = null; - } - $str = array_reverse($str); - $result = implode('', $str); - if($point>=1 && $point<=10) - { - $points = ($point) ? - " " . $words[$point] : " "; - } - else if($point>=11 && $point<=20) - { - $points = ($point) ? - " " . $words12[$point] : " "; - } - else - { - $points = ($point) ? - " " . $words1[$point / 10] . " " . - $words[$point = $point % 10] : ''; - } + $words12 = array('11' => 'eleven', + '12' => 'twelve', '13' => 'thirteen', '14' => 'fourteen', + '15' => 'fifteen', '16' => 'sixteen', '17' => 'seventeen', + '18' => 'eighteen', '19' =>'nineteen', '20' => 'twenty',); -if($ShowPaise=='0'){ + $digits = array('', 'hundred', 'thousand', 'lakh', 'crore'); + + while ($i < $digits_1) { + + $divider = ($i == 2) ? 10 : 100; + $number = floor($no % $divider); + $no = floor($no / $divider); + $i += ($divider == 10) ? 1 : 2; + + if ($number) { + $plural = (($counter = count($str)) && $number > 1) ? 's' : null; + $hundred = ($counter == 1 && $str[0]) ? ' and ' : null; + $str [] = ($number < 21) ? + $words[$number] . " " . $digits[$counter] . $plural . " " . $hundred: + $words[floor($number / 10) * 10]. " " . $words[$number % 10] . " ". $digits[$counter] . $plural . " " . $hundred; + } + else $str[] = null; -$amountInWords = "Rupees " . $result." Only"; -} -else{ + } + + $str = array_reverse($str); + $result = implode('', $str); + if($point>=1 && $point<=10) + { + $points = ($point) ? " " . $words[$point] : " "; + } + else if($point>=11 && $point<=20) + { + $points = ($point) ? " " . $words12[$point] : " "; + } + else + { + $points = ($point) ? " " . $words1[$point / 10] . " " . $words[$point = $point % 10] : ''; + } -$amountInWords = "Rupees " . $result ." Paise ". $points." Only"; -} - + if($ShowPaise=='0'){ - return $amountInWords; - } + $amountInWords = "Rupees " . $result." Only"; + } + else{ + + $amountInWords = "Rupees " . $result ." Paise ". $points." Only"; + } + + + return $amountInWords; + } } ?> \ No newline at end of file diff --git a/application/controllers/companycontroller.php b/application/controllers/companycontroller.php index b338e7e5..e65342df 100644 --- a/application/controllers/companycontroller.php +++ b/application/controllers/companycontroller.php @@ -19,9 +19,10 @@ class companycontroller extends BaseController parent::__construct(); $this->load->model('companydetailsmodel'); $this->isLoggedIn(); - } + } + /** - * default function of the companycontroller + * Index Page for this controller(default function of the class) */ public function index() { diff --git a/application/controllers/configurationctrl.php b/application/controllers/configurationctrl.php index cca4b419..2db8f7ee 100644 --- a/application/controllers/configurationctrl.php +++ b/application/controllers/configurationctrl.php @@ -4,7 +4,7 @@ require APPPATH . '/libraries/BaseController.php'; /** * Class : configurationctrl (Configuration Details - Controller) - * User Class to control all user related operations. + * configurationctrl Class to control all configuration related operations. * @author :Venba Info Tech - Surendar * @version : 1.1 * @since : 18 November 2017 @@ -12,7 +12,7 @@ require APPPATH . '/libraries/BaseController.php'; class configurationctrl extends BaseController { /** - * This is default constructor of the class + * default constructor of the class */ public function __construct() { @@ -20,51 +20,45 @@ class configurationctrl extends BaseController $this->load->library('form_validation'); $this->load->model('configmodel'); - - $this->isLoggedIn(); + $this->isLoggedIn(); } -public function index() - { - - $this->global['pageTitle'] = 'Resico : Config Details'; - - $this->loadViews("configlisting", $this->global, NULL , NULL); + /** + * Index Page for this controller(default function of the class) + */ + public function index() + { + $this->global['pageTitle'] = 'Resico : Config Details'; + $this->loadViews("configlisting", $this->global, NULL , NULL); } - + /** + * To load the configuration details as list + */ function configlisting() { - $this->load->model('configmodel'); - - $searchText = $this->input->post('searchText'); - $data['searchText'] = $searchText; - - - //$count = $this->configmodel->departmentListingCount($searchText); - - //$returns = $this->paginationCompress ( "configlisting/", $count, 20 ); - - $data['userRecords'] = $this->configmodel->configlisting(); - + $this->load->model('configmodel'); $this->global['pageTitle'] = 'Resico : Config Listing'; - $this->loadViews("configlisting", $this->global, $data, NULL); - } - function addconfig() + } + + /** + * To load the add new config + */ + function addconfig() { $this->global['pageTitle'] = 'Resico : Add New Config'; $this->loadViews("addconfig", $this->global,NULL, NULL); } - - + /** + * To add new config + */ function addNewconfig() { - // $Configid = $this->input->post('Configid'); $ConfigName = $this->input->post('configurationname'); $Rowcount = $this->input->post('txtRowCount'); $Comments = $this->input->post('Comments'); @@ -80,25 +74,21 @@ public function index() $IsActive = '0'; } - //$config = array('Config_ID'=>$Configid,'ConfigName'=>$ConfigName, 'Comments'=>$Comments); $config = array('ConfigName'=>$ConfigName, 'Comments'=>$Comments); $result = $this->configmodel->addconfigmaster($config); - //print_r($result); - //echo $id;die(); - if(count($config)>0) + if(count($config)>0) { $id=$result[0]['Config_ID']; - for($i=1;$i<=$Rowcount;$i++) - { - $ConfigValue = $this->input->post('ConfigValue'.$i); - $configvalue = array('Config_ID'=>$id,'ConfigValue'=>$ConfigValue); - $result = $this->configmodel->addconfigdetails($configvalue); + for($i=1;$i<=$Rowcount;$i++) + { + $ConfigValue = $this->input->post('ConfigValue'.$i); + $configvalue = array('Config_ID'=>$id,'ConfigValue'=>$ConfigValue); + $result = $this->configmodel->addconfigdetails($configvalue); - }}//if closed - //echo "successfully created:".$ConfigID; - - + } + }//if closed + if($result > 0) { redirect('configurationctrl/configlisting','refresh'); @@ -111,7 +101,10 @@ public function index() echo ""; } } - + + /** + * For editing purpose and it has oldest values only. + */ function editOldconfig($ConfigID = '') { $ConfigID = $_GET['ConfigID']; @@ -119,12 +112,13 @@ public function index() $data['child'] = $this->configmodel->GetConfigCenterDetails($ConfigID); $index = 1; - // $index = $index + 1; $this->global['pageTitle'] = 'Resico : Edit Config'; $this->loadViews("editconfig", $this->global, $data,NULL); - //} } + /** + * To store edited config information into DB + */ function configedit() { @@ -132,42 +126,30 @@ public function index() $ConfigName = $this->input->post('ConfigName'); $Comments = $this->input->post('Remarks'); $Rowcount = $this->input->post('txtRowCount'); - //echo $Rowcount;die(); - //$ConfigValue = $this->input->post('ConfigValue'); - + $config = array('Config_ID'=>$Configid,'ConfigName'=>$ConfigName, 'Comments'=>$Comments); - //print_r($config);die(); $result = $this->configmodel->updateconfig($config,$Configid); - // if(count($config)>0) - // { for($i=1;$i<=$Rowcount;$i++) { - // echo $i; - $Key = $this->input->post('DbKey'.$i); - $conid = $this->input->post('configID'.$i); - $ConfigValue = $this->input->post('configVal'.$i); - - //print_r($Key);die(); - // echo $conid . "-" . $ConfigValue; - $configval = array('ConfigValue'=>$ConfigValue); - // print_r($configval);die(); - $result = $this->configmodel->updateconfigvalue($configval,$Key); - } - //} - //$print_r($result);die(); - if($result == True) - { - redirect('configlisting','refresh'); - echo ""; - } - - else - { - redirect('configlisting','refresh'); - echo ""; - } - } -} + $Key = $this->input->post('DbKey'.$i); + $conid = $this->input->post('configID'.$i); + $ConfigValue = $this->input->post('configVal'.$i); + $configval = array('ConfigValue'=>$ConfigValue); + $result = $this->configmodel->updateconfigvalue($configval,$Key); + + } + if($result == True) + { + redirect('configlisting','refresh'); + echo ""; + } + else + { + redirect('configlisting','refresh'); + echo ""; + } + } + } ?> \ No newline at end of file diff --git a/application/controllers/department.php b/application/controllers/department.php index 1ed3a08c..76402e38 100644 --- a/application/controllers/department.php +++ b/application/controllers/department.php @@ -4,7 +4,7 @@ require APPPATH . '/libraries/BaseController.php'; /** * Class : department (Department Details - Controller) - * User Class to control all user related operations. + * department Class to control all department related operations. * @author : Venba Info Tech - Gandhimathi * @version : 1.1 * @since : 18 November 2017 @@ -12,30 +12,28 @@ require APPPATH . '/libraries/BaseController.php'; class department extends BaseController { /** - * This is default constructor of the class + * default constructor of the class */ public function __construct() { parent::__construct(); $this->load->model('department_model'); - // $this->load->library('form_validation'); - // $this->load->library('pagination'); $this->load->library('Excel'); $this->isLoggedIn(); } + /** - * This function used to load the first screen of the user + * Index Page for this controller(default function of the class) */ public function index() { - $this->global['pageTitle'] = 'Resico : Department Details'; - + $this->global['pageTitle'] = 'Resico : Department Details'; $this->loadViews("departmentListing", $this->global, NULL , NULL); } /** - * This function is used to load the Department list + * To load the Department list */ function departmentListing() { @@ -46,36 +44,26 @@ class department extends BaseController else { $this->load->model('department_model'); - - //$searchText = $this->input->post('searchText'); - //$data['searchText'] = $searchText; - //$count = $this->department_model->departmentListing($searchText); - //$returns = $this->paginationCompress ( "departmentListing/", $count, 20 ); - - $data['userRecords'] = $this->department_model->departmentListing();//$searchText, $returns["page"], $returns["segment"]); - + $data['userRecords'] = $this->department_model->departmentListing(); $this->global['pageTitle'] = 'Resico : Department Listing'; - $this->loadViews("departmentListing", $this->global, $data, NULL); } } + /** - * This function is used to load the add new supplier */ + * To load the add new department + */ function adddepartment() { - - //$data['payment'] = $this->department_model->getpayment(); - //$data['depcode'] = $this->department_model->getdepcode(); $data['depcode'] = $this->department_model->getdepcode(); - $this->global['pageTitle'] = 'Resico : Add New Department'; - $this->loadViews("adddepartment", $this->global,$data, NULL); - } - + /** + * To store the value of add new department + */ function addNewdepartment() { @@ -109,18 +97,20 @@ class department extends BaseController redirect('departmentListing','refresh'); } - } - - - + } + + /** + * To Convert the dateformat (date with time) and stored into DB + */ function getDateformat($Val) { $date = new DateTime($Val); $retDate = $date->format('Y-m-d H:i:s'); return $retDate; - } + } + /** - * This function is used to edit the department information + * To edit the department information */ function editdepartment() { @@ -140,12 +130,10 @@ class department extends BaseController $IsActive = '0'; } - - $department = array('DepartmentName'=>$DepartmentName, 'DEPCode'=>$DEPCode,'HeadDept'=>$HeadDept,'IsActive'=>$IsActive); - + $department = array('DepartmentName'=>$DepartmentName, 'DEPCode'=>$DEPCode,'HeadDept'=>$HeadDept,'IsActive'=>$IsActive); $result = $this->department_model->Updatedepartment($department, $DEPCode); - if($result == True) + if($result == True) { echo ""; redirect('departmentListing','refresh'); @@ -157,14 +145,14 @@ class department extends BaseController redirect('departmentListing','refresh'); } - } - + /** + * To view the departmant information and load's the edit department screen + */ function viewdepartment($SID = '') { - //print_r('hello');die(); if($SID == '') { @@ -177,7 +165,6 @@ class department extends BaseController $DepartmentID = $SID; } - $data['department'] = $this->department_model->getDeptInfo($DepartmentID); $data['depcode'] = $this->department_model->getdepcode(); $this->global['pageTitle'] = 'Resico : Edit Department'; @@ -185,11 +172,11 @@ class department extends BaseController } - /** this function can be use for excel report **/ - + /** + * To export report of supplier details in excel + */ function export_departmentdetails(){ - - + $this->load->library('excel'); $this->excel->setActiveSheetIndex(0)->mergeCells('C3:H3'); $this->excel->setActiveSheetIndex(0)->getStyle('C3')->getAlignment()->applyFromArray( @@ -252,11 +239,12 @@ class department extends BaseController } - + /** + * To load pagenotfound view + */ function pageNotFound() { $this->global['pageTitle'] = 'Resico : 404 - Page Not Found'; - $this->loadViews("404", $this->global, NULL, NULL); } diff --git a/application/controllers/employeedetails.php b/application/controllers/employeedetails.php index 80f0c1e4..0590b69b 100644 --- a/application/controllers/employeedetails.php +++ b/application/controllers/employeedetails.php @@ -4,7 +4,7 @@ require APPPATH . '/libraries/BaseController.php'; /** * Class : employeedetails (Employee Details - Controller) - * User Class to control all user related operations. + * employeedetails Class to control all Employee related operations. * @author :Venba Info Tech - Gandhimathi * @version : 1.1 * @since : 18 November 2017 @@ -12,65 +12,59 @@ require APPPATH . '/libraries/BaseController.php'; class employeedetails extends BaseController { /** - * This is default constructor of the class + * default constructor of the class */ - public function __construct() - { - parent::__construct(); - $this->load->model('employeedetails_model'); - $this->isLoggedIn(); - } - /** - * This function used to load the first screen of the user - */ - public function index() - { - $this->global['pageTitle'] = 'Resico : Employee Details'; + public function __construct() + { + parent::__construct(); + $this->load->model('employeedetails_model'); + $this->isLoggedIn(); + } - $this->loadViews("employeeListing", $this->global, NULL , NULL); - } - - /** - * This function is used to load the Employee details + /** + * Index Page for this controller(default function of the class) + */ + public function index() + { + $this->global['pageTitle'] = 'Resico : Employee Details'; + //Load the view supplierListing.php + $this->loadViews("employeeListing", $this->global, NULL , NULL); + } + + /** + * default function of the employeedetail class */ function employeeListing() { - $this->load->model('employeedetails_model'); - - + $this->load->model('employeedetails_model'); $data['userRecords'] = $this->employeedetails_model->employeeListing(); - $this->global['pageTitle'] = 'Resico : Employee Listing'; - $this->loadViews("employeeListing", $this->global, $data, NULL); } - /* - Validation for Gender status Dropdown - */ + + /** + *Validation for Gender status Dropdown + */ function Gender_validate($selectValue) -{ - //echo 'select_validate method called'; - // 'none' is the first option and the text says something like "-Choose one-" - if($selectValue == '-1') { - $this->form_validation->set_message('Gender_validate', 'Please Select Gender.'); - return false; + if($selectValue == '-1') + { + $this->form_validation->set_message('Gender_validate', 'Please Select Gender.'); + return false; + } + else // user picked something + { + return true; + } } - else // user picked something - { - return true; - } -} -/* - Validation for Martial status Dropdown - */ + /** + * Validation for Martial status Dropdown + */ function Martial_validate($selectValue) { - //echo 'select_validate method called'; - // 'none' is the first option and the text says something like "-Choose one-" if($selectValue == '-1') { $this->form_validation->set_message('Martial_validate', 'Please Select Martial status.'); @@ -81,13 +75,11 @@ class employeedetails extends BaseController return true; } } -/* - Validation for BloodGroup Dropdown + /** + *Validation for BloodGroup Dropdown */ function Blood_validate($selectValue) { - //echo 'select_validate method called'; - // 'none' is the first option and the text says something like "-Choose one-" if($selectValue == '-1') { $this->form_validation->set_message('Blood_validate', 'Please Select Blood Group.'); @@ -98,30 +90,27 @@ class employeedetails extends BaseController return true; } } - /* - Validation for Qualification Dropdown + /** + * Validation for Qualification Dropdown */ function select_validate($selectValue) -{ - //echo 'select_validate method called'; - // 'none' is the first option and the text says something like "-Choose one-" - if($selectValue == '-1') - { - $this->form_validation->set_message('select_validate', 'Please Select Educational Qualification.'); - return false; + { + if($selectValue == '-1') + { + $this->form_validation->set_message('select_validate', 'Please Select Educational Qualification.'); + return false; + } + else // user picked something + { + return true; + } } - else // user picked something - { - return true; - } -} -/* - Validation for Department Dropdown - */ + +/** + * Validation for Department Dropdown + */ function Dep_validate($selectValue) -{ - //echo 'select_validate method called'; - // 'none' is the first option and the text says something like "-Choose one-" + { if($selectValue == '-1') { $this->form_validation->set_message('Dep_validate', 'Please Select Department.'); @@ -131,14 +120,13 @@ class employeedetails extends BaseController { return true; } -} -/* - Validation for Desigination Dropdown - */ + } + + /** + * Validation for Desigination Dropdown + */ function Des_validate($selectValue) -{ - //echo 'select_validate method called'; - // 'none' is the first option and the text says something like "-Choose one-" + { if($selectValue == '-1') { $this->form_validation->set_message('Des_validate', 'Please Select Desigination.'); @@ -148,14 +136,15 @@ class employeedetails extends BaseController { return true; } -} + } - /* To Check the Pan Number is exists in the database or not */ + /** + * To Check the Pan Number is exists in the database or not for the selected Employee + */ function Pan_validate() { - // alert('validation pan'); - + $PanNo = $this->input->post('panno'); $query = $this->employeedetails_model->checkPANExists($PanNo); @@ -170,14 +159,15 @@ class employeedetails extends BaseController } } - - /* To Check the Pan Number is exists in the database or not */ + /** + * To Check the aadhar Number is exists in the database or not for the selected Employee + */ function Aadhar_validate() { $AadharNo = $this->input->post('aadharno'); - $this->load->model('employeedetails_model'); - $query = $this->employeedetails_model->checkAadharExists($AadharNo); + $this->load->model('employeedetails_model'); + $query = $this->employeedetails_model->checkAadharExists($AadharNo); if (count($query)> 0) { @@ -191,14 +181,14 @@ class employeedetails extends BaseController } - /** - * This function is used to save the new Employee form in the database - */ + /** + * To save the new Employee form in the database + */ function AddNewEmployee() { - $this->load->library('form_validation'); + $this->load->library('form_validation'); $this->form_validation->set_rules('ContactNumber', 'ContactNumber', 'trim|required|min_length[10]|max_length[10]'); $this->form_validation->set_rules('emailid', 'emailid', 'trim|required|valid_email'); @@ -218,90 +208,86 @@ class employeedetails extends BaseController $this->form_validation->set_rules('esino', 'esino', 'trim|min_length[10]|max_length[10]'); - if($this->form_validation->run() == FALSE) + if($this->form_validation->run() == FALSE) { $this->addemployee(); - //echo 'Validate method called'; } else { - //echo 'Validate not method called'; - $Picture = $this->add(); - $Profile = $this->input->post('photo'); - $FirstName = $this->input->post('FirstName'); - $LastName = $this->input->post('LastName'); - $FatherName = $this->input->post('FatherName'); - $DateofBirth = $this->input->post('DateofBirth'); - $ContactNumber = $this->input->post('ContactNumber'); - $EmailId = $this->input->post('emailid'); - $comEmailId = $this->input->post('comemailid'); - $Gender = $this->input->post('gender'); - $MartialStatus = $this->input->post('MartialStatus'); - $BloodGroup = $this->input->post('bloodgroup'); - $CurrentAddress = $this->input->post('currentaddress'); - $permanentaddress = $this->input->post('permanentaddress'); - $emergencycontactname = $this->input->post('emergencycontactname'); - $emergencycontactnumber = $this->input->post('emergencycontactnumber'); - $desigination = $this->input->post('desigination'); - $departmentCode = $this->input->post('departmentname'); - $dateofjoining = $this->input->post('dateofjoining'); - $pre_experience = $this->input->post('Previousexperience'); - if($pre_experience == '') - { - $Previousexperience = null; - } - else - { - $Previousexperience = $pre_experience; - } + $Picture = $this->add(); + $Profile = $this->input->post('photo'); + $FirstName = $this->input->post('FirstName'); + $LastName = $this->input->post('LastName'); + $FatherName = $this->input->post('FatherName'); + $DateofBirth = $this->input->post('DateofBirth'); + $ContactNumber = $this->input->post('ContactNumber'); + $EmailId = $this->input->post('emailid'); + $comEmailId = $this->input->post('comemailid'); + $Gender = $this->input->post('gender'); + $MartialStatus = $this->input->post('MartialStatus'); + $BloodGroup = $this->input->post('bloodgroup'); + $CurrentAddress = $this->input->post('currentaddress'); + $permanentaddress = $this->input->post('permanentaddress'); + $emergencycontactname = $this->input->post('emergencycontactname'); + $emergencycontactnumber = $this->input->post('emergencycontactnumber'); + $desigination = $this->input->post('desigination'); + $departmentCode = $this->input->post('departmentname'); + $dateofjoining = $this->input->post('dateofjoining'); + $pre_experience = $this->input->post('Previousexperience'); + + if($pre_experience == '') + { + $Previousexperience = null; + } + else + { + $Previousexperience = $pre_experience; + } - $eduqualifaction = $this->input->post('eduqualifaction'); - $addqualification = $this->input->post('addqualification'); - $referredby = $this->input->post('referredby'); - $referrercontno = $this->input->post('referrercontno'); - $accountno = $this->input->post('accountno'); - $ifsccode = $this->input->post('ifsccode'); - $bankbranchname = $this->input->post('bankbranchname'); - $bankaddress = $this->input->post('bankaddress'); - $aadharno = $this->input->post('aadharno'); - $panno = strtoupper($this->input->post('panno')); - $passportno = strtoupper($this->input->post('passportno')); - $ValidTill = $this->input->post('ValidTill'); - $addinfo = $this->input->post('addinfo'); - $IsActive = '1'; - $driverlicense = strtoupper($this->input->post ( 'driverlicense' )); - $licenseExpiryDate = $this->input->post ( 'licenseExpiryDate' ); - $VoterID = strtoupper($this->input->post ( 'voterID' )); - $PFno = $this->input->post('pfno'); - $ESIno = $this->input->post('esino'); - $Nominee = $this->input->post('nomineename'); - $createdby = $this->session->userdata ( 'userId' ); - - if($licenseExpiryDate != '') - { - //$License_ExpiryDate = $this->dateformat($licenseExpiryDate); - $License_ExpiryDate = $this->getDateformat($licenseExpiryDate); - } - else - { - $License_ExpiryDate = null; - } - - $DOB = $this->getDateformat($DateofBirth); - $DOJ = $this->getDateformat($dateofjoining); - - if($ValidTill != '') - { - - $Valid = $this->getDateformat($ValidTill); - } - else - { - $Valid = null; - } - - //echo $DOB; + $eduqualifaction = $this->input->post('eduqualifaction'); + $addqualification = $this->input->post('addqualification'); + $referredby = $this->input->post('referredby'); + $referrercontno = $this->input->post('referrercontno'); + $accountno = $this->input->post('accountno'); + $ifsccode = $this->input->post('ifsccode'); + $bankbranchname = $this->input->post('bankbranchname'); + $bankaddress = $this->input->post('bankaddress'); + $aadharno = $this->input->post('aadharno'); + $panno = strtoupper($this->input->post('panno')); + $passportno = strtoupper($this->input->post('passportno')); + $ValidTill = $this->input->post('ValidTill'); + $addinfo = $this->input->post('addinfo'); + $IsActive = '1'; + $driverlicense = strtoupper($this->input->post ( 'driverlicense' )); + $licenseExpiryDate = $this->input->post ( 'licenseExpiryDate' ); + $VoterID = strtoupper($this->input->post ( 'voterID' )); + $PFno = $this->input->post('pfno'); + $ESIno = $this->input->post('esino'); + $Nominee = $this->input->post('nomineename'); + $createdby = $this->session->userdata ( 'userId' ); + + if($licenseExpiryDate != '') + { + $License_ExpiryDate = $this->getDateformat($licenseExpiryDate); + } + else + { + $License_ExpiryDate = null; + } + + $DOB = $this->getDateformat($DateofBirth); + $DOJ = $this->getDateformat($dateofjoining); + + if($ValidTill != '') + { + $Valid = $this->getDateformat($ValidTill); + } + else + { + $Valid = null; + } + $Employee = array('FirstName'=>$FirstName, 'LastName'=>$LastName,'FatherName'=>$FatherName, 'Gender'=>$Gender,'DateofBirth'=>$DOB,'ContactNumber'=>$ContactNumber,'EmailId'=>$EmailId, 'BloodGroup'=>$BloodGroup,'MartialStatus'=>$MartialStatus,'DateofJoining'=>$DOJ, @@ -318,37 +304,37 @@ class employeedetails extends BaseController 'LicenseValidtill'=>$License_ExpiryDate,'VoterID'=>$VoterID,'PFNO'=>$PFno,'ESI'=>$ESIno, 'NomineeDetails'=>$Nominee); - $this->load->model('employeedetails_model'); - //print_r($Employee);die(); - $result = $this->employeedetails_model->addNewemployee($Employee); + $this->load->model('employeedetails_model'); + + $result = $this->employeedetails_model->addNewemployee($Employee); if($result > 0) { - - // $this->session->set_flashdata('Success', 'New Employee created successfully!'); -echo "";redirect('employeeListing','refresh'); + echo "";redirect('employeeListing','refresh'); } else { - $this->session->set_flashdata('Error', 'New Employee details not saved'); - -echo "";redirect('employeeListing','refresh'); + echo "";redirect('employeeListing','refresh'); } - - } + } } + /** + * To Convert the dateformat (date with time) and stored into DB + */ function getDateformat($Val) { - $date = new DateTime($Val); + $date = new DateTime($Val); $retDate = $date->format('Y-m-d H:i:s'); return $retDate; } - //this function used to dateformat to store in db + /** + * To Convert the dateformat (date only) and stored into DB + */ function dateformat($DateValue) { $date = DateTime::createFromFormat('d-m-Y', $DateValue);//we should give the date as per DatePicker format. @@ -364,47 +350,51 @@ echo "";redirect('employeeListing',' return $retDate; } - /** - * This function is used to load the add new Employee form with dropdown values */ + /** + * To load the add new Employee form with dropdown values + */ function addemployee() { $this->load->model('employeedetails_model'); $GenderConfigID = 'C013'; - $MartialConfigID = 'C012'; - $QualificationConfigID = 'C014'; - $DesignationConfigID = 'C010'; - $BloodGroupConfigID = 'C011'; - - $data['Gender'] = $this->employeedetails_model->getConfigValue($GenderConfigID); - $data['Martial'] = $this->employeedetails_model->getConfigValue($MartialConfigID); - $data['bankdetails']=$this->employeedetails_model->getBankDetails(); - $data['Qualification'] = $this->employeedetails_model->getConfigValue($QualificationConfigID); - $data['Designation'] = $this->employeedetails_model->getConfigValue($DesignationConfigID); - $data['BloodGroup'] = $this->employeedetails_model->getConfigValue($BloodGroupConfigID); + $MartialConfigID = 'C012'; + $QualificationConfigID = 'C014'; + $DesignationConfigID = 'C010'; + $BloodGroupConfigID = 'C011'; + $data['Gender'] = $this->employeedetails_model->getConfigValue($GenderConfigID); + $data['Martial'] = $this->employeedetails_model->getConfigValue($MartialConfigID); + $data['bankdetails']=$this->employeedetails_model->getBankDetails(); + $data['Qualification'] = $this->employeedetails_model->getConfigValue($QualificationConfigID); + $data['Designation'] = $this->employeedetails_model->getConfigValue($DesignationConfigID); + $data['BloodGroup'] = $this->employeedetails_model->getConfigValue($BloodGroupConfigID); + $data['Department'] = $this->employeedetails_model->getDepartment(); - $this->global['pageTitle'] = 'Resico : Add New Employee'; - $this->loadViews("addemployee", $this->global, $data, NULL); + $this->global['pageTitle'] = 'Resico : Add New Employee'; + $this->loadViews("addemployee", $this->global, $data, NULL); } - /** - * This function is used to check whether the Employee is existing in the database or not */ + + /** + * To check whether the Employee mailid is existing in the database or not + */ function CheckEmail() - { + { $id = $this->input->post('id'); - //print_r($id); $this->load->model('employeedetails_model'); $query = $this->employeedetails_model->checkMailExists($id ); $query = $query[0]['EmailId']; print_r($query); - - } - function checkPAN() + } + + /** + * To check whether PAN already exist or not + */ + function checkPAN() { $id = $this->input->post('id'); - //print_r($id); $this->load->model('employeedetails_model'); $query = $this->employeedetails_model->checkPANExists($id ); $query = $query[0]['PANNo']; @@ -416,7 +406,6 @@ echo "";redirect('employeeListing',' { $id = $this->input->post('id'); - //print_r($id); $this->load->model('employeedetails_model'); $query = $this->employeedetails_model->checkAadharExists($id ); $query = $query[0]['AadharNo']; @@ -425,10 +414,11 @@ echo "";redirect('employeeListing',' } - /* To Check the Pan Number is exists in the database or not for the selected Supplier */ - function Pan_validate_emp() { - //print_r($PanNo); - + /** + * To Check the Pan Number is exists in the database or not for the selected Employee + */ + function Pan_validate_emp() + { $Empid = $this->input->post('employeeid'); $PanNo = $this->input->post('panno'); $this->load->model('employeedetails_model'); @@ -444,8 +434,11 @@ echo "";redirect('employeeListing',' } } - // To Check the Aadhar Number is exists in the database or not for the selected Employee - function Aadhar_validate_emp() { + /** + * To Check the aadhar Number is exists in the database or not for the selected Employee + */ + function Aadhar_validate_emp() + { $Empid = $this->input->post('employeeid'); $AadharNo = $this->input->post('aadharno'); $this->load->model('employeedetails_model'); @@ -462,46 +455,52 @@ echo "";redirect('employeeListing',' } - + /** + * To load pagenotfound view + */ function pageNotFound() { $this->global['pageTitle'] = 'Resico : 404 - Page Not Found'; - $this->loadViews("404", $this->global, NULL, NULL); } - + /** + * To add employee revalant images(for profile pictures) + */ function add() - { + { $picture = ''; - if(!empty($_FILES['photo']['name'])) + if(!empty($_FILES['photo']['name'])) { $config['upload_path'] = 'uploads/images/'; - $config['allowed_types'] = 'jpg|jpeg|png|gif'; - $config['file_name'] = $_FILES['photo']['name']; + $config['allowed_types'] = 'jpg|jpeg|png|gif'; + $config['file_name'] = $_FILES['photo']['name']; - //Load upload library and initialize configuration - $this->load->library('upload',$config); - $this->upload->initialize($config); - if($this->upload->do_upload('photo')) - { - $uploadData = $this->upload->data(); - $picture = $uploadData['file_name']; - } - else - { - $error = array('error' => $this->upload->display_errors()); - $picture = ''; - } + //Load upload library and initialize configuration + $this->load->library('upload',$config); + $this->upload->initialize($config); + if($this->upload->do_upload('photo')) + { + $uploadData = $this->upload->data(); + $picture = $uploadData['file_name']; } - else - { - $picture = ''; + else + { + $error = array('error' => $this->upload->display_errors()); + $picture = ''; } - + } + else + { + $picture = ''; + } + return $picture ; } + /** + * To view the employee information and load's the edit employee screen + */ function ViewEmployee($EmpNO='') { @@ -511,16 +510,17 @@ echo "";redirect('employeeListing',' } else { - - $EmpID = $EmpNO; } + $EmpID = $EmpNO; + } $GenderConfigID = 'C013'; $MartialConfigID = 'C012'; $QualificationConfigID = 'C014'; $DesignationConfigID = 'C010'; $BloodGroupConfigID = 'C011'; - $this->load->model('employeedetails_model'); - //print_r('hai'); + + $this->load->model('employeedetails_model'); + $data['GenderList'] = $this->employeedetails_model->getConfigValue($GenderConfigID); $data['MartialList'] = $this->employeedetails_model->getConfigValue($MartialConfigID); $data['QualificationList'] = $this->employeedetails_model->getConfigValue($QualificationConfigID); @@ -535,7 +535,9 @@ echo "";redirect('employeeListing',' } - /* To Check the email exists in the database or not for the employee*/ + /** + * To Check the email exists in the database or not for the employee + */ function checkMailEmp() { @@ -554,17 +556,17 @@ echo "";redirect('employeeListing',' } } - /* To Update the employee details*/ + /** + * To Update the employee details + */ function UpdateEmployee() { - $EmpId = $this->input->post('employeeid'); - $this->load->library('form_validation'); - //$mail = $this->this->.post('emailid'); + $EmpId = $this->input->post('employeeid'); + $this->load->library('form_validation'); $this->form_validation->set_rules('ContactNumber', 'ContactNumber', 'trim|required|min_length[10]|max_length[10]'); - $this->form_validation->set_rules('emailid', 'emailid', 'trim|required|valid_email|callback_checkMailEmp'); - + $this->form_validation->set_rules('emailid', 'emailid', 'trim|required|valid_email|callback_checkMailEmp'); $this->form_validation->set_rules('gender', 'gender', 'callback_Gender_validate'); $this->form_validation->set_rules('MartialStatus', 'MartialStatus', 'callback_Martial_validate'); $this->form_validation->set_rules('bloodgroup', 'bloodgroup', 'callback_Blood_validate'); @@ -580,128 +582,117 @@ echo "";redirect('employeeListing',' $this->form_validation->set_rules('pfno', 'pfno', 'trim|min_length[22]|max_length[22]'); $this->form_validation->set_rules('esino', 'esino', 'trim|min_length[10]|max_length[10]'); - if($this->form_validation->run() == FALSE) - { + { $this->ViewEmployee($EmpId); - } - else - { + } + else + { - $this->load->model('employeedetails_model'); - $EmpId = $this->input->post('employeeid'); - $PictureName = $this->input->post('Image'); - $ModifyPictureName = $this->input->post('ModifyImage'); + $this->load->model('employeedetails_model'); + $EmpId = $this->input->post('employeeid'); + $PictureName = $this->input->post('Image'); + $ModifyPictureName = $this->input->post('ModifyImage'); if ($PictureName != '') - { - //echo 'Exists'; - //$Picture = $PictureName; - if(strlen($ModifyPictureName) == 0) - { - //echo 'Exists But Not replace'; - $Picture = $PictureName; - } - else - { - //echo 'Exists But Replace'; - //$Picture = $ModifyPictureName; - //$Picture = $this->editimage($ModifyPictureName); - $Picture = $this->add($ModifyPictureName); - } - } - else - { - //echo 'Not Exists'; - $Picture = $this->add(); - } - //echo $Picture; + { + if(strlen($ModifyPictureName) == 0) + { + $Picture = $PictureName; + } + else + { + $Picture = $this->add($ModifyPictureName); + } + } + else + { + $Picture = $this->add(); + } - $FirstName = $this->input->post('FirstName'); - $LastName = $this->input->post('LastName'); - $FatherName = $this->input->post('FatherName'); - $DateofBirth = $this->input->post('DateofBirth'); - $ContactNumber = $this->input->post('ContactNumber'); - $EmailId = $this->input->post('emailid'); - $comEmailId = $this->input->post('comemailid'); - $Gender = $this->input->post('gender'); - $MartialStatus = $this->input->post('MartialStatus'); - $BloodGroup = $this->input->post('bloodgroup'); - $CurrentAddress = $this->input->post('currentaddress'); - $permanentaddress = $this->input->post('permanentaddress'); - $emergencycontactname = $this->input->post('emergencycontactname'); - $emergencycontactnumber = $this->input->post('emergencycontactnumber'); - $desigination = $this->input->post('desigination'); - $departmentCode = $this->input->post('departmentname'); - $dateofjoining = $this->input->post('dateofjoining'); - //$Previousexperience = $this->input->post('Previousexperience'); - $pre_experience = $this->input->post('Previousexperience'); + $FirstName = $this->input->post('FirstName'); + $LastName = $this->input->post('LastName'); + $FatherName = $this->input->post('FatherName'); + $DateofBirth = $this->input->post('DateofBirth'); + $ContactNumber = $this->input->post('ContactNumber'); + $EmailId = $this->input->post('emailid'); + $comEmailId = $this->input->post('comemailid'); + $Gender = $this->input->post('gender'); + $MartialStatus = $this->input->post('MartialStatus'); + $BloodGroup = $this->input->post('bloodgroup'); + $CurrentAddress = $this->input->post('currentaddress'); + $permanentaddress = $this->input->post('permanentaddress'); + $emergencycontactname = $this->input->post('emergencycontactname'); + $emergencycontactnumber = $this->input->post('emergencycontactnumber'); + $desigination = $this->input->post('desigination'); + $departmentCode = $this->input->post('departmentname'); + $dateofjoining = $this->input->post('dateofjoining'); + $pre_experience = $this->input->post('Previousexperience'); - if($pre_experience == '') - { - $Previousexperience = null; - } - else - { - $Previousexperience = $pre_experience; - } - $eduqualifaction = $this->input->post('eduqualifaction'); - $addqualification = $this->input->post('addqualification'); - $referredby = $this->input->post('referredby'); - $referrercontno = $this->input->post('referrercontno'); - $accountno = $this->input->post('accountno'); - $ifsccode = $this->input->post('ifsccode'); - $bankbranchname = $this->input->post('bankbranchname'); - $bankaddress = $this->input->post('bankaddress'); - $aadharno = $this->input->post('aadharno'); - $panno = strtoupper($this->input->post('panno')); - $passportno = strtoupper($this->input->post('passportno')); - $ValidTill = $this->input->post('ValidTill'); - $addinfo = $this->input->post('addinfo'); - $driverlicense = strtoupper($this->input->post ( 'Driverlicense' )); - $licenseExpiryDate = $this->input->post ( 'LicenseExpiryDate' ); - $VoterID = strtoupper($this->input->post ( 'VoterID' )); - $pfno = strtoupper($this->input->post('pfno')); - //$uano = $this->input->post('uano'); - $esino = $this->input->post('esino'); - $Nominee = $this->input->post('nomineename'); - $chked = $this->input->post('isactive'); - // echo 'chkvalue'. $chked ; - if( $chked != '') - { - $IsActive = '1'; - } - else - { - $IsActive = '0'; - } - // echo 'chkvalue'. $IsActive ; - $UpdatedBY = $this->session->userdata ( 'userId' ); - - //$licenseExpiryDate = $this->getDateformat($licenseExpiryDate); - $DOB = $this->dateformat($DateofBirth); - $DOJ = $this->dateformat($dateofjoining); - if($ValidTill != '') - { - $Valid = $this->dateformat($ValidTill); - } - else - { - $Valid = null; - } + if($pre_experience == '') + { + $Previousexperience = null; + } + else + { + $Previousexperience = $pre_experience; + } - if($licenseExpiryDate != '') - { - $License_ExpiryDate = $this->dateformat($licenseExpiryDate); - } - else - { - $License_ExpiryDate = null; - } + $eduqualifaction = $this->input->post('eduqualifaction'); + $addqualification = $this->input->post('addqualification'); + $referredby = $this->input->post('referredby'); + $referrercontno = $this->input->post('referrercontno'); + $accountno = $this->input->post('accountno'); + $ifsccode = $this->input->post('ifsccode'); + $bankbranchname = $this->input->post('bankbranchname'); + $bankaddress = $this->input->post('bankaddress'); + $aadharno = $this->input->post('aadharno'); + $panno = strtoupper($this->input->post('panno')); + $passportno = strtoupper($this->input->post('passportno')); + $ValidTill = $this->input->post('ValidTill'); + $addinfo = $this->input->post('addinfo'); + $driverlicense = strtoupper($this->input->post ( 'Driverlicense' )); + $licenseExpiryDate = $this->input->post ( 'LicenseExpiryDate' ); + $VoterID = strtoupper($this->input->post ( 'VoterID' )); + $pfno = strtoupper($this->input->post('pfno')); + $esino = $this->input->post('esino'); + $Nominee = $this->input->post('nomineename'); + $chked = $this->input->post('isactive'); + + if( $chked != '') + { + $IsActive = '1'; + } + else + { + $IsActive = '0'; + } + + $UpdatedBY = $this->session->userdata ( 'userId' ); + $DOB = $this->dateformat($DateofBirth); + $DOJ = $this->dateformat($dateofjoining); - //echo $DOB; - $Employee = array('FirstName'=>$FirstName, 'LastName'=>$LastName,'FatherName'=>$FatherName,'Gender'=>$Gender, + if($ValidTill != '') + { + $Valid = $this->dateformat($ValidTill); + } + else + { + $Valid = null; + } + + if($licenseExpiryDate != '') + { + $License_ExpiryDate = $this->dateformat($licenseExpiryDate); + } + else + { + $License_ExpiryDate = null; + } + + + $Employee = array('FirstName'=>$FirstName, 'LastName'=>$LastName,'FatherName'=>$FatherName,'Gender'=>$Gender, 'DateofBirth'=>$DOB,'ContactNumber'=>$ContactNumber,'EmailId'=>$EmailId, 'BloodGroup'=>$BloodGroup,'MartialStatus'=>$MartialStatus,'DateofJoining'=>$DOJ, 'PreviousYearsOfExp'=>$Previousexperience,'Designation'=>$desigination, @@ -715,35 +706,30 @@ echo "";redirect('employeeListing',' 'Reference_ContactNumber'=>$referrercontno,'Remarks'=>$addinfo,'UpdatedBY'=>$UpdatedBY, 'personalEmailId'=>$comEmailId,'DriverLicense'=>$driverlicense,'LicenseValidtill'=>$License_ExpiryDate, 'VoterID'=>$VoterID,'PFNO'=>$pfno,'ESI'=>$esino,'NomineeDetails'=>$Nominee); - //print_r($Employee);die(); - $result = $this->employeedetails_model->UpdateEmployee($Employee,$EmpId); - - if($result > 0) - { - - // $this->session->set_flashdata('Success', $EmpId.'Employee Updated successfully!'); - -echo "";redirect('employeeListing','refresh'); - } - else - { - - $this->session->set_flashdata('Error', $EmpId.'Employee details not saved'); -echo ""; redirect('employeeListing','refresh'); - } + $result = $this->employeedetails_model->UpdateEmployee($Employee,$EmpId); + + if($result > 0) + { + echo "";redirect('employeeListing','refresh'); + } + else + { + $this->session->set_flashdata('Error', $EmpId.'Employee details not saved'); + echo ""; redirect('employeeListing','refresh'); + } - // redirect('employeeListing'); } } - /** this function can be use for excel report **/ - + /** + * To export report of supplier details in excel + */ function export_employee(){ - $this->load->library('excel'); + $this->load->library('excel'); $this->excel->setActiveSheetIndex(0)->mergeCells('L3:S3'); $this->excel->setActiveSheetIndex(0)->getStyle('L3')->getAlignment()->applyFromArray(array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,)); @@ -785,16 +771,11 @@ echo ""; redirect('employeeListin $this->excel->getActiveSheet()->setCellValue('AH5', 'PFNO'); $this->excel->getActiveSheet()->setCellValue('AI5', 'ESI'); $this->excel->getActiveSheet()->setCellValue('AJ5', 'Nominee Details'); - // $this->excel->getActiveSheet()->setCellValue('AI5', 'PF_Balance'); - // $this->excel->getActiveSheet()->setCellValue('AJ5', 'PF_Bal_On'); $this->excel->getActiveSheet()->setCellValue('AK5', 'Remarks'); $this->excel->getActiveSheet()->setCellValue('AL5', 'CreatedBy'); $this->excel->getActiveSheet()->setCellValue('AM5', 'UpdatedBY'); - - - $this->excel->getActiveSheet()->getStyle('L3')->getFont()->setSize(14); $this->excel->getActiveSheet()->getStyle('L3')->getFont()->setBold(true); $this->excel->getActiveSheet()->getStyle('C5')->getFont()->setSize(12); @@ -871,12 +852,6 @@ echo ""; redirect('employeeListin $this->excel->getActiveSheet()->getStyle('AL5')->getFont()->setBold(true); $this->excel->getActiveSheet()->getStyle('AM5')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('AM5')->getFont()->setBold(true); - // $this->excel->getActiveSheet()->getStyle('AL5')->getFont()->setSize(12); - // $this->excel->getActiveSheet()->getStyle('AL5')->getFont()->setBold(true); - // $this->excel->getActiveSheet()->getStyle('AM5')->getFont()->setSize(12); - // $this->excel->getActiveSheet()->getStyle('AM5')->getFont()->setBold(true); - - $exportData = $this->employeedetails_model->export_excel(); @@ -922,19 +897,10 @@ echo ""; redirect('employeeListin $this->excel->getActiveSheet()->setCellValue('AH'. $i,$data['PFNO']); $this->excel->getActiveSheet()->setCellValue('AI'. $i,$data['ESI']); $this->excel->getActiveSheet()->setCellValue('AJ'. $i,$data['NomineeDetails']); - // $this->excel->getActiveSheet()->setCellValue('AI'. $i,$data['PF_Balance']); - // $this->excel->getActiveSheet()->setCellValue('AJ'. $i,$data['PF_Bal_On']); $this->excel->getActiveSheet()->setCellValue('AK'. $i,$data['Remarks']); $this->excel->getActiveSheet()->setCellValue('AL'. $i,$data['CreatedByName']); $this->excel->getActiveSheet()->setCellValue('AM'. $i,$data['UpdatedByName']); - - - - - - - $i++; $s++; } diff --git a/application/controllers/emppaydate.php b/application/controllers/emppaydate.php index cb1484f0..1379ad46 100644 --- a/application/controllers/emppaydate.php +++ b/application/controllers/emppaydate.php @@ -4,7 +4,7 @@ require APPPATH . '/libraries/BaseController.php'; /** * Class : emppaydate (Employee Payment details - Controller) - * User Class to control all user related operations. + * emppaydate Class to control all employeepayment's related operations. * @author : Venba Info Tech - * @version : 1.1 * @since : 18 November 2017 @@ -12,7 +12,7 @@ require APPPATH . '/libraries/BaseController.php'; class emppaydate extends BaseController { /** - * This is default constructor of the class + * default constructor of the class */ public function __construct() { @@ -20,23 +20,20 @@ class emppaydate extends BaseController $this->load->model('emppaydate_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 + * Index Page for this controller (default function of the class) */ public function index() { $this->global['pageTitle'] = 'Resico : Employee Pay Details'; - $this->loadViews("emppayListing", $this->global); } /** - * This function is used to load the payment list for a employee. + * To load the payment list for a employee. */ function emppayListing() { @@ -52,24 +49,21 @@ class emppaydate extends BaseController } /** - * This function is used to load the add new payment for an employee. + * To load the add new payment for an employee. */ function addemppaydate() { $q="addemppaydate"; - $this->load->model('payroll_model'); - - $result['empdetails'] = $this->payroll_model->getEmpID($q); - - - - $this->global['pageTitle'] = 'Resico : Add Employee Pay'; - - $this->loadViews("addemppaydate", $this->global,$result); + $this->load->model('payroll_model'); + $result['empdetails'] = $this->payroll_model->getEmpID($q); + $this->global['pageTitle'] = 'Resico : Add Employee Pay'; + $this->loadViews("addemppaydate", $this->global,$result); } - + /** + * To store Employeepayment data into DB. + */ function addNewemppay() { @@ -80,8 +74,7 @@ class emppaydate extends BaseController $this->form_validation->set_rules('HRA_Rate','HRA_Rate','trim|required'); $this->form_validation->set_rules('HRA_Amount','HRA_Amount','trim|required'); $this->form_validation->set_rules('Basic_Pay','Basic_Pay','trim|required'); - $this->form_validation->set_rules('Total_salary','Total_salary','trim|required'); - + $this->form_validation->set_rules('Total_salary','Total_salary','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'); @@ -165,13 +158,12 @@ class emppaydate extends BaseController } /** - * This function is used for editing purpose and it has oldest values only. + * For editing purpose and it has oldest values only. */ function editOldemppay($paydataid="") { $data['emppay'] = $this->emppaydate_model->getUserInfo($paydataid); - $this->global['pageTitle'] = 'Resico : Edit Employee Pay Monthly Details '; @@ -182,7 +174,7 @@ class emppaydate extends BaseController /** - * This function is used for stored new values after editing. + * For stored new values after editing. */ function editemppay() { @@ -192,7 +184,6 @@ class emppaydate extends BaseController $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('Total_Salary','Total_Salary','trim|required'); $this->form_validation->set_rules('Basic_Pay','Basic_Pay','trim|required'); @@ -239,8 +230,7 @@ class emppaydate extends BaseController if(!empty($Due_Started)){$Due_Started=date('Y-m-d',strtotime($Due_Started));} else{$Due_Started=null;} - - //echo $Load_Issued_date. "-" . $Due_Started;die(); + $No_Of_Dues=$this->input->post('no_of_due'); $Paid_due=$this->input->post('paid_due'); $Remaining_Due=$this->input->post('remaining_due'); @@ -306,11 +296,12 @@ class emppaydate extends BaseController } - + /** + * To Delete employee payment details + */ function deleteEmpPay() { $EmpID = $this->input->post('id'); - //echo $EmpID; $result = $this->emppaydate_model->deleteEmployeePay($EmpID); if($result == 1) { @@ -322,10 +313,9 @@ class emppaydate extends BaseController } } - - - - + /** + * To load pagenotfound view + */ function pageNotFound() { $this->global['pageTitle'] = 'Resico : 404 - Page Not Found'; @@ -333,7 +323,9 @@ class emppaydate extends BaseController $this->loadViews("404", $this->global, NULL, NULL); } - + /** + * To Convert the dateformat (date with time) and stored into DB + */ function getDateformat($Val) { $date = new DateTime($Val,new DateTimeZone('Asia/Kolkata')); diff --git a/application/controllers/error.php b/application/controllers/error.php index e382d0d4..487d40be 100644 --- a/application/controllers/error.php +++ b/application/controllers/error.php @@ -1,8 +1,8 @@ load->model('inwardgateregister_model'); - $this->load->library('session'); $this->load->library('form_validation'); - $this->isLoggedIn(); - } + } + /** - * This function used to load the first screen of the user + * Index Page for this controller (default function of the class) */ public function index() { @@ -34,51 +33,55 @@ class inwardgateregister extends BaseController $this->loadViews("viewinwardgateregister", $this->global,NULL , NULL); } - + /** + * To load the IGR details for View purpose. + */ function viewIGRDetails() { $this->load->model('inwardgateregister_model'); $this->global['pageTitle'] = 'Resico : Inward Gate Register Details'; $data['IGR']= $this->inwardgateregister_model->igrListing(); - $this->loadViews("viewIGRDetails",$this->global,$data,NULL); } + /** + * For add new value for the system. + */ function addinwardgateregister() { $this->load->model('inwardgateregister_model'); $this->global['pageTitle'] = 'Resico : Add Inward Gate Register'; - - $data['PO_NO'] = $this->inwardgateregister_model->getpurchaseorder(); - //print_r($data['PO_NO']); - $this->loadViews("inwardgateregister", $this->global, $data, NULL); } + /** + * To Convert the dateformat (date with time) and stored into DB + */ function getDateformat($Val) { $date = new DateTime($Val,new DateTimeZone('Asia/Kolkata')); - // print_r($date); $retDate = $date->format('Y-m-d H:i:s'); return $retDate; } + /** + * To display igr lineitem datas + */ function IGRITEM() { - - $PO = $this->input->post('id'); $CreatedBy = $this->session->userdata('userId'); $this->inwardgateregister_model->UpdatePOMaster($PO,$CreatedBy); $data = $this->inwardgateregister_model->viewpurchaseorder($PO); - - echo json_encode($data); - - + echo json_encode($data); } - function addNewigr() + + /** + * To Store IGR data into DB + */ + function addNewigr() { @@ -94,116 +97,99 @@ class inwardgateregister extends BaseController $CreatedBy = $this->session->userdata('userId'); - //$Remarks = $this->input->post('Remarks'); $RowCount = $this->input->post('txtRowCount'); - //echo $RowCount; - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $createddt = $dt->format('Y-m-d H:i:s'); $IGRStatus = IGR_CREATED; - - - //echo $RowCount; - $igr = array(); + $igr = array(); - $igr = array('PONO'=>$PONO,'VehicleNo'=>$VehicleNo,'DeliveryChellanOrInvoiceNo'=>$DeliveryChellanOrInvoiceNo,'DeliveryChellanDate'=>$DeliveryChellanDate,'CourierNo'=>$CourierNo,'IGRStatus'=>$IGRStatus,'CreatedBy'=>$CreatedBy,'CreatedDate' =>$createddt); + $igr = array('PONO'=>$PONO,'VehicleNo'=>$VehicleNo,'DeliveryChellanOrInvoiceNo'=>$DeliveryChellanOrInvoiceNo,'DeliveryChellanDate'=>$DeliveryChellanDate,'CourierNo'=>$CourierNo,'IGRStatus'=>$IGRStatus,'CreatedBy'=>$CreatedBy,'CreatedDate' =>$createddt); - $igrM = $this->inwardgateregister_model->addigrM($igr); + $igrM = $this->inwardgateregister_model->addigrM($igr); - - - $IGRNO = ''; + $IGRNO = ''; if(count($igrM)>0) { foreach ($igrM as $key ) { $IGRNO=$key->IGRNO; } } - //echo $IGRNO; + - $IGRItemStatus = REQITEM_NEW; + $IGRItemStatus = REQITEM_NEW; - for ($i = 1; $i <= $RowCount; $i++) - { + for ($i = 1; $i <= $RowCount; $i++) + { + $MaterialCode = trim($this->input->post('MaterialCode'.$i)); + $QuantityAsPerInvoice = trim($this->input->post('txtQuantityAsPerInvoice'.$i)); + $OrderedQuantity = trim($this->input->post('OrderedQuantity'.$i)); + $ReceivedQty = trim($this->input->post('txtReceivedQuantity'.$i)); + $PendingQty = $this->input->post('txtPendingQty'.$i); + + if(strlen($QuantityAsPerInvoice)>0 && $QuantityAsPerInvoice != '0') + { + $Remarks = $this->input->post('txtRemarks'.$i); + $ItemStatus = ''; + + if($PendingQty == 0.00 ) + { + $ItemStatus = IGR_CREATED; + } + else + { + $ItemStatus = POLINEITEM_IGRPARTIAL_CREATED; + } + + $CreatedBy = $this->session->userdata('userId'); - $MaterialCode = trim($this->input->post('MaterialCode'.$i)); - - $QuantityAsPerInvoice = trim($this->input->post('txtQuantityAsPerInvoice'.$i)); - - $OrderedQuantity = trim($this->input->post('OrderedQuantity'.$i)); - - $ReceivedQty = trim($this->input->post('txtReceivedQuantity'.$i)); - - $PendingQty = $this->input->post('txtPendingQty'.$i); - //echo $QuantityAsPerInvoice; - //echo $PendingQty.'ReceivedQty'.$ReceivedQty; - //echo ' '; - - if(strlen($QuantityAsPerInvoice)>0 && $QuantityAsPerInvoice != '0') - { - $Remarks = $this->input->post('txtRemarks'.$i); - $ItemStatus = ''; - //if($QuantityAsPerInvoice == $OrderedQuantity) - - if($PendingQty == 0.00 ) - - { - $ItemStatus = IGR_CREATED; - } - else - { - $ItemStatus = POLINEITEM_IGRPARTIAL_CREATED; - } - - $CreatedBy = $this->session->userdata('userId'); - - - $igrDetails = array('IGRNO'=>$IGRNO,'MaterialCode'=>$MaterialCode,'QuantityAsPerInvoice'=>$QuantityAsPerInvoice,'Remarks'=>$Remarks,'IGRItemStatus'=>$IGRItemStatus,'CreatedBy'=>$CreatedBy,'CreatedDate'=>$createddt); - - $igrD = $this->inwardgateregister_model->addigrD($igrDetails); - - $Recqty = $this->inwardgateregister_model->getPOLineItemReceivedQty($PONO,$MaterialCode); - $ReceivedQuantity = 0.00; - if(count($Recqty)>0) - { - foreach ($Recqty as $key ) { - $ReceivedQuantity=$key->ReceivedQuantity; - } - } - $totalReceivedqty = $ReceivedQuantity + $QuantityAsPerInvoice; - - //echo ''; - - $POLineItem = array('ReceivedQuantity'=>$totalReceivedqty,'Status'=>$ItemStatus,'UpdateBY'=>$CreatedBy,'UpdatedOn'=>$createddt ); + $igrDetails = array('IGRNO'=>$IGRNO,'MaterialCode'=>$MaterialCode,'QuantityAsPerInvoice'=>$QuantityAsPerInvoice,'Remarks'=>$Remarks,'IGRItemStatus'=>$IGRItemStatus,'CreatedBy'=>$CreatedBy,'CreatedDate'=>$createddt); + $igrD = $this->inwardgateregister_model->addigrD($igrDetails); + $Recqty = $this->inwardgateregister_model->getPOLineItemReceivedQty($PONO,$MaterialCode); + $ReceivedQuantity = 0.00; + + if(count($Recqty)>0) + { + foreach ($Recqty as $key ) { + $ReceivedQuantity=$key->ReceivedQuantity; + } + } + + $totalReceivedqty = $ReceivedQuantity + $QuantityAsPerInvoice; + + $POLineItem = array('ReceivedQuantity'=>$totalReceivedqty,'Status'=>$ItemStatus,'UpdateBY'=>$CreatedBy,'UpdatedOn'=>$createddt ); - $this->inwardgateregister_model->UpdatePOLineItem($POLineItem,$PONO,$MaterialCode); - } + $this->inwardgateregister_model->UpdatePOLineItem($POLineItem,$PONO,$MaterialCode); + } } $this->inwardgateregister_model->UpdatePOMaster($PONO,$CreatedBy); - echo 'Successfully Created IGR Number:'. $IGRNO; - } + echo 'Successfully Created IGR Number:'. $IGRNO; + } + /** + *To get igr Datas form ajax + */ function ViewIGR() - { + { - $IGRNO= $this->input->post('id'); - //print_r($IGRNO); + $IGRNO= $this->input->post('id'); $data = $this->inwardgateregister_model->viewigr($IGRNO); - // print_r( $data); - - echo json_encode($data); + echo json_encode($data); - } + } + + /** + * To load pagenotfound view + */ function pageNotFound() { - $this->global['pageTitle'] = 'Resico : 404 - Page Not Found'; - + $this->global['pageTitle'] = 'Resico : 404 - Page Not Found'; $this->loadViews("404", $this->global, NULL, NULL); } } diff --git a/application/controllers/login.php b/application/controllers/login.php index 165f8c92..c88b8c9e 100644 --- a/application/controllers/login.php +++ b/application/controllers/login.php @@ -10,7 +10,7 @@ class Login extends CI_Controller { /** - * This is default constructor of the class + * Default constructor of the class */ public function __construct() { @@ -19,7 +19,7 @@ class Login extends CI_Controller } /** - * Index Page for this controller. + * Index Page for this controller(default function of the class) */ public function index() { @@ -27,7 +27,7 @@ class Login extends CI_Controller } /** - * This function used to check the user is logged in or not + * To check the user is logged in or not */ function isLoggedIn() { @@ -35,7 +35,6 @@ class Login extends CI_Controller if(!isset($isLoggedIn) || $isLoggedIn != TRUE) { - // echo 'inside controller'; $this->load->view('login'); } @@ -47,7 +46,7 @@ class Login extends CI_Controller /** - * This function used to logged in user + * To logged in user */ public function loginMe() { @@ -114,7 +113,7 @@ class Login extends CI_Controller } /** - * This function used to load forgot password view + * To load forgot password view */ function forgotPassword() { @@ -122,7 +121,7 @@ class Login extends CI_Controller } /** - * This function used to generate reset password request link + * To generate reset password request link */ function resetPasswordUser() { @@ -194,7 +193,9 @@ class Login extends CI_Controller } } - // This function used to reset the password + /** + * To reset the password + */ function resetPasswordConfirmUser() { @@ -220,7 +221,9 @@ class Login extends CI_Controller } } - // This function used to create new password + /** + * To create new password + */ function createPasswordUser() { $status = ''; diff --git a/application/controllers/monthlypay.php b/application/controllers/monthlypay.php index eb369018..fca9aadf 100755 --- a/application/controllers/monthlypay.php +++ b/application/controllers/monthlypay.php @@ -3,8 +3,8 @@ require APPPATH . '/libraries/BaseController.php'; /** - * Class : Cost Center (Cost Center Controller) - * User Class to control all user related operations. + * Class : monthlypay (monthlypay Controller) + * monthlypay Class to control all monthlypay related operations. * @author : Venba Info Tech - Saravana kumar * @version : 1.1 * @since : 18 November 2017 @@ -12,7 +12,7 @@ require APPPATH . '/libraries/BaseController.php'; class monthlypay extends BaseController { /** - * This is default constructor of the class + * default constructor of the class */ public function __construct() { @@ -20,12 +20,11 @@ class monthlypay extends BaseController $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 + * Index Page for this controller (default function of the class) */ public function index() { @@ -34,16 +33,20 @@ class monthlypay extends BaseController $this->loadviews('monthlyListing',$this->global); } + /** + * To dispaly the holidays information has list + */ function loadPublicholidays() { - - $data['days'] = $this-> monthlypay_model->getPublicHoldays(); - $this->global['pageTitle'] = 'Resico : Public Holidays'; - + $this->global['pageTitle'] = 'Resico : Public Holidays'; $this->loadviews('publicholidays',$this->global,$data,NULL); - } + } + + /** + * To deleted holidays information + */ function deletePublicHoliday() { $d = $this->input->post('param1'); @@ -53,7 +56,10 @@ class monthlypay extends BaseController echo "Deleted Successfully..!"; }else{echo "Something Wrong, Try Later...!";} } - + + /** + * To add and update public holidays information + */ function savePublicHolidays() { $jsondata = $this->input->post('param1'); @@ -87,11 +93,13 @@ class monthlypay extends BaseController echo $total . "-Holiday(s) Saved Successfully..!"; } - + /** + * For Employee's monthly attendance information as list + */ function attendanceLoad() { - $month['month'] = ''; + $month['month'] = ''; $monthdays = 0; $begin = 0; $end =0; @@ -99,26 +107,26 @@ class monthlypay extends BaseController if($this->input->post('month')) { - $current = $this->input->post('month'); - $month = substr($current,0,3); - $year = substr($current,4); - $month=date_parse($month); - $current = $year."-".$month['month'].'-01'; - $monthdays =cal_days_in_month(CAL_GREGORIAN,$month['month'],$year); - $begin = new DateTime($year.'-'.$month['month'].'-01'); - $end = new DateTime($year.'-'.$month['month'].'-'.$monthdays); + $current = $this->input->post('month'); + $month = substr($current,0,3); + $year = substr($current,4); + $month=date_parse($month); + $current = $year."-".$month['month'].'-01'; + $monthdays =cal_days_in_month(CAL_GREGORIAN,$month['month'],$year); + $begin = new DateTime($year.'-'.$month['month'].'-01'); + $end = new DateTime($year.'-'.$month['month'].'-'.$monthdays); } if(empty($current)) { - // echo "fresh"; - $current = date("Y-m"); - $year = date("Y"); - $month = date("m"); - $current = $current."-01"; - $monthdays =cal_days_in_month(CAL_GREGORIAN,$month,$year); - $begin = new DateTime($year.'-'.$month.'-01'); - $end = new DateTime($year.'-'.$month.'-'.$monthdays); + + $current = date("Y-m"); + $year = date("Y"); + $month = date("m"); + $current = $current."-01"; + $monthdays =cal_days_in_month(CAL_GREGORIAN,$month,$year); + $begin = new DateTime($year.'-'.$month.'-01'); + $end = new DateTime($year.'-'.$month.'-'.$monthdays); } @@ -131,22 +139,25 @@ class monthlypay extends BaseController } $begin->modify('+1 day'); } - $noofsundays = count($sundayarray); - - $publicholidaysarray = $this-> monthlypay_model->getPublicHoldays($current); - $string ="attendance"; - $data['noofsundays']=$noofsundays; - $data['noofpublicholidays']=count($publicholidaysarray); - $data['publicholidaysarray']=$publicholidaysarray; - $data['sundayarray']=$sundayarray; - $data['monthdays']=$monthdays; - $data['datefordropdown'] = $current; - $data['attendance'] = $this-> monthlypay_model->monthlyAttendance($current); - $data['emppay'] = $this-> monthlypay_model->getEmpPayDetails($current,$string); - $this->global['pageTitle'] = 'Resico : Monthly Attendance'; - $this->loadViews("attendance", $this->global, $data, NULL); + $noofsundays = count($sundayarray); + + $publicholidaysarray = $this-> monthlypay_model->getPublicHoldays($current); + $string ="attendance"; + $data['noofsundays']=$noofsundays; + $data['noofpublicholidays']=count($publicholidaysarray); + $data['publicholidaysarray']=$publicholidaysarray; + $data['sundayarray']=$sundayarray; + $data['monthdays']=$monthdays; + $data['datefordropdown'] = $current; + $data['attendance'] = $this-> monthlypay_model->monthlyAttendance($current); + $data['emppay'] = $this-> monthlypay_model->getEmpPayDetails($current,$string); + $this->global['pageTitle'] = 'Resico : Monthly Attendance'; + $this->loadViews("attendance", $this->global, $data, NULL); } + /** + * To save Employee's monthly attendance information + */ function saveAttendance() { @@ -157,10 +168,6 @@ class monthlypay extends BaseController $NoofDays = $this->input->post('param3'); $Month_Year = date('Y-m-d',strtotime($date)); $CreateBy = $this->session->userdata ( 'userId' ); - // echo 'from COn' . $date; - // print_r($phpdata);die();[Paid Leave - // echo count($phpdata); - //echo $NoofDays.'sdjksjh'; $EmpID ='temp'; foreach($phpdata as $data) { @@ -188,9 +195,8 @@ class monthlypay extends BaseController $res = $this->monthlypay_model->saveAttendance($monthattendance,$Month_Year,$EmpID); -// echo $res; $total = $total + $res; - // die(); + } echo $total . "-Employee(s) Attendance saved Successfully..!"; @@ -198,7 +204,11 @@ class monthlypay extends BaseController - } + } + + /** + * To Employee's monthly wise payment list. + */ function monthlyListing() { @@ -212,28 +222,20 @@ class monthlypay extends BaseController $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 + * To load the add new monthlypay */ function addmonthly() - { - - - - //$data['emp_id'] = $this->monthlypay_model->getmonthlypay(); - + { $this->global['pageTitle'] = 'Resico : Add Monthly Pay'; - $this->loadviews('addMontly',$this->global, NULL); } + /** + * For store new data into DB. + */ function addNewmonthly() { @@ -285,21 +287,13 @@ class monthlypay extends BaseController } /** - * This function is used for editing purpose and it has oldest values. + * For editing purpose and it has oldest values. */ function editOldmonthly($EmpID='',$month_year='') { - /*if($employeeid == null) - { - - redirect('monthlypay/monthlyListing'); - }*/ - - $data['monthly'] = $this->monthlypay_model->getUserInfo($EmpID,$month_year); - //$data['monthly_pay_inputs'] = $this->monthlylisting_model->getUserInfo($employeeid); $this->global['pageTitle'] = 'Resico : Edit Monthly Listing'; @@ -310,7 +304,7 @@ class monthlypay extends BaseController /** - * This function is used for stored new values after editing. + * For stored new values after editing. */ function editmonthly() { @@ -381,7 +375,9 @@ class monthlypay extends BaseController - + /** + * To load pagenotfound view + */ function pageNotFound() { $this->global['pageTitle'] = 'Resico : 404 - Page Not Found'; diff --git a/application/controllers/pages.php b/application/controllers/pages.php index 6fe087b1..1d01e7b1 100644 --- a/application/controllers/pages.php +++ b/application/controllers/pages.php @@ -24,7 +24,9 @@ class pages extends BaseController { - + /** + * Index Page for this controller(default function of the class) + */ public function index() { $this->_controller_output((object)array('output' => '' , 'js_files' => array() , 'css_files' => array())); diff --git a/application/controllers/payslip.php b/application/controllers/payslip.php index 7399028f..fb93c0a1 100755 --- a/application/controllers/payslip.php +++ b/application/controllers/payslip.php @@ -6,7 +6,7 @@ require APPPATH . '/third_party/mpdf/mpdf.php'; /** * Class : payslip (Pay Slip - Controller) - * User Class to control all user related operations. + * payslip Class to control all payslip related operations. * @author : Venba Info Tech * @version : 1.1 * @since : 18 November 2017 @@ -14,48 +14,56 @@ require APPPATH . '/third_party/mpdf/mpdf.php'; class payslip extends BaseController { /** - * This is default constructor of the class + * Default constructor of the class */ public function __construct() { parent::__construct(); $this->load->model('payroll_model'); $this->load->model('monthlypay_model'); - $this->load->library('form_validation'); + $this->load->library('form_validation'); $this->isLoggedIn(); } -function phpAlert($msg) { - echo ''; -} + /** + * To display the alert message + */ + function phpAlert($msg) { + echo ''; + } /** - * This function used to call stored procedure named with final_payroll_data() + * 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); - // $result = $this->db->last_query(); return $result; - //$this->db->call_function('model_sp'); + } -} - - function loadBankreportScreen() - { + /** + * To load bank report screen for payslip + */ + function loadBankreportScreen() + { $Data['Payon'] = $this->payroll_model->getPayOn(); $Data['Bank'] = $this->payroll_model->getBankInfo(); $this->global['pageTitle'] = 'Resico : Bank Report Screen'; $this->loadViews("bankreport", $this->global,$Data,NULL); - } - - function getBankReport() - { + } + + + /** + * To get report for payslip + * its generated a payslip's ESI,PF,Bank reports + */ + function getBankReport() + { $bank = $this->input->post('bank'); $payon = $this->input->post('month'); $monthsoptions = array("01" => "Jan", "02" => "Feb","03" => "Mar","04" => "Apr","05" => "May","06" => "June","07"=> "July","08"=> "Aug","09" => "Sep","10"=> "Oct","11" => "Nov","12"=>"Dec"); @@ -64,24 +72,11 @@ function phpAlert($msg) { $month = $monthsoptions[$m]."-".$y; $excel = $this->input->post('excel'); $HTML = ''; - //echo $excel; - // if(empty($excel)) - // { - // echo "PDF"; - // } - // else - // { - // echo "EXCEL"; - // } - // die(); - - $filename = ''; if($this->input->post('Bank_Report')) { - $data['result'] = $this->payroll_model->getReportforBank($bank,$payon); - //print_r($data['result']);die(); + $data['result'] = $this->payroll_model->getReportforBank($bank,$payon); $totamtwords = ''; $totalamt=0.00; if(!empty($data['result'])){ @@ -91,57 +86,55 @@ function phpAlert($msg) { } } $totamtwords = $this->convertNumber($totalamt); - $data['bankdetails']=$this->payroll_model->getBankInfo($bank); + $data['bankdetails']=$this->payroll_model->getBankInfo($bank); - $data['Totalamount']=$totalamt; - $data['Totalamtwords']=$totamtwords; - $data['PayMonth']=$month; - $filename = 'Bank Report for'.$payon.'pdf' ; - $HTML = $this->load->view("bankreportprint",$data,true); + $data['Totalamount']=$totalamt; + $data['Totalamtwords']=$totamtwords; + $data['PayMonth']=$month; + $filename = 'Bank Report for'.$payon.'pdf' ; + $HTML = $this->load->view("bankreportprint",$data,true); } if($this->input->post('PF_Report')) { $data['PFESI'] = $this->payroll_model->getReportforPFESI($payon); $data['PayMonth']=$month; $data['companyinfo']=$this->payroll_model->getCompanyInformation(); - //print_r($data['companyinfo']);die(); $totamtwords = ''; - $totalamt=0.00; - $totemppf = 0.00; - $totemprpf = 0.00; - if(!empty($data['PFESI'])){ - foreach($data['PFESI'] as $pf) - { + $totalamt=0.00; + $totemppf = 0.00; + $totemprpf = 0.00; + if(!empty($data['PFESI'])){ + + foreach($data['PFESI'] as $pf) + { $totalamt += ($pf->PF + $pf->CompanyPF); $totemppf += ($pf->PF); $totemprpf += ($pf->CompanyPF); } - } - $data['Totalamount']=$totalamt; - $data['TotalEmployeeContribution']=$totemppf; - $data['TotalEmployerContribution']=$totemprpf; - $totamtwords = $this->convertNumber($totalamt); - $data['Totalamtwords']=$totamtwords; + } + $data['Totalamount']=$totalamt; + $data['TotalEmployeeContribution']=$totemppf; + $data['TotalEmployerContribution']=$totemprpf; + $totamtwords = $this->convertNumber($totalamt); + $data['Totalamtwords']=$totamtwords; + if(empty($excel)){ - $filename = 'PF Report for'.$payon.'pdf' ; - $HTML = $this->load->view("pfreportprint",$data,true); - // echo "PDF PART 1"; + + $filename = 'PF Report for'.$payon.'pdf' ; + $HTML = $this->load->view("pfreportprint",$data,true); + } else{ $this->load->library('excel'); - // $this->global['pageTitle'] = 'Resico : PF Excel Report'; - // $this->loadViews('pfexcel',$this->global,$data,NULL); - $this->excel->setActiveSheetIndex(0); + $this->excel->setActiveSheetIndex(0); $this->excel->getActiveSheet()->setTitle('Employee PF Report ' . $data['PayMonth']); - $this->excel->getActiveSheet()->setCellValue('A1', 'Employee PF Report ' . $data['PayMonth']); - + $this->excel->getActiveSheet()->setCellValue('A1', 'Employee PF Report ' . $data['PayMonth']); $this->excel->getActiveSheet()->setCellValue('A4', 'S.No.'); $this->excel->getActiveSheet()->setCellValue('B4', 'Employee Name'); $this->excel->getActiveSheet()->setCellValue('C4', 'PF Account No'); $this->excel->getActiveSheet()->setCellValue('D4', 'Employee Contribution'); - $this->excel->getActiveSheet()->setCellValue('E4', 'Employeer Contribution'); $this->excel->getActiveSheet()->setCellValue('F4', 'No Of Days Worked'); $this->excel->getActiveSheet()->setCellValue('G4', 'OT Hrs Worked'); @@ -158,17 +151,18 @@ function phpAlert($msg) { $this->excel->getActiveSheet()->getStyle(chr($col))->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle(chr($col))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); - } - // print_r($data['PFESI']);die(); - $i=6; - $j=1; - $total=0; - $overall=0; - $totemp = 0; - $overallemp = 0; - $totemr = 0; - $overallemr = 0; - foreach($data['PFESI'] as $row){ + } + + $i=6; + $j=1; + $total=0; + $overall=0; + $totemp = 0; + $overallemp = 0; + $totemr = 0; + $overallemr = 0; + + foreach($data['PFESI'] as $row){ $this->excel->getActiveSheet()->setCellValue('A' . (string)($i),$j); $this->excel->getActiveSheet()->setCellValue('B' . (string)($i),$row->FName . $row->Lname); @@ -182,8 +176,6 @@ function phpAlert($msg) { $this->excel->getActiveSheet()->setCellValue('C' . (string)($i+1),'Total'); $this->excel->getActiveSheet()->setCellValue('F' . (string)($i),number_format($row->NoofDaysWorked,2,'.','')); $this->excel->getActiveSheet()->getStyle('F'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); - - $this->excel->getActiveSheet()->setCellValue('G' . (string)($i),number_format($row->OTperHours,2,'.','')); $this->excel->getActiveSheet()->getStyle('G'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); @@ -195,8 +187,6 @@ function phpAlert($msg) { $overallemp = $overallemp + $totemp; $overallemr = $overallemr + $totemr; $this->excel->getActiveSheet()->setCellValue('H' . (string)($i),($total)); - //$this->excel->getActiveSheet()->setCellValue('D' . (string)($i),($totemp)); - //$this->excel->getActiveSheet()->setCellValue('E' . (string)($i),($totemr)); $this->excel->getActiveSheet()->getStyle('H'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $this->excel->getActiveSheet()->getStyle('H'.(string)($i))->getNumberFormat()->setFormatCode('0.00'); $this->excel->getActiveSheet()->setCellValue('H' . (string)($i+1),($overall)); @@ -204,69 +194,63 @@ function phpAlert($msg) { $this->excel->getActiveSheet()->setCellValue('E' . (string)($i+1),($overallemr)); $this->excel->getActiveSheet()->getStyle('H'.(string)($i+1))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $this->excel->getActiveSheet()->getStyle('H'.(string)($i+1))->getNumberFormat()->setFormatCode('0.00'); - //$this->excel->getActiveSheet()->setCellValue('A6','HI'); + $i++; $j++; - } - $this->excel->getActiveSheet()->getProtection()->setSheet(true); - $this->excel->getActiveSheet()->getProtection()->setSort(true); - $this->excel->getActiveSheet()->getProtection()->setInsertRows(true); - $this->excel->getActiveSheet()->getProtection()->setFormatCells(true); + } + $this->excel->getActiveSheet()->getProtection()->setSheet(true); + $this->excel->getActiveSheet()->getProtection()->setSort(true); + $this->excel->getActiveSheet()->getProtection()->setInsertRows(true); + $this->excel->getActiveSheet()->getProtection()->setFormatCells(true); - $filename='EmployeePFReport'.$payon.'xls'; + $filename='EmployeePFReport'.$payon.'xls'; + header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="'.$filename.'"'); header('Cache-Control: max-age=0'); $objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'Excel5'); $objWriter->save('php://output'); - } + } - - - - - - - } if($this->input->post('ESI_Report')) { $data['PFESI'] = $this->payroll_model->getReportforPFESI($payon); - //print_r($data['PFESI']);die(); $data['PayMonth']=$month; $data['companyinfo']=$this->payroll_model->getCompanyInformation(); $totamtwords = ''; - $totalamt=0.00; - $totemppf = 0.00; - $totemprpf = 0.00; - if(!empty($data['PFESI'])){ - foreach($data['PFESI'] as $pf) - { + $totalamt=0.00; + $totemppf = 0.00; + $totemprpf = 0.00; + + if(!empty($data['PFESI'])){ + foreach($data['PFESI'] as $pf) + { $totalamt += ($pf->EmployeeESI + $pf->CompanyESI); $totemppf += ($pf->EmployeeESI); $totemprpf += ($pf->CompanyESI); - } - } - $data['Totalamount']=$totalamt; - $totamtwords = $this->convertNumber($totalamt); - $data['TotalEmployeeContribution']=$totemppf; - $data['TotalEmployerContribution']=$totemprpf; - $data['Totalamtwords']=$totamtwords; + } + } + + $data['Totalamount']=$totalamt; + $totamtwords = $this->convertNumber($totalamt); + $data['TotalEmployeeContribution']=$totemppf; + $data['TotalEmployerContribution']=$totemprpf; + $data['Totalamtwords']=$totamtwords; if(empty($excel)){ - $filename = 'ESI Report for'.$payon.'pdf'; - $HTML = $this->load->view("esireportprint",$data,true); - // echo "PDF PART 1"; + + $filename = 'ESI Report for'.$payon.'pdf'; + $HTML = $this->load->view("esireportprint",$data,true); } - else{ + else { $this->load->library('excel'); - - $this->excel->setActiveSheetIndex(0); + $this->excel->setActiveSheetIndex(0); $this->excel->getActiveSheet()->setTitle('Employee ESI Report ' . $data['PayMonth']); $this->excel->getActiveSheet()->setCellValue('A1', 'Employee ESI Report ' . $data['PayMonth']); @@ -274,11 +258,9 @@ function phpAlert($msg) { $this->excel->getActiveSheet()->setCellValue('B4', 'Employee Name'); $this->excel->getActiveSheet()->setCellValue('C4', 'ESI Account No'); $this->excel->getActiveSheet()->setCellValue('D4', 'Employee Contribution'); - $this->excel->getActiveSheet()->setCellValue('E4', 'Employeer Contribution'); $this->excel->getActiveSheet()->setCellValue('F4', 'No Of Days Worked'); $this->excel->getActiveSheet()->setCellValue('G4', 'OT Hrs Worked'); - $this->excel->getActiveSheet()->setCellValue('H4', 'Total Amount'); $this->excel->getActiveSheet()->mergeCells('A1:F1'); $this->excel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); @@ -286,14 +268,14 @@ function phpAlert($msg) { $this->excel->getActiveSheet()->getStyle('A1')->getFont()->setSize(16); $this->excel->getActiveSheet()->getStyle('A1')->getFill()->getStartColor()->setARGB('#333'); - for($col = ord('A'); $col <= ord('H'); $col++){ + for($col = ord('A'); $col <= ord('H'); $col++){ $this->excel->getActiveSheet()->getColumnDimension(chr($col))->setAutoSize(true); $this->excel->getActiveSheet()->getStyle(chr($col))->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle(chr($col))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); - } - // print_r($data['PFESI']);die(); + } + $i=6; $j=1; $total=0; @@ -315,17 +297,17 @@ function phpAlert($msg) { $this->excel->getActiveSheet()->getStyle('E'.(string)($i))->getNumberFormat()->setFormatCode('0.00'); $this->excel->getActiveSheet()->setCellValue('C' . (string)($i+1),'Total'); $this->excel->getActiveSheet()->setCellValue('F' . (string)($i),number_format($row->NoofDaysWorked,2,'.','')); - $this->excel->getActiveSheet()->getStyle('F'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); - - + $this->excel->getActiveSheet()->getStyle('F'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $this->excel->getActiveSheet()->setCellValue('G' . (string)($i),number_format($row->OTperHours,2,'.','')); $this->excel->getActiveSheet()->getStyle('G'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); + $total = $row->EmployeeESI + $row->CompanyESI; $overall=$overall + $total; $totemp = $row->EmployeeESI; $totemr = $row->CompanyESI; $overallemp = $overallemp + $totemp; $overallemr = $overallemr + $totemr; + $this->excel->getActiveSheet()->setCellValue('H' . (string)($i),($total)); $this->excel->getActiveSheet()->getStyle('H'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $this->excel->getActiveSheet()->getStyle('H'.(string)($i))->getNumberFormat()->setFormatCode('0.00'); @@ -334,7 +316,7 @@ function phpAlert($msg) { $this->excel->getActiveSheet()->setCellValue('H' . (string)($i+1),($overall)); $this->excel->getActiveSheet()->getStyle('H'.(string)($i+1))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $this->excel->getActiveSheet()->getStyle('H'.(string)($i+1))->getNumberFormat()->setFormatCode('0.00'); - //$this->excel->getActiveSheet()->setCellValue('A6','HI'); + $i++; $j++; } @@ -354,46 +336,25 @@ function phpAlert($msg) { if(empty($excel)){ - // $php = $this->output->get_output(); - - // Load library - // $this->load->library('dompdf_gen'); + + $mpdf=new mPDF('utf-8','A4-P',9, 12,12, 10, 82, 38, 4, 6); + $mpdf->SetDisplayMode('fullpage'); + $mpdf->SetHTMLHeader($HtmlHeading); + $mpdf->setFooter($HTMLFooter . "Page {PAGENO} of {nb}"); + $mpdf->setFooter("Page {PAGENO} of {nb}"); + $mpdf->list_indent_first_level = 1; + $mpdf->setAutoTopMargin = 'stretch'; + $mpdf->setAutoBottomMargin = 'stretch'; + $mpdf->WriteHTML($HTML); + $mpdf->Output("".$filename.'.pdf','I',$php); + + } - // require_once(APPPATH .'third_party/dompdf/dompdf_config.inc.php'); - // $dompdf = new DOMPDF(); - // $dompdf->set_paper('A4', 'portrait'); - // $dompdf->load_html($php); - - // $dompdf->render(); - - // // add the header - // $canvas = $dompdf->get_canvas(); - // $font = Font_Metrics::get_font("helvetica", "bold"); - - // // the same call as in my previous example - // $canvas->page_text(72, 18,"", - // $font, 6, array(0,0,0)); - - // $dompdf->stream($filename); - //echo "PDF PART 2"; - - $mpdf=new mPDF('utf-8','A4-P',9, 12,12, 10, 82, 38, 4, 6); - $mpdf->SetDisplayMode('fullpage'); - $mpdf->SetHTMLHeader($HtmlHeading); - //$html = $this->load->view("bankreportprint",$data,true); - $mpdf->setFooter($HTMLFooter . "Page {PAGENO} of {nb}"); - $mpdf->setFooter("Page {PAGENO} of {nb}"); - $mpdf->list_indent_first_level = 1; - $mpdf->setAutoTopMargin = 'stretch'; - $mpdf->setAutoBottomMargin = 'stretch'; - $mpdf->WriteHTML($HTML); - $mpdf->Output("".$filename.'.pdf','I',$php); - - } - - } - + } + /** + * To load Loan report for the employee.( whole employee / selected employee) + */ function loadLoanReport() { @@ -404,17 +365,17 @@ function phpAlert($msg) { $fyr = $this->uri->segment(4); if(!empty($eid) and !empty($fyr) and !is_numeric($eid) and !($fyr =='Overall')) { - //echo "EMPLOYEE WITH FINYEAR"; - $currentyear = substr($fyr,0,4); - $nxtyear = substr($fyr,5,4); - $data['fyear'] = $currentyear.'-'.$nxtyear; - $data['loanrecords'] = $this->payroll_model->getLoanReportforEmp($eid,$currentyear,$nxtyear,'emp'); - $data['selsource'] = $eid; + + $currentyear = substr($fyr,0,4); + $nxtyear = substr($fyr,5,4); + $data['fyear'] = $currentyear.'-'.$nxtyear; + $data['loanrecords'] = $this->payroll_model->getLoanReportforEmp($eid,$currentyear,$nxtyear,'emp'); + $data['selsource'] = $eid; } else if(!empty($eid) and !empty($fyr) and $fyr=='Overall') { - // echo "EMPLOYEE WITH OVERALL"; + $data['fyear'] = "Overall"; $currentyear =''; $nxtyear = ''; @@ -423,9 +384,9 @@ function phpAlert($msg) { } else if(is_numeric($eid)) { - //echo "LOAN HISTORY"; + $currentyear =''; - $nxtyear = ''; + $nxtyear = ''; $data['selsource'] = $eid; $data['fyear'] = $currentyear.'-'.$nxtyear; $data['childdata'] = $this->payroll_model->getLoanReportforEmp($eid,$currentyear="",$nxtyear="",'history'); @@ -436,13 +397,13 @@ function phpAlert($msg) { if(empty($this->input->post('finyear'))) { - //echo "DEFAULT LOAD"; + $year = date("Y"); $month = date("m"); $currentyear = ''; $nxtyear = ''; $source = $this->input->post('source'); - $data['selsource'] = 'Company'; + $data['selsource'] = 'Company'; } @@ -451,51 +412,43 @@ function phpAlert($msg) { if(!empty($this->input->post('finyear'))) { - //echo "FIN YEAR WITH SOURCE"; - $source = $this->input->post('source'); - $data['selsource'] =$source; - $finyear = $this->input->post('finyear'); - $currentyear = substr($finyear,0,4); - $nxtyear = substr($finyear,5,4); - $data['fyear'] = $currentyear.'-'.$nxtyear; + $source = $this->input->post('source'); + $data['selsource'] =$source; + $finyear = $this->input->post('finyear'); + $currentyear = substr($finyear,0,4); + $nxtyear = substr($finyear,5,4); + $data['fyear'] = $currentyear.'-'.$nxtyear; } } - - - // echo $currentyear.'-'.$nxtyear; - // echo "Company"; - $data['loanrecords'] = $this->payroll_model->getLoanReport($source,$currentyear,$nxtyear); - // print_r($data['loanrecords']); - + $data['loanrecords'] = $this->payroll_model->getLoanReport($source,$currentyear,$nxtyear); } - $data['loanemployees'] = $this->payroll_model->getEmpDetailsforLoan(); - $this->global['pageTitle'] = 'Resico : Loan Reports'; - $this->loadViews("loanreports", $this->global,$data, NULL); + $data['loanemployees'] = $this->payroll_model->getEmpDetailsforLoan(); + $this->global['pageTitle'] = 'Resico : Loan Reports'; + $this->loadViews("loanreports", $this->global,$data, NULL); - } + } /** - * This function used to load the first screen of the user - */ + * To upload the payslip data. + */ public function viewUpload2() { - $this->global['pageTitle'] = 'Resico : Payroll Data Upload2'; - - + $this->global['pageTitle'] = 'Resico : Payroll Data Upload2'; $this->loadViews("payslipupload2", $this->global, NULL); } + /** + * To load Monthly Pay inputs screen based month-year. + */ public function monthlyInputs() { $current = date("m-Y"); $data['month'] = $this-> monthlypay_model->monthlyListing($current); - // $data['fresh'] = $this-> monthlypay_model->getEmpPayDetails($current); - $data['fresh'] = $this-> monthlypay_model->getEmpPayDetailsforMonthInputs($current); $this->global['pageTitle'] = 'Resico : Payroll Monthly Inputs'; $this->loadViews("monthlypayinputs", $this->global,$data,NULL); @@ -503,153 +456,134 @@ function phpAlert($msg) { } - function changeMonth() - { - - $current = $this->input->post('param1'); - // echo $current;die(); - $month = $this-> monthlypay_model->monthlyListing($current); - $fresh = $this-> monthlypay_model->getEmpPayDetailsforMonthInputs($current); - $data = json_encode(array_merge($month,$fresh)); - echo $data; - } - + /** + * To Change the Month in payslip dropdown + */ + function changeMonth() + { + + $current = $this->input->post('param1'); + $month = $this-> monthlypay_model->monthlyListing($current); + $fresh = $this-> monthlypay_model->getEmpPayDetailsforMonthInputs($current); + $data = json_encode(array_merge($month,$fresh)); + echo $data; + } + /** + * To Store the Month in payslip datas + */ function saveMonthlyData() { - $month = $this->input->post('param2'); - $jsondata =$this->input->post('param1'); - $json = json_decode($jsondata,true); - $mon=''; - $year=''; - - if(strlen($month) == 7) - { - //echo "SEVEN"; - $mon = substr($month,0,2); - $year = substr($month,3); - } - else - { - //echo "NOT SEVEN"; - $mon = substr($month,0,1); - $year = substr($month,2); - - if((int)$mon < 10) - { - - $mon = '0'.$mon; - - } - } - - - $month = $mon ."-". $year; - //echo $month;die(); - $total = 0; - $ErrorEmpId = ''; - $TotalErrorFlag = 0; - foreach($json as $j) - { - $ErrorFlag = 0; - - $EmpID = $j['Employee Id']; - $Name = $j['Employee Name']; - $DaysWorked = $j['Days Worked']; - $LOP_Days = $j['LOP Days']; - $Paid_leave = $j['Paid Leave']; - $OT_Hrs_Worked = $j['OT Hours Worked in Hrs']; - $Loan_Recovered = $j['Loan Recovered in ₹']; - $Incentives = $j['Incentives in ₹']; - $Other_Deductions = $j['Other Deductions in ₹']; - $Created_By = $this->session->userdata ( 'userId' ); - - if(!is_numeric($DaysWorked) || ($DaysWorked > 31) || (strlen((string)$DaysWorked)) > 5 ) - { - //echo $EmpID . "-LOP_Days Invalid Data!"; - $ErrorFlag++; - } - - if(!is_numeric($LOP_Days) || ($LOP_Days > 31) || (strlen((string)$LOP_Days)) > 5 ) - { - //echo $EmpID . "-LOP_Days Invalid Data!"; - $ErrorFlag++; - } - if(!is_numeric($Paid_leave) || ($Paid_leave > 31) || (strlen((string)$Paid_leave)) > 5) - { - //echo $EmpID . "-Paid Leave Invalid Data!"; - $ErrorFlag++; - } + $month = $this->input->post('param2'); + $jsondata =$this->input->post('param1'); + $json = json_decode($jsondata,true); + $mon=''; + $year=''; - - - $OT_Hrs_Worked_first = explode(".",$OT_Hrs_Worked); - if(!is_numeric($OT_Hrs_Worked) || (strlen((string)$OT_Hrs_Worked))>6 || (strlen((string)$OT_Hrs_Worked_first[0])) >= 4)// || (strlen((string)$OT_Hrs_Worked_first[1]))> 3 ) - { - //echo $EmpID . "-OT Hrs Invalid Data!"; - $ErrorFlag++; - } - - - if(is_numeric($Loan_Recovered)){ - - $Loan_Recovered_first = explode(".",$Loan_Recovered); - if((strlen((string)$Loan_Recovered))>8 || (strlen((string)$Loan_Recovered_first[0]))> 5) - { - //echo $EmpID . "-Loan Recoverd Invalid Data!"; - $ErrorFlag++; - } - } - else if(is_string($Loan_Recovered)) - { - - //echo "STRING"; - if(strcasecmp($Loan_Recovered,'NA')) + if(strlen($month) == 7) { - //echo "NOT NA"; - $ErrorFlag++; + $mon = substr($month,0,2); + $year = substr($month,3); + } + else + { + $mon = substr($month,0,1); + $year = substr($month,2); + + if((int)$mon < 10) + { + $mon = '0'.$mon; + + } } - } - - $Incentives_first = explode(".",$Incentives); - if(!is_numeric($Incentives) || (strlen((string)$Incentives))>8 || (strlen((string)$Incentives_first[0]))> 5) - { - //echo $EmpID . "-Loan Recoverd Invalid Data!"; - $ErrorFlag++; - } - - - $Other_Deductions_first = explode(".",$Other_Deductions); - if(!is_numeric($Other_Deductions) || (strlen((string)$Other_Deductions))>8 || (strlen((string)$Other_Deductions_first[0]))> 5) - { - //echo $EmpID . "-Loan Recoverd Invalid Data!"; - $ErrorFlag++; - } - - if($ErrorFlag != 0) - { - //echo $EmpID ."- has Invalid Data!"; - $ErrorEmpId = $ErrorEmpId ."|". $EmpID; - $TotalErrorFlag++; - } - else//if($ErrorFlag == 0) - { - //nothing - } + $month = $mon ."-". $year; + $total = 0; + $ErrorEmpId = ''; + $TotalErrorFlag = 0; + foreach($json as $j) + { + $ErrorFlag = 0; + + $EmpID = $j['Employee Id']; + $Name = $j['Employee Name']; + $DaysWorked = $j['Days Worked']; + $LOP_Days = $j['LOP Days']; + $Paid_leave = $j['Paid Leave']; + $OT_Hrs_Worked = $j['OT Hours Worked in Hrs']; + $Loan_Recovered = $j['Loan Recovered in ₹']; + $Incentives = $j['Incentives in ₹']; + $Other_Deductions = $j['Other Deductions in ₹']; + $Created_By = $this->session->userdata ( 'userId' ); + + if(!is_numeric($DaysWorked) || ($DaysWorked > 31) || (strlen((string)$DaysWorked)) > 5 ) + { + $ErrorFlag++; + } + + if(!is_numeric($LOP_Days) || ($LOP_Days > 31) || (strlen((string)$LOP_Days)) > 5 ) + { + $ErrorFlag++; + } + + if(!is_numeric($Paid_leave) || ($Paid_leave > 31) || (strlen((string)$Paid_leave)) > 5) + { + $ErrorFlag++; + } + + $OT_Hrs_Worked_first = explode(".",$OT_Hrs_Worked); + + if(!is_numeric($OT_Hrs_Worked) || (strlen((string)$OT_Hrs_Worked))>6 || (strlen((string)$OT_Hrs_Worked_first[0])) >= 4)// || (strlen((string)$OT_Hrs_Worked_first[1]))> 3 ) + { + $ErrorFlag++; + } + + if(is_numeric($Loan_Recovered)){ + $Loan_Recovered_first = explode(".",$Loan_Recovered); + if((strlen((string)$Loan_Recovered))>8 || (strlen((string)$Loan_Recovered_first[0]))> 5) + { + $ErrorFlag++; + } + } + else if(is_string($Loan_Recovered)) + { + if(strcasecmp($Loan_Recovered,'NA')) + { + $ErrorFlag++; + } + } + + $Incentives_first = explode(".",$Incentives); + + if(!is_numeric($Incentives) || (strlen((string)$Incentives))>8 || (strlen((string)$Incentives_first[0]))> 5) + { + $ErrorFlag++; + } + + $Other_Deductions_first = explode(".",$Other_Deductions); + + if(!is_numeric($Other_Deductions) || (strlen((string)$Other_Deductions))>8 || (strlen((string)$Other_Deductions_first[0]))> 5) + { + $ErrorFlag++; + } + + if($ErrorFlag != 0) + { + $ErrorEmpId = $ErrorEmpId ."|". $EmpID; + $TotalErrorFlag++; + } + else//if($ErrorFlag == 0) + { + //nothing + } + } - - - - - } - - if($TotalErrorFlag == 0) + if($TotalErrorFlag == 0) { foreach($json as $j) - { + { $EmpID = $j['Employee Id']; $Name = $j['Employee Name']; $DaysWorked = $j['Days Worked']; @@ -659,27 +593,28 @@ function phpAlert($msg) { $Loan_Recovered = $j['Loan Recovered in ₹']; if(is_string($Loan_Recovered)) { - $Loan_Recovered = strtoupper($Loan_Recovered); + $Loan_Recovered = strtoupper($Loan_Recovered); } $Incentives = $j['Incentives in ₹']; $Other_Deductions = $j['Other Deductions in ₹']; $Created_By = $this->session->userdata ( 'userId' ); - + $monthlypaydata = array('Month_Year'=>$month,'EmpID'=>$EmpID,'Days_worked'=>$DaysWorked,'LOP_Days'=>$LOP_Days,'Paid_leave'=>$Paid_leave,'OT_Hrs_Worked'=>$OT_Hrs_Worked,'Loan_Recovered'=>$Loan_Recovered,'Incentives'=>$Incentives,'Other_Deductions'=>$Other_Deductions,'Created_By'=>$Created_By); $result = $this->monthlypay_model->saveMonthlyData_model($monthlypaydata); $total = $total + $result; - } + } } - //echo ""; + if(!empty($ErrorEmpId)) { - echo $ErrorEmpId . "- are have Invalid Data!"; + echo $ErrorEmpId . "- are have Invalid Data!"; } - echo $total . "- Employees Updated Successfully "; - - } - + echo $total . "- Employees Updated Successfully "; + } + /** + * To load the payslip list + */ function payslipLisiting() { $this->global['pageTitle'] = 'Resico : Payslip Listing'; @@ -687,79 +622,87 @@ function phpAlert($msg) { $this->loadViews("paysliplist", $this->global, $data , NULL); } - function editPayslip($EmpID,$PayOn) + /** + * To view the Supplier information and load's the edit supplier screen + */ + function editPayslip($EmpID,$PayOn) { - - + $this->global['pageTitle'] = 'Resico : Edit Employee Payslip'; $data['PayInfo'] = $this->payroll_model->GetPayslipdata($PayOn,$EmpID); $this->loadViews("editPayslip", $this->global, $data , NULL); } + + /** + * To view the payroll generater + */ public function viewGenerator() { $Data['Payon'] = $this->payroll_model->getPayOn(); - - $this->global['pageTitle'] = 'Resico : Payroll Generater'; $this->loadViews("payslipgenerate", $this->global, $Data , NULL); - } - /* Validation for Employee Dropdown + } + + /** + * Validation for Employee Dropdown */ function Employee_validate($selectValue) -{ - //echo 'select_validate method called'; - // 'none' is the first option and the text says something like "-Choose one-" - if($selectValue == '-1') - { - $this->form_validation->set_message('Employee_validate', 'Please Select Employee.'); - return false; - } - else // user picked something - { - return true; - } -} - -function getEmployee() -{ - $id = $this->input->post('id1'); - - $result = $this->payroll_model->getEmployeelist2($id ); - - $HTML=""; - - if($result->num_rows() > 0){ - - foreach($result->result() as $list){ - + { + if($selectValue == '-1') + { + $this->form_validation->set_message('Employee_validate', 'Please Select Employee.'); + return false; + } + else // user picked something + { + return true; + } + } - $HTML.=""; - } - } - echo $HTML; -} + /** + * Get data for Employee Dropdown + */ + function getEmployee() + { + $id = $this->input->post('id1'); + + $result = $this->payroll_model->getEmployeelist2($id ); + + $HTML=""; -/* Validation for PayOn Dropdown + if($result->num_rows() > 0){ + + foreach($result->result() as $list){ + + + $HTML.=""; + + } + } + echo $HTML; + } + + /* + * Validation for PayOn Dropdown */ function PayOn_validate($selectValue) -{ - //echo 'select_validate method called'; - // 'none' is the first option and the text says something like "-Choose one-" - if($selectValue == '-1') - { - $this->form_validation->set_message('PayOn_validate', 'Please Select PayOn.'); - return false; - } - else // user picked something - { - return true; - } -} + { + if($selectValue == '-1') + { + $this->form_validation->set_message('PayOn_validate', 'Please Select PayOn.'); + return false; + } + else // user picked something + { + return true; + } + } + /** - * This function used to load the first screen of the user + * To Generate the payslip as pdf */ public function PrintPdf() { @@ -778,15 +721,12 @@ function getEmployee() } else { - $Payon = $this->input->post('PayOn'); - //echo "Payon" . $Payon; + $Payon = $this->input->post('PayOn'); if($All != '') { $result = $this->payroll_model->getEmpAll($Payon); - // print_r($result); - // die(); if($result > 0 ) { @@ -794,24 +734,15 @@ function getEmployee() { $EmpID = $result[$i]['EmpId']; - //print_r( - //$EmpID ); - // die(); $Data['PayDetails'] = $this->payroll_model->GetPayslipdata($Payon,$EmpID); - // - + $totalsalary =$Data['PayDetails'][0]->LessAdvance; $totalsalaryinwords = $this->convertNumber(round($totalsalary)); $Data['amtinwords']=$totalsalaryinwords; $Data['CompanyDetails '] = $this->payroll_model->Companydetails(); - // print_r ($Data); - // exit(); - //$Data['Count'] = $i; - $html.=$this->load->view("payslipgenerateprint", $Data,true ); - - // print_r ($Data); - // exit(); + $html.=$this->load->view("payslipgenerateprint", $Data,true ); + } } @@ -819,52 +750,19 @@ function getEmployee() else { $EmpID = $this->input->post('Employee'); - //echo "EmpID" . $EmpID; + $Data['PayDetails'] = $this->payroll_model->GetPayslipdata($Payon,$EmpID); $totalsalary =$Data['PayDetails'][0]->LessAdvance; $totalsalaryinwords = $this->convertNumber(round($totalsalary)); $Data['amtinwords']=$totalsalaryinwords; $Data['CompanyDetails'] = $this->payroll_model->Companydetails(); - //print_r ($Data); - //exit(); + $html=$this->load->view("payslipgenerateprint", $Data,true ); } - // $php = $this->output->get_output(); - - // // Load library - // $this->load->library('dompdf_gen'); - - // if($All != '') - // { - // $filename = 'Payslip-'.$Payon.'.pdf' ; - // } - // else - // { - // $filename = 'Payslip-'.$EmpID . '-' .$Payon.'.pdf' ; - // } - - // require_once(APPPATH .'third_party/dompdf/dompdf_config.inc.php'); - // $dompdf = new DOMPDF(); - // $dompdf->set_paper('A4', 'portrait'); - // $dompdf->load_html($php); - - // $dompdf->render(); - - // // add the header - // $canvas = $dompdf->get_canvas(); - // $font = Font_Metrics::get_font("helvetica", "bold"); - - // // the same call as in my previous example - // $canvas->page_text(72, 18, "Page: {PAGE_NUM} of {PAGE_COUNT}", - // $font, 6, array(0,0,0)); - - // $dompdf->stream($filename); - // } - $mpdf=new mPDF('utf-8','A4-P',10, 10,10, 10, 10, 24, 4, 6); $mpdf->SetDisplayMode('fullpage'); $mpdf->SetHTMLHeader($HtmlHeading); @@ -878,7 +776,9 @@ function getEmployee() } } - + /** + * To update payslip + */ function updatePayslip() { @@ -908,13 +808,9 @@ function getEmployee() } - /** - * This function used to upload the Excel file Details - */ - /** - * This function used to upload the Excel file Details2 + * To upload the Excel file Details2 */ function uploadExcel2(){ @@ -980,14 +876,10 @@ function getEmployee() $Totaldays = 28; } - - // $Totaldays = 0; - //echo $highestRow; $FileDetails = array('PayOn'=>$PayOn,'TotalNoofDays'=>$Totaldays,'FileName'=> $config['file_name'],'CreatedBy'=>$createdby); $result = $this->payroll_model->UploadFileName($FileDetails); $emplid=$this->payroll_model->getEmpID($q=''); $payEmpID=$this->payroll_model->getEmpIDfromPayData(); - //print_r($payEmpID);die(); $nopaydata=0; $nopayid=''; @@ -1079,11 +971,7 @@ function getEmployee() $success++; } - //} - - - - + } @@ -1125,6 +1013,9 @@ function getEmployee() } + /** + * Validation For Payslip - which is already exists are not + */ function checkExistPay() { $empid = $this->input->post('employee'); @@ -1134,6 +1025,9 @@ function getEmployee() } + /** + * To load pagenotfound view + */ function pageNotFound() { $this->global['pageTitle'] = 'Resico : 404 - Page Not Found'; @@ -1141,73 +1035,69 @@ function getEmployee() $this->loadViews("404", $this->global, NULL, NULL); } + /** + * To convert the numbers into words + */ function convertNumber($amt){ - $ShowPaise='0'; - $totalAmt=explode(".",$amt); + + $ShowPaise='0'; + $totalAmt=explode(".",$amt); - $number = $totalAmt[0]; - $no = $number; + $number = $totalAmt[0]; + $no = $number; - if(!empty($totalAmt[1]) && $totalAmt[1]!=0){ - $point = $totalAmt[1]; - $ShowPaise='1'; - } - else{ - $point=0; - $ShowPaise='0'; - } + if(!empty($totalAmt[1]) && $totalAmt[1]!=0){ + $point = $totalAmt[1]; + $ShowPaise='1'; + } + else{ + $point=0; + $ShowPaise='0'; + } + $hundred = null; + $digits_1 = strlen($no); + $i = 0; + $str = array(); + $words = array('0' => '', '1' => 'One', '2' => 'Two', + '3' => 'Three', '4' => 'Four', '5' => 'Five', '6' => 'Six', + '7' => 'Seven', '8' => 'Eight', '9' => 'Nine', + '10' => 'Ten', '11' => 'Eleven', '12' => 'Twelve', + '13' => 'Thirteen', '14' => 'Fourteen', + '15' => 'Fifteen', '16' => 'Sixteen', '17' => 'Seventeen', + '18' => 'Eighteen', '19' =>'Nineteen', '20' => 'Twenty', + '30' => 'Thirty', '40' => 'Fourty', '50' => 'Fifty', + '60' => 'Sixty', '70' => 'Seventy', + '80' => 'Eighty', '90' => 'Ninety'); + $digits = array('', 'Hundred', 'Thousand', 'Lakh', 'Crore'); + while ($i < $digits_1) { + + $divider = ($i == 2) ? 10 : 100; + $number = floor($no % $divider); + $no = floor($no / $divider); + $i += ($divider == 10) ? 1 : 2; + + if ($number) { + $plural = (($counter = count($str)) && $number > 1) ? 's' : null; + $hundred = ($counter == 1 && $str[0]) ? ' and ' : null; + $str [] = ($number < 21) ? $words[$number] . " " . $digits[$counter] . $plural . " " . $hundred : $words[floor($number / 10) * 10]. " " . $words[$number % 10] . " ". $digits[$counter] . $plural . " " . $hundred; + } + else $str[] = null; + } + $str = array_reverse($str); + $result = implode('', $str); + $points = ($point) ? " " . $words[$point / 10] . " " . $words[$point = $point % 10] : ''; - $hundred = null; - $digits_1 = strlen($no); + if($ShowPaise=='0'){ - $i = 0; - $str = array(); - $words = array('0' => '', '1' => 'One', '2' => 'Two', - '3' => 'Three', '4' => 'Four', '5' => 'Five', '6' => 'Six', - '7' => 'Seven', '8' => 'Eight', '9' => 'Nine', - '10' => 'Ten', '11' => 'Eleven', '12' => 'Twelve', - '13' => 'Thirteen', '14' => 'Fourteen', - '15' => 'Fifteen', '16' => 'Sixteen', '17' => 'Seventeen', - '18' => 'Eighteen', '19' =>'Nineteen', '20' => 'Twenty', - '30' => 'Thirty', '40' => 'Forty', '50' => 'Fifty', - '60' => 'Sixty', '70' => 'Seventy', - '80' => 'Eighty', '90' => 'Ninety'); - $digits = array('', 'Hundred', 'Thousand', 'Lakh', 'Crore'); - while ($i < $digits_1) { - $divider = ($i == 2) ? 10 : 100; - $number = floor($no % $divider); - $no = floor($no / $divider); - $i += ($divider == 10) ? 1 : 2; - if ($number) { - $plural = (($counter = count($str)) && $number > 1) ? 's' : null; - $hundred = ($counter == 1 && $str[0]) ? ' and ' : null; - $str [] = ($number < 21) ? $words[$number] . - " " . $digits[$counter] . $plural . " " . $hundred - : - $words[floor($number / 10) * 10] - . " " . $words[$number % 10] . " " - . $digits[$counter] . $plural . " " . $hundred; - } else $str[] = null; - } - $str = array_reverse($str); - $result = implode('', $str); + $amountInWords = "Rupees " . $result." Only"; + } + else{ - $points = ($point) ? - " " . $words[$point / 10] . " " . - $words[$point = $point % 10] : ''; - -if($ShowPaise=='0'){ - -$amountInWords = "Rupees " . $result." Only"; -} -else{ - -$amountInWords = "Rupees " . $result ." Paise ". $points." Only"; -} + $amountInWords = "Rupees " . $result ." Paise ". $points." Only"; + } - - return $amountInWords; + return $amountInWords; } } diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index 421b2927..0050dd5d 100644 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -6,37 +6,37 @@ require APPPATH . '/third_party/mpdf/mpdf.php'; /** * Class : purchaseorder (Purchase order - Controller) - * User Class to control all user related operations. + * purchaseorder Class to control all po related operations. * @author : Venba InfoTech * @version : 1.1 * @since : 18 November 2017 */ + class purchaseorder extends BaseController { /** - * This is default constructor of the class + * default constructor of the class */ public function __construct() { parent::__construct(); $this->load->model('purchaseorder_model'); - - $this->load->library('session'); - $this->load->library('form_validation'); - $this->load->model('requistion_model'); + $this->load->library('session'); + $this->load->library('form_validation'); + $this->load->model('requistion_model'); $this->isLoggedIn(); } /** - * This function used to load the first screen of the user + * Index Page for this controller (default function of the class) */ public function index() { - $this->global['pageTitle'] = 'Resico : AddPO'; - + $this->global['pageTitle'] = 'Resico : AddPO'; $this->loadViews("addPO", $this->global, NULL , NULL); } - function viewfullpurchaseorder() + + function viewfullpurchaseorder() { $this->global['pageTitle'] = 'Resico : View Purchase Order'; @@ -48,8 +48,7 @@ class purchaseorder extends BaseController $this->global['pageTitle'] = 'Resico : Advance Request'; $data['PONO']=$this->purchaseorder_model->getadvancePONO('ST026'); - //print_r($data['PONO']); - + $this->loadViews("advancerequest", $this->global, $data, NULL); } function requisition() @@ -57,15 +56,13 @@ class purchaseorder extends BaseController $data['DeptList'] = $this->purchaseorder_model->getDepartmentListForAllReq(); $data['stList'] = $this->purchaseorder_model->getStatusListforAllReq(); - /* Cost code from Requisition - Client Review Fix - Start here */ - // $data['ReqList'] = $this->purchaseorder_model->getRequistionListbySearch(); - - $data['ReqList'] = $this->purchaseorder_model->getAllRequistionListToCreatePO(); - /* End Here */ - $this->global['pageTitle'] = 'Resico : Create PO from Requisition List'; - - $this->loadViews("createPOfromRequistion", $this->global, $data,Null); + /* Cost code from Requisition - Client Review Fix + Start here */ + $data['ReqList'] = $this->purchaseorder_model->getAllRequistionListToCreatePO(); + /* End Here */ + + $this->global['pageTitle'] = 'Resico : Create PO from Requisition List'; + $this->loadViews("createPOfromRequistion", $this->global, $data,Null); } @@ -75,27 +72,20 @@ class purchaseorder extends BaseController function PurchaseOrderList() { - $this->load->library('pagination'); - - // $count = $this->purchaseorder_model->purchaseorderListingCount(''); - - //$returns = $this->paginationCompress ( "purchaseorderListing/", $count, 10 ); - + $this->load->library('pagination'); $this->purchaseorder_model->UpdateRequistionStatus(); $data['POData'] = $this->purchaseorder_model->purchaseorderListing(); - - $this->global['pageTitle'] = 'Resico : Purchase Orders'; - - $this->loadViews("POlist", $this->global, $data, NULL); + + $this->global['pageTitle'] = 'Resico : Purchase Orders'; + $this->loadViews("POlist", $this->global, $data, NULL); } - function Req_validate($selectValue) -{ - //echo 'select_validate method called'; - // 'none' is the first option and the text says something like "-Choose one-" - if(strlen($selectValue) == 0) + + function Req_validate($selectValue) { + if(strlen($selectValue) == 0) + { $this->form_validation->set_message('Req_validate', 'Please Select Requisition Number to Create PO.'); return false; } @@ -105,7 +95,7 @@ class purchaseorder extends BaseController } } - /** + /** * This function used to show the Purchase Order Screen */ function CreatePurchaseOrder() @@ -172,14 +162,14 @@ class purchaseorder extends BaseController { $FYStart =$Fy->StartYear; $FYEnd =$Fy->EndYear; - //$FYEnd=$FYStart+1; + } } $FYdt = $FYStart." - ".$FYEnd ; - //echo $FYEnd; + foreach ($ReqDetails as $Rs): $CostCode = $Rs->CostCenterCode; @@ -220,12 +210,6 @@ class purchaseorder extends BaseController $data['PoTypeOptions'] = $this->purchaseorder_model->getConfigValue('C026'); - //print_r($data['PoTypeOptions']); - - - // $data[$Rate->ExchangeRate]=$Rate->ExchangeRate; - //$data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail($Currency); - $ViewName = ''; if($ReqType == REVENUE) { diff --git a/application/controllers/quality.php b/application/controllers/quality.php index fe9dbf2b..4dc33a88 100644 --- a/application/controllers/quality.php +++ b/application/controllers/quality.php @@ -4,7 +4,7 @@ require APPPATH . '/libraries/BaseController.php'; /** * Class : quality (Quality Controller) - * User Class to control all user related operations. + * quality Class to control all quality related operations. * @author : VenbaInfoTech - * @version : 1.1 * @since : 09 December 2017 @@ -12,18 +12,18 @@ require APPPATH . '/libraries/BaseController.php'; class quality extends BaseController { /** - * This is default constructor of the class + * default constructor of the class */ public function __construct() { parent::__construct(); $this->load->model('quality_model'); $this->load->library('form_validation'); - //$this->load->library('dompdf_gen'); $this->isLoggedIn(); - } + } + /** - * This function used to load the first screen of the user + * Index Page for this controller(default function of the class) */ public function index() { @@ -31,29 +31,33 @@ class quality extends BaseController $data['customers'] = $this->quality_model->getAllcustomers(); $data['existspec'] = $this->quality_model->getAllspec(); $this->global['pageTitle'] = 'Resico : Quality Master'; - $this->loadViews("qualitymasterlistview", $this->global, $data , NULL); } - + /** + * To load the report list + */ public function reportList() { $data['records'] = $this->quality_model->getTestMasterforList(); - $this->global['pageTitle'] = 'Resico : Quality Master'; $this->loadViews("reportmasterlist", $this->global, $data , NULL); } + /** + * To add new Specifications + */ function addNewPage() { $data['products'] = $this->quality_model->getAllprodcuts(); - $data['customers'] = $this->quality_model->getAllcustomers(); - + $data['customers'] = $this->quality_model->getAllcustomers(); $this->global['pageTitle'] = 'Resico : Quality Master'; - $this->loadViews("qualitymaster", $this->global, $data , NULL); } + /** + * To save specification information based on customerid and productid + */ function saveSpectficationData() { $product = $this->input->post('param2'); @@ -62,9 +66,7 @@ class quality extends BaseController $createdby = $this->session->userdata ( 'userId' ); $phpdata = json_decode($jsondata); $total = 0; - // echo $product .'-'. $customer; - // print_r($phpdata);die(); - + foreach($phpdata as $data) { $name = $data->Name; @@ -74,20 +76,20 @@ class quality extends BaseController $max = $data->Max; $temp = $data->Temp; $isExist = $this->quality_model->checkExist($product,$customer,$name); - //echo $isExist[0]->count;die(); + if($isExist[0]->count == 0) { $tostore = array('customer_id'=>$customer,'product_id'=>$product,'testtype'=>$name,'uom'=>$uom,'min'=>$min,'max'=>$max,'temp'=>$temp,'created_by'=>$createdby); $res = $this->quality_model->addSpecMast($tostore); - //echo 'i'.$res; + } else if($isExist[0]->count == 1) { $tostore = array('uom'=>$uom,'min'=>$min,'max'=>$max,'temp'=>$temp,'updated_by'=>$createdby); $res = $this->quality_model->updateSpecMast($tostore,$product,$customer,$name); - //echo 'u'.$res; + } $total +=$res; @@ -95,7 +97,10 @@ class quality extends BaseController echo $total.'- Specification Saved Successfully'; } - + + /** + * To delete specification based on Specification name, customerid and productid + */ function deleteSpecification() { $spname = $this->input->post('param1'); @@ -113,6 +118,9 @@ class quality extends BaseController } + /** + * To view inspection reports + */ function report() { @@ -122,60 +130,70 @@ class quality extends BaseController $this->loadViews("qualityreport", $this->global, $data, NULL); } + /** + * To view the report list + */ function viewSpec() { $prodcutid = $this->uri->segment(3); $customerid =$this->uri->segment(4); $data['specifications'] = $this->quality_model->getIndividualSpec($prodcutid,$customerid); $this->global['pageTitle'] = 'Resico : View reports Lists'; - $this->loadViews("viewIndSpec", $this->global, $data, NULL); } + /** + * To view the indiviual report + */ function viewIndReport() { $reportid = $this->uri->segment(3); - $data['reportdata'] = $this->quality_model->getIndividualReportData($reportid); $this->global['pageTitle'] = 'Resico : View Individual Report'; $this->loadViews("viewindreport", $this->global, $data, NULL); } + + /** + * To Generate the Reports as pdf + */ function printReportPDF() { $reportid = $this->input->post('rid'); - - $data['reportdata'] = $this->quality_model->getIndividualReportData($reportid); - + $data['reportdata'] = $this->quality_model->getIndividualReportData($reportid); $filename = 'PRE DESPATCH INSPECTION REPORT'.$reportid; - $html = $this->load->View("viewindreportpdf",$data,true); - require APPPATH . '/third_party/mpdf/mpdf.php'; - $mpdf=new mPDF('utf-8','A4-P',7,10,10, 10, 10, 24, 4, 6); - $mpdf->SetDisplayMode('fullpage'); + require APPPATH . '/third_party/mpdf/mpdf.php'; + $mpdf=new mPDF('utf-8','A4-P',7,10,10, 10, 10, 24, 4, 6); + $mpdf->SetDisplayMode('fullpage'); - $mpdf->list_indent_first_level = 1; - $mpdf->setAutoTopMargin = 'stretch'; - $mpdf->setAutoBottomMargin = 'stretch'; - $mpdf->WriteHTML($html); - $mpdf->Output($filename.'.pdf','I'); + $mpdf->list_indent_first_level = 1; + $mpdf->setAutoTopMargin = 'stretch'; + $mpdf->setAutoBottomMargin = 'stretch'; + $mpdf->WriteHTML($html); + $mpdf->Output($filename.'.pdf','I'); } + /** + * To get all data based on product id and customer id + */ function getAllSpecforReport() { $productid = $this->input->post('param1'); $customerid = $this->input->post('param2'); - //echo 'from cn'.$productid.'-'.$customerid; $res = $this->quality_model->getSpecifications($productid,$customerid); echo json_encode($res); } + /** + * To save report data + */ function saveTestReportData() { @@ -187,14 +205,10 @@ class quality extends BaseController $batchno = $this->input->post('param5'); $chart = $this->input->post('param7'); $batchno = date_format(date_create($batchno),'Y-m-d'); - $approver = $this->input->post('param6'); - $testphpdata = json_decode($testjson,true); $loiphpdata = json_decode($loijson,true); - $afsphpdata = json_decode($afsjson,true); - //print_r($afsphpdata);die(); $createdon = date('Y-m-d H:i:s'); $createby = $this->session->userdata ( 'userId' ); @@ -215,7 +229,7 @@ class quality extends BaseController $remarks1 = ''; foreach($testphpdata as $data) { - //print_r($data);die(); + $descrition = $data['Description']; $min = $data['SpecificationMin']; $max = $data['SpecificationMax']; @@ -249,8 +263,6 @@ class quality extends BaseController $w3 = $loi['After Heatingw3(g)']; $loip = $loi['L.O.I %']; $remark = $loi['Remarks']; - //echo $loip; - //echo $remark;die(); $loitabledata = array('testreport_id'=>$MASTERID,'start_time'=>$start,'end_time'=>$end,'temp'=>$temp,'w1'=>$w1,'w2'=>$w2,'w3'=>$w3,'loi_percentage'=>$loip,'remarks'=>$remark); $loiid = $this->quality_model->saveTestReportLOIData($loitabledata); @@ -276,6 +288,9 @@ class quality extends BaseController } + /** + * To load pagenotfound view + */ function pageNotFound() { $this->global['pageTitle'] = 'Resico : 404 - Page Not Found'; diff --git a/application/controllers/rawmaterialdetails.php b/application/controllers/rawmaterialdetails.php index c28fc220..f3901a6f 100644 --- a/application/controllers/rawmaterialdetails.php +++ b/application/controllers/rawmaterialdetails.php @@ -4,28 +4,29 @@ require APPPATH . '/libraries/BaseController.php'; /** * Class : rawmaterialdetails (Raw Material Detail - Controller) - * User Class to control all user related operations. + * rawmaterialdetails Class to control all Raw Material Details related operations. * @author : Venba Info Tech - Gandhimathi * @version : 1.1 * @since : 18 November 2017 */ + class rawmaterialdetails extends BaseController { /** - * This is default constructor of the class + * default constructor of the class */ public function __construct() { - parent::__construct(); - $this->load->model('rawmaterialdetails_model'); - $this->load->library('pagination'); + parent::__construct(); + $this->load->model('rawmaterialdetails_model'); + $this->load->library('pagination'); $this->load->library('form_validation'); $this->load->library('Excel'); - - $this->isLoggedIn(); + $this->isLoggedIn(); } + /** - * This function used to load the first screen of the user + * Index Page for this controller(default function of the class) */ public function index() { @@ -35,7 +36,7 @@ class rawmaterialdetails extends BaseController } /** - * This function is used to load the RawMaterialDetails list + * To load the RawMaterialDetails list */ function rawmaterialListing() { @@ -49,8 +50,10 @@ class rawmaterialdetails extends BaseController $this->loadViews("rawmaterialListing", $this->global, $data, NULL); } + /** - * This function is used to load the add new cost */ + * To load the add new material details + */ function addRawMaterial() { @@ -66,11 +69,12 @@ class rawmaterialdetails extends BaseController } - /* Validation for Material Type Dropdown */ + + /** + * Validation for Material Type Dropdown + */ function MaterialType_validate($selectValue) { - //echo 'select_validate method called'; - //'none' is the first option and the text says something like "-Choose one-" if($selectValue == '-1') { $this->form_validation->set_message('MaterialType_validate', 'Please Select Material Type.'); @@ -82,11 +86,11 @@ class rawmaterialdetails extends BaseController } } - /* Validation for Material Type Dropdown */ + /** + * Validation for Material Type Dropdown + */ function UOM_validate($selectValue) { - //echo 'select_validate method called'; - // 'none' is the first option and the text says something like "-Choose one-" if($selectValue == '-1') { $this->form_validation->set_message('UOM_validate', 'Please Select UOM.'); @@ -94,14 +98,15 @@ class rawmaterialdetails extends BaseController } else // user picked something { - return true; + return true; } } - /* Validation for Material Category Dropdown */ - function materialcategory_validate($selectValue) - { - + /** + * Validation for Material Category Dropdown + */ + function materialcategory_validate($selectValue) + { if($selectValue == '0') { $this->form_validation->set_message('materialcategory_validate', 'Please Select Material Category.'); @@ -113,7 +118,9 @@ class rawmaterialdetails extends BaseController } } - + /** + * To Store the add new material details into DB + */ function addNewRawMaterial() { @@ -185,27 +192,24 @@ class rawmaterialdetails extends BaseController } $RawMaterial = array('MaterialName'=>$MaterialName, 'MaterialType'=>$MaterialType, 'UOM'=>$UOM,'Category'=>$MaterialCategory, 'CreatedBy'=>$CreatedBy,'IsActive' => $IsActive,'assetcode'=>$AssetCode,'CostCenterCode'=>$CostCenterCode,'ConversionFactorUnit'=>$ConversionFactor,'ConversionFactorUOM'=>$ConversionFactorUOM,'Remarks'=>$Remarks,'HSNCODE'=>$HSNcode); - //print_r($RawMaterial);die(); - $result = $this->rawmaterialdetails_model->addNewRawMaterial($RawMaterial); + $result = $this->rawmaterialdetails_model->addNewRawMaterial($RawMaterial); if($result > 0) - { - - - echo "";redirect('rawmaterialListing','refresh'); - + { + echo "";redirect('rawmaterialListing','refresh'); } else { - echo ""; - redirect('rawmaterialListing','refresh'); - + redirect('rawmaterialListing','refresh'); } } } + /** + * To display rawmaterial exsits information and load's the edit rawmaterial screen + */ function viewRawmaterial($RID= '') { $MaterialType = ''; @@ -237,8 +241,8 @@ class rawmaterialdetails extends BaseController /** - * This function is used to edit the user information - */ + * To Store the edit material details into DB + */ function editRawmaterial() { if($this->isAdmin() == TRUE) @@ -247,7 +251,7 @@ class rawmaterialdetails extends BaseController } else { - $RawmaterialID = $this->input->post('MaterialCode'); + $RawmaterialID = $this->input->post('MaterialCode'); $this->form_validation->set_rules('MaterialName','Material Name','trim|required|'); $this->form_validation->set_rules('MaterialType','MaterialType','trim'); $this->form_validation->set_rules('UOM','UOM','trim'); @@ -317,8 +321,7 @@ class rawmaterialdetails extends BaseController } $RawMaterial = array(); - $RawMaterial = array('MaterialName'=>$MaterialName,'MaterialType'=>$MaterialType,'UpdatedBy'=>$UpdatedBy, 'UOM'=>$UOM,'IsActive' => $IsActive,'Category'=>$MaterialCategory,'ConversionFactorUnit'=>$ConversionFactor,'ConversionFactorUOM'=>$ConversionFactorUOM,'Remarks'=>$Remarks,'assetcode'=>$AssetCode,'CostCenterCode'=>$CostCenterCode,'HSNCODE'=>$HSNcode);//,'RMCode'=>$rmcode); - //print_r($RawMaterial);//die(); + $RawMaterial = array('MaterialName'=>$MaterialName,'MaterialType'=>$MaterialType,'UpdatedBy'=>$UpdatedBy, 'UOM'=>$UOM,'IsActive' => $IsActive,'Category'=>$MaterialCategory,'ConversionFactorUnit'=>$ConversionFactor,'ConversionFactorUOM'=>$ConversionFactorUOM,'Remarks'=>$Remarks,'assetcode'=>$AssetCode,'CostCenterCode'=>$CostCenterCode,'HSNCODE'=>$HSNcode); $result = $this->rawmaterialdetails_model->editRawmaterial($RawMaterial, $MaterialCode); if($result == true) @@ -326,10 +329,8 @@ class rawmaterialdetails extends BaseController echo ""; redirect('rawmaterialListing','refresh'); } else - { - - echo "";redirect('rawmaterialListing','refresh'); - + { + echo "";redirect('rawmaterialListing','refresh'); } @@ -337,13 +338,13 @@ class rawmaterialdetails extends BaseController } } - /** this function can be use for excel report **/ - + /** + * To export report of material details in excel + */ function export_material(){ $this->load->library('excel'); - //$this->excel->setActiveSheetIndex(0)->mergeCells('D3:J3'); $this->excel->setActiveSheetIndex(0)->mergeCells('F3:M3'); $this->excel->setActiveSheetIndex(0)->getStyle('F3')->getAlignment()->applyFromArray(array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,)); @@ -444,6 +445,9 @@ class rawmaterialdetails extends BaseController } + /** + * To load pagenotfound view + */ function pageNotFound() { $this->global['pageTitle'] = 'Resico : 404 - Page Not Found'; diff --git a/application/controllers/report.php b/application/controllers/report.php index 852617c3..e01485c5 100755 --- a/application/controllers/report.php +++ b/application/controllers/report.php @@ -4,7 +4,7 @@ require APPPATH . '/libraries/BaseController.php'; /** * Class :report (Report Details - Controller) - * User Class to control all user related operations. + * report Class to control all report related operations. * @author : Venba Info Tech - Saravana kumar * @version : 1.1 * @since : 18 November 2017 @@ -18,8 +18,7 @@ class report extends BaseController public function __construct() { parent::__construct(); - $this->load->model('dahsboard_Model'); - + $this->load->model('dahsboard_Model'); $this->isLoggedIn(); } public function pending_report() diff --git a/application/controllers/requisitionform.php b/application/controllers/requisitionform.php index 46d0c929..6cfcdfd2 100644 --- a/application/controllers/requisitionform.php +++ b/application/controllers/requisitionform.php @@ -4,7 +4,7 @@ require APPPATH . '/libraries/BaseController.php'; /** * Class : requisitionform (requisitionformController) - * User Class to control all user related operations. + * requisitionform Class to control all requistion related operations. * @author : Venba Info Tech - * @version : 1.1 * @since : 18 November 2017 @@ -12,16 +12,14 @@ require APPPATH . '/libraries/BaseController.php'; class requisitionform extends BaseController { /** - * This is default constructor of the class + * default constructor of the class */ public function __construct() { parent::__construct(); $this->load->model('requistion_model'); - - $this->load->library('session'); - $this->load->library('form_validation'); - + $this->load->library('session'); + $this->load->library('form_validation'); $this->isLoggedIn(); } /** @@ -30,8 +28,7 @@ class requisitionform extends BaseController function requisitionlisting() { $this->global['pageTitle'] = 'Resico : Requisition Listing'; - - $userID = $this->session->userdata ( 'userId' ); + $userID = $this->session->userdata ( 'userId' ); // $data['ReqList'] = $this->requistion_model->getRequistListUserID($userID); $data['Status'] = $this->requistion_model->CheckDraftStatus($userID); diff --git a/application/controllers/storerequisitionlist.php b/application/controllers/storerequisitionlist.php index 49780dc4..3a18cc1a 100644 --- a/application/controllers/storerequisitionlist.php +++ b/application/controllers/storerequisitionlist.php @@ -217,7 +217,7 @@ class storerequisitionlist extends BaseController $this->loadViews("issueStoreRequistion", $this->global,$data,null); } - + //update with existing one with new one function UpdateIssueRequistion() { @@ -351,7 +351,7 @@ class storerequisitionlist extends BaseController } -/* this function use to search StoreRequistlist*/ +/* this function use to search StoreRequistlist*///search bar function SearchRequistLists() { $userID = $this->session->userdata ( 'userId' ); @@ -390,17 +390,13 @@ class storerequisitionlist extends BaseController */ function requisitionlistApproval() { - $this->global['pageTitle'] = 'Resico :Approvalstorerequisitionlist'; + $this->global['pageTitle'] = 'Resico :Approvalstorerequisitionlist'; - //$data['Status']= $this->storerequistion_model->getStatus(); - $userID = $this->session->userdata ( 'userId' ); $data['AppList'] = $this->storerequistion_model->getApproverRequistList($userID); - - - $this->loadViews("requisitionlistapproval", $this->global, $data, NULL); + $this->loadViews("requisitionlistapproval", $this->global, $data, NULL); } /* To Edit the view store request*/ @@ -411,7 +407,6 @@ class storerequisitionlist extends BaseController $StoreReqNo= $this->input->post('id'); $result = $this->storerequistion_model->getRequistItemListApproval($StoreReqNo); $ReqList = $this->storerequistion_model->getRequistDetails($StoreReqNo); - // $DepNo = $ReqList[0]['DepartmentName']; $HTML=""; for ($i = 0; $i < count($result); $i++) @@ -437,33 +432,25 @@ class storerequisitionlist extends BaseController "; - //$index = $index + 1; + } - //print_r($ReqList); + die(json_encode(array('Items' =>$HTML,'Requist'=>$ReqList))); } -//not completed function UpdateStoreRequistion() { - $CostCenter = $this->input->post('CostCenter'); - - + $CostCenter = $this->input->post('CostCenter'); $DeletedRow = $this->input->post('txtDeletedRow'); $RowCount = $this->input->post('txtRowCount'); $Status = $this->input->post('txtStatus'); $Requestedby = $this->session->userdata ( 'EmpID' ); - $comma_separated = explode(':', $DeletedRow); $StoreReqNo =$this->input->post('txtReqNo'); - - $Requestedby = $this->input->post('RequestedBy'); - - //echo $CostCenter; $UpdatedBy = $this->session->userdata ('userId' ); $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); @@ -474,7 +461,7 @@ class storerequisitionlist extends BaseController { $Request = array('CostCenterCode'=>$CostCenter,'Status'=>$Status,'updatedOn'=>$updatedDate ); - $UpdateReq = $this->storerequistion_model->UpdateRequistion($StoreReqNo,$Request); + $UpdateReq = $this->storerequistion_model->UpdateRequistion($StoreReqNo,$Request); } @@ -503,7 +490,7 @@ class storerequisitionlist extends BaseController if($SkipInsert == "False") { - //echo "string"; die(); + $MaterialCode = $this->input->post('MaterialCode'.$i); $QuantityRequired=$this->input->post('Quantity'.$i); @@ -518,16 +505,11 @@ class storerequisitionlist extends BaseController if(count( $IsExists) == 0) { $ReqDetails = array('StoreReqNo'=>$StoreReqNo, 'MaterialCode'=>$MaterialCode,'QuantityRequired'=>$QuantityRequired,'Remarks'=>$Remarks,'Status'=>$StoreItemStatus,'UpdatedBy'=>$UpdatedBy,'UpdatedOn'=>$updatedDate); - - //print_r($ReqDetails); - //die(); - $this->storerequistion_model->addstoreRequistion($ReqDetails); } else { $ReqDetails = array('QuantityRequired'=>$QuantityRequired,'Remarks'=>$Remarks,'Status'=>$StoreItemStatus,'UpdatedBy'=>$UpdatedBy,'UpdatedOn'=>$updatedDate); - $this->storerequistion_model->UpdateRequistionLineItem($ReqDetails,$StoreReqNo,$MaterialCode); } @@ -547,7 +529,8 @@ class storerequisitionlist extends BaseController function DeleteRequistionForm() { - $ReqList= $this->input->post('id'); + + $ReqList= $this->input->post('id'); $StoreReqNo =''; $MaterialCode = ''; if(count($ReqList) > 0) diff --git a/application/controllers/storestatus.php b/application/controllers/storestatus.php index 1ae0acc0..6ec06667 100644 --- a/application/controllers/storestatus.php +++ b/application/controllers/storestatus.php @@ -4,7 +4,7 @@ require APPPATH . '/libraries/BaseController.php'; /** * Class : storestatus (Store Stock Status -Controller) - * User Class to control all user related operations. + * storestatus Class to control all store related operations. * @author : Venba Info Tech - Saravana kumar * @version : 1.1 * @since : 18 November 2017 @@ -12,19 +12,18 @@ require APPPATH . '/libraries/BaseController.php'; class storestatus extends BaseController { /** - * This is default constructor of the class + * default constructor of the class */ public function __construct() { parent::__construct(); $this->load->model('store_model'); - $this->load->library('form_validation'); - - + $this->load->library('form_validation'); $this->isLoggedIn(); } + /** - * This function used to load the first screen of the user + * Index Page for this controller (default function of the class) */ public function index() { @@ -34,29 +33,22 @@ class storestatus extends BaseController } /** - * This function is used to load the Supplier list + * To load the Supplier list */ function storeavailability() { - //$this->load->model('supplier_model'); - - - //$data['userRecords'] = $this->supplier_model->supplierListing(); - $this->global['pageTitle'] = 'Resico Industries : Store Status'; - //viewStock - $data['Stock'] = $this->store_model->viewStock(); - // print_r($data['Stock']); - $data['MaterialList'] = $this->store_model->GetAllMaterialList(); - $data['StockStatus'] = $this->store_model->GetConfigValue('C021'); + $data['Stock'] = $this->store_model->viewStock(); + $data['MaterialList'] = $this->store_model->GetAllMaterialList(); + $data['StockStatus'] = $this->store_model->GetConfigValue('C021'); $this->loadViews("storestatus", $this->global, $data,null); } - /** - * This function is used to load the Supplier list + /** + * To load the Supplier list */ function AddStock() { @@ -83,7 +75,10 @@ class storestatus extends BaseController } - + + /** + * To load the Supplier list + */ function UpdateStock() { @@ -101,7 +96,7 @@ class storestatus extends BaseController } - //this array to store the value in master table.. + //this array to store the value in master table.. $Stockdetails = array('Quantity'=>$AvailableQty,'Status'=>$Status,'Remarks'=>$Remarks, 'UpdatedBy'=>$CreatedBy,'updatedOn'=>$createddt); $data['Stock'] = $this->store_model->UpdateStock($Stockdetails,$MaterialCode); @@ -109,18 +104,21 @@ class storestatus extends BaseController } - + + /** + * To load the Supplier list + */ function viewStockHistory() { - $MaterialCode= $this->input->post('id'); + $MaterialCode= $this->input->post('id'); - $result = $this->store_model->GetStockHisory($MaterialCode); + $result = $this->store_model->GetStockHisory($MaterialCode); $TotalStock = 0; - $HTML=""; - for ($i = 0; $i < count($result); $i++) - { + $HTML=""; + for ($i = 0; $i < count($result); $i++) + { $SNo = $i + 1; $AvailableQty = $result[$i]['Quantity']; @@ -131,27 +129,25 @@ class storestatus extends BaseController $HTML.=" ".$SNo." - ". $AvailableQty." - + ". $AvailableQty." ".$UpdatedStock." ".$Updatedon->format('d-m-Y')." ".$Remarks." - - - "; + "; + $TotalStock = $TotalStock + $UpdatedStock; - //$index = $index + 1; - - } - //print_r($HTML); - //echo $AvilBudAmt; - die(json_encode(array('History' =>$HTML,'AvalStock'=>$TotalStock))); -} - + + } + + die(json_encode(array('History' =>$HTML,'AvalStock'=>$TotalStock))); + } + + /** + * To load pagenotfound view + */ function pageNotFound() { $this->global['pageTitle'] = 'Resico : 404 - Page Not Found'; - $this->loadViews("404", $this->global, NULL, NULL); } } diff --git a/application/controllers/supplier.php b/application/controllers/supplier.php index a399245a..73e2cfac 100644 --- a/application/controllers/supplier.php +++ b/application/controllers/supplier.php @@ -26,7 +26,7 @@ class supplier extends BaseController } /** - * default function of the supplier class + * Index Page for this controller(default function of the class) */ public function index() { @@ -198,7 +198,7 @@ class supplier extends BaseController /** - * To add new Supplier + * To store supplier data into DB. */ function addNewsupplier() { @@ -469,7 +469,7 @@ class supplier extends BaseController /** - * This function is used to export report of supplier details in excel + * To export report of supplier details in excel */ function export_supplierdetails(){ diff --git a/application/controllers/user.php b/application/controllers/user.php index 48a29675..637ca394 100644 --- a/application/controllers/user.php +++ b/application/controllers/user.php @@ -12,76 +12,204 @@ require APPPATH . '/libraries/BaseController.php'; class user extends BaseController { /** - * This is default constructor of the class + * Default constructor of the class */ public function __construct() { parent::__construct(); $this->load->model('user_model'); - $this->load->library('form_validation'); - + $this->load->model('dahsboard_Model'); + $this->load->library('form_validation'); $this->isLoggedIn(); } /** - * This function used to load the first screen of the user + * Index Page for this controller(default function of the class) */ public function index() { - $this->global['pageTitle'] = 'Resico : Dashboard'; + $this->global['pageTitle'] = 'Resico : Dashboard'; - $this->load->model('employeedetails_model'); - - + $this->load->model('employeedetails_model'); $this->load->model('dahsboard_Model'); $data['EmpCount'] = $this->employeedetails_model->getEmployeeCount(); $data['totalpurchaseorder']=$this->dahsboard_Model->totalpurchaseorder(); - - //print_r( $data['totalpurchaseorder']); - $data['totalordervalue']=$this->dahsboard_Model->totalordervalue(); - $data['pendingpo']=$this->dahsboard_Model->pendingpo(); - $data['totalserviceamount']=$this->dahsboard_Model->totalserviceamount(); - $data['totalcapitalamount']=$this->dahsboard_Model->totalcapitalamount(); - $data['totalimportamount']=$this->dahsboard_Model->totalimportamount(); - $data['totalrevenueamount']=$this->dahsboard_Model->totalrevenueamount(); - - - // $data['totalservicepo']=$this->dahsboard_Model->totalservicepo(); - //$data['totalrevenuepo']=$this->dahsboard_Model->totalrevenuepo(); - $data['totalimportpo']=$this->dahsboard_Model->totalimportpo(); - //$data['totalcapitalpo']=$this->dahsboard_Model->totalcapitalpo(); - - $data['details']=$this->dahsboard_Model->reqdetail(); - - $data['pending_details']=$this->dahsboard_Model->req_pending(); - $data['list']=$this->dahsboard_Model->req_list(); - + $data['totalordervalue']=$this->dahsboard_Model->totalordervalue(); + + $data['pendingpo']=$this->dahsboard_Model->pendingpo(); + + $data['totalserviceamount']=$this->dahsboard_Model->totalserviceamount(); + $data['totalcapitalamount']=$this->dahsboard_Model->totalcapitalamount(); + $data['totalimportamount']=$this->dahsboard_Model->totalimportamount(); + $data['totalrevenueamount']=$this->dahsboard_Model->totalrevenueamount(); + + $data['totalimportpo']=$this->dahsboard_Model->totalimportpo(); + + $data['details']=$this->dahsboard_Model->reqdetail(); + + $data['pending_details']=$this->dahsboard_Model->req_pending(); + $data['list']=$this->dahsboard_Model->req_list(); + $data['serviceprogress']=$this->dahsboard_Model->serviceprogress(); $data['revenueprogress']=$this->dahsboard_Model->revenueprogress(); $data['importprogress']=$this->dahsboard_Model->importprogress(); $data['capitalprogress']=$this->dahsboard_Model->capitalprogress(); - //month-wise area chart + + //month-wise area chart $data['getTotalServicePoCount'] = $this->dahsboard_Model->getTotalServicePoCount(); $data['getTotalimportPoCount'] = $this->dahsboard_Model->getTotalimportPoCount(); $data['getTotalcapitalPoCount'] = $this->dahsboard_Model->getTotalcapitalPoCount(); $data['getTotalrevenuePoCount'] = $this->dahsboard_Model->getTotalrevenuePoCount(); //dashboard pie chart - $data['importbudgt'] = $this->dahsboard_Model->importbudgt(); - $data['importbal'] = $this->dahsboard_Model->importbal(); - $data['servicebudgt'] = $this->dahsboard_Model->servicebudgt(); - $data['servicebal'] = $this->dahsboard_Model->servicebal(); - $data['revenuebudgt'] = $this->dahsboard_Model->revenuebudgt(); - $data['revenuebal'] = $this->dahsboard_Model->revenuebal(); - $data['capitalbud'] = $this->dahsboard_Model->capitalbud(); - $data['capitalbal'] = $this->dahsboard_Model->capitalbal(); + $data['importbudgt'] = $this->dahsboard_Model->importbudgt(); + $data['importbal'] = $this->dahsboard_Model->importbal(); + $data['servicebudgt'] = $this->dahsboard_Model->servicebudgt(); + $data['servicebal'] = $this->dahsboard_Model->servicebal(); + $data['revenuebudgt'] = $this->dahsboard_Model->revenuebudgt(); + $data['revenuebal'] = $this->dahsboard_Model->revenuebal(); + $data['capitalbud'] = $this->dahsboard_Model->capitalbud(); + $data['capitalbal'] = $this->dahsboard_Model->capitalbal(); + $data['totemp']=$this->dahsboard_Model->totemp(); + $data['totloan']=$this->dahsboard_Model->totloan(); + $data['totpay']=$this->dahsboard_Model->totpay(); + $data['totrec']=$this->dahsboard_Model->totrec(); + $data['emplist']=$this->dahsboard_Model->emplist(); + + /* yesterday absent list count in employee*/ + $dates = date('Y-m'); + $date = $dates.'-01'; + $dat = date('d',strtotime("-1 days")); + $WH = 'WH'.date('j',strtotime("-1 days")); + $yesterday = $this->dahsboard_Model->attyesterday($WH,$date); + + $values=0; + foreach ($yesterday as $weekda => $value) { + if($value[$WH] == 0){ + $values++; + } + + } + + $data['values'] = $values; + + /*Today absent list count in employee*/ + $dates = date('Y-m'); + $date = $dates.'-01'; + $dat = date('d'); + $WH = 'WH'.date('j'); + $yesterday = $this->dahsboard_Model->attyesterday($WH,$date); + $values=0; + + foreach ($yesterday as $weekda => $value) { + if($value[$WH] == 0){ + $values++; + } + } + + $data['today'] = $values; $this->loadViews("dashboard", $this->global, $data , NULL); +} + +function attendancemonth() +{ + + $date = date('Y-m'); + + $dates = $date.'-01'; + $EmpID= $this->input->post('id'); + $monthabs = $this->dahsboard_Model->attendance($EmpID,$dates); + $persent_month = date('t'); + $values=0; + $weekdays = array(); + $date = date('d'); + + for($i=1;$i<=$persent_month;$i++) + { + $weekdays[] = 'WH'.$i; } + foreach ($monthabs as $weekda ) { + foreach ($weekda as $key => $value) { + foreach ($weekdays as $weeks) { + + if($weeks == $key) + { + if($value != 0){ + $values++; + } + } + + } + } + } + + $year = date('Y'); + $current_month = date('m'); + $CUR_month = date('t'); + + $data['values'] = $values; + $data['present_percentage'] = round(($values/$date)*100); + $data['CUR_month'] = $date; + + echo json_encode($data); + +} + + +function attendanceyear() +{ + $CURMONTH = date('m'); + $CURDATE = date('d'); + $EmpID= $this->input->post('id'); + $day = array(); + + $result = $this->dahsboard_Model->attendanceyear($EmpID); + $yearabs = $this->dahsboard_Model->getAllAttendance($EmpID,$CURMONTH); + $TotalNoofDays = $result[0]->TotalWorkingDays; + $DaysWorked = $result[0]->DaysWorked; + + + $values=0; + + $weekdays = array(); + $date = date('d'); + + $Work= array_sum($weekdays); + + for($j=1;$j<=$date;$j++) + { + $weekdays[] = 'WH'.$j; + } + foreach ($yearabs as $day ) { + foreach ($day as $key => $value) { + foreach ($weekdays as $weeks) { + + if($weeks == $key) + { + if($value != 0){ + $values++; + } + } + } + } + } + + $TotalNoofDays = $TotalNoofDays+$CURDATE; + $DaysWorked = $DaysWorked+$values; + + $final_res = round(($DaysWorked /$TotalNoofDays) * 100); + $data['workeds']=$DaysWorked; + $data['yeardata'] = $final_res; + $data['totaldays'] = $TotalNoofDays; + + echo json_encode($data); +} + /** - * This function is used to load the user list + * To load the user list */ function userListing() { @@ -123,7 +251,7 @@ class user extends BaseController } /** - * This function is used to check whether email already exist or not + * To check whether email already exist or not */ function checkEmailExists() { @@ -139,29 +267,29 @@ class user extends BaseController if(empty($result)){ echo("true"); } else { echo("false"); } } - /* Validation for Employee Dropdown + + /** + * Validation for Employee Dropdown */ function Employee_validate($selectValue) -{ - //echo 'select_validate method called'; - // 'none' is the first option and the text says something like "-Choose one-" - if($selectValue == '0') - { - $this->form_validation->set_message('Employee_validate', 'Please Select Employee.'); - return false; + { + if($selectValue == '0') + { + $this->form_validation->set_message('Employee_validate', 'Please Select Employee.'); + return false; + } + else // user picked something + { + return true; + } } - else // user picked something - { - return true; - } -} - /* Validation for Employee Dropdown - */ + + /** + * Validation for Role Dropdown + */ function Role_validate($selectValue) -{ - //echo 'select_validate method called'; - // 'none' is the first option and the text says something like "-Choose one-" - if($selectValue == '0') + { + if($selectValue == '0') { $this->form_validation->set_message('Role_validate', 'Please Select Role.'); return false; @@ -172,7 +300,7 @@ class user extends BaseController } } /** - * This function is used to add new user to the system + * To add new user to the system */ function addNewUser() { @@ -183,8 +311,8 @@ class user extends BaseController else { - $this->form_validation->set_rules('EmpList','EmpList','trim|callback_Employee_validateS'); - $this->form_validation->set_rules('role','role','trim|callback_Role_validate'); + $this->form_validation->set_rules('EmpList','EmpList','trim|callback_Employee_validateS'); + $this->form_validation->set_rules('role','role','trim|callback_Role_validate'); $this->form_validation->set_rules('password','Password','required|max_length[20]'); $this->form_validation->set_rules('cpassword','Confirm Password','trim|required|matches[password]|max_length[20]'); @@ -198,12 +326,10 @@ class user extends BaseController $EmpID = $this->input->post('EmpList'); $roleId = $this->input->post('role'); $password = $this->input->post('password'); - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $Createddt = $dt->format('Y-m-d H:i:s'); - $email = $this->input->post('MailID'); - $userInfo = array('email'=>$email,'EmpID'=>$EmpID,'password'=>getHashedPassword($password),'roleId'=>$roleId,'createdBy'=>$this->vendorId,'createdDtm'=>$Createddt); $result = $this->user_model->addNewUser($userInfo); @@ -213,13 +339,13 @@ class user extends BaseController redirect('userListing','refresh'); echo ""; - - } + + } else { redirect('userListing','refresh'); - echo ""; + echo ""; } } @@ -227,9 +353,8 @@ class user extends BaseController } - /** - * This function is used load user edit information - * @param number $userId : Optional : This is user id + /** + * For editing purpose and it has oldest values only. */ function editOld($UserId = '') { @@ -245,28 +370,18 @@ class user extends BaseController } $Uid = $_GET['UID']; - - - $data['roles'] = $this->user_model->getUserRoles(); - - //print_r($data); - $data['EmpList'] = $this->user_model->GetEmployeeDetails($Uid); - //print_r($data); $data['EmpRole'] = $this->user_model->GetRoleNameByUserID($Uid); - // $data['userInfo'] = $this->user_model->getUserInfo($userId); - $this->global['pageTitle'] = 'Resico : Edit User'; - $this->loadViews("editOld", $this->global, $data, NULL); } } /** - * This function is used to edit the user information + * To store edited user information */ function editUser() { @@ -278,7 +393,7 @@ class user extends BaseController { $userId = $this->input->post('EmpList'); $this->form_validation->set_rules('EmpList','EmpList','trim|callback_Employee_validateS'); - $this->form_validation->set_rules('role','role','trim|callback_Role_validate'); + $this->form_validation->set_rules('role','role','trim|callback_Role_validate'); $this->form_validation->set_rules('password','Password','required|max_length[20]'); $this->form_validation->set_rules('cpassword','Confirm Password','trim|required|matches[password]|max_length[20]'); @@ -291,19 +406,12 @@ class user extends BaseController $EmpID = $this->input->post('EmpList'); $role = $this->input->post('role'); $password = $this->input->post('password'); - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $updatedDate = $dt->format('Y-m-d H:i:s'); - - // echo $EmpID; - - $userInfo = array(); - - + + $userInfo = array(); $userInfo = array('password'=>getHashedPassword($password),'roleId'=>$role,'EmpId'=>$EmpID,'updatedDtm'=>$updatedDate); - - - $result = $this->user_model->editUser($userInfo, $EmpID); if($result == true) @@ -315,34 +423,32 @@ class user extends BaseController $this->session->set_flashdata('error', 'User updation failed'); } - redirect('userListing'); + redirect('userListing'); + } } } /** - * This function is used to delete the user using userId - * @return boolean $result : TRUE / FALSE + * To delete the user */ function deleteUser() { echo 'Delete'; $Uid = $this->input->post('id'); - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - $updatedDate = $dt->format('Y-m-d H:i:s'); - - $userInfo = array('isDeleted'=>1,'updatedBy'=>$this->vendorId, 'updatedDtm'=>$updatedDate); - - $result = $this->user_model->deleteUser($Uid, $userInfo); + $updatedDate = $dt->format('Y-m-d H:i:s'); + + $userInfo = array('isDeleted'=>1,'updatedBy'=>$this->vendorId, 'updatedDtm'=>$updatedDate); + $result = $this->user_model->deleteUser($Uid, $userInfo); - echo 'Succssfully change the user status to InAcive'; + echo 'Succssfully change the user status to InAcive'; } /** - * This function is used to load the change password screen + * To load the change password screen */ function loadChangePass() { @@ -353,7 +459,7 @@ class user extends BaseController /** - * This function is used to change the password of the user + * To store change the password of the user into DB */ function changePassword() { @@ -394,6 +500,9 @@ class user extends BaseController } } + /** + * To load pagenotfound view + */ function pageNotFound() { $this->global['pageTitle'] = 'Resico : 404 - Page Not Found'; diff --git a/application/models/companydetailsmodel.php b/application/models/companydetailsmodel.php index e5bdc89f..9cabf1d7 100644 --- a/application/models/companydetailsmodel.php +++ b/application/models/companydetailsmodel.php @@ -54,12 +54,11 @@ class companydetailsmodel extends CI_Model /** - * To update the company related information - * @param number $compID : - * @param number $Comp : To get all the information of company's files - * @return array $this->db->affected_rows() : This will return how many value are changed (return as number/count) + * To update the company related files information + * @param number $compID : To get the company ID + * @param number $Comp : To get all the modified information of company + * @return array $this->db->last_query() : this will return changes in last executed query */ - function Updatecompany($Comp, $CompID) { $this->db->where('CompID', $CompID); @@ -68,7 +67,11 @@ class companydetailsmodel extends CI_Model return TRUE; } - + /** + * To Check the company images and files. if exists are not + * @param number $Pic: To get the images name from the controller + * @return array $query->result_array() : This is result of the query + */ function checkPhotoExists($Pic) { $this->db->select('ProfilePic'); @@ -80,7 +83,10 @@ class companydetailsmodel extends CI_Model } } - // updated by // + /** + * To get the Company Information for listing + * @return array $result : This is result of the query + */ function companylisting() { $this->db->select('com.*,emp.firstname,pmt.PaymentTerms'); @@ -93,16 +99,10 @@ class companydetailsmodel extends CI_Model return $result; } - // dropdown for payaple terms @ companydetails// - // function getpayment($Configvalue = '') - // { - // $ConfigID = 'C009'; - // $this->db->select('ConfigValue'); - // $this->db->from('T_ConfigDetails'); - // $this->db->where('Config_ID ',$ConfigID ); - // $query = $this->db->get(); - // return $query->result(); - // } + /** + * To get the paymentterms information for companydetails + * @return array $result : This is result of the query + */ function getPaymentTerms() { $this->db->select('*'); @@ -112,8 +112,11 @@ class companydetailsmodel extends CI_Model return $result; } - - // dropdown for file description @ companydetails// + /** + * To get filedescription information by config value(dropdown for file description) + * @param number $Configvalue :Optional : To get config value + * @return $query->result() : This is result of the query (config information) + */ function getfilename($Configvalue = '') { $ConfigID = 'C025'; @@ -125,8 +128,11 @@ class companydetailsmodel extends CI_Model } - // for display the bankdetails// - function getBankDetails() + /** + * To get bank details for company. + * @return $result : This is result of the query (bank details) + */ + function getBankDetails() { $this->db->select('*'); $this->db->from('T_Bank_Details'); @@ -135,7 +141,12 @@ class companydetailsmodel extends CI_Model return $result; } - // for add and update the bankdetails// + + /** + * To store and modified bank details for company. + * @param array $Bank : To get bank details from the controller using array + * @return array $isExits->result_array() : This is result of the query (bank details) + */ function BankDetails($Bank) { $bankname=$Bank['Bank_name']; diff --git a/application/models/dahsboard_model.php b/application/models/dahsboard_model.php index 0511bd55..47a5e87f 100755 --- a/application/models/dahsboard_model.php +++ b/application/models/dahsboard_model.php @@ -4,7 +4,118 @@ class dahsboard_Model extends CI_Model { - + function totemp() + { + + $sql="select count(EmpID) as totemp FROM T_Employee_Details where IsActive ='1'"; + $query =$this->db->query($sql); + return $query->result(); + + } + + + function totloan() + { + + $sql="select sum(Loan_Amount)as totloan FROM T_Loan_Master"; + $query =$this->db->query($sql); + return $query->result(); + + } + + + function totpay() + { + + $sql="select sum(Paid_Amount)as totpay FROM T_Loan_Master"; + $query =$this->db->query($sql); + return $query->result(); + + } + + function totrec() + { + + $sql="select sum(Loan_Amount), sum(Paid_Amount),sum(Loan_Amount)-sum(Paid_Amount) as totrec FROM T_Loan_Master"; + $query =$this->db->query($sql); + return $query->result(); + + } + + function emplist() + { + + $sql="select EmpID,CONCAT(FirstName,' ',LastName) as name FROM T_Employee_Details where IsActive ='1'"; + $query =$this->db->query($sql); + return $query->result(); + + + + } + + + function attyesterday($WH,$date) + { + //echo $EmpID.'-'.$dates; + $sql="select ".$WH." from T_Attendance where Month_Year = ? and EmpID in (select EmpID from T_Attendance)"; + $query = $this->db->query($sql,array($date)); + //return + return $query->result_array(); + } + + + function attendance($EmpID,$dates) + { + //echo $EmpID.'-'.$dates; + $sql="select * from T_Attendance where EmpID =? and Month_Year=?"; + $query = $this->db->query($sql,array($EmpID,$dates)); + + return $query->result(); + + } + function getAllAttendance($EmpID,$CURMONTH) + { + $sql="select * from T_Attendance where EmpID =? and month(Month_Year)=?"; + $query = $this->db->query($sql,array($EmpID,$CURMONTH)); + + return $query->result(); + } + + function daysalary($EmpID,$dates) + { + //print_r($dates);die; + $sql= "select * FROM T_Emp_Pay_Data as pay + + join T_Attendance att on att.EmpID = pay.EmpID + where att.Month_Year = ? and att.EmpID = ?;"; + $query = $this->db->query($sql,array($dates,$EmpID)); + + return $query->result(); + + } + + + + function attendanceyear($EmpID) + { + + // $sql="select Att.EmpID,Att.Month_Year,Att.*,NoofDays,Days_Worked,emp.DateofJoining from T_Attendance Att + // join T_Employee_Details as emp on emp.EmpID = Att.EmpID + // where Att.Month_Year between ? and ? and Att.EmpID = ?"; + $sql = 'select sum(NoofDays) as TotalWorkingDays,sum(Days_worked) as DaysWorked from T_Attendance where + case + when (month(Month_Year) >=4) then + (YEAR(Month_Year) = YEAR(CURRENT_DATE) and MONTH(Month_Year) >= 4 ) or ( YEAR(Month_Year) = YEAR(CURRENT_DATE)+1 and MONTH(Month_Year) <= 3 ) + else + (YEAR(Month_Year) = YEAR(CURRENT_DATE)-1 and MONTH(Month_Year) >= 4 ) or ( YEAR(Month_Year) = YEAR(CURRENT_DATE) and MONTH(Month_Year) <= 3 ) + end and EmpID = ? and month(Month_Year) != month(current_date());'; + $query= $this->db->query($sql,array($EmpID)); + return $query->result(); + + + + } + function totalpurchaseorder(){ diff --git a/application/models/supplier_model.php b/application/models/supplier_model.php index 5791007a..cf598765 100644 --- a/application/models/supplier_model.php +++ b/application/models/supplier_model.php @@ -3,7 +3,7 @@ class supplier_model extends CI_Model { - /** + /** * To get the Supplier Information for listing * @return array $result : This is result */ diff --git a/application/views/dashboard.php b/application/views/dashboard.php index 3be18b3e..46f891fe 100755 --- a/application/views/dashboard.php +++ b/application/views/dashboard.php @@ -55,6 +55,403 @@ if(!empty($EmpCount)) + +
+ +
+ +
+ +
+ +
+
+ +
+
+
+ + + + +
+ TOTAL NO OF EMPLOYEES + totemp;?> +
+ + +
+
+ + + + +
+ +
+
+ TOTAL EMPLOYEES ABSENT +
+ +
+
YESTERDAY
+
+ + + +
+ + +
+ + + +
+
+ +
+ +
TODAY
+ +
+ + +
+ + +
+ +
+ +
+ +
+ + + +
+
+
+ +
+ +
+
+ 'Select Employee'); + //print_r( $options); + + if(!empty($emplist)) + { + foreach ($emplist as $SID): + + + $options[$SID->EmpID] = $SID->name.' '.' - '.' '.$SID->EmpID; + + endforeach; + } + + echo form_dropdown('emp', $options,set_value('emp'),'id="emp"' ,'required="true"' ,'class="form-control select2'); + + ?> +
+
+
+
+
+ +
+


+
+
+ +
0
+
+
+ +
0
+
+ +
+ +
+ +
+ + + + + + + + +
+ +
+
+ 'Select Employee'); + //print_r( $options); + + if(!empty($emplist)) + { + foreach ($emplist as $SID): + + + $options[$SID->EmpID] = $SID->name.' '.' - '.' '.$SID->EmpID; + + endforeach; + } + + echo form_dropdown('employee', $options,set_value('employee'),'id="employee"' ,'required="true"' ,'class="form-control select2'); + + ?> +
+
+
+
+ +
+
+


+
+
+ +
0
+
+
+ +
0
+
+ +
+ +
+ + +
+ + + + + + + + + + +
+
+ +
+
+ + + + assets/plugins/daterangepicker/moment.js"> + + @@ -79,6 +81,7 @@ +