From 633dc1011dcf9a073ad9c71c5671b72202d05774 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Fri, 10 May 2024 09:36:19 +0000 Subject: [PATCH] FIX_Export XL ui And Login page : ps --- .env | 2 +- app/Config/Autoload.php | 2 +- app/Config/Routes.php | 8 +- app/Controllers/Assetdetails.php | 66 ++++++++++++ app/Controllers/CostCenter.php | 76 ++++++++++++++ app/Controllers/Department.php | 57 ++++++++++ app/Controllers/Employeedetails.php | 138 ++++++++++++++++++++++++- app/Controllers/Rawmaterialdetails.php | 92 ++++++++++++++++- app/Controllers/Supplier.php | 94 ++++++++++++----- app/Helpers/alert_helper.php | 49 +++++++++ app/Models/Assetdetails_model.php | 2 +- app/Models/Supplier_model.php | 14 +-- app/Views/POlist.php | 26 ++--- app/Views/assetListing.php | 2 +- app/Views/costListing.php | 2 +- app/Views/departmentListing.php | 2 +- app/Views/employeeListing.php | 28 ++--- app/Views/includes/header.php | 43 ++++++++ app/Views/login.php | 33 +++++- app/Views/rawmaterialListing.php | 28 ++--- app/Views/supplierListing.php | 26 ++--- app/Views/userListing.php | 28 ++--- composer.json | 1 + public/assets/images/bg.jpg | Bin 0 -> 1211316 bytes 24 files changed, 692 insertions(+), 127 deletions(-) create mode 100755 app/Helpers/alert_helper.php create mode 100644 public/assets/images/bg.jpg diff --git a/.env b/.env index b95522e1..8d761e49 100755 --- a/.env +++ b/.env @@ -20,7 +20,7 @@ CI_ENVIRONMENT = development # APP #-------------------------------------------------------------------- -# app.baseURL = '' +app.baseURL = 'http://localhost/ria/' # If you have trouble with `.`, you could also use `_`. # app_baseURL = '' # app.forceGlobalSecureRequests = false diff --git a/app/Config/Autoload.php b/app/Config/Autoload.php index 22249268..c89dfd5a 100644 --- a/app/Config/Autoload.php +++ b/app/Config/Autoload.php @@ -90,5 +90,5 @@ class Autoload extends AutoloadConfig * * @var list */ - public $helpers = ['datetime','cias','purchaseorder']; + public $helpers = ['datetime','cias','purchaseorder','alert']; } diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 16728a75..670f66f9 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -46,6 +46,7 @@ $routes->post('addNewsupplier', 'Supplier::savesupplierdetails'); // update supp $routes->post('supplierExist','Supplier::checksupplier'); $routes->post('supplierGSTExist','Supplier::checkGST'); $routes->post('supplierPANExist','Supplier::checkPAN'); +$routes->get('exportsupplier','Supplier::exportsupplier'); // export supplier details @@ -58,6 +59,7 @@ $routes->match(['get', 'post', 'put', 'delete'],'rawmaterialListing/(:num)', 'Ra $routes->post('materialExist','Rawmaterialdetails::checkmaterial'); $routes->get('viewRawmaterial','Rawmaterialdetails::viewRawmaterial'); $routes->post('rawmaterialdetails/editRawmaterial', 'Rawmaterialdetails::editRawmaterial'); +$routes->get('exportmaterial' , 'Rawmaterialdetails::exportmaterial'); // Cost Center Routes $routes->get('costListing', 'CostCenter::index'); @@ -70,6 +72,7 @@ $routes->post('CostCenter/DeleteCostDepartment','CostCenter::DeleteCostDepartmen $routes->match(['get', 'post', 'put', 'delete'],'CostCenter/GetBudgetForYear','CostCenter::GetBudgetForYear'); $routes->match(['get', 'post', 'put', 'delete'],'deletecost', 'CostCenter::deletecost'); +$routes->get('exportcost', 'CostCenter::exportcost'); // Asset Detail Routes $routes->get('assetListing', 'Assetdetails::assetListing'); @@ -77,13 +80,15 @@ $routes->get('addasset', 'Assetdetails::addasset'); $routes->match(['get', 'post', 'put', 'delete'],'editOldasset', 'Assetdetails::editasset'); $routes->match(['get', 'post', 'put', 'delete'],'editOldasset/(:num)', 'Assetdetails::editasset/$1'); $routes->match(['get', 'post', 'put', 'delete'],'editasset', 'Assetdetails::editasset'); +$routes->get('exportasset', 'Assetdetails::exportasset'); // Employee Detail Routes $routes->add('addemployee', 'Employeedetails::addemployee'); $routes->post('addNewEmployee', 'Employeedetails::AddNewEmployee'); $routes->get('employeeListing', 'Employeedetails::index'); $routes->get('employeedetails/ViewEmployee', 'Employeedetails::ViewEmployee'); -$routes->Post('employeedetails/UpdateEmployee', 'Employeedetails::UpdateEmployee'); +$routes->post('employeedetails/UpdateEmployee', 'Employeedetails::UpdateEmployee'); +$routes->get('exportemployee','Employeedetails::exportemployee'); $routes->post('employeeEmailExist','Employeedetails::CheckEmail'); @@ -114,6 +119,7 @@ $routes->get('adddepartment', 'Department::adddepartment'); $routes->post('savedepartment', 'Department::savedepartment'); $routes->get('editOlddepartment', 'Department::viewdepartment'); $routes->post('editdepartment', 'Department::editdepartment'); +$routes->get('exportdepartment', 'Department::exportdepartment'); $routes->get('batchcard/getHistListing', 'Batchcard::getHistListing'); diff --git a/app/Controllers/Assetdetails.php b/app/Controllers/Assetdetails.php index e946b2f1..1061c11c 100644 --- a/app/Controllers/Assetdetails.php +++ b/app/Controllers/Assetdetails.php @@ -428,4 +428,70 @@ class Assetdetails extends BaseController } + function exportasset() + { + + $data = $this->assetdetails_model->export_excel(); + $file_name = 'Asset_details' .' '. '.xls'; + $spreadsheet = new Spreadsheet(); + $sheet = $spreadsheet->getActiveSheet(); + $sheet->mergeCells('G3:M3'); + $sheet->getStyle('G3')->getAlignment()->setHorizontal('center'); + $sheet->setTitle('Asset Details'); + + $headers = [ + 'G3' => 'RESICO Asset Details', + 'C5' => 'AssetCode', + 'D5' => 'AssetName', + 'E5' => 'AssetDescription', + 'F5' => 'DepartmentName', + 'G5' => 'Location', + 'H5' => 'PONO', + 'I5' => 'POLineItem', + 'J5' => 'MaterialName', + 'K5' => 'Quanity', + 'L5' => 'UserName', + 'M5' => 'SupplierName', + 'N5' => 'DateOfPurchase', + 'O5' => 'DateOfCommison', + 'P5' => 'AssetValue', + 'Q5' => 'AssetStatus', + 'R5' => 'IsActive', + 'S5' => 'Remarks', + 'T5' => 'CreatedBy', + 'U5' => 'UpdatedBy' + ]; + + foreach ($headers as $cell => $value) { + $sheet->setCellValue($cell, $value); + $sheet->getStyle($cell)->getFont()->setSize($cell == 'G3' ? 14 : 12); + $sheet->getStyle($cell)->getFont()->setBold(true); + } + + if($data){ + $row = 6; // Start from row 6 + foreach ($data as $d) { + $col = 'A'; // Start from column A + foreach ($d as $value) { + $sheet->setCellValue($col . $row, $value); + $col++; + } + $row++; + } + } + $writer = new Xlsx($spreadsheet); + $writer->save($file_name); + header("Content-Type: application/vnd.ms-excel"); + header('Content-Disposition: attachment; filename="' . basename($file_name) . '"'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + header('Content-Length:' . filesize($file_name)); + flush(); + readfile($file_name); + exit; + } + + + } diff --git a/app/Controllers/CostCenter.php b/app/Controllers/CostCenter.php index 26cb9a32..608c5323 100644 --- a/app/Controllers/CostCenter.php +++ b/app/Controllers/CostCenter.php @@ -8,6 +8,13 @@ use CodeIgniter\Validation\Exceptions\ValidationException; use App\Models\Costcenter_model; +use PhpOffice\PhpSpreadsheet\Spreadsheet; + +use PhpOffice\PhpSpreadsheet\Writer\Xlsx; + +use PhpOffice\PhpSpreadsheet\Style\Alignment; + + /** * Module : Cost Center * Cost Center Class to control all cost center related operations. @@ -399,4 +406,73 @@ class CostCenter extends BaseController //} } + function exportcost() + { + + $exportData = $this->costcenter_model->export_excel(); + $file_name = 'Cost_Master' .' '. '.xls'; //save our workbook as this file name + $spreadsheet = new Spreadsheet(); + $sheet = $spreadsheet->getActiveSheet(); + $sheet->mergeCells('B3:P3'); + $sheet->getStyle('G3')->getAlignment()->setHorizontal('center'); + $sheet->setTitle('Cost Master'); + + $headers = [ + 'G3'=>'RESICO Cost Master', + 'B5'=>'S.No','C5'=>'CostCenterCode','D5'=>'CostCenterName', + 'E5'=>'CAPITAL','F5'=>'REVENUE','G5'=>'IMPORT','H5'=>'SERVICE', + 'I5'=>'BudgetYear','J5'=>'DepartmentName','K5'=>'IsActive', + 'L5'=>'CreatedBy','M5'=>'UpdatedBy','N5'=>'IsApproved','O5'=>'ApprovedBy' + ]; + + foreach ($headers as $cell => $value) { + $sheet->setCellValue($cell, $value); + $sheet->getStyle($cell)->getFont()->setSize($cell == 'G3' ? 14 : 12); + $sheet->getStyle($cell)->getFont()->setBold(true); + } + + if($exportData){ + $i = 6;$s = 1; + foreach ($exportData as $data) { + $rowData = [ + 'B' . $i => $s, + 'C' . $i => $data['CostCenterCode'], + 'D' . $i => $data['CostCenterName'], + 'E' . $i => $data['capital'], + 'F' . $i => $data['revenue'], + 'G' . $i => $data['import'], + 'H' . $i => $data['service'], + 'I' . $i => $data['BudgetYear'], + 'J' . $i => $data['DepartmentName'], + 'K' . $i => $data['IsActive'], + //'K' . $i => $data['Remarks'], + 'L' . $i => $data['firstname'], + 'M' . $i => $data['Updated_By'], + 'N' . $i => $data['IsApproved'], + 'O' . $i => $data['firstname'] + ]; + + foreach ($rowData as $cell => $value) { + $this->excel->getActiveSheet()->setCellValue($cell, $value); + } + + $i++; + $s++; + } + + } + $writer = new Xlsx($spreadsheet); + $writer->save($file_name); + header("Content-Type: application/vnd.ms-excel"); + header('Content-Disposition: attachment; filename="' . basename($file_name) . '"'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + header('Content-Length:' . filesize($file_name)); + flush(); + readfile($file_name); + exit; + } + + } diff --git a/app/Controllers/Department.php b/app/Controllers/Department.php index 7bda6456..303c937a 100644 --- a/app/Controllers/Department.php +++ b/app/Controllers/Department.php @@ -8,6 +8,13 @@ use CodeIgniter\Validation\Exceptions\ValidationException; use App\Models\Department_model; +use PhpOffice\PhpSpreadsheet\Spreadsheet; + +use PhpOffice\PhpSpreadsheet\Writer\Xlsx; + +use PhpOffice\PhpSpreadsheet\Style\Alignment; + + /** * Module : Department * Department Class to control all department related operations. @@ -155,4 +162,54 @@ class Department extends BaseController $this->loadViews("editdepartment", $this->global, $data, NULL); } + function exportdepartment() + { + + + $exportData = $this->department_model->export_excel(); + $file_name = 'Department_Details' .' '. '.xls'; //save our workbook as this file name + $spreadsheet = new Spreadsheet(); + $sheet = $spreadsheet->getActiveSheet(); + $sheet->setTitle('Department Details'); + + $headers = [ + 'A1'=>'Department ID','B1'=>'Department Name','C1'=>'Head Deptment ID','D1'=>'Is Active','E1'=>'Created By','F1'=>'Created Date' + ]; + + foreach ($headers as $cell => $value) { + $sheet->setCellValue($cell, $value); + $sheet->getStyle($cell)->getFont()->setSize(12); + $sheet->getStyle($cell)->getFont()->setBold(true); + } + + if($exportData){ + $i = 6; + foreach ($exportData as $data) { + $rowData = [ + 'A' . $i=>$data['DEPCode'], + 'B' . $i=>$data['DepartmentName'], + 'C' . $i=>$data['HeadDept'], + 'D' . $i=>$data['firstname'], + 'E' . $i=>$data['CreatedDt'], + 'F' . $i=>$data['IsActive'] + ]; + foreach ($rowData as $cell => $value) { + $this->excel->getActiveSheet()->setCellValue($cell, $value); + } + $i++; + } + + } + $writer = new Xlsx($spreadsheet); + $writer->save($file_name); + header("Content-Type: application/vnd.ms-excel"); + header('Content-Disposition: attachment; filename="' . basename($file_name) . '"'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + header('Content-Length:' . filesize($file_name)); + flush(); + readfile($file_name); + exit; + } } diff --git a/app/Controllers/Employeedetails.php b/app/Controllers/Employeedetails.php index e40e8ec4..5fb3e12a 100644 --- a/app/Controllers/Employeedetails.php +++ b/app/Controllers/Employeedetails.php @@ -10,6 +10,13 @@ use App\Models\Companydetails_model; use App\Models\Employeedetails_model; +use PhpOffice\PhpSpreadsheet\Spreadsheet; + +use PhpOffice\PhpSpreadsheet\Writer\Xlsx; + +use PhpOffice\PhpSpreadsheet\Style\Alignment; + + /** * Module : Employee * Employeedetails Class to control all employee related operations. @@ -703,4 +710,133 @@ class Employeedetails extends BaseController // } } -} + function exportemployee() + { + + $exportData = $this->employeedetails_model->export_excel(); + + $file_name = 'Employee_Details' .' '. '.xls'; //save our workbook as this file name + $spreadsheet = new Spreadsheet(); + $sheet = $spreadsheet->getActiveSheet(); + $sheet->mergeCells('L3:S3'); + $sheet->getStyle('L3')->getAlignment()->setHorizontal('center'); + $sheet->setTitle('Employee details'); + + $headers = [ + 'L3'=>'RESICO Employee Details', + 'A5'=>'EmpID', + 'B5'=>'FirstName-LastName', + 'C5'=>'FatherName', + 'D5'=>'Gender', + 'E5'=>'Date of Birth', + 'F5'=>'ContactNumber', + 'G5'=>'EmailId', + 'H5'=>'BloodGroup', + 'I5'=>'MartialStatus', + 'J5'=>'DateofJoining', + 'K5'=>'PreviousYearsOfExp', + 'L5'=>'Designation', + 'M5'=>'DepartmentName', + 'N5'=>'PresentAddress', + 'O5'=>'PermanentAddress', + 'P5'=>'EmergencyContactName', + 'Q5'=>'EmergencyContactNumber', + 'R5'=>'Edu_Qualification', + 'S5'=>'Additional_Qualification', + 'T5'=>'Reference_Name', + 'U5'=>'Reference_ContactNumber', + 'V5'=>'BankStatemant', + 'W5'=>'AadharNo', + 'X5'=>'PANNo', + 'Y5'=>'PassportNo', + 'Z5'=>'Passport_Valid_till', + 'AA5'=>'Voter ID', + 'AB5'=>'Driving License', + 'AC5'=>'Driving License Expiry Date', + 'AD5'=>'Official Email ID', + 'AE5'=>'IsActive', + 'AF5'=>'PFNO', + 'AG5'=>'ESI', + 'AH5'=>'Nominee Details', + // 'AI5'=>'PF_Balance', + // 'AJ5'=>'PF_Bal_On', + 'AI5'=>'Remarks', + 'AJ5'=>'CreatedBy', + 'AK5'=>'UpdatedBY' + ]; + + foreach ($headers as $cell => $value) { + $sheet->setCellValue($cell, $value); + $sheet->getStyle($cell)->getFont()->setSize($cell == 'L3' ? 14 : 12); + $sheet->getStyle($cell)->getFont()->setBold(true); + } + + if($exportData){ + $i = 6;$s = 1; + foreach ($exportData as $data) { + $rowData = [ + 'A'. $i,$data['EmpID'], + 'B'. $i=>$data['FirstName'].'-'.$data['LastName'], + 'C'. $i=>$data['FatherName'], + 'D'. $i=>$data['Gender'], + 'E'. $i=>$data['DateofBirth'], + 'F'. $i=>$data['ContactNumber'], + 'G'. $i=>$data['EmailId'], + 'H'. $i=>$data['BloodGroup'], + 'I'. $i=>$data['MartialStatus'], + 'J'. $i=>$data['DateofJoining'], + 'K'. $i=>$data['PreviousYearsOfExp'], + 'L'. $i=>$data['Designation'], + 'M'. $i=>$data['DepartmentName'], + 'N'. $i=>$data['PresentAddress'], + 'O'. $i=>$data['PermanentAddress'], + 'P'. $i=>$data['EmergencyContactName'], + 'Q'. $i=>$data['EmergencyContactNumber'], + 'R'. $i=>$data['Edu_Qualification'], + 'S'. $i=>$data['Additional_Qualification'], + 'T'. $i=>$data['Reference_Name'], + 'U'. $i=>$data['Reference_ContactNumber'], + 'V'. $i=>$data['BankAccountNo'].'-'.$data['IFSCCode'].'-'.$data['BankBranchName'].$data['BankAddress'], + 'W'. $i=>$data['AadharNo'], + 'X'. $i=>$data['PANNo'], + 'Y'. $i=>$data['PassportNo'], + 'Z'. $i=>$data['Passport_Valid_till'], + 'AA'. $i=>$data['VoterID'], + 'AB'. $i=>$data['DriverLicense'], + 'AC'. $i=>$data['LicenseValidtill'], + 'AD'. $i=>$data['personalEmailId'], + 'AE'. $i=>$data['IsActive'], + 'AF'. $i=>$data['PFNO'], + 'AG'. $i=>$data['ESI'], + 'AH'. $i=>$data['NomineeDetails'], + // 'AI'. $i=>$data['PF_Balance'], + // 'AJ'. $i=>$data['PF_Bal_On'], + 'AI'. $i=>$data['Remarks'], + 'AJ'. $i=>$data['CreatedByName'], + 'AK'. $i=>$data['UpdatedByName'], + ]; + + foreach ($rowData as $cell => $value) { + $this->excel->getActiveSheet()->setCellValue($cell, $value); + } + + $i++; + $s++; + } + + } + $writer = new Xlsx($spreadsheet); + $writer->save($file_name); + header("Content-Type: application/vnd.ms-excel"); + header('Content-Disposition: attachment; filename="' . basename($file_name) . '"'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + header('Content-Length:' . filesize($file_name)); + flush(); + readfile($file_name); + exit; + } + + + } diff --git a/app/Controllers/Rawmaterialdetails.php b/app/Controllers/Rawmaterialdetails.php index 756bde78..ba212177 100644 --- a/app/Controllers/Rawmaterialdetails.php +++ b/app/Controllers/Rawmaterialdetails.php @@ -8,6 +8,13 @@ use CodeIgniter\Validation\Exceptions\ValidationException; use App\Models\Rawmaterialdetails_model; +use PhpOffice\PhpSpreadsheet\Spreadsheet; + +use PhpOffice\PhpSpreadsheet\Writer\Xlsx; + +use PhpOffice\PhpSpreadsheet\Style\Alignment; + + /** * Module : Material Master details * Rawmaterialdetails Class to control all Rawmaterialdetails related operations. @@ -335,4 +342,87 @@ class Rawmaterialdetails extends BaseController // echo json_encode($query); //} } -} + + function exportmaterial() + { + + $exportData = $this->rawmaterialdetails_model->export_excel(); + + $file_name = 'MaterialMaster' .' '. '.xls'; //save our workbook as this file name + $spreadsheet = new Spreadsheet(); + $sheet = $spreadsheet->getActiveSheet(); + $sheet->mergeCells('F3:M3'); + $sheet->getStyle('F3')->getAlignment()->setHorizontal('center'); + $sheet->setTitle('Material Master'); + + $headers = [ + 'F3'=>'RESICO Material Master', + 'C5'=>'MaterialCode', + 'D5'=>'MaterialName', + 'E5'=>'MaterialType', + 'F5'=>'UOM', + 'G5'=>'RMCode', + 'H5'=>'Category', + 'I5'=>'assetcode', + 'J5'=>'CostCenterCode', + 'K5'=>'ConversionFactorUnit', + 'L5'=>'ConversionFactorUOM', + 'M5'=>'HSNCode', + 'N5'=>'Remarks', + 'O5'=>'Created by', + 'P5'=>'Updated By', + 'Q5'=>'IsActive' + ]; + + foreach ($headers as $cell => $value) { + $sheet->setCellValue($cell, $value); + $sheet->getStyle($cell)->getFont()->setSize($cell == 'F3' ? 14 : 12); + $sheet->getStyle($cell)->getFont()->setBold(true); + } + + if($exportData){ + $i = 6;$s = 1; + foreach ($exportData as $data) { + $rowData = [ + 'C' . $i=>$data['MaterialCode'], + 'D' . $i=>$data['MaterialName'], + 'E' . $i=>$data['MaterialType'], + 'F' . $i=>$data['UOM'], + 'G' . $i=>$data['RMCode'], + 'H' . $i=>$data['Category'], + 'I' . $i=>$data['assetcode'], + 'J' . $i=>$data['CostCenterCode'], + 'K' . $i=>$data['ConversionFactorUnit'], + 'L' . $i=>$data['ConversionFactorUOM'], + 'M' . $i=>$data['HSNCODE'], + 'N' . $i=>$data['Remarks'], + 'O' . $i=>$data['firstname'], + 'P' . $i=>$data['Updated_By'], + 'Q' . $i=>$data['IsActive'] + ]; + + foreach ($rowData as $cell => $value) { + $this->excel->getActiveSheet()->setCellValue($cell, $value); + } + + $i++; + $s++; + } + + } + $writer = new Xlsx($spreadsheet); + $writer->save($file_name); + header("Content-Type: application/vnd.ms-excel"); + header('Content-Disposition: attachment; filename="' . basename($file_name) . '"'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + header('Content-Length:' . filesize($file_name)); + flush(); + readfile($file_name); + exit; + } + + + } + diff --git a/app/Controllers/Supplier.php b/app/Controllers/Supplier.php index 52e55479..c106b7a4 100644 --- a/app/Controllers/Supplier.php +++ b/app/Controllers/Supplier.php @@ -6,30 +6,15 @@ use App\Controllers\BaseController; use CodeIgniter\Validation\Exceptions\ValidationException; -use App\Models\Assetdetails_model; -use App\Models\Batchcard_model; -use App\Models\Cashbook_model; -use App\Models\Companydetails_model; -use App\Models\Config_model; -use App\Models\Costcenter_model; -use App\Models\Dashboard_Model; -use App\Models\Department_model; -use App\Models\Employeedetails_model; -use App\Models\Emppaydate_model; -use App\Models\Inwardgateregister_model; -use App\Models\Login_model; -use App\Models\Monthlypay_model; -use App\Models\Mrir_model; -use App\Models\Payroll_model; -use App\Models\Purchaseorder_model; -use App\Models\Quality_model; -use App\Models\Rawmaterialdetails_model; -use App\Models\Requistion_model; -use App\Models\Store_model; -use App\Models\Storerequistion_model; use App\Models\Supplier_model; -use App\Models\User_model; -use App\Models\Zohobook_api_model; + +use PhpOffice\PhpSpreadsheet\Spreadsheet; + +use PhpOffice\PhpSpreadsheet\Writer\Xlsx; + +use PhpOffice\PhpSpreadsheet\Style\Alignment; + + /** * Module : Supplier @@ -53,7 +38,6 @@ class Supplier extends BaseController $this->session = session(); helper('form'); //$this->load->library('form_validation'); // $this->load->library('pagination'); - // $this->load->library('Excel'); $this->isLoggedIn(); } @@ -324,4 +308,66 @@ class Supplier extends BaseController } + function exportsupplier() + { + + $data = $this->supplier_model->export_excel(); + $file_name = 'Supplierdetails.xls'; + $spreadsheet = new Spreadsheet(); + $sheet = $spreadsheet->getActiveSheet(); + $sheet->mergeCells('B3:P3'); + $sheet->getStyle('B3')->getAlignment()->setHorizontal('center'); + $sheet->setTitle('Supplier details'); + + $headers = [ + 'B3' => 'RESICO Supplier Details', + 'A5' => 'SupplierID', + 'B5' => 'SupplierName', + 'C5' => 'Address', + 'D5' => 'ContactNumber', + 'E5' => 'AlternateContactNumber', + 'F5' => 'EmailAddress', + 'G5' => 'PAN', + 'H5' => 'GST NO', + 'I5' => 'MSME NO', + 'J5' => 'BankStatemant', + 'K5' => 'PaymentTerms', + 'L5' => 'IsService', + 'M5' => 'IsMaintanance', + 'N5' => 'IsRawMaterial', + 'O5' => 'CreatedBy', + 'P5' => 'UpdatedBy', + 'Q5' => 'IsActive' + ]; + + foreach ($headers as $cell => $value) { + $sheet->setCellValue($cell, $value); + $sheet->getStyle($cell)->getFont()->setSize($cell == 'B3' ? 14 : 12); + $sheet->getStyle($cell)->getFont()->setBold(true); + } + + if($data){ + $row = 6; // Start from row 6 + foreach ($data as $d) { + $col = 'A'; // Start from column A + foreach ($d as $value) { + $sheet->setCellValue($col . $row, $value); + $col++; + } + $row++; + } + } + $writer = new Xlsx($spreadsheet); + $writer->save($file_name); + header("Content-Type: application/vnd.ms-excel"); + header('Content-Disposition: attachment; filename="' . basename($file_name) . '"'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + header('Content-Length:' . filesize($file_name)); + flush(); + readfile($file_name); + exit; + } + } \ No newline at end of file diff --git a/app/Helpers/alert_helper.php b/app/Helpers/alert_helper.php new file mode 100755 index 00000000..6dc9a438 --- /dev/null +++ b/app/Helpers/alert_helper.php @@ -0,0 +1,49 @@ +  '; + $class = ' alert-success'; + break; + case 'warning': + $icon = '  '; + $class = ' alert-danger'; + break; + case 'danger': + $icon = '  '; + $class = ' alert-danger'; + break; + case 'info': + $icon = '  '; + $class = ' alert-info'; + break; + case 'error': + $icon = '  '; + $class = ' alert-error '; + break; + case 'question' : + $icon = '  '; + $class = ' alert-info'; + break; + default: + $icon = '  '; + $class = ' alert-info'; + break; + } + + $html = ' +
+
+ ' . $icon . ' + + ' . $content . ' +
+
'; + + return $html; + } +} \ No newline at end of file diff --git a/app/Models/Assetdetails_model.php b/app/Models/Assetdetails_model.php index c20a9044..b04711f1 100644 --- a/app/Models/Assetdetails_model.php +++ b/app/Models/Assetdetails_model.php @@ -254,7 +254,7 @@ class Assetdetails_model extends Model function export_excel() { $builder = $this->db->table('T_Asset_Details as det') - ->select('det.*,dep.DepartmentName as DEPCode,sup.SupplierName,MM.MaterialName,emp.firstname,emp1.firstname as Updated_By') + ->select('det.AssetCode,det.AssetName,det.Description,dep.DepartmentName as DEPCode,det.Location,det.PONO,det.POLineItem,MM.MaterialName,det.Quantity,det.UserName,sup.SupplierName,det.DateOfPurchase,det.DateOfCommison,det.AssetValue,det.AssetStatus,det.IsActive,det.Remarks,emp.firstname,emp1.firstname as Updated_By') ->join('tbl_users as tbl', ' det.createdby = tbl.userid', 'left') ->join('T_DepartmentDetails as dep', 'dep.DEPCode=det.DEPCode', 'left') ->join('T_Employee_Details as emp', 'emp.empid=tbl.empid', 'left') diff --git a/app/Models/Supplier_model.php b/app/Models/Supplier_model.php index 92ba8581..76434a03 100644 --- a/app/Models/Supplier_model.php +++ b/app/Models/Supplier_model.php @@ -170,19 +170,19 @@ class Supplier_model extends Model function export_excel() { - - $builder = $this->db->table('T_SupplierDetailsN as det') - ->select('det.SupplierID,SupplierName,det.Address,det.ContactNumber,det.AlternateContactNumber,det.EmailAddress,det.Exiseregistration,det.TIN, - det.PAN,det.CSTNO,det.CSTDate,det.GSTNO,det.GSTRange,det.CollectrateAddress,det.UANumber,pmt.PaymentTerms,emp.firstname ,emp1.firstname as Update_by,det.IsActive, - det.Cert_EMS,det.Cert_TS,det.Cert_OSHAS,det.Cert_ISO,det.Cert_IMS,det.BankAcNumber,det.IFSCCode,det.BranchName,det.BankAddress, - det.IsService,det.IsMaintanance,det.IsRawMaterial') + ->select('det.SupplierID,SupplierName,det.Address,det.ContactNumber,det.AlternateContactNumber,det.EmailAddress, + det.PAN,det.GSTNO,det.Cert_MSME, + CONCAT(det.BankAcNumber, "-", det.IFSCCode, "-", det.BranchName," ", det.BankAddress) AS ConcatenatedBankDetails, + pmt.PaymentTerms,det.IsService,det.IsMaintanance,det.IsRawMaterial,emp.firstname ,emp1.firstname as Update_by,det.IsActive') ->join('tbl_users as tbl', ' det.createdby = tbl.userid', 'left') ->join('T_Employee_Details as emp', 'emp.empid=tbl.empid', 'left') ->join('tbl_users as tbl1', ' det.UpdatedBy = tbl1.userid', 'left') ->join('T_Employee_Details as emp1', 'emp1.empid=tbl1.empid', 'left') ->join('T_PaymentTerms as pmt', 'pmt.PaymentID = det.PaymentID', 'left'); - return $$builder->get()->getResultArray(); + $query = $builder->get(); + + return $query->getResultArray(); } function checkSupplierExists($supp_name) diff --git a/app/Views/POlist.php b/app/Views/POlist.php index d7ff9f60..b9a31095 100644 --- a/app/Views/POlist.php +++ b/app/Views/POlist.php @@ -19,23 +19,17 @@
getFlashdata('error'); - if ($error) { + $error = session()->getFlashdata('error'); + if($error){ + $type = "error"; + echo show_alert($type, $error); + } + $success = session()->getFlashdata('success'); + if($success){ + $type = "success"; + echo show_alert($type, $success); + } ?> -
- - getFlashdata('error'); ?> -
- - getFlashdata('success'); - if ($success) { - ?> -
- - getFlashdata('success'); ?> -
-
diff --git a/app/Views/assetListing.php b/app/Views/assetListing.php index daa88820..60918318 100644 --- a/app/Views/assetListing.php +++ b/app/Views/assetListing.php @@ -11,7 +11,7 @@
diff --git a/app/Views/costListing.php b/app/Views/costListing.php index 862b7c38..7badaf3e 100644 --- a/app/Views/costListing.php +++ b/app/Views/costListing.php @@ -11,7 +11,7 @@
diff --git a/app/Views/departmentListing.php b/app/Views/departmentListing.php index 9cb83ad5..35871a20 100644 --- a/app/Views/departmentListing.php +++ b/app/Views/departmentListing.php @@ -49,7 +49,7 @@
diff --git a/app/Views/employeeListing.php b/app/Views/employeeListing.php index 4f7908fe..59dc4636 100644 --- a/app/Views/employeeListing.php +++ b/app/Views/employeeListing.php @@ -4,25 +4,19 @@
- getFlashdata('error'); - if ($error) { + if($error){ + $type = "error"; + echo show_alert($type, $error); + } + $success = session()->getFlashdata('success'); + if($success){ + $type = "success"; + echo show_alert($type, $success); + } ?> -
- - getFlashdata('error'); ?> -
- - getFlashdata('success'); - if ($success) { - ?> -
- - getFlashdata('success'); ?> -
-
@@ -40,7 +34,7 @@ diff --git a/app/Views/includes/header.php b/app/Views/includes/header.php index b07e2765..31ccad8f 100644 --- a/app/Views/includes/header.php +++ b/app/Views/includes/header.php @@ -86,6 +86,14 @@ -->