ASSESSED INCOME MULTIPLE2

This commit is contained in:
velz 2018-11-20 17:22:55 +05:30
parent ac272d4135
commit bf8bf3d5ad
2 changed files with 42 additions and 35 deletions

View File

@ -87,7 +87,7 @@ defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest auto
// define login route name for token verification // define login route name for token verification
//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors //defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors
//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listAllTemplates/:any)'); // no errors //defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listAllTemplates/:any)'); // no errors
defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'saveAssessedIncomeSalesCalculatedByItemwise'); // no errors defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'saveAssessedIncomeMonthwiseItems'); // no errors
/*********************AWS resources Constants*************************************************/ /*********************AWS resources Constants*************************************************/
defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic'); defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic');

View File

@ -1963,49 +1963,56 @@ class PD_Controller extends REST_Controller {
public function saveAssessedIncomeMonthwiseItems_post()//SALESITEMMONTHWISECHILD public function saveAssessedIncomeMonthwiseItems_post()//SALESITEMMONTHWISECHILD
{ {
$records = $this->post('records'); $records = $this->post('records');
$child_data = array(); $count = 0;
if(array_key_exists('child',$records)) foreach($records as $key => $record)
{ {
$child_data = $records['child'];
unset($records['child']); $child_data = array();
} if(array_key_exists('child',$record))
$id = "";
if($records['sim_id'] != null || $records['sim_id'] != "")
{
$where_condition_array = array('sim_id'=>$records['sim_id']);
$id = $this->PD_Model->updateRecords($records,SALESITEMMONTHWISE,$where_condition_array);
if($id != "" || $id != null)
{
foreach($child_data as $ckey => $child)
{ {
if($child['simc_id'] != "" || $child['simc_id'] != null) $child_data = $record['child'];
unset($record['child']);
}
$id = "";
if($record['sim_id'] != null || $record['sim_id'] != "")
{
$where_condition_array = array('sim_id'=>$record['sim_id']);
$id = $this->PD_Model->updateRecords($record,SALESITEMMONTHWISE,$where_condition_array);
if($id != "" || $id != null)
{ {
$where_condition_array = array('simc_id'=>$child['simc_id']); $count++;
$child_id = $this->PD_Model->updateRecords($child,SALESITEMMONTHWISECHILD,$where_condition_array); foreach($child_data as $ckey => $child)
{
if($child['simc_id'] != "" || $child['simc_id'] != null)
{
$where_condition_array = array('simc_id'=>$child['simc_id']);
$child_id = $this->PD_Model->updateRecords($child,SALESITEMMONTHWISECHILD,$where_condition_array);
}
else
{
$child['fk_sim_id'] = $records['sim_id'];
$child_id = $this->PD_Model->saveRecords($child,SALESITEMMONTHWISECHILD);
}
}
} }
else
}
else
{
$id = $this->PD_Model->saveRecords($record,SALESITEMMONTHWISE);
if($id != "" || $id != null)
{ {
$child['fk_sim_id'] = $records['sim_id']; $count++;
$child_id = $this->PD_Model->saveRecords($child,SALESITEMMONTHWISECHILD); foreach($child_data as $ckey => $child)
{
$child['fk_sim_id'] = $id;
$child_id = $this->PD_Model->saveRecords($child,SALESITEMMONTHWISECHILD);
}
} }
} }
}
}
else
{
$id = $this->PD_Model->saveRecords($records,SALESITEMMONTHWISE);
if($id != "" || $id != null)
{
foreach($child_data as $ckey => $child)
{
$child['fk_sim_id'] = $id;
$child_id = $this->PD_Model->saveRecords($child,SALESITEMMONTHWISECHILD);
}
}
} }
if($id != "" || $id != null) if($count == count($records))
{ {
$data['dataStatus'] = true; $data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK; $data['status'] = REST_Controller::HTTP_OK;