Code Duplication    Length = 14-14 lines in 2 locations

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

@@ 498-511 (lines=14) @@
495
	}
496
	}
497
	for ($i = 1; $i <= $response_arr['row_count']; $i++) {
498
		if($response_arr['invoice_amount_'.$i] != ''){
499
			$add_arr=array(
500
			  'accountid'=>$response_arr['accountid'],
501
			  'reseller_id'=>$response_arr['reseller_id'],
502
			  'invoiceid'=>$response_arr['invoiceid'],
503
			  'item_id'=>0,
504
			  'generate_type'=>1,
505
			  'item_type'=>'manual_inv',
506
			  'description'=>$response_arr['invoice_description_'.$i],
507
			  'debit'=>$this->common_model->add_calculate_currency($response_arr['invoice_amount_'.$i],"","",true,false),
508
			  'created_date'=>$response_arr['invoice_from_date_'.$i],
509
			);
510
		   	 $this->db->insert("invoice_details",$add_arr);	
511
		}
512
		$final_bal += $this->common_model->add_calculate_currency($response_arr['invoice_amount_'.$i],"","",true,false);
513
	  }
514
		  $query="select  sum(debit) as credit from invoice_details where invoiceid = ".$response_arr['invoiceid']; 
@@ 611-624 (lines=14) @@
608
	}
609
	}
610
		 for ($i = 1; $i <=$response_arr['row_count']; $i++) {
611
		if($response_arr['invoice_amount_'.$i] != ''){
612
			$add_arr=array(
613
			  'accountid'=>$response_arr['accountid'],
614
			  'reseller_id'=>$response_arr['reseller_id'],
615
			  'invoiceid'=>$response_arr['invoiceid'],
616
			  'item_id'=>0,
617
			  'generate_type'=>1,
618
			  'item_type'=>'manual_inv',
619
			  'description'=>$response_arr['invoice_description_'.$i],
620
			  'debit'=>$this->common_model->add_calculate_currency($response_arr['invoice_amount_'.$i],"","",true,false),
621
			  'created_date'=>$response_arr['invoice_from_date_'.$i],
622
			);
623
		   	 $this->db->insert("invoice_details",$add_arr);	
624
		}
625
		}
626
		$query="select  sum(debit) as credit from invoice_details where invoiceid = ".$response_arr['invoiceid']; 
627
		$invoice_total_query=$this->db->query($query);