I have the following freight table
Ihavethefollowingneighborhoodtable
Where in the table, select > idSaida = 1 = Center and idDestino = 2 = Abranches In this case a product will be collected at the Center and delivered to Abranches. This service was made by moto - dotMoto If we add up the result will be 2 points.
The problem is that I am not able to develop the calculation of this score. Has anyone here developed something similar? Do you have any idea?
Producing a test, the first result of print_r ($ data):
[0] => Array
(
[tiposervico] => 0
[endereco] => asdfasdf
[numero] =>
[bairro] => 1
[cidade] => Curitiba
[falarcom] =>
[idChamada] => 34
)
[1] => Array
(
[tiposervico] => 1
[endereco] => afsdf adf asf
[numero] =>
[bairro] => 2
[cidade] => Curitiba
[falarcom] =>
[idChamada] => 34
)
I tried to do this as I entered the services ...
public function addChamadaServico($dados)
{
$campo['idSaida'] = $dados[0]['bairro'];
$campo['idDestino'] = $dados[1]['bairro'];
$sql = "SELECT * FROM tabelafrete WHERE idSaida = ".$campo['idSaida']." AND idDestino = ".$campo['idDestino']."";
$consulta = $this->db->query($sql)->result();
//echo $sql;
foreach($consulta as $valor){
$contagem = $valor->pontoMoto * 15;
echo $contagem;
}
}
So far, apparently it works ... but the fact is that you can have multiple "destinations" in different neighborhoods and a return, or multiple returns in different neighborhoods ... does anyone have any ideas?