diff --git a/application/controllers/companycontroller.php b/application/controllers/companycontroller.php new file mode 100644 index 00000000..ebdb8763 --- /dev/null +++ b/application/controllers/companycontroller.php @@ -0,0 +1,222 @@ +load->model('companydetailsmodel'); + $this->isLoggedIn(); + } + /** + * This function used to load the first screen of the user + */ + public function index() + { + $this->global['pageTitle'] = 'Siddharth : Company Details'; + + //$this->loadViews("companyadd", $this->global, NULL , NULL); + + //$this->loadViews("Updatecompany", $this->global,NULL,NULL); + } + + public function companyview() + { + $this->global['pageTitle'] = 'Siddharth : Company Details'; + + $data['userRecords'] = $this->companydetailsmodel->companylisting(); + $data['payment'] = $this->companydetailsmodel->getpayment(); + $data['filenames']=$this->companydetailsmodel->filelist(); + //$data['filetype']=$this->companydetailsmodel->getfilename(); + $this->loadViews("companyview", $this->global,$data, NULL); + } + + function companyadd(){ + + $this->global['pageTitle'] = 'Siddharth : Company Details'; + $this->loadViews("companyadd", $this->global, NULL); + } + + + function add() + { + $picture = ''; + if(!empty($_FILES['photo']['name'])) + { + $config['upload_path'] = 'uploads/images/'; + $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 = ''; + } + } + else + { + $picture = ''; + } + + return $picture ; + } + function addfile() + { + $file = ''; + //Check whether user upload picture + if(!empty($_FILES['images']['name'])) + { + + $config['upload_path'] = 'uploads/files/'; + $config['allowed_types'] = 'docx|pdf|doc|png|jpg'; + $config['file_name'] = $_FILES['images']['name']; + + //Load upload library and initialize configuration + $this->load->library('upload',$config); + $this->upload->initialize($config); + + if($this->upload->do_upload('images')) + { + $uploadData = $this->upload->data(); + $file = $uploadData['file_name']; + } + else + { + $error = array('error' => $this->upload->display_errors()); + $file = ''; + } + } + else + { + $file = ''; + } + + return $file ; + } + + + function checkPanValidate() + { + $PanNo = $this->input->post('panno'); + $query = $this->supplier_model->checkPAN($PanNo); + if (count($query)> 0) + { + $this->form_validation->set_message('checkPanValidate', 'The Entered PAN Number is already exists in the Database.'); + return false; + } + else + { + return true; + } + } + function deletefile() + { + + $ID = $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); + $result = $this->companydetailsmodel->deletefile($ID, $userInfo); + echo 'Succssfully change the user status to InActive'; + + } + + + + + function UpdateCompany() + { + $data['payment'] = $this->companydetailsmodel->getpayment(); + if($this->isAdmin() == TRUE) + { + $this->loadThis(); + } + else + { + + $Picture = $this->add(); + $file =$this->addfile(); + $CompID = $this->input->post('CompanyID'); + $CompanyName = $this->input->post('CompanyName'); + $Address = $this->input->post('Address'); + $ContactNumber = $this->input->post('ContactNumber'); + $AlternateContactNumber = $this->input->post('AlternateContactNumber'); + $EmailAddress = $this->input->post('EmailAddress'); + $Exiseregistration = $this->input->post('Exiseregistration1'); + $TIN = $this->input->post('TIN'); + $PAN = $this->input->post('PAN'); + $GSTNO = $this->input->post('GSTNO'); + $GSTRange = $this->input->post('GSTRange'); + $CollectrateAddress = $this->input->post('CollectrateAddress'); + $UANumber = $this->input->post('UANumber'); + $Payment = $this->input->post('PaymentTerms'); + $PaymentDays = $this->input->post('PaymentDays'); + $PayableAT = $this->input->post('PayableAT'); + $createdby = $this->session->userdata ( 'userId' ); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $createddt = $dt->format('Y-m-d H:i:s'); + $UpdatedBY = $this->session->userdata ( 'Userid' ); + //$companywebsite = $this->input->post('companywebsite'); + $ceoname = $this->input->post('ceoname'); + $mdname = $this->input->post('mdname'); + $companystartedon = $this->input->post('companystartedon'); + $partnerdetails = $this->input->post ('partnerdetails'); + $ProfilePic = $this->input->post ('ProfilePic'); + //$files = $this->input->post('files'); + $filedescription1= $this->input->post('filedescription'); + //$files = $this->input->post('filename'); + $financialstart=$this->input->post('financialstart'); + $financialend=$this->input->post('financialend'); + $ID= $this->input->post('ID'); + //$createdDate=$this->input->post('createdDate'); + + $Company = array('CompID'=>$CompID,'CompanyName'=>$CompanyName,'Address'=>$Address,'ContactNumber'=>$ContactNumber,'AlternateContactNumber'=>$AlternateContactNumber,'EmailAddress'=>$EmailAddress,'TIN'=>$TIN,'PAN'=>$PAN,'GSTNO'=>$GSTNO,'GSTRange'=>$GSTRange,'UANumber'=>$UANumber,'PaymentTerms'=>$Payment ,'PaymentDays'=>$PaymentDays ,'PayableAT'=>$PayableAT ,'Createdby'=>$createdby,'ProfilePic'=>$Picture,'Exiseregistration'=>$Exiseregistration,'CollectrateAddress'=>$CollectrateAddress,'FiscalYearStartOn'=>$financialstart,'FiscalYearEndsOn'=> $financialend); + + if(!empty($file)) + { + $myfile = array('CompID'=>$CompID,'filename'=>$file,'ID'=>$ID,'filedescription'=>$filedescription1,'createdDate'=>$createddt); + //print_r($myfile);die(); + $result2 = $this->companydetailsmodel->filedetails($myfile); + } + $result = $this->companydetailsmodel->Updatecompany($Company,$CompID); + + if($result > 0) + { + + // $this->session->set_flashdata('Success', $EmpId.'Employee Updated successfully!'); + + echo ""; + redirect('companyview','refresh'); + } + + + // redirect('employeeListing'); + + } + } + + + +} + +?> \ No newline at end of file diff --git a/application/controllers/configurationctrl.php b/application/controllers/configurationctrl.php new file mode 100644 index 00000000..6ea1ebb3 --- /dev/null +++ b/application/controllers/configurationctrl.php @@ -0,0 +1,168 @@ +load->library('form_validation'); + $this->load->model('configmodel'); + + $this->isLoggedIn(); + } + +public function index() + { + + $this->global['pageTitle'] = 'Siddharth : Supplier'; + + $this->loadViews("configlisting", $this->global, NULL , NULL); + } + + + 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->global['pageTitle'] = 'Siddharth Industries : config Listing'; + + $this->loadViews("configlisting", $this->global, $data, NULL); + + } + function addconfig() + { + $this->global['pageTitle'] = 'siddharth : AddNew Department'; + $this->loadViews("addconfig", $this->global,NULL, NULL); + + } + + + + function addNewconfig() + { + $Configid = $this->input->post('Configid'); + $ConfigName = $this->input->post('configurationname'); + $Rowcount = $this->input->post('txtRowCount'); + $Comments = $this->input->post('Comments'); + $Createdby = $this->session->userdata ( 'userId' ); + $chked = $this->input->post('IsActive'); + + if( $chked != '') + { + $IsActive = '1'; + } + else + { + $IsActive = '0'; + } + + $config = array('Config_ID'=>$Configid,'ConfigName'=>$ConfigName, 'Comments'=>$Comments); + $result = $this->configmodel->addconfigmaster($config); + if(count($config)>0) + { + for($i=1;$i<=$Rowcount;$i++) + { + $ConfigValue = $this->input->post('ConfigValue'.$i); + $configvalue = array('Config_ID'=>$Configid,'ConfigValue'=>$ConfigValue); + $result = $this->configmodel->addconfigdetails($configvalue); + + }}//if closed + //echo "successfully created:".$ConfigID; + + + if($result > 0) + { + redirect('configurationctrl/configlisting','refresh'); + echo ""; + } + + else + { + redirect('configurationctrl/configlisting','refresh'); + echo ""; + } + } + + function editOldconfig($ConfigID = '') + { + $ConfigID = $_GET['ConfigID']; + $data['master'] = $this->configmodel->GetConfigCenterMaster($ConfigID); + $data['child'] = $this->configmodel->GetConfigCenterDetails($ConfigID); + + $index = 1; + // $index = $index + 1; + $this->global['pageTitle'] = 'Siddharth : Edit Cost'; + $this->loadViews("editconfig", $this->global, $data,NULL); + //} + } + + function configedit() + { + + $Configid = $this->input->post('Configid'); + $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 ""; + } + } +} +?> \ No newline at end of file diff --git a/application/controllers/department.php b/application/controllers/department.php new file mode 100644 index 00000000..41e7b792 --- /dev/null +++ b/application/controllers/department.php @@ -0,0 +1,324 @@ +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 + */ + public function index() + { + + $this->global['pageTitle'] = 'Siddharth : Department'; + + $this->loadViews("departmentListing", $this->global, NULL , NULL); + } + + /** + * This function is used to load the Supplier list + */ + function departmentListing() + { + + $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"]); + + $this->global['pageTitle'] = 'Siddharth Industries : department Listing'; + + $this->loadViews("departmentListing", $this->global, $data, NULL); + + } + /** + * This function is used to load the add new supplier */ + function adddepartment() + { + + //$data['payment'] = $this->department_model->getpayment(); + $data['depcode'] = $this->department_model->getdepcode(); + + $this->global['pageTitle'] = 'siddharth : AddNew Department'; + + $this->loadViews("adddepartment", $this->global,$data, NULL); + + } + + + + function addNewdepartment() + { + + + + $DepartmentName = $this->input->post('DepartmentName'); + $DEPCode = $this->input->post('DEPCode'); + $HeadDept = $this->input->post('HeadDept'); + $Createdby = $this->session->userdata ( 'userId' ); + $chked = $this->input->post('IsActive'); + + if( $chked != '') + { + $IsActive = '1'; + } + else + { + $IsActive = '0'; + } + + $department = array('DepartmentName'=>$DepartmentName, 'DEPCode'=>$DEPCode, 'HeadDept'=>$HeadDept,'Createdby'=>$Createdby,'IsActive'=>$IsActive); + $result = $this->department_model->addNewdepartment($department); + + if($result > 0) + { + redirect('departmentListing','refresh'); + echo ""; + } + + else + { + redirect('departmentListing','refresh'); + echo ""; + } + } + + + + 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 + */ + function editdepartment() + { + + $DepartmentName = $this->input->post('DepartmentName'); + $DEPCode = $this->input->post('DEPCode'); + $HeadDept = $this->input->post('HeadDept'); + $Createdby = $this->session->userdata ( 'userId' ); + $chked = $this->input->post('IsActive'); + + if( $chked != '') + { + $IsActive = '1'; + } + else + { + $IsActive = '0'; + } + + + $department = array('DepartmentName'=>$DepartmentName, 'DEPCode'=>$DEPCode,'HeadDept'=>$HeadDept,'IsActive'=>$IsActive); + + $result = $this->department_model->Updatedepartment($department, $DEPCode); + + if($result == True) + { + redirect('departmentListing','refresh'); + echo ""; + } + + else + { + redirect('departmentListing','refresh'); + echo ""; + } + + + } + + + + function viewdepartment($SID = '') + { + //print_r('hello');die(); + + if($SID == '') + { + $DepartmentID = $_GET['SID']; + + } + else + { + + $DepartmentID = $SID; + } + + + $data['department'] = $this->department_model->getDeptInfo($DepartmentID); + $data['depcode'] = $this->department_model->getdepcode(); + $this->global['pageTitle'] = 'Siddharth : Edit Supplier'; + $this->loadViews("editdepartment", $this->global,$data, NULL); + + } + + /** this function can be use for excel report **/ + + function export_departmentdetails(){ + + + $this->load->library('excel'); + $this->excel->setActiveSheetIndex(0); + + $this->excel->getActiveSheet()->setTitle('supplier details'); + + $this->excel->getActiveSheet()->setCellValue('A1', 'DepartmentID'); + $this->excel->getActiveSheet()->setCellValue('B1', 'SupplierName'); + $this->excel->getActiveSheet()->setCellValue('C1', 'Address'); + $this->excel->getActiveSheet()->setCellValue('D1', 'ContactNumber'); + $this->excel->getActiveSheet()->setCellValue('E1', 'AlternateContactNumber'); + $this->excel->getActiveSheet()->setCellValue('F1', 'EmailAddress'); + $this->excel->getActiveSheet()->setCellValue('G1', 'Exiseregistration'); + $this->excel->getActiveSheet()->setCellValue('H1', 'TIN'); + $this->excel->getActiveSheet()->setCellValue('I1', 'PAN'); + $this->excel->getActiveSheet()->setCellValue('J1', 'CSTNO'); + $this->excel->getActiveSheet()->setCellValue('K1', 'CST Date'); + $this->excel->getActiveSheet()->setCellValue('L1', 'GST NO'); + $this->excel->getActiveSheet()->setCellValue('M1', 'GST Range'); + $this->excel->getActiveSheet()->setCellValue('N1', 'Collectrate Address'); + $this->excel->getActiveSheet()->setCellValue('O1', 'UANumber'); + $this->excel->getActiveSheet()->setCellValue('P1', 'PaymentTerms'); + $this->excel->getActiveSheet()->setCellValue('Q1', 'PaymentDays'); + $this->excel->getActiveSheet()->setCellValue('R1', 'PayableAT'); + $this->excel->getActiveSheet()->setCellValue('S1', 'Createdby'); + $this->excel->getActiveSheet()->setCellValue('T1', 'UpdatedBy'); + $this->excel->getActiveSheet()->setCellValue('U1', 'IsActive'); + + + + + $this->excel->getActiveSheet()->getStyle('A1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('B1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('B1')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('C1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('C1')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('D1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('D1')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('E1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('E1')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('F1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('F1')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('G1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('G1')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('H1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('H1')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('I1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('I1')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('J1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('J1')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('K1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('K1')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('L1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('L1')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('M1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('M1')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('N1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('N1')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('O1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('O1')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('P1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('P1')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('Q1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('Q1')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('R1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('R1')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('S1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('S1')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('T1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('T1')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('U1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('U1')->getFont()->setBold(true); + + + $exportData = $this->supplier_model->export_excel(); + + if ($exportData) { + $i = 2; + $s = 1; + foreach ($exportData as $data) { + + $this->excel->getActiveSheet()->setCellValue('A' . $i,$data['DepartmentID']); + $this->excel->getActiveSheet()->setCellValue('B' . $i,$data['SupplierName']); + $this->excel->getActiveSheet()->setCellValue('C' . $i,$data['Address']); + $this->excel->getActiveSheet()->setCellValue('D' . $i,$data['ContactNumber']); + $this->excel->getActiveSheet()->setCellValue('E' . $i,$data['AlternateContactNumber']); + $this->excel->getActiveSheet()->setCellValue('F' . $i,$data['EmailAddress']); + $this->excel->getActiveSheet()->setCellValue('G' . $i,$data['Exiseregistration']); + $this->excel->getActiveSheet()->setCellValue('H' . $i,$data['TIN']); + $this->excel->getActiveSheet()->setCellValue('I' . $i,$data['PAN']); + $this->excel->getActiveSheet()->setCellValue('J' . $i,$data['CSTNO']); + $this->excel->getActiveSheet()->setCellValue('K' . $i,$data['CSTDate']); + $this->excel->getActiveSheet()->setCellValue('L' . $i,$data['GSTNO']); + $this->excel->getActiveSheet()->setCellValue('M' . $i,$data['GSTRange']); + $this->excel->getActiveSheet()->setCellValue('N' . $i,$data['CollectrateAddress']); + $this->excel->getActiveSheet()->setCellValue('O' . $i,$data['UANumber']); + $this->excel->getActiveSheet()->setCellValue('P' . $i,$data['PaymentTerms']); + $this->excel->getActiveSheet()->setCellValue('Q' . $i,$data['PaymentDays']); + $this->excel->getActiveSheet()->setCellValue('R' . $i,$data['PayableAT']); + $this->excel->getActiveSheet()->setCellValue('S' . $i,$data['firstname']); + $this->excel->getActiveSheet()->setCellValue('T' . $i,$data['Update_by']); + $this->excel->getActiveSheet()->setCellValue('U' . $i,$data['IsActive']); + + + + + + $i++; + $s++; + } + } + + $filename = 'supplierdetails' .' '. '.xls'; //save our workbook as this file name + header('Content-Type: application/vnd.ms-excel'); //mime type + header('Content-Disposition: attachment;filename="' . $filename . '"'); //tell browser what's the file name + header('Cache-Control: max-age=0'); //no cache + $objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'Excel5'); + if (ob_get_contents()) ob_end_clean(); + ob_start(); + $objWriter->save('php://output'); + + + } + + + function pageNotFound() + { + $this->global['pageTitle'] = 'Siddharth : 404 - Page Not Found'; + + $this->loadViews("404", $this->global, NULL, NULL); + } + +} +?> \ No newline at end of file