Example #1
0
$where_folio = $folio ? " AND t1.id={$folio} " : '';
$where_fecha = " ";
switch ($ctrlList) {
    case 'resultados':
        $data = array();
        $th = array();
        if (@$_GET["fecha"] != "") {
            $fecha1 = date("Y-m-d H:i:s", strtotime($_GET["fecha"]));
            $fecha2 = date("Y-m-d H:i:s", strtotime($_GET["fecha"] . " + 1 day -1 sec"));
            $where_fecha = " AND t1.FECHA_IN BETWEEN '{$fecha1}' AND '{$fecha2}' ";
            $sql = "SELECT\n\t\t\t\tt1.id as FOLIO,\n\t\t\t\tt1.CLIENTE_ID,\n\t\t\t\tCONCAT(t2.NOMBRE,' ',t2.APELLIDOS) AS NOMBRE,\n\t\t\t\tt2.GENERO,\n\t\t\t\tdate_format(t5.FECHA_ATENCION,'%d/%m/%Y') as FECHA_ATENCION,\n\t\t\t\tt3.NOMBRE as CONCEPTO,\n\t\t\t\tt1.*,\n\t\t\t\tt4.*\n\t\t\tFROM examenes t1\n\t\t\tINNER JOIN pacientes t2 ON t1.PACIENTE_ID=t2.PACIENTE_ID\n\t\t\tINNER JOIN conceptos t3 ON t1.CONCEPTO_ID=t3.CONCEPTO_ID\n\t\t\tLEFT JOIN resultados t4 ON t1.id=t4.EXAMEN_ID\n\t\t\tLEFT JOIN examenes_adminte t5 ON t1.id=t5.FOLIO_RASTREO\n\t\t\t{$where_cliente}\n\t\t\t{$where_fecha}\n\t\t\t{$where_folio}\n\t\t\t{$orderby};";
        } else {
            $sql = "SELECT\n\t\t\t\tt1.id as FOLIO,\n\t\t\t\tt1.CLIENTE_ID,\n\t\t\t\tCONCAT(t2.NOMBRE,' ',t2.APELLIDOS) AS NOMBRE,\n\t\t\t\tt2.GENERO,\n\t\t\t\tdate_format(t5.FECHA_ATENCION,'%d/%m/%Y') as FECHA_ATENCION,\n\t\t\t\tt3.NOMBRE as CONCEPTO,\n\t\t\t\tt1.*,\n\t\t\t\tt4.*\n\t\t\tFROM examenes t1\n\t\t\tINNER JOIN pacientes t2 ON t1.PACIENTE_ID=t2.PACIENTE_ID\n\t\t\tINNER JOIN conceptos t3 ON t1.CONCEPTO_ID=t3.CONCEPTO_ID\n\t\t\tLEFT JOIN resultados t4 ON t1.id=t4.EXAMEN_ID\n\t\t\tLEFT JOIN examenes_adminte t5 ON t1.id=t5.FOLIO_RASTREO\n\t\t\t{$where_cliente}\n\t\t\t{$where_nombre}\n\t\t\t{$where_folio}\n\t\t\t{$orderby};";
        }
        #preparamos toda la info
        $r = $rBD->query2array($sql);
        foreach ($r["data"] as $id => $d) {
            //cambiamos el id del
            $rowId = $d["id"];
            //valores para rellenar campos
            $relleno[] = array("EXAMEN_ID" => $d["EXAMEN_ID"], "resultado" => $d["resultado"], "razon_uno" => $d["razon_uno"], "razon_dos" => $d["razon_dos"], "hallazgos" => $d["hallazgos"]);
            unset($d["EXAMEN_ID"], $d["razon_uno"], $d["razon_dos"], $d["hallazgos"], $d["resultado"]);
            //si no hay folio hay que poner el radio button
            if (!$folio) {
                $data[$rowId]["modif"] = "<input type='radio' class='check' name='folio' value='" . $rowId . "' />";
            }
            //valores para lista
            foreach ($d as $c => $v) {
                $data[$rowId][$c] = $v;
            }
            //AÑADIR LOS CAMPOS PARA LLENAR por el doctor
Example #2
0
            break;
        case 'buscaEmp':
            $prev = $consultas[$sql];
            $cons = str_replace('%%', "%{$hint}%", $prev);
            break;
        case 'conceptos':
            $prev = $consultas[$sql];
            $cons = str_replace('%%', $hint, $prev);
            break;
        case 'rastrear':
            $prev = $consultas[$sql];
            $cons = str_replace('_id', $hint, $prev);
            break;
        case '':
            break;
    }
    $bd = new formas($dsnReader);
    $r = $bd->query2array($cons);
} elseif ($_GET["sql"]) {
    $sql = $_GET["sql"];
    switch ($sql) {
        case 'updateAdminte':
            $cons = $consultas[$sql];
            break;
    }
    $bd = new formas($dsnReader);
    $r = $bd->query2array($cons);
} else {
    $r = array("err" => true, "data" => array(), "msg" => "SQL no especificado");
}
echo json_encode($r);
Example #3
0
include "includes/class.table.php";
$rBD = new formas($dsnReader);
$wBD = new formas($dsnWriter);
$TE = new listas();
//sección del post para el json
$jsonPost = array();
$post = isset($_POST["row"]) ? $_POST["row"] : array();
foreach ($post as $d) {
    $jsonPost[] = (array) json_decode($d);
}
$jsonPost = json_encode($jsonPost);
$cliente = isset($_SESSION["sd"]) ? $_SESSION["sd"] : 0;
//datos para superadmin
if ($view->super()) {
    $empresas = $rBD->query2opt("SELECT CLIENTE_ID, NOMBRE FROM empresas;", array("CLIENTE_ID", "NOMBRE"));
    $pacientes = $rBD->query2array("SELECT * FROM pacientes;");
    $conceptos = $rBD->query2array("SELECT * FROM conceptos;");
} else {
    $where_pax = " WHERE CLIENTE_ID=" . $_SESSION["CLIENTE_ID"] . " AND PACIENTE_ID NOT IN (SELECT PACIENTE_ID FROM examenes WHERE CLIENTE_ID=" . $_SESSION["CLIENTE_ID"] . ")";
    $where_con = " WHERE CLIENTE_ID=" . $_SESSION["CLIENTE_ID"];
    $sql = "SELECT \n\t\t*, \n\t\tCONCAT(NOMBRE,' ',APELLIDOS) as NOMBRE \n\tFROM pacientes\n\t{$where_pax};";
    $pacientes = array();
    $pacientes = $rBD->query2array($sql);
    $conceptos = $rBD->query2array("SELECT * FROM conceptos {$where_con};");
}
foreach ($conceptos["data"] as $id => $v) {
    unset($conceptos["data"][$id]["id"]);
}
?>
<script type="text/javascript">
var labelw=0;