TAT AND COMANY

This commit is contained in:
velz 2019-01-04 13:17:18 +05:30
parent 3d1c3827cf
commit 251fd6a6e1
4 changed files with 72 additions and 6 deletions

View File

@ -302,7 +302,10 @@ defined('ENTITYBILLINGCONTACTINFO') OR define('ENTITYBILLINGCONTACTINFO','m_enti
defined('ENTITYBILLINGCONTACTINFOID') OR define('ENTITYBILLINGCONTACTINFOID','entity_billing_contact_id');
defined('ENTITYTAT') OR define('ENTITYTAT','m_entity_tat');
defined('ENTITYTATID') OR define('ENTITYTATID','entity_tat_id');
defined('ENTITYTATID') OR define('ENTITYTATID','entity_tat_master_id');
defined('ENTITYTATCHILD') OR define('ENTITYTATCHILD','m_entity_tat_child');
defined('ENTITYTATCHILDID') OR define('ENTITYTATCHILDID','entity_tat_child_id');
defined('ENTITYPDPRICEINFO') OR define('ENTITYPDPRICEINFO','m_entity_pdprice_info');
defined('ENTITYPDPRICEINFOID') OR define('ENTITYPDPRICEINFOID','entity_pdprice_id');

View File

@ -138,6 +138,7 @@ $route['saveVendorCityMapping'] = 'Entity_Management_Controller/saveVendorCityMa
$route['getVendorCityMap'] = 'Entity_Management_Controller/getVendorCityMap';
$route['saveLenderBranches'] = 'Entity_Management_Controller/saveLenderBranches';
$route['listLenderBranches'] = 'Entity_Management_Controller/listLenderBranches';
$route['getFullTATInfo'] = 'Entity_Management_Controller/getFullTATInfo';
//PD RELATED
$route['triggerNewPD'] = 'PD_Controller/triggerNewPD';

View File

@ -605,4 +605,66 @@ class Entity_Management_Controller extends REST_Controller {
}
public function getFullTATInfo_post()
{
//echo "dssd";
$records = $this->post('records');
$entity_id = $records['fk_entity_id'];
//print_r($this->post('records'));
$fields = array('entity_tat_master_id', 'fk_entity_id', 'tat1', 'tat2');
$where_condition_array = array('fk_entity_id' => $entity_id,'isactive'=>1);
$tat_master_records = $this->Entity_Management_Model->selectCustomRecords($fields,$where_condition_array,ENTITYTAT);
if(count($tat_master_records))
{
foreach($tat_master_records as $tat_key => $tat)
{
$columns = array('entity_tat_child_id', 'fk_city_id','CITY.name as city_name','fk_pd_type_id','PDTYPE.type_name as pd_type_name','fk_product_id','PRODUCTS.name as prodcut_name' , 'fk_tat_master_id');
$table = ENTITYTATCHILD.' as ENTITYTATCHILD';
$joins = array(
array('table' => CITY. ' as CITY',
'condition' =>'ENTITYTATCHILD.fk_city_id = CITY.city_id',
'jointype' => 'INNER'),
array('table' => PRODUCTS. ' as PRODUCTS',
'condition' =>'ENTITYTATCHILD.fk_product_id = PRODUCTS.product_id',
'jointype' => 'INNER'),
array('table' => PDTYPE. ' as PDTYPE',
'condition' =>'ENTITYTATCHILD.fk_pd_type_id = PDTYPE.pd_type_id',
'jointype' => 'INNER')
);
$where_condition_array = array('ENTITYTATCHILD.isactive' => 1,'ENTITYTATCHILD.fk_tat_master_id' => $tat['entity_tat_master_id']);
$entity_tat_child = $this->Entity_Management_Model->getJoinRecords($columns,$table,$joins,$where_condition_array);
$final_child = array();
foreach($entity_tat_child as $child_key => $child)
{
$temp = array();
$temp['entity_tat_child_id'] = $child['entity_tat_child_id'];
$temp['city'] = array('id' => $child['fk_city_id'],'name' => $child['city_name']);
$temp['prodcut'] = array('id' => $child['fk_product_id'],'name' => $child['prodcut_name']);
$temp['pdtye'] = array('id' => $child['fk_pd_type_id'],'name' => $child['pd_type_name']);
$final_child[] = $temp;
}
$tat_master_records[$tat_key]['child'] = $final_child;
}
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = $tat_master_records;
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
$data['msg'] = "No Data Available";
$this->response($data,REST_Controller::HTTP_OK);
}
}
}

View File

@ -2086,19 +2086,19 @@ class PD_Controller extends REST_Controller {
$pd_id = $this->post('pd_id');
$pd_form_id = $this->post('pd_form_id');
$company_id = null;
if(isset($records['company_id']))
if($this->post('company_id'))
{
$company_id = $records['company_id'];
$company_id = $this->post('company_id');
}
//print_r();
$fields = array('json');
$where_condition_array = array('isactive' => 1,'fk_form_id'=>$pd_form_id,'fk_pd_id'=>$pd_id);
if($company_id != null)
{
$where_condition_array = array('fk_form_id'=>$formid,'fk_pd_id'=>$pdid,'company_id' => $company_id);
$where_condition_array = array('fk_form_id'=>$pd_form_id,'fk_pd_id'=>$pd_id,'company_id' => $company_id);
}
$rec = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON);
// print_r($rec);die();
//print_r($this->db->last_query());die();
if(count($rec))
{
$data['dataStatus'] = true;