store requistions

This commit is contained in:
venbatechnologies 2017-07-05 17:48:21 +05:30
parent ef99e3b95d
commit 7d9f6ed5ea
13 changed files with 3774 additions and 0 deletions

View File

@ -95,6 +95,22 @@ define('PO_RELEASED', 'ST026');
define('PO_AWAITING_RELEASE', 'ST025');
define('PO_APPROVED', 'ST025');
/*store Status*/
define('STORE_DRAFT', 'ST014');
define('STORE_CREATED', 'ST015');
/*store requisition*/
define('STORE REQUISTION STATUS', '6');
define('STORE_OPEN', 'ST034');
define('STORE_PENDINGAPPROVAL', 'ST035');
define('STORE_APPROVAL', 'ST036');
define('STORE_ISSUSED', 'ST037');
define('STORE_ONHOLD', 'ST038');
define('STORE_REJECT', 'ST039');
/* Department Code */
define('ADMIN', 'DEP01');

View File

@ -0,0 +1,67 @@
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
require APPPATH . '/libraries/BaseController.php';
/**
* Class : Cost Center (Cost Center Controller)
* User Class to control all user related operations.
* @author : VenbaMail Mali
* @version : 1.1
* @since : 15 Feb 2016
*/
class storerequisition extends BaseController
{
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
//$this->load->model('monthlypay_model');
$this->load->library('session');
$this->load->library('form_validation');
// $this->load->library('pagination');
$this->isLoggedIn();
}
/**
* This function used to load the first screen of the user
*/
public function index()
{
//$this->global['pageTitle'] = 'Siddharth : storesrequisitionslip';
//$this->loadviews('storesrequisitionslip',$this->global);
}
function addstorerequisitionslip()
{
$this->global['pageTitle'] = 'Siddharth : Add Store Requisition';
$this->loadviews('addstorerequisitionslip',$this->global);
}
function storerequisitionlist()
{
$this->global['pageTitle'] = 'Siddharth : Store Requisition List';
$this->loadviews('storerequisitionlist',$this->global);
}
function storerequisitionlisting()
{
$this->global['pageTitle'] = 'Siddharth : Store Requisition Listing';
$this->loadviews('storerequisitionlisting',$this->global);
}
function approvalstorerequisition()
{
$this->global['pageTitle'] = 'Siddharth : Approval Store Requisition';
$this->loadviews('approvalstorerequisitionslip',$this->global);
}
function pageNotFound()
{
$this->global['pageTitle'] = 'Siddharth : 404 - Page Not Found';
$this->loadViews("404", $this->global, NULL, NULL);
}
}

View File

@ -0,0 +1,489 @@
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
require APPPATH . '/libraries/BaseController.php';
/**
* Class : Cost Center (Cost Center Controller)
* User Class to control all user related operations.
* @author : VenbaMail Mali
* @version : 1.1
* @since : 15 Feb 2016
*/
class storerequisitionlist extends BaseController
{
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->load->model('storerequistion_model');
$this->load->library('session');
$this->load->library('form_validation');
$this->isLoggedIn();
}
/*ADD Store requisition line item
*/
function addstores($userId='',$MaterialCode='')
{
$this->global['pageTitle'] = 'Siddharth : StoreRequisition Listing';
$this->load->model('storerequistion_model');
$userId= $this->session->userdata ('userId');
$data['DEPCode'] = $this->session->userdata('DEPCode');
$data['DepName'] = $this->session->userdata('DepartmentName');
//print_r($data['cost']);
$data['cost'] = $this->storerequistion_model->getCostUser($userId);
$data['MaterialList'] = $this->storerequistion_model->getRawMaterialList($MaterialCode);
//$data['Store'] = $this->storerequistion_model->Storeall($userId);
$this->loadViews("addstorerequisitionslip", $this->global,$data,null);
}
function addstore()
{
$this->global['pageTitle'] = 'Siddharth : StoreRequisition Listing';
//$this->load->model('storerequistion_model');
$userId= $this->session->userdata ('userId');
$data['Store'] = $this->storerequistion_model->Storeall($userId);
//print_r($data['Store']);
//echo "Check point form con";
$this->loadViews("storerequisition", $this->global,$data,null);
}
/**
* This function used to load the Delete the StoreRequistion Items
*/
function DeleteReqNo()
{
$StoreReqNo= $this->input->post('id');
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$updateddt = $dt->format('Y-m-d H:i:s');
$Request = array('Status'=>REQ_DELETED,'updatedOn'=>$updateddt);
$this->storerequistion_model->UpdateRequistion($StoreReqNo,$Request);
echo "Successfully Deleted the ".$StoreReqNo;
}
/* The Function Edit Store Requistion list */
function EditStoreRequistion($MaterialCode='')
{
$StoreReqNo = $_GET['StoreReqNo'];
//$StoreReqNo= $this->input->post('id');
$this->global['pageTitle'] = 'Siddharth : StoreRequisition Listing';
$this->load->model('storerequistion_model');
$data['cost'] = $this->storerequistion_model->editRequistDetails($StoreReqNo);
// print_r( $data);
$data['MaterialList'] = $this->storerequistion_model->getRawMaterialList($MaterialCode);
$data['DepName'] = $this->session->userdata('DepartmentName');
$data['LineItem']=$this ->storerequistion_model->editstorerequistions($StoreReqNo);
// $data['StoreReqNO'] = $StoreReqNo ;
//print_r($data['LineItem']);
$this->loadViews("editstorerequisition", $this->global,$data,null);
}
/**get the date formatted**/
function getDateformat($Val)
{
$date = new DateTime($Val);
$retDate = $date->format('Y-m-d H:i:s');
return $retDate;
}
/**This function is used to add new StoreRequestion to the system */
function addNewRequistion()
{
$Status= $_GET['ID'];
$Requestedby = $_GET['RequestedBy'];
$CostCenter = $_GET['CostCenter'];
$DEPCode = $_GET['DEPCode'];
$CreateBy = $this->session->userdata ( 'userId' );
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$createddt = $dt->format('Y-m-d H:i:s');
$DeletedRow = $this->input->post('txtDeletedRow');
$RowCount = $_GET['txtRowCount'];
//echo $RowCount; die();
$comma_separated = explode(':', $DeletedRow);
$IsExists = $this->storerequistion_model->RequistionIsExists($Requestedby);
if(count( $IsExists) == 0)
{
$Request = array( 'Requestedby'=>$Requestedby,'DepartmentCode'=>$DEPCode,'ReqDate'=>$createddt,'CostCenterCode'=>$CostCenter,'Status'=>$Status,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy);
//print_r($Request);
$Req = $this->storerequistion_model->addRequistion($Request);
foreach ($Req[0] as $value)
{
$StoreReqNo = $value;
}
//echo $StoreReqNo;
}
else
{
$Request = array('Requestedby'=>$Requestedby,'DepartmentCode'=>$DEPCode,'ReqDate'=>$createddt,'Status'=>$Status,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy,'CostCenterCode'=>$CostCenter);
$UpdateReq = $this->storerequistion_model->UpdateRequistion($Request,$IsExists[0]['StoreReqNo']);
}
$ReqNumber = '';
//print_r($RowCount);die();
if(count($Req)>0)
{
$ReqNumber = $Req[0]['StoreReqNo'];
//printf_r($ReqNumber);
}
else
{
$ReqNumber = $IsExists[0]['StoreReqNo'];
}
$SkipInsert = False;
for ($i = 1; $i <= $RowCount; $i++)
{
$MaterialCode = $this->input->post('MaterialCode'.$i);
$QuantityRequired=$this->input->post('Quantity'.$i);
$Remarks=$this->input->post('Remarks'.$i);
$Request = array('MaterialCode'=>$MaterialCode,'Status'=>$Status,'QuantityRequired'=>$QuantityRequired,'Remarks'=>$Remarks,'StoreReqNo'=>$value);
$addReq=$this->storerequistion_model->addstoreRequistion($Request);
$SkipInsert = "False";
if( count($comma_separated) > 0)
{
for($j = 1; $j < count($comma_separated); $j++)
{
$deletedRow = $comma_separated[$j] ;
if($deletedRow == $i )
{
$SkipInsert = "True";
break;
}
}
}
}
if($Status == STORE_DRAFT)
{
echo 'Successfully Saved the Store Requistion details';
}
else
{
echo 'Successfully Created the Store Requistion details';
}
}
function addstorerequisitionlist()
{
$this->global['pageTitle'] = 'Siddharth : StoreRequisition Listing';
$this->load->model('storerequistion_model');
$data['Status']= $this->storerequistion_model->getStatus();
$data['TotNoOfLine']=$this->storerequistion_model->getRequistionList();
//print_r($data['TotNoOfLine']);
$this->loadViews("storerequisitionlisting", $this->global,$data,null);
}
/* this function use to search StoreRequistlist*/
function SearchRequistLists()
{
$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('STORE REQUISTION STATUS');
if($St == "-1")
{
$Status = '';
}
else
{
$Status = $St;
}
$data['AppList'] = $this->storerequistion_model->getApproverRequistList($userID,$Status,$FromDate, $ToDate);
$this->global['pageTitle'] = 'Siddharth : ApprovalStoreRequisitionSlip';
$data['Status']= $this->storerequistion_model->getStatus();
$this->loadViews("approvalstorerequisitionslip", $this->global, $data, NULL);
}
/*Approve Completed*/
function ApproveRequest()
{
$Status= Trim($_GET['Status']);
//$StoreReqNo=$this->input->post('StoreReqNo');
$StoreReqNo = trim($this->input->post('id'));
$Remarks=trim($this->input->post('newcomments'));
$ApprovedBy = $this->session->userdata ( 'userId' );
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$ApprovedDate = $dt->format('Y-m-d H:i:s');
$Request = array('Status'=>$Status,'Comments'=>$Remarks,'ApprovedOn'=>$ApprovedDate,'Approvedby'=>$ApprovedBy);
$this->storerequistion_model->UpdateRequistion($StoreReqNo,$Request);
echo "Successfully Updated the Requistion No: ".$StoreReqNo;
}
/**
* This function used to load the first screen of the Requistion List Approval Screen
*/
function requisitionlistApproval()
{
$this->global['pageTitle'] = 'Siddharth :Approvalstorerequisitionlist';
//$data['Status']= $this->storerequistion_model->getStatus();
$userID = $this->session->userdata ( 'userId' );
$data['AppList'] = $this->storerequistion_model->getApproverRequistList($userID);
$this->loadViews("requisitionlistapproval", $this->global, $data, NULL);
}
/* To Edit the view store request*/
function ViewRequest()
{
$StoreReqNo= $this->input->post('id');
$result = $this->storerequistion_model->getRequistItemList($StoreReqNo);
$ReqList = $this->storerequistion_model->getRequistDetails($StoreReqNo);
$DepNo = $ReqList[0]['DepartmentName'];
//$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]['QuantityRequired'];
$Remarks= $result[$i]['Remarks'];
$HTML.="<tr id='".$i."'>
<td align='left'>".$SNo."</td>
<td align='left'>".$MaterialCode."</td>
<td align='left'>".$MaterialName."</td>
<td align='left'>".$UOM."</td>
<td align='left'>".$Quantity."</td>
<td align='left'>".$Remarks."</td>
</tr>";
//$index = $index + 1;
}
$CostCode = '';
$ReqType = '';
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$Year = $dt->format('Y');
if(count($ReqList)>0)
{
$ReqType = $ReqList[0]['Requestedby'];
$CostCode = $ReqList[0]['CostCenterName'];
//$AvlBudget=$ReqList[0]['CostCenterName'];
}
$AvlBudget = $this->storerequistion_model->GetAvailableBudgetAmount($CostCode,$Year,$ReqType);
//print_r($result);
$AvilBudAmt = '0';
if(count($AvlBudget)>0)
{
$AvilBudAmt = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue'];
}
//echo $AvilBudAmt;
die(json_encode(array('Items' =>$HTML,'Requist'=>$ReqList,'AvilBudAmount'=>number_format($AvilBudAmt,2))));
}
//not completed
function EditStoreRequisitions()
{
$StoreReqNo =$this->input->post('txtReqNo');
// echo $StoreReqNo;
$Status = $this->input->post('txtStatus');
$Requestedby = $this->input->post('RequestedBy');
$CostCenter = $this->input->post('CostCenter');
//echo $CostCenter;
$UpdatedBy = $this->session->userdata ('userId' );
//$ReqDate=$this->input->post('Date')
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$updatedDate = $dt->format('Y-m-d H:i:s');
$DEPCode = $_GET['DEPCode'];
$DeletedRow = $this->input->post('txtDeletedRow');
$RowCount = $this->input->post('txtRowCount');
//print_r($RowCount); die();
$comma_separated = explode(':', $DeletedRow);
if(strlen($Status) >1)
{
$Request = array('Requestedby'=>$Requestedby,'DepartmentCode'=>$DEPCode,'ReqDate'=>$updatedDate,'CostCenterCode'=>$CostCenter,'Status'=>$Status,'updatedOn'=>$updatedDate );
//print_r($Request); die();
$UpdateReq = $this->storerequistion_model->UpdateRequistion($StoreReqNo,$Request);
//echo"string"; die();
// foreach ($UpdateReq as $value)
// {
// $StoreReqNo = $value;
// }
}
$SkipInsert = False;
for ($i = 1; $i <= $RowCount; $i++)
{
//echo"hi";
$MaterialCode = $this->input->post('EditMaterialCode');
$QuantityRequired=$this->input->post('EditQuantity');
//echo"$QuantityRequired"; die();
$Remarks=$this->input->post('EditRemarks');
$Request = array('MaterialCode'=>$MaterialCode,'Status'=>$Status,'QuantityRequired'=>$QuantityRequired,'Remarks'=>$Remarks);
//print_r($Request);die();
$addReq = $this->storerequistion_model->addstoreRequistion($Request);
$SkipInsert = "False";
if(count($comma_separated) > 0)
{
for($j = 1; $j < count($comma_separated); $j++)
{
$deletedRow = $comma_separated[$j] ;
if($deletedRow == $i )
{
$SkipInsert = "True";
break;
}
}
}
if($SkipInsert == "False")
{
//echo "string"; die();
$MaterialCode = $this->input->post('EditMaterialCode'.$i);
echo"MaterialCode"; die();
$QuantityRequired=$this->input->post('Quantity'.$i);
$Remarks=$this->input->post('Remarks'.$i);
$Request = array('MaterialCode'=>$MaterialCode,'Status'=>$Status,'QuantityRequired'=>$QuantityRequired,'Remarks'=>$Remarks,'StoreReqNo'=>$StoreReqNo);
//print_r($Request);die();
$IsExists = $this->storerequistion_model->LineItemIsExists($StoreReqNo,$MaterialCode);
if(count( $IsExists) == 0)
{
$ReqDetails = array('StoreReqNo'=>$StoreReqNo, 'MaterialCode'=>$MaterialCode,'QuantityRequired'=>$QuantityRequired,'UpdatedBy'=>$UpdatedBy,'UpdatedOn'=>$updatedDate);
$this->storerequistion_model->addRequistionDetails($ReqDetails);
}
else
{
$ReqDetails = array('StoreReqNo'=>$StoreReqNo, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'UpdatedBy'=>$UpdatedBy,'UpdatedOn'=>$updatedDate);
$this->storerequistion_model->UpdateRequistionLineItem($ReqDetails,$StoreReqNo,$MaterialCode);
}
}
}
echo 'Successfully updated the Requistion details';
}
/**
* This function used to load the Delete the Requistion Items
*/
function DeleteRequistionForm()
{
$ReqList= $this->input->post('id');
$StoreReqNo ='';
$MaterialCode = '';
if(count($ReqList) > 0)
{
$StoreReqNo = $ReqList[0];
$MaterialCode = $ReqList[1];
}
$this->storerequistion_model->DeleteRequistionLineItem( $StoreReqNo,$MaterialCode);
echo "Successfully Deleted the Line item".$StoreReqNo;
}
}

