siddharth_application/application/controllers/report.php
2017-08-09 18:18:47 +05:30

554 lines
21 KiB
PHP
Executable File

<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
require APPPATH . '/libraries/BaseController.php';
/**
* Class : Inward Gate Register Controller (security)
* User Class to control all user related operations.
* @author : Saravana kumar
* @version : 1.1
* @since : 10 Jun 2017
*/
class report extends BaseController
{
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->load->model('dahsboard_Model');
$this->isLoggedIn();
}
public function pending_report()
{
$this->global['pageTitle'] = 'Siddharth : Reports';
$data['pending_list']=$this->dahsboard_Model->req_list();
$this->loadviews("report_pendingreqst",$this->global,$data, NULL);
}
public function releasedPO()
{
$this->global['pageTitle'] = 'Siddharth : Reports';
$data['rel_po']=$this->dahsboard_Model->report_relpo();
$this->loadviews("Report_POreleased",$this->global,$data, NULL);
}
public function openorderPO()
{
$this->global['pageTitle'] = 'Siddharth : Reports';
$data['open_po']=$this->dahsboard_Model->report_openpending();
$this->loadviews("Report_openorder",$this->global,$data, NULL);
}
public function TotalOrd()
{
$this->global['pageTitle'] = 'Siddharth : Reports';
$data['Total']=$this->dahsboard_Model->report_total();
$this->loadviews("Report_totalorders",$this->global,$data, NULL);
}
public function ccr()
{
$this->global['pageTitle'] = 'Siddharth : Reports';
$data['ccrpt']=$this->dahsboard_Model->report_ccr();
$this->loadviews("Report_costcenter",$this->global,$data, NULL);
}
function export_pending(){
$this->load->library('excel');
$this->excel->setActiveSheetIndex(0)->mergeCells('G3:M3');
//$this->excel->setActiveSheetIndex(0)->getStyle('G3')->getAlignment()->applyFromArray(
array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,);
//);
$this->excel->getActiveSheet()->setTitle('Pending Details');
$this->excel->getActiveSheet()->setCellValue('G3', 'SIDDHARTH INDUSTRIES Pending Details');
$this->excel->getActiveSheet()->setCellValue('F5', 'S.No');
$this->excel->getActiveSheet()->setCellValue('G5', 'Request Date');
$this->excel->getActiveSheet()->setCellValue('H5', 'Request Number');
$this->excel->getActiveSheet()->setCellValue('I5', 'Requestedby');
$this->excel->getActiveSheet()->setCellValue('J5', 'DepartmentName');
$this->excel->getActiveSheet()->setCellValue('K5', 'Request Type');
$this->excel->getActiveSheet()->setCellValue('L5', 'Aging');
$this->excel->getActiveSheet()->getStyle('G3')->getFont()->setSize(14);
$this->excel->getActiveSheet()->getStyle('G3')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('F5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('F5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('G5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('G5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('H5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('H5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('I5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('I5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('J5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('J5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('K5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('K5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('L5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('L5')->getFont()->setBold(true);
$exportData = $this->dahsboard_Model->export_reqlist();
if ($exportData) {
$i = 6;
$s = 1;
foreach ($exportData as $data) {
//print_r($data);die();
$this->excel->getActiveSheet()->setCellValue('F'. $i,$s);
$this->excel->getActiveSheet()->setCellValue('G'. $i,$data->ReqDate);
$this->excel->getActiveSheet()->setCellValue('H'. $i,$data->ReqNo);
$this->excel->getActiveSheet()->setCellValue('I'. $i,$data->Requestedby);
$this->excel->getActiveSheet()->setCellValue('J'. $i,$data->DepartmentName);
$this->excel->getActiveSheet()->setCellValue('K'. $i,$data->ReqType);
$this->excel->getActiveSheet()->setCellValue('L'. $i,$data->Aging);
$i++;
$s++;
}
}
$filename = 'Pending_details' .' '. '.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 export_relPO(){
$this->load->library('excel');
$this->excel->setActiveSheetIndex(0)->mergeCells('G3:M3');
//$this->excel->setActiveSheetIndex(0)->getStyle('G3')->getAlignment()->applyFromArray(
array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,);
//);
$this->excel->getActiveSheet()->setTitle('Released PO Details');
$this->excel->getActiveSheet()->setCellValue('G3', 'SIDDHARTH INDUSTRIES Released PO Details');
$this->excel->getActiveSheet()->setCellValue('F5', 'S.No');
$this->excel->getActiveSheet()->setCellValue('G5', 'PONO');
$this->excel->getActiveSheet()->setCellValue('H5', 'POType');
$this->excel->getActiveSheet()->setCellValue('I5', 'CreatedDate');
$this->excel->getActiveSheet()->setCellValue('J5', 'ReleasedDate');
$this->excel->getActiveSheet()->setCellValue('K5', 'Requested Department');
$this->excel->getActiveSheet()->setCellValue('L5', 'TotalOrderValue');
$this->excel->getActiveSheet()->getStyle('G3')->getFont()->setSize(14);
$this->excel->getActiveSheet()->getStyle('G3')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('F5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('F5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('G5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('G5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('H5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('H5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('I5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('I5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('J5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('J5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('K5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('K5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('L5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('L5')->getFont()->setBold(true);
$exportData = $this->dahsboard_Model->export_relpo();
if ($exportData) {
$i = 6;
$s = 1;
foreach ($exportData as $data) {
//print_r($data);die();
$this->excel->getActiveSheet()->setCellValue('F'. $i,$s);
$this->excel->getActiveSheet()->setCellValue('G'. $i,$data->PONO);
$this->excel->getActiveSheet()->setCellValue('H'. $i,$data->POType);
$this->excel->getActiveSheet()->setCellValue('I'. $i,$data->CreatedDate);
$this->excel->getActiveSheet()->setCellValue('J'. $i,$data->ReleasedDate);
$this->excel->getActiveSheet()->setCellValue('K'. $i,$data->Dept_Name);
$this->excel->getActiveSheet()->setCellValue('L'. $i,$data->TotalOrderValue);
$i++;
$s++;
}
}
$filename = 'ReleasedPO_details' .' '. '.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 export_openorder(){
$this->load->library('excel');
$this->excel->setActiveSheetIndex(0)->mergeCells('G3:M3');
//$this->excel->setActiveSheetIndex(0)->getStyle('G3')->getAlignment()->applyFromArray(
array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,);
//);
$this->excel->getActiveSheet()->setTitle('Pending PO Details');
$this->excel->getActiveSheet()->setCellValue('G3', 'SIDDHARTH INDUSTRIES OpenOrder Pending Details');
$this->excel->getActiveSheet()->setCellValue('F5', 'S.No');
$this->excel->getActiveSheet()->setCellValue('G5', 'PONO');
$this->excel->getActiveSheet()->setCellValue('H5', 'POType');
$this->excel->getActiveSheet()->setCellValue('I5', 'CreatedDate');
$this->excel->getActiveSheet()->setCellValue('J5', 'ApprovedDate');
$this->excel->getActiveSheet()->setCellValue('K5', 'Requested Department');
$this->excel->getActiveSheet()->setCellValue('L5', 'TotalOrderValue');
$this->excel->getActiveSheet()->getStyle('G3')->getFont()->setSize(14);
$this->excel->getActiveSheet()->getStyle('G3')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('F5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('F5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('G5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('G5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('H5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('H5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('I5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('I5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('J5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('J5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('K5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('K5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('L5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('L5')->getFont()->setBold(true);
$exportData = $this->dahsboard_Model->export_openorder();
if ($exportData) {
$i = 6;
$s = 1;
foreach ($exportData as $data) {
//print_r($data);die();
$this->excel->getActiveSheet()->setCellValue('F'. $i,$s);
$this->excel->getActiveSheet()->setCellValue('G'. $i,$data->PONO);
$this->excel->getActiveSheet()->setCellValue('H'. $i,$data->POType);
$this->excel->getActiveSheet()->setCellValue('I'. $i,$data->CreatedDate);
$this->excel->getActiveSheet()->setCellValue('J'. $i,$data->ApprovedDate);
$this->excel->getActiveSheet()->setCellValue('K'. $i,$data->Dept_Name);
$this->excel->getActiveSheet()->setCellValue('L'. $i,$data->TotalOrderValue);
$i++;
$s++;
}
}
$filename = 'OpenOrder_details' .' '. '.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 export_total(){
$this->load->library('excel');
$this->excel->setActiveSheetIndex(0)->mergeCells('G3:M3');
//$this->excel->setActiveSheetIndex(0)->getStyle('G3')->getAlignment()->applyFromArray(
array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,);
//);
$this->excel->getActiveSheet()->setTitle('Total Order Details');
$this->excel->getActiveSheet()->setCellValue('G3', 'SIDDHARTH INDUSTRIES Total Order Details');
$this->excel->getActiveSheet()->setCellValue('F5', 'S.No');
$this->excel->getActiveSheet()->setCellValue('G5', 'Department');
$this->excel->getActiveSheet()->setCellValue('H5', 'PO Created');
$this->excel->getActiveSheet()->setCellValue('I5', 'Approved');
$this->excel->getActiveSheet()->setCellValue('J5', 'OnHold');
$this->excel->getActiveSheet()->setCellValue('K5', 'Released');
$this->excel->getActiveSheet()->setCellValue('L5', 'IGR Created');
$this->excel->getActiveSheet()->setCellValue('M5', 'MRIR Approved');
$this->excel->getActiveSheet()->getStyle('G3')->getFont()->setSize(14);
$this->excel->getActiveSheet()->getStyle('G3')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('F5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('F5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('G5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('G5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('H5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('H5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('I5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('I5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('J5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('J5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('K5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('K5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('L5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('L5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('M5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('M5')->getFont()->setBold(true);
$exportData = $this->dahsboard_Model->export_total();
if ($exportData) {
$i = 6;
$s = 1;
foreach ($exportData as $data) {
//print_r($data);die();
$this->excel->getActiveSheet()->setCellValue('F'. $i,$s);
$this->excel->getActiveSheet()->setCellValue('G'. $i,$data->Dept_Name);
$this->excel->getActiveSheet()->setCellValue('H'. $i,$data->PO_Created);
$this->excel->getActiveSheet()->setCellValue('I'. $i,$data->Approved);
$this->excel->getActiveSheet()->setCellValue('J'. $i,$data->Onhold);
$this->excel->getActiveSheet()->setCellValue('K'. $i,$data->Released);
$this->excel->getActiveSheet()->setCellValue('L'. $i,$data->IGR_Created);
$this->excel->getActiveSheet()->setCellValue('M'. $i,$data->MRIR_Approved);
$i++;
$s++;
}
}
$filename = 'TotalOrder_details' .' '. '.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 export_ccr(){
$this->load->library('excel');
$this->excel->setActiveSheetIndex(0)->mergeCells('G3:M3');
//$this->excel->setActiveSheetIndex(0)->getStyle('G3')->getAlignment()->applyFromArray(
array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,);
//);
$this->excel->getActiveSheet()->setTitle('Cost Center Details');
$this->excel->getActiveSheet()->setCellValue('G3', 'SIDDHARTH INDUSTRIES Cost Center Details');
$this->excel->getActiveSheet()->setCellValue('F5', 'S.No');
$this->excel->getActiveSheet()->setCellValue('G5', 'Cost Center Code');
$this->excel->getActiveSheet()->setCellValue('H5', 'Cost Center Name');
$this->excel->getActiveSheet()->setCellValue('I5', 'Department');
$this->excel->getActiveSheet()->setCellValue('J5', 'Budet Type');
$this->excel->getActiveSheet()->setCellValue('K5', 'Budget Year');
$this->excel->getActiveSheet()->setCellValue('L5', 'Utilized Amount');
$this->excel->getActiveSheet()->setCellValue('M5', 'Balance Amount');
$this->excel->getActiveSheet()->getStyle('G3')->getFont()->setSize(14);
$this->excel->getActiveSheet()->getStyle('G3')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('F5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('F5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('G5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('G5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('H5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('H5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('I5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('I5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('J5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('J5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('K5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('K5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('L5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('L5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('M5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('M5')->getFont()->setBold(true);
$exportData = $this->dahsboard_Model->export_ccr();
if ($exportData) {
$i = 6;
$s = 1;
foreach ($exportData as $data) {
//print_r($data);die();
$this->excel->getActiveSheet()->setCellValue('F'. $i,$s);
$this->excel->getActiveSheet()->setCellValue('G'. $i,$data->Cost_Center_Code);
$this->excel->getActiveSheet()->setCellValue('H'. $i,$data->Cost_Center_Name);
$this->excel->getActiveSheet()->setCellValue('I'. $i,$data->Dept_Name);
$this->excel->getActiveSheet()->setCellValue('J'. $i,$data->BudgetType);
$this->excel->getActiveSheet()->setCellValue('K'. $i,$data->BudgetYear);
$this->excel->getActiveSheet()->setCellValue('L'. $i,$data->Util_Amount);
$this->excel->getActiveSheet()->setCellValue('M'. $i,$data->Avlbl_Amt);
$i++;
$s++;
}
}
$filename = 'Cost_Center_details' .' '. '.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');
}
}
?>