Exemplo n.º 1
0
function login()
{
    $msg = new messages();
    $fun = new funciones();
    if (!$fun->isAjax()) {
        header("Location: login.php");
    }
    $con = new con();
    $con->connect();
    $response = new StdClass();
    $usu = $_POST['usr'];
    $pass = $_POST['psw'];
    $pass = sha1(md5($pass));
    /*Consulta a la Bd*/
    $selectSQL = "SELECT * FROM `tbl_users` WHERE `us_usuario` = '{$usu}' AND `us_clave` = '{$pass}' AND us_estado = 1";
    $row_cons = mysql_query($selectSQL);
    $existe = mysql_fetch_assoc($row_cons);
    /*Termina Consulta*/
    /*Existe*/
    //$existe = 1;
    if ($existe) {
        $res = true;
        $mes = "panel.html";
        $_SESSION["ses_id"] = $existe['us_id'];
        //$menu = 1;
    } else {
        $res = false;
        $mes = $msg->get_msg("e002");
    }
    $response->res = $res;
    $response->mes = $mes;
    echo json_encode($response);
    $con->disconnect();
}
Exemplo n.º 2
0
 function get_options_fincas()
 {
     $con = new con();
     $msg = new messages();
     $rt = new route();
     $con->connect();
     //consultamos fincas desde la matriz ica
     if (isset($_SESSION["ses_id"])) {
         $qry = 'SELECT DISTINCT codfinca, municipio, depto FROM tbl_matriz_ica ORDER BY codfinca ASC';
         $res = mysql_query($qry);
         $item = " ";
         $script = "<script>\$(document).ready(function(){";
         while ($row_res = mysql_fetch_assoc($res)) {
             $item .= '
           <option value="' . $row_res["codfinca"] . '">' . $row_res["codfinca"] . ' (' . $row_res["municipio"] . ' - ' . $row_res["depto"] . ')</option>
     ';
             $script .= '';
         }
         $script .= '});</script>';
     } else {
         $rt->routing($rt->path("login"));
     }
     $html = '
     <select class="form-control valued" id="cod">
       ' . $item . '
     </select>
 ';
     $con->disconnect();
     return $script . $html;
 }
Exemplo n.º 3
0
 function get_fincas_list()
 {
     $con = new con();
     $msg = new messages();
     $rt = new route();
     $con->connect();
     //consultamos fincas desde la tabla de fincas
     if (isset($_SESSION["ses_id"])) {
         $qry = 'SELECT * FROM tbl_fincas WHERE fi_estado=1 ORDER BY fi_id ASC';
         $res = mysql_query($qry);
         $item = " ";
         $script = "<script>\$(document).ready(function(){";
         while ($row_res = mysql_fetch_assoc($res)) {
             $item .= '
           <option value="' . $row_res["fi_id"] . '">' . $row_res["fi_codigo"] . '</option>
     ';
             $script .= '';
         }
         $script .= '});</script>';
     } else {
         $rt->routing($rt->path("login"));
     }
     $html = '
     <select class="form-control valued" id="cod">
       <option>Seleccione</option>
       ' . $item . '
     </select>
 ';
     $con->disconnect();
     return $script . $html;
 }
Exemplo n.º 4
0
 function asignar_ica()
 {
     $con = new con();
     $msg = new messages();
     $fun = new funciones();
     $con->connect();
     //Fecha
     date_default_timezone_set("America/Bogota");
     $fecha = date('Y-m-d G:i:s');
     $filename = "I_" . date('YmdGis');
     $filename .= ".html";
     $content = "";
     $hoy = date('Y-m-d');
     $content .= "<h1>Informe, asignación de código ICA</h1>";
     $content .= "<br>Fecha " . $fecha . "<br>";
     $content .= "<br>Archivo generado: " . $filename . "<br>";
     //traemos listado de despachos aprobados
     $qry_des = 'SELECT * FROM tbl_despachos WHERE de_estado=2 AND de_ica = "" ORDER BY de_id';
     $arr_des = $fun->get_array($qry_des);
     $can_des = count($arr_des);
     $content .= "cantidad de despachos aprobados: " . $can_des;
     //$fun->print_array($arr_des);
     for ($i = 0; $i < $can_des; $i++) {
         $content .= "<pre>";
         $content .= "<br> Despacho #" . $i;
         // traemos el último ica disponible del paquete autorizado
         $qry_rem = 'SELECT * FROM tbl_remisiones_fisicas WHERE rf_estado = 99 LIMIT 1;';
         $arr_rem = $fun->get_array($qry_rem);
         $content .= "<br>  ->cantidad de consecutivos usados: " . $arr_rem[0]['rf_cant_usados'];
         $restantes = $arr_rem[0]['rf_dig_fin'] - $arr_rem[0]['rf_dig_ini'] - $arr_rem[0]['rf_cant_usados'];
         if ($restantes > 0) {
             $content .= "<br>  ->consecutivos restantes: " . $restantes;
             $cons = $arr_rem[0]['rf_dig_fin'] - $restantes;
             $content .= "<br>  ->consecutivo a usar: " . $cons;
             // lo asignamos al despacho actual y guardamos
             $content .= "<br>  ->despacho actual: " . $arr_des[$i]["de_id"];
             $tbl_de = "despachos";
             $cam_de = "de_ica = '" . $cons . "'";
             $whe_de = "de_id = " . $arr_des[$i]["de_id"];
             $res_de = $fun->actualizar($tbl_de, $cam_de, $whe_de);
             $tbl_rf = "remisiones_fisicas";
             $cam_rf = "rf_cant_usados = '" . ($arr_rem[0]['rf_cant_usados'] + 1) . "'";
             $whe_rf = "rf_id = " . $arr_rem[0]['rf_id'];
             $res_rf = $fun->actualizar($tbl_rf, $cam_rf, $whe_rf);
             if ($res_de == true && $res_rf == true) {
                 $r = "sin problemas";
             } else {
                 $r = "con problemas, comuniquese con soporte";
             }
             $content .= "<br>Actualización completada " . $r;
             $content .= "</pre>";
         }
     }
     $content .= "<hr>";
     // generamos informe
     $fun->create_file($content, $filename);
     //echo $content;
     $con->disconnect();
 }
