Code Duplication    Length = 28-28 lines in 2 locations

web_interface/astpp/application/modules/user/controllers/user.php 2 locations

@@ 1436-1463 (lines=28) @@
1433
		$this->load->view('view_user_cdrs_report', $data);
1434
	}
1435
1436
	function user_cdrs_report_json() {
1437
		$accountinfo=$this->session->userdata('accountinfo');
1438
		$variable=$accountinfo['type'] != 3 ?'total_debit':'total_cost';
1439
		$count_res = $this->user_model->getuser_cdrs_list(false, "", "");
1440
		$count_all = (array) $count_res->first_row();
1441
		$paging_data = $this->form->load_grid_config($count_all['count'], $_GET['rp'], $_GET['page']);
1442
		$json_data = $paging_data["json_paging"];
1443
		$query = $this->user_model->getuser_cdrs_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], false);
1444
		$grid_fields = json_decode($this->user_form->build_cdrs_report($accountinfo['type']));
1445
		$json_data['rows'] = $this->form->build_grid($query, $grid_fields);
1446
		if ($count_all['count'] > 0) {
1447
			$search_arr = $this->session->userdata('user_cdrs_report_search');
1448
			$show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes';
1449
			$duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ?
1450
			floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00"  : $count_all['billseconds'];
1451
			$json_data['rows'][] = array("cell" => array(
1452
					"<b>Grand Total</b>",
1453
					"",
1454
					"",
1455
					"",
1456
					$duration,
1457
					"<b>".$this->common_model->calculate_currency($count_all[$variable],"","",true,false)."</b>",
1458
					"",
1459
					"",
1460
					));
1461
		}
1462
		echo json_encode($json_data);
1463
	}
1464
1465
	function user_cdrs_report_search() {
1466
		$ajax_search = $this->input->post('ajax_search', 0);
@@ 1832-1859 (lines=28) @@
1829
		$this->load->view('view_provider_cdrs_report', $data);
1830
	}
1831
1832
	function user_provider_cdrs_report_json() {
1833
		$accountinfo=$this->session->userdata('accountinfo');
1834
		$variable=$accountinfo['type'] != 3 ?'total_debit':'total_cost';
1835
		$count_res = $this->user_model->getprovider_cdrs_list(false, "", "");
1836
		$count_all = (array) $count_res->first_row();
1837
		$paging_data = $this->form->load_grid_config($count_all['count'], $_GET['rp'], $_GET['page']);
1838
		$json_data = $paging_data["json_paging"];
1839
		$query = $this->user_model->getprovider_cdrs_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], false);
1840
		$grid_fields = json_decode($this->user_form->build_provider_report($accountinfo['type']));
1841
		$json_data['rows'] = $this->form->build_grid($query, $grid_fields);
1842
		if ($count_all['count'] > 0) {
1843
			$search_arr = $this->session->userdata('user_provider_cdrs_report_search');
1844
			$show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes';
1845
			$duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ?
1846
			floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00"  : $count_all['billseconds'];
1847
			$json_data['rows'][] = array("cell" => array(
1848
					"<b>Grand Total</b>",
1849
					"",
1850
					"",
1851
					"",
1852
					$duration,
1853
					"<b>".$this->common_model->calculate_currency($count_all[$variable],"","",true,false)."</b>",
1854
					"",
1855
					"",
1856
					));
1857
		}
1858
		echo json_encode($json_data);
1859
	}
1860
1861
	function user_provider_cdrs_report_search() {
1862
		$ajax_search = $this->input->post('ajax_search', 0);