private function checkDates()
 {
     if (empty($_POST['txtmonto']) or !ctype_digit($_POST['txtmonto'])) {
         Session::set("msg", "Asegurese de ingresar el monto como nro entero");
         return false;
     } else {
         if (empty($_POST['txtcuotas']) or !ctype_digit($_POST['txtcuotas'])) {
             Session::set("msg", "Asegurese de ingresar la cuota como nro entero");
             return false;
         } else {
             if ($_POST['txtmonto'] < (new Compra())->findById(Session::get('id'))->obtenerPagoMinimo() * $_POST['txtcuotas']) {
                 Session::set("msg", "Monto no válido.. Ingrese nuevamente el monto");
                 return false;
             } else {
                 if ($_POST['txtcuotas'] > (new Compra())->findById(Session::get('id'))->obtenerCuotasRestantes()) {
                     Session::set("msg", "Cantidad no válida.. Ingrese nuevamente la cantidad de cuotas");
                     return false;
                 } else {
                     if ((new Compra())->findById(Session::get('id'))->obtenerCuotasRestantes() == 0) {
                         Session::set("msg", "Deuda Saldada.. no puede registrar más pagos");
                         return false;
                     } else {
                         return true;
                     }
                 }
             }
         }
     }
 }
 protected function checkUser()
 {
     if (Session::get("log_in") != null and Session::get("log_in")->getRol()->getNombre() == $this->getTypeRole()) {
         return true;
     } else {
         Session::set("msg", "Debe loguearse como " . $this->getMessageRole() . " para acceder.");
         header("Location:index.php?c=main&a=index");
     }
 }
 private function checkDates()
 {
     if (empty($_POST['txtnom'])) {
         Session::set("msg", "Ingrese los datos obligatorios (*) para continuar.");
         return false;
     } else {
         return true;
     }
 }
Beispiel #4
0
 public function update($object)
 {
     $aux = $this->findById($object->getId());
     if (!$object->equals($aux)) {
         if ($this->check($object)) {
             Session::set('msg', $this->getCheckMessage());
             return null;
         }
     }
     return $this->executeQuery($this->getUpdateQuery(), $this->getUpdateParameter($object));
 }
 public function cons3()
 {
     if ($this->checkUser()) {
         $compras = array();
         if (isset($_POST["dtfecini"]) and isset($_POST["dtfecfin"])) {
             if ($_POST["dtfecini"] > $_POST["dtfecfin"]) {
                 Session::set('msg', "La fecha de inicio debe ser menor a la fecha de cierre");
             } else {
                 $compras = $this->getPaginator()->paginar((new Consulta())->cons3($_POST["dtfecini"], $_POST["dtfecfin"], Session::get('log_in')->getId()));
             }
         }
         $this->redirect(array('cons3.php'), array("compras" => $compras, "paginador" => $this->getPaginator()->getPages()));
     }
 }
                                    <li><a href="index.php?c=usuarios&a=logout">Cerrar Sesión</a></li>                                   
                                <?php 
} else {
    ?>
                                    <li><a href="index.php?c=usuarios&a=login">Iniciar Sesión</a></li>
                                    <li><a href="index.php?c=usuarios&a=add">Registrarse</a></li>                                    
                            <?php 
}
?>
    
                        </ul>
                    </nav>                    
                </header>
                <section>
                    <?php 
if (\App\Session::get('msg') != null) {
    echo \App\Session::get('msg') . "<br /><br />";
    \App\Session::set('msg', "");
}
echo $content;
?>
                </section>
                <footer>
                    Copyright &copy; <?php 
echo date("Y");
?>
 -- Reservados todos los derechos
                </footer>
            </div>
    </body>
</html>
 private function checkDates()
 {
     if (empty($_POST['txtmat']) or empty($_POST['txtcant']) or empty($_POST['txtmod']) or empty($_POST['txtprecio'])) {
         Session::set("msg", "Ingrese los datos obligatorios (*) para continuar.");
         return false;
     } else {
         if (!ctype_digit($_POST['txtcant']) or !ctype_digit($_POST['txtprecio'])) {
             Session::set("msg", "Asegurese de que la cantidad y/o precio sean nros entero");
             return false;
         } else {
             return true;
         }
     }
 }
 private function checkDates()
 {
     if (empty($_POST['txttipcom']) or empty($_POST['txtcli']) or empty($_POST['txtveh']) or empty($_POST['dtfecha']) or empty($_POST['txtcant'])) {
         Session::set("msg", "Ingrese los datos obligatorios (*) para continuar.");
         return false;
     } else {
         if (!ctype_digit($_POST['txtcuotas']) or !ctype_digit($_POST['txtcant'])) {
             Session::set("msg", "Asegurese de que la cantidad y/o las cuotas sean nros enteros");
             return false;
         } else {
             if ((new Vehiculo())->findById($_POST['txtveh'])->getCant() < $_POST['txtcant']) {
                 Session::set("msg", "El vehículo no cuenta con la cantidad ingresada");
                 return false;
             } else {
                 return true;
             }
         }
     }
 }
 public function c3()
 {
     if ($this->checkUser()) {
         $compras = array();
         if (isset($_GET["d1"]) and isset($_GET["d2"])) {
             if ($_GET["d1"] > $_GET["d2"]) {
                 Session::set('msg', "La fecha de inicio debe ser menor a la fecha de cierre");
             } else {
                 $compras = (new Consulta())->cons3($_GET["d1"], $_GET["d2"], Session::get('log_in')->getId());
                 $this->getPdf()->AddPage();
                 $this->getPdf()->AliasNbPages();
                 $this->getPdf()->SetFont('Arial', 'B', 16);
                 $this->getPdf()->Cell(40, 10, 'Mostrar Compras por fechas');
                 $this->getPdf()->SetFont('Arial', 'B', 12);
                 $this->getPdf()->Ln(20);
                 $this->getPdf()->Cell(20, 5, "Cliente: " . Session::get('log_in')->getApellido() . " " . Session::get('log_in')->getNombre());
                 $this->getPdf()->Ln(10);
                 $this->getPdf()->Cell(20, 5, "Compra", 'B', null, "C");
                 $this->getPdf()->Cell(20, 5, "Fecha", 'B', null, "C");
                 $this->getPdf()->Cell(30, 5, "Cuotas", 'B', null, "C");
                 $this->getPdf()->Ln(8);
                 foreach ($compras as $compra) {
                     $this->getPdf()->Cell(20, 5, $compra->getId(), null, null, "C");
                     $this->getPdf()->Cell(20, 5, $compra->getFecha(), null, null, "C");
                     $this->getPdf()->Cell(20, 5, count($compra->getPagos()) . "/" . $compra->getCuotas(), null, null, "C");
                     $this->getPdf()->Ln(5);
                 }
                 $this->getPdf()->SetFont('Arial', 'BI', 12);
                 // Número de página
                 $this->getPdf()->SetY(265);
                 $this->getPdf()->Cell(0, 10, utf8_decode('Página: ') . $this->getPdf()->PageNo(), 'T', 0, 'C');
                 $this->getPdf()->Output();
             }
         }
     }
 }