Exemplo n.º 5
0
function get_data($opc)
{
    $fun = new funciones();
    $msg = new messages();
    $response = new StdClass();
    $con = new con();
    $con->connect();
    switch ($opc) {
        case 1:
            $item = "";
            $arr = array();
            $year = date("Y");
            for ($i = 1; $i <= 12; $i++) {
                $qry_gr = "SELECT COUNT(de_id) AS conteo FROM `tbl_despachos` WHERE de_timestamp BETWEEN '" . $year . "-" . $i . "-01 00:00:00' AND '" . $year . "-" . $i . "-31 23:59:59'";
                $res_gr = mysql_query($qry_gr);
                while ($row_gr = mysql_fetch_assoc($res_gr)) {
                    $arr[] = array('month' => $year . "-" . $i, 'value' => $row_gr['conteo']);
                }
            }
            break;
        case 2:
            $item = "";
            $arr = array();
            $qry_gr = "SELECT COUNT(fi_id) AS conteo FROM `tbl_fincas` WHERE fi_estado=1";
            $res_gr = mysql_query($qry_gr);
            while ($row_gr = mysql_fetch_assoc($res_gr)) {
                $arr[] = array('label' => "Fincas Autorizadas", 'value' => $row_gr['conteo']);
            }
            $qry_gr = "SELECT COUNT(DISTINCT(codfinca)) AS conteo FROM `tbl_matriz_ica`";
            $res_gr = mysql_query($qry_gr);
            while ($row_gr = mysql_fetch_assoc($res_gr)) {
                $arr[] = array('label' => "Fincas Existentes", 'value' => $row_gr['conteo']);
            }
            break;
        case 3:
            $item = "";
            $arr = array();
            $year = date("Y");
            $qry_gr = "SELECT * FROM tbl_control_inventarios";
            $res_gr = mysql_query($qry_gr);
            while ($row_gr = mysql_fetch_assoc($res_gr)) {
                $arr[] = array('id' => $row_gr['ci_id'], 'vol_i' => $row_gr['ci_vol_ini'], 'vol_a' => $row_gr['ci_vol_act']);
            }
            break;
    }
    $res = true;
    $mes = $arr;
    $response->res = $res;
    $response->mes = $mes;
    echo json_encode($response);
    $con->disconnect();
}
Exemplo n.º 6
0
 function get_reports()
 {
     $con = new con();
     $msg = new messages();
     $rt = new route();
     $con->connect();
     //consultamos fincas
     if (isset($_SESSION["ses_id"])) {
         $qry = 'SELECT * FROM tbl_reporte_consecutivo ORDER BY rp_consecutivo DESC ';
         $res = mysql_query($qry);
         $item = " ";
         $script = "<script>\$(document).ready(function(){";
         while ($row_res = mysql_fetch_assoc($res)) {
             $item .= '
           <tr>
             <td>' . $row_res["rp_timestamp"] . '</td>
             <td>' . $row_res["rp_consecutivo"] . '</td>
             <td>' . $row_res["rp_causa"] . '</td>
           </tr>
     ';
             $script .= '';
         }
         $script .= '});</script>';
     } else {
         $rt->routing($rt->path("login"));
     }
     $html = '
       <table class="table table-striped table-hover ">
         <thead>
           <tr>
             <th>Fecha reporte</th>
             <th>Consecutivo</th>
             <th>Causa</th>
           </tr>
         </thead>
         <tbody>
           ' . $item . '
         </tbody>
       </table> 
 ';
     $con->disconnect();
     return $script . $html;
 }
Exemplo n.º 7
0
function change_pack()
{
    $fun = new funciones();
    $msg = new messages();
    $response = new StdClass();
    /*recibimos variables*/
    $act = $_POST["a"];
    $id = $_POST["id"];
    if ($act == "" || $id == "") {
        $res = false;
        $mes = $msg->get_msg("e005");
    } else {
        $con = new con();
        $con->connect();
        if ($act == 1) {
            //activar, cambiar a 99
            if ($fun->borrar("remisiones_fisicas", "rf_id", $id)) {
                $res = true;
                $mes = $msg->get_msg("e004");
            } else {
                $res = false;
                $mes = $msg->get_msg("e003-1", "Activando remision.");
            }
        } else {
            //desactivar, cambiar a 1
            if ($fun->activar("remisiones_fisicas", "rf_id", $id)) {
                $res = true;
                $mes = $msg->get_msg("e004");
            } else {
                $res = false;
                $mes = $msg->get_msg("e003-1", "Desactivando remision.");
            }
        }
    }
    $response->res = $res;
    $response->mes = $mes;
    echo json_encode($response);
    $con->disconnect();
}
Exemplo n.º 8
0
function edt_usuario()
{
    $fun = new funciones();
    $msg = new messages();
    $response = new StdClass();
    /*recibimos variables*/
    $id = mysql_real_escape_string($_POST['id']);
    $nomb = mysql_real_escape_string($_POST['nomb']);
    $finc = mysql_real_escape_string($_POST['finc']);
    /* Encriptamos clave */
    //$pass = sha1(md5($pass));
    if ($nomb == "" || $finc == "") {
        $res = false;
        $mes = $msg->get_msg("e005");
    } else {
        $con = new con();
        $con->connect();
        /* verificamos que exista la cuenta para evitar redundancias*/
        $res_us = $fun->existe("supervisores", "su_id", $id);
        if ($res_us) {
            /* actualizamos datos del supervisor */
            $cambios = 'su_nombre = "' . $nomb . '", su_fi_id = ' . $finc;
            $where = "su_id = " . $id;
            $qry = $fun->actualizar("supervisores", $cambios, $where);
            $resp = mysql_query($qry);
            $res = true;
            $mes = $msg->get_msg("e004");
        } else {
            $res = false;
            $mes = $msg->get_msg("e029");
        }
    }
    $response->res = $res;
    $response->mes = $mes;
    echo json_encode($response);
    $con->disconnect();
}
Exemplo n.º 9
0
function MASTER_RUN_IMC_TIMES()
{
    $link = new con();
    $i = 0;
    $query = "TRUNCATE table times";
    $result = mysqli_query($link->getConnection(), $query);
    $query2 = "SELECT venue, id FROM films";
    $result2 = mysqli_query($link->getConnection(), $query2);
    while ($row = mysqli_fetch_array($result2)) {
        $i += 1;
        $run[$i] = new MysqlTimes(strtoupper($row['venue']), $row['id']);
        $run[$i]->printTime();
        if (mysqli_error($link->getConnection())) {
            echo "You have an error";
            print_r(mysqli_error($link->getConnection()));
        }
    }
    mysqli_close($link->getConnection());
}
Exemplo n.º 10
0
<?php

