diff --git a/application/controllers/requisitionform.php b/application/controllers/requisitionform.php index 4edceba7..d0a247a2 100644 --- a/application/controllers/requisitionform.php +++ b/application/controllers/requisitionform.php @@ -19,9 +19,9 @@ class requisitionform extends BaseController parent::__construct(); $this->load->model('requistion_model'); - $this->load->library('session'); - $this->load->library('form_validation'); - $this->load->library('pagination'); + $this->load->library('session'); + $this->load->library('form_validation'); + $this->isLoggedIn(); } /** @@ -29,7 +29,7 @@ class requisitionform extends BaseController */ function requisitionlisting() { - $this->global['pageTitle'] = 'Siddharth : Requisition Listing'; + $this->global['pageTitle'] = 'Siddharth : Requisition Listing'; $userID = $this->session->userdata ( 'userId' ); @@ -60,6 +60,95 @@ class requisitionform extends BaseController $this->loadViews("requisitionform", $this->global, $data,null); } + /** + * This function used to load the first screen of the Requistion List Approval Screen + */ + function requisitionlistApproval() + { + $this->global['pageTitle'] = 'Siddharth : Requisition Approval'; + + $data['Status']= $this->requistion_model->getStatus(); + + $userID = $this->session->userdata ( 'userId' ); + + $data['AppList'] = $this->requistion_model->getApproverRequistList($userID); + + + + $this->loadViews("requisitionlistapproval", $this->global, $data, NULL); + } + + + /** + * This function used to load the Edit Requistion Form + */ + function EditRequistionForm() + { + $this->global['pageTitle'] = 'Siddharth : Edit Requisition'; + + $ReqNo= $_GET['ReqNo']; + $ReqType= $_GET['ReqType']; + //$data['Status']= $this->requistion_model->getStatus(); + // echo $ReqNo; + $userID = $this->session->userdata ( 'userId' ); + + $data['ReqDetails'] = $this->requistion_model->getRequistDetails($ReqNo,'Yes'); + $data['LineItem'] = $this->requistion_model->getRequistItemList($ReqNo,'Yes'); + $data['CostCenter'] = $this->requistion_model->getCostCenterUserID($userID); + $data['MaterialCode'] = $this->requistion_model->GetMaterialCode( $ReqType,'Yes'); + + $this->loadViews("editrequisitionform", $this->global, $data, NULL); + } + + + + function SearchRequistList() + { + $userID = $this->session->userdata ( 'userId' ); + $ReqValue = $this->input->post('SearchDate'); + + $Dt = explode("-",$ReqValue); + + $FromDate =''; + $ToDate = ''; + $Status= ''; + if(count( $Dt)>1) + { + $FDate = $Dt[0]."-".$Dt[1]."-".$Dt[2]; + $TDate = $Dt[3]."-".$Dt[4]."-".$Dt[5]; + $FromDate = $this->getDateformat($FDate); + $ToDate = $this->getDateformat($TDate); + } + + $St = $this->input->post('RequisitionStatus'); + + if($St == "-1") + { + $Status = ''; + } + else + { + $Status = $St; + } + + $data['AppList'] = $this->requistion_model->getApproverRequistList($userID,$Status,$FromDate, $ToDate); + + $this->global['pageTitle'] = 'Siddharth : Requisition Approval'; + + $data['Status']= $this->requistion_model->getStatus(); + + $this->loadViews("requisitionlistapproval", $this->global, $data, NULL); + + } + + + + function getDateformat($Val) + { + $date = new DateTime($Val); + $retDate = $date->format('Y-m-d H:i:s'); + return $retDate; + } /** * This function used to load the Employee details based on the EmpID selection */ @@ -113,9 +202,9 @@ class requisitionform extends BaseController function getMaterialCode() { - $ReqType= $this->input->post('id'); + $ReqType= $this->input->post('id'); - $MaterialCode = $this->requistion_model->GetMaterialCode( $ReqType); + $MaterialCode = $this->requistion_model->GetMaterialCode( $ReqType); $MaterialName = ""; $UOM = ""; $HTML = ""; @@ -240,14 +329,67 @@ class requisitionform extends BaseController } } - - function editrequisitionlisting() + +/* To Edit the request*/ + function ViewRequest() { - $this->global['pageTitle'] = 'Siddharth : Edit Requisition Listing'; - - $this->loadViews("editrequisitionform", $this->global, NULL); + $ReqNo= $this->input->post('id'); + $result = $this->requistion_model->getRequistItemList($ReqNo); + $ReqList = $this->requistion_model->getRequistDetails($ReqNo); + $DepNo = $ReqList[0]['DEPCode']; + $CostList = $this->requistion_model->GetCostCenterByDept($DepNo); + $HTML=""; + for ($i = 0; $i < count($result); $i++) + { + $SNo = $i + 1; + $MaterialCode = $result[$i]['MaterialCode']; + $MaterialName = $result[$i]['MaterialName']; + $UOM = $result[$i]['UOM']; + $Quantity = $result[$i]['Quantity']; + $HTML.="