131 lines
4.4 KiB
PHP
131 lines
4.4 KiB
PHP
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
class inwardgateregister_model extends CI_Model
|
|
{
|
|
/**
|
|
* This function is used to get the user listing count
|
|
* @param string $searchText : This is optional search text
|
|
* @return number $count : This is row count
|
|
*/
|
|
|
|
|
|
/**
|
|
* This function is used to get the user listing count
|
|
* @param string $searchText : This is optional search text
|
|
* @param number $page : This is pagination offset
|
|
* @param number $segment : This is pagination limit
|
|
* @return array $result : This is result
|
|
*/
|
|
function igrListing($IGRNO,$IGR)
|
|
{
|
|
|
|
$this->db->select('igr.*,igrd.*,POM.DeliveryDate,sup.SupplierName,MM.MaterialName');
|
|
$this->db->from('T_IGR_Master igr');
|
|
$this->db->join('T_IGR_Details igrd','igrd.IGRNO = igr.IGRNO','left');
|
|
$this->db->join('T_PurchaseOrder_Master POM ', 'igr.PONO = POM.PONO','left');
|
|
$this->db->join('T_SupplierDetailsN sup', 'POM.SupplierID = sup.SupplierID','left');
|
|
$this->db->join('T_PurchaseOrder_LineItem POL', 'POL.PONO = igr.PONO','left');
|
|
$this->db->join('T_MaterialMaster MM', 'MM.MaterialCode = igrd.MaterialCode','left');
|
|
$this->db->group_by('igr.IGRNO',$IGRNO);
|
|
|
|
|
|
|
|
$query = $this->db->get();
|
|
//print_r( $this->db->last_query());
|
|
$result = $query->result();
|
|
return $result;
|
|
}
|
|
|
|
function getpurchaseorder($pono='')
|
|
{
|
|
$this->db->select('POM.PONO,POM.ServiceDescription,POM.DeliveryDate,sup.SupplierName,sup.Address');
|
|
$this->db->from('T_PurchaseOrder_Master POM');
|
|
$this->db->join('T_SupplierDetailsN sup', 'POM.SupplierID = sup.SupplierID','left');
|
|
//$this->db->join('T_PurchaseOrder_LineItem POL', 'POL.PONO = POM.PONO','left');
|
|
//$this->db->join('T_MaterialMaster MM', 'MM.MaterialCode = POL.MaterialCode','left');
|
|
//$this->db->where('PONO',$pono="PO0002" );
|
|
$query = $this->db->get();
|
|
|
|
$result = $query->result();
|
|
//print_r($result);
|
|
//$this->db->last_query();
|
|
return $result;
|
|
}
|
|
|
|
|
|
function viewpurchaseorder($PO)
|
|
{
|
|
|
|
$this->db->select('POM.PONO,POL.MaterialCode,POL.Quantity,POL.PONO,MM.MaterialName,MM.UOM');
|
|
$this->db->from('T_PurchaseOrder_Master POM');
|
|
//$this->db->join('T_SupplierDetailsN sup', 'POM.SupplierID = sup.SupplierID','left');
|
|
$this->db->join('T_PurchaseOrder_LineItem POL', 'POL.PONO = POM.PONO','left');
|
|
$this->db->join('T_MaterialMaster MM', 'MM.MaterialCode = POL.MaterialCode','left');
|
|
$this->db->where('POM.PONO',$PO );
|
|
|
|
//$this->db->where('PONO', $PO);
|
|
$query = $this->db->get();
|
|
|
|
$result = $query->result();
|
|
|
|
$this->db->last_query();
|
|
return $result;
|
|
}
|
|
function addigrM($igrM)
|
|
{
|
|
|
|
$this->db->trans_start();
|
|
$this->db->insert('T_IGR_Master', $igrM);
|
|
$insert_id = $this->db->affected_rows();
|
|
$this->db->trans_complete();
|
|
// print_r($this->db->last_query());
|
|
print_r($insert_id);
|
|
if($insert_id>0)
|
|
{
|
|
$subQuery = 'select max(IGRNO) as IGRNO from T_IGR_Master';
|
|
|
|
$query = $this->db->query($subQuery);
|
|
|
|
return $query->result_array();
|
|
}
|
|
}
|
|
|
|
function addigrD($igrD)
|
|
{
|
|
$this->db->trans_start();
|
|
$this->db->insert('T_IGR_Details', $igrD);
|
|
$insert_id = $this->db->affected_rows();
|
|
$this->db->trans_complete();
|
|
// print_r($this->db->last_query());
|
|
if($insert_id>0)
|
|
{
|
|
$subQuery = 'select max(IGRItemNo) as IGRItemNo from T_IGR_Details';
|
|
|
|
$query = $this->db->query($subQuery);
|
|
|
|
return $query->result_array();
|
|
}
|
|
}
|
|
function viewigr($IGRNO)
|
|
{
|
|
|
|
$this->db->select('igr.*,igrd.*,MM.MaterialName,MM.UOM,sup.Address,sup.SupplierName,POM.ServiceDescription,POL.Quantity');
|
|
$this->db->from('T_IGR_Master igr');
|
|
$this->db->join('T_IGR_Details igrd','igrd.IGRNO = igr.IGRNO','left');
|
|
$this->db->join('T_PurchaseOrder_Master POM','igr.PONO = POM.PONO','left');
|
|
$this->db->join('T_PurchaseOrder_LineItem POL','POL.PONO = POM.PONO','left');
|
|
|
|
$this->db->join('T_SupplierDetailsN sup', 'sup.SupplierID = POM.SupplierID','left');
|
|
|
|
$this->db->join('T_MaterialMaster MM', 'MM.MaterialCode = igrd.MaterialCode','left');
|
|
$this->db->order_by('igr.IGRNO');
|
|
$this->db->where('igr.IGRNO',$IGRNO);
|
|
|
|
|
|
|
|
$query = $this->db->get();
|
|
//print_r( $this->db->last_query());
|
|
$result = $query->result();
|
|
return $result;
|
|
}
|
|
} |