function setEventosTarifas() { // print_r($_POST); $eventos = new eventosModel(); $cLibreria = new cLibreria(); $id_evento = $_POST['id_evento']; $tarifa = $_POST['tarifa']; $tarifa_tipo_afiliacion = $_POST['tarifa_tipo_afiliacion']; $tarifa_tipo_estatus = $_POST['tarifa_tipo_participante']; $fecha_vencimiento = $cLibreria->getFechaYMD($_POST['fecha_vencimiento']); // $resultFechas=$eventos->getFechasTarifa($_POST['id_evento'],$fecha_vencimiento) $resultFechas = $eventos->getFechasTarifa($id_evento, $fecha_vencimiento, $tarifa_tipo_afiliacion, $tarifa_tipo_estatus); if (count($resultFechas) == 0) { $result = $eventos->setEventosTarifas($id_evento, $tarifa_tipo_afiliacion, $tarifa_tipo_estatus, $tarifa, $fecha_vencimiento); if ($result) { $respuesta = array('estatus' => 200, 'msg' => "DATOS GUARDADOS CORRECTAMENTE."); } else { $respuesta = array('estatus' => 500, 'msg' => 'ERROR AL GUARDAR DATOS.'); } } else { $respuesta = array('estatus' => 500, 'msg' => 'ERROR AL GUARDAR DATOS <b>HAY FECHAS POSTERIORES</b>.'); } echo json_encode($respuesta); }
<?php session_start(); if (empty($_SESSION["nombre"])) { header("Location: ../"); } include_once '../controller/cSistema.php'; $cSistema = new cSistema(); include_once '../controller/cLibreria.php'; $cLibreria = new cLibreria(); $txtFecha_inicio = $cLibreria->getMenosDia(30); $txtFecha_fin = $cLibreria->getFechaActual(); ?> <!DOCTYPE html> <!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]--> <!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]--> <!--[if !IE]><!--> <html lang="en" class="no-js"> <!--<![endif]--> <!-- BEGIN HEAD --> <head> <meta charset="utf-8"/> <title>Temposati</title> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="width=device-width, initial-scale=1.0" name="viewport"/> <meta content="" name="description"/> <meta content="" name="author"/> <!-- BEGIN PACE PLUGIN FILES --> <script src="../assets/global/plugins/pace/pace.min.js" type="text/javascript"></script> <!-- <link href="../assets/global/plugins/pace/themes/pace-theme-flash.css" rel="stylesheet" type="text/css"/> --> <link href="../assets/global/plugins/pace/themes/pace-theme-barber-shop.css" rel="stylesheet" type="text/css"/>
/** * Función que regresa la relación que existe en un participante con los eventos anteriores a partir del día actual menos 3 y todas las fechas anteriores * @param [type] $id_participante [description] * @return [type] [description] */ function getEventosParticipantes($id_participante) { $cLibreria = new cLibreria(); $fecha_fin = $cLibreria->getFechaActual(); $fecha_fin = $cLibreria->getLessDay(3); $sql = "select e.nombre_evento,e.tipo_evento,e.ciudad,e.fecha_evento,e.fecha_evento_fin,e.sitio_web,e.constancia,pv.material from participantes_eventos as pv, participantes as p, eventos as e where pv.id_participante=p.id_participante and pv.id_evento=e.id_evento and pv.id_participante={$id_participante} and e.fecha_evento < '{$fecha_fin}';"; // echo $sql; $result = $this->find($sql); return $result; }
function getReporteAccesos() { $cLibreria = new cLibreria(); $fechaInicio = $cLibreria->getFechaYMD($_POST['txtFechaInicio']); $fechaFin = $cLibreria->getFechaYMD($_POST['txtFechaFin']); $usuariosModel = new usuariosModel(); $tipoReporte = $_POST['tipoReporte']; switch ($tipoReporte) { case 1: //accesos al sistema $datos = $usuariosModel->getRegistroAccesos($fechaInicio, $fechaFin); break; case 2: //nuevos registros al sistema $datos = $usuariosModel->getRegistrosNuevos($fechaInicio, $fechaFin); break; default: echo "<h1>Error en tipo de reporte :P</h1>"; break; } ?> <table class="table table-striped table-bordered table-hover table-responsive" id="tabla"> <!-- <caption> --> <!-- <h1>Reporte de accesos al tablero cieft(Participantes)</h1> --> <!-- </caption> --> <thead> <tr> <th>NOMBRE</th> <th>CORREO</th> <th>FECHA</th> </tr> </thead> <tbody> <?php foreach ($datos as $key => $rowReportes) { echo "<tr>\n\t\t\t\t\t\t<td>" . $rowReportes['nombre'] . "</td>\n\t\t\t\t\t\t<td>" . $rowReportes['correo'] . "</td>\n\t\t\t\t\t\t<td>" . $rowReportes['fecha'] . "</td>\n\t\t\t\t\t\t</tr>"; } ?> </tbody> </table> <?php }
<?php if ($_POST) { include_once "../controller/cFallidos.php"; include_once "../controller/cLibreria.php"; $cLibreria = new cLibreria(); $cFallidos = new cFallidos(); switch ($_POST['opcion']) { case 'get': $datos = $cFallidos->getFallido($_POST['tipo'], $cLibreria->getFechaYMD($_POST['fecha_inicio']), $cLibreria->getFechaYMD($_POST['fecha_fin'])); ?> <table class="table table-hover table-bordered table-striped" id="tabla" border="1" cellpadding="10" cellspacing="0"> <thead> <tr> <th>Fecha de generación</th> <th>Tipo</th> <th>Descripción</th> <th>Vendedor</th> <th>Sucursal</th> </tr> </thead> <tbody> <?php while ($row = $datos->fetch_array(MYSQLI_ASSOC)) { if ($row['tipo'] == 1) { $msg = "<label class='bold'>PEDIDO FALLIDO</label>"; } else { $msg = "<label class='bold'>ENVIO DE CORREO FALLIDO</label>"; } $vendedor = $row['paterno'] . " " . $row['materno'] . " " . $row['nombre']; echo "<tr>";
public function getFechasTarifa($id_evento, $id_participante, $tipo_afiliacion) { $eventosModel = new eventosModel(); $participantesModel = new participantesModel(); $datosParticipante = $participantesModel->getDatosParticipante($id_participante); foreach ($datosParticipante as $key => $rowParticipante) { $tipo_estatus = $rowParticipante['estatus']; } $descuento = $eventosModel->getDescuentos($id_evento, $id_participante); //obtengo los descuentos que tenga un participante. if (count($descuento) != 0) { //encontro un descuento. foreach ($descuento as $key => $row) { // $afiliado=$row['costo_evento']; $costo = $row['costo_evento']; } } else { //comparamos que el afiliado no tenga un descuento. $cLibreria = new cLibreria(); $fecha_actual = $cLibreria->getDateNow(); $tarifas = $eventosModel->getFechasTarifa($id_evento, $fecha_actual, $tipo_afiliacion, $tipo_estatus); if (count($tarifas) == 0) { //no cuenta con tarifas para el evento $result = $eventosModel->getEvento($id_evento); foreach ($result as $key => $row) { $costo = $row['costo_evento']; } } else { foreach ($tarifas as $key => $rowTarifas) { if ($cLibreria->compararFecha($fecha_actual, $rowTarifas['fecha_vencimiento'], 1)) { //comparamos si la fecha actual es menor a la fecha de vencimiento $costo = $rowTarifas['tarifa']; break; } } } } //fin else // return array('afiliado' => $afiliado,'noafiliado'=>$noafiliado); return $costo; }
<?php if ($_POST) { include_once "../controller/cVentas.php"; include_once '../controller/cLibreria.php'; $cVentas = new cVentas(); $cLibreria = new cLibreria(); switch ($_POST['opcion']) { case 'setVentas': try { $id_ventas = $cVentas->setVentas($_POST['id_sucursal'], $_POST['id_usuario'], $_POST['comision_total']); //guardo la venta $cVentas->setVentasProductos($id_ventas, $_POST['id_producto'], $_POST['comision_total'], $_POST['num_serie']); //guardo la relacion de la venta con los productos $cVentas->notificacion($_POST['id_usuario'], $id_ventas); //envio un mensaje de notificacion $respuesta = array('resultado' => 1); echo json_encode($respuesta); } catch (Exception $e) { include_once '../controller/cFallidos.php'; include_once '../controller/cProductos.php'; $cFallidos = new cFallidos(); $cProductos = new cProductos(); $datos = $cProductos->getProducto($_POST['id_producto']); while ($row = $datos->fetch_array(MYSQLI_ASSOC)) { $producto = $row['clave'] . "/" . $row['descripcion']; } $descripcion = "<h4>EL REGISTRO DE LA VENTA NO SE REALIZO CON EXITO.</h4>EL PRODUCTO A REGISTRAR ES: <b>" . strtoupper($producto . "/" . $_POST['num_serie']) . "</b> CON UNA COMISIÓN TOTAL DE: <b>" . $_POST['comision_total'] . "</b>"; $cFallidos->setFallido($_POST['id_usuario'], $_POST['id_sucursal'], $descripcion, 1); $respuesta = array('error' => $e->getMessage()); echo json_encode($respuesta);
<head> <meta charset="UTF-8"> <title>Temposatis</title> <!-- <link href="../assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/> --> <style> .text-center{text-align: center; } .text-left{text-align: left; } .text-right{text-align: right; } </style> </head> <body> <div class="datos"> <?php include_once "../controller/cVentas.php"; include_once '../controller/cLibreria.php'; $cLibreria = new cLibreria(); $cVentas = new cVentas(); $datos = $cVentas->getVentasExistentes($_GET['id_cliente'], $_GET['vendedor'], $_GET['sucursal'], $_GET['fecha_inicio'], $_GET['fecha_fin'], $_GET['estatus']); ?> <table class="table table-hover table-bordered table-striped" id="tabla" border="1" cellpadding="10" cellspacing="0"> <thead> <tr> <th> Folio</th> <th> Sucursal </th> <th> Vendedor </th> <th> Fecha </th> <th> Referencia/serie</th> <th> Incentivos por venta(comisiones) </th> <th> Estatus</th> <th> Observacion</th> </tr>
/** * Regresa el costo que debe pagar un participante al inscribirse a un evento * @param [type] $id_evento [description] * @param [type] $id_participante [description] * @return [type] [description] */ function getCostoEvento($id_evento, $id_participante) { $sql = "select p.id_tipo_afiliacion as tipo_afiliacion,p.estatus as tipo_estatus from participantes as p where p.id_participante={$id_participante}"; $datosParticipante = $this->find($sql); foreach ($datosParticipante as $key => $rowParticipante) { $tipo_estatus = $rowParticipante['tipo_estatus']; $tipo_afiliacion = $rowParticipante['tipo_afiliacion']; } $descuento = $this->getDescuentos($id_evento, $id_participante); //obtengo los descuentos que tenga un participante. if (count($descuento) != 0) { //encontro un descuento. foreach ($descuento as $key => $row) { $costo_evento = $row['costo_evento']; } } else { $cLibreria = new cLibreria(); $fecha_actual = $cLibreria->getDateNow(); $tarifas = $this->getFechasTarifa($id_evento, $fecha_actual, $tipo_afiliacion, $tipo_estatus); if (count($tarifas) == 0) { //no cuenta con tarifas para el evento $sql = "select * from eventos as e where e.id_evento={$id_evento};"; $result = $this->find($sql); foreach ($result as $key => $row) { $costo_evento = $row['costo_evento']; } } else { foreach ($tarifas as $key => $rowTarifas) { if ($cLibreria->compararFecha($fecha_actual, $rowTarifas['fecha_vencimiento'], 1)) { //comparamos si la fecha actual es menor a la fecha de vencimiento $costo_evento = $rowTarifas['tarifa']; break; } } } } return $costo_evento; }