/** * Devuelve la cantidad de sorteos existentes * * @return boolean, array */ public function GetNumSoteos() { //Preparacion del query $sql = "SELECT COUNT(id_sorteo) as N FROM sorteos WHERE status = 1"; $result = $this->vConexion->ExecuteQuery($sql); if ($this->vConexion->GetNumberRows($result) > 0) { $row = $this->vConexion->GetArrayInfo($result); return $row['N']; } else { return 0; } }
/** * Devuelve el listado de numeros agotados * * @param string $fecha * @return boolean, array */ public function GetNumeros($fecha) { //Preparacion del query $sql = "SELECT IA.numero, S.nombre_sorteo, S.hora_sorteo, Z.nombre_zodiacal\r\n FROM detalle_ticket IA\r\n INNER JOIN Sorteos S ON IA.id_sorteo=S.id_sorteo\r\n INNER JOIN Zodiacal Z ON IA.id_zodiacal=Z.Id_zodiacal\r\n WHERE monto_restante=0 AND IA.fecha_sorteo LIKE '%" . $fecha . "%'"; $result = $this->vConexion->ExecuteQuery($sql); //echo $sql; if ($this->vConexion->GetNumberRows($result) > 0) { return $result; } else { return ""; } }
/** * Devuelve el detalle de jugadas de algun ticket * * @param string $id_ticket * @return boolean, array */ public function GetDetalleTicket($id_ticket) { //Preparacion del query $sql = "SELECT DT.*, S.nombre_sorteo, Z.nombre_zodiacal\r\n FROM detalle_ticket DT\r\n INNER JOIN sorteos S ON S.id_sorteo=DT.id_sorteo\r\n INNER JOIN zodiacal Z ON Z.Id_zodiacal=DT.id_zodiacal\r\n WHERE id_ticket='" . $id_ticket . "'"; $result = $this->vConexion->ExecuteQuery($sql); $total_registros = $this->vConexion->GetNumberRows($result); if ($total_registros == 0) { $sql = " SELECT DTD.*, SS.nombre_sorteo, ZZ.nombre_zodiacal\r\n\t\t\t\tFROM detalle_ticket_diario DTD\r\n INNER JOIN sorteos SS ON SS.id_sorteo=DTD.id_sorteo\r\n INNER JOIN zodiacal ZZ ON ZZ.Id_zodiacal=DTD.id_zodiacal\r\n WHERE id_ticket_diario='" . $id_ticket . "' AND monto <> 0"; $result = $this->vConexion->ExecuteQuery($sql); //echo $sql; } return $result; }
/** * Valida que los sorteos de un Ticket no se han cerrado * * @param string $id_ticket * @param string $serial */ public function ValidaSorteosTicket($id_ticket, $tipo_servidor) { if ($tipo_servidor == 1 or $tipo_servidor == 2) { $ticket = "ticket"; } else { $ticket = "ticket_diario"; } //Preparacion del query $sql = "SELECT id_sorteo FROM detalle_" . $ticket . " WHERE id_" . $ticket . "='" . $id_ticket . "'"; $result = $this->vConexion->ExecuteQuery($sql); $total_registros = $this->vConexion->GetNumberRows($result); $flag = false; if ($total_registros > 0) { $hora_actual = strtotime(date('H:i:s')); while ($roww = $this->vConexion->GetArrayInfo($result)) { $sql = "SELECT hora_sorteo FROM sorteos WHERE status = 1 AND id_sorteo = " . $roww["id_sorteo"] . ""; $result = $this->vConexion->ExecuteQuery($sql); $row = $this->vConexion->GetArrayInfo($result); if ($hora_actual > strtotime($row["hora_sorteo"])) { $flag = true; } } } return $flag; }
/** * Busqueda de Parametros * * @param string $cantidad * @param string $pagina * @return boolean, array */ public function GetListado($cantidad, $pagina) { // Datos para la paginacion $inicial = ($pagina - 1) * $cantidad; //Preparacion del query $sql = "SELECT * FROM parametros"; $result = $this->vConexion->ExecuteQuery($sql); // Datos para la paginacion $total_registros = $this->vConexion->GetNumberRows($result); if ($cantidad != 0) { $total_paginas = ceil($total_registros / $cantidad); } else { $total_paginas = 0; } // Nuevo SQL $sql .= " LIMIT " . $cantidad . " OFFSET " . $inicial . ""; $result = $this->vConexion->ExecuteQuery($sql); return array('pagina' => $pagina, 'total_paginas' => $total_paginas, 'total_registros' => $total_registros, 'result' => $result); }
/** * Busqueda de Todos las Relaciones de Pago. * * @param string $cantidad * @param string $pagina * @return boolean, array */ public function GetListado($cantidad, $pagina) { // Datos para la paginacion $inicial = ($pagina - 1) * $cantidad; //Preparacion del query $sql = "SELECT RP.*, TJ.nombre_jugada FROM relacion_pagos RP INNER JOIN tipo_jugadas TJ ON RP.id_tipo_jugada=TJ.id_tipo_jugada"; $result = $this->vConexion->ExecuteQuery($sql); // Datos para la paginacion $total_registros = $this->vConexion->GetNumberRows($result); if ($cantidad != 0) { $total_paginas = ceil($total_registros / $cantidad); } else { $total_paginas = 0; } // Nuevo SQL $sql .= " LIMIT " . $cantidad . " OFFSET " . $inicial . ""; $result = $this->vConexion->ExecuteQuery($sql); return array('pagina' => $pagina, 'total_paginas' => $total_paginas, 'total_registros' => $total_registros, 'result' => $result); }
/** * Busqueda de Todos los Usuarios. * * @param string $usuario * @param string $clave * @return boolean, array */ public function GetListado($cantidad, $pagina) { // Datos para la paginacion $inicial = ($pagina - 1) * $cantidad; //Preparacion del query //$sql = "SELECT * FROM sorteos WHERE status <> 0"; $sql = "SELECT * FROM sorteos ORDER BY hora_sorteo, id_loteria, zodiacal, nombre_sorteo"; $result = $this->vConexion->ExecuteQuery($sql); // Datos para la paginacion $total_registros = $this->vConexion->GetNumberRows($result); if ($cantidad != 0) { $total_paginas = ceil($total_registros / $cantidad); } else { $total_paginas = 0; } // Nuevo SQL $sql .= " LIMIT " . $cantidad . " OFFSET " . $inicial . ""; $result = $this->vConexion->ExecuteQuery($sql); return array('pagina' => $pagina, 'total_paginas' => $total_paginas, 'total_registros' => $total_registros, 'result' => $result); }
/** * Busqueda de detalle de Tickets Segun id_ticket * * @param string $id_ticket */ public function GetAllDetalleTciket2($id_ticket) { //Preparacion del query $sql = "SELECT *\r\n FROM detalle_ticket DT\r\n WHERE id_ticket='" . $id_ticket . "'"; $result = mysql_query($sql); $total_registros = $this->vConexion->GetNumberRows($result); if ($total_registros == 0) { $sql = "SELECT *\r\n FROM detalle_ticket_diario DT\r\n WHERE id_ticket_diario='" . $id_ticket . "'"; $result = $this->vConexion->ExecuteQuery($sql); } return $result; }
/** * Obtiene los datos de un sorteo * * @param string $id_sorteo * @param string $fecha * @return boolean, array */ public function GetDatosSorteo($id_sorteo) { //Preparacion del query $sql = "SELECT * FROM resultados WHERE id_sorteo = " . $id_sorteo; $result = $this->vConexion->ExecuteQuery($sql); if ($this->vConexion->GetNumberRows($result) > 0) { $roww = $this->vConexion->GetArrayInfo($result); //$respu = $roww["id_resultados"]; return $roww; } else { return ""; } }
/** * Retorna Si el sorteo esta disponible para jugar ese dia si o no * * @param integer $id_sorteo * @return boolean 1,0 */ function GetSorteobyDia($id_sorteo) { //AND id_dias_semana LIKE '%".date("w")."%' $sql = "SELECT id_loteria, id_tipo_sorteo FROM sorteos WHERE id_dias_semana LIKE '%" . date("w") . "%' AND id_sorteo=" . $id_sorteo; $result = $this->vConexion->ExecuteQuery($sql); $numero = $this->vConexion->GetNumberRows($result); if ($numero < 1) { return 0; } else { return 1; } //$id_tipo_sorteo= $row["id_tipo_sorteo"]; }
/** * Existe Ticket no impreso * * @param string $fecha_hora * @param string $taquilla * @param string $total_ticket * @param string $id_usuario * @return boolean, array */ public function ExisteTicketNoImpreso($taquilla) { //Preparacion del query $sql = "SELECT * FROM ticket_diario WHERE status='1' AND taquilla = " . $taquilla . " ORDER BY `fecha_hora` DESC LIMIT 1 "; $result = $this->vConexion->ExecuteQuery($sql); $roww = $this->vConexion->GetArrayInfo($result); if ($this->vConexion->GetNumberRows($result) == 0) { return 1; } else { return $roww['impreso']; } /*$sql = "SELECT FROM `ticket` WHERE `fecha_hora` LIKE '%".$fecha_hora."%' , `taquilla`, `total_ticket` , `id_usuario` , `premiado`, `pagado`) VALUES ('".$id_ticket."', '".$serial."', '".."', '".$taquilla."', '".$total_ticket."', '".$id_usuario."', '0', '0')"; return $this->vConexion->ExecuteQuery($sql);*/ }
/** * Obtiene todos los datos de cupo general. * * @param string $cantidad * @param string $pagina * @return boolean, array */ public function GetListado($cantidad, $pagina) { // Datos para la paginacion $inicial = ($pagina - 1) * $cantidad; //Preparacion del query $sql = "SELECT CE.*, TJ.nombre_jugada, S.nombre_sorteo, Z.nombre_zodiacal\r\n FROM cupo_especial CE\r\n INNER JOIN tipo_jugadas TJ ON CE.id_tipo_jugada=TJ.id_tipo_jugada\r\n INNER JOIN sorteos S ON CE.id_sorteo=S.id_sorteo\r\n INNER JOIN zodiacal Z ON CE.id_zodiacal=Z.id_zodiacal"; $result = $this->vConexion->ExecuteQuery($sql); // Datos para la paginacion $total_registros = $this->vConexion->GetNumberRows($result); if ($cantidad != 0) { $total_paginas = ceil($total_registros / $cantidad); } else { $total_paginas = 0; } // Nuevo SQL $sql .= " LIMIT " . $cantidad . " OFFSET " . $inicial . ""; $result = $this->vConexion->ExecuteQuery($sql); return array('pagina' => $pagina, 'total_paginas' => $total_paginas, 'total_registros' => $total_registros, 'result' => $result); }