merged uptodate : ps

This commit is contained in:
VE10-Sanjeev 2023-06-16 15:05:58 +05:30
parent 9ac51ff47c
commit 2b0af09121
4 changed files with 59 additions and 56 deletions

View File

@ -351,8 +351,9 @@ class requisitionform extends BaseController
*/ */
function addNewRequistion() 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('RequestType','RequestType','trim|required');
$this->form_validation->set_rules('EmpID','EmpID','trim|required'); $this->form_validation->set_rules('EmpID','EmpID','trim|required');
@ -361,15 +362,16 @@ class requisitionform extends BaseController
$this->requisition(); $this->requisition();
} }
else else
{ {
log_message('error'," add new Requisition GET[ID] ".$_GET['ID']); log_message('error'," add new Requisition GET[ID] ".$_GET['ID']);
$Status= $_GET['ID']; $Status= $_GET['ID'];
$RequestType = strtoupper(trim($this->input->post('RequestType'))); $RequestType = strtoupper(trim($this->input->post('RequestType')));
$Requestedby = strtoupper(trim($this->input->post('EmpID'))); $Requestedby = strtoupper(trim($this->input->post('EmpID')));
log_message('error'," add new Requisition empid ".$Requestedby); log_message('error'," add new Requisition empid ".$Requestedby);
$RequestedbyDept = $this->session->userdata ( 'DEPCode' ); $RequestedbyDept = $this->session->userdata ( 'DEPCode' );
$CostCenter = $this->input->post('CostCenter'); $CostCenter = $this->input->post('CostCenter');
$CreateBy = $this->session->userdata ( 'userId' ); $CreateBy = $this->session->userdata ( 'userId' );
$UpdatedBy = $this->session->userdata ( 'userId' );
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$createddt = $dt->format('Y-m-d H:i:s'); $createddt = $dt->format('Y-m-d H:i:s');
@ -378,29 +380,30 @@ class requisitionform extends BaseController
$comma_separated = explode(':', $DeletedRow); $comma_separated = explode(':', $DeletedRow);
$serviceSchedule = $this->input->post('serviceSchedule'); $serviceSchedule = $this->input->post('serviceSchedule');
$servicePeriod = $this->input->post('serviceSchedule'); $servicePeriod = $this->input->post('serviceSchedule');
// $noOfService = $this->input->post('noOfService'); // $noOfService = $this->input->post('noOfService');
$noOfService = 1; $noOfService = 1;
$IsExists = $this->requistion_model->RequistionIsExists($Requestedby); $IsExists = $this->requistion_model->RequistionIsExists($Requestedby);
// print_r($IsExists); // print_r($IsExists);die();
// return true;
if(count( $IsExists) == 0) if(count( $IsExists) == 0)
{ {
//echo 'Not Exists'; //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); $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); //print_r($Request);
$Req = $this->requistion_model->addRequistion($Request); $Req = $this->requistion_model->addRequistion($Request);
} }
else else
{ {
//echo 'Exists'; //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); $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']); $UpdateReq = $this->requistion_model->UpdateRequistion($Request,$IsExists[0]['ReqNo']);
} }
$ReqNumber = ''; $ReqNumber = '';
if(count($Req)>0) if(count($Req)>0)
{ {
$ReqNumber = $Req[0]['ReqNo']; $ReqNumber = $Req[0]['ReqNo'];
@ -410,12 +413,12 @@ class requisitionform extends BaseController
$ReqNumber = $IsExists[0]['ReqNo']; $ReqNumber = $IsExists[0]['ReqNo'];
} }
$SkipInsert = False; $SkipInsert = False;
for ($i = 1; $i <= $RowCount; $i++) for ($i = 1; $i <= $RowCount; $i++)
{ {
$SkipInsert = "False"; $SkipInsert = "False";
if( count($comma_separated) > 0) if( count($comma_separated) > 0)
{ {
for($j = 1; $j < count($comma_separated); $j++) for($j = 1; $j < count($comma_separated); $j++)
{ {
$deletedRow = $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); $MaterialCode = $this->input->post('MaterialCode'.$i);
$Quantity = $this->input->post('Quantity'.$i); $Quantity = $this->input->post('Quantity'.$i);
$OtherD = $this->input->post('otherD'.$i); $OtherD = $this->input->post('otherD'.$i);
$ReqDetails = array('ReqNo'=>$ReqNumber, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'MaterialDescription'=>$OtherD); $ReqDetails = array('ReqNo'=>$ReqNumber, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'MaterialDescription'=>$OtherD,'UpdatedBy'=>$UpdatedBy);
$this->requistion_model->addRequistionDetails($ReqDetails,$ReqNumber); $this->requistion_model->addRequistionDetails($ReqDetails,$ReqNumber);
} }
} }
if($Status == REQ_DRAFT) if($Status == REQ_DRAFT)
{ {
echo 'Successfully Saved the Requistion details.Requistion No is '.$ReqNumber; echo 'Successfully Saved the Requistion details.Requistion No is '.$ReqNumber;
} }
else else
{ {
echo 'Successfully Created the Requistion details.Requistion No is '.$ReqNumber; echo 'Successfully Created the Requistion details.Requistion No is '.$ReqNumber;
} }
} }

View File

@ -29,7 +29,7 @@ class requistion_model extends CI_Model
return $query->result(); 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 * @return array $result : This is result of the query
*/ */
function getEditRequistItemList($ReqNo) 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, /* $subQuery ='select distinct Req.ReqNo, Req.MaterialCode,Mat.MaterialName,Mat.UOM, Req.Quantity,
ifnull(Po.Quantity,0) as POQTY,sta.StatusName ifnull(Po.Quantity,0) as POQTY,sta.StatusName
from T_Requestion_Details Req join T_MaterialMaster Mat on from T_Requestion_Details Req join T_MaterialMaster Mat on
Req.MaterialCode = Mat.MaterialCode Req.MaterialCode = Mat.MaterialCode
left join T_PurchaseOrder_LineItem Po on Po.ReqNo = Req.ReqNo left join T_PurchaseOrder_LineItem Po on Po.ReqNo = Req.ReqNo
left join T_PurchaseOrder_Master POmast on POmast.PONO=Po.PONO left join T_PurchaseOrder_Master POmast on POmast.PONO=Po.PONO
and Po.MaterialCode = Req.MaterialCode and Po.MaterialCode = Req.MaterialCode
join T_Status sta on sta.StatusCode = Req.Status join T_Status sta on sta.StatusCode = Req.Status
where Req.ReqNo = ? and POmast.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()); // print_r($this->db->last_query());
return $query->result(); */ 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 * This function is used to check the Request is in Draft status
* @return array $result : This is result of the query * @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('Status ',REQ_DRAFT );
$this->db->where('Requestedby ',$ReqBy ); $this->db->where('Requestedby ',$ReqBy );
$query = $this->db->get(); $query = $this->db->get();
//print_r($this->db->last_query());die();
if ($query->num_rows > 0) { if ($query->num_rows > 0) {
//echo $result->num_rows;
return $query->result_array(); return $query->result_array();
} }else{
return array();
}
} }
/** /**
* This function is used to check the Request Line Item is in Draft status * This function is used to check the Request Line Item is in Draft status

View File

@ -461,7 +461,7 @@ if(!empty($ReqPOType))
foreach($LineItem as $record) foreach($LineItem as $record)
{ {
$index = $index + 1; $index = $index + 1;
$materialdesc=$record->MaterialDescription; $materialdesc=isset($record->MaterialDescription) ? $record->MaterialDescription :"";
//echo $materialdesc; //echo $materialdesc;
?> ?>
<tr id="<?php echo $index ; ?>"> <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->Quantity ; ?></td>
<td align="left"><?php echo $record->POQTY ; ?></td> <td align="left"><?php echo $record->POQTY ; ?></td>
<td align="left"><?php echo $record->StatusName ;?></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> <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> <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>

View File

@ -302,9 +302,9 @@ function saveToDatabase(editableObj,column,ReqId,Index) {
success:function(data) { success:function(data) {
if(data) if(data)
{ {
$('#content').loader('hide'); $('#content').loader('hide');
alert(data); alert(data);
location.reload(); location.reload(true);
} }
else else
{ {