mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
falta mostrar precios albaran
This commit is contained in:
@ -45,6 +45,8 @@ class AlbaranModel extends \App\Models\BaseModel
|
||||
|
||||
$presupuestos = $model_presupuesto->find($presupuestos_id);
|
||||
|
||||
$return_data = [];
|
||||
|
||||
foreach ($presupuestos as $presupuesto) {
|
||||
|
||||
$envios = $model_presupuesto_direcciones->where('presupuesto_id', $presupuesto->id)->findAll();
|
||||
@ -54,7 +56,7 @@ class AlbaranModel extends \App\Models\BaseModel
|
||||
$precio_unidad = $presupuesto->total_aceptado/$presupuesto->tirada;
|
||||
|
||||
$albaran_linea = [];
|
||||
$albaran_linea = array(
|
||||
$albaran_linea = [
|
||||
'titulo' => $presupuesto->titulo,
|
||||
'isbn' => $presupuesto->isbn,
|
||||
'ref_cliente' => $presupuesto->ref_cliente,
|
||||
@ -63,17 +65,17 @@ class AlbaranModel extends \App\Models\BaseModel
|
||||
'ejemplares_por_caja' => $envio->cantidad,
|
||||
'precio_unidad' => $precio_unidad,
|
||||
'total' => $precio_unidad * $envio->cantidad
|
||||
);
|
||||
];
|
||||
|
||||
|
||||
$serie = $model_series->find(11);
|
||||
$numero_albaran = str_replace($serie->next, 'number', $serie->formato);
|
||||
$numero_albaran = str_replace(date("Y"), 'year', $numero_albaran);
|
||||
$numero_albaran = str_replace('{number}', $serie->next, $serie->formato);
|
||||
$numero_albaran = str_replace( '{year}', date("Y"), $numero_albaran);
|
||||
|
||||
$serie->next = $serie->next + 1;
|
||||
$model_series->save($serie);
|
||||
|
||||
$albaran = array(
|
||||
$albaran = [
|
||||
'pedido_id' => $pedido_id,
|
||||
'presupuesto_id' => $presupuesto->id,
|
||||
'presupuesto_direccion_id' => $envio->id,
|
||||
@ -84,20 +86,22 @@ class AlbaranModel extends \App\Models\BaseModel
|
||||
'total' => $albaran_linea['total'],
|
||||
'direccion_albaran' => $envio->direccion,
|
||||
'att_albaran' => $envio->att,
|
||||
'created_at' => date("Y-m-d H:i:s"),
|
||||
'updated_at' => date("Y-m-d H:i:s"),
|
||||
'user_created_id' => $user_id,
|
||||
'user_updated_id' => $user_id
|
||||
);
|
||||
'user_updated_id' => $user_id,
|
||||
'fecha_albaran' => date('d/m/Y'),
|
||||
];
|
||||
|
||||
$id_albaran = $this->insert($albaran);
|
||||
$model_albaran_linea = model('App\Models\Pedidos\AlbaranLineaModel');
|
||||
$model_albaran_linea->insert($albaran_linea);
|
||||
$albaran['id'] = $id_albaran;
|
||||
$albaran_linea['albaran_id'] = $id_albaran;
|
||||
$id_albaran_linea =$model_albaran_linea->insert($albaran_linea);
|
||||
$albaran_linea['id'] = $id_albaran_linea;
|
||||
|
||||
return $id_albaran;
|
||||
array_push($return_data, ["albaran"=>$albaran, "albaran_linea" =>$albaran_linea]);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return $return_data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user