mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
corregidas direfencias en totales presupuestos. tiradas alternativas ok. corregido calculo envio base
This commit is contained in:
@ -1722,8 +1722,8 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
'tarifa_encuadernado_id' => $servicio->tarifa_id,
|
||||
'proveedor_id' => $servicio->proveedor_id,
|
||||
'tiempo' => $servicio->tiempo,
|
||||
'precio_total' => $servicio->total,
|
||||
'precio_unidad' => $servicio->precio_unidad,
|
||||
'precio_total' => round($servicio->total, 2),
|
||||
'precio_unidad' => round($servicio->precio_unidad, 2),
|
||||
'margen' => $servicio->margen,
|
||||
];
|
||||
|
||||
@ -1739,7 +1739,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$data = [
|
||||
'presupuesto_id' => $presupuestoId,
|
||||
'tarifa_extra_id' => $servicio->tarifa_id,
|
||||
'precio' => $servicio->precio,
|
||||
'precio' => round($servicio->precio, 2),
|
||||
'margen' => $servicio->margen,
|
||||
];
|
||||
$model->insert($data);
|
||||
@ -1764,8 +1764,8 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$data = [
|
||||
'presupuesto_id' => $presupuestoId,
|
||||
'tarifa_manipulado_id' => $servicio->tarifa_id,
|
||||
'precio_total' => $servicio->total,
|
||||
'precio_unidad' => $servicio->precio_unidad,
|
||||
'precio_total' => round($servicio->total, 2),
|
||||
'precio_unidad' => round($servicio->precio_unidad, 2),
|
||||
'margen' => $servicio->margen,
|
||||
];
|
||||
$model->insert($data);
|
||||
@ -1792,7 +1792,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$margen = 0;
|
||||
|
||||
|
||||
$peso_envio = round(floatval(floatval($peso) * floatval($unidades) / 1000.0)); // peso libro * unidades y se pasa a kilogramos
|
||||
$peso_envio = round(floatval(floatval($peso) * floatval($unidades) / 1000.0), 3); // peso libro * unidades y se pasa a kilogramos
|
||||
$tarifas_envio = $modelTarifaEnvio->getTarifaEnvio($pais_id, $cp, $peso_envio, $entregaPieCalle ? 'palets' : 'cajas');
|
||||
for ($i = 0; $i < count($tarifas_envio); $i++) {
|
||||
if ($peso_envio > $tarifas_envio[$i]->peso_max || floatval($tarifas_envio[$i]->precio_max) == 0) {
|
||||
@ -2021,7 +2021,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
foreach ($interior as $linea) {
|
||||
if (count($linea) > 0) {
|
||||
$costeInterior += round(floatval($linea['total_impresion']),2);
|
||||
$costeInterior += round(floatval($linea['total_impresion']), 2);
|
||||
$peso_interior += floatval($linea['peso']);
|
||||
$lomo += floatval($linea['mano']);
|
||||
if ($extra_info) {
|
||||
@ -2131,6 +2131,12 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
return $return_data;
|
||||
}
|
||||
$coste_servicios += round(floatval($acabadoCubierta[0]->total), 2);
|
||||
if ($extra_info) {
|
||||
$totalServicios += round(floatval($acabadoCubierta[0]->total), 2);
|
||||
$base = round(floatval($acabadoCubierta[0]->total / (1 + $acabadoCubierta[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $datosPedido->tirada) , 2)* $datosPedido->tirada;
|
||||
$margenServicios += round(floatval($acabadoCubierta[0]->total - $base), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2157,7 +2163,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$linea_sobrecubierta = PresupuestoClienteService::obtenerSobrecubierta($input_data);
|
||||
|
||||
if (count($linea_sobrecubierta) > 0) {
|
||||
$coste_sobrecubierta += round(floatval($linea_sobrecubierta['total_impresion']),2);
|
||||
$coste_sobrecubierta += round(floatval($linea_sobrecubierta['total_impresion']), 2);
|
||||
$peso_sobrecubierta += floatval($linea_sobrecubierta['peso']);
|
||||
if ($extra_info) {
|
||||
|
||||
@ -2216,6 +2222,12 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
$coste_servicios += round(floatval($acabadoSobrecubierta[0]->total), 2);
|
||||
if ($extra_info) {
|
||||
$totalServicios += round(floatval($acabadoSobrecubierta[0]->total), 2);
|
||||
$base = round(floatval($acabadoSobrecubierta[0]->total / (1 + $acabadoSobrecubierta[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $datosPedido->tirada) , 2)* $datosPedido->tirada;
|
||||
$margenServicios += round(floatval($acabadoSobrecubierta[0]->total - $base), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2363,6 +2375,12 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
$coste_servicios += round(floatval($acabadoFaja[0]->total), 2);
|
||||
if ($extra_info) {
|
||||
$totalServicios += round(floatval($acabadoFaja[0]->total), 2);
|
||||
$base = round(floatval($acabadoFaja[0]->total / (1 + $acabadoFaja[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $datosPedido->tirada) , 2)* $datosPedido->tirada;
|
||||
$margenServicios += round(floatval($acabadoFaja[0]->total - $base), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2413,7 +2431,9 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$costeServiciosDefecto += round(floatval($servicio->total), 2);
|
||||
if ($extra_info) {
|
||||
$totalServicios += round(floatval($servicio->total), 2);
|
||||
$margenServicios += round(floatval($servicio->total) * floatval($servicio->margen) / 100.0, 2);
|
||||
$base = round(floatval($servicio->total / (1 + $servicio->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $datosPedido->tirada), 2)*$datosPedido->tirada;
|
||||
$margenServicios += round(floatval($servicio->total -$base), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2448,7 +2468,9 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$costeServiciosDefecto += round(floatval($servicio->total), 2);
|
||||
if ($extra_info) {
|
||||
$totalServicios += round(floatval($servicio->total), 2);
|
||||
$margenServicios += round(floatval($servicio->total) * floatval($servicio->margen) / 100.0, 2);
|
||||
$base = round(floatval($servicio->total / (1 + $servicio->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $datosPedido->tirada), 2)*$datosPedido->tirada;
|
||||
$margenServicios += round(floatval($servicio->total -$base), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2563,7 +2585,9 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$coste_servicios += round(floatval($resultado[0]->total), 2);
|
||||
if ($extra_info) {
|
||||
$totalServicios += round(floatval($resultado[0]->total), 2);
|
||||
$margenServicios += round(floatval($resultado[0]->total) * floatval($resultado[0]->margen) / 100.0, 2);
|
||||
$base = round(floatval($resultado[0]->total / (1 + $resultado[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $datosPedido->tirada) , 2)* $datosPedido->tirada;
|
||||
$margenServicios += round(floatval($resultado[0]->total - $base), 2);
|
||||
}
|
||||
} else if ($servicio->nombre == "ferro" || $servicio->nombre == "prototipo") {
|
||||
// Extra
|
||||
@ -2593,7 +2617,9 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$coste_servicios += round(floatval($resultado[0]->precio), 2);
|
||||
if ($extra_info) {
|
||||
$totalServicios += round(floatval($resultado[0]->precio), 2);
|
||||
$margenServicios += round(floatval($resultado[0]->precio) * floatval($resultado[0]->margen) / 100.0, 2);
|
||||
$base = round(floatval($resultado[0]->total / (1 + $resultado[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $datosPedido->tirada) , 2)* $datosPedido->tirada;
|
||||
$margenServicios += round(floatval($resultado[0]->total - $base), 2);
|
||||
}
|
||||
} else if ($servicio->nombre == 'solapas_cubierta' || $servicio->nombre == 'solapas_sobrecubierta' || $servicio->nombre == 'solapas_faja') {
|
||||
// Servicios manipulado
|
||||
@ -2625,7 +2651,9 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$coste_servicios += round(floatval($resultado[0]->total), 2);
|
||||
if ($extra_info) {
|
||||
$totalServicios += round(floatval($resultado[0]->total), 2);
|
||||
$margenServicios += round(floatval($resultado[0]->total) * floatval($resultado[0]->margen) / 100.0, 2);
|
||||
$base = round(floatval($resultado[0]->total / (1 + $resultado[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $datosPedido->tirada) , 2)* $datosPedido->tirada;
|
||||
$margenServicios += round(floatval($resultado[0]->total - $base), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2661,7 +2689,9 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$coste_servicios += round(floatval($resultado[0]->total), 2);
|
||||
if ($extra_info) {
|
||||
$totalServicios += round(floatval($resultado[0]->total), 2);
|
||||
$margenServicios += round(floatval($resultado[0]->total) * floatval($resultado[0]->margen) / 100.0, 2);
|
||||
$base = round(floatval($resultado[0]->total / (1 + $resultado[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $datosPedido->tirada) , 2)* $datosPedido->tirada;
|
||||
$margenServicios += round(floatval($resultado[0]->total - $base), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2696,7 +2726,9 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$coste_servicios += round(floatval($resultado[0]->total), 2);
|
||||
if ($extra_info) {
|
||||
$totalServicios += round(floatval($resultado[0]->total), 2);
|
||||
$margenServicios += round(floatval($resultado[0]->total) * floatval($resultado[0]->margen) / 100.0, 2);
|
||||
$base = round(floatval($resultado[0]->total / (1 + $resultado[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $datosPedido->tirada) , 2)* $datosPedido->tirada;
|
||||
$margenServicios += round(floatval($resultado[0]->total - $base), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2731,7 +2763,9 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$coste_servicios += round(floatval($resultado[0]->total), 2);
|
||||
if ($extra_info) {
|
||||
$totalServicios += round(floatval($resultado[0]->total), 2);
|
||||
$margenServicios += round(floatval($resultado[0]->total) * floatval($resultado[0]->margen) / 100.0, 2);
|
||||
$base = round(floatval($resultado[0]->total / (1 + $resultado[0]->margen / 100.0)), 2);
|
||||
$base = round(floatval($base / $datosPedido->tirada) , 2)* $datosPedido->tirada;
|
||||
$margenServicios += round(floatval($resultado[0]->total - $base), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2745,12 +2779,12 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$precio_u,
|
||||
round(($total_por_tirada) / $tirada[$t], 4)
|
||||
);
|
||||
array_push($peso, round($peso_interior + $peso_cubierta + $peso_sobrecubierta + $peso_guardas, 2));
|
||||
array_push($peso, round($peso_interior + $peso_cubierta + $peso_sobrecubierta + $peso_guardas + $peso_faja, 2));
|
||||
|
||||
if ($extra_info) {
|
||||
$totalServicios -= $margenServicios;
|
||||
if (($margenServicios + $totalServicios) > 0) {
|
||||
$porcentajeMargenServicios = $margenServicios / ($margenServicios + $totalServicios) * 100;
|
||||
$porcentajeMargenServicios = $margenServicios / ($totalServicios) * 100;
|
||||
} else {
|
||||
$porcentajeMargenServicios = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user