Common master file
This commit is contained in:
parent
73bbaa3244
commit
3f07de22ae
@ -61,7 +61,11 @@ $route['translate_uri_dashes'] = FALSE;
|
||||
*/
|
||||
/* Routes regards Common Masters CRUD operations*/
|
||||
|
||||
$route['getListOfSubProduct'] = 'Common_Masters_Controller/getListOfSubProduct';
|
||||
$route['getListOfBranches'] = 'Common_Masters_Controller/getListOfBranches';
|
||||
$route['getListOfCompany'] = 'Common_Masters_Controller/getListOfCompany';
|
||||
$route['getListOfState'] = 'Common_Masters_Controller/getListOfState';
|
||||
$route['getListOfCity'] = 'Common_Masters_Controller/getListOfCity';
|
||||
$route['saveBranch'] = 'Common_Masters_Controller/saveBranch';
|
||||
|
||||
$route['getListOfMaster'] = 'Common_Masters_Controller/getListOfMaster';
|
||||
|
||||
@ -999,9 +999,11 @@ class Common_Masters_Controller extends REST_Controller {
|
||||
|
||||
public function saveMaster_post()
|
||||
{
|
||||
echo 'dfsf';
|
||||
$records = $this->post('records');
|
||||
$table_name = $this->post('master_name');
|
||||
|
||||
print_r($records);
|
||||
//die();
|
||||
|
||||
if(false !== array_key_exists(constant($table_name.'ID'),$records)) //Update Record
|
||||
{
|
||||
@ -1051,7 +1053,169 @@ class Common_Masters_Controller extends REST_Controller {
|
||||
|
||||
|
||||
/* End Of Save,Update and Retrieve all Master Tables */
|
||||
|
||||
/* For Branch Listing */
|
||||
public function getListOfBranches_get(){
|
||||
echo "asfd";
|
||||
die;
|
||||
$columns = array('m_city.name as cityname','BRANCH.*');
|
||||
$table = BRANCH.' as BRANCH';
|
||||
$joins = array(
|
||||
array(
|
||||
'table' => 'm_city',
|
||||
'condition' => 'BRANCH.fk_city_id = m_city.city_id ',
|
||||
'jointype' => 'INNER'
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
|
||||
$result = $this->Common_Masters_Model->getJoinRecords($columns,$table,$joins,$print_query = '');
|
||||
|
||||
if(count($result) > 0)
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $result;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
}
|
||||
/* End Of Branch Master */
|
||||
|
||||
/* For Company Listing */
|
||||
public function getListOfCompany_get(){
|
||||
$columns = array('m_city.name as city_name','m_states.name as state_name','COMPANY.*');
|
||||
$table = COMPANY.' as COMPANY';
|
||||
$joins = array(
|
||||
array(
|
||||
'table' => 'm_city',
|
||||
'condition' => 'COMPANY.city = m_city.city_id ',
|
||||
'jointype' => 'INNER'
|
||||
),
|
||||
array(
|
||||
'table' => 'm_states',
|
||||
'condition' => 'COMPANY.state = m_states.state_id',
|
||||
'jointype' => 'INNER'
|
||||
)
|
||||
);
|
||||
|
||||
$result = $this->Common_Masters_Model->getJoinRecords($columns,$table,$joins,$print_query = '');
|
||||
//print_r($result);
|
||||
//die();
|
||||
if(count($result) > 0)
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $result;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
}
|
||||
/* End of Company Listing */
|
||||
|
||||
/* For Product Listing */
|
||||
public function getListOfSubProduct_get(){
|
||||
$columns = array('m_products.name as product_name','SUBPRODUCTS.*');
|
||||
$table = SUBPRODUCTS.' as SUBPRODUCTS';
|
||||
$joins = array(
|
||||
array(
|
||||
'table' => 'm_products',
|
||||
'condition' => 'SUBPRODUCTS.fk_product_id = m_products.product_id',
|
||||
'jointype' => 'INNER'
|
||||
)
|
||||
);
|
||||
|
||||
$result = $this->Common_Masters_Model->getJoinRecords($columns,$table,$joins,$print_query = '');
|
||||
|
||||
if(count($result) > 0)
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $result;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
}
|
||||
/* End of Product Listing */
|
||||
|
||||
/* For State Listing */
|
||||
public function getListOfState_get(){
|
||||
$columns = array('m_regions.name as region_name','STATE.*');
|
||||
$table = STATE.' as STATE';
|
||||
$joins = array(
|
||||
array(
|
||||
'table' => 'm_regions',
|
||||
'condition' => 'STATE.fk_region_id = m_regions.region_id ',
|
||||
'jointype' => 'INNER'
|
||||
)
|
||||
);
|
||||
|
||||
$result = $this->Common_Masters_Model->getJoinRecords($columns,$table,$joins,$print_query = '');
|
||||
|
||||
if(count($result) > 0)
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $result;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
}
|
||||
/* End of State Listing */
|
||||
|
||||
/* For City Listing */
|
||||
public function getListOfCity_get(){
|
||||
$columns = array('m_states.name as state_name','CITY.*');
|
||||
$table = CITY.' as CITY';
|
||||
$joins = array(
|
||||
array(
|
||||
'table' => 'm_states',
|
||||
'condition' => 'CITY.fk_state_id = m_states.state_id ',
|
||||
'jointype' => 'INNER'
|
||||
)
|
||||
);
|
||||
|
||||
$result = $this->Common_Masters_Model->getJoinRecords($columns,$table,$joins,$print_query = '');
|
||||
|
||||
if(count($result) > 0)
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $result;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
}
|
||||
/* End of City Listing */
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user