SAVE TAT INFO

This commit is contained in:
velz 2019-01-05 12:54:09 +05:30
parent 49126361a4
commit ec7100fc52
2 changed files with 36 additions and 0 deletions

View File

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

View File

@ -667,4 +667,39 @@ class Entity_Management_Controller extends REST_Controller {
}
public function saveTATInfo_post()
{
$records = $this->post('records');
$count = 0;
// if($records['entity_tat_master_id'] == "" || $records['entity_tat_master_id'] == null)
// {
$temp = array('fk_entity_id'=>$records['fk_entity_id'],'tat1'=>$records['tat1'],'tat2'=>$records['tat2'],'fk_createdby'=>$records['fk_createdby']);
$id = $this->Entity_Management_Model->saveRecords($temp,ENTITYTAT);
if($id != null || $id != "")
{
foreach($records['child'] as $key => $child)
{
$temp = array('fk_city_id'=>substr($child,0,1),'fk_product_id'=>substr($child,1,1),'fk_pd_type_id'=>substr($child,2,1),'fk_tat_master_id'=>$id);
$cid = $this->Entity_Management_Model->saveRecords($temp,ENTITYTATCHILD);
if($cid != "" || $cid != null) { $count++; }
}
}
if($count != 0 && ($count == count($records['child'])))
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = $count;
$this->response($data,REST_Controller::HTTP_OK);
}
// }
// else
// {
// }
}
}