1
I have the following freight table
I have the following neighborhood table
Where on the table -> idSaida = 1 = Centre and idDestino = 2 = Abranches In this case a product will be collected at the Center and delivered at Abranches. This service was made by motorcycle - point If we add up the result will be 2 points.
The problem is, I’m having trouble working out how to calculate that score. Has anyone here developed anything similar? Have any idea?
Producing a test, the first print_r result ($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 by inserting 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;
}
}
Until then, apparently it works... but the case is that it can have several "destinations" in different neighborhoods and a return, or several returns in different neighborhoods... someone has some idea?