0
application/controllers/storestatus.php Normal file → Executable file
View File

View File

@ -0,0 +1,117 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?>
ERROR - 2017-07-05 13:38:50 --> Severity: Notice --> Use of undefined constant STORE_REJECT - assumed 'STORE_REJECT' /opt/lampp/htdocs/siddharth_application/application/models/storerequistion_model.php 283
ERROR - 2017-07-05 13:38:50 --> Severity: Notice --> Use of undefined constant STORE_DRAFT - assumed 'STORE_DRAFT' /opt/lampp/htdocs/siddharth_application/application/models/storerequistion_model.php 283
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:38:51 --> Severity: Notice --> Use of undefined constant STORE_PENDINGAPPROVAL - assumed 'STORE_PENDINGAPPROVAL' /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 237
ERROR - 2017-07-05 13:48:54 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 13:48:54 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 13:48:54 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 13:48:54 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 13:48:54 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 13:48:54 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 13:52:26 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 13:52:26 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 13:52:26 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 13:52:26 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 13:52:26 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 13:52:26 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:00:11 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/storerequisitionlisting.php 53
ERROR - 2017-07-05 14:00:11 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/storerequisitionlisting.php 53
ERROR - 2017-07-05 14:00:11 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/storerequisitionlisting.php 53
ERROR - 2017-07-05 14:00:11 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/storerequisitionlisting.php 53
ERROR - 2017-07-05 14:00:11 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/storerequisitionlisting.php 53
ERROR - 2017-07-05 14:00:11 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/storerequisitionlisting.php 53
ERROR - 2017-07-05 14:00:34 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:00:34 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:00:34 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:00:34 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:00:34 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:00:34 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:01:25 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:01:25 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:01:25 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:01:25 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:01:25 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:01:25 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:01:44 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:01:44 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:01:44 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:01:44 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:01:44 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:01:44 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:03:29 --> Severity: Notice --> Undefined property: stdClass::$StatusName /opt/lampp/htdocs/siddharth_application/application/views/editstorerequisition.php 353
ERROR - 2017-07-05 14:03:53 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:03:53 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:03:53 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:03:53 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:03:53 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:03:53 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:04:37 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/storerequisitionlisting.php 53
ERROR - 2017-07-05 14:04:37 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/storerequisitionlisting.php 53
ERROR - 2017-07-05 14:04:37 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/storerequisitionlisting.php 53
ERROR - 2017-07-05 14:04:37 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/storerequisitionlisting.php 53
ERROR - 2017-07-05 14:04:37 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/storerequisitionlisting.php 53
ERROR - 2017-07-05 14:04:37 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/storerequisitionlisting.php 53
ERROR - 2017-07-05 14:05:24 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:05:24 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:05:24 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:05:24 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:05:24 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:05:24 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:05:35 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:05:35 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:05:35 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:05:35 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:05:35 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33
ERROR - 2017-07-05 14:05:35 --> Severity: Notice --> Undefined index: RequisitionStatus /opt/lampp/htdocs/siddharth_application/application/views/approvalstorerequisitionslip.php 33

View File

