merged uptodate : ps
This commit is contained in:
parent
9ac51ff47c
commit
2b0af09121
@ -351,8 +351,9 @@ class requisitionform extends BaseController
|
||||
*/
|
||||
function addNewRequistion()
|
||||
{
|
||||
// print_r($this->input->post());die();
|
||||
|
||||
log_message('error'," add new Requisition Fns Called");
|
||||
log_message('error'," add new Requisition Fns Called");
|
||||
$this->form_validation->set_rules('RequestType','RequestType','trim|required');
|
||||
$this->form_validation->set_rules('EmpID','EmpID','trim|required');
|
||||
|
||||
@ -361,15 +362,16 @@ class requisitionform extends BaseController
|
||||
$this->requisition();
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
log_message('error'," add new Requisition GET[ID] ".$_GET['ID']);
|
||||
$Status= $_GET['ID'];
|
||||
$RequestType = strtoupper(trim($this->input->post('RequestType')));
|
||||
$Requestedby = strtoupper(trim($this->input->post('EmpID')));
|
||||
log_message('error'," add new Requisition empid ".$Requestedby);
|
||||
$RequestedbyDept = $this->session->userdata ( 'DEPCode' );
|
||||
$Status= $_GET['ID'];
|
||||
$RequestType = strtoupper(trim($this->input->post('RequestType')));
|
||||
$Requestedby = strtoupper(trim($this->input->post('EmpID')));
|
||||
log_message('error'," add new Requisition empid ".$Requestedby);
|
||||
$RequestedbyDept = $this->session->userdata ( 'DEPCode' );
|
||||
$CostCenter = $this->input->post('CostCenter');
|
||||
$CreateBy = $this->session->userdata ( 'userId' );
|
||||
$UpdatedBy = $this->session->userdata ( 'userId' );
|
||||
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
||||
$createddt = $dt->format('Y-m-d H:i:s');
|
||||
|
||||
@ -378,29 +380,30 @@ class requisitionform extends BaseController
|
||||
|
||||
$comma_separated = explode(':', $DeletedRow);
|
||||
$serviceSchedule = $this->input->post('serviceSchedule');
|
||||
$servicePeriod = $this->input->post('serviceSchedule');
|
||||
// $noOfService = $this->input->post('noOfService');
|
||||
$servicePeriod = $this->input->post('serviceSchedule');
|
||||
// $noOfService = $this->input->post('noOfService');
|
||||
$noOfService = 1;
|
||||
|
||||
$IsExists = $this->requistion_model->RequistionIsExists($Requestedby);
|
||||
// print_r($IsExists);
|
||||
$IsExists = $this->requistion_model->RequistionIsExists($Requestedby);
|
||||
// print_r($IsExists);die();
|
||||
// return true;
|
||||
|
||||
if(count( $IsExists) == 0)
|
||||
{
|
||||
if(count( $IsExists) == 0)
|
||||
{
|
||||
//echo 'Not Exists';
|
||||
$Request = array('ReqType'=>$RequestType, 'Requestedby'=>$Requestedby,'ReqDate'=>$createddt,'CostCenterCode'=>$CostCenter,'Status'=>$Status,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy,'Schedule_Type'=>$serviceSchedule,'NumberOfService'=>$noOfService,'Service_Period'=>$servicePeriod,'RequestedDept'=>$RequestedbyDept);
|
||||
|
||||
//print_r($Request);
|
||||
|
||||
$Req = $this->requistion_model->addRequistion($Request);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
//echo 'Exists';
|
||||
$Request = array('ReqType'=>$RequestType, 'Requestedby'=>$Requestedby,'ReqDate'=>$createddt,'Status'=>$Status,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy,'CostCenterCode'=>$CostCenter,'Schedule_Type'=>$serviceSchedule,'NumberOfService'=>$noOfService,'Service_Period'=>$servicePeriod,'RequestedDept'=>$RequestedbyDept);
|
||||
$UpdateReq = $this->requistion_model->UpdateRequistion($Request,$IsExists[0]['ReqNo']);
|
||||
}
|
||||
$ReqNumber = '';
|
||||
}
|
||||
$ReqNumber = '';
|
||||
if(count($Req)>0)
|
||||
{
|
||||
$ReqNumber = $Req[0]['ReqNo'];
|
||||
@ -410,12 +413,12 @@ class requisitionform extends BaseController
|
||||
$ReqNumber = $IsExists[0]['ReqNo'];
|
||||
}
|
||||
|
||||
$SkipInsert = False;
|
||||
for ($i = 1; $i <= $RowCount; $i++)
|
||||
{
|
||||
$SkipInsert = "False";
|
||||
if( count($comma_separated) > 0)
|
||||
{
|
||||
$SkipInsert = False;
|
||||
for ($i = 1; $i <= $RowCount; $i++)
|
||||
{
|
||||
$SkipInsert = "False";
|
||||
if( count($comma_separated) > 0)
|
||||
{
|
||||
for($j = 1; $j < count($comma_separated); $j++)
|
||||
{
|
||||
$deletedRow = $comma_separated[$j] ;
|
||||
@ -427,27 +430,27 @@ class requisitionform extends BaseController
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($SkipInsert == "False")
|
||||
{
|
||||
if($SkipInsert == "False")
|
||||
{
|
||||
$MaterialCode = $this->input->post('MaterialCode'.$i);
|
||||
$Quantity = $this->input->post('Quantity'.$i);
|
||||
$OtherD = $this->input->post('otherD'.$i);
|
||||
|
||||
$ReqDetails = array('ReqNo'=>$ReqNumber, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'MaterialDescription'=>$OtherD);
|
||||
$this->requistion_model->addRequistionDetails($ReqDetails,$ReqNumber);
|
||||
}
|
||||
$ReqDetails = array('ReqNo'=>$ReqNumber, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'MaterialDescription'=>$OtherD,'UpdatedBy'=>$UpdatedBy);
|
||||
$this->requistion_model->addRequistionDetails($ReqDetails,$ReqNumber);
|
||||
}
|
||||
|
||||
}
|
||||
if($Status == REQ_DRAFT)
|
||||
{
|
||||
echo 'Successfully Saved the Requistion details.Requistion No is '.$ReqNumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'Successfully Created the Requistion details.Requistion No is '.$ReqNumber;
|
||||
}
|
||||
}
|
||||
if($Status == REQ_DRAFT)
|
||||
{
|
||||
echo 'Successfully Saved the Requistion details.Requistion No is '.$ReqNumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'Successfully Created the Requistion details.Requistion No is '.$ReqNumber;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ class requistion_model extends CI_Model
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
/* This function is used to getEditRequistItemList view the information
|
||||
/* This function is used to getEditRequistItemList view the information
|
||||
* @return array $result : This is result of the query
|
||||
*/
|
||||
function getEditRequistItemList($ReqNo)
|
||||
@ -52,16 +52,16 @@ class requistion_model extends CI_Model
|
||||
|
||||
|
||||
/* $subQuery ='select distinct Req.ReqNo, Req.MaterialCode,Mat.MaterialName,Mat.UOM, Req.Quantity,
|
||||
ifnull(Po.Quantity,0) as POQTY,sta.StatusName
|
||||
from T_Requestion_Details Req join T_MaterialMaster Mat on
|
||||
Req.MaterialCode = Mat.MaterialCode
|
||||
left join T_PurchaseOrder_LineItem Po on Po.ReqNo = Req.ReqNo
|
||||
left join T_PurchaseOrder_Master POmast on POmast.PONO=Po.PONO
|
||||
and Po.MaterialCode = Req.MaterialCode
|
||||
join T_Status sta on sta.StatusCode = Req.Status
|
||||
ifnull(Po.Quantity,0) as POQTY,sta.StatusName
|
||||
from T_Requestion_Details Req join T_MaterialMaster Mat on
|
||||
Req.MaterialCode = Mat.MaterialCode
|
||||
left join T_PurchaseOrder_LineItem Po on Po.ReqNo = Req.ReqNo
|
||||
left join T_PurchaseOrder_Master POmast on POmast.PONO=Po.PONO
|
||||
and Po.MaterialCode = Req.MaterialCode
|
||||
join T_Status sta on sta.StatusCode = Req.Status
|
||||
where Req.ReqNo = ? and POmast.Status != ?';
|
||||
|
||||
$query = $this->db->query($subQuery, array($ReqNo,PO_AMENDED));
|
||||
$query = $this->db->query($subQuery, array($ReqNo,PO_AMENDED));
|
||||
|
||||
// print_r($this->db->last_query());
|
||||
return $query->result(); */
|
||||
@ -395,7 +395,6 @@ ifnull(Po.Quantity,0) as POQTY,sta.StatusName
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* This function is used to check the Request is in Draft status
|
||||
* @return array $result : This is result of the query
|
||||
@ -407,11 +406,12 @@ ifnull(Po.Quantity,0) as POQTY,sta.StatusName
|
||||
$this->db->where('Status ',REQ_DRAFT );
|
||||
$this->db->where('Requestedby ',$ReqBy );
|
||||
$query = $this->db->get();
|
||||
|
||||
//print_r($this->db->last_query());die();
|
||||
if ($query->num_rows > 0) {
|
||||
//echo $result->num_rows;
|
||||
return $query->result_array();
|
||||
}
|
||||
}else{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* This function is used to check the Request Line Item is in Draft status
|
||||
|
||||
@ -461,7 +461,7 @@ if(!empty($ReqPOType))
|
||||
foreach($LineItem as $record)
|
||||
{
|
||||
$index = $index + 1;
|
||||
$materialdesc=$record->MaterialDescription;
|
||||
$materialdesc=isset($record->MaterialDescription) ? $record->MaterialDescription :"";
|
||||
//echo $materialdesc;
|
||||
?>
|
||||
<tr id="<?php echo $index ; ?>">
|
||||
@ -481,7 +481,7 @@ if(!empty($ReqPOType))
|
||||
<td align="left"><?php echo $record->Quantity ; ?></td>
|
||||
<td align="left"><?php echo $record->POQTY ; ?></td>
|
||||
<td align="left"><?php echo $record->StatusName ;?></td>
|
||||
<input type="hidden" name="<?php echo 'materialdesc'.$index ?>" id="<?php echo 'materialdesc'.$index ?>" value="<?php echo $record->MaterialDescription ; ?>" />
|
||||
<input type="hidden" name="<?php echo 'materialdesc'.$index ?>" id="<?php echo 'materialdesc'.$index ?>" value="<?php echo isset($record->MaterialDescription) ? $record->MaterialDescription : '' ; ?>" />
|
||||
<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> </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>
|
||||
|
||||
|
||||
@ -302,9 +302,9 @@ function saveToDatabase(editableObj,column,ReqId,Index) {
|
||||
success:function(data) {
|
||||
if(data)
|
||||
{
|
||||
$('#content').loader('hide');
|
||||
$('#content').loader('hide');
|
||||
alert(data);
|
||||
location.reload();
|
||||
location.reload(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user