Code Duplication    Length = 7-7 lines in 2 locations

web_interface/astpp/application/models/common_model.php 1 location

@@ 337-343 (lines=7) @@
334
				if ($taxes_info->num_rows() > 0) {
335
					$tax_value = $taxes_info->result_array();
336
					$tax_value = $tax_value[0];
337
					if ($tax_value["taxes_priority"] == "") {
338
						$tax_priority = $tax_value["taxes_priority"];
339
					} else if ($tax_value["taxes_priority"] > $tax_priority) {
340
						$query = $this->db_model->getSelect("SUM(debit) as total", "invoice_details", array("invoiceid" => $invoiceid));
341
						$query = $query->result_array();
342
						$sub_total = $query["0"]["total"];
343
					}
344
					$tax_total = (($sub_total * ( $tax_value['taxes_rate'] / 100 )) + $tax_value['taxes_amount'] );
345
					$tax_total = round($tax_total, self::$global_config['system_config']['decimalpoints']);
346
					$tax_array = array("accountid" => $account['id'], "reseller_id" => $account['reseller_id'], "invoiceid" => $invoiceid, "item_id" => "0", "description" => $tax_value['taxes_description'], "debit" => $tax_total, "credit" => "", "item_type" => "TAX", "created_date" => $start_date);

web_interface/astpp/application/modules/invoices/controllers/invoices.php 1 location

@@ 1834-1840 (lines=7) @@
1831
			if($taxes_info->num_rows() > 0 ){
1832
					$tax_value=$taxes_info->result_array();
1833
					$tax_value=$tax_value[0];
1834
				 if($tax_value["taxes_priority"] == ""){
1835
					 $tax_priority = $tax_value["taxes_priority"];
1836
				 }else if($tax_value["taxes_priority"] > $tax_priority){
1837
					 $query = $this->db_model->getSelect("SUM(value) as total", "invoices_total", array("invoiceid"=> $invoiceid));
1838
					 $query =  $query->result_array();
1839
					 $sub_total = $query["0"]["total"];
1840
				 }
1841
				$tax_total = (($sub_total * ( $tax_value['taxes_rate'] / 100 )) + $tax_value['taxes_amount'] );
1842
				$tax_array = array("invoiceid"=>$invoiceid,"title"=>"TAX","text"=>$tax_value['taxes_description'],
1843
					"value"=>$tax_total,"class"=>"2","sort_order"=>$sort_order);