mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
terminado importador
This commit is contained in:
@ -1765,7 +1765,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$direccion['direccion'],
|
||||
$peso_libro,
|
||||
$direccion['unidades'],
|
||||
$direccion['entregaPalets'] == 'false' ? 0 : 1,
|
||||
($direccion['entregaPalets'] == 'false' || $direccion['entregaPalets'] == 0) ? 0 : 1,
|
||||
false
|
||||
);
|
||||
|
||||
@ -1776,7 +1776,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
unset($data->id);
|
||||
$data->precio = $data->coste;
|
||||
unset($data->coste);
|
||||
$data->entregaPieCalle = $direccion['entregaPalets'] == 'false' ? 0 : 1;
|
||||
$data->entregaPieCalle = ($direccion['entregaPalets'] == 'false' || $direccion['entregaPalets'] == 0) ? 0 : 1;
|
||||
unset($data->tipo);
|
||||
$data->peso = $peso_envio;
|
||||
$data->cantidad = $unidades;
|
||||
@ -1887,15 +1887,21 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$margen = $tarifas_envio[$i]->margen;
|
||||
}
|
||||
|
||||
$tarifa_envio_final = null;
|
||||
if (count($tarifas_envio) > 1) {
|
||||
$tarifa_final = array_reduce($tarifas_envio, function ($previous, $current) {
|
||||
$tarifa_envio_final = array_reduce($tarifas_envio, function ($previous, $current) {
|
||||
return $current->precio < $previous->precio ? $current : $previous;
|
||||
});
|
||||
$coste = $tarifa_final->precio;
|
||||
} else {
|
||||
if (count($tarifas_envio) > 0)
|
||||
$coste = $tarifas_envio[0]->precio;
|
||||
$margen = $tarifas_envio[0]->margen;
|
||||
if (count($tarifas_envio) > 0){
|
||||
$tarifa_envio_final = $tarifas_envio[0];
|
||||
}
|
||||
}
|
||||
$coste = $tarifa_envio_final->precio;
|
||||
$margen = $tarifa_envio_final->margen;
|
||||
|
||||
if(!isset($return_data['id'])){
|
||||
$return_data['id'] = $tarifa_envio_final->id;
|
||||
}
|
||||
|
||||
$return_data['coste'] = $coste;
|
||||
|
||||
Reference in New Issue
Block a user