Material Master

This commit is contained in:
gandhimathi Bharathirajan 2017-04-13 00:21:40 +05:30
parent c12bee54c4
commit 9a80993826

View File

@ -9,15 +9,13 @@ class rawmaterialdetails_model extends CI_Model
*/
function rawmaterialListingCount($searchText = '')
{
$this->db->select('BaseT.MaterialCode, BaseT.MaterialName, BaseT.MaterialType, BaseT.UOM, BaseT.CreatedDate');
$this->db->from('T_MaterialMaster as BaseT');
//$this->db->join('tbl_users as users', 'users.userId = BaseT.userId','left');
//$this->db->join('T_SupplierDetailsN as ID', 'ID.SupplierID = BaseT.SupplierID','left');
$this->db->select('*');
$this->db->from('T_MaterialMaster');
if(!empty($searchText)) {
$likeCriteria = "(BaseT.MaterialCode LIKE '%".$searchText."%'
OR BaseT.MaterialName LIKE '%".$searchText."%'
OR BaseT.MaterialType LIKE '%".$searchText."%'
OR BaseT.SupplierID LIKE '%".$searchText."%')";
$likeCriteria = "(MaterialCode LIKE '%".$searchText."%'
OR MaterialName LIKE '%".$searchText."%'
OR MaterialType LIKE '%".$searchText."%' OR UOM LIKE '%".$searchText."%')";
$this->db->where($likeCriteria);
}
//$this->db->where('BaseT.isDeleted', 0);
@ -35,19 +33,17 @@ class rawmaterialdetails_model extends CI_Model
*/
function rawmaterialListing($searchText = '', $page, $segment)
{
$this->db->select('BaseT.MaterialCode, BaseT.MaterialName, BaseT.MaterialType, BaseT.UOM ,BaseT.CreatedDate');
$this->db->from('T_MaterialMaster as BaseT');
$this->db->select('*');
$this->db->from('T_MaterialMaster');
//$this->db->join('T_SupplierDetailsN as ID', 'ID.SupplierID = BaseT.SupplierID','left');
if(!empty($searchText)) {
$likeCriteria = "(BaseT.MaterialCode LIKE '%".$searchText."%'
OR BaseT.MaterialName LIKE '%".$searchText."%'
OR BaseT.MaterialType LIKE '%".$searchText."%'
OR BaseT.SupplierID LIKE '%".$searchText."%')";
$likeCriteria = "(MaterialCode LIKE '%".$searchText."%'
OR MaterialName LIKE '%".$searchText."%'
OR MaterialType LIKE '%".$searchText."%' OR UOM LIKE '%".$searchText."%')";
$this->db->where($likeCriteria);
}
//$this->db->where('BaseT.isDeleted', 0);
//$this->db->where('BaseT.userId !=', 1);
$this->db->limit($page, $segment);
$query = $this->db->get();
@ -57,24 +53,32 @@ class rawmaterialdetails_model extends CI_Model
function getUOM()
function getUOM($UOM = '')
{
$ConfigID = 'C001';
$this->db->select('ConfigValue');
$this->db->from('T_ConfigDetails');
$this->db->where('Config_id ',$ConfigID );
$this->db->select('ConfigValue');
$this->db->from('T_ConfigDetails');
$this->db->where('Config_id ',$ConfigID );
if($UOM != '')
{
$this->db->where('ConfigValue !=',$UOM );
}
$query = $this->db->get();
return $query->result();
}
function getmaterial()
function getmaterialType($MaterialType = '')
{
$Config_ID = 'C003';
$this->db->select('Config_ID,ConfigValue');
$this->db->from('T_ConfigDetails');
$this->db->where('Config_id',$Config_ID );
if($MaterialType != '')
{
$this->db->where('ConfigValue !=',$MaterialType );
}
$query = $this->db->get();
return $query->result();
@ -87,14 +91,10 @@ class rawmaterialdetails_model extends CI_Model
function addNewRawMaterial($RawMaterial)
{
$this->db->trans_start();
$this->db->insert('T_MaterialMaster', $RawMaterial);
$MaterialCode = $this->db->insert_id();
$this->db->trans_complete();
return $MaterialCode;
return TRUE;
}
/**
@ -102,15 +102,14 @@ function addNewRawMaterial($RawMaterial)
* @param number $userId : This is user id
* @return array $result : This is user information
*/
function getuserInfo($MaterialCode)
function getMaterialDetails($MaterialCode)
{
$this->db->select('MaterialCode, MaterialName,MaterialType,UOM,CreatedBy,UpdatedBy,CreatedDate');
$this->db->select('*');
$this->db->from('T_MaterialMaster');
//$this->db->where('isDeleted', 0);
//$this->db->where('roleId !=', 1);
$this->db->where('MaterialCode', $MaterialCode);
$query = $this->db->get();
//sprint_r($this->db->last_query());
return $query->result();
}
function editRawmaterial($RawMaterial, $MaterialCode)