load->model('inwardgateregister_model');
$this->load->library('session');
$this->load->library('form_validation');
$this->isLoggedIn();
}
/**
* This function used to load the first screen of the user
*/
public function index()
{
$this->global['pageTitle'] = 'Siddharth : Inward Gate Register';
$this->loadViews("viewinwardgateregister", $this->global,NULL , NULL);
}
function viewinwardgateregister($IGRNO='',$IGR='')
{
$this->load->model('inwardgateregister_model');
$this->global['pageTitle'] = 'Siddharth : Inward Gate Register';
$data['IGR']= $this->inwardgateregister_model->igrListing($IGRNO,$IGR);
$this->loadViews("viewinwardgateregister",$this->global,$data,NULL);
}
function addinwardgateregister($pono='',$IGRNO='',$IGR='')
{
$this->load->model('inwardgateregister_model');
$this->global['pageTitle'] = 'Siddharth : Add Inward Gate Register';
//$data['IGR']=$this->inwardgateregister_model->igrListing($IGRNO,$IGR);
$data['PO_NO'] = $this->inwardgateregister_model->getpurchaseorder($pono);
//print_r($data);
$this->loadViews("inwardgateregister", $this->global, $data, NULL);
}
function getDateformat($Val)
{
$date = new DateTime($Val,new DateTimeZone('Asia/Kolkata'));
// print_r($date);
$retDate = $date->format('Y-m-d H:i:s');
return $retDate;
}
function IGRITEM($PO='')
{
$PO = $this->input->post('id');
$data = $this->inwardgateregister_model->viewpurchaseorder($PO);
//$result = $this->inwardgateregister_model->viewpurchaseorder($PO);
/*$HTML="";
for ($i = 0; $i < count($data); $i++)
{
$SNo = $i + 1;
$MaterialCode = $result[$i]['MaterialCode'];
$MaterialName = $result[$i]['MaterialName'];
$UOM = $result[$i]['UOM'];
$Quantity = $result[$i]['Quantity'];
$HTML.="
| ".$SNo." |
". $MaterialCode." |
".$MaterialName." |
".$UOM." |
".$Quantity." |
";
//$index = $index + 1;
}*/
echo json_encode($data);
//$this->load->view('sample',$data,NULL);
}
function addNewigr()
{
$PONO = $this->input->post('PONO');
//$igr = $this->input->post('igr');
$DeliveryChellanOrInvoiceNo = $this->input->post('InvoiceNo');
$DeliveryChellan = $this->input->post('InvoiceDate');
$DeliveryChellanDate = $this->getDateformat($DeliveryChellan);
$VehicleNo = $this->input->post('VehicleNo');
$CourierNo = $this->input->post('CourierNo');
$CreatedBy = $this->session->userdata('userId');
//$Remarks = $this->input->post('Remarks');
$RowCount = $this->input->post('txtRowCount');
//echo $RowCount;
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$createddt = $dt->format('Y-m-d H:i:s');
$IGRStatus = IGR_CREATED;
//echo $RowCount;
$igr = array();
$igr = array('PONO'=>$PONO,'VehicleNo'=>$VehicleNo,'DeliveryChellanOrInvoiceNo'=>$DeliveryChellanOrInvoiceNo,'DeliveryChellanDate'=>$DeliveryChellanDate,'CourierNo'=>$CourierNo,'IGRStatus'=>$IGRStatus,'CreatedBy'=>$CreatedBy,'CreatedDate' =>$createddt);
//print_r($igr);
$igrM = $this->inwardgateregister_model->addigrM($igr);
$IGRNO = '';
if(count($igrM)>0)
{
$IGRNO = $igrM[0]['IGRNO'];
}
//echo $IGRNO;
$IGRItemStatus = REQITEM_NEW;
//echo ("success");
//print_r($RowCount);
for ($i = 1; $i <= $RowCount; $i++)
{
//echo i;
//echo $IGRNO ;
$MaterialCode = $this->input->post('MaterialCode'.$i);
$QuantityAsPerInvoice = $this->input->post('ReceivedQuantity'.$i);
$Remarks = $this->input->post('Remarks'.$i);
//$Remarks = $this->input->post('Remarks');
$CreatedBy = $this->session->userdata('userId');
$igrDetails = array('IGRNO'=>$IGRNO,'MaterialCode'=>$MaterialCode,'QuantityAsPerInvoice'=>$QuantityAsPerInvoice,'Remarks'=>$Remarks,'IGRItemStatus'=>$IGRItemStatus,'CreatedBy'=>$CreatedBy,'CreatedDate'=>$createddt);
//print_r($igrDetails);
$igrD = $this->inwardgateregister_model->addigrD($igrDetails);
}
}
function ViewIGR($IGRNO='')
{
$IGRNO= $this->input->post('id');
//print_r($IGRNO);
$data = $this->inwardgateregister_model->viewigr($IGRNO);
//print_r( $data);
echo json_encode($data);
}
function pageNotFound()
{
$this->global['pageTitle'] = 'Siddharth : 404 - Page Not Found';
$this->loadViews("404", $this->global, NULL, NULL);
}
}
?>