if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$this->utilityclass->lmAuthFirstProceeding($case_no);
$geo_date_query = $this->db->query("Select date_entry from supportive_document where applid='$case_no'")->row();
$geo_date = isset($geo_date_query->date_entry) ? $geo_date_query->date_entry : '.....';
$mStat = false;
foreach ($lmdata['applicants_buyers'] as $applicantRow) {
if ($applicantRow->is_applicant == 1) {
if ($applicantRow->marital_status == '1') {
$mStat = true;
}
}
}
$mStatErr = false;
$hasSpouse = false;
if ($mStat == true) {
foreach ($lmdata['applicants_buyers'] as $applicantRow) {
if ($applicantRow->is_applicant != 1) {
if ($applicantRow->pdar_rel_guar == '3') {
$hasSpouse = true;
}
if ($applicantRow->pdar_rel_guar == '4') {
$hasSpouse = true;
}
if ($hasSpouse) {
break;
}
}
}
if (!$hasSpouse) {
$mStatErr = true;
}
}
if ($mStatErr == true) {
$data = array(
'error' => '#ERR14233: Spouse details has to be added if you select applicant as married!!!' . $case_no,
);
echo json_encode($data);
return false;
}
// row_array
$basic = $this->SettlementKhasModel->getSettlementBasic($case_no);
$applicants_buyers = $this->SettlementKhasModel->getAllApplicantBuyers($case_no);
$applicants_owners = $this->SettlementKhasModel->getAllApplicantOwners($case_no);
$applicants_encroacher = $this->SettlementKhasModel->getAllApplicantEncroacher($case_no);
$applicants_riotee_nok = $this->SettlementKhasModel->getAllApplicantRioteeNok($case_no);
$dags = $this->SettlementKhasModel->getSettlementDag($case_no);
$lmnotes = $this->SettlementKhasModel->getSettlementTenantLmNote($case_no);
$proceedings = $this->SettlementKhasModel->getSettlementProceeding($case_no);
$dhardocuments = $this->SettlementKhasModel->getDocuments($case_no);
$d = $basic["dist_code"];
$s = $basic["subdiv_code"];
$c = $basic["cir_code"];
$m = $basic["mouza_pargona_code"];
$l = $basic["lot_no"];
$v = $basic["vill_townprt_code"];
/// premium
$lmdata['co_name'] = $this->SettlementCommonModel->getCoName($d, $s, $c);
$lmdata['s_area'] = $this->SettlementCommonModel->getPremiumArea();
$premiumData = $this->db->query("Select * from settlement_premium where case_no='$case_no' and is_final=1")->row();
$lmdata['premiumData'] = $premiumData;
/// premium end
$lmdata['basic'] = $basic;
$lmdata['geo_date'] = $geo_date;
$lmdata['applicants_buyers'] = $applicants_buyers;
$lmdata['applicants_owners'] = $applicants_owners;
$lmdata['applicants_encroacher'] = $applicants_encroacher;
$lmdata['applicants_riotee_nok'] = $applicants_riotee_nok;
$lmdata['reservation'] = $this->SettlementVgrModel->getSettlementReservation($case_no);
$lmdata['dags'] = $dags;
$lmdata['lmnotes'] = $lmnotes;
$lmdata['proceedings'] = $proceedings;
$lmdata['dhardocuments'] = $dhardocuments;
if ($applicants_encroacher == true) {
foreach ($applicants_encroacher as $encroacher) {
$vlb_encroacher = $this->SettlementApModel->getEncroacherDetails($d, $s, $c, $m, $l, $v, $encroacher->dag_no);
$district['vlb_enc'] = $vlb_encroacher;
if ($vlb_encroacher == true) {
// getting the encroacher details
$vlb_encroacher_in_dag = $this->SettlementApModel->getEncroacherInDag($vlb_encroacher->id);
//var_dump($vlb_encroacher_in_dag); die();
$vlb_enc_details[] = $vlb_encroacher_in_dag;
} else {
$lmdata['empty_err'] = "No Land Bank Details found!!";
}
}
$lmdata['vlb_enc_details'] = $vlb_enc_details;
}
foreach ($applicants_encroacher as $encroacher_prem) {
$revenue[] = $this->db->query("Select dag_revenue,dag_area_b,dag_area_k,dag_area_lc,dag_area_g,dag_area_kr,dag_no from chitha_basic where dist_code='$d' and "
. "subdiv_code='$s' and cir_code='$c' and mouza_pargona_code='$m' and lot_no='$l' and vill_townprt_code='$v' and dag_no='$encroacher_prem->dag_no'")->result();
$lmdata['revenue'] = $revenue;
}
// calling API for self declaration data
$sql = "Select basundhara from basundhar_application where dharitree='$case_no' ";
$basundhara = $this->db->query($sql)->row();
$token = $this->utilityclass->createTokenJwt();
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, API_LINK_NC . "getAppDetails");
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, http_build_query(array(
'application_no' => $basundhara->basundhara,
'api_key' => API_KEY,
'token' => $token
)));
$output = curl_exec($curl_handle);
if (isset(json_decode($output)->responseType)) {
if (json_decode($output)->responseType == 3) {
echo json_decode($output)->data . " - Unauthorized access!";
return false;
}
}
curl_close($curl_handle);
$output = json_decode($output);
//var_dump($output);
$lmdata['document'] = $output->documents;
$lmdata['query'] = $output->query;
$lmdata['property'] = $output->property;
$lmdata['aadhar'] = $output->aadhar;
$lmdata['nextKin'] = $output->nextKin;
foreach ($output->selfDeclaration as $selfDec) {
$lmdata['selfDeclarationDetails'] = json_decode($selfDec->dec_details);
}
foreach ($lmdata['applicants_buyers'] as $adhar_photo):
if ($adhar_photo->is_applicant == 1):
if (trim($adhar_photo->identity_type) == 'AADHAAR'):
$adhar_photo_link = $adhar_photo->identity_doc_link;
$open_adhar_file = fopen($adhar_photo_link, "r") or die("Unable to open file!");
$read_adhar_file = fread($open_adhar_file, filesize($adhar_photo_link));
fclose($open_adhar_file);
// decoding the base64 encoding file variable
$lmdata['base64_decoded_adhar_file'] = "<img src = data:" . $this->decodeBase64($read_adhar_file) . ";base64," . $read_adhar_file . " class='img-thumbnail' alt='Adhar Photo' width='170' height='200'>";
endif;
endif;
endforeach;
// for guardian relation
$query_for_guar_rel = "SELECT * from master_guard_rel WHERE id NOT IN ('5','6')";
$relation_executation = $this->db->query($query_for_guar_rel);
$row = $relation_executation->num_rows();
if ($row != 0) {
$lmdata['guar_rel'] = $relation_executation->result();
}
/// vlb data
if (isset($dags)) {
foreach ($dags as $vlb_dag) {
$sqlvlbcheck = $this->db->query("SELECT * FROM settlement_land_bank_details WHERE application_no = ? AND dag_no = ?", array($application_no, $vlb_dag->dag_no));
if ($sqlvlbcheck->num_rows() > 0) {
$vlb_newly_added[] = $sqlvlbcheck->row()->dag_no;
} else {
$vlb_newly_added[] = false;
}
}
$lmdata['vlb_newly_added'] = $vlb_newly_added;
}
$lmdata['case_no'] = $case_no;
// For insertion of settlement khasland
$distCode = trim($this->input->post('dist_code'));
if ($distCode == null) {
redirect(base_url() . 'index.php/basundhara2/settlementCases');
}
if ($application_no == null) {
redirect(base_url() . 'index.php/basundhara2/settlementCases');
}
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="error alert-danger">', '</div>');
//********validation bypass */
$validation_bypass = 0;
if ($_POST['lm_note'] == '2') {
if (isset($_POST['rejected_reasons'])) {
$validation_bypass_array = $this->getValidationBypass(LABOUR_LINE_LAND_ID);
foreach ($_POST['rejected_reasons'] as $rej_list_key => $rej_form_code) {
$r_c = explode("_", $rej_form_code);
if (in_array($r_c[0], $validation_bypass_array)) {
$validation_bypass = 1;
}
}
}
}
//****checking if validation is required */
if ($validation_bypass == 0) {
if ($_POST['lm_note'] == '2') {
$this->form_validation->set_rules('rejected_reasons', 'Rejected reason', 'required');
if (isset($_POST['rejected_reasons'])) {
foreach ($_POST['rejected_reasons'] as $rej_list_key => $rej_list) {
$this->form_validation->set_rules('rejected_reasons[' . $rej_list_key . ']', '', '');
}
}
if (isset($_POST['sub_rejected_reasons'])) {
foreach ($_POST['sub_rejected_reasons'] as $sub_rej_key => $val) {
$this->form_validation->set_rules('sub_rejected_reasons[' . $sub_rej_key . ']', 'Sub Rejected reason', 'required|min_length[1]');
}
}
}
//******Geo tag validation */
$geo_tag_dags = array();
foreach ($lmdata['dags'] as $geo_tag) {
$geo_tag_dags[] = $geo_tag->dag_no;
}
$geo_tag_dags_array = "'" . implode("','", $geo_tag_dags) . "'";
$get_tag_dag_count = $this->db->query("select count(t.applid) from (select distinct on (applid, dag_no) applid, dag_no from supportive_document where applid= ? AND file_name = ? and dag_no in ($geo_tag_dags_array)) t", array($application_no, GEO_TAG_PHOTO))->row()->count;
$total_dag_count = count($lmdata['dags']);
if ((int)$get_tag_dag_count != (int)$total_dag_count) {
if (GEO_TAG_ACTIVE_STATUS == 1) {
$this->form_validation->set_rules('geo_tag_photo', 'Geo tag photo', 'required');
}
}
$this->form_validation->set_rules('service_code', 'Service Code', 'trim|required|is_natural');
$this->form_validation->set_rules('lot_no', 'Lot Number', 'trim|required');
$this->form_validation->set_rules('case_no', 'Case No', 'trim|required|min_length[2]');
$this->form_validation->set_rules('is_urban', 'Is Urban', 'trim|required');
$this->form_validation->set_rules('uuid', 'uuid', 'trim|required');
$this->form_validation->set_rules('dist_name', 'District Name', 'trim|required');
$this->form_validation->set_rules('dist_code', 'District Code', 'trim|required');
$this->form_validation->set_rules('subdiv_name', 'Sub Division Name', 'trim|required');
$this->form_validation->set_rules('subdiv_code', 'Sub Division Code', 'trim|required');
$this->form_validation->set_rules('circle_name', 'Circle Name', 'trim|required');
$this->form_validation->set_rules('cir_code', 'Circle Code', 'trim|required');
$this->form_validation->set_rules('mouza_name', ' Mouza Name', 'trim|required');
$this->form_validation->set_rules('mouza_pargona_code', 'Mouza Code ', 'trim|required');
$this->form_validation->set_rules('village_name', 'Village Name ', 'trim|required');
$this->form_validation->set_rules('vill_townprt_code', 'Village Code ', 'trim|required');
$this->form_validation->set_rules('occupation_applicant', 'Schedule of the land and area under occupation', 'trim|required');
$this->form_validation->set_rules('caste', 'Caste', 'trim|required');
$this->form_validation->set_rules('chitha_verified', 'Chitha Verified', 'trim|required');
$this->form_validation->set_rules('vlb_verified', 'VLB Verified', 'trim|required');
$this->form_validation->set_rules('bhumiputra_confirmation_lm', 'Bhumiputra Verified', 'trim|required');
$this->form_validation->set_rules('is_tribal_belt', 'Whether Tribal', 'trim|required');
$this->form_validation->set_rules('protected_class_lm', 'Protected Category', 'trim|required|is_natural|greater_than[0]');
$this->form_validation->set_rules('landslide', ' Is Area Under cover landslide clone ', 'trim|required');
$this->form_validation->set_rules('erosion', ' Is Land falls under erosion ', 'trim|required');
// $this->form_validation->set_rules('encroacher_exist_vlb', 'Is Encroacher Exists in VLB ?', 'trim|required');
$this->form_validation->set_rules('possession_verification', 'Possession Verified', 'trim|required');
// $this->form_validation->set_rules('nature_possession', 'Nature of Possession', 'trim|required');
$this->form_validation->set_rules('is_landless', 'Whether application is landless', 'trim|required');
$this->form_validation->set_rules('land_falls', 'Whether the proposed land falls under', 'trim|required|is_natural|greater_than[0]');
$this->form_validation->set_rules('falls_und_gmc', 'Falls Under GMC', 'trim|required');
$this->form_validation->set_rules('roadside_comment_check', 'Roadside/Riverside Reservation', 'trim|required');
$this->form_validation->set_rules('family_comment_check', ' Whether applicant family has occupied any land', 'trim|required');
// $this->form_validation->set_rules('zonal_valuation', 'Zonal Valuation', 'trim|required|numeric|greater_than[0]');
//$this->form_validation->set_rules('field_report', 'Field Report', 'trim|required');
$this->form_validation->set_rules('lm_note', 'LM Remarks', 'trim|required');
$this->form_validation->set_rules('lm_remark_text', 'LM Remarks (Text Area)', 'trim|required');
$this->form_validation->set_rules('co_code', 'Select SK/Circle Officer', 'trim|required');
$this->form_validation->set_rules('roadside_reservation', '', '');
$this->form_validation->set_rules('validationcheck', 'Premium Calculation', 'trim|required');
$this->form_validation->set_rules('totaldue', 'Premium Amount', 'trim|required');
if (empty($_FILES['field_report']['name'])) {
$this->form_validation->set_rules('field_report', 'Field report document', 'required');
}
$roadside_comment_check = $this->input->post('roadside_comment_check');
$family_comment_check = $this->input->post('family_comment_check');
$totalDagAreaLessaValidation = 0;
$totalAgrAreaLessaValidation = 0;
$totalHomeAreaLessaValidation = 0;
$appAreaMoreThanDagA = 0;
$reserveMoreThanAppArea = 0;
$familyMoreThanAppArea = 0;
$fishAreaLessaValidation = 0;
$totalRoadSideAreaLessaValidation = 0;
$totalFamilyAreaLessaValidation = 0;
$totalFishAreaLessaValidation = 0;
$enc_count = count($applicants_encroacher);
$enc_avl_check = 0;
if ($applicants_encroacher == true) {
$enc_avl_check = $enc_count;
foreach ($applicants_encroacher as $enc_applicant) {
if ($this->input->post('encroacher_exist_vlb' . $enc_applicant->id) != 4) {
$this->form_validation->set_rules('encroacher_exist_vlb' . $enc_applicant->id, 'Encroacher exist in VLB', 'trim|required|is_natural');
$this->form_validation->set_rules('enc_dag' . $enc_applicant->id, 'Encroachers Dag No.', 'trim|required|is_natural');
$this->form_validation->set_rules('period_possession' . $enc_applicant->id, 'Encroachers Period Possession', 'trim|required');
$this->form_validation->set_rules('riotee_name' . $enc_applicant->id, 'Encroachers Name', 'trim|required|min_length[3]|max_length[70]');
$this->form_validation->set_rules('riotee_guardian' . $enc_applicant->id, 'Encroachers Guardian', 'trim|required|min_length[1]|max_length[70]');
// $this->form_validation->set_rules('enc_id'.$enc_applicant->id, 'Encroacher Id', 'trim|required|is_natural');
} else {
$enc_avl_check++;
$this->form_validation->set_rules('encroacher_exist_vlb' . $enc_applicant->id, '', '');
$this->form_validation->set_rules('encroacher_exist_vlb' . $enc_applicant->id, '', '');
$this->form_validation->set_rules('enc_dag' . $enc_applicant->id, '', '');
$this->form_validation->set_rules('period_possession' . $enc_applicant->id, '', '');
$this->form_validation->set_rules('riotee_name' . $enc_applicant->id, '', '');
$this->form_validation->set_rules('riotee_guardian' . $enc_applicant->id, '', '');
}
}
if ($enc_avl_check != $enc_count) {
if ($enc_avl_check != ((int)$enc_count * 2)) {
$this->form_validation->set_rules('encroacher_exist_vlb', '(If you select "Name does not exist and also not in possession" for one Dag then the uneligible dag must be deleted from area details!)', 'required');
}
}
}
foreach ($lmdata['dags'] as $dag_area_cal) {
//******NCBTAD check */
$ncBtadCheck = $this->SettlementCommonModel->ncBtadCheck($dag_area_cal->dist_code, $dag_area_cal->subdiv_code, $dag_area_cal->cir_code, $dag_area_cal->mouza_pargona_code, $dag_area_cal->lot_no, $dag_area_cal->vill_townprt_code, $dag_area_cal->dag_no);
if ($ncBtadCheck > 0) {
//*******throw error for NCBTAD */
log_message('error', '#ERR1674: This village is mapped as NCBTAD! ' . $case_no);
$this->session->set_flashdata('message', "#ERR1674: This village is mapped as NCBTAD! " . $case_no);
redirect(base_url() . "index.php/home");
}
$this->form_validation->set_rules('nature_possession' . $dag_area_cal->dag_no, 'Nature of Possession', 'trim|required');
// new premium addition
// $this->form_validation->set_rules('area'.$dag_area_cal->dag_no, 'Select Area Type', 'trim|required');
$this->form_validation->set_rules('area_new' . $dag_area_cal->dag_no, 'Select Area Type', 'trim|required');
// for barak valley
if (in_array($distCode, json_decode(BARAK_VALLEY))) {
if (empty($_FILES['trace_map_copy' . $dag_area_cal->dag_no]['name'])) {
$this->form_validation->set_rules('trace_map_copy' . $dag_area_cal->dag_no, 'Trace map document', 'required');
}
$this->form_validation->set_rules('landmark_east' . $dag_area_cal->dag_no, 'East Landmark', 'trim|required|xss_clean');
$this->form_validation->set_rules('landmark_west' . $dag_area_cal->dag_no, 'West Landmark', 'trim|required|xss_clean');
$this->form_validation->set_rules('landmark_north' . $dag_area_cal->dag_no, 'North Landmark', 'trim|required|xss_clean');
$this->form_validation->set_rules('landmark_south' . $dag_area_cal->dag_no, 'South Landmark', 'trim|required|xss_clean');
$this->form_validation->set_rules('zonal_valuation_prem' . $dag_area_cal->dag_no, 'Zonal Value', 'trim|required|xss_clean');
$bighaValidation = $this->UtilsModel->defaultValue($this->input->post('dag_area_b' . $dag_area_cal->dag_no), 0);
$kathaValidation = $this->UtilsModel->defaultValue($this->input->post('dag_area_k' . $dag_area_cal->dag_no), 0);
$lessaValidation = $this->UtilsModel->defaultValue($this->input->post('dag_area_lc' . $dag_area_cal->dag_no), 0);
$gandaValidation = $this->UtilsModel->defaultValue($this->input->post('dag_area_g' . $dag_area_cal->dag_no), 0);
// $bighaValidationHome = $this->UtilsModel->defaultValue($this->input->post('home_b' . $dag_area_cal->dag_no), 0);
// $kathaValidationHome = $this->UtilsModel->defaultValue($this->input->post('home_k' . $dag_area_cal->dag_no), 0);
// $lessaValidationHome = $this->UtilsModel->defaultValue($this->input->post('home_lc' . $dag_area_cal->dag_no), 0);
// $gandaValidationHome = $this->UtilsModel->defaultValue($this->input->post('home_g' . $dag_area_cal->dag_no), 0);
// $bighaValidationAgr = $this->UtilsModel->defaultValue($this->input->post('agri_b' . $dag_area_cal->dag_no), 0);
// $kathaValidationAgr = $this->UtilsModel->defaultValue($this->input->post('agri_k' . $dag_area_cal->dag_no), 0);
// $lessaValidationAgr = $this->UtilsModel->defaultValue($this->input->post('agri_lc' . $dag_area_cal->dag_no), 0);
// $gandaValidationAgr = $this->UtilsModel->defaultValue($this->input->post('agri_g' . $dag_area_cal->dag_no), 0);
// $bighaValidationFish = $this->UtilsModel->defaultValue($this->input->post('fbigha' . $dag_area_cal->dag_no), 0);
// $kathaValidationFish = $this->UtilsModel->defaultValue($this->input->post('fkatha' . $dag_area_cal->dag_no), 0);
// $lessaValidationFish = $this->UtilsModel->defaultValue($this->input->post('flessa' . $dag_area_cal->dag_no), 0);
// $gandaValidationFish = $this->UtilsModel->defaultValue($this->input->post('fganda' . $dag_area_cal->dag_no), 0);
$dagAreaLessaValidation = ($bighaValidation * 6400) + ($kathaValidation * 320) + ($lessaValidation * 20) + $gandaValidation;
// $homeAreaLessaValidation = ($bighaValidationHome * 6400) + ($kathaValidationHome * 320) + ($lessaValidationHome * 20) + $gandaValidationHome;
// $agrAreaLessaValidation = ($bighaValidationAgr * 6400) + ($kathaValidationAgr * 320) + ($lessaValidationAgr * 20) + $gandaValidationAgr;
// $fishAreaLessaValidation = ($bighaValidationFish * 6400) + ($kathaValidationFish * 320) + ($lessaValidationFish * 20) + $gandaValidationFish;
if ($dagAreaLessaValidation < $agrAreaLessaValidation + $homeAreaLessaValidation + $fishAreaLessaValidation) {
$appAreaMoreThanDagA = 1;
}
$totalDagAreaLessaValidation += $dagAreaLessaValidation;
$totalHomeAreaLessaValidation += $homeAreaLessaValidation;
$totalAgrAreaLessaValidation += $agrAreaLessaValidation;
$totalFishAreaLessaValidation += $fishAreaLessaValidation;
if ($roadside_comment_check == 'YES') {
$this->form_validation->set_rules('reserved_dag_road' . $dag_area_cal->dag_no, 'Reserved Dag', 'trim|required|is_natural');
$this->form_validation->set_rules('reserved_patta_road' . $dag_area_cal->dag_no, 'Reserved Patta ', 'trim|required|is_natural');
$this->form_validation->set_rules('reserved_bigha' . $dag_area_cal->dag_no, 'Reserved Bigha', 'trim|required|is_natural|greater_than[-1]|xss_clean');
$this->form_validation->set_rules('reserved_katha' . $dag_area_cal->dag_no, 'Reserved Katha', 'trim|required|is_natural|greater_than[-1]|less_than[20]|xss_clean');
$this->form_validation->set_rules('reserved_lessa' . $dag_area_cal->dag_no, 'Reserved Lessa', 'trim|required|numeric|greater_than[-1]|less_than[16]|xss_clean');
$this->form_validation->set_rules('reserved_ganda' . $dag_area_cal->dag_no, 'Reserved Ganda', 'trim|required|numeric|greater_than[-1]|less_than[320]|xss_clean');
$this->form_validation->set_rules('reserved_kranti' . $dag_area_cal->dag_no, 'Reserved Kranti', 'trim|required|numeric|greater_than[-1]|less_than[20]|xss_clean');
$bighaValidationRoadside = $this->UtilsModel->defaultValue($this->input->post('reserved_bigha' . $dag_area_cal->dag_no), 0);
$kathaValidationRoadside = $this->UtilsModel->defaultValue($this->input->post('reserved_katha' . $dag_area_cal->dag_no), 0);
$lessaValidationRoadside = $this->UtilsModel->defaultValue($this->input->post('reserved_lessa' . $dag_area_cal->dag_no), 0);
$gandaValidationRoadside = $this->UtilsModel->defaultValue($this->input->post('reserved_ganda' . $dag_area_cal->dag_no), 0);
$roadSideAreaLessaValidation = ($bighaValidationRoadside * 6400) + ($kathaValidationRoadside * 320) + ($lessaValidationRoadside * 20) + $gandaValidationRoadside;
if ($agrAreaLessaValidation + $homeAreaLessaValidation < $roadSideAreaLessaValidation) {
$reserveMoreThanAppArea = 1;
}
$totalRoadSideAreaLessaValidation += $roadSideAreaLessaValidation;
}
if ($family_comment_check == 'YES') {
$this->form_validation->set_rules('reserved_dag_family' . $dag_area_cal->dag_no, 'Reserved Family Dag', 'trim|required|is_natural');
$this->form_validation->set_rules('reserved_patta_family' . $dag_area_cal->dag_no, 'Reserved Family Patta ', 'trim|required|is_natural');
$this->form_validation->set_rules('reserved_bigha_family' . $dag_area_cal->dag_no, 'Reserved Family Bigha', 'trim|required|is_natural|greater_than[-1]|xss_clean');
$this->form_validation->set_rules('reserved_katha_family' . $dag_area_cal->dag_no, 'Reserved Family Katha', 'trim|required|is_natural|greater_than[-1]|less_than[20]|xss_clean');
$this->form_validation->set_rules('reserved_lessa_family' . $dag_area_cal->dag_no, 'Reserved Family Lessa', 'trim|required|numeric|greater_than[-1]|less_than[16]|xss_clean');
$this->form_validation->set_rules('reserved_ganda_family' . $dag_area_cal->dag_no, 'Reserved Family Ganda', 'trim|required|numeric|greater_than[-1]|less_than[320]|xss_clean');
$this->form_validation->set_rules('reserved_kranti_family' . $dag_area_cal->dag_no, 'Reserved Family Kranti', 'trim|required|numeric|greater_than[-1]|less_than[20]|xss_clean');
$bighaValidationFamily = $this->UtilsModel->defaultValue($this->input->post('reserved_bigha_family' . $dag_area_cal->dag_no), 0);
$kathaValidationFamily = $this->UtilsModel->defaultValue($this->input->post('reserved_katha_family' . $dag_area_cal->dag_no), 0);
$lessaValidationFamily = $this->UtilsModel->defaultValue($this->input->post('reserved_lessa_family' . $dag_area_cal->dag_no), 0);
$gandaValidationFamily = $this->UtilsModel->defaultValue($this->input->post('reserved_ganda_family' . $dag_area_cal->dag_no), 0);
$familyAreaLessaValidation = ($bighaValidationFamily * 6400) + ($kathaValidationFamily * 320) + ($lessaValidationFamily * 20) + $gandaValidationFamily;
if ($agrAreaLessaValidation + $homeAreaLessaValidation < $familyAreaLessaValidation) {
$familyMoreThanAppArea = 1;
}
$totalFamilyAreaLessaValidation += $familyAreaLessaValidation;
}
// new premium addition
if (!empty($this->input->post('area_new' . $dag_area_cal->dag_no))) {
$maxland_check = $this->SettlementCommonModel->checkMaxAreaAllowed($this->input->post('area_new' . $dag_area_cal->dag_no));
if (!empty($maxland_check->max_land)) {
// if ($maxland_check->max_land < ($totalAgrAreaLessaValidation + $totalHomeAreaLessaValidation)) {
// $this->form_validation->set_rules('totalAppliedAreaInUrban', 'Total Applied Area cannot exceed more than ' .
// $maxland_check->max_land . 'Lessa !', 'required|callback_totalAppliedAreaInUrban');
// }
if ($maxland_check->max_land == '40') {
$maxland_ganda = 2560;
} elseif ($maxland_check->max_land == '60') {
$maxland_ganda = 3840;
}
if ($maxland_ganda < ($totalAgrAreaLessaValidation + $totalHomeAreaLessaValidation) - $totalRoadSideAreaLessaValidation) {
$this->form_validation->set_rules('totalAppliedAreaInUrban', 'Total Applied Area cannot exceed more than ' .
$maxland_ganda . 'Gonda !', 'required|callback_totalAppliedAreaInUrban');
}
}
}
} else {
if (empty($_FILES['trace_map_copy' . $dag_area_cal->dag_no]['name'])) {
$this->form_validation->set_rules('trace_map_copy' . $dag_area_cal->dag_no, 'Trace map document', 'required');
}
$this->form_validation->set_rules('zonal_valuation_prem' . $dag_area_cal->dag_no, 'Zonal Value', 'trim|required|xss_clean');
$this->form_validation->set_rules('landmark_east' . $dag_area_cal->dag_no, 'East Landmark', 'trim|required|xss_clean');
$this->form_validation->set_rules('landmark_west' . $dag_area_cal->dag_no, 'West Landmark', 'trim|required|xss_clean');
$this->form_validation->set_rules('landmark_north' . $dag_area_cal->dag_no, 'North Landmark', 'trim|required|xss_clean');
$this->form_validation->set_rules('landmark_south' . $dag_area_cal->dag_no, 'South Landmark', 'trim|required|xss_clean');
$bighaValidation = $this->UtilsModel->defaultValue($this->input->post('dag_area_b' . $dag_area_cal->dag_no), 0);
$kathaValidation = $this->UtilsModel->defaultValue($this->input->post('dag_area_k' . $dag_area_cal->dag_no), 0);
$lessaValidation = $this->UtilsModel->defaultValue($this->input->post('dag_area_lc' . $dag_area_cal->dag_no), 0);
$bighaValidationHome = $this->UtilsModel->defaultValue($this->input->post('home_b' . $dag_area_cal->dag_no), 0);
$kathaValidationHome = $this->UtilsModel->defaultValue($this->input->post('home_k' . $dag_area_cal->dag_no), 0);
$lessaValidationHome = $this->UtilsModel->defaultValue($this->input->post('home_lc' . $dag_area_cal->dag_no), 0);
$bighaValidationAgr = $this->UtilsModel->defaultValue($this->input->post('agri_b' . $dag_area_cal->dag_no), 0);
$kathaValidationAgr = $this->UtilsModel->defaultValue($this->input->post('agri_k' . $dag_area_cal->dag_no), 0);
$lessaValidationAgr = $this->UtilsModel->defaultValue($this->input->post('agri_lc' . $dag_area_cal->dag_no), 0);
$bighaValidationFish = $this->UtilsModel->defaultValue($this->input->post('fbigha' . $dag_area_cal->dag_no), 0);
$kathaValidationFish = $this->UtilsModel->defaultValue($this->input->post('fkatha' . $dag_area_cal->dag_no), 0);
$lessaValidationFish = $this->UtilsModel->defaultValue($this->input->post('flessa' . $dag_area_cal->dag_no), 0);
$dagAreaLessaValidation = ($bighaValidation * 100) + ($kathaValidation * 20) + $lessaValidation;
// $homeAreaLessaValidation = ($bighaValidationHome * 100) + ($kathaValidationHome * 20) + $lessaValidationHome;
// $agrAreaLessaValidation = ($bighaValidationAgr * 100) + ($kathaValidationAgr * 20) + $lessaValidationAgr;
// $fishAreaLessaValidation = ($bighaValidationFish * 100) + ($kathaValidationFish * 20) + $lessaValidationFish;
if ($dagAreaLessaValidation < $agrAreaLessaValidation + $homeAreaLessaValidation + $fishAreaLessaValidation) {
$appAreaMoreThanDagA = 1;
}
$totalDagAreaLessaValidation += $dagAreaLessaValidation;
// $totalHomeAreaLessaValidation += $homeAreaLessaValidation;
// $totalAgrAreaLessaValidation += $agrAreaLessaValidation;
// $totalFishAreaLessaValidation += $fishAreaLessaValidation;
if ($roadside_comment_check == 'YES') {
$this->form_validation->set_rules('reserved_dag_road' . $dag_area_cal->dag_no, 'Reserved Dag', 'trim|required|is_natural');
$this->form_validation->set_rules('reserved_patta_road' . $dag_area_cal->dag_no, 'Reserved Patta ', 'trim|required|is_natural');
$this->form_validation->set_rules('reserved_bigha' . $dag_area_cal->dag_no, 'Reserved Bigha', 'trim|required|is_natural|greater_than[-1]|xss_clean');
$this->form_validation->set_rules('reserved_katha' . $dag_area_cal->dag_no, 'Reserved Katha', 'trim|required|is_natural|greater_than[-1]|less_than[5]|xss_clean');
$this->form_validation->set_rules('reserved_lessa' . $dag_area_cal->dag_no, 'Reserved Lessa', 'trim|required|numeric|greater_than[-1]|less_than[20]|xss_clean');
$bighaValidationRoadside = $this->UtilsModel->defaultValue($this->input->post('reserved_bigha' . $dag_area_cal->dag_no), 0);
$kathaValidationRoadside = $this->UtilsModel->defaultValue($this->input->post('reserved_katha' . $dag_area_cal->dag_no), 0);
$lessaValidationRoadside = $this->UtilsModel->defaultValue($this->input->post('reserved_lessa' . $dag_area_cal->dag_no), 0);
$roadSideAreaLessaValidation = ($bighaValidationRoadside * 100) + ($kathaValidationRoadside * 20) + $lessaValidationRoadside;
if ($agrAreaLessaValidation + $homeAreaLessaValidation < $roadSideAreaLessaValidation) {
$reserveMoreThanAppArea = 1;
}
$totalRoadSideAreaLessaValidation += $roadSideAreaLessaValidation;
}
if ($family_comment_check == 'YES') {
$this->form_validation->set_rules('reserved_dag_family' . $dag_area_cal->dag_no, 'Reserved Family Dag', 'trim|required|is_natural');
$this->form_validation->set_rules('reserved_patta_family' . $dag_area_cal->dag_no, 'Reserved Family Patta ', 'trim|required|is_natural');
$this->form_validation->set_rules('reserved_bigha_family' . $dag_area_cal->dag_no, 'Reserved Family Bigha', 'trim|required|is_natural|greater_than[-1]|xss_clean');
$this->form_validation->set_rules('reserved_katha_family' . $dag_area_cal->dag_no, 'Reserved Family Katha', 'trim|required|is_natural|greater_than[-1]|less_than[5]|xss_clean');
$this->form_validation->set_rules('reserved_lessa_family' . $dag_area_cal->dag_no, 'Reserved Family Lessa', 'trim|required|numeric|greater_than[-1]|less_than[20]|xss_clean');
$bighaValidationFamily = $this->UtilsModel->defaultValue($this->input->post('reserved_bigha_family' . $dag_area_cal->dag_no), 0);
$kathaValidationFamily = $this->UtilsModel->defaultValue($this->input->post('reserved_katha_family' . $dag_area_cal->dag_no), 0);
$lessaValidationFamily = $this->UtilsModel->defaultValue($this->input->post('reserved_lessa_family' . $dag_area_cal->dag_no), 0);
$familyAreaLessaValidation = ($bighaValidationFamily * 100) + ($kathaValidationFamily * 20) + $lessaValidationFamily;
if ($agrAreaLessaValidation + $homeAreaLessaValidation < $familyAreaLessaValidation) {
$familyMoreThanAppArea = 1;
}
$totalFamilyAreaLessaValidation += $familyAreaLessaValidation;
}
// new premium addition
if (!empty($this->input->post('area_new' . $dag_area_cal->dag_no))) {
$maxland_check = $this->SettlementCommonModel->checkMaxAreaAllowed($this->input->post('area_new' . $dag_area_cal->dag_no));
if (!empty($maxland_check->max_land)) {
if ($maxland_check->max_land < ($totalAgrAreaLessaValidation + $totalHomeAreaLessaValidation) - $totalRoadSideAreaLessaValidation) {
$this->form_validation->set_rules('totalAppliedAreaInUrban', 'Total Applied Area cannot exceed more than ' .
$maxland_check->max_land . 'Lessa !', 'required|callback_totalAppliedAreaInUrban');
}
}
} else {
$this->form_validation->set_rules('totalAppliedAreaInUrban', 'Area type missing!! ', 'required|callback_totalAppliedAreaInUrban');
}
}
}
// new additional property calculation
$singleAdditionalProToLessa = 0;
$totalAdditionalProToLessa = 0;
$additional_properties = $this->db->query("Select * from settlement_additional_property where applid='$application_no'")->result();
if (in_array($distCode, json_decode(BARAK_VALLEY))) {
foreach ($additional_properties as $singleProperty) {
$bighaAdditionalPro = $this->UtilsModel->defaultValue($singleProperty->bigha, 0);
$kathaAdditionalPro = $this->UtilsModel->defaultValue($singleProperty->katha, 0);
$lessaAdditionalPro = $this->UtilsModel->defaultValue($singleProperty->lessa, 0);
$gandaAdditionalPro = $this->UtilsModel->defaultValue($singleProperty->ganda, 0);
$singleAdditionalProToLessa = ($bighaAdditionalPro * 6400) + ($kathaAdditionalPro * 320) + ($lessaAdditionalPro * 20) + $gandaAdditionalPro;
$totalAdditionalProToLessa += $singleAdditionalProToLessa;
}
} else {
foreach ($additional_properties as $singleProperty) {
$bighaAdditionalPro = $this->UtilsModel->defaultValue($singleProperty->bigha, 0);
$kathaAdditionalPro = $this->UtilsModel->defaultValue($singleProperty->katha, 0);
$lessaAdditionalPro = $this->UtilsModel->defaultValue($singleProperty->lessa, 0);
$singleAdditionalProToLessa = ($bighaAdditionalPro * 100) + ($kathaAdditionalPro * 20) + $lessaAdditionalPro;
$totalAdditionalProToLessa += $singleAdditionalProToLessa;
}
}
$checkUrbanCon = trim($this->input->post('is_urban'));
if ($reserveMoreThanAppArea == 1) {
$this->form_validation->set_rules('reserveMoreThanAppArea', 'Total roadside reserved area should not be more than total applied area !', 'required|callback_reserveMoreThanAppArea');
}
if ($familyMoreThanAppArea == 1) {
$this->form_validation->set_rules('familyMoreThanAppArea', 'Total family reserved area should not be more than total applied area !', 'required|callback_familyMoreThanAppArea');
}
if ($totalHomeAreaLessaValidation + $totalAgrAreaLessaValidation + $totalFishAreaLessaValidation == 0) {
$this->form_validation->set_rules('totalAppliedAreaZeroCheck', 'Total applied area should not be Zero !', 'required|callback_totalAppliedAreaZeroCheck');
}
if ($appAreaMoreThanDagA == 1) {
$this->form_validation->set_rules('appAreaMoreThanDagA', 'Total applied area should not be more than total Dag Area !', 'required|callback_appAreaMoreThanDagA');
}
$land_exceed = 0;
// for barak valley
// if (in_array($distCode, json_decode(BARAK_VALLEY))) {
// if (KHAS_MAX_HOMESTEAD * 6400 < $totalHomeAreaLessaValidation) {
// $this->form_validation->set_rules('khasMaxHomestead', 'Total applied Homestead area should not be more than ' . KHAS_MAX_HOMESTEAD . ' Bigha !', 'required|callback_khasMaxHomestead');
// }
// if (KHAS_MAX_AGRICULTURE * 6400 < $totalAgrAreaLessaValidation) {
// $this->form_validation->set_rules('khasMaxAgriculture', 'Total applied Agriculture area should not be more than ' . KHAS_MAX_AGRICULTURE . ' Bigha !', 'required|callback_khasMaxAgriculture');
// }
// if (FISHERY_MAX_AREA * 6400 < $totalFishAreaLessaValidation) {
// $this->form_validation->set_rules('khasMaxFishery', 'Total applied Fishery area should not be more than ' . FISHERY_MAX_AREA . ' Bigha !', 'required|callback_khasMaxFishery');
// }
// if ((KHAS_MAX_HOMESTEAD + KHAS_MAX_AGRICULTURE) * 6400 < ($totalAgrAreaLessaValidation + $totalHomeAreaLessaValidation + $totalAdditionalProToLessa)) {
// // $this->form_validation->set_rules('totalAppliedAdditionalArea','Total Land Area (Applied Area + Additional Area) cannot exceed more than '. (KHAS_MAX_HOMESTEAD + KHAS_MAX_AGRICULTURE) . ' Bigha !', 'required|callback_totalAppliedAdditionalArea');
// $land_exceed = 1;
// }
// // new premium addition
// if ($this->input->post('area_new' . $dag_area_cal->dag_no) != 10) {
// $maxland_ganda = '';
// if (!empty($this->input->post('area_new' . $dag_area_cal->dag_no))) {
// $maxland_check = $this->SettlementCommonModel->checkMaxAreaAllowed($this->input->post('area_new' . $dag_area_cal->dag_no));
// if (!empty($maxland_check->max_land)) {
// if ($maxland_check->max_land == '40') {
// $maxland_ganda = 2560;
// } elseif ($maxland_check->max_land == '60') {
// $maxland_ganda = 3840;
// }
// if ($maxland_ganda < ($totalAgrAreaLessaValidation + $totalHomeAreaLessaValidation) - $totalRoadSideAreaLessaValidation) {
// $this->form_validation->set_rules('totalAppliedAreaInUrban', 'Total Applied Area cannot exceed more than ' .
// $maxland_ganda . 'Gonda !', 'required|callback_totalAppliedAreaInUrban');
// }
// }
// } else {
// $this->form_validation->set_rules('totalAppliedAreaInUrban', 'Area type missing ' .
// $maxland_ganda . 'Gonda !', 'required|callback_totalAppliedAreaInUrban');
// }
// }
// if ($checkUrbanCon == 'Y') {
// // if((MAX_APPLIED_URBAN_AREA_BARAK_KATHA * 320) + (MAX_APPLIED_URBAN_AREA_BARAK_LESSA * 20) < ($totalAgrAreaLessaValidation + $totalHomeAreaLessaValidation) - $totalRoadSideAreaLessaValidation)
// // {
// // $this->form_validation->set_rules('totalAppliedAreaInUrban','Total Applied Area in Urban cannot exceed more than '.
// // MAX_APPLIED_URBAN_AREA_BARAK_KATHA . 'Katha ,' . MAX_APPLIED_URBAN_AREA_BARAK_LESSA . 'Lessa !', 'required|callback_totalAppliedAreaInUrban');
// // }
// // new premium addition
// // $maxland_ganda ='';
// if ($this->input->post('area_new' . $dag_area_cal->dag_no) != 10) {
// if (!empty($this->input->post('area_new' . $dag_area_cal->dag_no))) {
// $maxland_check = $this->SettlementCommonModel->checkMaxAreaAllowed($this->input->post('area_new' . $dag_area_cal->dag_no));
// if (!empty($maxland_check->max_land)) {
// if ($maxland_check->max_land == '40') {
// $maxland_ganda = 2560;
// } elseif ($maxland_check->max_land == '60') {
// $maxland_ganda = 3840;
// }
// if ($maxland_ganda < ($totalAgrAreaLessaValidation + $totalHomeAreaLessaValidation) - $totalRoadSideAreaLessaValidation) {
// $this->form_validation->set_rules('totalAppliedAreaInUrban', 'Total Applied Area cannot exceed more than ' .
// $maxland_ganda . 'Gonda !', 'required|callback_totalAppliedAreaInUrban');
// }
// }
// } else {
// $this->form_validation->set_rules('totalAppliedAreaInUrban', 'Area type missing ' .
// $maxland_ganda . 'Gonda !', 'required|callback_totalAppliedAreaInUrban');
// }
// }
// }
// } else {
// if (KHAS_MAX_HOMESTEAD * 100 < $totalHomeAreaLessaValidation) {
// $this->form_validation->set_rules('khasMaxHomestead', 'Total applied Homestead area should not be more than ' . KHAS_MAX_HOMESTEAD . ' Bigha !', 'required|callback_khasMaxHomestead');
// }
// if (KHAS_MAX_AGRICULTURE * 100 < $totalAgrAreaLessaValidation) {
// $this->form_validation->set_rules('khasMaxAgriculture', 'Total applied Agriculture area should not be more than ' . KHAS_MAX_AGRICULTURE . ' Bigha !', 'required|callback_khasMaxAgriculture');
// }
// if (FISHERY_MAX_AREA * 100 < $totalFishAreaLessaValidation) {
// $this->form_validation->set_rules('khasMaxFishery', 'Total applied Fishery area should not be more than ' . FISHERY_MAX_AREA . ' Bigha !', 'required|callback_khasMaxFishery');
// }
// if ((KHAS_MAX_HOMESTEAD + KHAS_MAX_AGRICULTURE) * 100 < ($totalAgrAreaLessaValidation + $totalHomeAreaLessaValidation + $totalAdditionalProToLessa)) {
// // $this->form_validation->set_rules('totalAppliedAdditionalArea','Total Land Area (Applied Area + Additional Area) cannot exceed more than '. (KHAS_MAX_HOMESTEAD + KHAS_MAX_AGRICULTURE) . ' Bigha !', 'required|callback_totalAppliedAdditionalArea');
// $land_exceed = 1;
// }
// // new premium addition
// if ($this->input->post('area_new' . $dag_area_cal->dag_no) != 10) {
// if (!empty($this->input->post('area_new' . $dag_area_cal->dag_no))) {
// $maxland_check = $this->SettlementCommonModel->checkMaxAreaAllowed($this->input->post('area_new' . $dag_area_cal->dag_no));
// if (!empty($maxland_check->max_land)) {
// if ($maxland_check->max_land < ($totalAgrAreaLessaValidation + $totalHomeAreaLessaValidation) - $totalRoadSideAreaLessaValidation) {
// $this->form_validation->set_rules('totalAppliedAreaInUrban', 'Applied Area cannot exceed more than ' .
// $maxland_check->max_land . 'Lessa !', 'required|callback_totalAppliedAreaInUrban');
// }
// }
// } else {
// $this->form_validation->set_rules('totalAppliedAreaInUrban', 'Area type missing ' .
// $maxland_check->max_land . 'Lessa !', 'required|callback_totalAppliedAreaInUrban');
// }
// }
// if ($checkUrbanCon == 'Y') {
// // if((MAX_APPLIED_URBAN_AREA_KATHA * 20) + MAX_APPLIED_URBAN_AREA_LESSA < ($totalAgrAreaLessaValidation + $totalHomeAreaLessaValidation) - $totalRoadSideAreaLessaValidation)
// // {
// // $this->form_validation->set_rules('totalAppliedAreaInUrban','Total Applied Area in Urban cannot exceed more than '.
// // MAX_APPLIED_URBAN_AREA_KATHA . 'Katha ,' . MAX_APPLIED_URBAN_AREA_LESSA . 'Lessa !', 'required|callback_totalAppliedAreaInUrban');
// // }
// // new premium addition
// if ($this->input->post('area_new' . $dag_area_cal->dag_no) != 10) {
// if (!empty($this->input->post('area_new' . $dag_area_cal->dag_no))) {
// $maxland_check = $this->SettlementCommonModel->checkMaxAreaAllowed($this->input->post('area_new' . $dag_area_cal->dag_no));
// if (!empty($maxland_check->max_land)) {
// if ($maxland_check->max_land < ($totalAgrAreaLessaValidation + $totalHomeAreaLessaValidation) - $totalRoadSideAreaLessaValidation) {
// $this->form_validation->set_rules('totalAppliedAreaInUrban', 'Applied Area cannot exceed more than ' .
// $maxland_check->max_land . 'Lessa !', 'required|callback_totalAppliedAreaInUrban');
// }
// }
// } else {
// $this->form_validation->set_rules('totalAppliedAreaInUrban', 'Area type missing ' .
// $maxland_check->max_land . 'Lessa !', 'required|callback_totalAppliedAreaInUrban');
// }
// }
// }
// }
// if ($_POST['lm_note'] == '1' && $land_exceed == 1) {
// $this->form_validation->set_rules('land_exceed', 'Warning : Total Land Area (Applied Area + Additional Area) exceed more than ' . (KHAS_MAX_HOMESTEAD + KHAS_MAX_AGRICULTURE) . ' Bigha ! You can select not recommend and proceed!!!', 'required|callback_land_exceed');
// }
// for total applied area set_value in validation error Homestead
$this->form_validation->set_rules('total_applied_area_homestead_bigha', '', '');
$this->form_validation->set_rules('total_applied_area_homestead_katha', '', '');
$this->form_validation->set_rules('total_applied_area_homestead_lessa', '', '');
$this->form_validation->set_rules('total_applied_area_homestead_ganda', '', '');
$this->form_validation->set_rules('total_applied_area_homestead_kranti', '', '');
// for total applied area set_value in validation error Agriculture
$this->form_validation->set_rules('total_applied_area_agricultural_bigha', '', '');
$this->form_validation->set_rules('total_applied_area_agricultural_katha', '', '');
$this->form_validation->set_rules('total_applied_area_agricultural_lessa', '', '');
$this->form_validation->set_rules('total_applied_area_agricultural_ganda', '', '');
$this->form_validation->set_rules('total_applied_area_agricultural_kranti', '', '');
// additional file upload validation
// upload additional files
if (isset($_FILES['fileUpload']['name'])) {
$this->form_validation->set_rules('fileText[]', 'Document Details', 'trim|xss_clean|required');
$fileCount = count($_FILES['fileUpload']['name']);
// validation for file type and file size
for ($i = 0; $i < $fileCount; $i++) {
if ($_FILES['fileUpload']['name'][$i] && $_FILES['fileUpload']['size'][$i] && $_FILES['fileUpload']['tmp_name'][$i]) {
$name = $_FILES['fileUpload']['name'][$i];
$size = $_FILES['fileUpload']['size'][$i];
$mime = mime_content_type($_FILES['fileUpload']['tmp_name'][$i]);
$exp = explode("/", $mime);
$ext = $exp[1];
if ($name != NULL) {
if ($ext == NULL) {
// todo error show extension missing
$this->form_validation->set_rules('additional_doc_err', 'File extension', 'required');
}
if (! in_array($ext, UPLOAD_TYPE_VALIDATION)) {
// todo error show file allow type not match
$this->form_validation->set_rules('additional_doc_err', 'Only JPG/PNG/PDF file', 'required');
}
if ($size > UPLOAD_MAX_SIZE) {
// todo error show file size
$this->form_validation->set_rules('additional_doc_err', 'Maximum 2MB file size', 'required');
}
} else {
// todo error show file not nullable
$this->form_validation->set_rules('additional_doc_err', 'File name', 'required');
}
} else {
$this->form_validation->set_rules('additional_doc_err', 'File', 'required');
}
}
}
}
//****this validation is required in all cases */
if ($validation_bypass == 1) {
if ($_POST['lm_note'] == '2') {
$this->form_validation->set_rules('rejected_reasons', 'Rejected reason', 'required');
if (isset($_POST['rejected_reasons'])) {
foreach ($_POST['rejected_reasons'] as $rej_list_key => $rej_list) {
$this->form_validation->set_rules('rejected_reasons[' . $rej_list_key . ']', '', '');
}
}
if (isset($_POST['sub_rejected_reasons'])) {
foreach ($_POST['sub_rejected_reasons'] as $sub_rej_key => $val) {
$this->form_validation->set_rules('sub_rejected_reasons[' . $sub_rej_key . ']', 'Sub Rejected reason', 'required|min_length[1]');
}
}
}
$this->form_validation->set_rules('lm_note', 'LM Remarks', 'trim|required');
$this->form_validation->set_rules('lm_remark_text', 'LM Remarks (Text Area)', 'trim|required');
// $this->form_validation->set_rules('co_code', 'Select SK/Circle Officer', 'trim|required');
$this->form_validation->set_rules('co_code_reject', 'Select Circle Officer', 'trim|required');
if ($applicants_encroacher == true) {
foreach ($applicants_encroacher as $enc_applicant) {
$this->form_validation->set_rules('encroacher_exist_vlb' . $enc_applicant->id, '', '');
$this->form_validation->set_rules('enc_dag' . $enc_applicant->id, '', '');
$this->form_validation->set_rules('period_possession' . $enc_applicant->id, '', '');
$this->form_validation->set_rules('riotee_name' . $enc_applicant->id, '', '');
$this->form_validation->set_rules('riotee_guardian' . $enc_applicant->id, '', '');
}
}
}
if ($this->form_validation->run() == false) {
$lmdata['all_errors'] = validation_errors();
if (isset($fileCount)) {
$lmdata['fileCount'] = $fileCount;
}
$lmdata['err_return'] = true;
$lmdata['_view'] = 'LabourLineLand/LabourLandView';
$this->load->view('layouts/main', $lmdata);
} else {
$this->db->trans_begin();
//************update in settlement_applicant */
if ($applicants_encroacher == true) {
foreach ($applicants_encroacher as $enc_applicant) {
$applicant_array = [
'encroacher_exist_vlb' => $this->input->post('encroacher_exist_vlb' . $enc_applicant->id)
];
$this->db->where('id', $enc_applicant->id);
$this->db->where('case_no', $case_no);
$this->db->update('settlement_applicant', $applicant_array);
if ($this->db->affected_rows() <= 0) {
$this->db->trans_rollback();
log_message('error', '#ERROR00112: Updation failed in settlement_applicant RTPS Case No ' . $application_no);
$data = array(
'error' => "#ERROR00112: Registration of Settlement failed for case no : " . $application_no
);
echo json_encode($data);
return false;
}
}
}
//new premium condition
foreach ($lmdata['dags'] as $dag_for_approve) {
$dag_arraay[] = $this->input->post('approval' . $dag_for_approve->dag_no);
$dag_by_approve = $this->input->post('approval' . $dag_for_approve->dag_no);
}
$approved_by = null;
if ($dag_by_approve != '' || $dag_by_approve != null) {
if (count($dag_arraay) == 1) {
$approved_by = $dag_by_approve;
} else {
if (count(array_unique($dag_arraay)) < count($dag_arraay)) {
$approved_by = $dag_by_approve;
} else {
$approved_by = 'GOVT';
}
}
}
//*******update in settlement_basic */
$sk_code = null;
$co_code = null;
// if(trim($lmdata['sk_availability']) == 'y')
if ('1' == '2') {
$pending_officer = 'SK';
$sk_code = $this->input->post('co_code');
} else {
$pending_officer = 'CO';
$co_code = $this->input->post('co_code');
}
if ($validation_bypass == 1) {
$pending_officer = 'CO';
$co_code = $this->input->post('co_code_reject');
}
$basicData = [
'status' => 'W',
'lm_code' => $this->session->userdata('user_code'),
'submission_date' => date('Y-m-d G:i:s'),
'from_office' => 'LM',
'pending_officer' => $pending_officer,
'pending_office' => $pending_officer,
'sk_code' => $sk_code,
'co_code' => $co_code,
'approve_by' => $approved_by
];
$this->db->where('case_no', $case_no);
$this->db->update('settlement_basic', $basicData);
if ($this->db->affected_rows() <= 0) {
$this->db->trans_rollback();
log_message('error', '#ERROR0011: Updation failed in settlement_basic RTPS Case No ' . $application_no);
$data = array(
'error' => "#ERROR0011: Registration of Settlement failed for case no : " . $application_no
);
echo json_encode($data);
return false;
}
//update additional property
$additional_property_check = $this->db->query("Select * from settlement_additional_property where applid='$application_no'");
if ($additional_property_check->num_rows() > 0) {
$additionalPropertyUpdate = [
'case_no' => $case_no,
];
$this->db->where('applid', $application_no);
$this->db->update('settlement_additional_property', $additionalPropertyUpdate);
if ($this->db->affected_rows() <= 0) {
$this->db->trans_rollback();
log_message('error', '#ERROR1836: Updation failed in settlement_additional_property RTPS Case No ' . $application_no);
$data = array(
'error' => "#ERROR1836: Registration of Settlement failed for case no : " . $application_no
);
echo json_encode($data);
return false;
}
}
// insertion in backup table
$phase_count = $this->db->query("SELECT COUNT(*) as ct FROM settlement_backup_json WHERE applid = '$application_no' AND from_office = 'LM'")->row()->ct;
$phase_count = (int)$phase_count + 1;
$backup_array_lm = [
'applid' => $application_no,
'case_no' => $case_no,
'from_office' => 'LM',
'to_office' => $pending_officer,
'status' => 'W',
'phase' => 'LM_' . $phase_count,
'data' => json_encode($_POST)
];
$backup_insertion_lm = $this->db->insert('settlement_backup_json', $backup_array_lm);
if ($backup_insertion_lm != 1) {
$this->db->trans_rollback();
log_message('error', '#BACKUP002: Insertion failed in settlement_backup_json RTPS Case No ' . $application_no);
$this->session->set_flashdata('message', "#BACKUP002: Registration of Settlement failed for case no : " . $application_no);
redirect(base_url() . "index.php/home");
return false;
}
// UPDATING Geo Tag Photo case number in supportive document
if (isset($lmdata['geo_tag_doc'])) {
foreach ($lmdata['geo_tag_doc'] as $geo_tag_loop) {
$geo_tag_array = array(
'case_no' => $case_no
);
$this->db->where('applid', $geo_tag_loop->applid);
$this->db->where('dag_no', $geo_tag_loop->dag_no);
$this->db->where('file_name', GEO_TAG_PHOTO);
$this->db->update('supportive_document', $geo_tag_array);
if ($this->db->affected_rows() == 0) {
$this->db->trans_rollback();
log_message('error', '#SETUP0001S: Updation failed in supportive_document basundhara Case No ' . $geo_tag_loop->applid);
$data = array(
'error' => "#SETUP0001S: Registration of Settlement failed for case no : " . $geo_tag_loop->applid
);
echo json_encode($data);
return false;
}
}
}
//*****only insert if validation bypass is 0 */
if ($validation_bypass == 0) {
foreach ($lmdata['dags'] as $dagsland) {
$landmark_east = $this->input->post('landmark_east' . $dagsland->dag_no);
$landmark_west = $this->input->post('landmark_west' . $dagsland->dag_no);
$landmark_north = $this->input->post('landmark_north' . $dagsland->dag_no);
$landmark_south = $this->input->post('landmark_south' . $dagsland->dag_no);
$landmark = [
'east' => $landmark_east,
'west' => $landmark_west,
'north' => $landmark_north,
'south' => $landmark_south,
];
$fmddata = [
'date_entry' => date('Y-m-d'),
'landmark' => json_encode($landmark),
'nature_possession' => $this->input->post('nature_possession' . $dagsland->dag_no),
];
$this->db->where('case_no', $case_no);
$this->db->where('dag_no', $dagsland->dag_no);
$this->db->update('settlement_dag_details', $fmddata);
if ($this->db->affected_rows() <= 0) {
$this->db->trans_rollback();
log_message('error', '#ERROR0012: Updation failed in settlement_dag_details RTPS Case No ' . $application_no);
$data = array(
'error' => "#ERROR0012: Registration of Settlement failed for case no : " . $application_no
);
echo json_encode($data);
return false;
}
}
// upload additional file
if (isset($_FILES['fileUpload']['name'])) {
for ($i = 0; $i < $fileCount; $i++) {
$_FILES['file']['name'] = $_FILES['fileUpload']['name'][$i];
$_FILES['file']['type'] = $_FILES['fileUpload']['type'][$i];
$_FILES['file']['tmp_name'] = $_FILES['fileUpload']['tmp_name'][$i];
$_FILES['file']['error'] = $_FILES['fileUpload']['error'][$i];
$_FILES['file']['size'] = $_FILES['fileUpload']['size'][$i];
$mime = mime_content_type($_FILES['fileUpload']['tmp_name'][$i]);
$exp = explode("/", $mime);
$onlyExtension = $exp[1];
$fileRename = $this->UUID4() . '.' . $onlyExtension;
$config['upload_path'] = UPLOAD_DIR;
$config['allowed_types'] = UPLOAD_ALLOW_TYPE;
$config['max_size'] = UPLOAD_MAX_SIZE;;
$config['file_name'] = $fileRename;
$this->load->library('upload', $config);
$this->upload->initialize($config);
if ($this->upload->do_upload('file')) {
$document = array(
'case_no' => $case_no,
'file_name' => $_POST['fileText'][$i],
'user_code' => $this->session->userdata('user_code'),
// 'fetch_file_name' => $_FILES['file']['name'],
'fetch_file_name' => $_POST['fileText'][$i],
'file_type' => $_FILES['file']['type'],
'file_path' => UPLOAD_DIR . $fileRename,
'date_entry' => date('Y-m-d h:i:s'),
'mut_type' => LABOUR_LINE_LAND_ID,
);
// save data in attachment file
$addMoreDocQuery = $this->db->insert('supportive_document', $document);
if ($addMoreDocQuery != 1) {
$this->db->trans_rollback();
log_message('error', '#ERRADDDOC0001: Insertion failed in supportive document RTPS Case No ' . $application_no);
$this->session->set_flashdata('message', "#ERRADDDOC0001: Only PDF and Image files area allowed : " . $application_no);
redirect(base_url() . "index.php/home");
return false;
}
} else {
$this->db->trans_rollback();
// todo error show
// redirect to respected route with error mgs
log_message('error', '#ERRADDDOC0001: Insertion failed in supportive document RTPS Case No ' . $application_no);
$this->session->set_flashdata('message', "#ERRADDDOC00851: Only PDF and Image files area allowed : " . $application_no);
redirect(base_url() . "index.php/home");
return false;
}
}
}
//end of additional file upload
$field_report_file = $_FILES['field_report'];
// For uploading dag wise trace_map_copy
foreach ($lmdata['dags'] as $dags_doc) {
$timestamp = date('mdYhis', time()) . uniqid();
$trace_map_file = $_FILES['trace_map_copy' . $dags_doc->dag_no];
$trace_file_name = 'trace_map_copy' . $timestamp;
//upload trace map file by calling API
$trace_map_api_file = $this->SettlementCommonModel->uploadFileByApiBase($trace_map_file, $application_no, API_KEY, $trace_file_name);
$trace_json = json_decode($trace_map_api_file);
$trace_upload_path = UPLOAD_DIR . $timestamp . $trace_map_file['name'];
if ($trace_json->status == 4) // success
{
$document = array(
'case_no' => $case_no,
'file_name' => 'Trace Map Copy',
'user_code' => $this->session->userdata('user_code'),
'fetch_file_name' => $trace_map_file['name'],
'file_type' => $trace_map_file['type'],
'file_path' => $trace_upload_path,
'date_entry' => date('Y-m-d h:i:s'),
'mut_type' => $this->input->post('service_code'),
'dag_no' => $this->input->post('dag_no_doc' . $dags_doc->dag_no),
'api_doc_id' => $trace_json->docId,
);
$insert_supportive_doc = $this->db->insert('supportive_document', $document);
if ($insert_supportive_doc != 1) {
log_message('error', '#ERRORPPSSGG: Insertion failed in supportive_document for case no :' . $this->db->last_query());
$this->db->trans_rollback();
$json = [
'errorMessage' => "#ERRORPPSSGG: Failed to forward the case for Case No : " . $case_no
];
echo json_encode($json);
return false;
}
} else {
log_message('error', 'Unable to upload trace map file for case no ' . $case_no);
$this->db->trans_rollback();
$this->session->set_flashdata('message', "#ERRADDDOC077471: Only PDF and Image files area allowed : " . $application_no);
redirect(base_url() . "index.php/home");
}
if (FILE_UPLOAD_REQUIRE_IN_DHARITREE == 1) //
{
// Trace Map copy upload
$config['file_name'] = $trace_file_name;
$config['upload_path'] = UPLOAD_DIR;
$config['allowed_types'] = UPLOAD_ALLOW_TYPE;
$config['max_size'] = 2000;
$this->load->library('upload', $config);
$this->upload->initialize($config);
if (!move_uploaded_file($trace_map_file['tmp_name'], $trace_upload_path)) {
log_message('error', 'Unable to move trace map file for case no ' . $case_no);
$this->db->trans_rollback();
$this->session->set_flashdata('message', "#ERRADDDOC00711001: Only PDF and Image files area allowed : " . $application_no);
redirect(base_url() . "index.php/home");
}
}
}
$timestamp = date('mdYhis', time()) . uniqid();
// For uploading field report
//upload field report file by calling API
$field_file_name = 'field_report' . $timestamp;
$field_report_api_file = $this->SettlementCommonModel->uploadFileByApiBase($field_report_file, $application_no, API_KEY, $field_file_name);
$field_report_json = json_decode($field_report_api_file);
$field_report_path = UPLOAD_DIR . $timestamp . $field_report_file['name'];
if ($field_report_json->status == 4) // success
{
$document = array(
'case_no' => $case_no,
'file_name' => 'Field Report',
'user_code' => $this->session->userdata('user_code'),
'fetch_file_name' => $field_report_file['name'],
'file_type' => $field_report_file['type'],
'file_path' => $field_report_path,
'date_entry' => date('Y-m-d h:i:s'),
'mut_type' => $this->input->post('service_code'),
'api_doc_id' => $field_report_json->docId,
);
$insert_supportive_doc = $this->db->insert('supportive_document', $document);
if ($insert_supportive_doc != 1) {
$this->db->trans_rollback();
log_message('error', '#ERRORPPSSGGP: Insertion failed in supportive_document for case no :' . $case_no);
$json = [
'errorMessage' => "#ERRORPPSSGGP: Failed to forward the case for Case No : " . $case_no
];
echo json_encode($json);
return false;
}
} else {
log_message('error', 'Unable to upload field report file for case no ' . $case_no);
$this->db->trans_rollback();
$this->session->set_flashdata('message', "#ERRADDDOC00998501: Only PDF and Image files area allowed : " . $application_no);
redirect(base_url() . "index.php/home");
}
if (FILE_UPLOAD_REQUIRE_IN_DHARITREE == 1) //
{
$config2['file_name'] = $field_file_name;
$config2['upload_path'] = UPLOAD_DIR;
$config2['allowed_types'] = UPLOAD_ALLOW_TYPE;
$config2['max_size'] = 2000;
$this->load->library('upload', $config2);
$this->upload->initialize($config2);
if (!move_uploaded_file($field_report_file['tmp_name'], $field_report_path)) {
log_message('error', 'Unable to move field report file for case no ' . $case_no);
$this->db->trans_rollback();
$this->session->set_flashdata('message', "#ERRADDDOC000331: Only PDF and Image files area allowed : " . $application_no);
redirect(base_url() . "index.php/home");
}
}
//*********if LM if case of case rejected the rejected remarks */
$responseMasterObj = $this->SettlementCommonModel->lmRejectedValidationBypassFalse(LABOUR_LINE_LAND_ID);
$comment = addslashes($this->input->post('lm_note'));
$pro_class_lm = $this->input->post('protected_class_lm');
$protected_class_lm = ($pro_class_lm == null || $pro_class_lm == '' || $pro_class_lm == 0) ? 0 : $this->input->post('protected_class_lm');
$lmnote = array(
'user_code' => $this->session->userdata('user_code'),
'chitha_verified' => $this->input->post('chitha_verified'),
'vlb_verified' => $this->input->post('vlb_verified'),
'is_tribal_belt' => $this->input->post('is_tribal_belt'),
'possession_verification' => $this->input->post('possession_verification'),
'period_possession' => date('Y-m-d'),
// 'nature_possession'=>$this->input->post('nature_possession'),
'is_landless' => $this->input->post('is_landless'),
'land_falls' => $this->input->post('land_falls'),
'falls_und_gmc' => $this->input->post('falls_und_gmc'),
'roadside_reservation' => $this->input->post('roadside_reservation'),
// 'zonal_valuation'=>$this->input->post('zonal_valuation'),
// 'trace_map_copy'=>$this->input->post('trace_map_copy'),
// 'chitha_copy'=>$this->input->post('chitha_copy'),
'trace_map_copy' => 'NA',
'chitha_copy' => 'NA',
'lm_note' => $comment,
'lm_remark_text' => $this->input->post('lm_remark_text'),
'date_entry' => date('Y-m-d h:i:s'),
'case_no' => $case_no,
'status' => 'W',
'total_bigha' => $this->input->post('total_bigha'),
'total_Katha' => $this->input->post('total_Katha'),
'total_lessa' => $this->input->post('total_lessa'),
'total_ganda' => $this->input->post('total_ganda'),
'total_kranti' => $this->input->post('total_kranti'),
// 'encroacher_exist_vlb' => $this->input->post('encroacher_exist_vlb'),
'landslide' => $this->input->post('landslide'),
'erosion' => $this->input->post('erosion'),
'protected_class_lm' => $protected_class_lm,
'bhumiputra_confirmation' => $this->input->post('bhumiputra_confirmation_lm'),
'lm_rejected_remarks' => json_encode($responseMasterObj->reject_remarks)
);
$insLmnote = $this->db->insert('settlement_ap_lmnote', $lmnote);
if ($insLmnote != 1) {
$this->db->trans_rollback();
log_message('error', '#ERRSET0005: Insertion failed in settlement_ap_lmnote RTPS Case No ' . $application_no);
$data = array(
'error' => "#ERRSET0005: Registration of Settlement failed for case no : " . $application_no
);
echo json_encode($data);
return false;
}
}
if ($validation_bypass == 1) {
$this->SettlementCommonModel->firstProceedingValidationBypassTrue(
LABOUR_LINE_LAND_ID,
$case_no,
$application_no,
$lmdata['rejected_list']
);
}
//******do if only validation_bypass 0 */
if ($validation_bypass == 0) {
///// road side reserve area start /////
if ($roadside_comment_check == 'YES') {
foreach ($lmdata['dags'] as $dags) {
$reservedarea = array(
'dist_code' => $this->input->post('dist_code'),
'subdiv_code' => $this->input->post('subdiv_code'),
'cir_code' => $this->input->post('cir_code'),
'mouza_pargona_code' => $this->input->post('mouza_pargona_code'),
'lot_no' => $this->input->post('lot_no'),
'vill_townprt_code' => $this->input->post('vill_townprt_code'),
'dag_no' => $this->input->post('reserved_dag_road' . $dags->dag_no),
'patta_no' => $this->input->post('reserved_patta_road' . $dags->dag_no),
'bigha' => $this->input->post('reserved_bigha' . $dags->dag_no),
'katha' => $this->input->post('reserved_katha' . $dags->dag_no),
'lessa' => $this->input->post('reserved_lessa' . $dags->dag_no),
'ganda' => $this->input->post('reserved_ganda' . $dags->dag_no),
'kranti' => $this->input->post('reserved_kranti' . $dags->dag_no),
'case_no' => $case_no,
'applid' => $this->input->post('applid'),
'lm_code' => $this->session->userdata('user_code'),
'date_entry' => date('Y-m-d h:i:s'),
'date_update' => date('Y-m-d h:i:s'),
'type' => 'R'
);
$reserveData = $this->db->insert('settlement_reservation', $reservedarea);
// echo $this->db->last_query(); die();
if ($reserveData != 1) {
$this->db->trans_rollback();
log_message('error', '#ERRSET00052: Insertion failed in settlement_reservation RTPS Case No ' . $application_no);
$data = array(
'error' => "#ERRSET00052: Registration of Settlement failed for case no : " . $application_no
);
echo json_encode($data);
return false;
}
}
}
if ($family_comment_check == 'YES') {
foreach ($lmdata['dags'] as $dags) {
$reservedarea = array(
'dist_code' => $this->input->post('dist_code'),
'subdiv_code' => $this->input->post('subdiv_code'),
'cir_code' => $this->input->post('cir_code'),
'mouza_pargona_code' => $this->input->post('mouza_pargona_code'),
'lot_no' => $this->input->post('lot_no'),
'vill_townprt_code' => $this->input->post('vill_townprt_code'),
'dag_no' => $this->input->post('reserved_dag_family' . $dags->dag_no),
'patta_no' => $this->input->post('reserved_patta_family' . $dags->dag_no),
'bigha' => $this->input->post('reserved_bigha_family' . $dags->dag_no),
'katha' => $this->input->post('reserved_katha_family' . $dags->dag_no),
'lessa' => $this->input->post('reserved_lessa_family' . $dags->dag_no),
'ganda' => $this->input->post('reserved_ganda_family' . $dags->dag_no),
'kranti' => $this->input->post('reserved_kranti_family' . $dags->dag_no),
'case_no' => $case_no,
'applid' => $this->input->post('applid'),
'lm_code' => $this->session->userdata('user_code'),
'date_entry' => date('Y-m-d h:i:s'),
'date_update' => date('Y-m-d h:i:s'),
'type' => 'F'
);
$reserveData = $this->db->insert('settlement_reservation', $reservedarea);
// echo $this->db->last_query(); die();
if ($reserveData != 1) {
$this->db->trans_rollback();
log_message('error', '#ERRSET00053: Insertion failed in settlement_reservation RTPS Case No ' . $application_no);
$data = array(
'error' => "#ERRSET00053: Registration of Settlement failed for case no : " . $application_no
);
echo json_encode($data);
return false;
}
}
}
///// family reserve area end //////
//// premium insert start ******************
$sumMbAmount = 0;
$approved_by = '';
$count = 0;
foreach ($lmdata['dags'] as $dag_premium) {
$count++;
if ($count > 1) {
if ($approved_by != $this->input->post('approval' . $dag_premium->dag_no)) {
$this->db->trans_rollback();
$this->session->set_flashdata('message', "Error #ERRAM000199: Settlement Application not submitted case no # $application_no");
log_message('error', '#ERRAM000199: Multiple User Approval, RTPS Case No ' . $application_no);
redirect(base_url() . "index.php/home");
}
}
// premium verify start ******************
if (in_array($basic["dist_code"], json_decode(BARAK_VALLEY))) {
$area_in_bigha = 6400;
} else {
$area_in_bigha = 100;
}
$concession_rate = 25;
$ratetype = $this->input->post('rate_type' . $dag_premium->dag_no);
$ratepr2 = $this->db->query("Select rate_type from settlement_premium_rate where prid=$ratetype ")->row();
$ratepr = $ratepr2->rate_type;
// var_dump($ratepr->rate_type); die;
$is_full_pay = $this->input->post('paymode');
// $prem_zonal=$this->input->post('zonal_valuation_prem'.$dag_premium->dag_no);
$prem_zonal = $this->utilityclass->getZonalValue($dag_premium->dist_code, $basic['uuid'], $dag_premium->dag_no);
$prem_area = $this->input->post('total_lessa' . $dag_premium->dag_no);
$prem_rate = $this->input->post('rate' . $dag_premium->dag_no);
$prem_concession = $this->input->post('concession' . $dag_premium->dag_no);
$mb_land = $this->input->post('mb_land' . $dag_premium->dag_no);
if (in_array($basic["dist_code"], json_decode(BARAK_VALLEY))) {
if ($mb_land == 25) {
$mb_land = 1600;
} else if ($mb_land == 30) {
$mb_land = 1920;
} else if ($mb_land == 40) {
$mb_land = 2560;
}
}
if ($prem_concession == "YES") {
if ($ratepr == 'P') {
if ($prem_area > $mb_land) {
$premium = $mb_land * $prem_zonal / $area_in_bigha;
$discount = $prem_rate - ($prem_rate * $concession_rate / 100);
$amount1 = ceil($premium * $discount / 100);
$access_area = $prem_area - $mb_land;
$premium2 = ($access_area * ($prem_zonal * 1.5)) / $area_in_bigha;
$amount2 = ceil($premium2 * $discount / 100);
$finalamount = ceil($amount1 + $amount2);
} else {
$premium = $prem_area * $prem_zonal / $area_in_bigha;
$discount = $prem_rate - ($prem_rate * $concession_rate / 100);
$amount = ($premium * $discount / 100);
$finalamount = ceil($amount);
}
} else if ($ratepr == 'R') {
$premium = $prem_area * $prem_rate / $area_in_bigha;
$discount = ceil($premium * ($concession_rate / 100));
$finalamount = ceil($premium - $discount);
}
} else if ($prem_concession == "NO") {
if ($ratepr == 'P') {
if ($prem_area > $mb_land) {
$premium = $mb_land * $prem_zonal / $area_in_bigha;
$amount1 = ceil($premium * $prem_rate / 100);
$access_area = $prem_area - $mb_land;
$premium2 = ($access_area * ($prem_zonal * 1.5)) / $area_in_bigha;
$amount2 = ceil($premium2 * $prem_rate / 100);
$finalamount = ceil($amount1 + $amount2);
} else {
$premium = $prem_area * $prem_zonal / $area_in_bigha;
$amount = ($premium * $prem_rate / 100);
$finalamount = ceil($amount);
}
} else if ($ratepr == 'R') {
$finalamount = ceil($prem_area * $prem_rate / $area_in_bigha);
}
}
$sumMbAmount += $finalamount;
// $fmd = array(
// 'case_no' => $case_no,
// 'user_code' => $this->session->userdata('user_code'),
// 'uuid' => $basic['uuid'],
// 'dag_no' => $dag_premium->dag_no,
// 'zonal_valuation' => $this->input->post('zonal_valuation_prem' . $dag_premium->dag_no),
// 'area_name' => $this->input->post('area_new' . $dag_premium->dag_no),
// 'land_type' => $this->input->post('land_type' . $dag_premium->dag_no),
// 'rate_type' => $this->input->post('rate_type' . $dag_premium->dag_no),
// 'rate' => $this->input->post('rate' . $dag_premium->dag_no),
// 'concession' => $this->input->post('concession' . $dag_premium->dag_no),
// 'amount_dag' => $this->input->post('amount' . $dag_premium->dag_no),
// 'final_amount' => $this->input->post('finalamount'),
// 'due_amount' => $this->input->post('totaldue'),
// 'total_lessa' => $this->input->post('total_lessa' . $dag_premium->dag_no),
// 'is_full_pay' => $this->input->post('paymode'),
// 'is_final' => 1,
// 'date_entry' => date('Y-m-d h:i:s'),
// 'approve_by' => $this->input->post('approval' . $dag_premium->dag_no),
// );
// $insPremium = $this->db->insert('settlement_premium', $fmd);
// if ($insPremium != 1) {
// $this->db->trans_rollback();
// log_message('error', '#ERRSET000101: Insertion failed in settlement_premium RTPS Case No ' . $application_no);
// $data = array(
// 'error' => "#ERRSET000101: Registration of Settlement failed for case no : " . $application_no
// );
// echo json_encode($data);
// return false;
// }
$approved_by = $this->input->post('approval' . $dag_premium->dag_no);
} // foreach end
// premium verify 2 start ******************
if ((float)$sumMbAmount != (float)$this->input->post('finalamount')) {
// var_dump("Amount mismatch!!!"); die;
$this->db->trans_rollback();
$this->session->set_flashdata('message', "Error #ERRAM0001: Settlement Application not submitted case no # $application_no");
log_message('error', '#ERRAM0001: Premium ghotala by LM, RTPS Case No ' . $application_no);
redirect(base_url() . "index.php/home");
}
if ($is_full_pay == "NO") {
$discount = 30;
$finaldue = ($sumMbAmount * $discount / 100);
// $finaldueamount = round($finaldue,2);
$finaldueamount = ceil($finaldue);
} else if ($is_full_pay == "YES") {
$finaldueamount = $sumMbAmount;
}
if ($finaldueamount != $this->input->post('totaldue')) {
// var_dump("Due Amount mismatch!!!");
$this->db->trans_rollback();
$this->session->set_flashdata('message', "Error #ERRAM0002: Settlement Application not submitted case no # $case_no");
log_message('error', '#ERRAM0002: Premium ghotala by LM, RTPS Case No ' . $application_no);
redirect(base_url() . "index.php/home");
}
// premium verify 2 end ******************
}
//////proceeding start//////
$proceeding_id = $this->db->query("Select max(proceeding_id)+1 as c from settlement_proceeding where case_no='$case_no' ")->row()->c;
if ($proceeding_id == null) {
$proceeding_id = 1;
}
$insPetProceed = [
'case_no' => $case_no,
'proceeding_id' => $proceeding_id,
'date_of_hearing' => date('Y-m-d h:i:s'),
'next_date_of_hearing' => date('Y-m-d h:i:s'),
'note_on_order' => $this->input->post('lm_remark_text'),
'status' => 'W',
'user_code' => $this->session->userdata('user_code'),
'date_entry' => date('Y-m-d h:i:s'),
'operation' => 'E',
'ip' => $this->utilityclass->get_client_ip(),
'office_from' => 'LM',
'office_to' => $pending_officer,
'task' => 'LM note submitted'
];
$insertProceeding = $this->db->insert('settlement_proceeding', $insPetProceed);
// echo $this->db->last_query(); die();
if ($insertProceeding != 1) {
$this->db->trans_rollback();
log_message('error', '#ERRORPP: Insertion failed in settlement_proceeding for case no :' . $case_no);
$json = [
'errorMessage' => "#ERRORPP: Failed to forward the case for Case No : " . $case_no
];
echo json_encode($json);
return false;
}
//////proceeding end//////
////settlement Khas LM Report insert end
if ($this->db->trans_status() == false) {
$this->db->trans_rollback();
$data = array(
'error' => "Error in submitting. Please try Again"
);
} else {
//////////////POST To basundhara/////////////////////
$rmk = 'Forwarded to ' . $pending_officer;
$status = 'M';
$task = 'LM';
$pen = 'CO';
// $pen=$pending_officer;
$case = $case_no;
$rtps_status = $this->SettlementApiModel->postApiBasundhara($application_no, $case, $rmk, $status, $task, $pen);
$rtps_status = json_decode($rtps_status);
if (trim($rtps_status) != "y") {
$this->db->trans_rollback();
$this->session->set_flashdata('message', "Error #ERRAPP0011: Settlement Application not submitted case no # $case_no");
redirect(base_url() . "index.php/home");
} else {
$this->db->trans_commit();
}
$this->session->set_flashdata('message', "Application Successfully Forwarded to " . $pending_officer . " With Case No # " . $case_no);
redirect(base_url() . "index.php/home");
}
}
}
js
Monday, November 17, 2025
temp
Subscribe to:
Post Comments (Atom)
temp
if ($_SERVER['REQUEST_METHOD'] == 'POST') { $this->utilityclass->lmAuthFirstProceeding($case_no); ...
-
ণত্ব বিধি আৰু ষত্ব বিধি ণত্ব বিধিঃ ণত্ব বিধিঃ যি বিধি বা নিয়মৰ দ্বাৰা শব্দ একোটাৰ দন্ত্য 'ন’ই মূদ্ধণ্য ‘ণ’ৰ ৰূপ লয়, তাকে ণত্ব বিধ...
-
অধ্যায়-১২ বিদ্যুৎ নির্বাচিত প্রশ্নোত্তৰ প্রশ্নঃ তাঁৰ এডালৰ দৈর্ঘ্য দুগুণলৈ বৃদ্ধি কৰিলে এমিটাৰৰ পাঠৰ কি পৰিৱৰ্তন হয়? উত্তৰঃ এমিট...
-
Introduction Vegetable crops require frequent irrigation for better growth and development. Irrigation requirement may vary from crop...
No comments:
Post a Comment