siddharth_application/application/controllers/MRIRcontroller.php
venbatechnologies@gmail.com f7023852d4 I Update MIMR add screen
2017-07-05 18:27:10 +05:30

183 lines
5.6 KiB
PHP

<?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 MRIRcontroller extends BaseController
{
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$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
*/
// public function index()
// {
// $this->global['pageTitle'] = 'Siddharth : Material Inspetion Report';
//
// $this->loadViews("materialinspectionreport", $this->global, NULL , NULL);
// }
function materialinspectionreport($mrir='',$IGRNO='')
{
$this->global['pageTitle'] = 'Siddharth : Material Inspection Report';
$this->load->model('mrir_model');
$data['IGRNOonly'] = $this->mrir_model->getIGRNOonly();
$this->loadViews("materialinspectionreport", $this->global,$data,NULL);
}
/*FOR Displaying IGR Values in Materialinspection.php(view file) */
function igrdatavalues()
{
$IgrNo= $_GET['IGRNO'];
print_r($IgrNo);
$data['IGRDetails'] = $this->mrir_model->get_IGRs($IgrNo);
$this->global['pageTitle'] = 'Siddharth : IGR Details ';
$this->loadViews("materialinspectionreport", $this->global, $data,NULL);
}
/* FOR Edit MRIR Screen */
function editmaterialinspectionreport()
{
$this->global['pageTitle'] = 'Siddharth : Edit Material Inspection Report';
$this->load->model('mrir_model');
$data['IGRNOonly'] = $this->mrir_model->getIGRNOonly();
$this->loadViews("Editmaterialinspectionreport", $this->global,$data,NULL);
}
/* For View MRIR Screen*/
function viewmaterialinspectionreport()
{
$this->load->model('mrir_model');
$data['mrirdatas2'] = $this->mrir_model-> view_MRIR();
$this->global['pageTitle'] = 'Siddharth : View Material Inspection Report';
//print_r( $data);
$this->loadViews("viewmaterialinspectionreport", $this->global,$data,NULL);
}
/* For Values are Stored in DB */
function displaying_values()
{
$this->load->model('mrir_model');
$RowCount = $this->input->post('RowCount');
//echo $RowCount;
// get form variable
$igrno = $this->input->post('IGRNO');
$PONO = $this->input->post('PONO');
$CreatedBy = $this->session->userdata('userId');
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$createddt = $dt->format('Y-m-d H:i:s');
$Remark = $this->input->post('Remarks');
//this array to store the value in master table..
$mrirmastervalues = array('IGRNO'=>$igrno,'PONO'=>$PONO,'CreatedBy'=>$CreatedBy,'Createdon'=>$createddt);
$mrirmaster = $this->mrir_model->master_mrir($mrirmastervalues);
$MRIRNO = '';
if(count($mrirmaster)>0)
{
foreach ($mrirmaster as $key ) {
$MRIRNO=$key->MRIRNo; }
}
for ($i = 1; $i <= $RowCount; $i++)
{
$MaterialCode = $this->input->post('MaterialCode'.$i);
$ActualQuantityReceived = $this->input->post('ActualQuantity'.$i);
echo $ActualQuantityReceived;
$QuantityAsPerInvoice = $this->input->post('ReceivedQuantity'.$i);
$Remarked = $this->input->post('Remarks'.$i);
$StoreIncharge = $this->session->userdata('name');
$UpdatedBy = $this->session->userdata('userId');
//this array to store the value in master table..
$mrirdetailvalues = array('MRIRNO'=>$MRIRNO,'MaterialCode'=>$MaterialCode,'ActualQuantityReceived'=>$ActualQuantityReceived,'StoreInchargeID'=>$StoreIncharge,'Remarks'=>$Remarked,'UpdateBy'=>$UpdatedBy);
//print_r($mrirvalues2);
//die();
$mrirdetails = $this->mrir_model->detail_mrir($mrirdetailvalues);
}
echo "successfully created : ".$MRIRNO;
}
function displaying_MRIRvalues()
{
$mrir = $this->input->post("mrirno");
$result=$this->mrir_model->get_MRIRs($mrir);
$obj=json_encode($result);
echo $obj;
}
function displaying_IGRvalues()
{
$igr= $this->input->post("igrno");
$result=$this->mrir_model->get_IGRs($igr);
$obj = json_encode($result);
echo $obj;
}
function pageNotFound()
{
$this->global['pageTitle'] = 'Siddharth : 404 - Page Not Found';
$this->loadViews("404", $this->global, NULL, NULL);
}
}
?>