178 lines
5.3 KiB
PHP
Executable File
178 lines
5.3 KiB
PHP
Executable File
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
class rawmaterialdetails_model extends CI_Model
|
|
{
|
|
|
|
/**
|
|
* 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 rawmaterialListing()
|
|
{
|
|
$this->db->select('*');
|
|
$this->db->from('T_MaterialMaster');
|
|
$query = $this->db->get();
|
|
$result = $query->result();
|
|
return $result;
|
|
}
|
|
|
|
function getUOM($UOM = '')
|
|
{
|
|
$ConfigID = 'C001';
|
|
$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 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();
|
|
}
|
|
|
|
//This function used to get the material category using configdetails table
|
|
function getmaterialCategory($MaterialCategory = '')
|
|
{
|
|
$Config_ID = 'C023';
|
|
$this->db->select('Config_ID,ConfigValue');
|
|
$this->db->from('T_ConfigDetails');
|
|
$this->db->where('Config_id',$Config_ID );
|
|
if($MaterialCategory != '')
|
|
{
|
|
$this->db->where('ConfigValue !=',$MaterialCategory );
|
|
}
|
|
$query = $this->db->get();
|
|
|
|
return $query->result();
|
|
}
|
|
|
|
//This function used to get the conversionfactor using configdetails table
|
|
function getConversionfactorUOM($ConversionFactorUOM ='')
|
|
{
|
|
$Config_ID = 'C024';
|
|
$this->db->select('Config_ID,ConfigValue');
|
|
$this->db->from('T_ConfigDetails');
|
|
$this->db->where('Config_id',$Config_ID );
|
|
if($ConversionFactorUOM != '')
|
|
{
|
|
$this->db->where('ConfigValue !=',$ConversionFactorUOM );
|
|
}
|
|
$query = $this->db->get();
|
|
|
|
return $query->result();
|
|
|
|
}
|
|
|
|
//AssetCode
|
|
/**
|
|
* This function used to get user information by id
|
|
* @param number $userId : This is user id
|
|
* @return array $result : This is user information
|
|
*/
|
|
|
|
|
|
function addNewRawMaterial($RawMaterial='')
|
|
{
|
|
|
|
$this->db->insert('T_MaterialMaster', $RawMaterial);
|
|
return TRUE;
|
|
}
|
|
|
|
/**
|
|
* This function used to get user information by id
|
|
* @param number $userId : This is user id
|
|
* @return array $result : This is user information
|
|
*/
|
|
function getMaterialDetails($MaterialCode)
|
|
{
|
|
$this->db->select('*');
|
|
$this->db->from('T_MaterialMaster');
|
|
$this->db->where('MaterialCode', $MaterialCode);
|
|
$query = $this->db->get();
|
|
//sprint_r($this->db->last_query());
|
|
return $query->result();
|
|
}
|
|
|
|
function getAssetcode()
|
|
{
|
|
$this->db->select('AssetCode,AssetName');
|
|
$this->db->from('T_Asset_Details');
|
|
//$this->db->where('Assetcode',$Assetcode );
|
|
//$this->db->where('AssetCode',$Assetcode );
|
|
$query = $this->db->get();
|
|
return $query->result();
|
|
}
|
|
|
|
|
|
function getCostCenterCode()//$CostCenterCode='')
|
|
{
|
|
$this->db->select('CostCenterCode,CostCenterName');
|
|
$this->db->from('T_CostCenter_Master');
|
|
//$this->db->where('CostCenterCode', $CostCenterCode);
|
|
$query = $this->db->get();
|
|
return $query->result();
|
|
}
|
|
|
|
|
|
function editRawmaterial($RawMaterial, $MaterialCode)
|
|
{
|
|
|
|
$this->db->where('MaterialCode', $MaterialCode);
|
|
$this->db->update('T_MaterialMaster', $RawMaterial);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
function viewrawmaterial($RawMaterial, $MaterialCode)
|
|
{
|
|
echo $MaterialCode; //."and".$RawMaterial ;
|
|
|
|
$this->db->where('MaterialCode', $MaterialCode);
|
|
$this->db->update('T_MaterialMaster', $RawMaterial);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
function export_excel(){
|
|
|
|
$this->db->select('det.*,emp.firstname,emp1.firstname as Updated_By,det.IsActive');
|
|
$this->db->join('tbl_users as tbl',' det.createdby = tbl.userid','left');
|
|
$this->db->join('T_Employee_Details as emp', 'emp.empid=tbl.empid','left');
|
|
$this->db->join('tbl_users as tbl1',' det.UpdatedBy = tbl1.userid','left');
|
|
$this->db->join('T_Employee_Details as emp1', 'emp1.empid=tbl1.empid','left');
|
|
return $this->db->get('T_MaterialMaster as det')->result_array();
|
|
}
|
|
|
|
/**
|
|
* This function is used to delete the user information
|
|
* @param number $userId : This is user id
|
|
* @return boolean $result : TRUE / FALSE*/
|
|
|
|
// function deletePO($PO, $POinfo)
|
|
// {
|
|
// $this->db->where('PO', $PO);
|
|
// $this->db->update('T_PurchaseOrderDetails', $POInfo);
|
|
// return $this->db->affected_rows();
|
|
// }
|
|
}
|
|
?>
|