terminado el flujo completo de facturas, incluyendo cambio en el texto de pedidos y facturas cuando no tiene factura validada

This commit is contained in:
2025-04-12 17:47:36 +02:00
parent 8912606c9a
commit 89531f1a1b
11 changed files with 119 additions and 5 deletions

View File

@ -145,6 +145,27 @@ class FacturaModel extends \App\Models\BaseModel
return $builder;
}
public function presupuestoHasFacturaValidada($presupuesto_id = null)
{
if ($presupuesto_id == null) {
return false;
}
$result = $this->db->table($this->table . " t1")
->select("t1.id")
->join("facturas_lineas t2", "t2.factura_id = t1.id", "left")
->join("pedidos_linea t3", "t2.pedido_linea_impresion_id = t3.id", "left")
->where("t3.presupuesto_id", $presupuesto_id)
->where("t1.deleted_at IS NULL")
->where("t2.deleted_at IS NULL")
->where("t1.estado", "validada")
->get()
->getResultObject();
return !empty($result);
}
public function getSumatoriosFacturacionCliente($cliente_id = -1){
if($cliente_id == -1){