70 lines
2.0 KiB
PHP
Executable File
70 lines
2.0 KiB
PHP
Executable File
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
class store_model extends CI_Model
|
|
{
|
|
|
|
function viewStock()
|
|
{
|
|
|
|
$this->db->select('st.*,st.Remarks as storeremarks,MM.*');
|
|
$this->db->from('T_Store_Stockdetails st ');
|
|
$this->db->join('T_MaterialMaster MM','st.MaterialCode=MM.MaterialCode');
|
|
|
|
|
|
$query = $this->db->get();
|
|
//print_r($this->db->last_query());
|
|
|
|
$result = $query->result();
|
|
return $result;
|
|
}
|
|
|
|
// function viewStock()
|
|
// {
|
|
// $this->db->distinct();
|
|
// $this->db->select('st.*,st.Remarks as storeremarks,MM.*,RDet.DeliveredQuantity');
|
|
// $this->db->from('T_Store_Stockdetails st ');
|
|
// $this->db->join('T_MaterialMaster MM','st.MaterialCode=MM.MaterialCode');
|
|
// $this->db->join('T_Requestion_Details RDet','st.MaterialCode=RDet.MaterialCode and MM.MaterialCode=RDet.MaterialCode');
|
|
|
|
// $query = $this->db->get();
|
|
|
|
// $result = $query->result();
|
|
// //print_r($this->db->last_query());
|
|
// return $result;
|
|
// }
|
|
function GetAllMaterialList()
|
|
{
|
|
|
|
$subQuery = 'select MM.* from T_MaterialMaster MM where MaterialCode not in(select MaterialCode from T_Store_Stockdetails)';
|
|
$query = $this->db->query($subQuery);
|
|
return $query->result();
|
|
}
|
|
function GetConfigValue($ConfigID)
|
|
{
|
|
$this->db->select('ConfigValue');
|
|
$this->db->from('T_ConfigDetails');
|
|
$this->db->where('Config_ID',$ConfigID);
|
|
$query = $this->db->get();
|
|
|
|
$result = $query->result();
|
|
return $result;
|
|
}
|
|
function addStock($StockDetails)
|
|
{
|
|
|
|
$this->db->trans_start();
|
|
$this->db->insert('T_Store_Stockdetails', $StockDetails);
|
|
$insert_id = $this->db->affected_rows();
|
|
$this->db->trans_complete();
|
|
}
|
|
|
|
function UpdateStock($StockDetails,$MaterialCode)
|
|
{
|
|
$this->db->where('MaterialCode',$MaterialCode);
|
|
$this->db->update('T_Store_Stockdetails',$StockDetails);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|