session_start();
require "../php/funciones.php";
$fun = new funciones();
if (!$fun->isAjax()) {
    header("Location: ../pages/index.html");
}
$con = new con();
$con->connect();
$response = new StdClass();
//echo "<br> ->Cambio: ".$cambio;
//echo "<br> ->Lunes: ".$lunes."<br>";
/* Definimos el semestre */
$s_ini = "2015-01-02 00:00:00";
$s_fin = "2015-07-01 23:59:59";
/*Cuenta para la todas las solicitudes sin completar*/
$q1 = "SELECT * FROM tbl_reservas WHERE re_tipo_sol=1 AND re_log_fecha BETWEEN '" . $s_ini . "' AND '" . $s_fin . "';";
$r1 = mysql_query($q1, $con->connect());
$c1 = mysql_num_rows($r1);
/*Cuenta para la todas las solicitudes completadas*/
$q2 = "SELECT * FROM tbl_reservas WHERE re_tipo_sol=2 AND re_log_fecha BETWEEN '" . $s_ini . "' AND '" . $s_fin . "';";
$r2 = mysql_query($q2, $con->connect());
$c2 = mysql_num_rows($r2);
$datos[] = array("label" => "Sala de Computo", "value" => $c1);
$datos[] = array("label" => "Salon de Clases", "value" => $c2);
$response->data = $datos;
$response->total = $c1 + $c2;
echo json_encode($response);
Exemplo n.º 11
0
function add_vehiculo()
{
    $fun = new funciones();
    $msg = new messages();
    $response = new StdClass();
    $con = new con();
    $con->connect();
    /*recibimos variables*/
    $tipo = mysql_real_escape_string($_POST['tipo']);
    $marca = mysql_real_escape_string($_POST['marca']);
    $modelo = mysql_real_escape_string($_POST['modelo']);
    $color = mysql_real_escape_string($_POST['color']);
    $linea = mysql_real_escape_string($_POST['linea']);
    $placa = mysql_real_escape_string($_POST['placa']);
    $nro_motor = mysql_real_escape_string($_POST['nro_motor']);
    $nro_chasis = mysql_real_escape_string($_POST['nro_chasis']);
    $cod_prop = mysql_real_escape_string($_POST['cod_prop']);
    $empresa = mysql_real_escape_string($_POST['emp']);
    $emp_soat = mysql_real_escape_string($_POST['emp_soat']);
    $num_soat = mysql_real_escape_string($_POST['num_soat']);
    $ven_soat = mysql_real_escape_string($_POST['ven_soat']);
    $emp_rt = mysql_real_escape_string($_POST['emp_rt']);
    $num_rt = mysql_real_escape_string($_POST['num_rt']);
    $ven_rt = mysql_real_escape_string($_POST['ven_rt']);
    $tipo_rem = mysql_real_escape_string($_POST['tipo_rem']);
    $color_rem = mysql_real_escape_string($_POST['color_rem']);
    $marca_rem = mysql_real_escape_string($_POST['marca_rem']);
    $capacidad = str_replace(",", ".", $_POST['capacidad']);
    $tipo_llanta_dir = mysql_real_escape_string($_POST['tipo_llanta_dir']);
    $tipo_llanta_tra = mysql_real_escape_string($_POST['tipo_llanta_tra']);
    $tarjeta_operacion = mysql_real_escape_string($_POST['t_oper']);
    /* Encriptamos clave */
    //$pass = sha1(md5($pass));
    if ($placa == "" || $cod_prop == "" || $capacidad == "") {
        $res = false;
        $mes = $msg->get_msg("e005");
    } else {
        /* verificamos que exista la cuenta para evitar redundancias*/
        $res_us = $fun->existe("vehiculos", "ve_placa", $placa);
        if (!$res_us) {
            /* ingresamos datos del vehiculo */
            $qry = "INSERT INTO tbl_vehiculos (ve_empresa, ve_pe_id, ve_tipo_vehiculo, ve_modelo, ve_marca, ve_color, ve_nro_motor, ve_nro_chasis, ve_soat, ve_soat_nro,ve_soat_vence, ve_tecno, ve_tecno_vence, ve_placa, ve_remolque_tipo, ve_remolque_color, ve_remolque_marca, ve_capacidad_m3, ve_tipo_llanta_traccion, ve_tipo_llanta_direccional, ve_linea, ve_t_op, ve_created, ve_estado) \n\t\t\t\t\t\t\t\t\t\t  VALUES ('" . $empresa . "', " . $cod_prop . ", '" . $tipo . "', '" . $modelo . "', '" . $marca . "', '" . $color . "', '" . $nro_motor . "', '" . $nro_chasis . "', '" . $emp_soat . "', '" . $num_soat . "', '" . $ven_soat . "', '" . $emp_rt . "', '" . $ven_rt . "', '" . $placa . "', '" . $tipo_rem . "', '" . $color_rem . "','" . $marca_rem . "', '" . $capacidad . "', '" . $tipo_llanta_tra . "', '" . $tipo_llanta_dir . "', '" . $linea . "', '" . $tarjeta_operacion . "', '" . $_SESSION["ses_id"] . "',1);";
            //echo $qry;
            $resp = mysql_query($qry);
            if (!$resp) {
                $res = false;
                $mes = $msg->get_msg("e003");
            } else {
                $res = true;
                $mes = $msg->get_msg("e004");
            }
        } else {
            $res = false;
            $mes = $msg->get_msg("e023");
        }
    }
    $response->res = $res;
    $response->mes = $mes;
    echo json_encode($response);
    $con->disconnect();
}
Exemplo n.º 12
0
 function get_total_students_x_dh($sala, $mes, $dia, $h_ini, $h_fin)
 {
     include "../semestre.php";
     $con = new con();
     $con->connect();
     #recorremos semestre
     $arr_dias_semana = array("Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado", "Domingo");
     #acum
     $acum = 0;
     $day = split(" ", $semestre_ini);
     $sem_i = $day[0];
     $sem_f = $semestre_fin;
     $i = 0;
     for ($i = $sem_i; $i <= $sem_f; $i = date("Y-m-d", strtotime($i . "+ 1 days"))) {
         $dia_semana = $arr_dias_semana[date('N', strtotime($i)) - 1];
         $mes_fecha = date('n', strtotime($i));
         if ($mes_fecha == $mes) {
             if ($dia_semana === $dia) {
                 $query = "SELECT COUNT(fe_id) AS conteo FROM tbl_flujo_estudiantes WHERE fe_sala=" . $sala . " AND fe_log_fecha BETWEEN '" . $i . " " . $h_ini . "' AND '" . $i . " " . $h_fin . "';";
                 //echo $query."<br>";
                 $rq = mysql_query($query);
                 $fq = mysql_fetch_array($rq);
                 //echo "<br> -> fecha[".$i."] >> acum=".$acum." // result=".$fq[0];
                 $acum += $fq[0];
             }
         }
     }
     //echo "<br>Total acum: ".$acum;
     return $acum;
 }
Exemplo n.º 13
0
<?php

require "require_connect.php";
$con = new con();
$con->local_connect();
$con->variable_path_set();
$mc = new myclass();
$con->plook = $con->plook . $_GET['id'] . '.jpg';
// echo "look = ".$con->plook.'<br>';
// echo " id = ".$_GET['id'].'<br>';
$_SESSION['plno'] = $_GET['id'];
?>
	

<!DOCTYPE html>
<html>
	<head>
		<title>Look Details</title>
		<!-- new fonts -->
			<link rel="stylesheet" type="text/css" href="fs_folders/style/fonts/miso_bold_macroman/stylesheet.css">
		    <link rel="stylesheet" type="text/css" href="fs_folders/style/fonts/miso_light_macroman/stylesheet.css">
			<link rel="stylesheet" type="text/css" href="fs_folders/style/fonts/miso_regular_macroman/stylesheet.css">
		<!-- end fonts -->
		<!-- new home -->
			
			<link rel="stylesheet" type="text/css" href="fs_folders/index_home/home_css/home.css">
		<!-- end home -->
		<!-- new plugin -->
			<script type="text/javascript" src='fs_folders/js/jquery-1.7.1.min.js'> </script>
			<script type="text/javascript" src='fs_folders/js/function_js.js'></script>
			
