Code Duplication    Length = 5-5 lines in 3 locations

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

@@ 257-261 (lines=5) @@
254
		 $invoice_total='';
255
		 $query="SELECT  * from invoice_details where item_type='INVPAY' AND invoiceid='$id' ORDER BY created_date ASC";
256
		 $invoice = $this->db_model->getSelect("*", "invoices", array("id"=> $id));
257
		 if ($invoice ->num_rows() > 0) {
258
			 $invoice= $invoice->result_array();
259
			 $result=$invoice[0];
260
			 $data['payment_due_date']=$result['due_date'];
261
		  }
262
     
263
			$accountdata = $this->db_model->getSelect("*","accounts",array("id"=> $result['accountid']));
264
			if ($accountdata ->num_rows() > 0) {
@@ 384-388 (lines=5) @@
381
			$data['invoice_total_query']=$invoice_total_query;
382
		  }
383
		 $invoice = $this->db_model->getSelect("*", "invoices", array("id"=> $id));
384
		 if ($invoice ->num_rows() > 0) {
385
			 $invoice= $invoice->result_array();
386
			 $result=$invoice[0];
387
			 $data['payment_due_date']=$result['due_date'];
388
		  }
389
		 $invoice_auto_res = $this->db_model->getSelect("sum(debit) as debit", "invoice_details", array("invoiceid"=> $id,'generate_type'=>0));
390
	 $data['invoice_auto_res']=0;
391
		 if ($invoice_auto_res ->num_rows() > 0) {
@@ 726-730 (lines=5) @@
723
			$data['invoice_total_query']=$invoice_total_query;
724
		  }
725
		  $invoice = $this->db_model->getSelect("*", "invoices", array("id"=> $id));
726
		  if ($invoice ->num_rows() > 0) {
727
			 $invoice= $invoice->result_array();
728
			 $result=$invoice[0];
729
			 $data['payment_due_date']=$result['due_date'];
730
		  }
731
     
732
			$accountdata = $this->db_model->getSelect("*","accounts",array("id"=> $result['accountid']));
733
			if ($accountdata ->num_rows() > 0) {