Code Duplication    Length = 11-11 lines in 2 locations

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

@@ 1583-1593 (lines=11) @@
1580
	$invoice_total_query=$this->db->query($query);
1581
	if($invoice_total_query ->num_rows() > 0) {
1582
		  $invoice_total_query= $invoice_total_query->result_array();
1583
		  foreach($invoice_total_query as $key=>$value){
1584
			  $data['item_type']=$value['item_type'];
1585
			  $data['description']=$value['description'];
1586
			  if($value['item_type'] == 'Refill'){
1587
				  $data['debit']=$value['credit'];
1588
			  }else{
1589
				  $data['debit']=$value['debit'];
1590
			  }	   
1591
			  $created_date=$value['created_date'];
1592
			  $invoicedata['invoiceid']=$value['invoiceid'];
1593
		  }
1594
		  }else{
1595
		$query="select item_type,description,created_date,invoiceid,debit,credit from invoice_details where invoiceid = ".$invoiceid." And item_type='SUBCHRG' Group By item_type"; 	
1596
		$invoice_total_query=$this->db->query($query);
@@ 1599-1609 (lines=11) @@
1596
		$invoice_total_query=$this->db->query($query);
1597
		if($invoice_total_query ->num_rows() > 0) {
1598
		  $invoice_total_query= $invoice_total_query->result_array();
1599
		  foreach($invoice_total_query as $key=>$value){
1600
			  $data['item_type']=$value['item_type'];
1601
			  $data['description']=$value['description'];
1602
			  if($value['item_type'] == 'Refill'){
1603
				  $data['debit']=$value['credit'];
1604
			  } else{
1605
				  $data['debit']=$value['debit'];
1606
			  }	   
1607
			  $created_date=$value['created_date'];
1608
			  $invoicedata['invoiceid']=$value['invoiceid'];
1609
		  }
1610
		}
1611
	  }
1612
		  $data['accountinfo'] = $accountdata;