@ -0,0 +1,410 @@
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
class storerequistion_model extends CI_Model
{
/* completed*/
function getCostUser($userId='',$BudgetType='')
{
$this->db->select ('ED.FirstName,CM.CostCenterCode,CM.CostCenterName,CB.BudgetAmount,CB.BudgetType');
$this->db-> from(' T_CostCenter_Master CM');
$this->db->join ('T_CostCenter_Departments CD ',' CD.CostCenterCode = CM.CostCenterCode');
$this->db->join ('T_CostCenter_Budget CB ',' CB.CostCenterCode = CM.CostCenterCode');
$this->db->join ('T_Employee_Details ED ','ED.Departmentcode = CD.DEPCode');
$this->db->join ('tbl_users TU ',' TU.EmpID = ED.EmpID ');
$this->db->where('TU.userId ',$userId);
//$this->db->where('CB.BudgetType','SERVICE');
$query = $this->db->get();
$result = $query->result();
//print_r( $result );
return $result;
}
function getRawMaterialList($MaterialCode='')
{
$this->db->select('MaterialName,UOM,MaterialCode');
$this->db->from('T_MaterialMaster');
//$this->db->where('MaterialCode',$MaterialCode );
$query = $this->db->get();
$result = $query->result();
// print_r($result);
return $result;
}
/**
* This function is used to add the Raise store Requestion into the Database
* @return array $result : This is result of the query
*/
function addRequistion($ReqDate='')
{
$this->db->trans_start();
$this->db->insert('T_Store_Requestion_Master', $ReqDate);
$insert_id = $this->db->affected_rows();
$this->db->trans_complete();
if($insert_id>0)
{
$subQuery = 'select max(StoreReqNo) as StoreReqNo from T_Store_Requestion_Master';
$query = $this->db->query($subQuery);
return $query->result_array();
}
//return $insert_id;
}
/**
* This function is used to update the details into Database
* @return array $result : This is result of the query
*/
function UpdateRequistion($StoreReqNo,$Request)
{
$this->db->where('StoreReqNo',$StoreReqNo);
$this->db->update('T_Store_Requestion_Master',$Request);
return TRUE;
}
function getRequistionList()
{
$this->db->select('Sm.StoreReqNo,Sm.Requestedby,Sm.ReqDate,Sm.Status,Sd.Remarks,Sd.QuantityRequired,Sd.QuantityIssued,St.StatusName ');
$this->db->from ('T_Store_Requestion_Master Sm');
$this->db->join('T_Store_Requestion_Details Sd ',' Sd.StoreReqNo = Sm.StoreReqNo');
$this->db->join('T_Status St','St.StatusCode = Sm.Status');
// $this->db->where('Sm.Status ','ST036');
$query = $this->db->get();
$result = $query->result();
// print_r($this->db->last_query());
//print_r($result);
return $result;
}
/*this function used to Add Store Requistion*/
function addstoreRequistion($Request)
{
//print_r($Request);
$this->db->trans_start();
$this->db->insert('T_Store_Requestion_Details',$Request);
$insert_id = $this->db->affected_rows();
$this->db->trans_complete();
if($insert_id>0)
{
$subQuery = 'select max(StoreReqLineItemNo) as StoreReqLineItemNo from T_Store_Requestion_Details';
$query = $this->db->query($subQuery);
return $query->result_array();
}
}
/**
* This function is used to add the Line item details to the Database
* @return array $result : This is result of the query
*/
function addRequistionDetails($StoreReqLineItemNo)
{
//echo "nsmdnsjkkjasdf"; die();
$this->db->trans_start();
$this->db->insert('T_Store_Requestion_Details', $StoreReqLineItemNo
);
$insert_id = $this->db->affected_rows();
$this->db->trans_complete();
//print_r($this->db->last_query());
return $insert_id;
}
/**
* This function is used to check the Request Line Item is in Draft status
* @return array $result : This is result of the query
*/
function LineItemIsExists($StoreReqNo,$MaterialCode)
{
$this->db->select('StoreReqNo');
$this->db->from('T_Store_Requestion_Details');
$this->db->where('StoreReqNo ',$StoreReqNo );
$this->db->where('MaterialCode ',$MaterialCode );
$query = $this->db->get();
if ($query->num_rows > 0) {
//echo $result->num_rows;
return $query->result_array();
}
}
/**
* This function is used to update the details into Database
* @return array $result : This is result of the query
*/
function UpdateRequistionLineItem($StoreReqNo,$MaterialCode,$Request)
{
$this->db->where('StoreReqNo', $StoreReqNo);
$this->db->where('MaterialCode', $MaterialCode);
$this->db->update('T_Store_Requestion_Details',($Request));
return TRUE;
}
/**
* This function is used to delete the Line item from details into Database
* @return array $result : This is result of the query
*/
function DeleteRequistionLineItem( $StoreReqNo,$MaterialCode)
{
$this->db->where('StoreReqNo', $StoreReqNo);
$this->db->where('MaterialCode', $MaterialCode);
$this->db->delete('T_Store_Requestion_Details');
return TRUE;
}
/**
* This function is used to get the userId information
* @return array $result : This is result of the query
*/
function getStatus()
{
$this->db->select('StatusCode,StatusName ');
$this->db->from('T_Status');
$this->db->where('Remarks', 'STORE REQUISTION STATUS');
//$this->db->where('StatusCode!=', REQ_DRAFT);
$query = $this->db->get();
// print_r($query);
return $query->result();
}
function editstorerequistions($StoreReqNo)
{
$this->db->select('StoreReqNo,Sr.MaterialCode,Sr.QuantityRequired,Sr.Status,Sr.Remarks,Mm.MaterialName,Mm.UOM ');
$this->db->from('T_Store_Requestion_Details Sr');
$this->db->join('T_MaterialMaster Mm' ,' Mm.MaterialCode = Sr.MaterialCode');
$this->db->where('StoreReqNo',$StoreReqNo);
$query = $this->db->get();
return $query->result();
}
/**
* This function is used to check the Request is in Draft status
* @return array $result : This is result of the query
*/
function RequistionIsExists($ReqDate)
{
$this->db->select('StoreReqNo');
$this->db->from('T_Store_Requestion_Master');
//$this->db->where('Status ',REQ_DRAFT );
$this->db->where('ReqDate',$ReqDate );
$query = $this->db->get();
if ($query->num_rows > 0) {
//echo $result->num_rows;
return $query->result_array();
}
}
/**
* This function is used to check the Request is in Draft status
* @return array $result : This is result of the query
*/
function Storerequisition($MaterialCode)
{
$this->db->select('StoreReqNo');
$this->db->from('T_Store_Requestion_Details');
//$this->db->where('Status ',REQ_DRAFT );
$this->db->where('MaterialCode',$MaterialCode);
$query = $this->db->get();
if ($query->num_rows > 0) {
//echo $result->num_rows;
return $query->result_array();
}
}
/** COMPLETED
* This function is used to get the List of Store Requist details to the approver
* @return array $result : This is result of the query
*/
function getApproverRequistList($UserID,$Status = '',$FromDate='' ,$ToDate='')
{
// echo 'UserId: '.$UserID . 'From: '.$FromDate .'TO: '. $ToDate. 'Status: '. $Status;
$subQuery = ' select distinct Str.StoreReqNo,Str.Requestedby,Str.ReqDate,Str.Status,Str.CreatedDate,Str.Comments,St.StatusName
from T_Store_Requestion_Master Str
join T_Status St on St.StatusCode = Str.Status
join T_Employee_Details Emp on Emp.Departmentcode =Str.DepartmentCode
join T_DepartmentDetails Dept on Dept.DEPCode = Emp.Departmentcode
where Str.Status not in(?,?) and Emp.Departmentcode in (select DEPCode from T_DepartmentDetails where HeadDept=
(select HeadDept from T_DepartmentDetails where DEPCode = (select Departmentcode from T_Employee_Details where
EmpID=(select EmpID from tbl_users where userId=?))))';
$subQuery1 = $subQuery;
$query ='';
if($FromDate != '' && $ToDate != '' && $Status !='' )
{
$Where = 'and Str.CreatedDate >= ? and Str.CreatedDate <= ? and Status=?';
$subQuery1 .= $Where;
$query = $this->db->query($subQuery1, array(STORE_REJECT,STORE_DRAFT,$UserID,$FromDate,$ToDate,$Status));
}
else if($FromDate != '' && $ToDate != '' && $Status =='')
{
$Where = 'and Str.CreatedDate >= ? and Str.CreatedDate <= ? ';
$subQuery1 .= $Where;
$query = $this->db->query($subQuery1, array(STORE_REJECT,STORE_DRAFT,$UserID,$FromDate,$ToDate));
}
else if($Status != '' && $FromDate == '' && $ToDate == '')
{
$Where = 'and Status = ?';
$subQuery1 .= $Where;
$query = $this->db->query($subQuery1, array(STORE_REJECT,STORE_DRAFT,$UserID,$Status));
}
else
{
$query = $this->db->query($subQuery, array(STORE_REJECT,STORE_DRAFT,$UserID));
}
//print_r($this->db->last_query());
return $query->result();
}
/**
* This function is used to get the Store Requsition List for the login user
* @return array $result : This is result of the query
*/
function getRequistDetails($StoreReqNo='',$NoArray='')
{
$subQuery = 'select StoreReqNo,Str.Requestedby,Str.ReqDate,Dept.DepartmentName,Cm.CostCenterName,Bud.BudgetAmount,Bud.BudgetType from T_Store_Requestion_Master Str
join T_DepartmentDetails Dept on Dept.DEPCode = Str.DepartmentCode
join T_CostCenter_Master Cm on Cm.CostCenterCode =Str.CostCenterCode
join T_CostCenter_Budget Bud on Bud.CostCenterCode =Cm.CostCenterCode
where StoreReqNo =? ';
// print_r($this->db->last_subquery());
$query = $this->db->query($subQuery, array($StoreReqNo));
if($NoArray == '')
{
return $query->result_array();
}
else
{
return $query->result();
}
}
function editRequistDetails($StoreReqNo)
{
$this->db->select('StoreReqNo,Sr.CostCenterCode,Cc.CostCenterName
');
$this->db->from('T_Store_Requestion_Master Sr');
$this->db->join('T_CostCenter_Master Cc ',' Cc.CostCenterCode=Sr.CostCenterCode');
$this->db->where('StoreReqNo',$StoreReqNo);
$query = $this->db->get();
return $query->result();
}
// function editRequistItemList($StoreReqNo)
// {
// $this->db->select('StoreReqNo,Mat.MaterialCode,Str.QuantityRequired,Str.Remarks,Mat.MaterialName,Mat.UOM
// ');
// $this->db->from('T_Store_Requestion_Details Str');
// $this->db->join('T_MaterialMaster Mat ',' Mat.MaterialCode = Str.MaterialCode');
// $this->db->where('StoreReqNo',$StoreReqNo);
// $query = $this->db->get();
// return $query->result();
// }
/**
* This function is used to get the Store Requsition List for the login user
* @return array $result : This is result of the query
*/
function getRequistItemList($StoreReqNo,$NoArray='')
{
$subQuery = ' select Str.StoreReqNo,Str.MaterialCode,Str.QuantityRequired,Str.Remarks,Mat.MaterialName,Mat.UOM,Ss.StatusName
from T_Store_Requestion_Details Str
join T_MaterialMaster Mat on Mat.MaterialCode = Str.MaterialCode
join T_Status Ss on Ss.StatusCode = Str.Status
where Str.StoreReqNo =?';
$query = $this->db->query($subQuery, array($StoreReqNo));
if($NoArray == '')
{
return $query->result_array();
}
else
{
return $query->result();
}
}
/**
* This function is used to get the Available BudgetAmount for the Cost center
* @return array $result : This is result of the query
*/
function GetAvailableBudgetAmount($CostCode,$Year,$BudgetType)
{
$this->db->select('BudgetAmount');
$this->db->from('T_CostCenter_Budget');
$this->db->where('CostCenterCode',$CostCode );
$this->db->where('BudgetYear',$Year );
$this->db->where('BudgetType',$BudgetType );
$query = $this->db->get();
return $query->result_array();
}
/*this function used to get the all store requistion list view*/
function Storeall($StoreReqNo,$IsArray='')
{
$result = $this->db-> query("CALL P_GET_AllSTOREREQUISTION('".$StoreReqNo."')") or die(mysql_error());
{
//echo 'Store Line item Inserted successfully';
if($IsArray != '')
{
return $result->result_array();
}
else
{
return $result->result();
}
}
}
}

View File

@ -0,0 +1,751 @@
<?php
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$CurrentDate = $dt->format('d-m-y');
// print_r($cost);die();
?>
<script>
$(function() {
//Initialize Select2 Elements
$("#CostCenter").select2();
$("#MaterialCode").select2();
$("#Date").datepicker({
// minDate : 'now',
maxDate : 'now',
dateFormat: 'dd/mm/yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
});
});
</script>
<style type="text/css">
.num{
text-align:left;
}
.select2
{
width: 100% ! important;
}
</style>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Siddharth Industries - Raise Store Requisition </center>
</h1>
</section>
<section class="content">
<div id="content"></div>
<div class="row" style="border:2px dotted; padding:5%">
<?php
$attributes = array('class' => 'form-label-left requistion ','name' => 'requistion','id' => 'requistion');
echo form_open($this->config->base_url().'storerequisitionlist
/ addstores',$attributes); ?>
<!-- <form method="post" role="form" > -->
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Requested By</label>
<?php
$data = array('name' => 'RequestedBy','value' => set_value('RequestedBy',$name) ,'id'=>'RequestedBy','class' => 'form-control num' ,'required' => 'true' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
<div class="col-md-3">
<label>Department Name</label>
<?php
$data = array('name' => 'DepartmentName','value' => set_value('DepartmentName',$DEPCode . "-".$DepName), 'id'=>'DepartmentName','class' => 'form-control num' ,'required' => 'true' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
<div class="col-md-3">
<label>Requested Date</label>
<?php
$data = array('name' => 'Date','value' => set_value('Date',$CurrentDate), 'id' =>"Date", 'class' => 'form-control num' ,'required' => 'true');
echo form_input($data);
?>
</div>
<div class="col-md-3">
<label>Cost Center</label>
<?php
$Costs = array("0"=>'Select Cost Center Name');
//print_r( $options);
if(!empty($cost))
{
foreach ($cost as $SID):
// echo $SID->ConfigValue;
$Costs[$SID->CostCenterCode] = $SID->CostCenterCode .'-'. $SID->CostCenterName ;
endforeach;
}
echo form_dropdown('CostCenter', $Costs,set_value('CostCenter'),'id="CostCenter"' ,'class="form-control select2"' ,'readonly="true"','required="true"');
?>
</div>
<!-- <div class="col-md-2">
<label>Available Budget Amount</label>
<?php
$data = array('name' => 'BudgetAmount','value' => set_value('BudgetAmount'),'id'=>"BudgetAmount", 'class' => 'form-control','readonly' => 'true','required="true"' );
echo form_input($data);
?>
</div> -->
</div>
</div>
<br>
<br>
<div class="container-fluid">
<table class="table table-bordered" style="border:1px solid #333">
<div align="right" style="padding-right:10px">
<div align="right">
<a onclick="return validateBeforeAdd();" class="btn btn-primary">Add Line Item</a>
<!-- Add line Item -->
<div class="modal fade" id="mypo" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<center><h4>Add Line Item </h4></center>
</div>
<div align="left">
<div class="col-md-6">
<label>Material Code</label>
<div >
<?php
$options = array("0"=>'Material Code');
//print_r( $options);
if(!empty($MaterialList))
{
foreach ($MaterialList as $MID):
$options[$MID->MaterialCode] = $MID->MaterialCode.' '.' - '.' '.$MID->MaterialName;
endforeach;
}
echo form_dropdown('MaterialCode', $options,set_value('MaterialCode'),'id="MaterialCode"' ,'class="form-control"');
?>
</div>
</div>
<div class="col-md-6">
<label>Description</label>
<div class="form-group">
<?php
$data = array('name' => 'Description','value' => set_value('Description'),'id'=>'Description', 'class' => 'form-control','readonly' => 'true' );
echo form_input($data);
?>
</div>
</div>
<div class="col-md-6">
<label>UOM</label>
<div>
<?php
$data = array('name' => 'UOM','value' => set_value('UOM'),'id'=>'UOM', 'class' => 'form-control','readonly' => 'true' );
echo form_input($data);
?>
</div>
</div>
<div class="col-md-6">
<label>Quantity</label>
<div class="form-group">
<?php
$data = array('name' => 'Quantity','value' => set_value('Quantity'),'id'=>'Quantity', 'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event)','maxlength'=>'20');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-12">
<label>Remarks</label>
<div class="form-group">
<?php
$data = array('name' => 'Remarks','value' => set_value('Remarks'),'id'=>'Remarks', 'class' => 'form-control');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn btn-info font addClick" ID="addClick" ><i class="fa fa-plus"></i>&nbsp;&nbsp;<span class="bold">Add</span></a>
<a class="btn btn-info" data-dismiss="modal" value="Cancel">cancel</a>
</div>
</div>
</div>
</div>
<!-- Edit Line Item -->
<div class="modal fade" id="EditItem" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<center><h4>Edit Line Item </h4></center>
</div>
<div align="left">
<div class="col-md-6">
<label>Material Code</label>
<div >
<?php
$options = array("0"=>'Material Code');
//print_r( $options);
if(!empty($MaterialList))
{
foreach ($MaterialList as $MID):
$options[$MID->MaterialCode] = $MID->MaterialCode.' '.' - '.' '.$MID->MaterialName;
endforeach;
}
echo form_dropdown('EditMaterialCode', $options,set_value('EditMaterialCode'),'id="EditMaterialCode"' ,'class="form-control"');
?>
</div>
</div>
<div class="col-md-6">
<label>Description</label>
<div class="form-group">
<?php
$data = array('name' => 'EditDescription','value' => set_value('EditDescription'),'id'=>'EditDescription', 'class' => 'form-control','readonly' => 'true' );
echo form_input($data);
?>
</div>
</div>
<div class="col-md-6">
<label>UOM</label>
<div>
<?php
$data = array('name' => 'EditUOM','value' => set_value('EditUOM'),'id'=>'EditUOM', 'class' => 'form-control','readonly' => 'true' );
echo form_input($data);
?>
</div>
</div>
<div class="col-md-6">
<label>Quantity</label>
<div class="form-group">
<?php
$data = array('name' => 'EditQuantity','value' => set_value('EditQuantity'),'id'=>'EditQuantity', 'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event)','maxlength'=>'20');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-12">
<label>Remarks</label>
<div class="form-group">
<?php
$data = array('name' => 'EditRemarks','value' => set_value('EditRemarks'),'id'=>'EditRemarks', 'class' => 'form-control');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn btn-info font EditItem" ID="EditItem" ><i class="fa fa-plus"></i>&nbsp;&nbsp;<span class="bold">Edit</span></a>
<a class="btn btn-info" data-dismiss="modal" value="Cancel">cancel</a>
</div>
</div>
</div>
</div>
</div>
</div>
</table>
</div>
<div class="row" style="padding: 0px 15px 0px 10px;">
<table id="mytable" class="table table-bordered table-hover editableTable" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #CFCFCF;">
<th>SNO</th>
<th>Item Code</th>
<th>Description</th>
<th>UOM</th>
<th>Quantity</th>
<th>Remarks</th>
<th>Action</th>
</thead>
<tbody id='mytab'>
</tbody>
</table>
</div>
<br>
<div class="col-md-3 col-md-offset-9" align = "right">
<input type="hidden" name="txtRowCount" id="txtRowCount" />
<input type="hidden" name="txtDeletedRow" id="txtDeletedRow" />
<input type="hidden" name="txtStatus" id="txtStatus" />
<!--<a class="btn btn-primary Save" ID="Save" onclick="Save()" >&nbsp;&nbsp;<span class="bold">Save</span></a> -->
<a class="btn btn-primary Save" ID="Save" onclick="Save(0)" >&nbsp;&nbsp;<span class="bold">Save</span></a>
<a class="btn btn-primary Submit" ID="Submit" onclick="Save(1)" >&nbsp;&nbsp;<span class="bold">Submit</span></a>
<!--<input type="Submit" class="btn btn-info" />-->
<input type="reset" class="btn btn-info" value="Reset" />
</div>
</form>
</div>
</section>
</div>
</script>
<script type="text/html" id="tempList">
<tr id="<%=index%>">
<td align="left"><%=index%></td>
<td align="left"><%=MaterialCode%></td>
<td align="left"><%=MaterialName%></td>
<td align="left"><%=UOM%></td>
<td align="left"><%=Quantity%></td>
<td align="left"><%=Remarks%></td>
<td>
<a data-target='#EditItem' data-id="<%=index%>" data-userid="<%=index%>" data-toggle="modal" href="#EditItem"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit the <%=MaterialCode%> Material details"></i>&nbsp;&nbsp;&nbsp;</a> <a href='#' onclick = "Deleterow(<%=index%>)" class="link" data-id="<%=index%>" data-userid="<%=index%>" id="Del" ><span class="glyphicon glyphicon-trash"></span></a>
</td>
</tr>
</script>
<!--copy script-->
<script>
var isExceed = 0;
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode != 46 && charCode > 31
&& (charCode < 48 || charCode > 57))
return false;
return true;
}
</script>
<script>
$(function() {
$( ".datePicker" ).datepicker({ dateFormat: 'dd/mm/yy' });
//Initialize Select2 Elements
});
</script>
<script>
$('#CostCenter').change(function() {
var id = $('#CostCenter').val();
$("#BudgetAmount").val('');
var y = <?php echo json_encode($cost, JSON_PRETTY_PRINT) ?>;
$.each(y, function(idx, obj) {
// alert(obj.PONO);
if(id == obj.CostCenterCode)
{
//alert(obj.BudgetAmount);
$("#BudgetAmount").val(obj.BudgetAmount);
}
});
});
</script>
<script>
$('#MaterialCode').change(function() {
var id = $('#MaterialCode').val();
//alert(id);
$("#Description").val('');
$("#UOM").val('');
var z = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
$.each(z,function(idx,obj){
if(id== obj.MaterialCode){
//alert(obj.MaterialName);
$("#UOM").val(obj.UOM);
$("#Description").val(obj.MaterialName)
}
});
});
</script>
<script>
function addHidden(theForm, key, value) {
// Create a hidden input element, and append it to the form:
var input = document.createElement('input');
input.type = 'hidden';
input.name = key;'name-as-seen-at-the-server';
input.id = key;'name-as-seen-at-the-server';
input.value = value;
theForm.append(input);
}
$("#mypo").on("shown.bs.modal", function(e) {
if($("option:selected", $("#CostCenter")).val() == '-1')
{
alert('Please select the CostCenter ');
e.close();
}
});
var index=1;
$('.addClick').click(function()
{
if ($("#MaterialCode option:selected").val() =='-1' )
{
alert('Please Select the MaterialCode ');
return false;
}
if(document.getElementById('Quantity').value == '' )
{
alert('Please Enter the Quantity');
return false;
}
if ($("#MaterialCode option:selected").val() !='-1' && $('#Quantity').val() != '' )
{
var temp =index;
var MaterialCode = $("#MaterialCode option:selected").val();
var Description =$('#Description').val();
var UOM =$('#UOM').val();
var Quantity =$('#Quantity').val();
var Remarks=$('#Remarks').val();
$('#MaterialCode option[value='+MaterialCode+']').remove();
index = parseInt(index)+1;
var template = jQuery("#tempList").html();
$('#mytab').append(_.template(template,{index:temp,MaterialCode:MaterialCode,MaterialName:Description,UOM:UOM,Quantity:Quantity,Remarks:Remarks}));
var theForm = $(".requistion");
addHidden(theForm,"MaterialCode"+temp,MaterialCode);
addHidden(theForm,"Description"+temp,Description);
addHidden(theForm,"UOM"+temp,UOM);
addHidden(theForm,"Quantity"+temp,Quantity);
addHidden(theForm,"Remarks"+temp,Remarks);
//alert(JSON.stringify(Description));
$('#txtRowCount').val(temp);
clear();
}
});
function clear()
{
$('#MaterialCode').val('');
$('#Description').val('');
$('#UOM').val('');
$('#Quantity').val('');
$('#Remarks').val('');
}
var index = '1';
var userid = '';
function removeHiddenRows(rowcount)
{
var step;
if(rowcount > 2)
{
for (step = 1; step < rowcount ; step++)
{
var td = document.getElementById(step);
td.parentNode.removeChild(td);
$("#MaterialCode"+step).remove();
$("#Description"+step).remove();
$("#UOM"+step).remove();
$("#Quantity"+step).remove();
$("#Remarks"+step).remove();
index = '1';
userid = '';
}
}
}
$("#EditItem").on("shown.bs.modal", function(e) {
userid = $(e.relatedTarget).data('userid');
// alert(userid);
var tr= document.getElementById(userid);
var cellval = tr.cells;
//alert(x[1].innerHTML);
$('#EditMaterialCode').val(cellval[1].innerHTML);
$('#EditDescription').val(cellval[2].innerHTML);
$('#EditUOM').val(cellval[3].innerHTML);
$('#EditQuantity').val(cellval[4].innerHTML);
$('#EditRemarks').val(cellval[5].innerHTML);
});
$('.EditItem').click(function(){
var editMaterialCode = $("#EditMaterialCode").val();
var editDescription = $("#EditDescription").val();
var editUOM = $('#EditUOM').val();
var editQuantity = $('#EditQuantity').val();
var editRemarks = $('#EditRemarks').val();
var tr= document.getElementById(userid);
//alert(tr);
var cellval = tr.cells;
cellval[1].innerHTML = editMaterialCode;
cellval[2].innerHTML = editDescription;
cellval[3].innerHTML = editUOM;
cellval[4].innerHTML = editQuantity;
cellval[5].innerHTML = editRemarks;
$('#MaterialCode'+userid).val(editMaterialCode);
$('#Description'+userid).val(editDescription);
$('#UOM'+userid).val(editUOM);
$('#Quantity'+userid).val(editQuantity);
$('#Remarks'+userid).val(editRemarks);
$('#txtRowCount').val(userid);
});
function Deleterow(rowid)
{
var DelRows = $('#txtDeletedRow').val();
var answer = confirm(" Do you want to delete the Item from the List?")
if (answer)
{
var td = document.getElementById(rowid);
td.parentNode.removeChild(td);
if(DelRows != '')
{
DelRows = DelRows + ":" + rowid;
}
else
{
DelRows= "0" + ":" + rowid;
}
$('#txtDeletedRow').val(DelRows);
}
}
function validateBeforeAdd()
{
if ($("#CostCenter option:selected").val() =='-1' )
{
alert('Please Select the CostCenterCode ');
$("#CostCenter").focus();
return false;
}
else if( isExceed == '1')
{
alert('You dont have available Budget Amount. You cant raise new StoreRequisition');
return false;
}
else
{
$('#mypo').modal('show');
}
}
function Save(status)
{
//alert($(json.stringify(MaterialCode).val());
var txtRowCount= $('#txtRowCount').val();
//var mat = $('#MaterialCode'+txtRowCount).val();
if(status == '0')
{
stat = '<?php echo STORE_DRAFT; ?>';
}
else
{
stat = '<?php echo STORE_PENDINGAPPROVAL; ?>';
}
$('#txtStatus').val(stat);
var id=$('#txtStatus').val();
var RequestedBy=$('#RequestedBy').val();
var CostCenter=$('#CostCenter').val();
var splitDepCode= $('#DepartmentName').val();
DEPCode = splitDepCode.split('-')[0];
if (validate())
{
if(document.getElementById('mytable').rows.length < 0)
{
alert('Please Select Line item to Store Requisition');
$('#Deliverydt').focus();
return false;
}
else
{
console.log($('.requistion').serialize());
$('#content').loader('show');
$.ajax({
data:$('.requistion').serialize(),
type:"POST",
url:"<?php echo base_url() ?>storerequisitionlist/addNewRequistion?ID="+id+"&RequestedBy="+RequestedBy+"&CostCenter="+CostCenter+"&DEPCode="+DEPCode+"&txtRowCount="+txtRowCount,
success:function(data) {
if(data)
{
$('#content').loader('hide');
alert(data);
$('#txtRowCount').val('');
$('#txtDeletedRow').val('');
window.location = "addstorerequisitionlist";
}
else
{
alert("Error");
}
}
});
}
}
}
function validate()
{
if($("option:selected", $("#CostCenter")).val() == '-1')
{
alert('Please Select CostCenter');
return false;
}
else if($("option:selected", $("#MaterialCode")).val() == '-1')
{
alert('Please Select MaterialCode');
return false;
}
else if($("#txtRowCount").val().length < 1)
{
alert('Please Add Line Item');
return false;
}
else if(isExceed == 1)
{
alert('You dont have Budget and You cant Raise New StoreRequisition');
return false;
}
else
{
return true;
}
}
</script>
<script>
$(function () {
$('#Items').DataTable({
"paging": false,
"lengthChange": true,
"searching": false,
"ordering": false,
"info": false,
"autoWidth": true
});
});
</script>

View File

@ -0,0 +1,478 @@
<?php
//print_r($AppList);
?>
<div class="content-wrapper">
<section class="content">
<div>
<center><b><h2>Store Requisition Approval List </h2></b></center>
<?php
$attributes = array('class' => 'form-label-left Approve ','name' => 'Approve','id' => 'Approve');
echo form_open($this->config->base_url().'storerequisitionlist/SearchRequistLists',$attributes); ?>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Store Requisition Status</label>
<div>
<select class="form-control required" id="RequisitionStatus" name="RequisitionStatus" >
<option value="-1" >Select Status</option>
<?php
if(!empty($Status))
{
foreach ($Status as $DEP)
{
$StatusCode = $DEP->StatusCode;
if ($_POST['RequisitionStatus'] == $StatusCode)
{
echo "<option value=\"".$StatusCode."\" selected=\"selected\">".$StatusCode.' - '. $DEP->StatusName."</option>";
}
else
{
echo "<option value=\"".$StatusCode."\">".$StatusCode.' - '. $DEP->StatusName ."</option>";
}
}
}
?>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>Date range:</label>
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
<input type="text" class="form-control pull-right" id="SearchDate" value="<?php echo isset($_POST['SearchDate']) ? $_POST['SearchDate'] : '' ?>" name="SearchDate">
</div>
<!-- /.input group -->
</div>
</div>
<div class="col-md-3">
<label>&nbsp;&nbsp;</label>
<div class="form-group">
<input type="hidden" name="FromDate" id="FromDate" />
<input type="hidden" name="ToDate" id="ToDate" />
<input type="submit" class="btn btn-primary" >
<!-- <input type="Reset" class="btn btn-primary" >
<!-- <button type="button" class="close" data-dismiss="modal">&times;</button>
<!--<a class="btn btn-info" onclick="Search()" >Search</a> -->
<a class="btn btn-primary" onclick="Reset()" >Clear</a>
</div>
</div>
</div>
</div>
<br/>
<!-- popup for view store requisition detail -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal -->
<form>
<div class="modal-content">
<div class="modal-header" style="background-color: #3c8dbc;color:#fff;">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<center><h4> Store Requisition Details - REQNo</h4></center>
</div>
<div align="left">
<div class="col-md-12">
<!--<div class="col-md-4">
<label>Requistion Type</label>
<div class="form-group">
<?php
$data = array('name' => 'ReqType','value' => set_value('ReqType'),'id'=>'ReqType', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div> -->
<div class="col-md-6">
<label>Requested By</label>
<div class="form-group">
<?php
$data = array('name' => 'Requestedby','value' => set_value('Requestedby'),'id'=>'Requestedby', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-6">
<label>Department Name</label>
<div class="form-group">
<?php
$data = array('name' => 'Desigination','value' => set_value('Desigination'),'id'=>'Desigination', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6">
<label>Requested Date</label>
<div class="form-group">
<?php
$data = array('name' => 'ReqDate','value' => set_value('ReqDate'),'id'=>'ReqDate', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-6">
<label>Cost Center Name</label>
<div class="form-group">
<?php
$data = array('name' => 'CostCenter','value' => set_value('CostCenter'),'id'=>'CostCenter', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<!-- <div class="col-md-4">
<label>Avl Budget Amt</label>&nbsp;<img id="AlertImg" src="<?php echo base_url(); ?>assets/dist/img/red.png" alt="your image" width="25px" style="display:none"/>
<div class="form-group">
<?php
$data = array('name' => 'AvlBudgetAmount','value' => set_value('AvlBudgetAmount'),'id'=>'AvlBudgetAmount', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div> -->
</div>
</div>
<table id="Items" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<div align="right" style="padding-right:10px">
<div class="modal fade" role="dialog">
<thead style="background-color:#ddf">
<tr>
<th>SNo</th>
<th>Item Code</th>
<th>Item Description</th>
<th>UOM</th>
<th>Quantity</th>
<th>Remarks</th>
</tr>
</thead>
<tbody id="tbleAppend">
</tbody>
</div>
</div>
</table>
<div class="modal-footer"> <div class="col-md-12">
<a class="btn btn-info" data-dismiss="modal" value="Cancel">Ok</a>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<table id="Requisition" class="table table-bordered table-hover editabletable" style="background-color:#fff;font-size:12px;">
<div align="right" style="padding-right:10px">
<div id="content" > </div>
<div class="modal fade" role="dialog">
<thead style="background-color:#ddf">
<tr>
<th>Store Requisition Number</th>
<th>Requested By</th>
<th>Requested Date</th>
<th>Status</th>
<th>Action</th>
<th>comments</th>
</tr>
</thead>
<tbody id="ApprovalList">
<?php
if(!empty($AppList))
{
//print_r($AppList);
$index = 0;
foreach($AppList as $record)
{
$index = $index +1;
?>
<tr id="<?php echo $index ?>" >
<td><a data-toggle="modal" data-target="#myModal" data-id="<%=index%>" data-userid="<?php echo $record->StoreReqNo ?>" ><u><?php echo $record->StoreReqNo ?></u></a></td>
<td><?php echo $record->Requestedby?></td>
<td ><?php $Cdt = new DateTime($record->ReqDate);
$ReqDate= $Cdt->format('d-m-Y');
echo $ReqDate;
?></td>
<td><?php echo $record->StatusName ?></td>
<?php if (($record->Status) == STORE_PENDINGAPPROVAL)
{
?>
<!-- <td contenteditable="true"><input type="text" id="Remarks<?php echo $index ?>" name="Remarks<?php echo $index ?>"class="form-control" maxlength="100"></td> -->
<!-- <td data-name="sel" id="Action<?php echo $index ?>" onchange="saveToDatabase(this.options[this.selectedIndex].value,'question','<?php echo $record->StoreReqNo ; ?>','<?php echo $index ; ?>')">
<select name="status<?php echo $index ?>" id="status<?php echo $index ?>">
<option value="-1">Select Action</option>
<option value="1">Approve</option>
<option value="2">Reject</option>
</select>
</td> -->
<td> <select name="selectId" id="selectId" title="Select Your Option" onchange="saveToDatabase('<?php echo $record->StoreReqNo ?>','<?php echo $index ; ?>',this.options[this.selectedIndex].value,'<?php echo $record->Comments ?>');">
<option value="-1" >Select Option</option>
<option value="1">Approve</option>
<option value="2">Reject</option>
</select></td>
<?php
}
else
{
?>
<td><?php echo "---";//$record->Comments ?></td>
<!-- <td><?php echo $record->StatusName ?></td> -->
<?php
}
?>
<td contenteditable="true" id="newcomments<?php echo $index ; ?>" ><?php echo $record->Comments ?></td>
</tr>
<?php
}
}
?>
<tr>
<td><a data-toggle="modal" data-target="#StoreReq" >STREQ0001</a></td>
<td>Kasiraman</td>
<td>20/6/2017</td>
<td>Pending Approval</td>
<td>
<select name="" id="">
<option value="1">Select Action</option>
<option value="2">Approve</option>
<option value="3">Reject</option>
</select>
</td>
<td contenteditable="true"></td>
</tr>
</tbody>
</table>
<br>
</div>
</div>
</section>
</div>
<script>
var startDate = '';
var endDate = '';
function Reset()
{
$('#RequisitionStatus').val("-1");
$('#SearchDate').val('');
}
$("#myModal").on("shown.bs.modal", function(e) {
var ReqId = $(e.relatedTarget).data('userid');
$("#CostCenter").val('');
$("#tbleAppend").empty();
$("#Requestedby").val('');
$("#ReqDate").val('');
$("#Desigination").val('');
$("#AvlBudgetAmount").val('');
$('#content').loader('show');
$.ajax({
data:{id:ReqId},
type:"POST",
dataType: 'json',
url:"<?php echo base_url() ?>storerequisitionlist/ViewRequest",
success:function(json) {
$('#content').loader('hide');
//alert();
$("#Requestedby").val(json.Requist[0]['Requestedby']);
$("#ReqDate").val(json.Requist[0]['ReqDate']);
$("#Desigination").val(json.Requist[0]['DepartmentName']);
$("#CostCenter").val(json.Requist[0]['CostCenterName']);
//$("#AvlBudgetAmount").val(json.Requist[0]['BudgetAmount']);
$("#AvlBudgetAmount").val(json.AvilBudAmount);
$("#tbleAppend").append(json.Items);
}
});
});
function saveToDatabase(ReqId,Index,option,com)
{
// alert(ReqId);
// alert(Index);
// alert(option);
// alert(com);
var newcomments=document.getElementById('newcomments'+Index+'').innerHTML;
var id=ReqId;
var Status= '';
//alert(newcomments);
if (option == -1 )
{
alert("Please Select Option");
}
else if (option == 1 )
{
alert(' The Approval ');
Status='ST036';
var strMsg='Do YOu want to Approve this requisition?';
}
else
{
alert('The Rejects' );
Status='ST039';
var strMsg='Do You want to Reject this requisition?';
}
var answer = confirm(strMsg);
if (answer)
{
//$('#content').loader('show');
$.ajax({
data:{id:id,newcomments:newcomments},
type:"POST",
url:"<?php echo base_url() ?>storerequisitionlist/ApproveRequest?Status="+Status,
success:function(data) {
if(data)
{
$('#content').loader('hide');
alert(data);
location.reload();
}
else
{
alert("Error");
}
}
});
}
else
{
return;
}
}
$(function() {
var d = new Date();
var month = d.getMonth();
var day = d.getDate();
var year = d.getFullYear() ;
var SIAStartYear = year - 2015;
var mindt = year-70;
var maxdt = year-15;
$( ".datePicker" ).datepicker(
{
minDate : new Date(year-SIAStartYear,1,1),
maxDate :'now',
dateFormat: 'mm/dd/yy',changeMonth: true, changeYear: true,
}
);
//$('#SearchDate').daterangepicker( );
//Initialize Select2 Elements
$(".select2").select2();
//$('#SearchDate').val('');
$('#SearchDate').daterangepicker(
{
locale: {
format: 'DD-MM-YYYY'
},
showDropdowns: true
},
function(start, end, label) {
startDate = start.format('DD-MM-YYYY');
endDate = end.format('DD-MM-YYYY');
$('#FromDate').val(startDate);
$('#ToDate').val(endDate);
//alert("A new date range was chosen: " + start.format('DD-MM-YYYY') + ' to ' + end.format('DD-MM-YYYY'));
});
});
$(function () {
$('#Items').DataTable({
"paging": false,
"lengthChange": true,
"searching": false,
"ordering": false,
"info": false,
"autoWidth": false
});
$('#Requisition').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": true
});
});
</script>

0
application/views/editCapitalPo.php Normal file → Executable file
View File

View File

@ -0,0 +1,875 @@
<?php
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$CurrentDate = $dt->format('d-m-y');
// print_r($cost);die();
$CostCenterCode='';
$StoreReqNo='';
foreach ($cost as $key ) {
$CostCenterCode = $key->CostCenterName;
$StoreReqNo=$key->StoreReqNo;
//print_r($CostCenterCode);# code...
}
?>
<script>
$(function() {
//Initialize Select2 Elements
$("#CostCenter").select2();
$("#MaterialCode").select2();
$("#Date").datepicker({
// minDate : 'now',
maxDate : 'now',
dateFormat: 'mm/dd/yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
});
});
</script>
<style type="text/css">
.num{
text-align:left;
}
.select2
{
width: 100% ! important;
}
</style>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Siddharth Industries - Edit Store Requisition - <?php echo $StoreReqNo; ?></center>
</h1>
</section>
<section class="content">
<div class="row" style="border:2px dotted; padding:5%">
<?php
$attributes = array('class' => 'form-label-left requistion ','name' => 'requistion','id' => 'requistion');
echo form_open($this->config->base_url().'storerequisitionlist
/EditStoreRequistion',$attributes);
?>
<!-- <form method="post" role="form" > -->
<div class="row">
<input type="hidden" name="txtReqNo" id="txtReqNo" value="<?php echo $StoreReqNo?>"/>
<div class="col-md-3">
<label>Requested By</label>
<?php
$data = array('name' => 'RequestedBy','value' => set_value('RequestedBy',$name), 'id'=>'RequestedBy','class' => 'form-control num' ,'required' => 'true' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
<div class="col-md-3">
<label>Department Name</label>
<?php
$data = array('name' => 'DepartmentName','value' => set_value('DepartmentName',$DEPCode . "-".$DepName), 'id'=>'DepartmentName','class' => 'form-control num' ,'required' => 'true' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
<div class="col-md-3">
<label>Requested Date</label>
<?php
$data = array('name' => 'Date','value' => set_value('Date',$CurrentDate), 'id' =>"Date", 'class' => 'form-control num' ,'required' => 'true');
echo form_input($data);
?>
</div>
<div class="col-md-3">
<label>Cost Center</label>
<?php
$Costs = array();
//$CostCenterCode = $key->CostCenterName;
//print_r( $options);
if(!empty($cost))
//print_r($cost);
{
foreach ($cost as $SID):
// echo $SID->ConfigValue;
$Costs[$SID->CostCenterCode] = $SID->CostCenterCode .'-'. $SID->CostCenterName ;
endforeach;
}
echo form_dropdown('CostCenter', $Costs,set_value('CostCenter'),'id="CostCenter"' ,'class="form-control select2"' ,'readonly="true"','required="true"');
?>
</div>
<!-- <div class="col-md-2">
<label>Available Budget Amount</label>
<?php
$data = array('name' => 'BudgetAmount','value' => set_value('BudgetAmount'),'id'=>"BudgetAmount", 'class' => 'form-control','readonly' => 'true','required="true"' );
echo form_input($data);
?>
</div> -->
</div>
<br>
<br>
<div class="container-fluid">
<table class="table table-bordered" style="border:1px solid #333">
<div align="right" style="padding-right:10px">
<div align="right">
<a onclick="return validateBeforeAdd();" class="btn btn-primary">Add Line Item</a>
<!-- Add line Item -->
<div class="modal fade" id="mypo" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<center><h4>Add Line Item </h4></center>
</div>
<div align="left">
<div class="col-md-6">
<label>Material Code</label>
<div >
<?php
$options = array("0"=>'Material Code');
//print_r( $options);
if(!empty($MaterialList))
{
foreach ($MaterialList as $MID):
$options[$MID->MaterialCode] = $MID->MaterialCode.' '.' - '.' '.$MID->MaterialName;
endforeach;
}
echo form_dropdown('MaterialCode', $options,set_value('MaterialCode'),'id="MaterialCode"' ,'class="form-control"');
?>
</div>
</div>
<div class="col-md-6">
<label>Description</label>
<div class="form-group">
<?php
$data = array('name' => 'Description','value' => set_value('Description'),'id'=>'Description', 'class' => 'form-control','readonly' => 'true' );
echo form_input($data);
?>
</div>
</div>
<div class="col-md-6">
<label>UOM</label>
<div>
<?php
$data = array('name' => 'UOM','value' => set_value('UOM'),'id'=>'UOM', 'class' => 'form-control','readonly' => 'true' );
echo form_input($data);
?>
</div>
</div>
<div class="col-md-6">
<label>Quantity</label>
<div class="form-group">
<?php
$data = array('name' => 'Quantity','value' => set_value('Quantity'),'id'=>'Quantity', 'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event)','maxlength'=>'20');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-12">
<label>Remarks</label>
<div class="form-group">
<?php
$data = array('name' => 'Remarks','value' => set_value('Remarks'),'id'=>'Remarks', 'class' => 'form-control');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn btn-info font addClick" ID="addClick" ><i class="fa fa-plus"></i>&nbsp;&nbsp;<span class="bold">Add</span></a>
<a class="btn btn-info" data-dismiss="modal" value="Cancel">cancel</a>
</div>
</div>
</div>
</div>
<!-- Edit Line Item -->
<div class="modal fade" id="EditItem" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<center><h4>Edit Line Item </h4></center>
</div>
<div align="left">
<div class="col-md-6">
<label>Material Code</label>
<div >
<?php
$options = array("0"=>'Material Code');
//print_r( $options);
if(!empty($MaterialList))
{
foreach ($MaterialList as $MID):
$options[$MID->MaterialCode] = $MID->MaterialCode.' '.' - '.' '.$MID->MaterialName;
endforeach;
}
echo form_dropdown('EditMaterialCode', $options,set_value('EditMaterialCode'),'id="EditMaterialCode"' ,'class="form-control"');
?>
</div>
</div>
<div class="col-md-6">
<label>Description</label>
<div class="form-group">
<?php
$data = array('name' => 'EditDescription','value' => set_value('EditDescription'),'id'=>'EditDescription', 'class' => 'form-control','readonly' => 'true' );
echo form_input($data);
?>
</div>
</div>
<div class="col-md-6">
<label>UOM</label>
<div>
<?php
$data = array('name' => 'EditUOM','value' => set_value('EditUOM'),'id'=>'EditUOM', 'class' => 'form-control','readonly' => 'true' );
echo form_input($data);
?>
</div>
</div>
<div class="col-md-6">
<label>Quantity</label>
<div class="form-group">
<?php
$data = array('name' => 'EditQuantity','value' => set_value('EditQuantity'),'id'=>'EditQuantity', 'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event)','maxlength'=>'20');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-12">
<label>Remarks</label>
<div class="form-group">
<?php
$data = array('name' => 'EditRemarks','value' => set_value('EditRemarks'),'id'=>'EditRemarks', 'class' => 'form-control');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn btn-info font EditItem" ID="EditItem" ><i class="fa fa-plus"></i>&nbsp;&nbsp;<span class="bold">Edit</span></a>
<a class="btn btn-info" data-dismiss="modal" value="Cancel">cancel</a>
</div>
</div>
</div>
</div>
</div>
</div>
</table>
</div>
<div class="row" style="padding: 0px 15px 0px 10px;">
<table id="mytable" class="table table-bordered table-hover editableTable" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #CFCFCF;">
<th>SNO</th>
<th>Item Code</th>
<th>Description</th>
<th>UOM</th>
<th>Quantity</th>
<th>Remarks</th>
<th>Action</th>
</thead>
<tbody id='mytab'>
<?php
if(!empty($LineItem))
{ //alert();
$index = 0;
foreach($LineItem as $record)
{
//print_r($record);
$index = $index + 1;
?>
<tr id="<?php echo $index ; ?>">
<td align="left"><?php echo $index ; ?></td>
<!-- <input type="hidden" name="<?php echo 'te'.$index ?>" id="<?php echo 'te'.$index ?>" value="<?php echo $record->MaterialCode ; ?>" />
<input type="hidden" name="<?php echo 'te'.$index ?>" id="<?php echo 'tes'.$index ?>" value="<?php echo $record->QuantityRequired ; ?>" /> -->
<td align="left"><?php echo $record->MaterialCode ?></td>
<td align="left"><?php echo $record->MaterialName ?></td>
<td align="left"><?php echo $record->UOM ?></td>
<td align="left"><?php echo $record->QuantityRequired ?></td>
<!-- <td align="left"><?php echo $record->StatusName ?></td> -->
<td align="left"><?php echo $record->Remarks ?></td>
<td>
<a data-id="<?php echo $index ; ?>" data-userid="<?php echo $index ; ?>" data-target='#EditItem' data-toggle="modal" href="#EditItem"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit the <?php echo $record->MaterialCode ; ?> Material details"></i>&nbsp;&nbsp;&nbsp;</a> <a onclick = "DeleteRow(<?php echo $index ; ?>)" class="link" data-id="<?php echo $record->MaterialCode ; ?>" data-userid="<?php echo $index ; ?>" id="Del" ><span class="glyphicon glyphicon-trash"></span></a>
</td>
</tr>
<?php $RowCount = $index; }
?>
<?php
}?>
</tbody>
</table>
</div>
<br>
<div class="col-md-3 col-md-offset-9" align = "right">
<input type="hidden" name="txtRowCount" id="txtRowCount" />
<input type="hidden" name="txtDeletedRow" id="txtDeletedRow" />
<input type="hidden" name="txtStatus" id="txtStatus" />
<!--<a class="btn btn-primary Save" ID="Save" onclick="Save()" >&nbsp;&nbsp;<span class="bold">Save</span></a> -->
<a class="btn btn-primary Save" ID="Save" onclick="Save(0)" >&nbsp;&nbsp;<span class="bold">Save</span></a>
<a class="btn btn-primary Submit" ID="Submit" onclick="Save(1)" >&nbsp;&nbsp;<span class="bold">Submit</span></a>
<!--<input type="Submit" class="btn btn-info" />-->
<input type="reset" class="btn btn-info" value="Reset" />
</div>
</form>
</div>
</section>
</div>
</script>
<script type="text/html" id="tempList">
<tr id="<%=index%>">
<td align="left"><%=index%></td>
<td align="left"><%=MaterialCode%></td>
<td align="left"><%=MaterialName%></td>
<td align="left"><%=UOM%></td>
<td align="left"><%=Quantity%></td>
<td align="left"><%=Remarks%></td>
<td>
<a data-target='#EditItem' data-id="<%=index%>" data-userid="<%=index%>" data-toggle="modal" href="#EditItem"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit the <%=MaterialCode%> Material details"></i>&nbsp;&nbsp;&nbsp;</a> <a href='#' onclick = "Deleterow(<%=index%>)" class="link" data-id="<%=index%>" data-userid="<%=index%>" id="Del" ><span class="glyphicon glyphicon-trash"></span></a>
</td>
</tr>
</script>
<!--copy script-->
<script>
var isExceed = 0;
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode != 46 && charCode > 31
&& (charCode < 48 || charCode > 57))
return false;
return true;
}
</script>
<script>
$(function() {
$( ".datePicker" ).datepicker({ dateFormat: 'dd/mm/yy' });
//Initialize Select2 Elements
});
</script>
<script>
$('#CostCenter').change(function() {
var id = $('#CostCenter').val();
$("#BudgetAmount").val('');
var y = <?php echo json_encode($cost, JSON_PRETTY_PRINT) ?>;
$.each(y, function(idx, obj) {
// alert(obj.PONO);
if(id == obj.CostCenterCode)
{
//alert(obj.BudgetAmount);
$("#BudgetAmount").val(obj.BudgetAmount);
}
});
});
</script>
<script>
$('#MaterialCode').change(function() {
var id = $('#MaterialCode').val();
//alert(id);
$("#Description").val('');
$("#UOM").val('');
var z = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
$.each(z,function(idx,obj){
if(id== obj.MaterialCode){
//alert(obj.MaterialName);
$("#UOM").val(obj.UOM);
$("#Description").val(obj.MaterialName)
}
});
});
</script>
<script>
function addHidden(theForm, key, value) {
// Create a hidden input element, and append it to the form:
var input = document.createElement('input');
input.type = 'hidden';
input.name = key;'name-as-seen-at-the-server';
input.id = key;'name-as-seen-at-the-server';
input.value = value;
theForm.append(input);
}
$("#mypo").on("shown.bs.modal", function(e) {
if($("option:selected", $("#CostCenter")).val() == '-1')
{
alert('Please select the CostCenter ');
e.close();
}
});
var index=1;
$('.addClick').click(function()
{
if ($("#MaterialCode option:selected").val() =='-1' )
{
alert('Please Select the MaterialCode ');
return false;
}
if(document.getElementById('Quantity').value == '' )
{
alert('Please Enter the Quantity');
return false;
}
if ($("#MaterialCode option:selected").val() !='-1' && $('#Quantity').val() != '' )
{
var temp =index;
var MaterialCode = $("#MaterialCode option:selected").val();
var Description =$('#Description').val();
var UOM =$('#UOM').val();
var Quantity =$('#Quantity').val();
var Remarks=$('#Remarks').val();
$('#MaterialCode option[value='+MaterialCode+']').remove();
index = parseInt(index)+1;
var template = jQuery("#tempList").html();
$('#mytab').append(_.template(template,{index:temp,MaterialCode:MaterialCode,MaterialName:Description,UOM:UOM,Quantity:Quantity,Remarks:Remarks}));
var theForm = $(".requistion");
addHidden(theForm,"MaterialCode"+temp,MaterialCode);
addHidden(theForm,"Description"+temp,Description);
addHidden(theForm,"UOM"+temp,UOM);
addHidden(theForm,"Quantity"+temp,Quantity);
addHidden(theForm,"Remarks"+temp,Remarks);
//alert(JSON.stringify(Description));
$('#txtRowCount').val(temp);
clear();
}
});
function clear()
{
$('#MaterialCode').val('');
$('#Description').val('');
$('#UOM').val('');
$('#Quantity').val('');
$('#Remarks').val('');
}
var index = '1';
var userid = '';
function removeHiddenRows(rowcount)
{
var step;
if(rowcount > 2)
{
for (step = 1; step < rowcount ; step++)
{
var td = document.getElementById(step);
td.parentNode.removeChild(td);
$("#MaterialCode"+step).remove();
$("#Description"+step).remove();
$("#UOM"+step).remove();
$("#Quantity"+step).remove();
$("#Remarks"+step).remove();
index = '1';
userid = '';
}
}
}
$("#EditItem").on("shown.bs.modal", function(e) {
userid = $(e.relatedTarget).data('userid');
// alert(userid);
var tr= document.getElementById(userid);
var cellval = tr.cells;
//alert(x[1].innerHTML);
$('#EditMaterialCode').val(cellval[1].innerHTML);
$('#EditDescription').val(cellval[2].innerHTML);
$('#EditUOM').val(cellval[3].innerHTML);
$('#EditQuantity').val(cellval[4].innerHTML);
$('#EditRemarks').val(cellval[5].innerHTML);
});
$('.EditItem').click(function(){
var editMaterialCode = $("#EditMaterialCode").val();
var editDescription = $("#EditDescription").val();
var editUOM = $('#EditUOM').val();
var editQuantity = $('#EditQuantity').val();
var editRemarks = $('#EditRemarks').val();
var tr= document.getElementById(userid);
//alert(tr);
var cellval = tr.cells;
cellval[1].innerHTML = editMaterialCode;
cellval[2].innerHTML = editDescription;
cellval[3].innerHTML = editUOM;
cellval[4].innerHTML = editQuantity;
cellval[5].innerHTML = editRemarks;
$('#MaterialCode'+userid).val(editMaterialCode);
$('#Description'+userid).val(editDescription);
$('#UOM'+userid).val(editUOM);
$('#Quantity'+userid).val(editQuantity);
$('#Remarks'+userid).val(editRemarks);
$('#txtRowCount').val(userid);
});
function Deleterow(rowid)
{
var id = [];
var tr= document.getElementById(rowid);
var cellval = tr.cells;
var MaterialCode = cellval[1].innerHTML;
// alert(cellval[1].innerHTML);
id[0] = $('#txtReqNo').val();
id[1] = MaterialCode;
var answer = confirm(" Do you want to delete the Item from the List?")
if (answer)
{
// To delete the item from list
var x = <?php echo json_encode($LineItem, JSON_PRETTY_PRINT) ?>;
var result = '0';
//alert(x);
//alert(MaterialCode);
if(MaterialCode != "0")
{
$.each(x, function(idx, obj) {
if(obj.MaterialCode === MaterialCode)
{
result = '1';
return false;
}
});
}
if(result == '0')
{
var DelRows = $('#txtDeletedRow').val();
tr.parentNode.removeChild(tr);
if(DelRows != '')
{
DelRows = DelRows + ":" + rowid;
}
else
{
DelRows= "0" + ":" + rowid;
}
$('#txtDeletedRow').val(DelRows);
}
// To delete the value from Tables
else if(result == '1')
{
var DelRows = $('#txtDeletedRow').val();
tr.parentNode.removeChild(tr);
if(DelRows != '')
{
DelRows = DelRows + ":" + rowid;
}
else
{
DelRows= "0" + ":" + rowid;
}
$('#txtDeletedRow').val(DelRows);
$.ajax({
data:{id:id},
type:"POST",
url:"<?php echo base_url() ?>storerequisitionlist/DeleteRequistionForm",
success:function(data) {
if(data)
{
$('#content').loader('hide');
alert(data);
}
else
{
alert("Error");
}
}});
}
}
}
function validateBeforeAdd()
{
if ($("#CostCenter option:selected").val() =='-1' )
{
alert('Please Select the CostCenterCode ');
$("#CostCenter").focus();
return false;
}
else if( isExceed == '1')
{
alert('You dont have available Budget Amount. You cant raise new StoreRequisition');
return false;
}
else
{
$('#mypo').modal('show');
}
}
function Save(status)
{
//alert($(json.stringify(MaterialCode).val());
var txtRowCount= $('#txtRowCount').val();
//var mat = $('#MaterialCode'+txtRowCount).val();
if(status == '0')
{
stat = '<?php echo STORE_DRAFT; ?>';
}
else
{
stat = '<?php echo STORE_PENDINGAPPROVAL; ?>';
}
$('#txtStatus').val(stat);
var id=$('#txtStatus').val();
var RequestedBy=$('#RequestedBy').val();
var CostCenter=$('#CostCenter').val();
var splitDepCode= $('#DepartmentName').val();
DEPCode = splitDepCode.split('-')[0];
if (validate())
{
if(document.getElementById('mytable').rows.length < 0)
{
alert('Please Select Line item to Store Requisition');
$('#Deliverydt').focus();
return false;
}
else
{
console.log($('.requistion').serialize());
$('#content').loader('show');
$.ajax({
data:$('.requistion').serialize(),
type:"POST",
url:"<?php echo base_url() ?>storerequisitionlist/EditStoreRequisitions?ID="+id+"&RequestedBy="+RequestedBy+"&CostCenter="+CostCenter+"&DEPCode="+DEPCode+"&txtRowCount="+txtRowCount,
success:function(data) {
if(data)
{
$('#content').loader('hide');
alert(data);
$('#txtRowCount').val('');
$('#txtDeletedRow').val('');
//window.location = "storerequisitionlist";
}
else
{
alert("Error");
}
}
});
}
}
}
function validate()
{
if($("option:selected", $("#CostCenter")).val() == '-1')
{
alert('Please Select CostCenter');
return false;
}
else if($("option:selected", $("#MaterialCode")).val() == '-1')
{
alert('Please Select MaterialCode');
return false;
}
else if(document.getElementById('mytable').rows.length < 1)
{
alert('Please Add Line Item');
return false;
}
else if(isExceed == 1)
{
alert('You dont have Budget and You cant Raise New StoreRequisition');
return false;
}
else
{
return true;
}
}
</script>
<script>
$(function () {
$('#Items').DataTable({
"paging": false,
"lengthChange": true,
"searching": false,
"ordering": false,
"info": false,
"autoWidth": true
});
});
</script>

View File

@ -0,0 +1,164 @@
<?php
$DraftCount = '';
$StoreReqNo = '';
if(!empty($Status))
{
foreach ($Status as $St)
{
$DraftCount = $St->cnt;
$StoreReqNo = $St->StoreReqNo;
}
//echo $ReqNo;
}?>
<style>
span.highlight {
background-color: yellow;
}
</style>
<div class="content-wrapper">
<section class="content-header">
<h1>
<CENTER>Siddharth Industries - Requisition Listing</CENTER>
</h1>
</section>
<section class="content">
<div class="row">
<div class="col-xs-12 text-right">
<div class="form-group">
<?php if($DraftCount == 0)
{ ?>
<a class="btn btn-primary" href="<?php echo base_url(); ?>storerequisitionlist/addstores"/>Raise Store Requisition</a><?php
}?>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<CENTER><h3 class="box-title"></h3></CENTER>
<div class="box-tools"></div>
</div>
<?php if($DraftCount > 0 ) {?><p>
<span class="highlight">The Store Requisition No <b><?php echo $StoreReqNo;?></b> is in Draft status.</span> Please act on the requisition.<span class="highlight">Then only you can raise New StoreRequisition. </span>
</p> <?php } ?>
<table id="Requisition" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<thead style="background-color:#ddf">
<tr>
<th>Store Requisition No</th>
<th>Tot No.OfLineItem </th>
<th>Issued Item Count</th>
<th>Pending Item Count</th>
<th>Status</th>
<th>Requested Date</th>
<th>Remarks</th>
<th>Action</th>
</tr>
</thead>
<?php
if(!empty($Store))
{
// echo "VIEW";
// print_r($Store);
foreach($Store as $record)
{ //print_r($record);
?>
<tr>
<td><?php echo $record->StoreReqNo ?></td>
<td><?php echo $record->TotalNoofLineItems ?></td>
<td><?php echo $record->IssuesItems ?></td>
<td><?php echo $record->PendingItems ?></td>
<td><?php echo $record->StatusName ?></td>
<td><?php echo $record->ReqDate ?></td>
<td><?php echo $record->Remarks ?></td>
<td> <a data-toggle="tooltip" href="<?php echo base_url().'EditStoreRequisition?StoreReqNo='.$record->StoreReqNo; ?>"><i class="fa fa-pencil" data-toggle="tooltip" title="<?php echo $record->StoreReqNo; ?> - Click here to view addstorerequisitionslip"></i>&nbsp;&nbsp;&nbsp;</a> <a data-toggle="tooltip" onclick="DeleteRow('<?php echo $record->StoreReqNo; ?>' )" ><span class="glyphicon glyphicon-trash" title="<?php echo $record->StoreReqNo; ?> - Click here to Delete Requisition details"></span></a> </td>
</tr>
<?php
}
}
?>
</table>
</div>
</div>
</div>
</section>
</div>
<script>
function DeleteRow(rowid)
{
id = rowid;
var answer = confirm(" Do you want to delete the Requisition?")
if (answer)
{
$.ajax({
data:{id:id},
type:"POST",
url:"<?php echo base_url() ?>storerequisitionlist/DeleteReqNo",
success:function(data) {
if(data)
{
$('#content').loader('hide');
alert(data);
location.reload();
}
else
{
alert("Error");
}
}});
}
}
</script>
<script>
$(function () {
$('#Requisition').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": true
});
});
</script>

View File

@ -0,0 +1,407 @@
<!-- <?php
$DraftCount = '';
$ReqNo = '';
if(!empty($Status))
{
foreach ($Status as $St)
{
//$DraftCount = $St->cnt;
//$ReqNo = $St->ReqNo;
}
//echo $ReqNo;
}?> -->
<style>
span.highlight {
background-color: yellow;
}
</style>
<div class="content-wrapper">
<section class="content-header">
<h1>
<CENTER>Siddharth Industries - Store Requisition Listing</CENTER>
</h1>
</section>
<section class="content">
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Store Requisition Status</label>
<div>
<select class="form-control required" id="RequisitionStatus" name="RequisitionStatus" >
<!-- <?php
$attributes = array('class' => 'form-label-left requistion ','name' => 'requistion','id' => 'requistion');
echo form_open($this->config->base_url().'storerequisitionlist
/ addstorerequisitionlist',$attributes); ?> -->
<option value="-1" >Select Status</option>
<?php
if(!empty($Status))
{
foreach ($Status as $DEP)
{
$StatusCode = $DEP->StatusCode;
if ($_POST['RequisitionStatus'] == $StatusCode)
{
echo "<option value=\"".$StatusCode."\" selected=\"selected\">".$StatusCode.' - '. $DEP->StatusName."</option>";
}
else
{
echo "<option value=\"".$StatusCode."\">".$StatusCode.' - '. $DEP->StatusName ."</option>";
}
}
}
?>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>Date range:</label>
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
<input type="text" class="form-control pull-right" id="SearchDate" value="<?php echo isset($_POST['SearchDate']) ? $_POST['SearchDate'] : '' ?>" name="SearchDate">
</div>
<!-- /.input group -->
</div>
</div>
<div class="col-md-3">
<label>&nbsp;&nbsp;</label>
<div class="form-group">
<input type="hidden" name="FromDate" id="FromDate" />
<input type="hidden" name="ToDate" id="ToDate" />
<input type="submit" class="btn btn-primary" >
<!-- <input type="Reset" class="btn btn-primary" >
<!-- <button type="button" class="close" data-dismiss="modal">&times;</button>
<!--<a class="btn btn-info" onclick="Search()" >Search</a> -->
<a class="btn btn-primary" onclick="Reset()" >Clear</a>
</div>
</div>
</div>
</div><br/>
<!-- model to show Store requisition detail -->
<div class="modal fade" id="storereqdetail" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<form>
<div class="modal-content">
<div class="modal-header" style="background-color: #3c8dbc;color:#fff;">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<center><h4> Store Requisition Details - REQ No</h4></center>
</div>
<div align="left">
<div class="col-md-12">
<div class="col-md-6">
<label>Requested By</label>
<div class="form-group">
<?php
$data = array('name' => 'ReqBy','value' => set_value('ReqBy'),'id'=>'ReqBy', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-6">
<label>Department</label>
<div class="form-group">
<?php
$data = array('name' => 'Desigination','value' => set_value('Desigination'),'id'=>'Desigination', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6">
<label>Requested Date</label>
<div class="form-group">
<?php
$data = array('name' => 'ReqDate','value' => set_value('ReqDate'),'id'=>'ReqDate', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-6">
<label>Cost Center Name</label>
<div class="form-group">
<?php
$data = array('name' => 'CostCenter','value' => set_value('CostCenter'),'id'=>'CostCenter', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
<!-- <div class="col-md-4">
<label>Avl Budget Amt</label>&nbsp;<img id="AlertImg" src="<?php echo base_url(); ?>assets/dist/img/red.png" alt="your image" width="25px" style="display:none"/>
<div class="form-group">
<?php
$data = array('name' => 'AvlBudgetAmount','value' => set_value('AvlBudgetAmount'),'id'=>'AvlBudgetAmount', 'class' => 'form-control' ,'readonly' => 'true');
echo form_input($data);
?>
</div>
</div> -->
</div>
<table id="Items" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<div align="right" style="padding-right:10px">
<div class="modal fade" role="dialog">
<thead style="background-color:#ddf">
<tr>
<th>SNo</th>
<th>Item Code</th>
<th>Item Description</th>
<th>UOM</th>
<th>Quantity</th>
<th>Remarks</th>
</tr>
</thead>
<tbody id="tbleAppend">
</tbody>
</div>
</div>
</table>
<div class="modal-footer"> <div class="col-md-12">
<a class="btn btn-info" data-dismiss="modal" value="Cancel">Ok</a>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<CENTER><h3 class="box-title"></h3></CENTER>
<div class="box-tools"></div>
</div>
<table id="Requisition" class="table table-bordered table-hover editabletable" style="background-color:#fff;font-size:12px;">
<thead style="background-color:#ddf">
<tr>
<th>Store Requisition No</th>
<th>Requested Date</th>
<th>Requested Quantity</th>
<th>Issued Quantity</th>
<th>Status</th>
<th>Requester Comments</th>
</tr>
</thead>
<tbody>
<?php
if(!empty($TotNoOfLine))
{
$index = 0;
foreach($TotNoOfLine as $record)
{
$index = $index +1;
?>
<tr id="<?php echo $index ?>" >
<td><a data-toggle="modal" data-target="#storereqdetail" data-id="<%=index%>" data-userid="<?php echo $record->StoreReqNo ?>" ><u><?php echo $record->StoreReqNo ?></u></a></td>
<td align="right"><?php
$rdate = new DateTime($record->ReqDate) ;
$ReqDate = $rdate->format('d-m-Y');
echo $ReqDate; ?></td>
<td align="right"><?php echo $record->QuantityRequired ?></td>
<td contenteditable="true" align="right"><?php echo $record->QuantityIssued ?></td>
<td><?php echo $record->StatusName ?></td>
<td> <?php echo $record->Remarks ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</section>
</div>
<script>
var startDate = '';
var endDate = '';
function Reset()
{
$('#RequisitionStatus').val("-1");
$('#SearchDate').val('');
}
$("#storereqdetail").on("shown.bs.modal", function(e) {
var ReqId = $(e.relatedTarget).data('userid');
$("#CostCenter").val('');
$("#tbleAppend").empty();
$("#Requestedby").val('');
$("#ReqDate").val('');
$("#Desigination").val('');
$("#AvlBudgetAmount").val('');
//$('#content').loader('show');
$.ajax({
data:{id:ReqId},
type:"POST",
dataType: 'json',
url:"<?php echo base_url() ?>storerequisitionlist/ViewRequest",
success:function(json) {
$('#content').loader('hide');
//alert();
$("#Requestedby").val(json.Requist[0]['Requestedby']);
$("#ReqDate").val(json.Requist[0]['ReqDate']);
$("#Desigination").val(json.Requist[0]['DepartmentName']);
$("#CostCenter").val(json.Requist[0]['CostCenterName']);
//$("#AvlBudgetAmount").val(json.Requist[0]['BudgetAmount']);
$("#AvlBudgetAmount").val(json.AvilBudAmount);
$("#tbleAppend").append(json.Items);
}
});
});
</script>
<script>
function DeleteRow(rowid)
{
id = rowid;
var answer = confirm(" Do you want to delete the Requisition?")
if (answer)
{
$.ajax({
data:{id:id},
type:"POST",
url:"<?php echo base_url() ?>storerequisitionlist/DeleteReqNo",
success:function(data) {
if(data)
{
$('#content').loader('hide');
alert(data);
location.reload();
}
else
{
alert("Error");
}
}});
}
}
</script>
<script>
$(function() {
var d = new Date();
var month = d.getMonth();
var day = d.getDate();
var year = d.getFullYear() ;
var SIAStartYear = year - 2015;
var mindt = year-70;
var maxdt = year-15;
$( ".datePicker" ).datepicker(
{
minDate : new Date(year-SIAStartYear,1,1),
maxDate :'now',
dateFormat: 'mm/dd/yy',changeMonth: true, changeYear: true,
}
);
//$('#SearchDate').daterangepicker( );
//Initialize Select2 Elements
$(".select2").select2();
//$('#SearchDate').val('');
$('#SearchDate').daterangepicker(
{
locale: {
format: 'DD-MM-YYYY'
},
showDropdowns: true
},
function(start, end, label) {
startDate = start.format('DD-MM-YYYY');
endDate = end.format('DD-MM-YYYY');
$('#FromDate').val(startDate);
$('#ToDate').val(endDate);
//alert("A new date range was chosen: " + start.format('DD-MM-YYYY') + ' to ' + end.format('DD-MM-YYYY'));
});
});
$(function () {
$('#Requisition').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": true
});
});
</script>

0
application/views/storestatus.php Normal file → Executable file
View File