203 lines
5.6 KiB
PHP
203 lines
5.6 KiB
PHP
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
require APPPATH . '/libraries/BaseController.php';
|
|
|
|
/**
|
|
* Class : Inward Gate Register Controller (security)
|
|
* User Class to control all user related operations.
|
|
* @author : Saravana kumar
|
|
* @version : 1.1
|
|
* @since : 8 Jun 2017
|
|
*/
|
|
class inwardgateregister extends BaseController
|
|
{
|
|
/**
|
|
* This is default constructor of the class
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->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()
|
|
{
|
|
$this->load->model('inwardgateregister_model');
|
|
$this->global['pageTitle'] = 'Siddharth : Inward Gate Register';
|
|
$data['IGR']= $this->inwardgateregister_model->igrListing();
|
|
//print_r($data['IGR']);//print_r statement is used to get the values
|
|
$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.="<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>
|
|
</tr>";
|
|
|
|
//$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($IGRNO);
|
|
//die();
|
|
|
|
$igrM = $this->inwardgateregister_model->addigrM($igr);
|
|
|
|
|
|
$IGRNO = '';
|
|
if(count($igrM)>0)
|
|
{
|
|
foreach ($igrM as $key ) {
|
|
$IGRNO=$key->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);
|
|
|
|
|
|
}
|
|
//print_r($IGRNO);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
|
|
?>
|