Exemplo n.º 14
0
function upd_vehiculo()
{
    $fun = new funciones();
    $msg = new messages();
    $response = new StdClass();
    /*recibimos variables*/
    $id = $_POST['id'];
    $vh = $_POST['vh'];
    $con = new con();
    $con->connect();
    $t = "personas";
    $c = "pe_ve_id=" . $vh;
    $w = "pe_id=" . $id;
    $resp = $fun->actualizar($t, $c, $w);
    if ($resp) {
        $res = true;
        $mes = $msg->get_msg("e004");
    } else {
        $res = false;
        $mes = $msg->get_msg("e036");
    }
    $con->disconnect();
    $response->res = $res;
    $response->mes = $mes;
    echo json_encode($response);
}
Exemplo n.º 15
0
function del_persona()
{
    $fun = new funciones();
    $msg = new messages();
    $response = new StdClass();
    /*recibimos variables*/
    $id = $_POST["id"];
    $con = new con();
    $con->connect();
    /* ingresamos datos de la finca */
    $tbl = "personas";
    $cambios = "pe_estado=99";
    $where = "pe_id=" . $id;
    $r = $fun->actualizar($tbl, $cambios, $where);
    if ($r) {
        $res = true;
        $mes = $msg->get_msg("e004");
    } else {
        $res = false;
        $mes = $msg->get_msg("e035");
    }
    $response->res = $res;
    $response->mes = $mes;
    echo json_encode($response);
    $con->disconnect();
}
Exemplo n.º 16
0
function supervisores()
{
    //cargar lotes segun la finca que se seleccione, lotes de la tabla lotes_autorizados
    $msg = new messages();
    $response = new StdClass();
    /*recibimos variables*/
    $cod = $_POST["cod"];
    if ($cod == "") {
        $res = false;
        $mes = $msg->get_msg("e005");
    } else {
        $con = new con();
        $con->connect();
        /* Consultamos los supervisores */
        $qry = "SELECT * FROM tbl_supervisores WHERE su_fi_id=" . $cod . " AND su_estado=1;";
        $resp = mysql_query($qry);
        $cant = mysql_num_rows($resp);
        if ($cant > 0) {
            $item = '';
            while ($row_resp = mysql_fetch_assoc($resp)) {
                $item .= '<option value="' . $row_resp["su_id"] . '">' . $row_resp["su_nombre"] . '</option>';
            }
            $html = '
			        <select class="form-control valued" id="sup">
			          ' . $item . '
			        </select>
			        <label for="sup" class="">Supervisor</label>
			    ';
            $res = true;
            $mes = $html;
        } else {
            $res = false;
            $mes = $msg->get_msg("e010");
        }
    }
    $response->res = $res;
    $response->mes = $mes;
    echo json_encode($response);
    $con->disconnect();
}
Exemplo n.º 17
0
<?php

