mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en pagos (datepicker)
This commit is contained in:
@ -38,8 +38,8 @@ class FacturaLineaModel extends \App\Models\BaseModel {
|
||||
->select(
|
||||
"t1.id AS id, t1.factura_id AS factura_id,
|
||||
t1.pedido_linea_impresion_id AS pedido_linea_impresion_id, t1.pedido_maquetacion_id AS pedido_maquetacion_id,
|
||||
t1.descripcion AS concepto, t1.cantidad as unidades, t1.precio_unidad AS precio_unidad, t1.iva AS iva,
|
||||
t1.base AS subtotal, t1.total_iva AS total_iva, t1.total AS total, t1.data AS data, t2.pedido_id AS pedido_id,
|
||||
t1.descripcion AS descripcion, t1.cantidad as cantidad, t1.precio_unidad AS precio_unidad, t1.iva AS iva,
|
||||
t1.base AS base, t1.total_iva AS total_iva, t1.total AS total, t1.data AS data, t2.pedido_id AS pedido_id,
|
||||
t3.total_aceptado AS total_aceptado"
|
||||
)
|
||||
->join("pedidos_linea t2", "t2.id = t1.pedido_linea_impresion_id", "left")
|
||||
@ -68,5 +68,30 @@ class FacturaLineaModel extends \App\Models\BaseModel {
|
||||
->where("pedido_linea_id", $pedido_linea_id)
|
||||
->where("cantidad", $cantidad)
|
||||
->delete();
|
||||
}
|
||||
}
|
||||
|
||||
public function updateFacturaPedidoLinea($factura_id, $pedido_linea_id, $cantidad, $cantidad_new)
|
||||
{
|
||||
// Obtener la ID del registro que queremos actualizar
|
||||
$record = $this->db->table("facturas_pedidos_lineas")
|
||||
->select('id')
|
||||
->where("factura_id", $factura_id)
|
||||
->where("pedido_linea_id", $pedido_linea_id)
|
||||
->where("cantidad", $cantidad)
|
||||
->limit(1)
|
||||
->get()
|
||||
->getRow();
|
||||
|
||||
// Si existe el registro
|
||||
if ($record) {
|
||||
$data = [
|
||||
"cantidad" => $cantidad_new
|
||||
];
|
||||
|
||||
// Actualizar el registro especificado por su ID
|
||||
$this->db->table("facturas_pedidos_lineas")
|
||||
->where("id", $record->id)
|
||||
->update($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user