Code Duplication    Length = 6-6 lines in 3 locations

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

@@ 139-144 (lines=6) @@
136
		  $invoice_query ="select sum(credit) as grand_credit from invoice_details where reseller_id='0'";
137
		  }
138
		  $credit_query=$this->db->query($invoice_query);
139
		  if($credit_query->num_rows() > 0){
140
		  $credit_total=$credit_query->result_array();
141
		  $grand_credit_total=$credit_total[0]['grand_credit'];
142
		  $grandcredit=$grand_total-$grand_credit_total;
143
		  $grand_credit=$this->common->currency_decimal($grandcredit).' '.$currency_id;
144
		  }
145
		  $download="<a  href=" . $url .$value['id'].'/00_'.$value['invoice_prefix'].$value['invoiceid']. " class='btn btn-royelblue btn-sm'  title='Download Invoice' ><i class='fa fa-cloud-download fa-fw'></i></a>&nbsp";
146
		  if($value['type'] == 'I'){
147
		if($value['confirm'] ==0){
@@ 1159-1164 (lines=6) @@
1156
          
1157
		  $invoice_query ="select sum(credit) as grand_credit from invoice_details where accountid=$accountid";
1158
		  $credit_query=$this->db->query($invoice_query);
1159
		  if($credit_query->num_rows() > 0){
1160
		  $credit_total=$credit_query->result_array();
1161
		  $grand_credit_total=$credit_total[0]['grand_credit'];
1162
		  $grandcredit=$grand_total-$grand_credit_total;
1163
		  $grand_credit=$this->common->currency_decimal($grandcredit).' '.$currency_id;
1164
		  }
1165
         
1166
         
1167
       
@@ 1271-1276 (lines=6) @@
1268
          
1269
		  $invoice_query ="select sum(credit) as grand_credit from invoice_details where accountid=$accountid";
1270
		  $credit_query=$this->db->query($invoice_query);
1271
		  if($credit_query->num_rows() > 0){
1272
		  $credit_total=$credit_query->result_array();
1273
		  $grand_credit_total=$credit_total[0]['grand_credit'];
1274
		  $grandcredit=$grand_total-$grand_credit_total;
1275
		  $grand_credit=$this->common->currency_decimal($grandcredit).' '.$currency_id;
1276
		  }
1277
		 $download='<a href="'. base_url() .'/user/user_invoice_download/' . $value['id'].'/00'.$value['invoice_prefix'].$value['invoiceid'].'" class="btn btn-royelblue btn-sm"  title="Download Invoice" ><i class="fa fa-cloud-download fa-fw"></i></a>&nbsp';
1278
		 if($outstanding > 0){
1279
		 $payment = ' <a style="padding: 0 8px;" href="'. base_url() .'user/user_invoice_payment/' . $value['id'] . '" class="btn btn-warning"  title="Payment">Unpaid</a>';