session_start();
require "../php/funciones.php";
$fun = new funciones();
if (!$fun->isAjax()) {
    header("Location: ../pages/index.html");
}
//Verificamos si la peticion viene por get o por post
//modificacion requerida para refrescar tablas
if (isset($_GET['sala'])) {
    $sala = $_GET["sala"];
} else {
    $sala = $_POST['sala'];
}
$con = new con();
$con->connect();
$response = new StdClass();
/*Consulta a la Bd*/
$selectSQL = "SELECT FE.fe_pc,ES.es_nombre, ES.es_codigo, ES.es_plan, FE.fe_id FROM tbl_flujo_estudiantes FE\n\t\t\t\tInner Join tbl_estudiantes ES\n\t\t\t\tWHERE FE.fe_es_codigo = ES.es_codigo AND\n\t\t\t\tFE.fe_sala = " . $sala . " AND\n\t\t\t\tFE.fe_estado = 1;";
$row_cons = mysql_query($selectSQL);
while ($fila = mysql_fetch_array($row_cons)) {
    $codplan = $fila[2] . "-" . $fila[3];
    $arrayData[] = array('<button type="button" class="btn btn-primary"><i class="fa fa-desktop"></i>&nbsp;&nbsp;&nbsp;' . $fila[0] . '</button>', $fila[1], $fila[2] . "-" . $fila[3], '
				<button type="button" id="salida' . $fila[4] . '" onclick="registrar_salida(' . $fila[4] . ',' . $fila[2] . ',this);" title="Registrar Salida" class="btn btn-success btn-circle"><i class="fa fa-paper-plane-o"></i></button>
				<button type="button" id="borrar' . $fila[4] . '" onclick="borrar_registro(' . $fila[4] . ',' . $fila[2] . ',this);" title="Borrar Registro" class="btn btn-danger btn-circle"><i class="fa fa-trash"></i></button>
				');
}
#print_r($arrayData);
echo json_encode($arrayData);
$con->disconnect();
Exemplo n.º 18
0
<?php

session_start();
require "../php/funciones.php";
require "../semestre.php";
$fun = new funciones();
if (!$fun->isAjax()) {
    header("Location: ../pages/index.html");
}
$con = new con();
$con->connect();
$response = new StdClass();
$sala = 4;
$br = "<br>";
$mes = "";
$msg = "";
/* definimos variables */
$year_ini = date("Y", strtotime($semestre_ini));
$mnth_ini = date("m", strtotime($semestre_ini));
$dday_ini = date("m", strtotime($semestre_ini));
$year_fin = date("Y", strtotime($semestre_fin));
$mnth_fin = date("m", strtotime($semestre_fin));
$dday_fin = date("m", strtotime($semestre_fin));
$ini_semestre = date("Y-m-d", strtotime($semestre_ini));
$fin_semestre = date("Y-m-d", strtotime($semestre_fin));
for ($h = 8; $h <= 21; $h++) {
    #Ciclo Hora
    /* Lanzamos query Agrupado por horas */
    $qry = "SELECT COUNT(*) AS Cantidad FROM tbl_flujo_estudiantes WHERE fe_sala=" . $sala . " AND fe_hora_entrada BETWEEN '" . $h . ":00:00' AND '" . $h . ":59:59';";
    $msg .= $br . $qry;
    $result = mysql_query($qry, $con->connect());
Exemplo n.º 19
0
    function build_menu()
    {
        $con = new con();
        $msg = new messages();
        $rt = new route();
        $con->connect();
        //consultamos sesión del usuario
        if (isset($_SESSION["ses_id"])) {
            $qry = 'SELECT * FROM tbl_modulos AS M
            INNER JOIN tbl_usuarios AS U
            INNER JOIN tbl_permisos AS P
            INNER JOIN tbl_per_x_usu AS PxU
            INNER JOIN tbl_permisos_x_modulo AS PxM
            WHERE M.mo_id = PxM.pxm_mo_id 
            AND PxM.pxm_pe_id = P.pe_id
            AND P.pe_id = PxU.pxu_pe_id
            AND PxU.pxu_us_id = U.us_id
            AND U.us_id = ' . $_SESSION["ses_id"];
            $res = mysql_query($qry);
            $menuitem = " ";
            $script = "<script>\$(document).ready(function(){";
            while ($row_res = mysql_fetch_assoc($res)) {
                $tipo_us = $row_res['pxu_pe_id'];
                //$menuitem.='<li><a href="'.$row_res['mo_ruta'].'" class="">'.$row_res['mo_nombre'].'</a></li>';
                $menuitem .= '<li><a href="#" id="' . $row_res['mo_nombre'] . '" class="">' . $row_res['mo_descripcion'] . '</a></li>';
                $script .= '$("#' . $row_res['mo_nombre'] . '").on("click", function(){$(location).attr("href","' . $row_res['mo_ruta'] . '"); });';
            }
            $script .= '});</script>';
        } else {
            $rt->routing($rt->path("login"));
        }
        //generamos menú tipo dropdown para el usuario gerente
        if ($tipo_us == 1) {
            $dropdown = '<li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Gestionar <span class="caret"></span></a>
                    <ul class="dropdown-menu" role="menu">
                    ' . $menuitem . '
                    </ul>
                  </li>
                  <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Reportes <span class="caret"></span></a>
                    <ul class="dropdown-menu" role="menu">
                      <li><a onclick="reporte(1)" target="_blank" id="" class="">Reporte de Consecutivos ICA generados</a></li>              
                      <li><a onclick="reporte(2)" target="_blank" id="" class="">Reporte de Despachos Generados</a></li>
                    </ul>
                  </li>
                  <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Programación (Cronjobs) <span class="caret"></span></a>
                    <ul class="dropdown-menu" role="menu">
                      <li><a onclick="go_cj_r()" target="">Despachos</a></li>              
                      <li><a onclick="go_cj_i()" target="">Consecutivos ICA</a></li>              
                    </ul>
                  </li>';
            $menuitem = $dropdown;
        }
        $html = '
            <nav class="navbar navbar-inverse">
              <div class="container-fluid">
                <div class="navbar-header">
                  <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-2">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                  </button>
                </div>

                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-2">
                  <ul class="nav navbar-nav">
                  ' . $menuitem . '
                  </ul>
                  <ul class="nav navbar-nav navbar-right">
                    
                    <li><a href="#" id="reloj">fecha / hora</a></li>
                  </ul>
                </div>
              </div>
            </nav>
    ';
        $con->disconnect();
        return $script . $html;
    }
Exemplo n.º 20
0
function count_2($var)
{
    $var++;
}
$c = 5;
count_2($c);
echo $c;
// kết quả sẽ là 5
?>

<?php 
class cha
{
    public $ten_cha = "toi la cha";
    public function test()
    {
        echo $this->ten_cha . "<br />";
    }
}
class con extends cha
{
    public $ten_con = 'toi la con';
    public function test()
    {
        parent::test();
        //phuong thuc test la cua class cha
        echo $this->ten_con . "<br />";
    }
}
$a = new con();
$a->test();
Exemplo n.º 21
0
 function get_options_vehiculos($id = 'cod_prop')
 {
     $con = new con();
     $msg = new messages();
     $rt = new route();
     $con->connect();
     //consultamos fincas desde la matriz ica
     if (isset($_SESSION["ses_id"])) {
         $qry = 'SELECT DISTINCT ve_id, ve_placa, ve_capacidad_m3 FROM tbl_vehiculos WHERE ve_estado=1 ORDER BY ve_placa ASC';
         $res = mysql_query($qry);
         $item = " ";
         $script = "<script>\$(document).ready(function(){";
         while ($row_res = mysql_fetch_assoc($res)) {
             $item .= '
           <option value="' . $row_res["ve_id"] . '">' . $row_res["ve_placa"] . ' (Capacidad: ' . $row_res["ve_capacidad_m3"] . ' m<sup>3</sup>)</option>
     ';
             $script .= '';
         }
         $script .= '});</script>';
     } else {
         $rt->routing($rt->path("login"));
     }
     $html = '
     <select class="form-control valued" id="' . $id . '">
       ' . $item . '
     </select>
 ';
     $con->disconnect();
     return $script . $html;
 }
Exemplo n.º 22
0
 function programar_rutas()
 {
     $con = new con();
     $msg = new messages();
     $fun = new funciones();
     $con->connect();
     //Fecha
     date_default_timezone_set("America/Bogota");
     $fecha = date('Y-m-d G:i:s');
     $filename = "R_" . date('YmdGis');
     $filename .= ".html";
     $content = "";
     $hoy = date('Y-m-d');
     $content .= "<h1>Informe, generacion de rutas</h1>";
     $content .= "<br>Fecha " . $fecha . "<br>";
     //traemos municipios
     $qry_sn = "SELECT * FROM tbl_subnucleos ORDER BY sn_id ASC";
     $res_sn = $fun->get_array($qry_sn);
     if (!$res_sn) {
         $content .= $msg->get_msg("e025");
     } else {
         //($res_sn);
         //cantidad de sn:
         $cant_sn = count($res_sn);
         $content .= "Total Municipios: " . $cant_sn . "<br>";
         for ($i = 0; $i < $cant_sn; $i++) {
             $content .= "<h1>municipio nro: " . $res_sn[$i]["sn_id"] . "";
             $content .= "=> " . $res_sn[$i]["sn_subnucleo"] . "</h1><br>";
             //traemos conductores asociados
             $qry_con = 'SELECT * FROM tbl_personas 
     			INNER JOIN tbl_vehiculos ON ve_id = pe_ve_id
     			WHERE 
             pe_f1 = ' . $res_sn[$i]["sn_id"] . ' OR 
             pe_f2 = ' . $res_sn[$i]["sn_id"] . '
           ;';
             //$content.= $qry_con;
             /*HACE FALTA LA DOBLE VALIDACIÓN DE QUE ESTE NO ESTÉ ASIGNADO O SUGERIDO A OTRA FINCA*/
             $res_con = $fun->get_array($qry_con);
             $cant_con = count($res_con);
             $content .= "<br> cantidad de conductores: " . $cant_con;
             //para cada subnucleo, listamos sus respectivas fincas
             $qry_fin = 'SELECT * FROM tbl_fincas WHERE fi_sn_id = ' . $res_sn[$i]["sn_id"] . ';';
             $res_fin = $fun->get_array($qry_fin);
             //traemos inventarios por cada finca
             $cant_fin = count($res_fin);
             $content .= "<br> cantidad de fincas: " . $cant_fin . "<br>";
             $arr_inv = array();
             $pos = 0;
             $c = 0;
             for ($j = 0; $j < $cant_fin; $j++) {
                 $qry_inv = 'SELECT * FROM tbl_inventario WHERE in_fi_id = ' . $res_fin[$j]["fi_id"] . ' AND in_mt_restante > 0 AND in_estado=1;';
                 //$content.= $qry_inv;
                 $res_inv = $fun->get_array($qry_inv);
                 $c = count($res_inv);
                 if ($c > 1) {
                     $pos = $pos + $c;
                     for ($k = 0; $k < $pos; $k++) {
                         $arr_inv[$k] = $res_inv[$k];
                     }
                 }
                 if ($c == 1) {
                     $arr_inv[$pos] = $res_inv[0];
                     $pos++;
                 }
             }
             $cant_inv = count($arr_inv);
             $content .= "<br> <h4>cantidad de inventarios de este municipio: " . $cant_inv . "</h4>";
             /*$content.= "<pre>";
               print_r($arr_inv);
               $content.= "</pre>";*/
             //traemos turnos
             $qry_tur = 'SELECT * FROM tbl_turnos ORDER BY tu_id ASC';
             $res_tur = $fun->get_array($qry_tur);
             //variables de sesión para cada inventario
             for ($ci = 0; $ci < $cant_inv; $ci++) {
                 $id_inv = $arr_inv[$ci]["in_id"];
                 $_SESSION[$id_inv]["inv_rest"] = $arr_inv[$ci]["in_mt_restante"];
                 //$content.= "<br>prueba variable sesion".$_SESSION[$id_inv]["inv_rest"];
             }
             //recorremos arreglo y vamos asignando conductores
             if ($cant_inv > 0) {
                 $turno = 0;
                 $tg = 0;
                 for ($doblete = 0; $doblete < 2; $doblete++) {
                     $end = false;
                     $l = 0;
                     while ($end == false) {
                         for ($m = 0; $m < $cant_inv; $m++) {
                             if ($l == $cant_con) {
                                 $end = true;
                                 break;
                             }
                             //traemos inventario restante
                             //$inv_rest = $fun->get_custom("SELECT in_mt_restante FROM tbl_inventario WHERE in_id=".$arr_inv[$m]["in_id"]);
                             $inv_rest = $_SESSION[$arr_inv[$m]["in_id"]]["inv_rest"];
                             if ($inv_rest > 0) {
                                 $inv_nuevo = $inv_rest - $res_con[$l]["ve_capacidad_m3"];
                                 if ($inv_nuevo >= 0) {
                                     $content .= "<pre>";
                                     $content .= "<br> ----> [" . $l . "] asignando cond " . $res_con[$l]["pe_id"] . " (cap. " . $res_con[$l]["ve_capacidad_m3"] . "m<sup>3</sup>) a inventario " . $arr_inv[$m]["in_id"] . " en el turno (" . $turno . "): " . $res_tur[$turno]["tu_hora_ini"] . "\n\t\t\t\t        \t\t\tinventario restante: " . $inv_nuevo;
                                     $content .= "<br><strong>Actualizacion de inventario tbl_inventario, in_mt_restante =" . $inv_nuevo . "</strong> => resultado: ";
                                     //$upd_vol = $fun->actualizar("inventario", "in_mt_restante =".$inv_nuevo, "in_id = ".$arr_inv[$m]["in_id"]);
                                     $_SESSION[$arr_inv[$m]["in_id"]]["inv_rest"] = $inv_nuevo;
                                     //cargamos en despachos como sugerencia [estado=1]
                                     $tbl_des = 'despachos';
                                     $fld_des = 'de_pe_id, de_ve_capacidad_m3, de_in_id, de_tu_id, de_inv_rest, de_created, de_estado';
                                     $val_des = $res_con[$l]["pe_id"] . ',' . $res_con[$l]["ve_capacidad_m3"] . ',' . $arr_inv[$m]["in_id"] . ',' . $res_tur[$turno]["tu_id"] . ',' . $inv_nuevo . ',' . $_SESSION["ses_id"] . ',1';
                                     $res_des = $fun->crear($tbl_des, $fld_des, $val_des);
                                     //$content.= "<br>Probando SESSION VAR: inventario restante del inventario (".$arr_inv[$m]["in_id"].") :".$_SESSION[$arr_inv[$m]["in_id"]]["inv_rest"]."<br>";
                                     $res_des = true;
                                     if ($res_des) {
                                         $tg++;
                                     } else {
                                         $content .= "(error)";
                                     }
                                 }
                             } else {
                                 $m++;
                             }
                             $l++;
                         }
                         $turno++;
                     }
                 }
                 $content .= "<h3>Total turnos generados: " . $tg . "</h3>";
             }
             $content .= "<br>+++++++++++++++++++++++++++++++++++++++++++++++++++++++<br>";
         }
     }
     // generamos informe
     $fun->create_file($content, $filename);
     //echo $content;
     $con->disconnect();
     unset($arr_inv);
 }
Exemplo n.º 23
0
 function crear($tbl, $fields, $values)
 {
     $con = new con();
     $con->connect();
     //preguntamos si existe la finca en la matriz entregada
     $selectSQL = "INSERT INTO tbl_" . $tbl . " (" . $fields . ") VALUES (" . $values . ");";
     //echo $selectSQL;
     $res_cons = mysql_query($selectSQL);
     if ($res_cons) {
         $respuesta = true;
     } else {
         $respuesta = false;
     }
     /*Termina Consulta*/
     return $respuesta;
 }
Exemplo n.º 24
0
  <tr>
    <td class="tg-031e" colspan="4"><strong>Correo Institucional: </strong>' . $email . '</td>
  </tr>
  <tr>
    <td class="tg-031e" colspan="4"><strong>Fecha de Reservaci&oacute;n: </strong>' . $fReserva . '</td>
  </tr>
  <tr>
    <td class="tg-vn4c"><strong>Edificio: </strong>' . $r_edif . '</td>
    <td class="tg-vn4c"><strong>Sal&oacute;n: </strong>' . $r_salon . '</td>
    <td class="tg-vn4c"><strong>Hora Inicio: </strong>' . $desde . '</td>
    <td class="tg-vn4c"><strong>Hora Fin</strong>' . $hasta . '</td>
  </tr>
</table>
';
$mensaje = $html;
$con = new con();
$con->connect();
$fx = new funciones();
$response = new StdClass();
$fReserva = mysql_real_escape_string($fReserva, $con->connect());
$sql = "INSERT INTO tbl_reservas (re_tipo_sol, re_nombre, re_cargo, re_tid, re_nid, re_edificio, re_oficina, re_tel, re_ext, re_email, re_fecha_reserva, re_edificio_reserva, re_salon_reserva, re_desde, re_hasta, re_log_fecha, re_estado) \n\t\t\t  VALUES (" . $tipoSol . ",'" . $nombre . "','" . $cargo . "'," . $tid . "," . $id . "," . $edificio . "," . $oficina . "," . $tel . "," . $ext . ",'" . $email . "','" . $fReserva . "'," . $r_edif . "," . $r_salon . ",'" . $desde . "','" . $hasta . "',NOW(),1)";
if (mysql_query($sql)) {
    if ($fx->enviar_email($para, $titulo, $mensaje)) {
        //mail($fw_para, $fw_titulo, $fw_mensaje, $fw_cabeceras);
        $response->res = "true";
        $response->msg = 'Enviado Satisfactoriamente.';
    } else {
        $response->msg = 'Hubo problemas al enviar su solicitud, favor intentar m&aacute;s tarde.';
        $response->res = "false";
    }
} else {
Exemplo n.º 25
0
function imcEntry()
{
    $link = new con();
    $con = $link->getConnection();
    $array = [];
    $i = 0;
    $query = 'select times.* , cinejoin.title
from times
inner join cinejoin
on times.id = cinejoin.id;';
    $result = mysqli_query($con, $query);
    while ($row = mysqli_fetch_array($result)) {
        $arrayT[$i]['title'] = preg_replace("~FLS~", "", $row['title']);
        $arrayB[$i]['title'] = preg_replace("~\\s~", "", $arrayT[$i]['title'], 1);
        $trimmedString = rtrim($arrayB[$i]['title']);
        $array[$i]['title'] = preg_replace('~\\s~', '_', $trimmedString);
        //capitalise first letter
        $array[$i]['venue'] = ucfirst(strtolower($row['venue']));
        $arrayT[$i]['time'] = preg_replace('~:~', "", $row['time']);
        $array[$i]['time'] = intval($arrayT[$i]['time']);
        $array[$i]['day'] = $row['day'];
        $array[$i]['month'] = $row['month'];
        $array[$i]['year'] = $row['year'];
        if ($array[$i]['title'] === "Batman_Vs_Superman_Dawn_Of_Justice__" || $array[$i]['title'] === "Batman_Vs_Superman_Dawn_Of_Justice") {
            $array[$i]['title'] = "Batman_V_Superman:_Dawn_Of_Justice";
        } else {
            if ($array[$i]['title'] === "Grimsby__" || $array[$i]['title'] === "Grimbsy_" || $array[$i]['title'] === "Grimbsy") {
                $array[$i]['title'] = "The_Brothers_Grimsby";
            } else {
                if ($array[$i]['title'] === "Hail_Caeser__" || $array[$i]['title'] === "Hail_Caeser_" || $array[$i]['title'] === "Hail_Caeser") {
                    $array[$i]['title'] = "Hail,_Caesar!";
                } else {
                    if ($array[$i]['title'] === "Zootropolis" || $array[$i]['title'] === "Zootropolis_" || $array[$i]['title'] === "Zootropolis__") {
                        $array[$i]['title'] = "Zootopia";
                    }
                }
            }
        }
        $i++;
    }
    $content = "";
    $z = 1;
    for ($i = 0; $i < count($array); $i++) {
        $content .= "('" . $array[$i]['title'] . "','" . $array[$i]['venue'] . "','" . $array[$i]['time'] . "'," . $array[$i]['year'] . "," . $array[$i]['day'] . "," . $array[$i]['month'] . ", 'Imc')";
        if ($z < count($array)) {
            $content .= ",";
        }
        $z++;
    }
    $query = "insert into catalog (title, venue, time, year, day, month, cinema) values " . $content;
    #print_r($content);
    $result = mysqli_query($con, $query);
}
Exemplo n.º 26
0
function change_usuario($opt = null)
{
    $fun = new funciones();
    $msg = new messages();
    $response = new StdClass();
    /*recibimos variables*/
    $user = $_POST["user"];
    $pass = $_POST["ch_pass"];
    //Encriptamos clave
    $pass = sha1(md5($pass));
    $con = new con();
    $con->connect();
    $qry = 'UPDATE tbl_usuarios 
				SET us_clave="' . $pass . '" WHERE us_id=' . $user . ';';
    $res = mysql_query($qry);
    if ($res) {
        $res = true;
        $mes = $msg->get_msg("e004");
    } else {
        $res = false;
        $mes = $msg->get_msg("e013");
    }
    $con->disconnect();
    $response->res = $res;
    $response->mes = $mes;
    echo json_encode($response);
}
Exemplo n.º 27
0
<?php

session_start();
require "../php/funciones.php";
require "../semestre.php";
$fun = new funciones();
if (!$fun->isAjax()) {
    header("Location: ../pages/index.html");
}
$con = new con();
$con->connect();
$response = new StdClass();
/* GET */
$sala = $_POST['s'];
$mes = $_POST['m'];
$ini = $_POST['i'];
$fin = $_POST['f'];
$day = split(" ", $semestre_ini);
$sem_i = $day[0];
$sem_f = $semestre_fin;
$a = $fun->get_total_students_x_dh($sala, $mes, "Lunes", $ini, $fin);
$b = $fun->get_total_students_x_dh($sala, $mes, "Martes", $ini, $fin);
$c = $fun->get_total_students_x_dh($sala, $mes, "Miercoles", $ini, $fin);
$d = $fun->get_total_students_x_dh($sala, $mes, "Jueves", $ini, $fin);
$e = $fun->get_total_students_x_dh($sala, $mes, "Viernes", $ini, $fin);
$arr_cant = array($a, $b, $c, $d, $e);
$response->rows = $arr_cant;
echo json_encode($response);
Exemplo n.º 28
0
    function build_menu_aside()
    {
        $con = new con();
        $msg = new messages();
        $rt = new route();
        $con->connect();
        //consultamos sesión del usuario
        if (isset($_SESSION["ses_id"])) {
            $qry = 'SELECT * FROM tbl_modulos AS M
            INNER JOIN tbl_usuarios AS U
            INNER JOIN tbl_permisos AS P
            INNER JOIN tbl_per_x_usu AS PxU
            INNER JOIN tbl_permisos_x_modulo AS PxM
            WHERE M.mo_id = PxM.pxm_mo_id 
            AND PxM.pxm_pe_id = P.pe_id
            AND P.pe_id = PxU.pxu_pe_id
            AND PxU.pxu_us_id = U.us_id
            AND U.us_id = ' . $_SESSION["ses_id"] . ' LIMIT 1';
            $res = mysql_query($qry);
            $menuitem = " ";
            $script = "<script>\$(document).ready(function(){";
            while ($row_res = mysql_fetch_assoc($res)) {
                $cargo = $row_res['pe_descripcion'];
                $nombre = $row_res['us_nombre'];
                //si es superadmin, le habilitamos el menú de gestión de usuarios y permisos
                switch ($row_res['pe_permiso']) {
                    case 1:
                        //superAdmin
                        $script .= '$("#usuarios").on("click", function(){$(location).attr("href","../users/users.php"); });';
                        $script .= '$("#reportar").on("click", function(){$(location).attr("href","../reportar/reportar.php"); });';
                        $menuitem .= '<li><a href="#" id="usuarios" class=""><i class="md md-user"></i>Usuarios</a></li>';
                        $menuitem .= '<li><a href="#" id="reportar" class=""><i class="md md-user"></i>Reportar Consecutivo</a></li>';
                        $icon = '<a href="#" class="btn btn-floating-mini btn-warning" title="' . $row_res['pe_descripcion'] . '" data-ripple-centered=""><i class="md md-account-circle"></i></a>';
                        break;
                    case 2:
                        //Jefeop
                        $icon = '<a href="#" class="btn btn-floating-mini btn-primary" title="' . $row_res['pe_descripcion'] . '" data-ripple-centered=""><i class="md md-account-circle"></i></a>';
                        break;
                    case 3:
                        //Digit
                        $icon = '<a href="#" class="btn btn-floating-mini btn-success" title="' . $row_res['pe_descripcion'] . '" data-ripple-centered=""><i class="md md-account-circle"></i></a>';
                        break;
                    case 4:
                        //Gerente
                        $icon = '<a href="#" class="btn btn-floating-mini btn-warning" title="' . $row_res['pe_descripcion'] . '" data-ripple-centered=""><i class="md md-account-circle"></i></a>';
                        break;
                    default:
                        $menuitem = "";
                        break;
                }
                /*$tipo_us = $row_res['pxu_pe_id'];
                  //$menuitem.='<li><a href="'.$row_res['mo_ruta'].'" class="">'.$row_res['mo_nombre'].'</a></li>';
                  $menuitem.='<li><a href="#" id="'.$row_res['mo_nombre'].'" class="">'.$row_res['mo_descripcion'].'</a></li>';
                  $script.='$("#'.$row_res['mo_nombre'].'").on("click", function(){$(location).attr("href","'.$row_res['mo_ruta'].'"); });';
                  */
            }
            $script .= '});</script>';
        } else {
            $rt->routing($rt->path("login"));
        }
        $html = '
	    <nav class="navbar-panel">
	      <div class="header container-fluid mtr-cyan-900">
	        <div class="row">
	          <div class="col-xs-12">
              <h1 style="text-align:center; padding-top:6px; margin-bottom: 6px;">' . $icon . '</h1>
              <h4 style="margin-top: 1px;"><b>' . $nombre . '</b> <br> <span style="font-style:italic; font-size:13px;">' . $cargo . '<span></h4>
              <h4></h4>
	          </div>
	        </div>
	      </div>

	      <div class="content mtr-grey-100">
	        <ul class="nav">
            ' . $menuitem . '
	          <li><a href="#" id="btn_logout">Salir</a></li>
	        </ul>
	      </div>
	    </nav>
    ';
        $con->disconnect();
        return $script . $html;
    }
Exemplo n.º 29
0
function load_row()
{
    $fun = new funciones();
    $msg = new messages();
    $response = new StdClass();
    /*recibimos variables*/
    $id = $_POST["id"];
    if ($id == "") {
        $res = false;
        $mes = $msg->get_msg("e005");
    } else {
        $con = new con();
        $con->connect();
        //traemos datos según sea el id
        $qry = "SELECT * FROM `tbl_remisiones_fisicas` WHERE rf_id =" . $id . ";";
        $data = $fun->get_array($qry);
        if ($data != false) {
            $res = true;
            $response->key = $data[0]['rf_id'];
            $response->ini = $data[0]['rf_dig_ini'];
            $response->fin = $data[0]['rf_dig_fin'];
            $response->inter = $data[0]['rf_interventor'];
            $response->persona = $data[0]['rf_persona_entrega'];
        } else {
            $res = false;
            $response->mes = $msg->get_msg("e034");
        }
    }
    $response->res = $res;
    echo json_encode($response);
    $con->disconnect();
}
Exemplo n.º 30
0
 function get_rfisicas()
 {
     $con = new con();
     $msg = new messages();
     $rt = new route();
     $con->connect();
     //consultamos fincas
     if (isset($_SESSION["ses_id"])) {
         $qry = 'SELECT * FROM tbl_remisiones_fisicas ORDER BY rf_estado DESC ';
         $res = mysql_query($qry);
         $item = " ";
         $script = "<script>\$(document).ready(function(){";
         while ($row_res = mysql_fetch_assoc($res)) {
             $denominador = $row_res["rf_dig_fin"] - $row_res["rf_dig_ini"];
             //calculamos porcentaje de uso
             if ($denominador > 0) {
                 $porcentaje = $row_res["rf_cant_usados"] * 100 / $denominador;
             } else {
                 $porcentaje = 0;
             }
             //echo "datos: <br> -usados: ".$row_res["rf_cant_usados"]."<br>-fin: ".$row_res["rf_dig_fin"]."<br>-ini: ".$row_res["rf_dig_ini"];
             //boton de activacion/desactivación
             if ($row_res["rf_estado"] == 1) {
                 $btn = '<div id="act-button" style="display:" onclick="change(1, ' . $row_res['rf_id'] . ')" class="btn btn-floating-mini btn-success" title="Activar Paquete"><i class="md  md-done"></i></div>
               <div id="des-button" style="display:none" onclick="change(2, ' . $row_res['rf_id'] . ')" class="btn btn-floating-mini btn-warning" title="Desactivar Paquete"><i class="md  md-close"></i></div>';
             } else {
                 $btn = '<div id="act-button" style="display:none" onclick="change(1, ' . $row_res['rf_id'] . ')" class="btn btn-floating-mini btn-success" title="Activar Paquete"><i class="md  md-done"></i></div>
               <div id="des-button" style="display:" onclick="change(2, ' . $row_res['rf_id'] . ')" class="btn btn-floating-mini btn-warning" title="Desactivar Paquete"><i class="md  md-close"></i></div>';
             }
             $btn_edt = '<div id="act-button" onclick="load_row(' . $row_res['rf_id'] . ')" class="btn btn-floating-mini btn-info" title="Modificar Paquete"><i class="md  md-edit"></i></div>';
             //--
             $item .= '
           <tr>
             <td>' . $row_res["rf_timestamp"] . '</td>
             <td>' . $row_res["rf_persona_entrega"] . '</td>
             <td>' . $row_res["rf_interventor"] . '</td>
             <td>' . $row_res["rf_dig_ini"] . '</td>
             <td>' . $row_res["rf_dig_fin"] . '</td>
             <td><div class="progress progress-striped active">
                   <div class="progress-bar" title="' . $row_res["rf_cant_usados"] . '  (' . $porcentaje . '%)" style="width: ' . $porcentaje . '%; height:10px;"></div>
                 </div>
             </td>
             <td>
             ' . $btn_edt . $btn . '
             </td>
           </tr>
     ';
             $script .= '';
         }
         $script .= '});</script>';
     } else {
         $rt->routing($rt->path("login"));
     }
     $html = '
       <table class="table table-striped table-hover ">
         <thead>
           <tr>
             <th>Fecha Registro</th>
             <th>Recibido</th>
             <th>Interventor</th>
             <th>Inicia</th>
             <th>Termina</th>
             <th>Usados</th>
             <th>Acciones</th>
           </tr>
         </thead>
         <tbody>
           ' . $item . '
         </tbody>
       </table> 
 ';
     $con->disconnect();
     return $script . $html;
 }